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 (req.auth) {
if (!uni.getStorageSync('token')) { if (!uni.getStorageSync('token')) {
uni.navigateTo({ uni.navigateTo({
url: '/pages/login/mobile'
url: '/pages/login/login'
}) })
console.error('需要登录') console.error('需要登录')
return return


+ 1
- 1
api/http.js View File

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


+ 6
- 0
pages.json View File

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


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

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


+ 18
- 1
store/store.js View File

@ -11,7 +11,11 @@ const store = new Vuex.Store({
configList: {}, //配置对象 configList: {}, //配置对象
userInfo : {}, userInfo : {},
}, },
getters: {},
getters: {
getConfig(state){
return state.configList
}
},
mutations: { mutations: {
// 初始化配置 // 初始化配置
initConfig(state) { 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) { login(state) {
uni.login({ uni.login({
@ -46,7 +58,12 @@ const store = new Vuex.Store({
uni.navigateTo({ uni.navigateTo({
url: '/pages/login/wxUserInfo' url: '/pages/login/wxUserInfo'
}) })
}else{
uni.switchTab({
url: '/pages/contentDetail/contentDetail'
})
} }
}) })
}, },
fail(err) { fail(err) {


Loading…
Cancel
Save