commit 245d0886b15388b4d8a1cd3f0fb0ea16f32f138e Author: chen <2659004835@qq.com> Date: Wed Dec 8 16:24:28 2021 +0800 新增canvas绘制图片、保存、分享 diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..e71886d Binary files /dev/null and b/.DS_Store differ diff --git a/app.js b/app.js new file mode 100644 index 0000000..dea4d17 --- /dev/null +++ b/app.js @@ -0,0 +1,11 @@ +//app.js +var urlPath = require('./config.js'); +App({ + globalData: { + isLogin : false + }, + onLaunch: function () { + var that = this; + wx.setStorageSync('urlPath', urlPath); + }, +}) \ No newline at end of file diff --git a/app.json b/app.json new file mode 100644 index 0000000..284c505 --- /dev/null +++ b/app.json @@ -0,0 +1,53 @@ +{ + "pages": [ + "pages/canvasposter/canvasposter", + "pages/index/index", + "pages/again/again", + "pages/sign/sign", + "pages/user/user", + "pages/rule/rule", + "pages/ranking/ranking", + "pages/picture/picture", + "pages/personal/personal", + "pages/auth/auth" + ], + "tabBar": { + "custom": true, + "color": "#7A7E83", + "selectedColor": "#3cc51f", + "borderStyle": "black", + "backgroundColor": "#ffffff", + "list": [{ + "pagePath": "pages/canvasposter/canvasposter", + "iconPath": "img/bg_w.png", + "selectedIconPath": "img/bg_b.png", + "text": "首页" + },{ + "pagePath": "pages/index/index", + "iconPath": "img/bg_w.png", + "selectedIconPath": "img/bg_b.png", + "text": "产品" + }, + { + "pagePath": "pages/ranking/ranking", + "iconPath": "img/bg_w.png", + "selectedIconPath": "img/bg_b.png", + "text": "排行榜" + }, + { + "pagePath": "pages/user/user", + "iconPath": "img/bg_w.png", + "selectedIconPath": "img/bg_b.png", + "text": "个人中心" + } + ] + }, + "window": { + "backgroundTextStyle": "light", + "navigationBarBackgroundColor": "#fff", + "navigationBarTitleText": "丰谷酒业", + "navigationBarTextStyle": "black" + }, + "style": "v2", + "sitemapLocation": "sitemap.json" +} diff --git a/app.wxss b/app.wxss new file mode 100644 index 0000000..e432794 --- /dev/null +++ b/app.wxss @@ -0,0 +1,120 @@ +.container{ + background: #eeeeee; + min-height: 100vh; + padding-bottom: 40rpx; +} +view,text,input,button,scroll-view,textarea{ + box-sizing: border-box; +} +.container button[disabled],.container button[disabled]:not([type]) { + background-color: #ccc; + color: #fff; +} +.top10{ + margin-top: 10rpx; +} +.top20{ + margin-top: 20rpx; +} +.top30{ + margin-top: 30rpx; +} +.top40{ + margin-top: 40rpx; +} +/**通用css**/ +view{ + box-sizing: border-box; +} +.view-bg{ + width: 690rpx; + position: relative; + background: #fff; + margin-left:auto; + margin-right: auto; + border-radius: 10rpx; + overflow: hidden; + padding-bottom: 40rpx; +} +/**/ +.countdown{ + width: 100%; + text-align: center; + padding: 40rpx 0; +} +.countdown .names{ + font-size: 30rpx; +} +.countdown .names text{ + background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfMAAAAJCAYAAAAmccWAAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyVpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDYuMC1jMDAyIDc5LjE2NDQ2MCwgMjAyMC8wNS8xMi0xNjowNDoxNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDIxLjIgKE1hY2ludG9zaCkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6Mzk0M0RGRkRGNEJDMTFFQUExNzhEOURGMjAwQUZGODIiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6Mzk0M0RGRkVGNEJDMTFFQUExNzhEOURGMjAwQUZGODIiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDozOTQzREZGQkY0QkMxMUVBQTE3OEQ5REYyMDBBRkY4MiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDozOTQzREZGQ0Y0QkMxMUVBQTE3OEQ5REYyMDBBRkY4MiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PhtKAecAAAElSURBVHja7Nu9asJQGMbxk+AN6FAoOHRTlGZz7A0InVoHR6eWDg6dewvq6N6OgmDpRXToVOiqOCjYoR8XUNInTQIOJe2Q4Q35/+AB5WR6Ai+exOOFYehgS3v8mn70laFyoTSUd2Wh3Cjb9KKX6wNKA8DcKTGfCszylFtlojST7zVloDwpR1QEgLmDnxvXGu1owaZzZZax/qCcUhMA5g7YmdvV/2O9q1SpCQBzBxXlWTmmikL+EDt08fssAMhD/R9z542azAnYmRfXl7KhBgA5WlNBcXfmATWYFL2Xus9Yj/5d+klNAHJ0p/Qy1ufKGTXZ43E0zZ69IyJT5fKXS1bKSboz54gIAOZOufGY3bYrFx8JeVQ+lKWLj4x0HI/YATB3kPgWYABV0EFs4jF8rAAAAABJRU5ErkJggg==") no-repeat center; + background-size:499rpx 10rpx; + display: inline-block; + width: 100%; +} +.countdown .time{ + color: #666666; + font-size: 32rpx; + height: 50rpx; + line-height: 50rpx; + margin-top: 30rpx; +} +.countdown .time text{ + height: 50rpx; + width: 50rpx; + display: inline-block; + background:#2a8de9; + border-radius: 4rpx; + color: #fff; + margin:0 6rpx; +} +.countdown .tab{ + display: inline-block; + width: 100%; + margin-top: 40rpx; +} +.countdown .tab .list{ + width: 33.33%; + float: left; + display: inline-block; + font-size: 50rpx; + border-right: 1rpx solid #ebebeb; + font-weight: bold; +} +.countdown .tab .list text{ + font-size: 24rpx; + color: #333333; + font-weight: 400; +} +.countdown .tab .list text:nth-child(2){ + display: block; + margin-top: 10rpx; +} +/**/ +.signup{ + width: 130rpx; + height: 50rpx; + line-height: 50rpx; + background: #ffc103; + color: #fff; + font-size: 26rpx; + border-radius: 15rpx 0 0 15rpx; + text-align: center; + position: fixed; + top: 460rpx; + right: 0; + box-shadow: 0 6rpx 6rpx rgba(0,0,0,.2); +} +.sign-rule{ + width: 130rpx; + height: 50rpx; + line-height: 50rpx; + background: #2A8DEB; + color: #fff; + font-size: 26rpx; + border-radius: 15rpx 0 0 15rpx; + text-align: center; + position: fixed; + top: 540rpx; + right: 0; + box-shadow: 0 6rpx 6rpx rgba(0,0,0,.2); +} \ No newline at end of file diff --git a/config.js b/config.js new file mode 100644 index 0000000..737a607 --- /dev/null +++ b/config.js @@ -0,0 +1,23 @@ +var host = "https://vote.daiguanyun.com"; +var host = "http://192.168.2.15:8810"; +var config = { + host:host, + getopenid: host + "/index/getOpenId", + getVoteList: host + '/index/rankList', + getSlideList: host + '/index/getSlideList', + getDetail: host + '/index/getOneById', + getImgs: host + '/index/getImgs', + getBaseInfo: host + '/index/getBaseInfo', + upload: host + '/index/upload', + saveProduction: host + '/index/saveProduction', + getUser: host + '/index/getUser', + vote : host + '/index/vote', + getUserById:host + '/index/getUserById', + getUserProduction: host + '/index/getUserProduction', + saveVisit: host + '/index/saveVisit', + search: host + '/index/search', + getBottleCategories: host + '/index/getBottleCategories',//酒瓶标题 + composeBottle: host + '/index/composeBottle',//保存图片 + getBottleWidgets: host + '/index/getBottleWidgets',//查询作品 +} +module.exports = config; \ No newline at end of file diff --git a/custom-tab-bar/index.js b/custom-tab-bar/index.js new file mode 100644 index 0000000..05cf828 --- /dev/null +++ b/custom-tab-bar/index.js @@ -0,0 +1,38 @@ +Component({ + data: { + selected: '-1', + color: "#7A7E83", + selectedColor: "#fff", + list: [{ + pagePath: "/pages/canvasposter/canvasposter", + iconPath: "/img/bg_w.png", + selectedIconPath: "/img/bg_b.png", + text: "首页" + },{ + pagePath: "/pages/index/index", + iconPath: "/img/bg_w.png", + selectedIconPath: "/img/bg_b.png", + text: "产品" + }, { + pagePath: "/pages/ranking/ranking", + iconPath: "/img/bg_w.png", + selectedIconPath: "/img/bg_b.png", + text: "排行榜" + }, { + pagePath: "/pages/user/user", + iconPath: "/img/bg_w.png", + selectedIconPath: "/img/bg_b.png", + text: "个人中心" + }] + }, + attached() {}, + methods: { + switchTab(e) { + const data = e.currentTarget.dataset + const url = data.path + wx.switchTab({ + url + }) //可能是改变样式的原因 + } + } +}) diff --git a/custom-tab-bar/index.json b/custom-tab-bar/index.json new file mode 100644 index 0000000..32640e0 --- /dev/null +++ b/custom-tab-bar/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} \ No newline at end of file diff --git a/custom-tab-bar/index.wxml b/custom-tab-bar/index.wxml new file mode 100644 index 0000000..79d688c --- /dev/null +++ b/custom-tab-bar/index.wxml @@ -0,0 +1,8 @@ + + + + + {{item.text}} + + diff --git a/custom-tab-bar/index.wxss b/custom-tab-bar/index.wxss new file mode 100644 index 0000000..b7fb156 --- /dev/null +++ b/custom-tab-bar/index.wxss @@ -0,0 +1,37 @@ +.tab-bar { + position: fixed; + bottom: 0; + left: 0; + right: 0; + height: 89rpx; + background: white; + display: flex; + box-shadow: 0 -10rpx 10rpx rgba(0,0,0,.1); +} + + +.tab-bar-item { + flex: 1; + text-align: center; + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; +} + +.tab-bar-item cover-image { + width: 100%; + height: 91rpx; +} + +.tab-bar-item cover-view { + position: relative; + top: 0; + width: 100%; + left: 0; + height: 90rpx; + line-height: 90rpx; + font-size: 30rpx; + z-index: 99; + margin-top: -90rpx; +} diff --git a/img/.DS_Store b/img/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/img/.DS_Store differ diff --git a/img/background/2.png b/img/background/2.png new file mode 100644 index 0000000..d398fc6 Binary files /dev/null and b/img/background/2.png differ diff --git a/img/background/3.png b/img/background/3.png new file mode 100644 index 0000000..6878d02 Binary files /dev/null and b/img/background/3.png differ diff --git a/img/banner.png b/img/banner.png new file mode 100644 index 0000000..ba53838 Binary files /dev/null and b/img/banner.png differ diff --git a/img/bg_b.png b/img/bg_b.png new file mode 100644 index 0000000..94692fb Binary files /dev/null and b/img/bg_b.png differ diff --git a/img/bg_w.png b/img/bg_w.png new file mode 100644 index 0000000..9b8bb1e Binary files /dev/null and b/img/bg_w.png differ diff --git a/img/button/1.png b/img/button/1.png new file mode 100644 index 0000000..bc049e2 Binary files /dev/null and b/img/button/1.png differ diff --git a/img/button/2.png b/img/button/2.png new file mode 100644 index 0000000..bf4eded Binary files /dev/null and b/img/button/2.png differ diff --git a/img/close-icon.png b/img/close-icon.png new file mode 100644 index 0000000..810fab7 Binary files /dev/null and b/img/close-icon.png differ diff --git a/img/decorate/1.png b/img/decorate/1.png new file mode 100644 index 0000000..7efb0ab Binary files /dev/null and b/img/decorate/1.png differ diff --git a/img/decorate/2.png b/img/decorate/2.png new file mode 100644 index 0000000..f97f423 Binary files /dev/null and b/img/decorate/2.png differ diff --git a/img/decorate/3.png b/img/decorate/3.png new file mode 100644 index 0000000..4ac0ef4 Binary files /dev/null and b/img/decorate/3.png differ diff --git a/img/download-icon.png b/img/download-icon.png new file mode 100644 index 0000000..a44c10b Binary files /dev/null and b/img/download-icon.png differ diff --git a/img/face/3.png b/img/face/3.png new file mode 100644 index 0000000..23966f9 Binary files /dev/null and b/img/face/3.png differ diff --git a/img/face/4.png b/img/face/4.png new file mode 100644 index 0000000..3b58c21 Binary files /dev/null and b/img/face/4.png differ diff --git a/img/icon_01.png b/img/icon_01.png new file mode 100644 index 0000000..fcbff29 Binary files /dev/null and b/img/icon_01.png differ diff --git a/img/icon_02.png b/img/icon_02.png new file mode 100644 index 0000000..cb7de9c Binary files /dev/null and b/img/icon_02.png differ diff --git a/img/icon_03.png b/img/icon_03.png new file mode 100644 index 0000000..72d6372 Binary files /dev/null and b/img/icon_03.png differ diff --git a/img/icon_04.png b/img/icon_04.png new file mode 100644 index 0000000..e25b15e Binary files /dev/null and b/img/icon_04.png differ diff --git a/img/icon_05.png b/img/icon_05.png new file mode 100644 index 0000000..e7a5f8b Binary files /dev/null and b/img/icon_05.png differ diff --git a/img/icon_06.png b/img/icon_06.png new file mode 100644 index 0000000..9b97232 Binary files /dev/null and b/img/icon_06.png differ diff --git a/img/img_01.png b/img/img_01.png new file mode 100644 index 0000000..ee74138 Binary files /dev/null and b/img/img_01.png differ diff --git a/img/img_02.png b/img/img_02.png new file mode 100644 index 0000000..bc8e77b Binary files /dev/null and b/img/img_02.png differ diff --git a/img/img_03.png b/img/img_03.png new file mode 100644 index 0000000..b096e3a Binary files /dev/null and b/img/img_03.png differ diff --git a/img/opera/3.png b/img/opera/3.png new file mode 100644 index 0000000..23966f9 Binary files /dev/null and b/img/opera/3.png differ diff --git a/img/opera/4.png b/img/opera/4.png new file mode 100644 index 0000000..3b58c21 Binary files /dev/null and b/img/opera/4.png differ diff --git a/img/opera/5.png b/img/opera/5.png new file mode 100644 index 0000000..bf3f22f Binary files /dev/null and b/img/opera/5.png differ diff --git a/img/personage/1.png b/img/personage/1.png new file mode 100644 index 0000000..80a6483 Binary files /dev/null and b/img/personage/1.png differ diff --git a/img/personage/2.png b/img/personage/2.png new file mode 100644 index 0000000..3a2c72a Binary files /dev/null and b/img/personage/2.png differ diff --git a/img/personage/3.png b/img/personage/3.png new file mode 100644 index 0000000..2c6291c Binary files /dev/null and b/img/personage/3.png differ diff --git a/img/robot.png b/img/robot.png new file mode 100644 index 0000000..3384992 Binary files /dev/null and b/img/robot.png differ diff --git a/img/share-icon.png b/img/share-icon.png new file mode 100644 index 0000000..42d04bc Binary files /dev/null and b/img/share-icon.png differ diff --git a/img/word/1.png b/img/word/1.png new file mode 100644 index 0000000..a2e5027 Binary files /dev/null and b/img/word/1.png differ diff --git a/img/word/2.png b/img/word/2.png new file mode 100644 index 0000000..a90124c Binary files /dev/null and b/img/word/2.png differ diff --git a/img/word/3.png b/img/word/3.png new file mode 100644 index 0000000..35651e7 Binary files /dev/null and b/img/word/3.png differ diff --git a/img/zoom-icon.png b/img/zoom-icon.png new file mode 100644 index 0000000..9a503f8 Binary files /dev/null and b/img/zoom-icon.png differ diff --git a/pages/again/again.js b/pages/again/again.js new file mode 100644 index 0000000..5f5c8bc --- /dev/null +++ b/pages/again/again.js @@ -0,0 +1,154 @@ +// pages/sign/sign.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + img_url:wx.getStorageSync('img_url'), + swiperCurrent:0, + autoplay: false, + interval: 3000, + duration: 800, + //倒计时数据 + endTime: '2020/11/22 10:40:30', + // + tab_number:31,//参与者 + tab_vote:2375,//投票数 + tab_visit:55,//访问次数 + //上传图 + source:'', + is_upload:'0', + }, + /** + * 上传图片 + */ +uploadimg:function(){ + var that = this; + wx.chooseImage({ //从本地相册选择图片或使用相机拍照 + count: 1, // 默认9 + sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有 + success:function(res){ + //前台显示 + that.setData({ + source: res.tempFilePaths, + is_upload:'1' + }) + // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片 + var tempFilePaths = res.tempFilePaths + wx.uploadFile({ + url: '#', + filePath: tempFilePaths[0], + name: 'file', + success:function(res){ + //打印 + } + }) + } + }) + //https://www.jb51.net/article/132557.htm 后端源码 +}, + //上传图片 + swiperChange: function (e) { + this.setData({ + swiperCurrent: e.detail.current + }) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + var that = this; + that.countDown() + }, +// 倒计时 + countDown:function(){ + var that=this; + var nowTime = new Date().getTime();//现在时间(时间戳) + var endTime = new Date(that.data.endTime).getTime();//结束时间(时间戳) + var time = (endTime-nowTime)/1000;//距离结束的毫秒数 + // 获取天、时、分、秒 + let day = parseInt(time / (60 * 60 * 24)); + let hou = parseInt(time % (60 * 60 * 24) / 3600); + let min = parseInt(time % (60 * 60 * 24) % 3600 / 60); + let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60); + day = that.timeFormin(day), + hou = that.timeFormin(hou), + min = that.timeFormin(min), + sec = that.timeFormin(sec) + that.setData({ + day: that.timeFormat(day), + hou: that.timeFormat(hou), + min: that.timeFormat(min), + sec: that.timeFormat(sec) + }) + // 每1000ms刷新一次 + if (time>0){ + that.setData({ + countDown: true + }) + setTimeout(this.countDown, 1000); + }else{ + that.setData({ + countDown:false + }) + } + }, + //小于10的格式化函数(2变成02) + timeFormat(param) { + return param < 10 ? '0' + param : param; + }, + //小于0的格式化函数(不会出现负数) + timeFormin(param) { + return param < 0 ? 0: param; + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/again/again.json b/pages/again/again.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/again/again.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/again/again.wxml b/pages/again/again.wxml new file mode 100644 index 0000000..92aa2f0 --- /dev/null +++ b/pages/again/again.wxml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + 距离投票结束还有 + + + {{day}}{{hou}}{{min}}{{sec}}秒 + + + + {{tab_number}} + 参与者 + + + {{tab_vote}} + 投票数 + + + {{tab_visit}} + 访问量 + + + + + +
+ + 描述 +