Browse Source

小程序登陆

h5_css
yanyan 3 years ago
parent
commit
224f6abf7f
  1. 2
      manifest.json
  2. 2
      pages/index/index.vue
  3. 8
      subpkg/login/login.vue

2
manifest.json

@ -50,7 +50,7 @@
/* 快应用特有相关 */ /* 快应用特有相关 */
"mp-weixin" : { "mp-weixin" : {
/* 小程序特有相关 */ /* 小程序特有相关 */
"appid" : "wxf733c344d8e69a99", "appid" : "wx93ec514a5c456507",
"setting" : { "setting" : {
"urlCheck" : false "urlCheck" : false
}, },

2
pages/index/index.vue

@ -44,7 +44,7 @@
}, },
onLoad() { onLoad() {
this.getSwiperList(); this.getSwiperList();
// this.checkLogin() this.checkLogin()
}, },
onShow() { onShow() {
this.page= "home" this.page= "home"

8
subpkg/login/login.vue

@ -51,10 +51,14 @@
} }
const { data: loginResult } = await uni.$http.post('/small/wechat/login', query) const { data: loginResult } = await uni.$http.post('/small/wechat/login', query)
if (loginResult.meta.status !== 200) return uni.$showMsg('登录失败!')
if (loginResult.token === "") return uni.$showMsg('登录失败!')
// 直接把 token 保存到 vuex 中 // 直接把 token 保存到 vuex 中
this.updateToken(loginResult.data) this.updateToken(loginResult.token)
uni.switchTab({
url: '/pages/index/index'
})
//this.navigateBack() //this.navigateBack()
}, },
navigateBack() { navigateBack() {

Loading…
Cancel
Save