患者端提交

This commit is contained in:
zoujiandong 2023-11-17 16:40:45 +08:00
parent 7c0f376058
commit 63d7cb402d
6 changed files with 15 additions and 24 deletions

View File

@ -126,6 +126,7 @@ Page({
} }
let token = wx.getStorageSync('AUTH_TOKEN_'+usertype); let token = wx.getStorageSync('AUTH_TOKEN_'+usertype);
console.log(token); console.log(token);
console.log(url);
if(token){ if(token){
wx.switchTab({ wx.switchTab({
url: url url: url

View File

@ -6,7 +6,6 @@ Page({
data: { data: {
showEntryTip:false, showEntryTip:false,
showEntryTip_second:false, showEntryTip_second:false,
isLogin:false,
beforeClose(action){ beforeClose(action){
return new Promise((resolve) => { return new Promise((resolve) => {
if (action === 'confirm') { if (action === 'confirm') {
@ -24,14 +23,6 @@ Page({
checked: false, checked: false,
static_host: api.getStaticHost() static_host: api.getStaticHost()
}, },
onUnload: function() {
let isLogin=this.data.isLogin;
if(!isLogin){
wx.setStorageSync('usertype','');
}
// 页面销毁时执行
},
onLoad(){ onLoad(){
let usertype = wx.getStorageSync('usertype'); let usertype = wx.getStorageSync('usertype');
this.setData({ this.setData({
@ -139,12 +130,10 @@ Page({
api.wechatMobileLogin(params).then(response => { api.wechatMobileLogin(params).then(response => {
console.log(response); console.log(response);
wx.setStorageSync('AUTH_TOKEN_'+usertype, response.data.token); wx.setStorageSync('AUTH_TOKEN_'+usertype, response.data.token);
THIS.setData({
isLogin:true
})
wx.setStorageSync('user_id_'+usertype, response.data.user_id); wx.setStorageSync('user_id_'+usertype, response.data.user_id);
wx.setStorageSync('client_user_id_'+usertype, response.data.client_user_id); wx.setStorageSync('client_user_id_'+usertype, response.data.client_user_id);
app.globalData.config.userID = response.data.user_id; app.globalData.config.userID = response.data.user_id;
app.globalData.isLogin=true;
app.imInit(); app.imInit();
//跳转页面 //跳转页面
wx.switchTab({ wx.switchTab({

View File

@ -8,7 +8,6 @@ Page({
title: '手机号登录', //导航栏 中间的标题 title: '手机号登录', //导航栏 中间的标题
}, },
checked: false, checked: false,
isLogin:false,
phone: "", phone: "",
sms: "", sms: "",
btn_msg: "获取验证码", btn_msg: "获取验证码",
@ -52,13 +51,7 @@ Page({
}) })
} }
}, },
onUnload: function() {
let isLogin=this.data.isLogin;
if(!isLogin){
wx.setStorageSync('usertype','');
}
// 页面销毁时执行
},
getCodePhone(e){ getCodePhone(e){
let phone_reg = /^1[3-9]\d{9}$/; let phone_reg = /^1[3-9]\d{9}$/;
let phone = this.data.phone; let phone = this.data.phone;
@ -136,9 +129,7 @@ Page({
params.wx_code = res.code; params.wx_code = res.code;
api.mobileLogin(params).then(response => { api.mobileLogin(params).then(response => {
THIS.setData({ app.globalData.isLogin=true;
isLogin:true
})
console.log(response); console.log(response);
wx.setStorageSync('AUTH_TOKEN_'+usertype, response.data.token); wx.setStorageSync('AUTH_TOKEN_'+usertype, response.data.token);
wx.setStorageSync('user_id_'+usertype, response.data.user_id); wx.setStorageSync('user_id_'+usertype, response.data.user_id);

View File

@ -38,6 +38,8 @@ Page({
wx.setStorageSync('AUTH_TOKEN_'+usertype, ""); wx.setStorageSync('AUTH_TOKEN_'+usertype, "");
wx.setStorageSync('user_id_'+usertype, ""); wx.setStorageSync('user_id_'+usertype, "");
wx.setStorageSync('client_user_id_'+usertype, ""); wx.setStorageSync('client_user_id_'+usertype, "");
app.globalData.isLogin=false;
wx.setStorageSync('usertype','')
app.go("/Pages/index/index"); app.go("/Pages/index/index");
} else if (res.cancel) { } else if (res.cancel) {
console.log('用户点击取消') console.log('用户点击取消')

View File

@ -53,8 +53,11 @@ Page({
let usertype = wx.getStorageSync('usertype'); let usertype = wx.getStorageSync('usertype');
wx.setStorageSync('AUTH_TOKEN_'+usertype, ""); wx.setStorageSync('AUTH_TOKEN_'+usertype, "");
wx.setStorageSync('user_id_'+usertype, ""); wx.setStorageSync('user_id_'+usertype, "");
wx.setStorageSync('client_user_id_'+usertype, ""); wx.setStorageSync('client_user_id_'+usertype, "");
app.imLogout(); app.imLogout();
app.globalData.isLogin=false;
wx.setStorageSync('usertype','')
app.go("/Pages/index/index"); app.go("/Pages/index/index");
} else if (res.cancel) { } else if (res.cancel) {
console.log('用户点击取消') console.log('用户点击取消')

7
app.js
View File

@ -151,7 +151,6 @@ App({
wx.$TUIKit.logout(); wx.$TUIKit.logout();
wx.$TUIKit = undefined; wx.$TUIKit = undefined;
} }
wx.setStorageSync('usertype','');
this.clearAllInterval(); this.clearAllInterval();
this.globalData.chat_sdk_ready = false; this.globalData.chat_sdk_ready = false;
}, },
@ -219,6 +218,7 @@ App({
wx.$TUIKit = undefined wx.$TUIKit = undefined
} }
this.globalData.chat_sdk_ready = false this.globalData.chat_sdk_ready = false
this.globalData.isLogin=false;
this.go("/Pages/kickedout/index"); this.go("/Pages/kickedout/index");
}, },
$onSystemPushReceived(e){ $onSystemPushReceived(e){
@ -307,6 +307,11 @@ App({
formatWenZhenInfo(){ formatWenZhenInfo(){
this.getConversationList(); this.getConversationList();
}, },
onHide(){
if(!this.globalData.isLogin){
wx.setStorageSync('usertype','');
}
},
getConversationList(){ getConversationList(){
wx.$TUIKit.getConversationList().then((imResponse) => { wx.$TUIKit.getConversationList().then((imResponse) => {
// console.log("getConversationList from app js: ", imResponse.data.conversationList); // console.log("getConversationList from app js: ", imResponse.data.conversationList);