From b6347305d3d9c0379cdfcd0f5c9e7947f9671dfa Mon Sep 17 00:00:00 2001 From: wangxiaohua <1214073490@qq.com> Date: Thu, 30 Dec 2021 16:33:16 +0800 Subject: [PATCH] init --- config.js | 2 +- pages/index/guide.vue | 78 ++++++++++++++++++++++++++++++++++--------- utils/http.js | 4 +-- 3 files changed, 66 insertions(+), 18 deletions(-) diff --git a/config.js b/config.js index 6419d1c..b0986c8 100644 --- a/config.js +++ b/config.js @@ -6,7 +6,7 @@ var host = 'http://121.42.63.138:9091/autoSR/api'; // 测试站 // var host = 'http://192.168.31.169:8080/autoSR/api'; // 长龙 // var host = 'http://192.168.31.134:8080/autoSR/api'; // 佳豪 // var host = 'http://10.2.1.104:8081/autoSR/api'; // 刘敏 -// var host = 'https://zkgj.quhouse.com/api'; // 质控正式 +var host = 'https://zkgj.quhouse.com/api'; // 质控正式 // var host = 'https://hfju.com/api'; // 数智正式 diff --git a/pages/index/guide.vue b/pages/index/guide.vue index 6a9694c..db2b63d 100644 --- a/pages/index/guide.vue +++ b/pages/index/guide.vue @@ -45,27 +45,75 @@ export default { data() { return { - + name:"", + path:'/pages/index/index', + pathurl:'/pages/index/index', + pathur2:'/pages/index/customer', + pathur3:'/pages/center/prohibited/index', }; }, + onLoad(opts) { + this.name=opts.loginName ||''; + let stat=opts.path||''; + if(stat==1){ + this.path=this.pathur3; + }else if(stat==2){ + this.path=this.pathur2; + }else{ + this.path=this.pathurl; + } + }, onShow: function() { - uni.request({ - url: config.service.verify, - method: "GET", - header: { - 'content-type': 'application/json', - 'Access-Token': uni.getStorageSync('weapp_session_login_data').token - }, - success: (data) => { - if (data.data.code == 10000) { - uni.switchTab({ - url: '/pages/index/index' - }); + if(this.name==''){ + uni.request({ + url: config.service.verify, + method: "GET", + header: { + 'content-type': 'application/json', + 'Access-Token': uni.getStorageSync('weapp_session_login_data').token + }, + success: (data) => { + if (data.data.code == 10000) { + uni.switchTab({ + url: '/pages/index/index' + }); + } } + }) + }else{ + var userInfo=uni.getStorageSync('weapp_session_userInfo_data'); + if(userInfo){ + console.log(userInfo.loginName) + if(this.name==userInfo.loginName){ + uni.request({ + url: config.service.verify, + method: "GET", + header: { + 'content-type': 'application/json', + 'Access-Token': uni.getStorageSync('weapp_session_login_data').token + }, + success: (data) => { + if (data.data.code == 10000) { + uni.switchTab({ + url:this.path + }); + } + } + }) + }else{ + console.log("不是本人") + } + }else{ + console.log("没有用户信息") } - }) + } + + + + + + }, - onHide: function() {}, methods: { bindWxBLogin() { wx.navigateTo({ diff --git a/utils/http.js b/utils/http.js index d9610ae..761ef4c 100644 --- a/utils/http.js +++ b/utils/http.js @@ -1,9 +1,9 @@ -const baseUrl = 'http://121.42.63.138:9091/autoSR/api';// 测试站 +// const baseUrl = 'http://121.42.63.138:9091/autoSR/api';// 测试站 // const baseUrl = 'http://192.168.31.169:8080/autoSR/api'; // 长龙 // const baseUrl = 'http://192.168.31.134:8080/autoSR/api'; // 佳豪 // const baseUrl = 'http://10.2.1.104:8081/autoSR/api'; // 刘敏 -// const baseUrl = 'https://zkgj.quhouse.com/api'; // 质控正式 +const baseUrl = 'https://zkgj.quhouse.com/api'; // 质控正式 // const baseUrl = 'https://hfju.com/api'; // 数智正式 const install = (Vue, vm) => {