From ce0af4005fed4e6b4a12e9fc29cb6c8d17bc2c55 Mon Sep 17 00:00:00 2001 From: zx <604444282@qq.com> Date: Thu, 15 Dec 2022 17:40:21 +0800 Subject: [PATCH] zx --- app.js | 2 +- pages/mine/pages/profile/profile.js | 15 ++--- pages/mine/pages/profile/profile.wxml | 14 +---- pages/varComm/pages/brand/index.js | 89 ++++++++++++++------------- 4 files changed, 54 insertions(+), 66 deletions(-) diff --git a/app.js b/app.js index c41da10..3176d8f 100644 --- a/app.js +++ b/app.js @@ -73,7 +73,7 @@ App({ menuRight: 0, //胶囊按钮 距离屏幕右边的距离 request: function (prarms, callback) { let obj = { - version: "1.1.2", + version: "1.1.3", ...prarms } return new Promise((resolve, reject) => { diff --git a/pages/mine/pages/profile/profile.js b/pages/mine/pages/profile/profile.js index 30b43bb..0325df7 100644 --- a/pages/mine/pages/profile/profile.js +++ b/pages/mine/pages/profile/profile.js @@ -1,7 +1,6 @@ // pages/mine/pages/register/register.js const app = getApp() import timer from '../../../../utils/timer' -import Dialog from '../../../../miniprogram_npm/@vant/weapp/dialog/dialog'; Page({ /** @@ -95,15 +94,13 @@ Page({ return new Promise((resolve, reject) => { app.globalData.request(obj, (res) => { if (res.Code == 1) { - Dialog.alert({ + wx.showModal({ title: '提示', - message: res.Msg, - selector:'#myDialog', - }).then(() => { - this.setData({status: 0, sVerifycode: ''}); - this.getdata(); - wx.navigateBack({delta: 1}); - }); + content: res.Msg, + }) + this.setData({status: 0, sVerifycode: ''}); + this.getdata(); + wx.navigateBack({delta: 1}); } resolve(true) }).catch(err => { diff --git a/pages/mine/pages/profile/profile.wxml b/pages/mine/pages/profile/profile.wxml index 45a1aa5..f84b298 100644 --- a/pages/mine/pages/profile/profile.wxml +++ b/pages/mine/pages/profile/profile.wxml @@ -30,16 +30,4 @@ - - - \ No newline at end of file + \ No newline at end of file diff --git a/pages/varComm/pages/brand/index.js b/pages/varComm/pages/brand/index.js index 3072fcc..ee0e914 100644 --- a/pages/varComm/pages/brand/index.js +++ b/pages/varComm/pages/brand/index.js @@ -37,7 +37,6 @@ Component({ } wx.setStorageSync('brandData', this.data.boxArr) wx.navigateTo({ - // url: `/pages/varComm/pages/brandRatio/index`, url: `/contrastPackages/brandRatio/index`, }) }, @@ -77,51 +76,55 @@ Component({ boxArr: result }) }, + getData() { + wx.showLoading({ + title: '数据载入中....', + }) + app.globalData.request({ + action: 'getUserBrand', + token: wx.getStorageSync('token'), + }).then(res => { + let arr = [] + for (let i = 65; i <= 90; i++) { + arr.push({ + name: String.fromCharCode(i), + data: [] + }); + } + for (let i of res) { + for (let j of arr) { + if (i.firstword == j.name) { + j.data.push(i) + } + } + } + this.setData({ + mockData: arr + }); + }) + if (wx.getStorageSync('brandData')) { + let boxArr = [] + let result = [] + for (let i of wx.getStorageSync('brandData')) { + i ? boxArr.push(i) : boxArr.push(null) + i ? result.push(JSON.stringify(i)) : "" + } + this.setData({ + boxArr, + result + }) + }; + wx.hideLoading(); + } + }, + lifetimes: { + attached() { + this.getData(); + }, }, - pageLifetimes: { show() { - //页面数据 - wx.showLoading({ - title: '数据载入中....', - }) - app.globalData.request({ - action: 'getUserBrand', - token: wx.getStorageSync('token'), - }).then(res => { - let arr = [] - for (let i = 65; i <= 90; i++) { - arr.push({ - name: String.fromCharCode(i), - data: [] - }); - } - for (let i of res) { - for (let j of arr) { - if (i.firstword == j.name) { - j.data.push(i) - } - } - } - this.setData({ - mockData: arr - }) - setTimeout(() => { - wx.hideLoading(); - }, 1000) - }) - if (wx.getStorageSync('brandData')) { - let boxArr = [] - let result = [] - for (let i of wx.getStorageSync('brandData')) { - i ? boxArr.push(i) : boxArr.push(null) - i ? result.push(JSON.stringify(i)) : "" - } - this.setData({ - boxArr, - result - }) - } + this.getData(); }, }, }) \ No newline at end of file