Browse Source

修复登录页面bug

master
longjieli 7 months ago
parent
commit
d57e31300c
5 changed files with 29 additions and 5 deletions
  1. +1
    -1
      api/api.js
  2. +1
    -1
      api/http.js
  3. +6
    -0
      pages.json
  4. +3
    -2
      pages/login/login.vue
  5. +18
    -1
      store/store.js

+ 1
- 1
api/api.js View File

@ -55,7 +55,7 @@ export function api(key, data, callback, loadingTitle){
if (req.auth) {
if (!uni.getStorageSync('token')) {
uni.navigateTo({
url: '/pages/login/mobile'
url: '/pages/login/login'
})
console.error('需要登录')
return


+ 1
- 1
api/http.js View File

@ -29,7 +29,7 @@ function http(uri, data, callback, method = 'GET', showLoading, title) {
uni.removeStorageSync('token')
console.error('登录过期');
uni.navigateTo({
url: '/pages/auth/login'
url: '/pages/login/login'
})
}


+ 6
- 0
pages.json View File

@ -11,6 +11,12 @@
"style": {
"navigationBarTitleText": "个人中心"
}
},
{
"path": "pages/login/login",
"style": {
"navigationBarTitleText": "登录"
}
}
],
"globalStyle": {


+ 3
- 2
pages/login/login.vue View File

@ -4,7 +4,7 @@
<!-- <image src="/static/image/login/logo.png" mode=""></image> -->
</view>
<view class="title">
欢迎使用xx加油
欢迎使用xx知识平台
</view>
<view class="btn mt">
<view class="icon">
@ -48,9 +48,10 @@
</template>
<script>
import configPopup from '../../components/config/configPopup.vue';
import configPopup from '@/components/configPopup/configPopup.vue'
export default {
name : 'Login',
components : { configPopup },
data() {
return {
checkboxValue : []


+ 18
- 1
store/store.js View File

@ -11,7 +11,11 @@ const store = new Vuex.Store({
configList: {}, //配置对象
userInfo : {},
},
getters: {},
getters: {
getConfig(state){
return state.configList
}
},
mutations: {
// 初始化配置
initConfig(state) {
@ -25,6 +29,14 @@ const store = new Vuex.Store({
}
})
})
let apiConfig = [ 'getPrivacyPolicy' , 'getUserAgreement' ] //需要访问不同接口才能得到的配置数据
let key = ['privacyAgreement','userAgreement']
apiConfig.forEach((item,index) => {
api(item,res => {
state.configList[key[index]] = res.result
})
})
},
login(state) {
uni.login({
@ -46,7 +58,12 @@ const store = new Vuex.Store({
uni.navigateTo({
url: '/pages/login/wxUserInfo'
})
}else{
uni.switchTab({
url: '/pages/contentDetail/contentDetail'
})
}
})
},
fail(err) {


Loading…
Cancel
Save