From 1e7af1808bd2de7142d9878c67f42f6ca5a5b334 Mon Sep 17 00:00:00 2001 From: XiaoXinPro 14 IAH5R <568170040@qq.com> Date: Tue, 8 Nov 2022 17:41:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=88=E6=9D=83=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.json | 3 +- custom-tab-bar/index.js | 4 +- ext.json | 55 +++-- index/index.js | 435 ++++++++++++++++++---------------- index/index.wxml | 2 +- index/user.js | 148 ++++++------ index/user.wxml | 228 +++++++++--------- pages/edit/edit.js | 226 +++++++++--------- pages/edit/edit.wxml | 133 ++++++----- pages/getphoneInfo/index.js | 55 +++-- pages/setUserInfo/index.js | 134 +++++++++++ pages/setUserInfo/index.json | 8 + pages/setUserInfo/index.wxml | 15 ++ pages/setUserInfo/index.wxss | 36 +++ pages/site/site.js | 3 +- pages/site/site.wxml | 6 +- pages/theme/index1/index.js | 17 ++ pages/theme/index1/index.wxml | 2 +- project.config.json | 2 +- 19 files changed, 889 insertions(+), 623 deletions(-) create mode 100644 pages/setUserInfo/index.js create mode 100644 pages/setUserInfo/index.json create mode 100644 pages/setUserInfo/index.wxml create mode 100644 pages/setUserInfo/index.wxss diff --git a/app.json b/app.json index 136a5b9..5dd829c 100644 --- a/app.json +++ b/app.json @@ -78,7 +78,8 @@ "pages/siteAdd/siteAdd", "pages/fillIndent/fillIndent", "pages/coupon/childDetail/childDetail", - "pages/theme/index1/index" + "pages/theme/index1/index", + "pages/setUserInfo/index" ], "subpackages": [ { diff --git a/custom-tab-bar/index.js b/custom-tab-bar/index.js index 3d5d1a0..0145bfa 100644 --- a/custom-tab-bar/index.js +++ b/custom-tab-bar/index.js @@ -135,7 +135,7 @@ Component({ const that = this console.log(app.globalData.mouldType, "mouldType") if (app.globalData.mouldType == 0) { - that.getTabBar().setData({ + that.setData({ selectedColor: `${app.globalData.styleLsit.t_in_std.styleClass}`, list: [{ "pagePath": "/index/index", @@ -164,7 +164,7 @@ Component({ ], }) } else if (app.globalData.mouldType == 1) { - that.getTabBar().setData({ + that.setData({ //getTabBar(). selectedColor: `${app.globalData.styleLsit.t_in_std.styleClass}`, list: [{ "pagePath": "/pages/theme/index1/index", diff --git a/ext.json b/ext.json index 2cfc09c..3c0587f 100644 --- a/ext.json +++ b/ext.json @@ -1,45 +1,33 @@ { "ext": { "attr": { - "car": { - "tjd": { - "payPath": "", - "tjdAppId": "wx6945d1bda68d7993" - }, - "etcp": { - "payPath": "pages/pay/order-pay-open/main", - "etcpAppId": "wxc07f9d67923d676d", - "etcpCallbackUrl": "https://admin.malls.iformall.com/api/carCallback/etcpPaidCallback" - }, - "bolink": { - "payPath": "pages/park/park", - "bolinkAppId": "wxbd08b4baa10fcc1d" - }, - "version": "release" - }, - "mchId": "1539496451", + "mchId": "1602801645", "imgProxy": [ { - "newUrl": "https://c.malls.iformall.com/img", + "newUrl": "https://ctest.malls.iformall.com/img", "orgUrl": "https://iformall-net.formall.oss-accelerate.aliyuncs.com" }, { - "newUrl": "https://c.malls.iformall.com/img1", + "newUrl": "https://ctest.malls.iformall.com/img1", "orgUrl": "https://formall.oss-accelerate.aliyuncs.com" }, { - "newUrl": "https://c.malls.iformall.com/img2", + "newUrl": "https://ctest.malls.iformall.com/img2", "orgUrl": "https://wx.qlogo.cn" } ], - "configUrl": "https://c.malls.iformall.com/C/api", - "ifStoreApp": "0", + "configUrl": "https://ctest.malls.iformall.com/C/api", + "etcpAppId": "wx219a81b9c87aa4f7", + "etcpVersion": "release", + "businessSwitch": "1", + "businessVersion": "1", + "etcpCallbackUrl": "https://admintest.malls.iformall.com/api/carCallback/etcpPaidCallback", "ifHaveWebSocket": "0", - "ifHaveCarModular": "0" + "ifHaveCarModular": "1" }, - "name": "宁乡翡翠湖国际广场", - "weappId": "wxbe89097584fbbf03", - "appVersion": "C.5.1.1" + "name": "富茂光谷测试版", + "weappId": "wx219a81b9c87aa4f7", + "appVersion": "C.test.5.2.0" }, "debug": false, "tabBar": { @@ -75,7 +63,8 @@ "selectedIconPath": "assets/images/user-a.png" } ], - "custom": true + "color": "#abb1be", + "selectedColor": "#b2743d" }, "window": { "backgroundTextStyle": "dark", @@ -83,7 +72,17 @@ "navigationBarTitleText": "", "navigationBarBackgroundColor": "#FFFFFF" }, - "extAppid": "wxbe89097584fbbf03", + "plugins": { + "auto-points-plugin": { + "version": "2.4.0", + "provider": "wxfab2bf944bfc4da6" + }, + "live-player-plugin": { + "version": "1.2.5", + "provider": "wx2b03c6e691cd7370" + } + }, + "extAppid": "wx219a81b9c87aa4f7", "extEnable": true, "permission": { "scope.userLocation": { diff --git a/index/index.js b/index/index.js index a8f5460..3bdbe38 100644 --- a/index/index.js +++ b/index/index.js @@ -120,7 +120,25 @@ Page({ }) this.getCouponChannelList(e.detail) }, - getBusinessList() { //获取优选导航 + + // 2022年11月8日微信收回接口“wx.getUserProfile”、“wx.getUserInfo”之后,需要手动设置用户头像与昵称 + goSetAvatar() { + const accreditFlag = this.data.accreditFlag + // 没授权手机号 + if (accreditFlag == 2) { + wx.navigateTo({ + url: '/pages/getphoneInfo/index?go="setUserInfo"' + }) + // 手机号已授权 + } else { + wx.navigateTo({ + url: '/pages/setUserInfo/index', + }) + } + }, + + //获取优选导航 + getBusinessList() { Http.get({ url: config.api.businessList, data: { @@ -170,8 +188,8 @@ Page({ url: config.api.couponChannelList, data: param }).then(res => { - if (res.data.list&&res.data.list.length != 0) { - + if (res.data.list && res.data.list.length != 0) { + let tempLsit = this.data.businessData let data = res.data.list data.map(item => { @@ -192,7 +210,7 @@ Page({ businessData: data }) } - }else{ + } else { this.setData({ noDataFlag: true }) @@ -325,7 +343,7 @@ Page({ url: '/pages2/live/livelist/index', }) }, - alphaClick1: function(even) { + alphaClick1: function (even) { var animation = wx.createAnimation({}) animation.opacity(0).step({ duration: 2000 @@ -334,7 +352,7 @@ Page({ alphaData: animation.export() }) }, - alphaClick: function(even) { + alphaClick: function (even) { var animation = wx.createAnimation({}) animation.opacity(0).step({ duration: 2000 @@ -344,23 +362,23 @@ Page({ }) }, // 我的卡包 - mycard: function() { + mycard: function () { wx.navigateTo({ url: '/pages/cardorder/index/index', }) }, //我的券包 - mycoupon: function() { + mycoupon: function () { wx.navigateTo({ url: '/pages/couponorder/index/index', }) }, - gotoSpellGroup: function() { + gotoSpellGroup: function () { wx.navigateTo({ url: '/pages/spellGroup/spellGroup', }) }, - qrcode: function() { + qrcode: function () { var that = this; let memberId = that.data.memberId; if (memberId) { @@ -370,17 +388,17 @@ Page({ } }, //跳往限时秒杀 - gotoRushBuy: function() { + gotoRushBuy: function () { wx.navigateTo({ url: '/pages/rushToBuy/index', }) }, - swiperChange: function(e) { + swiperChange: function (e) { this.setData({ swiperCurrent: e.detail.current }); }, - gotogame: function() { + gotogame: function () { let that = this; if (!that.data.showIf) { wx.showToast({ @@ -420,7 +438,7 @@ Page({ * */ app.globalData.skipUrl = '/pages/game/index?url=' + that.data.staticGamedata.url + "&id=" + that.data.staticGamedata.id + "&gameId=" + that.data.staticGamedata.gameId, - app.globalData.skip = 'redirectTo' + app.globalData.skip = 'redirectTo' wx.redirectTo({ url: "/pages/getphoneInfo/index?path=index&url=" + that.data.staticGamedata.url + "&id=" + that.data.staticGamedata.id + "&gameId=" + that.data.staticGamedata.gameId, }); @@ -457,7 +475,7 @@ Page({ } }, - mySpecial: function() { + mySpecial: function () { console.log("special"); wx.navigateTo({ url: '/pages/specialcourtesy/specialcourtesy', @@ -500,7 +518,7 @@ Page({ /** * 生命周期函数--监听页面初次渲染完成 */ - onLoad: function(options) { + onLoad: function (options) { console.log("onLoad--") this.setData({ mouldType: app.globalData.mouldType, @@ -564,38 +582,38 @@ Page({ }, // 初始换底部导航栏 - setTabStyle: function() { + setTabStyle: function () { this.getTabBar().setData({ selectedColor: `${app.globalData.styleLsit.t_in_std.styleClass}`, list: [{ - "pagePath": "/index/index", - "iconPath": `${app.globalData.styleLsit.t_in.icon}`, - "selectedIconPath": `${app.globalData.styleLsit.t_in_std.icon}`, - "text": "首页" - }, - { - "pagePath": "/index/searchbar", - "iconPath": `${app.globalData.styleLsit.t_md.icon}`, - "selectedIconPath": `${app.globalData.styleLsit.t_md_std.icon}`, - "text": "门店" - }, - { - "pagePath": "/index/passCar", - "iconPath": `${app.globalData.styleLsit.t_tc.icon}`, - "selectedIconPath": `${app.globalData.styleLsit.t_tc_std.icon}`, - "text": "停车" - }, - { - "pagePath": "/index/user", - "iconPath": `${app.globalData.styleLsit.t_uc.icon}`, - "selectedIconPath": `${app.globalData.styleLsit.t_uc_std.icon}`, - "text": "我的" - } + "pagePath": "/index/index", + "iconPath": `${app.globalData.styleLsit.t_in.icon}`, + "selectedIconPath": `${app.globalData.styleLsit.t_in_std.icon}`, + "text": "首页" + }, + { + "pagePath": "/index/searchbar", + "iconPath": `${app.globalData.styleLsit.t_md.icon}`, + "selectedIconPath": `${app.globalData.styleLsit.t_md_std.icon}`, + "text": "门店" + }, + { + "pagePath": "/index/passCar", + "iconPath": `${app.globalData.styleLsit.t_tc.icon}`, + "selectedIconPath": `${app.globalData.styleLsit.t_tc_std.icon}`, + "text": "停车" + }, + { + "pagePath": "/index/user", + "iconPath": `${app.globalData.styleLsit.t_uc.icon}`, + "selectedIconPath": `${app.globalData.styleLsit.t_uc_std.icon}`, + "text": "我的" + } ], }) }, - onShow: function() { + onShow: function () { console.log("onShow--") console.log(app.globalData.mouldType, "mouldType") if (app.globalData.token) { @@ -665,38 +683,38 @@ Page({ }) } // 如果有游戏 - setTimeout(function() { + setTimeout(function () { that.alphaClick(); }, 8000) // 如果有广告 - setTimeout(function() { + setTimeout(function () { that.alphaClick1(); }, 8000) }, - getmemberId: function(token) { + getmemberId: function (token) { let that = this; Http.get({ - url: config.api.getScore, - data: { - token: token - } - }).then(res => { - if (res.data.avatarUrl && res.data.nickName){ - app.globalData.userAvatarUrl = res.data.avatarUrl, - app.globalData.userName = res.data.nickName - } - that.setData({ - levelName: res.data.levelName, - upgradePercent: res.data.upgradePercent, - upgradeScore: res.data.upgradeScore, - memberId: res.data.id, - credit: res.data.credit, - userAvatarUrl: res.data.avatarUrl, - userName: res.data.nickName, - }) + url: config.api.getScore, + data: { + token: token + } + }).then(res => { + if (res.data.avatarUrl && res.data.nickName) { + app.globalData.userAvatarUrl = res.data.avatarUrl, + app.globalData.userName = res.data.nickName + } + that.setData({ + levelName: res.data.levelName, + upgradePercent: res.data.upgradePercent, + upgradeScore: res.data.upgradeScore, + memberId: res.data.id, + credit: res.data.credit, + userAvatarUrl: res.data.avatarUrl, + userName: res.data.nickName, }) + }) .catch(err => { wx.showModal({ title: '提示', @@ -705,7 +723,7 @@ Page({ }) }) }, - gotoChengzhangzhi: function() { + gotoChengzhangzhi: function () { wx.navigateTo({ url: '/pages/czdetail/czdetail', }) @@ -715,17 +733,17 @@ Page({ url: '/pages/integralmall/index', }) }, - gotoBargain: function() { + gotoBargain: function () { wx.navigateTo({ url: '/pages/bargain/bargain', }) }, - gotoSpellGroup: function() { + gotoSpellGroup: function () { wx.navigateTo({ url: '/pages/spellGroup/spellGroup', }) }, - gotoCard: function() { + gotoCard: function () { wx.navigateTo({ url: '/pages/discountCardList/discountCardList', }) @@ -735,7 +753,7 @@ Page({ // url: '/pages/game/index', // }) // }, - gotoJfsc: function() { + gotoJfsc: function () { wx.navigateTo({ url: '/pages/integralmall/index', }) @@ -746,7 +764,7 @@ Page({ * @param {code,page} * 子组件向父组件传值 */ - onGetCode: function(e) { + onGetCode: function (e) { this.setData({ code: e.detail.val, page: e.detail.pageNum, @@ -754,10 +772,10 @@ Page({ console.log(e.detail.val) console.log(e.detail.pageNum) }, - getWeapNote: function(couponChannelId, couponId, orderId) { + getWeapNote: function (couponChannelId, couponId, orderId) { var that = this; - if (app.globalData.token) { + if (app.globalData.token) { // 登录 console.log(app.globalData.token) that.getmemberId(app.globalData.token); @@ -792,11 +810,11 @@ Page({ app.businessListCallback(app.globalData.token); } Http.get({ - url: config.api.getWeapNote, - data: { - appId: config.weapp.AppId, - } - }) + url: config.api.getWeapNote, + data: { + appId: config.weapp.AppId, + } + }) .then(res => { console.log(33333333333) console.log(app.globalData.token) @@ -856,11 +874,11 @@ Page({ app.businessListCallback(app.globalData.token); } Http.get({ - url: config.api.getWeapNote, - data: { - appId: config.weapp.AppId, - } - }) + url: config.api.getWeapNote, + data: { + appId: config.weapp.AppId, + } + }) .then(res => { console.log(33333333333) console.log(app.globalData.token) @@ -893,26 +911,26 @@ Page({ getStaticGame(token) { let _this = this; Http.get({ - url: config.api.getGame, - data: { - triggleAction: 2, // 固定入口 - token: token - } - }).then(res => { - if (res.data.id) { - _this.setData({ - showIf: true, - newUrl: res.data.imgUrl - }) - } else { - _this.setData({ - showIf: false - }) - } + url: config.api.getGame, + data: { + triggleAction: 2, // 固定入口 + token: token + } + }).then(res => { + if (res.data.id) { _this.setData({ - staticGamedata: res.data + showIf: true, + newUrl: res.data.imgUrl }) + } else { + _this.setData({ + showIf: false + }) + } + _this.setData({ + staticGamedata: res.data }) + }) .catch(err => { _this.setData({ showIf: false @@ -920,28 +938,28 @@ Page({ console.log(err) }) }, - getGameOne: function(token) { + getGameOne: function (token) { let _this = this; Http.get({ - url: config.api.getGame, - data: { - triggleAction: 1, // 登录触发 - token: token - } - }).then(res => { - if (res.data.id) { - _this.setData({ - showGame: true, - }) - } else { - _this.setData({ - showGame: false - }) - } + url: config.api.getGame, + data: { + triggleAction: 1, // 登录触发 + token: token + } + }).then(res => { + if (res.data.id) { _this.setData({ - gamedata: res.data + showGame: true, }) + } else { + _this.setData({ + showGame: false + }) + } + _this.setData({ + gamedata: res.data }) + }) .catch(err => { _this.setData({ showGame: false @@ -952,21 +970,21 @@ Page({ /** * mallinfo */ - getMallInfo: function(token) { + getMallInfo: function (token) { let that = this; Http.get({ - url: config.api.getMallInfo, - data: { - token: token, - } - }).then(res => { - that.setData({ - liveFlag: res.data.liveSupport, - weappShareTitle: res.data.weappShareTitle ? res.data.weappShareTitle : null, - weappShareCoverImg: res.data.weappShareCoverImg ? res.data.weappShareCoverImg : null, - }); - console.log(that.data.liveFlag, "||||") - }) + url: config.api.getMallInfo, + data: { + token: token, + } + }).then(res => { + that.setData({ + liveFlag: res.data.liveSupport, + weappShareTitle: res.data.weappShareTitle ? res.data.weappShareTitle : null, + weappShareCoverImg: res.data.weappShareCoverImg ? res.data.weappShareCoverImg : null, + }); + console.log(that.data.liveFlag, "||||") + }) .catch(err => { // 不需要错误提示 }); @@ -975,24 +993,24 @@ Page({ getxsList() { let that = this; Http.get({ - url: config.api.couponChannelList, - data: { - pageNum: 1, - pageSize: 3, - targetAd: 2 - } - }).then(res => { - if (res && res.data.total > 0) { - that.setData({ - xslist: res.data.list, - showQg: true - }); - } else { - that.setData({ - showQg: false - }) - } - }) + url: config.api.couponChannelList, + data: { + pageNum: 1, + pageSize: 3, + targetAd: 2 + } + }).then(res => { + if (res && res.data.total > 0) { + that.setData({ + xslist: res.data.list, + showQg: true + }); + } else { + that.setData({ + showQg: false + }) + } + }) .catch(err => { console.log(err) wx.showToast({ @@ -1006,21 +1024,21 @@ Page({ /** * banner */ - getBannerlist: function() { + getBannerlist: function () { let that = this; Http.get({ - url: config.api.bannerlist, - data: { - pageNum: 1, - pageSize: 7 - } - }).then(res => { - that.getmemberId(app.globalData.token); - // that.checkUserCarStatus(); - that.setData({ - list: res.data.list - }); - }) + url: config.api.bannerlist, + data: { + pageNum: 1, + pageSize: 7 + } + }).then(res => { + that.getmemberId(app.globalData.token); + // that.checkUserCarStatus(); + that.setData({ + list: res.data.list + }); + }) .catch(err => { that.getmemberId(app.globalData.token); // that.checkUserCarStatus(); @@ -1117,27 +1135,27 @@ Page({ }) }, // 专题显示 - topicShow: function() { + topicShow: function () { let that = this; Http.get({ - url: config.api.topicShow, - data: { - token: app.globalData.token - } - }).then(res => { - if (res && res.data) { - that.setData({ - name: res.data.name, - cover: res.data.cover, - id: res.data.id, - showTopic: true - }) - } else { - that.setData({ - showTopic: false - }) - } - }) + url: config.api.topicShow, + data: { + token: app.globalData.token + } + }).then(res => { + if (res && res.data) { + that.setData({ + name: res.data.name, + cover: res.data.cover, + id: res.data.id, + showTopic: true + }) + } else { + that.setData({ + showTopic: false + }) + } + }) .catch(err => { console.log(err); }) @@ -1204,48 +1222,47 @@ Page({ // } // }); // }, - gotoBargain: function() { + gotoBargain: function () { wx.navigateTo({ url: '/pages/bargain/bargain' }) }, //限时抢购的详情页面 - gotodetail: function(e) { + gotodetail: function (e) { wx.navigateTo({ - url: `/pages/coupon/detail/index?couponChannelId=${ - e.currentTarget.dataset.couponchannelid + url: `/pages/coupon/detail/index?couponChannelId=${e.currentTarget.dataset.couponchannelid }&couponId=${e.currentTarget.dataset.couponid}` }); }, //浮层广告 - getGg: function(token) { + getGg: function (token) { let that = this Http.get({ - url: config.api.getGg, - data: { - token: token, - appId: config.weapp.AppId, - openId: "" // wx.getStorageSync('openId') - } - }).then(res => { - console.log(res) - if (res.data.id) { - that.setData({ - showGg: true, - }) - console.log(that.data.showGg, 1111111111111) - } else { - that.setData({ - showGg: false - }) - that.getGameOne(app.globalData.token) - console.log(that.data.showGg, 222222222222222222) - } + url: config.api.getGg, + data: { + token: token, + appId: config.weapp.AppId, + openId: "" // wx.getStorageSync('openId') + } + }).then(res => { + console.log(res) + if (res.data.id) { that.setData({ - ggdata: res.data + showGg: true, }) + console.log(that.data.showGg, 1111111111111) + } else { + that.setData({ + showGg: false + }) + that.getGameOne(app.globalData.token) + console.log(that.data.showGg, 222222222222222222) + } + that.setData({ + ggdata: res.data }) + }) .catch(err => { this.setData({ showGg: false @@ -1257,7 +1274,7 @@ Page({ /** * 刷新 */ - onPullDownRefresh: function(e) { + onPullDownRefresh: function (e) { this.setData({ topicObj2: null, //欢乐城首页限时抢购 topicObj3: null, //欢乐城首页砍价 @@ -1297,7 +1314,7 @@ Page({ that.topicShow(); }, //加载更多 - onReachBottom: function() { + onReachBottom: function () { console.log("我到底了") let that = this; that.data.page++; @@ -1305,7 +1322,7 @@ Page({ page: that.data.page, businePageNum: that.data.businePageNum + 1 }); - console.log("加载更多页数" + that.data.page, ); + console.log("加载更多页数" + that.data.page,); console.log("加载更多key" + that.data.code); if (that.data.mouldType == 0) { //富茂源模板 //父组件获得子组件的方法 @@ -1320,15 +1337,15 @@ Page({ } }, - + // 用户点击右上角分享 - onShareAppMessage: function() { + onShareAppMessage: function () { app.globalData.previewFlag = true return { path: "/pages/index/index", title: this.data.weappShareTitle, imageUrl: this.data.weappShareCoverImg, - success: function(res) { + success: function (res) { wx.showToast({ title: "分享成功", duration: 1000, diff --git a/index/index.wxml b/index/index.wxml index 3341947..0a3e723 100644 --- a/index/index.wxml +++ b/index/index.wxml @@ -16,7 +16,7 @@ - + diff --git a/index/user.js b/index/user.js index 6cd03d8..22f4164 100644 --- a/index/user.js +++ b/index/user.js @@ -15,7 +15,7 @@ Page({ data: { mch_id: mch_id, - businessSwitch:businessSwitch, + businessSwitch: businessSwitch, goUrl: "", templateId: [], aboutShow: false, @@ -46,10 +46,10 @@ Page({ mineFlag: "", flag: 'hidden', score: '0', - credit:'0', - userId:"", - memberName:"", - memberLogo:"", + credit: '0', + userId: "", + memberName: "", + memberLogo: "", curPhone: '', name: "", birthdate: "", @@ -100,7 +100,7 @@ Page({ url: `/pages/getphoneInfo/index?path=main` }); }, -//是否授权手机号 + //是否授权手机号 ifPhoneInfo() { let that = this; Http.get({ @@ -136,7 +136,7 @@ Page({ /** * 跳转到成长值的页面 */ - gotograde: function() { + gotograde: function () { wx.navigateTo({ url: '/pages/czdetail/czdetail', }) @@ -144,12 +144,12 @@ Page({ /** * 跳转到商场信息的页面 */ - gomallInfo: function() { + gomallInfo: function () { wx.navigateTo({ url: '/pages/mallInfo/mallInfo', }) }, - showVersion: function() { + showVersion: function () { /** * 长按显示版本号 */ @@ -160,8 +160,12 @@ Page({ }); } }, - gotoedit: function() { - this.checkUserStatus(); + gotoedit: function () { + // this.checkUserStatus(); + console.log('goSetAvatar'); + wx.navigateTo({ + url: '/pages/setUserInfo/index' + }) }, onLoad() { // this.getLocation(); @@ -236,9 +240,9 @@ Page({ /** * 生命周期函数--监听页面显示 */ - onShow: function() { - - if (businessSwitch){ + onShow: function () { + + if (businessSwitch) { let openId = wx.getStorageSync("openId") this.setData({ goUrl: `plugin://auto-points-plugin/index?openid=${openId}&mch_id=${this.data.mch_id}` @@ -304,46 +308,46 @@ Page({ }; Http.get({ - url: config.api.getScore, - data: {} - }).then(res => { - if (res.data.address && res.data.name && res.data.sex && res.data.birthdate) { - that.setData({ - showEdit: true - }) - } - let curPhone = res.data.phone ? res.data.phone : ''; - if (curPhone) { - let curPhoneList = curPhone.split(''); - let curPhoneList01 = []; - curPhoneList.forEach((item, index) => { - if (index >= 3 && index <= 6) { - item = '*'; - } - curPhoneList01.push(item); - }) - curPhone = curPhoneList01.join(''); - } + url: config.api.getScore, + data: {} + }).then(res => { + if (res.data.address && res.data.name && res.data.sex && res.data.birthdate) { that.setData({ - score: res.data.score, - credit: res.data.credit, - curPhone: curPhone, - levelName: res.data.levelName, - userId: res.data.userId, - userAvatarUrl: res.data.avatarUrl, - userName: res.data.nickName + showEdit: true + }) + } + let curPhone = res.data.phone ? res.data.phone : ''; + if (curPhone) { + let curPhoneList = curPhone.split(''); + let curPhoneList01 = []; + curPhoneList.forEach((item, index) => { + if (index >= 3 && index <= 6) { + item = '*'; + } + curPhoneList01.push(item); }) - if (res.data.nickName) { - that.setData({ - ismember: true, - memberId: res.data.id - }) - var size = this.setCanvasSize(); - var initUrl = JSON.stringify({ - flagid: res.data.id - }); - } + curPhone = curPhoneList01.join(''); + } + that.setData({ + score: res.data.score, + credit: res.data.credit, + curPhone: curPhone, + levelName: res.data.levelName, + userId: res.data.userId, + userAvatarUrl: res.data.avatarUrl, + userName: res.data.nickName }) + if (res.data.nickName) { + that.setData({ + ismember: true, + memberId: res.data.id + }) + var size = this.setCanvasSize(); + var initUrl = JSON.stringify({ + flagid: res.data.id + }); + } + }) .catch(err => { wx.showModal({ title: '提示', @@ -357,29 +361,29 @@ Page({ //查询关于我们 Http.get({ - url: config.api.getMallInfo, - data: {} - }).then(res => { - if(res.code==200){ - this.setData({ - memberName:res.data.name, - memberLogo:res.data.imgUrlH - }) - } - if (res.data.businessHours !== '[]') { - that.setData({ - aboutShow: true - }) - } else { - that.setData({ - aboutShow: false - }) - } - }) - .catch(err => {}) + url: config.api.getMallInfo, + data: {} + }).then(res => { + if (res.code == 200) { + this.setData({ + memberName: res.data.name, + memberLogo: res.data.imgUrlH + }) + } + if (res.data.businessHours !== '[]') { + that.setData({ + aboutShow: true + }) + } else { + that.setData({ + aboutShow: false + }) + } + }) + .catch(err => { }) }, //适配不同屏幕大小的canvas - setCanvasSize: function() { + setCanvasSize: function () { var size = {}; try { var res = wx.getSystemInfoSync(); diff --git a/index/user.wxml b/index/user.wxml index ea9c60a..7e41085 100644 --- a/index/user.wxml +++ b/index/user.wxml @@ -20,7 +20,7 @@ -

{{userName}}

+

{{userName}}

- - - - - - 我的订单 + + + + + + 我的订单 - - - - - - 我的券包 - - - + + + + + + + 我的券包 - - - - - 我的卡包 - - + + - - - - - - 积分商城 + + + + + + 我的卡包 - - + + + + + + + + + 积分商城 + + + + - + - - 我的砍价 - > - + + 我的砍价 + > + - - 我的拼团 - > - + + 我的拼团 + > + - - 我的活动 - > - - + + 我的活动 + > + + + + + 完善个人信息 + > + + - - 特享礼遇 - > - + + 特享礼遇 + > + - - 兑换 - > - - - - - 问券调查 - > - - - - - 个人信息 - > - - - - - - 投诉建议 - > - - - - - 自助积分 - > - - - - - 关于我们 - > - - + + + 投诉建议 + > + + + + + 自助积分 + > + + + + + 关于我们 + > + + - - + - - + - - + - - + - - - + - - + - - + - - - + + - - + - - + - - + - + diff --git a/pages/edit/edit.js b/pages/edit/edit.js index 58218f1..0a9bcf1 100644 --- a/pages/edit/edit.js +++ b/pages/edit/edit.js @@ -9,15 +9,15 @@ Page({ * 页面的初始数据 */ data: { - childArr:[], + childArr: [], navigationBarHeight, chevronUrl: imgurl.chevron.url, date: '1988-03-12', - dateEnd:'', + dateEnd: '', flag: 1, flagsex: 0, - height:"", - weight:"", + height: "", + weight: "", items: [ { name: 1, value: '男', checked: false }, { name: 2, value: '女', checked: false }, @@ -27,7 +27,8 @@ Page({ array1: ['附近住户', '距离2km', '距离3km', '更远'], index: 0, index1: 0, - showPage:false + showPage: false, + type: true }, /** * 获得生日 @@ -65,13 +66,13 @@ Page({ }, fail: function (error) { console.log(error) - }, + }, complete: function (data) { } }) }, formSubmit: function (e) { - console.log(e.detail,"formSubmit") + console.log(e.detail, "formSubmit") let that = this; // console.log(that.data.childArr) /** @@ -105,38 +106,41 @@ Page({ } else { var birthdate = null; } - if (username == null || address == null || sex == 0 || birthdate == null) { - wx.showToast({ - title: '请输入完整的用户信息', - icon:"none" - }) - } else { - let tmeparr = [] - tmeparr = JSON.parse(JSON.stringify(that.data.childArr)) - console.log(that.data.childArr) - tmeparr.map(item=>{ - item.birthdate = new Date(item.birthdate).getTime() - }) - console.log(that.data.childArr) - Http.post({ - url: config.api.updateInfo, - data: { - sex: sex, - address: address, - name: username, - birthdate: birthdate, - childrenList: tmeparr, - height: e.detail.value.height ? e.detail.value.height : that.data.height, - weight: e.detail.value.weight ? e.detail.value.weight : that.data.weight, - } - }) + // if (username == null || address == null || sex == 0 || birthdate == null) { + // wx.showToast({ + // title: '请输入完整的用户信息', + // icon: "none" + // }) + // } else {} + let tmeparr = [] + tmeparr = JSON.parse(JSON.stringify(that.data.childArr)) + console.log(that.data.childArr) + tmeparr.map(item => { + item.birthdate = new Date(item.birthdate).getTime() + }) + console.log(that.data.childArr) + Http.post({ + url: config.api.updateInfo, + data: { + sex: sex, + address: address, + name: username, + birthdate: birthdate, + childrenList: tmeparr, + height: e.detail.value.height ? e.detail.value.height : that.data.height, + weight: e.detail.value.weight ? e.detail.value.weight : that.data.weight, + } + }) .then(res => { wx.showToast({ title: "信息提交成功,将在3分钟内生效", icon: 'none', duration: 2000, mask: false - }) + }), + setTimeout(() => { + wx.navigateBack() + }, 2000) }) .catch(err => { wx.showToast({ @@ -146,7 +150,7 @@ Page({ mask: false }) }) - } + }, radioChange: function (e) { this.setData({ @@ -154,7 +158,7 @@ Page({ flagsex: 1 }) }, - childSex(e){ + childSex(e) { let index = e.currentTarget.dataset.index let tmpeObj = this.data.childArr tmpeObj[index].sex = e.detail.value @@ -163,7 +167,7 @@ Page({ }) console.log(tmpeObj) }, - chidBirthday(e){ + chidBirthday(e) { let index = e.currentTarget.dataset.index let tmpeObj = this.data.childArr tmpeObj[index].birthdate = e.detail.value @@ -171,7 +175,7 @@ Page({ childArr: tmpeObj }) }, - chidName(e){ + chidName(e) { let index = e.currentTarget.dataset.index let tmpeObj = this.data.childArr tmpeObj[index].name = e.detail.value @@ -179,17 +183,17 @@ Page({ childArr: tmpeObj }) }, - childDel(e){ + childDel(e) { let index = e.currentTarget.dataset.index let tmpeObj = this.data.childArr - tmpeObj.splice(index,1) + tmpeObj.splice(index, 1) this.setData({ childArr: tmpeObj }) }, - childAdd(){ + childAdd() { let tmpeObj = this.data.childArr - tmpeObj.unshift({ sex:1}) + tmpeObj.unshift({ sex: 1 }) this.setData({ childArr: tmpeObj }) @@ -198,7 +202,12 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { - let tmpeDateEnd = util.formatTime(new Date(), "yyyy-MM-dd") + if (1 * options.type) { + this.setData({ + type: false + }) + } + let tmpeDateEnd = util.formatTime(new Date(), "yyyy-MM-dd") let that = this; that.setData({ dateEnd: tmpeDateEnd @@ -207,82 +216,83 @@ Page({ url: config.api.getScore, data: {}, }) - .then(res => {res.data - console.log(res); - if(res.code == 200){ - if (res.data.weight){ - this.setData({ - weight: res.data.weight + .then(res => { + res.data + console.log(res); + if (res.code == 200) { + if (res.data.weight) { + this.setData({ + weight: res.data.weight + }) + } + if (res.data.height) { + this.setData({ + height: res.data.height + }) + } + + if (res.data.childrenList) { + let tmpeArr = res.data.childrenList + tmpeArr.map(item => { + item.birthdate = util.fmtDate(parseInt(item.birthdate)) + that.setData({ + childArr: tmpeArr + }) + }) + } + that.setData({ + showPage: true, }) } - if (res.data.height) { - this.setData({ - height: res.data.height + var reg = RegExp(/address/); + if (res && res.data && res.data.address && res.data.address.match(reg)) { + that.setData({ + address: JSON.parse(res.data.address).address + JSON.parse(res.data.address).name, + addressStr: JSON.parse(res.data.address).address + JSON.parse(res.data.address).name + }) + } else { + that.setData({ + address: res.data.address, + addressStr: res.data.address }) } - - if (res.data.childrenList){ - let tmpeArr = res.data.childrenList - tmpeArr.map(item => { - item.birthdate = util.fmtDate(parseInt(item.birthdate)) - that.setData({ - childArr: tmpeArr - }) + if (res.data.name) { + that.setData({ + username: res.data.name }) } - that.setData({ - showPage:true, - }) - } - var reg = RegExp(/address/); - if (res&&res.data&&res.data.address&&res.data.address.match(reg)) { - that.setData({ - address: JSON.parse(res.data.address).address + JSON.parse(res.data.address).name, - addressStr: JSON.parse(res.data.address).address + JSON.parse(res.data.address).name - }) - }else{ - that.setData({ - address: res.data.address, - addressStr: res.data.address - }) - } - if (res.data.name) { - that.setData({ - username: res.data.name - }) - } - if (res.data.sex) { - if (res.data.sex == 1) { - var checked = 'items[' + 0 + '].checked' + if (res.data.sex) { + if (res.data.sex == 1) { + var checked = 'items[' + 0 + '].checked' + that.setData({ + [checked]: true, + flagsex: 1 + }) + } else if (res.data.sex == 2) { + var checked = 'items[' + 1 + '].checked' + that.setData({ + [checked]: true, + flagsex: 1 + }) + } that.setData({ - [checked]: true, - flagsex: 1 + sex: res.data.sex }) - } else if (res.data.sex == 2) { - var checked = 'items[' + 1 + '].checked' + } + if (res.data.birthdate) { that.setData({ - [checked]: true, - flagsex: 1 + date: util.fmtDate(parseInt(res.data.birthdate)), + flag: 2 }) } - that.setData({ - sex: res.data.sex - }) - } - if (res.data.birthdate) { - that.setData({ - date: util.fmtDate(parseInt(res.data.birthdate)), - flag: 2 - }) - } - }) - .catch(error=>{ - wx.showToast({ - title: error.errMsg, - icon: 'none', - duration: 2000, - mask: false - }); - }) + }) + .catch(error => { + wx.showToast({ + title: error.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) } }) \ No newline at end of file diff --git a/pages/edit/edit.wxml b/pages/edit/edit.wxml index 48147c7..cc583cd 100644 --- a/pages/edit/edit.wxml +++ b/pages/edit/edit.wxml @@ -1,78 +1,83 @@
- - 姓名 - - - - - 生日 - - - {{date}} - - - - - 身高 - - - - - 体重 - - - - - 性别 - - - {{item.value}} - - - + + + 姓名 + + + + + 生日 + + + {{date}} + + + + + 身高 + + + + + 体重 + + + + + 性别 + + + {{item.value}} + + + - - - 住址 - {{address}} - 请选择地址 - + + 住址 + {{address}} + 请选择地址 + + - + 添加子女信息 - - - - 姓名 - - - + + + 添加子女信息 - - 生日 - - - {{item.birthdate}} - - - + + + + 姓名 + + + + + + 生日 + + + {{item.birthdate}} + + + - - 性别 - - - - - - - - + + 性别 + + + + + + + + + + + 删除 - 删除 diff --git a/pages/getphoneInfo/index.js b/pages/getphoneInfo/index.js index 0d258c3..f44e691 100755 --- a/pages/getphoneInfo/index.js +++ b/pages/getphoneInfo/index.js @@ -14,10 +14,11 @@ Page({ skipUrl: 0, fillIndentId: "", couponId: "", + go: '' // skip: app.globalData.skip }, - onLoad: function(options) { - + onLoad: function (options) { + console.log(options, 'options'); var that = this; console.log(options.skipUrl, "options.skipUrl") if (options.skipUrl) { @@ -26,6 +27,12 @@ Page({ }) } + if (options.go) { + that.setData({ + go: options.go + }) + } + that.setData({ path: options.path }) @@ -44,7 +51,7 @@ Page({ }); } - if (options && options.mineFlag) { + if (options && options.mineFlag) { that.setData({ mineFlag: options.mineFlag }) @@ -56,18 +63,18 @@ Page({ } Http.get({ - url: config.api.marketicon, - data: { - appId: config.weapp.AppId - } - }).then(res => { - that.setData({ - mallImgUrl: res.data.mallImgUrl - }); - wx.setNavigationBarTitle({ - title: res.data.mallName - }) + url: config.api.marketicon, + data: { + appId: config.weapp.AppId + } + }).then(res => { + that.setData({ + mallImgUrl: res.data.mallImgUrl + }); + wx.setNavigationBarTitle({ + title: res.data.mallName }) + }) .catch(err => { wx.showToast({ title: err.errMsg, @@ -77,7 +84,7 @@ Page({ }); }) }, - onShow: function() { + onShow: function () { wx.checkSession({ success() { //session_key 未过期,并且在本生命周期一直有效 @@ -105,12 +112,12 @@ Page({ } }) }, - backHome: function() { + backHome: function () { wx.switchTab({ url: app.globalData.goHomeUrl, }) }, - getPhoneNumber: function(e) { + getPhoneNumber: function (e) { var that = this; var iv = e.detail.iv; var encryptedData = e.detail.encryptedData; @@ -223,15 +230,21 @@ Page({ wx.showToast({ title: res.data.msg, icon: "success", - success: function(res) { + success: function (res) { if (that.data.couponChannelId) { wx.redirectTo({ url: "/pages/coupon/detail/index?couponChannelId=" + that.data.couponChannelId + "&flag=pay" }) } else { - wx.switchTab({ - url: '/index/passCar', - }) + if (that.data.paramData.go) { + wx.navigateTo({ + url: '/pages/setUserInfo/index', + }) + } else { + wx.switchTab({ + url: '/index/passCar', + }) + } } } }); diff --git a/pages/setUserInfo/index.js b/pages/setUserInfo/index.js new file mode 100644 index 0000000..02a97e2 --- /dev/null +++ b/pages/setUserInfo/index.js @@ -0,0 +1,134 @@ +let app = getApp(); +const Http = require("../../utils/HttpBasics"); +const bgColor = require("../../utils/bgColor.js") +const config = require("../../config/config"); +const defaultAvatarUrl = 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0' + +Page({ + /** + * 页面的初始数据 + */ + data: { + avatarUrl: defaultAvatarUrl, + theme: wx.getSystemInfoSync().theme, + typeLsit: {}, + }, + + /** + * 获取全局样式 + */ + getType() { + Http.get({ + url: config.api.setType, + data: { + mouldType: app.globalData.mouldType + } + }).then(res => { + const { + code, + data + } = res + if (code == 200) { + app.globalData.typeLsit = data + this.setData({ + typeLsit: data, + }) + } + }) + }, + + getNickName(e) { + + }, + + formSubmit(e) { + const data = { + avatarUrl: this.data.avatarUrl, + nickName: e.detail.value.nickname + } + Http.post({ + url: "/user/updateUserInfo", + data, + }).then(res => { + if (res.code == 200) { + wx.showToast({ + title: '更改成功!', + duration: 2000 + }) + setTimeout(() => { + wx.navigateBack() + }, 2000) + } + }).catch(err => { + console.log(err); + }) + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.getType(), + wx.onThemeChange((result) => { + this.setData({ + theme: result.theme + }) + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + }, + + onChooseAvatar(e) { + const { avatarUrl } = e.detail + this.setData({ + avatarUrl, + }) + }, +}) \ No newline at end of file diff --git a/pages/setUserInfo/index.json b/pages/setUserInfo/index.json new file mode 100644 index 0000000..6290c34 --- /dev/null +++ b/pages/setUserInfo/index.json @@ -0,0 +1,8 @@ +{ + "usingComponents": { + "navbar": "/components/navbar/navbar" + }, + "enablePullDownRefresh": true, + "navigationBarBackgroundColor": "#F4F5F9", + "pageOrientation": "auto" +} \ No newline at end of file diff --git a/pages/setUserInfo/index.wxml b/pages/setUserInfo/index.wxml new file mode 100644 index 0000000..126ee59 --- /dev/null +++ b/pages/setUserInfo/index.wxml @@ -0,0 +1,15 @@ + + + + + 点击更换头像 + + + + + + + + \ No newline at end of file diff --git a/pages/setUserInfo/index.wxss b/pages/setUserInfo/index.wxss new file mode 100644 index 0000000..c157a2d --- /dev/null +++ b/pages/setUserInfo/index.wxss @@ -0,0 +1,36 @@ +@import "../../app.wxss"; + +.container { + margin-top: 200rpx; + padding: 0 40rpx 0 40rpx; + text-align: center; +} + +.avatar-wrapper { + padding: 0; + width: 103rpx !important; + border-radius: 10rpx; + margin-top: 40rpx; + margin-bottom: 40rpx; +} + +.avatar { + display: block; + width: 56px; + height: 56px; +} + +.des { + margin-bottom: 30rpx; +} + +.submit { + margin-top: 40rpx; +} + +.input { + text-align: left; + padding-left: 20rpx; + height: 70rpx; + border-bottom: 1px solid #afafaf; +} \ No newline at end of file diff --git a/pages/site/site.js b/pages/site/site.js index 8b9e24a..a093ade 100644 --- a/pages/site/site.js +++ b/pages/site/site.js @@ -9,7 +9,7 @@ Page({ data: { navigationBarHeight, }, - go(e){ + go(e) { let url = e.currentTarget.dataset.url wx.navigateTo({ url: url, @@ -20,7 +20,6 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { - }, /** diff --git a/pages/site/site.wxml b/pages/site/site.wxml index 24c7a46..27d1e2b 100644 --- a/pages/site/site.wxml +++ b/pages/site/site.wxml @@ -1,9 +1,13 @@ - + 我的个人信息 + + 我的子女信息 + + 我的收货地址 diff --git a/pages/theme/index1/index.js b/pages/theme/index1/index.js index 0292007..bb397ef 100644 --- a/pages/theme/index1/index.js +++ b/pages/theme/index1/index.js @@ -146,6 +146,23 @@ Page({ }) }) }, + + // 2022年11月8日微信收回接口“wx.getUserProfile”、“wx.getUserInfo”之后,需要手动设置用户头像与昵称 + goSetAvatar() { + const accreditFlag = this.data.accreditFlag + // 没授权手机号 + if (accreditFlag == 2) { + wx.navigateTo({ + url: '/pages/getphoneInfo/index?go="setUserInfo"' + }) + // 手机号已授权 + } else { + wx.navigateTo({ + url: '/pages/setUserInfo/index', + }) + } + }, + getCouponChannelList(key) { if (this.data.noDataFlag) { return diff --git a/pages/theme/index1/index.wxml b/pages/theme/index1/index.wxml index c7844b9..c5dc242 100644 --- a/pages/theme/index1/index.wxml +++ b/pages/theme/index1/index.wxml @@ -15,7 +15,7 @@ - + diff --git a/project.config.json b/project.config.json index 79c196c..0a33f27 100644 --- a/project.config.json +++ b/project.config.json @@ -34,7 +34,7 @@ }, "compileType": "miniprogram", "libVersion": "2.11.2", - "appid": "wx453ae0d37f3550d0", + "appid": "wxfa336cad86ed598d", "projectname": "C", "simulatorType": "wechat", "simulatorPluginLibVersion": {},