Commit d2b4cb48 by golton_gao

update: 代码优化

parent d6541678
......@@ -5,12 +5,14 @@ export const SetToken = function (val) {
if (env == 'development') {
val.$mas.token = testToken
val.$mas.uid = testUid
return Promise.resolve()
} else {
val.$nativeApi.account
return val.$nativeApi.account
.getUser()
.then(data => {
val.$mas.token = data.ssoToken
val.$mas.uid = data.uid
return null
})
.catch(error => {
console.log(error)
......
......@@ -45,8 +45,7 @@
import CHeader from "./components/commom/c-header.vue";
import { SetToken, code, projectMapUrl } from "./api.js";
import factory from "../libraries/plugins/factory";
import { setCookie, delCookie } from "~lib/utils/common";
import { delCookie } from "~lib/utils/common";
export default {
components: {
......@@ -89,9 +88,9 @@ export default {
return this.$store.state.shareStore.authObj.showReport;
},
},
beforeCreate() {
async beforeCreate() {
// 初始化 token
SetToken(this);
await SetToken(this);
// 修改导航条颜色
this.$nativeApi.system.statusBarColor([11, 20, 29, 1]);
......
......@@ -40,14 +40,15 @@ Vue.use(nativeApi, Object.assign({
maxRetryTimes: 10,
retrySleepTime: 100
}))
// Vue.use(mas, {
// baseUrl: 'https://mxytest.cndrealty.com:4433',
// code: 'cndvp-api'
// })
const baseUrl =
process.env.PACK_ENV === 'prod'
? 'https://jffcvp.cndrealty.com:4433'
: 'https://mxytest.cndrealty.com:4433'
Vue.use(mas, {
baseUrl: 'https://jffcvp.cndrealty.com:4433',
baseUrl: baseUrl,
code: 'cndvp-api'
})
Vue.use(VIscroll, {
mouseWheel: true,
click: false,
......
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