Commit d2b4cb48 by golton_gao

update: 代码优化

parent d6541678
...@@ -5,12 +5,14 @@ export const SetToken = function (val) { ...@@ -5,12 +5,14 @@ export const SetToken = function (val) {
if (env == 'development') { if (env == 'development') {
val.$mas.token = testToken val.$mas.token = testToken
val.$mas.uid = testUid val.$mas.uid = testUid
return Promise.resolve()
} else { } else {
val.$nativeApi.account return val.$nativeApi.account
.getUser() .getUser()
.then(data => { .then(data => {
val.$mas.token = data.ssoToken val.$mas.token = data.ssoToken
val.$mas.uid = data.uid val.$mas.uid = data.uid
return null
}) })
.catch(error => { .catch(error => {
console.log(error) console.log(error)
......
...@@ -45,8 +45,7 @@ ...@@ -45,8 +45,7 @@
import CHeader from "./components/commom/c-header.vue"; import CHeader from "./components/commom/c-header.vue";
import { SetToken, code, projectMapUrl } from "./api.js"; import { SetToken, code, projectMapUrl } from "./api.js";
import factory from "../libraries/plugins/factory"; import { delCookie } from "~lib/utils/common";
import { setCookie, delCookie } from "~lib/utils/common";
export default { export default {
components: { components: {
...@@ -89,9 +88,9 @@ export default { ...@@ -89,9 +88,9 @@ export default {
return this.$store.state.shareStore.authObj.showReport; return this.$store.state.shareStore.authObj.showReport;
}, },
}, },
beforeCreate() { async beforeCreate() {
// 初始化 token // 初始化 token
SetToken(this); await SetToken(this);
// 修改导航条颜色 // 修改导航条颜色
this.$nativeApi.system.statusBarColor([11, 20, 29, 1]); this.$nativeApi.system.statusBarColor([11, 20, 29, 1]);
...@@ -412,4 +411,4 @@ export default { ...@@ -412,4 +411,4 @@ export default {
} }
} }
} }
</style> </style>
\ No newline at end of file
...@@ -40,14 +40,15 @@ Vue.use(nativeApi, Object.assign({ ...@@ -40,14 +40,15 @@ Vue.use(nativeApi, Object.assign({
maxRetryTimes: 10, maxRetryTimes: 10,
retrySleepTime: 100 retrySleepTime: 100
})) }))
// Vue.use(mas, { const baseUrl =
// baseUrl: 'https://mxytest.cndrealty.com:4433', process.env.PACK_ENV === 'prod'
// code: 'cndvp-api' ? 'https://jffcvp.cndrealty.com:4433'
// }) : 'https://mxytest.cndrealty.com:4433'
Vue.use(mas, { Vue.use(mas, {
baseUrl: 'https://jffcvp.cndrealty.com:4433', baseUrl: baseUrl,
code: 'cndvp-api' code: 'cndvp-api'
}) })
Vue.use(VIscroll, { Vue.use(VIscroll, {
mouseWheel: true, mouseWheel: true,
click: false, click: false,
...@@ -85,4 +86,4 @@ export default [ ...@@ -85,4 +86,4 @@ export default [
'RouterStore', 'RouterStore',
'NativeApi', 'NativeApi',
'element-ui' 'element-ui'
] ]
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment