diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2b8f438 --- /dev/null +++ b/.gitignore @@ -0,0 +1,44 @@ +# ---> Vue +# gitignore template for Vue.js projects +# +# Recommended template: Node.gitignore + +# TODO: where does this rule come from? +docs/_book + +# TODO: where does this rule come from? +test/ + +# ---> macOS +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +node_modules/ +unpackage + +.idea/ +.hbuilderx/ \ No newline at end of file diff --git a/App.vue b/App.vue index 4aac7c4..63e1c0d 100644 --- a/App.vue +++ b/App.vue @@ -6,6 +6,7 @@ // #endif import checkIsAgree from '@/pages/uni-agree/utils/uni-agree.js'; import uniIdPageInit from '@/uni_modules/uni-id-pages/init.js'; + import updateTabBar from '@/common/js/updateTabBar.js' export default { globalData: { searchText: '', @@ -43,7 +44,17 @@ // #endif }, onShow: function() { - console.log('App Show') + console.log('App Show'); + + // uni.setStorageSync('userType', 'user'); + let userType = uni.getStorageSync('userType'); + if(userType=='user'){ + updateTabBar.changeUser(); + }else if(userType=='agent'){ + updateTabBar.changeAgent(); + }else if(userType=='background'){ + updateTabBar.changebackground(); + } }, onHide: function() { console.log('App Hide') diff --git a/common/appInit.js b/common/appInit.js index b62d38c..574b035 100644 --- a/common/appInit.js +++ b/common/appInit.js @@ -9,7 +9,7 @@ import interceptorChooseImage from '@/uni_modules/json-interceptor-chooseImage/j interceptorChooseImage() // #endif -const db = uniCloud.database() +// const db = uniCloud.database() export default async function() { const debug = uniStarterConfig.debug; @@ -37,7 +37,7 @@ export default async function() { console.error(code, message); } // 绑定clientDB错误事件 - db.on('error', onDBError) + // db.on('error', onDBError) //拦截云对象请求 diff --git a/common/js/api.js b/common/js/api.js new file mode 100644 index 0000000..96d0573 --- /dev/null +++ b/common/js/api.js @@ -0,0 +1,85 @@ +let baseUrl = 'http://192.168.66.221:8000' + +let API = { + login(data, success, fail){ + API.sendRequest('post', data, '/passport/login', success, fail) + }, + register(data, success, fail){ + API.sendRequest('post', data, '/passport/register', success, fail) + }, + // 找回密码 + retrieve(data, success, fail){ + API.sendRequest('post', data, '/passport/retrieve', success, fail) + }, + modifyPassword(data, success, fail){ + API.sendRequest('post', data, '/user/modifyPassword', success, fail) + }, + // 短信验证码 + sendCode(data, success, fail){ + API.sendRequest('post', data, '/passport/sendCode', success, fail) + }, + // 提现记录 + getWithdrawal(data, success, fail){ + API.sendRequest('post', data, '/user/withdrawalRecords', success, fail) + }, + getRecharge(data, success, fail){ + API.sendRequest('post', data, '/user/rechargeRecords', success, fail) + }, + // 消费记录 + getConsumption(data, success, fail){ + API.sendRequest('post', data, '/user/consumptionRecords', success, fail) + }, + // 中奖记录 + getAwards(data, success, fail){ + API.sendRequest('post', data, '/user/awardsRecords', success, fail) + }, + // 首页专区 + getZoneList(data, success, fail){ + API.sendRequest('post', data, '/zone/zoneList', success, fail) + }, + // 首页专区-专区列表 + getGoodsList(data, success, fail){ + API.sendRequest('post', data, '/zone/zoneGoodsList', success, fail) + }, + // 开始刮奖 + beginLottery(data, success, fail){ + API.sendRequest('post', data, '/zone/beginLottery', success, fail) + }, + // 刮完奖请求 + endLottery(data, success, fail){ + API.sendRequest('post', data, '/zone/endLottery', success, fail) + }, + // 首页中奖纪录 + getAwardRecords(data, success, fail){ + API.sendRequest('post', data, '/index/awardRecords', success, fail) + }, + // 首页轮播图 + getRotationChart(data, success, fail){ + API.sendRequest('post', data, '/index/rotationChart', success, fail) + }, + // 通用api + request(url, data, success, fail){ + API.sendRequest('post', data, url, success, fail) + }, + + sendRequest(method, data, url, success, fail){ + uni.request({ + url:baseUrl+url, + data: data, + method: method, + success(res) { + // console.log(res, '000'); + // 200=成功, 400 = 失败错误返回、404 token验证失败 + if(res.data.code==200){ + success && success(res.data); + }else{ + uni.showToast({ + title: res.data.msg, + icon: 'none' + }) + } + } + }) + } +} +export default API; \ No newline at end of file diff --git a/common/js/updateTabBar.js b/common/js/updateTabBar.js new file mode 100644 index 0000000..a78ed51 --- /dev/null +++ b/common/js/updateTabBar.js @@ -0,0 +1,56 @@ +export default { + changeUser(){ + uni.setTabBarItem({ + index:0, + visible: true + }) + uni.setTabBarItem({ + index:1, + visible: false + }) + uni.setTabBarItem({ + index:2, + visible: false + }) + uni.setTabBarItem({ + index:3, + visible: false + }) + }, + changeAgent(){ + uni.setTabBarItem({ + index:1, + visible: true + }) + uni.setTabBarItem({ + index:0, + visible: false + }) + uni.setTabBarItem({ + index:2, + visible: false + }) + uni.setTabBarItem({ + index:3, + visible: false + }) + }, + changebackground(){ + uni.setTabBarItem({ + index:0, + visible: true + }) + uni.setTabBarItem({ + index:2, + visible: true + }) + uni.setTabBarItem({ + index:3, + visible: true + }) + uni.setTabBarItem({ + index:1, + visible: false + }) + }, +} \ No newline at end of file diff --git a/manifest.json b/manifest.json index 349762d..44e58bf 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "name" : "ggjuni", "appid" : "__UNI__49E3CD6", "description" : "云端一体应用快速开发基本项目模版", - "versionName" : "", + "versionName" : "1.0.0", "versionCode" : "100", "transformPx" : false, "app-plus" : { diff --git a/node_modules/qrcodejs2/package.json b/node_modules/qrcodejs2/package.json index f986382..3177a8d 100644 --- a/node_modules/qrcodejs2/package.json +++ b/node_modules/qrcodejs2/package.json @@ -1,21 +1,52 @@ { - "name": "qrcodejs2", - "version": "0.0.2", - "description": "Javsacript QRCode for all browsers", - "main": "qrcode.js", - "repository": { - "type": "git", - "url": "git://github.com/davidshimjs/qrcodejs.git" + "_args": [ + [ + "qrcodejs2@0.0.2", + "D:\\newProjectAddress\\guaguale_uniapp" + ] + ], + "_from": "qrcodejs2@0.0.2", + "_id": "qrcodejs2@0.0.2", + "_inBundle": false, + "_integrity": "sha512-+Y4HA+cb6qUzdgvI3KML8GYpMFwB24dFwzMkS/yXq6hwtUGNUnZQdUnksrV1XGMc2mid5ROw5SAuY9XhI3ValA==", + "_location": "/qrcodejs2", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "qrcodejs2@0.0.2", + "name": "qrcodejs2", + "escapedName": "qrcodejs2", + "rawSpec": "0.0.2", + "saveSpec": null, + "fetchSpec": "0.0.2" + }, + "_requiredBy": [ + "/" + ], + "_resolved": "https://registry.npmjs.org/qrcodejs2/-/qrcodejs2-0.0.2.tgz", + "_spec": "0.0.2", + "_where": "D:\\newProjectAddress\\guaguale_uniapp", + "author": { + "name": "davidshimjs", + "email": "ssm0123@gmail.com" + }, + "bugs": { + "url": "https://github.com/davidshimjs/qrcodejs/issues" }, + "description": "Javsacript QRCode for all browsers", + "gitHead": "06c7a5e134f116402699f03cda5819e10a0e5787", + "homepage": "https://github.com/davidshimjs/qrcodejs#readme", "keywords": [ "qrcode", "javascript" ], - "author": "davidshimjs ", "license": "MIT", - "gitHead": "06c7a5e134f116402699f03cda5819e10a0e5787", - "readmeFilename": "README.md", - "bugs": { - "url": "https://github.com/davidshimjs/qrcodejs/issues" - } + "main": "qrcode.js", + "name": "qrcodejs2", + "repository": { + "type": "git", + "url": "git://github.com/davidshimjs/qrcodejs.git" + }, + "version": "0.0.2" } diff --git a/package-lock.json b/package-lock.json index 96d16ad..929bb20 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,29 +1,34 @@ { - "name": "ggjuni", "version": "2.1.4", - "lockfileVersion": 2, + "lockfileVersion": 1, "requires": true, - "packages": { - "": { - "version": "2.1.4", - "dependencies": { - "qrcodejs2": "^0.0.2" - }, - "engines": { - "HBuilderX": "^3.2.6" + "dependencies": { + "echarts": { + "version": "5.4.3", + "resolved": "https://registry.npmmirror.com/echarts/-/echarts-5.4.3.tgz", + "integrity": "sha512-mYKxLxhzy6zyTi/FaEbJMOZU1ULGEQHaeIeuMR5L+JnJTpz+YR03mnnpBhbR4+UYJAgiXgpyTVLffPAjOTLkZA==", + "requires": { + "tslib": "2.3.0", + "zrender": "5.4.4" } }, - "node_modules/qrcodejs2": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/qrcodejs2/-/qrcodejs2-0.0.2.tgz", - "integrity": "sha512-+Y4HA+cb6qUzdgvI3KML8GYpMFwB24dFwzMkS/yXq6hwtUGNUnZQdUnksrV1XGMc2mid5ROw5SAuY9XhI3ValA==" - } - }, - "dependencies": { "qrcodejs2": { "version": "0.0.2", "resolved": "https://registry.npmjs.org/qrcodejs2/-/qrcodejs2-0.0.2.tgz", "integrity": "sha512-+Y4HA+cb6qUzdgvI3KML8GYpMFwB24dFwzMkS/yXq6hwtUGNUnZQdUnksrV1XGMc2mid5ROw5SAuY9XhI3ValA==" + }, + "tslib": { + "version": "2.3.0", + "resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.3.0.tgz", + "integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg==" + }, + "zrender": { + "version": "5.4.4", + "resolved": "https://registry.npmmirror.com/zrender/-/zrender-5.4.4.tgz", + "integrity": "sha512-0VxCNJ7AGOMCWeHVyTrGzUgrK4asT4ml9PEkeGirAkKNYXYzoPJCLvmyfdoOXcjTHPs10OZVMfD1Rwg16AZyYw==", + "requires": { + "tslib": "2.3.0" + } } } } diff --git a/package.json b/package.json index f3c6511..4dc4f5f 100644 --- a/package.json +++ b/package.json @@ -4,12 +4,12 @@ "version": "2.1.4", "description": "云端一体应用快速开发基本项目模版", "keywords": [ - "login", - "登录", - "搜索", - "uni-id实例", - "留言板" - ], + "login", + "登录", + "搜索", + "uni-id实例", + "留言板" + ], "repository": "https://gitcode.net/dcloud/uni-starter", "engines": { "HBuilderX": "^3.2.6" @@ -82,6 +82,7 @@ } }, "dependencies": { + "echarts": "^5.4.3", "qrcodejs2": "^0.0.2" } } diff --git a/pages.json b/pages.json index de5ca8c..ab9a398 100644 --- a/pages.json +++ b/pages.json @@ -1,5 +1,17 @@ { - "pages": [{ + "pages": [ + { + "path": "uni_modules/uni-id-pages/pages/login/login-withpwd", + "style": { + "navigationStyle": "custom" + } + }, + { + "path": "pages/home/home", + "style": { + "navigationStyle": "custom" + } + }, { "path": "pages/list/list", "style": { // #ifndef APP-PLUS @@ -66,7 +78,7 @@ "enablePullDownRefresh": true } } - // #ifdef APP-PLUS + //666 #ifdef APP-PLUS , { "path": "pages/ucenter/about/about", "style": { @@ -80,6 +92,29 @@ } } }, + { + "path": "pages/list/team", + "style": { + "enablePullDownRefresh": false, + "navigationBarTitleText": "顶呱刮-代理端" + } + }, + { + "path": "pages/list/agent", + "style": { + "enablePullDownRefresh": false, + // "navigationBarTitleText": "代理", + "navigationStyle": "custom" + } + }, + { + "path": "pages/list/user", + "style": { + "enablePullDownRefresh": false, + // "navigationBarTitleText": "用户" + "navigationStyle": "custom" + } + }, { "path": "uni_modules/uni-upgrade-center-app/pages/upgrade-popup", "style": { @@ -99,12 +134,127 @@ { "path": "pages/ucenter/invite/invite", "style": { - "navigationStyle": "custom", + "navigationBarTitleText": "邀请码", + // "navigationStyle": "custom", "enablePullDownRefresh": false } } - // #endif - ], + //666 #endif + ,{ + "path" : "pages/goodslist/goodslist", + "style" : + { + "navigationBarTitleText": "专区", + // "navigationStyle": "custom", + "enablePullDownRefresh": false + } + + } + ,{ + "path" : "pages/scratchCard/scratchCard", + "style" : + { + "navigationBarTitleText": "专区", + "enablePullDownRefresh": false + } + + } + ,{ + "path" : "pages/recordsList/recordsList", + "style" : + { + "navigationBarTitleText": "记录", + "enablePullDownRefresh": false + } + + } + + ,{ + "path" : "pages/recharge/recharge", + "style" : + { + "navigationBarTitleText": "充值", + "enablePullDownRefresh": false + } + + } + ,{ + "path" : "pages/about/about", + "style" : + { + "navigationBarTitleText": "关于", + "enablePullDownRefresh": false + } + + } + ,{ + "path" : "pages/about/rechargeSet/rechargeSet", + "style" : + { + "navigationBarTitleText": "充值设置", + "enablePullDownRefresh": false + } + + } + ,{ + "path" : "pages/about/bonusSet/index", + "style" : + { + "navigationBarTitleText": "奖金设置", + "enablePullDownRefresh": false + } + + } + ,{ + "path" : "pages/about/bonusSet/bonusList", + "style" : + { + "navigationBarTitleText": "元专区", + "enablePullDownRefresh": false + } + + } + ,{ + "path" : "pages/about/bonusSet/bonusSet", + "style" : + { + "navigationBarTitleText": "奖金设置", + "enablePullDownRefresh": false, + "app-plus": { + "titleNView": { + "buttons": [ + { + "text": "添加奖金 ", + "fontSize": "14", + "color": "#999" + } + ] + } + } + } + + } + ,{ + "path" : "pages/about/serviceSet/serviceSet", + "style" : + { + "navigationBarTitleText": "客服设置", + "enablePullDownRefresh": false, + "app-plus": { + "titleNView": { + "buttons": [ + { + "text": "添加客服 ", + "fontSize": "14", + "color": "#999" + } + ] + } + } + } + + } + ], "subPackages": [{ "root": "uni_modules/uni-feedback", "pages": [{ @@ -126,9 +276,12 @@ { "path": "login/login-withoutpwd" }, - { - "path": "login/login-withpwd" - }, + // { + // "path": "login/login-withpwd", + // "style": { + // "navigationStyle": "custom" + // } + // }, { "path": "userinfo/deactivate/deactivate", "style": { @@ -150,13 +303,15 @@ { "path": "register/register", "style": { - "navigationBarTitleText": "注册" + // "navigationBarTitleText": "注册" + "navigationStyle": "custom" } }, { "path": "retrieve/retrieve", "style": { - "navigationBarTitleText": "重置密码" + "navigationBarTitleText": "重置密码", + "navigationStyle": "custom" } }, { "path": "common/webview/webview", @@ -201,13 +356,14 @@ } } // #endif + ] } ], "globalStyle": { // #ifdef H5 "h5": { - "titleNView": false + // "titleNView": false }, // #endif "navigationBarTextStyle": "black", @@ -223,9 +379,10 @@ "condition": { "list": [{ "path": "pages/list/detail" - }, { - "path": "pages/list/list" - }, + }, + // { + // "path": "pages/list/list" + // }, { "path": "pages/ucenter/settings/settings" } @@ -233,24 +390,43 @@ "current": 1 }, "tabBar": { - "color": "#7A7E83", - "selectedColor": "#007AFF", + "color": "#999999", + "selectedColor": "#101010", "borderStyle": "black", "backgroundColor": "#FFFFFF", - "list": [{ - "pagePath": "pages/list/list", - "iconPath": "static/tabbar/list.png", - "selectedIconPath": "static/tabbar/list_active.png", - "text": "列表" - }, { - "pagePath": "pages/grid/grid", - "iconPath": "static/tabbar/grid.png", - "selectedIconPath": "static/tabbar/grid_active.png", - "text": "宫格" - }, { + "fontSize": "14px", + "list": [ + { + "pagePath": "pages/home/home", + "iconPath": "static/tabbar/home.png", + "selectedIconPath": "static/tabbar/home_a.png", + "text": "首页" + }, + { + "pagePath": "pages/list/team", + "iconPath": "static/tabbar/user.png", + "selectedIconPath": "static/tabbar/user_a.png", + "text": "团队", + "visible": false + }, + { + "pagePath": "pages/list/agent", + "iconPath": "static/tabbar/agent.png", + "selectedIconPath": "static/tabbar/agent_a.png", + "text": "代理", + "visible": false + }, + { + "pagePath": "pages/list/user", + "iconPath": "static/tabbar/user.png", + "selectedIconPath": "static/tabbar/user_a.png", + "text": "用户", + "visible": false + }, + { "pagePath": "pages/ucenter/ucenter", - "iconPath": "static/tabbar/me.png", - "selectedIconPath": "static/tabbar/me_active.png", + "iconPath": "static/tabbar/ucenter.png", + "selectedIconPath": "static/tabbar/ucenter_a.png", "text": "我的" }] }, diff --git a/pages/about/about.vue b/pages/about/about.vue new file mode 100644 index 0000000..1db3c9f --- /dev/null +++ b/pages/about/about.vue @@ -0,0 +1,108 @@ + + + + + diff --git a/pages/about/bonusSet/bonusList.vue b/pages/about/bonusSet/bonusList.vue new file mode 100644 index 0000000..7af1c1d --- /dev/null +++ b/pages/about/bonusSet/bonusList.vue @@ -0,0 +1,92 @@ + + + + + diff --git a/pages/about/bonusSet/bonusSet.vue b/pages/about/bonusSet/bonusSet.vue new file mode 100644 index 0000000..783c460 --- /dev/null +++ b/pages/about/bonusSet/bonusSet.vue @@ -0,0 +1,219 @@ + + + + + diff --git a/pages/about/bonusSet/index.vue b/pages/about/bonusSet/index.vue new file mode 100644 index 0000000..619b539 --- /dev/null +++ b/pages/about/bonusSet/index.vue @@ -0,0 +1,99 @@ + + + + + diff --git a/pages/about/rechargeSet/rechargeSet.vue b/pages/about/rechargeSet/rechargeSet.vue new file mode 100644 index 0000000..d7fbac3 --- /dev/null +++ b/pages/about/rechargeSet/rechargeSet.vue @@ -0,0 +1,78 @@ + + + + + diff --git a/pages/about/serviceSet/serviceSet.vue b/pages/about/serviceSet/serviceSet.vue new file mode 100644 index 0000000..a4d0454 --- /dev/null +++ b/pages/about/serviceSet/serviceSet.vue @@ -0,0 +1,206 @@ + + + + + diff --git a/pages/goodslist/goodslist.vue b/pages/goodslist/goodslist.vue new file mode 100644 index 0000000..35a1df6 --- /dev/null +++ b/pages/goodslist/goodslist.vue @@ -0,0 +1,93 @@ + + + + + diff --git a/pages/home/home.vue b/pages/home/home.vue new file mode 100644 index 0000000..0a2a0b0 --- /dev/null +++ b/pages/home/home.vue @@ -0,0 +1,558 @@ + + + + + diff --git a/pages/invite/invite.vue b/pages/invite/invite.vue new file mode 100644 index 0000000..8183fd0 --- /dev/null +++ b/pages/invite/invite.vue @@ -0,0 +1,22 @@ + + + + + diff --git a/pages/list/agent.vue b/pages/list/agent.vue new file mode 100644 index 0000000..6f03b18 --- /dev/null +++ b/pages/list/agent.vue @@ -0,0 +1,477 @@ + + + + + \ No newline at end of file diff --git a/pages/list/list.nvue b/pages/list/list.nvue index d04772b..db59c9d 100644 --- a/pages/list/list.nvue +++ b/pages/list/list.nvue @@ -11,6 +11,7 @@ + @@ -54,7 +55,7 @@ - + @@ -63,7 +64,8 @@ import statusBar from "@/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-status-bar"; import Gps from '@/uni_modules/json-gps/js_sdk/gps.js'; - const gps = new Gps(),db = uniCloud.database(); + const gps = new Gps(); + // db = uniCloud.database(); export default { components: { @@ -79,8 +81,8 @@ }, colList(){ return [ - db.collection('opendb-news-articles').where(this.where).field('avatar,title,last_modify_date,user_id').getTemp(), - db.collection('uni-id-users').field('_id,nickname').getTemp() + // db.collection('opendb-news-articles').where(this.where).field('avatar,title,last_modify_date,user_id').getTemp(), + // db.collection('uni-id-users').field('_id,nickname').getTemp() ] } }, diff --git a/pages/list/team.vue b/pages/list/team.vue new file mode 100644 index 0000000..f73666e --- /dev/null +++ b/pages/list/team.vue @@ -0,0 +1,301 @@ + + + + + \ No newline at end of file diff --git a/pages/list/user.vue b/pages/list/user.vue new file mode 100644 index 0000000..c1a6931 --- /dev/null +++ b/pages/list/user.vue @@ -0,0 +1,478 @@ + + + + + \ No newline at end of file diff --git a/pages/recharge/recharge.vue b/pages/recharge/recharge.vue new file mode 100644 index 0000000..98c894d --- /dev/null +++ b/pages/recharge/recharge.vue @@ -0,0 +1,150 @@ + + + + + diff --git a/pages/recordsList/recordsList.vue b/pages/recordsList/recordsList.vue new file mode 100644 index 0000000..2f2ea36 --- /dev/null +++ b/pages/recordsList/recordsList.vue @@ -0,0 +1,248 @@ + + + + + diff --git a/pages/scratchCard/scratch.js b/pages/scratchCard/scratch.js new file mode 100644 index 0000000..6b0c6d0 --- /dev/null +++ b/pages/scratchCard/scratch.js @@ -0,0 +1,109 @@ + +class Scratch { + constructor (page, opts) { + opts = opts || {} + this.page = page + this.canvasId = opts.canvasId || 'canvas' + this.width = opts.width || 340 + this.height = opts.height || 150 + // this.maskColor = opts.maskColor || '#D2D2D2' + this.maskColor = '#ccc' + this.size = opts.size || 10 + this.r = this.size * 2 + this.area = this.r * this.r + this.scale = opts.scale || 0.3 + this.totalArea = this.width * this.height + // this.show = opts.show || false + this.init() + } + + init () { + this.show = false + this.clearPoints = [] + this.ctx = uni.createCanvasContext(this.canvasId) + this.drawMask() + this.bindTouch() + } + + drawMask () { + this.ctx.setFillStyle(this.maskColor) + this.ctx.fillRect(0, 0, this.width, this.height) + this.ctx.draw() + } + + bindTouch () { + this.page.touchStart = (e) => { + this.eraser(e, true) + } + this.page.touchMove = (e) => { + this.eraser(e, false) + } + this.page.touchEnd = (e) => { + if (this.show) { + this.ctx.clearRect(0, 0, this.width, this.height) + this.ctx.draw() + // console.log('刮奖面积达标'); + } + } + } + + eraser (e, bool) { + const len = this.clearPoints.length + let count = 0 + const x = e.touches[0].x; const y = e.touches[0].y + const x1 = x - this.size + const y1 = y - this.size + if (bool) { + this.clearPoints.push({ + x1: x1, + y1: y1, + x2: x1 + this.r, + y2: y1 + this.r + }) + } + for (const item of this.clearPoints) { + if (item.x1 > x || item.y1 > y || item.x2 < x || item.y2 < y) { + count++ + } else { + break + } + } + if (len === count) { + this.clearPoints.push({ + x1: x1, + y1: y1, + x2: x1 + this.r, + y2: y1 + this.r + }) + } + if (len && this.r * this.r * len > this.scale * this.totalArea) { + this.show = true; + // console.log('刮奖面积达标'); + } + this.clearArcFun(x, y, this.r, this.ctx) + this.ctx.draw(true); + } + + clearArcFun (x, y, r, ctx) { + let stepClear = 1 + clearArc(x, y, r) + function clearArc (x, y, radius) { + const calcWidth = radius - stepClear + const calcHeight = Math.sqrt(radius * radius - calcWidth * calcWidth) + + const posX = x - calcWidth + const posY = y - calcHeight + + const widthX = 2 * calcWidth + const heightY = 2 * calcHeight + + if (stepClear <= radius) { + ctx.clearRect(posX, posY, widthX, heightY) + stepClear += 1 + clearArc(x, y, radius) + } + } + } +} + +export default Scratch \ No newline at end of file diff --git a/pages/scratchCard/scratchCard - jquery+h5.vue b/pages/scratchCard/scratchCard - jquery+h5.vue new file mode 100644 index 0000000..51f14a9 --- /dev/null +++ b/pages/scratchCard/scratchCard - jquery+h5.vue @@ -0,0 +1,232 @@ + + + + + diff --git a/pages/scratchCard/scratchCard - uni丝滑.vue b/pages/scratchCard/scratchCard - uni丝滑.vue new file mode 100644 index 0000000..4c7bee5 --- /dev/null +++ b/pages/scratchCard/scratchCard - uni丝滑.vue @@ -0,0 +1,196 @@ + + + + + \ No newline at end of file diff --git a/pages/scratchCard/scratchCard - 原本卡顿.vue b/pages/scratchCard/scratchCard - 原本卡顿.vue new file mode 100644 index 0000000..7977803 --- /dev/null +++ b/pages/scratchCard/scratchCard - 原本卡顿.vue @@ -0,0 +1,231 @@ + + + + + diff --git a/pages/scratchCard/scratchCard.vue b/pages/scratchCard/scratchCard.vue new file mode 100644 index 0000000..8a172c7 --- /dev/null +++ b/pages/scratchCard/scratchCard.vue @@ -0,0 +1,411 @@ + + + + + \ No newline at end of file diff --git a/pages/ucenter/invite/invite.vue b/pages/ucenter/invite/invite.vue index 5bb4df8..1dbdf9f 100644 --- a/pages/ucenter/invite/invite.vue +++ b/pages/ucenter/invite/invite.vue @@ -1,21 +1,26 @@ @@ -87,6 +92,9 @@ } diff --git a/uni_modules/uni-id-pages/pages/register/register.vue b/uni_modules/uni-id-pages/pages/register/register.vue index 20de1ad..4fedb90 100644 --- a/uni_modules/uni-id-pages/pages/register/register.vue +++ b/uni_modules/uni-id-pages/pages/register/register.vue @@ -1,6 +1,6 @@