Merge branch 'dev' of http://git.sinoecare.com/sinoecare/digital_village_v2/dvcp_v2_wechat_app into dev
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
"private": false,
|
"private": false,
|
||||||
"author": "Kubbo",
|
"author": "Kubbo",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "node bin/pages.js&&cross-env NODE_ENV=development VUE_APP_CW_MODE=dev UNI_PLATFORM=mp-weixin vue-cli-service uni-build --watch --minimize",
|
"dev": "node bin/pages.js&&cross-env NODE_ENV=development VUE_APP_CW_MODE=dev UNI_PLATFORM=mp-weixin vue-cli-service uni-build --watch",
|
||||||
"pages": "node bin/pages.js",
|
"pages": "node bin/pages.js",
|
||||||
"lib": "node bin/lib.js&&npm unpublish --force&&npm publish&&node bin/clean.js",
|
"lib": "node bin/lib.js&&npm unpublish --force&&npm publish&&node bin/clean.js",
|
||||||
"lib:all": "node src/project/build.js&&npm unpublish --workspaces --force&&npm publish --workspaces&&node bin/clean.js",
|
"lib:all": "node src/project/build.js&&npm unpublish --workspaces --force&&npm publish --workspaces&&node bin/clean.js",
|
||||||
@@ -39,10 +39,10 @@
|
|||||||
"@dcloudio/uni-stat": "^2.0.1-33920220208001",
|
"@dcloudio/uni-stat": "^2.0.1-33920220208001",
|
||||||
"@vue/shared": "^3.2.31",
|
"@vue/shared": "^3.2.31",
|
||||||
"axios": "^0.19.2",
|
"axios": "^0.19.2",
|
||||||
|
"axios-miniprogram-adapter": "^0.3.2",
|
||||||
"core-js": "^3.7.0",
|
"core-js": "^3.7.0",
|
||||||
"dayjs": "^1.9.5",
|
"dayjs": "^1.9.5",
|
||||||
"dvcp-wui": "^1.0.1",
|
"dvcp-wui": "^1.0.1",
|
||||||
"flyio": "^0.6.14",
|
|
||||||
"query-string": "^7.1.1",
|
"query-string": "^7.1.1",
|
||||||
"regenerator-runtime": "^0.12.1",
|
"regenerator-runtime": "^0.12.1",
|
||||||
"uview-ui": "^1.7.8",
|
"uview-ui": "^1.7.8",
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import tools from '../utils/util'
|
import tools from '../utils/util'
|
||||||
|
import {mapActions} from "vuex"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'AiLogin',
|
name: 'AiLogin',
|
||||||
@@ -22,6 +23,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
...mapActions(['autoLogin']),
|
||||||
show() {
|
show() {
|
||||||
tools.$getUserProfile().then(data => {
|
tools.$getUserProfile().then(data => {
|
||||||
this.userData = data.userInfo;
|
this.userData = data.userInfo;
|
||||||
@@ -45,7 +47,7 @@ export default {
|
|||||||
}, {withoutToken: true}).then(d => {
|
}, {withoutToken: true}).then(d => {
|
||||||
if (d.data) {
|
if (d.data) {
|
||||||
let data = {...this.userData, phone: d.data};
|
let data = {...this.userData, phone: d.data};
|
||||||
this.$autoLogin(data, this.$store).then(res => {
|
this.autoLogin(data, this.$store).then(res => {
|
||||||
this.$emit("success", res);
|
this.$emit("success", res);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,8 +87,8 @@ export default {
|
|||||||
this.$emit('list', this.fileList)
|
this.$emit('list', this.fileList)
|
||||||
},
|
},
|
||||||
upload(wait) {
|
upload(wait) {
|
||||||
let count = this.limit - (this.fileList?.length||0)
|
let count = this.limit - (this.fileList?.length || 0)
|
||||||
if(count>0){
|
if (count > 0) {
|
||||||
let params = {
|
let params = {
|
||||||
count,
|
count,
|
||||||
sizeType: ['compressed'],
|
sizeType: ['compressed'],
|
||||||
@@ -115,7 +115,7 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
uni.chooseFile(params)
|
uni.chooseFile(params)
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
this.$u.toast(`不能超过${this.limit}个`)
|
this.$u.toast(`不能超过${this.limit}个`)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -128,8 +128,9 @@ export default {
|
|||||||
this.$emit('manual', img)
|
this.$emit('manual', img)
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
} else {
|
} else {
|
||||||
|
console.log(this.$instance.defaults)
|
||||||
uni.uploadFile({
|
uni.uploadFile({
|
||||||
url: this.$instance.config.baseURL + this.action,
|
url: this.$instance.defaults.baseURL + this.action,
|
||||||
filePath: img.path,
|
filePath: img.path,
|
||||||
name: 'file',
|
name: 'file',
|
||||||
header: {
|
header: {
|
||||||
@@ -137,7 +138,6 @@ export default {
|
|||||||
Authorization: uni.getStorageSync('token'),
|
Authorization: uni.getStorageSync('token'),
|
||||||
},
|
},
|
||||||
success: response => {
|
success: response => {
|
||||||
uni.hideLoading()
|
|
||||||
const res = JSON.parse(response.data)
|
const res = JSON.parse(response.data)
|
||||||
if (res?.data) {
|
if (res?.data) {
|
||||||
this.$emit('data', res.data)
|
this.$emit('data', res.data)
|
||||||
@@ -160,9 +160,9 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
fail: err => {
|
fail: err => {
|
||||||
console.log(err)
|
console.error(err)
|
||||||
uni.hideLoading()
|
},
|
||||||
}
|
complete: () => uni.hideLoading()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
29
src/components/utils/http.js
Normal file
29
src/components/utils/http.js
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import axios from 'axios'
|
||||||
|
import adapter from 'axios-miniprogram-adapter'
|
||||||
|
|
||||||
|
const instance = axios.create({
|
||||||
|
timeout: 600000,
|
||||||
|
withCredentials: true,
|
||||||
|
adapter
|
||||||
|
})
|
||||||
|
const getToken = () => {
|
||||||
|
let vuex = uni.getStorageSync("vuex")
|
||||||
|
return !!vuex ? JSON.parse(vuex).token : null
|
||||||
|
}
|
||||||
|
const source = axios.CancelToken.source();
|
||||||
|
instance.interceptors.request.use(config => {
|
||||||
|
if (config.withoutToken) {
|
||||||
|
return config
|
||||||
|
} else if (getToken()) {
|
||||||
|
config.headers["Authorization"] = getToken()
|
||||||
|
} else {
|
||||||
|
config.cancelToken = source.token
|
||||||
|
source.cancel("用户未验证,取消请求:" + config.url)
|
||||||
|
}
|
||||||
|
return config
|
||||||
|
}, err => {
|
||||||
|
console.error(err)
|
||||||
|
return Promise.reject(err)
|
||||||
|
})
|
||||||
|
|
||||||
|
export default instance
|
||||||
97
src/components/utils/modules.js
Normal file
97
src/components/utils/modules.js
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
import http from "./http";
|
||||||
|
import Vue from "vue";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户登录信息
|
||||||
|
*/
|
||||||
|
export const user = {
|
||||||
|
state: () => ({}),
|
||||||
|
mutations: {
|
||||||
|
setUser(state, user) {
|
||||||
|
for (const key in user) {
|
||||||
|
Vue.set(state, key, user[key])
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
getUserInfo({commit}) {
|
||||||
|
//获取企业微信后台账号信息
|
||||||
|
//党员认证状态 partyStatusForWX:0、未认证 1、认证中 2、已认证
|
||||||
|
return http.post("/app/appwechatuser/check").then(res => {
|
||||||
|
if (res?.code == 0) {
|
||||||
|
commit('setUser', res.data)
|
||||||
|
return Promise.all([])
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getCode({dispatch}, count = 0) {
|
||||||
|
if (count > 3) {
|
||||||
|
return Promise.reject("无法获取code")
|
||||||
|
} else return new Promise((resolve, reject) => {
|
||||||
|
uni.login({
|
||||||
|
success: res => {
|
||||||
|
if (res?.code) {
|
||||||
|
resolve(res.code);
|
||||||
|
} else {
|
||||||
|
reject(res);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: () => resolve(dispatch("getCode", ++count))
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getToken({commit}, code) {
|
||||||
|
if (code) {
|
||||||
|
return http.post("/auth/wechat-con/token", {code}, {
|
||||||
|
headers: {"Authorization": "Basic d2VjaGF0OndlY2hhdA=="},
|
||||||
|
withoutToken: true
|
||||||
|
}).then(res => {
|
||||||
|
if (res?.access_token) {
|
||||||
|
const token = [res?.token_type, res?.access_token].join(" ").trim()
|
||||||
|
commit("setToken", token)
|
||||||
|
return token
|
||||||
|
} else {
|
||||||
|
uni.showToast({title: res?.msg})
|
||||||
|
return Promise.resolve(res?.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else return Promise.reject("缺少登录code")
|
||||||
|
},
|
||||||
|
autoLogin({dispatch}, count = 0) {
|
||||||
|
if (count <= 3) {
|
||||||
|
return dispatch("getCode").then(code => dispatch("getToken", code).catch(() => dispatch("autoLogin", ++count)))
|
||||||
|
} else return Promise.reject("登录失败,请联系管理员")
|
||||||
|
},
|
||||||
|
authCheck({state, dispatch}, {checkType, modulePath}) {
|
||||||
|
//用于进入应用的权限判断
|
||||||
|
//checkType 1、登录认证 2、居民认证 3、党员认证
|
||||||
|
//判断是否需要校验认证信息
|
||||||
|
let {token, user: userInfo} = state
|
||||||
|
if (!checkType) {
|
||||||
|
//如果需要校验认证信息,必定要先验证是否登录
|
||||||
|
uni.navigateTo({url: modulePath});
|
||||||
|
} else if (checkType == 1) {
|
||||||
|
if (!token) {
|
||||||
|
return dispatch('autoLogin');
|
||||||
|
}
|
||||||
|
uni.navigateTo({url: modulePath});
|
||||||
|
} else if (checkType == 2) {
|
||||||
|
if (!token) {
|
||||||
|
return dispatch('autoLogin');
|
||||||
|
}
|
||||||
|
if (!(userInfo.residentId && userInfo.status == 2)) {
|
||||||
|
return uni.navigateTo({url: '/mods/AppAuth/AppAuth'});
|
||||||
|
}
|
||||||
|
uni.navigateTo({url: modulePath});
|
||||||
|
} else if (checkType == 3) {
|
||||||
|
if (!token) {
|
||||||
|
return dispatch('autoLogin');
|
||||||
|
}
|
||||||
|
if (!userInfo.partyId) {
|
||||||
|
return uni.showToast({title: "您还不是党员,暂时无法使用该功能", icon: "none"});
|
||||||
|
}
|
||||||
|
uni.navigateTo({url: modulePath});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -328,30 +328,6 @@ const $getLoginCode = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const $autoLogin = (params, store) => {
|
|
||||||
params = params ? params : {};
|
|
||||||
return new Promise(function (resolve, reject) {
|
|
||||||
$getLoginCode().then((res) => {
|
|
||||||
let body = {...params, code: res.code};
|
|
||||||
store.commit('getToken', {
|
|
||||||
...body,
|
|
||||||
then: (v1) => {
|
|
||||||
if (v1) {
|
|
||||||
store.commit('getUserInfo', (v2) => {
|
|
||||||
if (v2) {
|
|
||||||
resolve(v2);
|
|
||||||
} else {
|
|
||||||
reject(v2);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
reject(v1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
export default {
|
export default {
|
||||||
$toast,
|
$toast,
|
||||||
$loading,
|
$loading,
|
||||||
@@ -366,6 +342,5 @@ export default {
|
|||||||
$dayjs,
|
$dayjs,
|
||||||
$dict,
|
$dict,
|
||||||
$getLoginCode,
|
$getLoginCode,
|
||||||
$autoLogin,
|
|
||||||
$qs
|
$qs
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -9,13 +9,13 @@ import 'uview-ui/theme.scss'
|
|||||||
|
|
||||||
Vue.use(vui)
|
Vue.use(vui)
|
||||||
Vue.config.productionTip = false
|
Vue.config.productionTip = false
|
||||||
Vue.prototype.$instance = axios.instance
|
Vue.prototype.$instance = axios
|
||||||
Vue.prototype.$areaId = config.areaId;
|
Vue.prototype.$areaId = config.areaId;
|
||||||
Vue.prototype.$areaName = config.areaName;
|
Vue.prototype.$areaName = config.areaName;
|
||||||
Vue.prototype.$cdn = 'https://cdn.cunwuyun.cn/'
|
Vue.prototype.$cdn = 'https://cdn.cunwuyun.cn/'
|
||||||
App.mpType = 'app'
|
App.mpType = 'app'
|
||||||
Object.keys(utils).map(e => Vue.prototype[e] = utils[e])
|
Object.keys(utils).map(e => Vue.prototype[e] = utils[e])
|
||||||
utils.$dict.init(axios.instance)
|
utils.$dict.init(axios)
|
||||||
|
|
||||||
const app = new Vue({
|
const app = new Vue({
|
||||||
store,
|
store,
|
||||||
|
|||||||
@@ -30,11 +30,10 @@
|
|||||||
<div class="appName fill" v-text="app.name"/>
|
<div class="appName fill" v-text="app.name"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<AiLogin ref="login" @success="getAuth()"/>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import {mapMutations, mapState} from 'vuex'
|
import {mapActions, mapState} from 'vuex'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "home",
|
name: "home",
|
||||||
@@ -57,18 +56,18 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapMutations(['getUserInfo']),
|
...mapActions(['getUserInfo', 'autoLogin']),
|
||||||
handleLogin() {
|
handleLogin() {
|
||||||
if (!this.token) {
|
if (!this.token) {
|
||||||
this.$refs.login.show();
|
this.autoLogin();
|
||||||
}
|
} else this.$u.toast("已登录,无需重新登录!")
|
||||||
},
|
},
|
||||||
handleGotoApp(app) {
|
handleGotoApp(app) {
|
||||||
uni.navigateTo({url: `${app.path}`})
|
uni.navigateTo({url: `${app.path}`})
|
||||||
},
|
},
|
||||||
getApps() {
|
getApps() {
|
||||||
this.$instance.post("/node/wechatapps/list", null, {
|
this.$instance.post("/node/wechatapps/list", null, {
|
||||||
baseURL: "http://192.168.1.87:12525", params: {size: 999, type: 'mp'}
|
baseURL: "http://192.168.1.87:12525", params: {size: 999, type: 'mp'}, withoutToken: true
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res?.data) {
|
if (res?.data) {
|
||||||
this.apps = res.data.records.map(e => {
|
this.apps = res.data.records.map(e => {
|
||||||
@@ -80,14 +79,13 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getAuth() {
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.getUserInfo()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.getAuth();
|
if (this.token) {
|
||||||
|
this.getUserInfo();
|
||||||
|
} else {
|
||||||
|
this.autoLogin().then(() => this.getUserInfo())
|
||||||
|
}
|
||||||
this.getApps()
|
this.getApps()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,97 +1,25 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
import perState from 'vuex-persistedstate'
|
import perState from 'vuex-persistedstate'
|
||||||
import http from "../utils/axios";
|
import * as modules from "dvcp-wui/utils/modules"
|
||||||
|
|
||||||
Vue.use(Vuex)
|
Vue.use(Vuex)
|
||||||
|
|
||||||
const store = new Vuex.Store({
|
const store = new Vuex.Store({
|
||||||
state: {
|
state: {
|
||||||
/**
|
token: ""
|
||||||
* 是否需要强制登录
|
|
||||||
*/
|
|
||||||
forcedLogin: false,
|
|
||||||
token: "",
|
|
||||||
userName: "",
|
|
||||||
user: {
|
|
||||||
username: "",
|
|
||||||
avatarUrl: "",
|
|
||||||
nickName: "",
|
|
||||||
gender: "",
|
|
||||||
token: "",
|
|
||||||
phoneNumber: ''
|
|
||||||
},
|
|
||||||
global: {
|
|
||||||
areaId: ""
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
getToken(state, params) {
|
|
||||||
if (params?.code) {
|
|
||||||
http.instance.post("/auth/wechat-con/token", params, {
|
|
||||||
headers: {"Authorization": "Basic d2VjaGF0OndlY2hhdA=="},
|
|
||||||
withoutToken: true
|
|
||||||
}).then(res => {
|
|
||||||
if (res?.access_token) {
|
|
||||||
store.commit("setToken", res.token_type + ' ' + res.access_token)
|
|
||||||
params?.then?.(true)
|
|
||||||
} else {
|
|
||||||
uni.showToast({title: res?.msg})
|
|
||||||
params?.then?.(false)
|
|
||||||
}
|
|
||||||
}).finally(err => console.error(err))
|
|
||||||
} else params?.then(false)
|
|
||||||
},
|
|
||||||
setToken(state, token) {
|
setToken(state, token) {
|
||||||
state.token = token
|
state.token = token
|
||||||
},
|
},
|
||||||
setUserInfo(state, user) {
|
logout(state, showToast) {
|
||||||
state.user = user
|
|
||||||
},
|
|
||||||
getUserInfo(state, cb) {
|
|
||||||
http.instance.post("/app/appwechatuser/check").then(res => {
|
|
||||||
if (res?.data) {
|
|
||||||
store.commit("setUserInfo", res.data)
|
|
||||||
cb && cb(true)
|
|
||||||
} else {
|
|
||||||
cb && cb(false)
|
|
||||||
}
|
|
||||||
}).catch(err => {
|
|
||||||
console.error(err)
|
|
||||||
cb && cb(false)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
login(state, ploy) {
|
|
||||||
state.userName = ploy.userName || '新用户';
|
|
||||||
state.token = ploy.token
|
|
||||||
},
|
|
||||||
logout(state) {
|
|
||||||
state.userName = "";
|
|
||||||
state.token = ""
|
state.token = ""
|
||||||
uni.setStorageSync('userInfo', {})
|
state.user = {}
|
||||||
uni.setStorageSync('vuex', {})
|
showToast && uni.showToast({title: `登录失效,请重新登录`, duration: 2000, icon: 'none'})
|
||||||
state.user = {
|
|
||||||
username: "",
|
|
||||||
avatarUrl: "",
|
|
||||||
nickName: "",
|
|
||||||
gender: "",
|
|
||||||
token: "",
|
|
||||||
phoneNumber: ''
|
|
||||||
}
|
|
||||||
uni.showToast({title: `登录失效,请重新登录`, duration: 2000, icon: 'none'})
|
|
||||||
},
|
},
|
||||||
setUser(state, info) {
|
|
||||||
state.user = info
|
|
||||||
},
|
|
||||||
getUser(state, ploy) {
|
|
||||||
state.user.nickName = ploy.nickName;
|
|
||||||
state.user.avatarUrl = ploy.avatarUrl;
|
|
||||||
state.user.gender = ploy.gender;
|
|
||||||
},
|
|
||||||
getUserPhoneNumber(state, ploy) {
|
|
||||||
state.user.phoneNumber = ploy.phoneNumber;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
modules,
|
||||||
plugins: [perState({
|
plugins: [perState({
|
||||||
storage: {
|
storage: {
|
||||||
getItem: key => uni.getStorageSync(key),
|
getItem: key => uni.getStorageSync(key),
|
||||||
|
|||||||
@@ -1,52 +1,23 @@
|
|||||||
import config from '@/utils/config';
|
import setting from './config';
|
||||||
import util from 'dvcp-wui/utils/util';
|
import util from 'dvcp-wui/utils/util';
|
||||||
import store from "../store"
|
import store from "../store"
|
||||||
|
import instance from "dvcp-wui/utils/http";
|
||||||
|
|
||||||
const Fly = require('flyio/dist/npm/wx');
|
instance.defaults.baseURL = setting.baseUrl
|
||||||
let instance = new Fly();
|
|
||||||
const baseURL = config.baseUrl;
|
|
||||||
let count = 0;
|
|
||||||
instance.config.timeout = 50000;
|
|
||||||
instance.config.baseURL = baseURL;
|
|
||||||
|
|
||||||
const getToken = () => {
|
instance.interceptors.response.use(response => {
|
||||||
if (store.state.token) return store.state.token;
|
util.$hideLoading();
|
||||||
else return '';
|
if (response.data.code === 1) {
|
||||||
};
|
util.$toast({title: response.data.msg, duration: 3000});
|
||||||
|
} else if (response.data.code == 2) {
|
||||||
instance.interceptors.request.use((config) => {
|
//首次静默登录异常不做任何返回
|
||||||
if (!config.withoutToken) {
|
} else if (response.data.code == 401) {
|
||||||
config.headers['Authorization'] = getToken();
|
return store.commit('logout')
|
||||||
|
} else {
|
||||||
|
return response.data;
|
||||||
}
|
}
|
||||||
return config;
|
}, err => {
|
||||||
|
console.error(err);
|
||||||
});
|
});
|
||||||
|
|
||||||
instance.interceptors.response.use(
|
export default instance
|
||||||
function (response) {
|
|
||||||
util.$hideLoading();
|
|
||||||
if (response.data.code === 1) {
|
|
||||||
util.$toast({title: response.data.msg, duration: 3000});
|
|
||||||
} else if (response.data.code == 2) {
|
|
||||||
//首次静默登录异常不做任何返回
|
|
||||||
} else if (response.data.code == 401) {
|
|
||||||
if (count > 3) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
count++;
|
|
||||||
return util.$getLoginCode().then((res) => {
|
|
||||||
store.commit("getToken", {code: res.code})
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
count = 0;
|
|
||||||
return response.data;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
function (err) {
|
|
||||||
console.log(err);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
export default {
|
|
||||||
instance,
|
|
||||||
baseURL
|
|
||||||
};
|
|
||||||
|
|||||||
Reference in New Issue
Block a user