Browse Source

token刷新修改

master
unknown 10 months ago
parent
commit
12ddd031ab
  1. 4
      config/api.js
  2. 4
      config/request.js
  3. 2
      config/site.config.js
  4. 28
      config/utils.js
  5. 4
      manifest.json
  6. 1
      pages/indexEntry/enroll/enroll.vue
  7. 10
      pages/indexEntry/enroll/signContract/signContract.vue
  8. 2
      pages/indexEntry/examines/warningEducation/warningEducation.vue
  9. 1
      pages/indexEntry/findShcool/findShcool.vue
  10. 26
      pages/mineEntry/carLearnHours/carLearnHours.vue
  11. 3
      pages/tabbar/index/index.vue
  12. 3
      pages/userCenter/login/login.vue
  13. BIN
      static/images/ic_dingdan.zip
  14. BIN
      static/images/logo.png
  15. BIN
      static/images/tabbar/sy.png
  16. BIN
      static/images/tabbar/syActive.png
  17. BIN
      static/images/tabbar/tk.png
  18. BIN
      static/images/tabbar/tkActive.png
  19. BIN
      static/images/tabbar/wd.png
  20. BIN
      static/images/tabbar/wdActive.png
  21. BIN
      static/images/tabbar/zx.png
  22. BIN
      static/images/tabbar/zxActive.png
  23. BIN
      static/images/userCenter/ic_dingdan@2x.png.zip
  24. BIN
      static/images/userCenter/ic_dingdan@2x.png/__MACOSX/._ic_dingdan@2x.png
  25. 1
      store/modules/user.js

4
config/api.js

@ -164,6 +164,10 @@ export const deleteTest = (params) => http.get('app/student-record/deleteTest',
export const getAgreement = (params={}) => http.get('app/student-record/getAgreement', {params})
// 学车流程
export const getDriveProcessDetails = (params={}) => http.get('app/student-record/getDriveProcessDetails', {params})
// 学时查询
export const getStudentProcess = (params={}) => http.get('app/student-process/getStudentProcess', {params})

4
config/request.js

@ -1,7 +1,7 @@
import { H5_API, WX_API,httpPrefix } from '@/config/site.config.js';
import { checkToken } from './utils'
import { refreshToken } from './utils'
@ -47,7 +47,7 @@ module.exports = (vm) => {
// console.log('请求结果')
// console.log(data)
if(data.code==406&&response.config.url!='member/auth/refresh-token'&&response.config.url!=='member/auth/logout') {
await vm.$store.dispatch('refreshToken')
await refreshToken()
let obj = response.config
let method = obj.method.toLowerCase()
if(method=='get') {

2
config/site.config.js

@ -3,7 +3,7 @@ const VUE_APP_PLATFORM = process.env.VUE_APP_PLATFORM;
module.exports = {
H5_API: VUE_APP_PLATFORM === 'h5' ? '/api' : '',//h5代理
WX_API: VUE_APP_PLATFORM === 'h5' ? '' : 'http://192.168.1.36:48080/',//非代理地址
// website: 'http://192.168.1.37:90/h5/#',
// website: 'http://192.168.1.37:90/h5/#', 192.168.1.15:48080/
website: 'http://192.168.1.37',
httpPrefix: 'app-api/',
imgUrl: 'https://jiangxijiakao-1.oss-cn-hangzhou.aliyuncs.com/defaultImages/app/bigImg/'

28
config/utils.js

@ -135,5 +135,33 @@ export function uploadImgApi(filePath, imgName) {
})
})
}
let apiOk =true
let refreshTokenFn = null
export function refreshToken() {
return new Promise(async(resolve, reject)=>{
if(!apiOk) {
return refreshTokenFn
}
apiOk = false
refreshTokenFn = null
const http = uni.$u.http
let config = { header: {'content-type': 'application/x-www-form-urlencoded; charset=UTF-8'}, custom: { noToken: true } }
let refreshToken = store.state.user.vuex_loginInfo.refreshToken
refreshTokenFn = await http.post('member/auth/refresh-token',{refreshToken}, config)
if( refreshTokenFn.data|| refreshTokenFn.data.accessToken) {
apiOk = true
store.commit('update_vuex_loginInfo', refreshTokenFn.data)
uni.$u.http.setConfig((config) => {
config.header.Authorization = 'Bearer ' + refreshTokenFn.data.accessToken
return config
})
resolve(refreshTokenFn)
}else {
apiOk = true
store.commit('goLogin')
reject('刷新token失败了')
}
})
}

4
manifest.json

@ -96,8 +96,8 @@
"disableHostCheck" : true,
"proxy" : {
"/api" : {
// "target" : "http://192.168.1.26:48080/",
"target" : "http://192.168.1.36:48080/",
"target" : "http://192.168.1.15:48080/",
// "target" : "http://192.168.1.36:48080/",
"changeOrigin" : true,
"secure" : true,
"pathRewrite" : {

1
pages/indexEntry/enroll/enroll.vue

@ -196,7 +196,6 @@
// this.$goPage('/pages/indexEntry/enroll/signContract/signContract?schoolId='+this.vuex_userInfo.schoolId)
// return
//
if(this.vuex_userInfo.applyStep==3) {
return this.$goPage('/pages/indexEntry/enroll/signContract/signContract')
}

10
pages/indexEntry/enroll/signContract/signContract.vue

@ -7,7 +7,7 @@
</view>
<view class="btnBg" @click="$goPage('/pages/indexEntry/enroll/payment/payment')">同意并签字确认</view>
</view> -->
<web-view :src="webViewUrl"></web-view>
<web-view :src="webViewUrl" @message="handleGetMessage"></web-view>
</view>
</template>
@ -52,6 +52,14 @@
uni.hideLoading()
this.webViewUrl = res.url
},
handleGetMessage(e){
console.log('handleGetMessage',e)
if(e.detail.data[0].result=='success'){
uni.navigateTo({
url: '/pages/indexEntry/enroll/payment/payment'
})
}
},
//
async getContractStatusFn() {
const {

2
pages/indexEntry/examines/warningEducation/warningEducation.vue

@ -15,7 +15,7 @@
<image src="@/static/images/index/btn_bofang.png" mode=""></image>
</view>
<view class="coverImg">
<image src="@/static/images/logo.png" mode=""></image>
<image src="@/static/images/index/avatar.png" mode=""></image>
</view>
</view>
<view class="rightTxt">

1
pages/indexEntry/findShcool/findShcool.vue

@ -130,6 +130,7 @@
.pageBgImg {
width: 100%;
min-height: 100vh;
background-size: 100% 392rpx;
.searchCon {
padding: 0 0 24rpx 0;
}

26
pages/mineEntry/carLearnHours/carLearnHours.vue

@ -29,16 +29,32 @@
<script>
import { imgUrl } from '@/config/site.config'
import { getStudentProcess } from '@/config/api.js'
export default {
data() {
return {
imgUrl: imgUrl+'carlearTimeBg.png',
backgroundSize: '100% 100%',
list: [
{total: 1024, time: 236, text: '模拟器'},
{total: 1024, time: 236, text: '科目一'},
{total: 1024, time: 236, text: '科目二'},
{total: 1024, time: 236, text: '科目三'},
list: []
}
},
onLoad() {
this.getStudentProcessFn()
},
onPullDownRefresh() {
this.getStudentProcessFn().then((res)=>{
uni.stopPullDownRefresh()
})
},
methods: {
async getStudentProcessFn() {
const {data: res} = await getStudentProcess({studentId: this.studentId})
console.log('基础不劳')
this.list = [
{total: res.simulateTotalTime, time: res.simulateValidTtime, text: '模拟器'},
{total: res.subjectOneTotalTime, time: res.subjectOneValidTtime, text: '科目一'},
{total: res.subjectTwoTotalTime, time: res.subjectTwoValidTtime, text: '科目二'},
{total: res.subjectThreeTotalTime, time: res.subjectOneValidTtime, text: '科目三'},
]
}
}

3
pages/tabbar/index/index.vue

@ -54,7 +54,7 @@
<!-- 更多入口 -->
<view class="card">
<view class="ul3">
<view class="li3" v-for="(item,index) in moreSection" :key="index" @click="goPageSection(item)">
<view class="li3" v-for="(item,index) in moreSection" :key="index">
<view class="icon">
<image :src="item.icon" mode=""></image>
</view>
@ -297,6 +297,7 @@
methods: {
async entrySectionClick(item) {
if(item.text=='我要报名') {
// return this.$goPage('/pages/indexEntry/enroll/signContract/signContract')
let token = this.$store.state.user.vuex_loginInfo.accessToken
if(!token) {
this.$store.commit('goLogin')

3
pages/userCenter/login/login.vue

@ -4,7 +4,7 @@
<image src="../../../static/images/userCenter/loginTitle.png" mode=""></image>
</view>
<view class="btnCon">
<view class="btn" @click="getPhoneNumber">手机号快捷登录 <button open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" class="hide">手机号</button></view>
<view class="btn" @click="getPhoneNumber">手机号快捷登录 <button open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" class="hide" v-if="isCheck">手机号</button> </view>
<view class="btn border" @click="$goPage('/pages/userCenter/login/loginByPhone');">手机号登录/注册</view>
</view>
<view style="margin-top: 40rpx;">
@ -51,6 +51,7 @@
},
methods: {
async getPhoneNumber (e) {
console.log(111)
if(!this.isCheck) return this.$u.toast('请勾选产品协议与隐私政策');
let phoneCode = e.detail.code
console.log(e.detail.errMsg) //

BIN
static/images/ic_dingdan.zip

BIN
static/images/logo.png

Before

Width: 100  |  Height: 100  |  Size: 10 KiB

BIN
static/images/tabbar/sy.png

Before

Width: 58  |  Height: 56  |  Size: 1.0 KiB

BIN
static/images/tabbar/syActive.png

Before

Width: 58  |  Height: 56  |  Size: 861 B

BIN
static/images/tabbar/tk.png

Before

Width: 58  |  Height: 56  |  Size: 929 B

BIN
static/images/tabbar/tkActive.png

Before

Width: 58  |  Height: 56  |  Size: 826 B

BIN
static/images/tabbar/wd.png

Before

Width: 58  |  Height: 56  |  Size: 1.6 KiB

BIN
static/images/tabbar/wdActive.png

Before

Width: 58  |  Height: 56  |  Size: 1.3 KiB

BIN
static/images/tabbar/zx.png

Before

Width: 58  |  Height: 56  |  Size: 587 B

BIN
static/images/tabbar/zxActive.png

Before

Width: 58  |  Height: 56  |  Size: 547 B

BIN
static/images/userCenter/ic_dingdan@2x.png.zip

BIN
static/images/userCenter/ic_dingdan@2x.png/__MACOSX/._ic_dingdan@2x.png

1
store/modules/user.js

@ -190,6 +190,7 @@ function wxAdsFn(longitude,latitude, commit,resolve, reject,) {
province: result.address_component.province,
district: result.address_component.district
}
console.log(obj)
commit('update_vuex_cityInfo', obj)
resolve(obj)
uni.hideLoading();

Loading…
Cancel
Save