作者 lihongjuan

1

... ... @@ -71,9 +71,18 @@ data(){
},
methods:{
toPubArticle(){
wx.navigateTo({
url:"./pubArticle"
})
let token=uni.getStorageSync("token");
if(token==''{
uni.showToast({
title:'请登录后操作',
icon:'none'
})
}else{
wx.navigateTo({
url:"./pubArticle"
})
}
},
getuserinfo(){
var that = this
... ...
... ... @@ -37,10 +37,14 @@
if(options.istoken!=undefined){
this.istoken=options.istoken
}
console.log(uni.getStorageSync('token'))
console.log(this.istoken)
if(uni.getStorageSync('token')!=''&&this.istoken==''){
this.getusermsg()
}else if (uni.getStorageSync('token')==''&&this.istoken==''){
uni.navigateTo({
uni.setStorageSync("chosetype",1)
uni.switchTab({
url:'../school/school'
})
}
... ... @@ -76,8 +80,9 @@
token:uni.getStorageSync('token')
}
app.post(url,params,"get").then((res)=>{
uni.setStorageSync("chosetype",1)
if(res.level==1){
uni.setStorageSync("chosetype",1)
wx.switchTab({
url:'../school/school'
})
... ... @@ -90,10 +95,10 @@
}).catch((err)=>{
console.log(err)
uni.setStorageSync("chosetype",1)
uni.clearStorageSync()
wx.switchTab({
url:'../school/school'
})
uni.clearStorageSync()
})
},
... ... @@ -125,19 +130,14 @@
uni.login({
provider: "weixin",
success(r) {
console.log(r)
let url = "common/getSessionKey";
app.post(url, {
code: r.code
}, "post").then(r => {
console.log(r)
that.session_key = r.session_key;
that.openid = r.openid;
console.log(that.session_key);
console.log(that.openid)
// uni.setStorageSync('openid', r.openid);
// uni.setStorageSync('session_key', r.session_key);
}).catch(err => {})
... ...