From 2b9a56a158e30fbdb51f29ed05d1d58020bae3fe Mon Sep 17 00:00:00 2001 From: slj Date: Mon, 13 Jun 2022 09:28:10 +0800 Subject: [PATCH] =?UTF-8?q?bug=20=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.js | 1 + pages/topics/reportDemand/index.js | 83 ++++++++++++++++++++++++++++++ pages/weChatAuth/index.js | 20 ++++++- project.private.config.json | 7 +++ 4 files changed, 109 insertions(+), 2 deletions(-) diff --git a/config.js b/config.js index e4a26a5..4181223 100644 --- a/config.js +++ b/config.js @@ -1,4 +1,5 @@ const config = { + // api_url: 'http://10.10.11.54:7101/fqsb', // 服务器地址 // api_url: 'http://10.10.11.44:7101/fqsb', // 服务器地址 api_url: 'https://shibeirencai.elinkit.com.cn:7101/fqsb' // 正式环境 // api_url: 'https://dingoa.elinkit.com.cn/fqsb', // 测试环境 diff --git a/pages/topics/reportDemand/index.js b/pages/topics/reportDemand/index.js index 2e6e455..4a2943e 100644 --- a/pages/topics/reportDemand/index.js +++ b/pages/topics/reportDemand/index.js @@ -9,6 +9,7 @@ import { TopicModel } from '../../../models/topic.js' let topicModel = new TopicModel() +const app = getApp() Page({ /** @@ -60,7 +61,89 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { + //进入页面判断是否绑定微信号,如果绑定手机号根据segmentIndex的数值fetch留言互动和赋能中心的资源,否则退回注册页面或者首页 + if (store.hasBindUserInfo()) { + console.log('已经绑定微信') + if (store.hasPhone()) { + console.log('已经绑定手机号码') + } else { + console.log('未绑定手机号码') + if (app.globalData.navigate.mobile) { + var params = { + phone: app.globalData.navigate.mobile, + nickName: app.globalData.navigate.nickname, + avatarUrl: app.globalData.navigate.faceImg + } + userModel.navigateUser(params, res => { + store.saveUserInfo({ + nickName: params.nickName, + avatarUrl: params.avatarUrl, + phone: params.phone + }) + }) + wx.reLaunch({ + url: '/pages/topics/reportDemand/index', + }) + } else { + wx.showModal({ + title: '温馨提示', + content: '是否前往验证手机号码?', + success(res) { + if (res.confirm) { + wx.redirectTo({ + url: '/pages/weChatAuth/index?type=2', + }) + } else if (res.cancel) { + wx.switchTab({ + url: '/pages/home/index', + }) + } + } + }) + } + } + } else { + console.log('--未绑定微信--') + console.log('app.globalData.navigate.mobile--',app.globalData.navigate.mobile) + if (app.globalData.navigate.mobile) { + console.log('app.globalData.navigate.mobile--',app.globalData.navigate.mobile) + var params = { + phone: app.globalData.navigate.mobile, + nickName: app.globalData.navigate.nickname, + avatarUrl: app.globalData.navigate.faceImg + } + userModel.navigateUser(params, res => { + store.saveUserInfo({ + nickName: params.nickName, + avatarUrl: params.avatarUrl, + phone: params.phone + }) + }) + wx.reLaunch({ + url: '/pages/topics/reportDemand/index', + }) + } else { + wx.showModal({ + title: '温馨提示', + content: '是否前往绑定微信?', + success(res) { + if (res.confirm) { + // wx.redirectTo({ + // url: '/pages/weChatAuth/index?tabType=funeng', + // }) + wx.redirectTo({ + url: '/pages/weChatAuth/index?tabType=reportDemand', + }) + } else if (res.cancel) { + wx.switchTab({ + url: '/pages/home/index', + }) + } + } + }) + } + } }, /** diff --git a/pages/weChatAuth/index.js b/pages/weChatAuth/index.js index 933680e..142d789 100644 --- a/pages/weChatAuth/index.js +++ b/pages/weChatAuth/index.js @@ -119,6 +119,12 @@ Page({ url: '/pages/user/index' }) } + if(tabType=='reportDemand'){ + app.globalData.currentTab = "4" + wx.navigateTo({ + url: `/pages/topics/reportDemand/index`, + }) + } } else { console.log('未绑定手机号码') wx.showModal({ @@ -164,9 +170,19 @@ Page({ data.iv = e.detail.iv; // data.session = app.globalData.session; userModel.wxRegister(data,res => { - wx.reLaunch({ - url: '/pages/home/index', + console.log('res---',res) + let tabType=this.data.tabType + console.log('tabType--',tabType) + if(tabType=='reportDemand'){ + app.globalData.currentTab = "4" + wx.navigateTo({ + url: `/pages/topics/reportDemand/index`, }) + return + } + wx.reLaunch({ + url: '/pages/home/index', + }) }); } } diff --git a/project.private.config.json b/project.private.config.json index 1d9dacd..db09dfc 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -155,6 +155,13 @@ "query": "", "launchMode": "default", "scene": null + }, + { + "name": "报需求", + "pathName": "pages/topics/reportDemand/index", + "query": "", + "launchMode": "default", + "scene": null } ] }