From 9347cb1adbc49b5a083b32736e8e149926c1f3c1 Mon Sep 17 00:00:00 2001 From: luyisha Date: Mon, 11 Sep 2023 11:18:25 +0800 Subject: [PATCH] 1 --- pages/about/bannerManage/addBanner.vue | 12 +- pages/about/bannerManage/bannerManage.vue | 2 +- pages/about/noticeManage/noticeManage.vue | 24 ++-- pages/about/serviceSet/serviceSet.vue | 1 + pages/home/home.vue | 47 ++++---- pages/scratchCard/scratch.js | 4 +- pages/scratchCard/scratchCard.vue | 53 ++++++--- pages/ucenter/ucenter.vue | 9 +- .../pages/login/login-withpwd.vue | 104 ++++++------------ .../uni-id-pages/pages/register/register.vue | 7 +- .../pages/userinfo/change_pwd/change_pwd.vue | 11 +- 11 files changed, 136 insertions(+), 138 deletions(-) diff --git a/pages/about/bannerManage/addBanner.vue b/pages/about/bannerManage/addBanner.vue index 89dbeac..705f56b 100644 --- a/pages/about/bannerManage/addBanner.vue +++ b/pages/about/bannerManage/addBanner.vue @@ -9,7 +9,7 @@ --> - + 点击添加轮播图 @@ -51,16 +51,18 @@ uni.uploadFile({ url: API.baseUrl+'/rotationChart/upload', filePath: tempFilePaths[0], - name: 'file', + name: 'image', header: { token: uni.getStorageSync('user_token') }, formData: { - 'image': tempFilePaths[0] + }, success: (uploadFileRes) => { console.log(uploadFileRes.data); - // this.editInfo.image + let data = JSON.parse(uploadFileRes.data); + this.editInfo.image = data.data.url; + this.editInfo.img = data.data.path;//短路径用来上传 } }); } @@ -71,7 +73,7 @@ id: this.id||'', title: this.editInfo.title, sort: this.editInfo.sort, - image: this.editInfo.image + image: this.editInfo.img }; API.request('/rotationChart/save', data, res=>{ uni.showToast({ diff --git a/pages/about/bannerManage/bannerManage.vue b/pages/about/bannerManage/bannerManage.vue index a97914b..9c3d94e 100644 --- a/pages/about/bannerManage/bannerManage.vue +++ b/pages/about/bannerManage/bannerManage.vue @@ -60,7 +60,7 @@ } }, - onLoad(e) { + onShow() { this.getList(); }, onNavigationBarButtonTap() { diff --git a/pages/about/noticeManage/noticeManage.vue b/pages/about/noticeManage/noticeManage.vue index 975b494..a6618ac 100644 --- a/pages/about/noticeManage/noticeManage.vue +++ b/pages/about/noticeManage/noticeManage.vue @@ -4,8 +4,8 @@ - 标题:{{item.title}} - 发布时间:{{item.time}} + 标题:{{item.title}} + 发布时间:{{item.create_time}} @@ -69,7 +69,7 @@ } }, - onLoad(e) { + onShow() { this.getList(); }, onNavigationBarButtonTap() { @@ -103,7 +103,7 @@ } .set_item{ width: 670rpx; - height: 280rpx; + min-height: 280rpx; box-shadow: 0px 0px 4px 0px rgba(0, 0, 0, 0.11); margin-bottom: 40rpx; border-radius: 10px; @@ -112,21 +112,27 @@ padding: 30rpx 30rpx; line-height: 24px; } + .box2{ + display: -webkit-box;//将盒子转换为弹性盒子 + -webkit-box-orient: vertical;//文本显示方式,默认水平 + -webkit-line-clamp: 1;//设置显示多少行 + overflow: hidden; + } .text{ color: #999; } .box3{ font-size: 12px; - display: -webkit-box;//将盒子转换为弹性盒子 - -webkit-box-orient: vertical;//文本显示方式,默认水平 - -webkit-line-clamp: 1;//设置显示多少行 - overflow: hidden; + // display: -webkit-box;//将盒子转换为弹性盒子 + // -webkit-box-orient: vertical;//文本显示方式,默认水平 + // -webkit-line-clamp: 1;//设置显示多少行 + // overflow: hidden; } .flex-row{ display: flex; align-items: center; justify-content: space-between; - padding: 0px 110rpx; + padding: 0px 110rpx 30rpx; } .red{ color: #E33837; diff --git a/pages/about/serviceSet/serviceSet.vue b/pages/about/serviceSet/serviceSet.vue index e37d4cc..f76a0fb 100644 --- a/pages/about/serviceSet/serviceSet.vue +++ b/pages/about/serviceSet/serviceSet.vue @@ -98,6 +98,7 @@ }) this.showEdit = false; this.editInfo = {}; + this.getList(); }) }, getList(){ diff --git a/pages/home/home.vue b/pages/home/home.vue index 81dc349..cf50fe9 100644 --- a/pages/home/home.vue +++ b/pages/home/home.vue @@ -159,28 +159,32 @@ } }, onShow() { - if(this.userType=='user'){ - this.getAwardRecords(); - updateTabBar.changeUser(); - }else if(this.userType=='background'){ - updateTabBar.changebackground(); - } + setTimeout(()=>{ + if(this.userType=='user'){ + updateTabBar.changeUser(); + this.getZoneList(); + this.getRotationChart(); + this.getAwardRecords(); + this.getNotice(); + }else if(this.userType=='background'){ + updateTabBar.changebackground(); + this.getNeedSta(); + this.getUserSta(); + this.getUpDownSta(); + + this.pieChart = echarts.init(document.getElementById('piechart')); + this.myChart = echarts.init(document.getElementById('mychart')); + setTimeout(()=>{ + this.renderPie(); + this.renderChart(); + }, 200) + } + }, 500) }, created() { this.userType = uni.getStorageSync('userType'); - if(this.userType=='user'){ - this.getZoneList(); - this.getRotationChart(); - this.getAwardRecords(); - this.getNotice(); - } - if(this.userType=='background'){ - this.getNeedSta(); - this.getUserSta(); - this.getUpDownSta(); - } }, mounted() { if(this.userType=='user'){ @@ -199,15 +203,6 @@ }); } - if(this.userType=='background'){ - this.pieChart = echarts.init(document.getElementById('piechart')); - this.myChart = echarts.init(document.getElementById('mychart')); - setTimeout(()=>{ - this.renderPie(); - this.renderChart(); - }, 200) - } - }, methods: { toUrl(item){ diff --git a/pages/scratchCard/scratch.js b/pages/scratchCard/scratch.js index 6b0c6d0..8e01012 100644 --- a/pages/scratchCard/scratch.js +++ b/pages/scratchCard/scratch.js @@ -13,12 +13,12 @@ class Scratch { this.area = this.r * this.r this.scale = opts.scale || 0.3 this.totalArea = this.width * this.height - // this.show = opts.show || false + this.show = false this.init() } init () { - this.show = false + this.clearPoints = [] this.ctx = uni.createCanvasContext(this.canvasId) this.drawMask() diff --git a/pages/scratchCard/scratchCard.vue b/pages/scratchCard/scratchCard.vue index ed8a97a..e10c609 100644 --- a/pages/scratchCard/scratchCard.vue +++ b/pages/scratchCard/scratchCard.vue @@ -36,6 +36,7 @@ {{awards_amount}}元 + @@ -96,7 +97,6 @@ export default { prize_img: '', // 中奖图片 isScratching: false, // 是否正在刮奖, isThank: false, - // show: false, guaCanvas: null, isShow: false, c_r_id: '', @@ -106,9 +106,12 @@ export default { // console.log(this.show); }, watch: { - isShow(n){ - this.showResult = true; - this.doPrizeScratchTicketFun(); + isShow(n, o){ + console.log(n,o); + if(n && n!=o){ + this.showResult = true; + this.doPrizeScratchTicketFun(); + } } }, onLoad(e) { @@ -117,19 +120,22 @@ export default { // +'元专区' }) this.id = e.id; + this.initInfo(); - API.request('/zone/beginInitInfo', {zone_goods_id: this.id}, res=>{ - this.ticketInfo = res.data.data; - }) - - let timer = setInterval(()=>{ - if(this.guaCanvas && this.guaCanvas.show){ - this.isShow = true; - clearInterval(timer); - } - }, 500) }, methods: { + initInfo(){ + API.request('/zone/beginInitInfo', {zone_goods_id: this.id}, res=>{ + this.ticketInfo = res.data.data; + }) + + let timer = setInterval(()=>{ + if(this.guaCanvas && this.guaCanvas.show){ + this.isShow = true; + clearInterval(timer); + } + }, 500) + }, initCanvas () { // 刮奖初始化信息必须在onReady后,不然h5不支持(小程序可在onLoad执行) this.guaCanvas = new Scratch(this, { @@ -156,11 +162,15 @@ export default { // this.isWin = true; // this.isThank = true; API.endLottery({c_r_id: this.c_r_id}, res=>{ - this.awards_amount = res.data.awards_amount; - this.isWin = true; + if(res.data.awards_amount){ + this.awards_amount = res.data.awards_amount; + this.isWin = true; + }else{ + this.isWin = false + this.isThank = true; + } + }, fail=>{ - this.isWin = false - this.isThank = true; // this.isScratching = false }) }, @@ -171,7 +181,14 @@ export default { }, // 再刮一次 again(){ + this.isWin = false; this.isThank = false; + this.toDraw = false; + this.showResult = false; + this.isScratching = false; + this.isShow = false; + this.guaCanvas.show = false; + this.initInfo(); } }, } diff --git a/pages/ucenter/ucenter.vue b/pages/ucenter/ucenter.vue index f42b9b8..75713cc 100644 --- a/pages/ucenter/ucenter.vue +++ b/pages/ucenter/ucenter.vue @@ -10,7 +10,7 @@ - ID: {{userInfo.id}} + ID: {{userInfo.id || userInfo.aid}} 点击登陆 @@ -326,6 +326,8 @@ //#endif if(uni.getStorageSync('userType')=='background'){ this.getAdminUserInfo(); + }else if(uni.getStorageSync('userType')=='agent'){ + this.getAgentInfo(); }else{ this.getUserInfo(); } @@ -586,6 +588,11 @@ this.userInfo = res.data.data; }) }, + getAgentInfo(){ + API.request('/agentTeam/getAgentUserInfo', {}, res=>{ + this.userInfo = res.data; + }) + }, getAdminUserInfo(){ API.request('/adminUser/userInfo', {}, res=>{ this.userInfo = res.data.data; diff --git a/uni_modules/uni-id-pages/pages/login/login-withpwd.vue b/uni_modules/uni-id-pages/pages/login/login-withpwd.vue index 13c6d6a..76a2f18 100644 --- a/uni_modules/uni-id-pages/pages/login/login-withpwd.vue +++ b/uni_modules/uni-id-pages/pages/login/login-withpwd.vue @@ -143,11 +143,6 @@ // return this.$refs.agreements.popup(this.pwdLogin) // } - let data = { - "password": this.password, - "phone": this.username - } - // if (/^1\d{10}$/.test(this.username)) { // data.mobile = this.username // } else if (/@/.test(this.username)) { @@ -155,74 +150,47 @@ // } else { // data.username = this.username // } - - if(this.userType=='user'){ - API.login(data, res=>{ - console.log(res); - // this.loginSuccess() + let url = '', newUrl = ''; + let data = {}; + switch (this.userType){ + case 'user': + url = '/passport/login'; + data = {phone: this.username, password: this.password}; + newUrl = '/pages/home/home'; + break; + case 'agent': + url = '/passport/agentLogin'; + data = {phone: this.username, password: this.password}; + newUrl = '/pages/list/team'; + break; + case 'background': + url = '/passport/adminLogin'; + data = {account_number: this.username, password: this.password}; + newUrl = '/pages/home/home'; - uni.showToast({ - title: res.msg - }) - uni.setStorageSync('user_token', res.data.token); - let accounts = uni.getStorageSync('accounts') || []; - accounts.push(this.username); - uni.setStorageSync('accounts', accounts); - uni.setStorageSync('userType', 'user'); - // updateTabBar.changeUser(); - setTimeout(()=>{ - uni.switchTab({ - url:'/pages/home/home' - }) - }, 1500) - }) + break; } - if(this.userType=='agent'){ - API.request('/passport/agentLogin', { - phone: this.username, - password: this.password - }, res=>{ - console.log(res); - uni.showToast({ - title: res.msg + API.request(url, data, res=>{ + uni.showToast({ + title: res.msg + }) + + let accounts = uni.getStorageSync('accounts') || []; + accounts.push(this.username); + accounts = Array.from(new Set(accounts)); + uni.setStorageSync('accounts', accounts); + + uni.setStorageSync('user_token', res.data.token); + uni.setStorageSync('userType', this.userType); + + setTimeout(()=>{ + uni.switchTab({ + url:newUrl }) - uni.setStorageSync('user_token', res.data.token); - let accounts = uni.getStorageSync('accounts') || []; - accounts.push(this.username); - uni.setStorageSync('accounts', accounts); - uni.setStorageSync('userType', 'agent'); - // updateTabBar.changeAgent(); - setTimeout(()=>{ - uni.switchTab({ - url:'/pages/list/team' - }) - }, 1500) - }, fail=>{}, false) - } + }, 1500) + }, fail=>{}, false) - if(this.userType=='background'){ - API.request('/passport/adminLogin', { - account_number: this.username, - password: this.password - }, res=>{ - console.log(res); - uni.showToast({ - title: res.msg - }) - uni.setStorageSync('user_token', res.data.token); - let accounts = uni.getStorageSync('accounts') || []; - accounts.push(this.username); - uni.setStorageSync('accounts', accounts); - uni.setStorageSync('userType', 'background'); - // updateTabBar.changebackground(); - setTimeout(()=>{ - uni.switchTab({ - url:'/pages/home/home' - }) - }, 1500) - }, fail=>{}, false) - } // uniIdCo.login(data).then(e => { diff --git a/uni_modules/uni-id-pages/pages/register/register.vue b/uni_modules/uni-id-pages/pages/register/register.vue index b8833b9..7c21bd1 100644 --- a/uni_modules/uni-id-pages/pages/register/register.vue +++ b/uni_modules/uni-id-pages/pages/register/register.vue @@ -45,9 +45,9 @@ placeholder="密码" type="password" v-model="formData.password" trim="both" /> - +