|
@@ -1,76 +1,69 @@
|
|
|
import Vue from 'vue'
|
|
|
import App from './App'
|
|
|
-import store from "store";
|
|
|
-import uView from "uview-ui";
|
|
|
-Vue.use(uView);
|
|
|
+import store from 'store'
|
|
|
+import uView from 'uview-ui'
|
|
|
+Vue.use(uView)
|
|
|
|
|
|
Vue.config.productionTip = false
|
|
|
|
|
|
-import {
|
|
|
- setStorage,
|
|
|
- getStorage,
|
|
|
- removeStorage
|
|
|
-} from "@/common/utils/storage.js"
|
|
|
+import { setStorage, getStorage, removeStorage } from '@/common/utils/storage.js'
|
|
|
|
|
|
// #ifdef H5
|
|
|
// 解析地址栏参数
|
|
|
function getQueryVariable(variable) {
|
|
|
// 从?开始获取后面的所有数据
|
|
|
- var query = window.location.search.substring(1);
|
|
|
+ var query = window.location.search.substring(1)
|
|
|
// 从字符串&开始分隔成数组split
|
|
|
- var vars = query.split('&');
|
|
|
+ var vars = query.split('&')
|
|
|
// 遍历该数组
|
|
|
for (var i = 0; i < vars.length; i++) {
|
|
|
// 从等号部分分割成字符
|
|
|
- var pair = vars[i].split('=');
|
|
|
+ var pair = vars[i].split('=')
|
|
|
// 如果第一个元素等于 传进来的参的话 就输出第二个元素
|
|
|
if (pair[0] == variable) {
|
|
|
- return (pair[1]);
|
|
|
+ return pair[1]
|
|
|
}
|
|
|
}
|
|
|
- return undefined;
|
|
|
+ return undefined
|
|
|
}
|
|
|
-if (getQueryVariable("x-token")) {
|
|
|
- setStorage('token', getQueryVariable("x-token") || '')
|
|
|
+if (getQueryVariable('x-token')) {
|
|
|
+ setStorage('token', getQueryVariable('x-token') || '')
|
|
|
}
|
|
|
-if (getQueryVariable("openId")) {
|
|
|
- setStorage('openId', getQueryVariable("openId") || '')
|
|
|
+if (getQueryVariable('openId')) {
|
|
|
+ setStorage('openId', getQueryVariable('openId') || '')
|
|
|
}
|
|
|
-if (getQueryVariable("username")) {
|
|
|
- setStorage('name', getQueryVariable("username") || '')
|
|
|
+if (getQueryVariable('username')) {
|
|
|
+ setStorage('name', getQueryVariable('username') || '')
|
|
|
}
|
|
|
-if (getQueryVariable("useravatar")) {
|
|
|
- setStorage('avatar', getQueryVariable("useravatar") || '')
|
|
|
+if (getQueryVariable('useravatar')) {
|
|
|
+ setStorage('avatar', getQueryVariable('useravatar') || '')
|
|
|
}
|
|
|
-if (getQueryVariable("userId")) {
|
|
|
- setStorage('userId', getQueryVariable("userId") || '')
|
|
|
+if (getQueryVariable('userId')) {
|
|
|
+ setStorage('userId', getQueryVariable('userId') || '')
|
|
|
}
|
|
|
-if (getQueryVariable("mobile")) {
|
|
|
- setStorage('mobile', getQueryVariable("mobile") || '')
|
|
|
+if (getQueryVariable('mobile')) {
|
|
|
+ setStorage('mobile', getQueryVariable('mobile') || '')
|
|
|
}
|
|
|
-if (getQueryVariable("miniProgram")) {
|
|
|
- setStorage('miniProgram', getQueryVariable("miniProgram") || '')
|
|
|
+if (getQueryVariable('miniProgram')) {
|
|
|
+ setStorage('miniProgram', getQueryVariable('miniProgram') || '')
|
|
|
}
|
|
|
-if (getQueryVariable("appId")) {
|
|
|
- setStorage('appId', getQueryVariable("appId") || '')
|
|
|
+if (getQueryVariable('appId')) {
|
|
|
+ setStorage('appId', getQueryVariable('appId') || '')
|
|
|
}
|
|
|
|
|
|
-if (getQueryVariable("miniOpenId")) {
|
|
|
- setStorage('miniOpenId', getQueryVariable("miniOpenId") || '')
|
|
|
+if (getQueryVariable('miniOpenId')) {
|
|
|
+ setStorage('miniOpenId', getQueryVariable('miniOpenId') || '')
|
|
|
}
|
|
|
|
|
|
-if (getQueryVariable("sharerOpenId")) {
|
|
|
- setStorage('sharerOpenId', getQueryVariable("sharerOpenId") || '')
|
|
|
+if (getQueryVariable('sharerOpenId')) {
|
|
|
+ setStorage('sharerOpenId', getQueryVariable('sharerOpenId') || '')
|
|
|
}
|
|
|
|
|
|
// #endif
|
|
|
|
|
|
-import {
|
|
|
- Base64
|
|
|
-} from 'js-base64'
|
|
|
+import { Base64 } from 'js-base64'
|
|
|
Vue.prototype.$Base64 = Base64
|
|
|
|
|
|
-
|
|
|
import {
|
|
|
toast,
|
|
|
successToast,
|
|
@@ -88,37 +81,35 @@ import {
|
|
|
getLocation,
|
|
|
getAddress,
|
|
|
getNowDate,
|
|
|
- getNowDatetime,
|
|
|
-} from "common/utils/common"
|
|
|
-import {
|
|
|
- navToPage
|
|
|
-} from "common/utils/navPag"
|
|
|
-Vue.prototype.$navToPage = navToPage;
|
|
|
-Vue.prototype.$H5Href = process.env.VUE_APP_HREF;
|
|
|
-Vue.prototype.$toast = toast;
|
|
|
-Vue.prototype.$successToast = successToast;
|
|
|
-Vue.prototype.$showLoading = showLoading;
|
|
|
-Vue.prototype.$tipLoading = tipLoading;
|
|
|
-Vue.prototype.$hideLoading = hideLoading;
|
|
|
-Vue.prototype.$modal = modal;
|
|
|
-Vue.prototype.$tips = tips;
|
|
|
-Vue.prototype.$navPage = navPage;
|
|
|
-Vue.prototype.$redPage = redPage;
|
|
|
-Vue.prototype.$backPage = backPage;
|
|
|
-Vue.prototype.$callPhone = callPhone;
|
|
|
-Vue.prototype.$copy = copy;
|
|
|
-Vue.prototype.$openLocation = openLocation;
|
|
|
-Vue.prototype.$getLocation = getLocation;
|
|
|
-Vue.prototype.$getAddress = getAddress;
|
|
|
-Vue.prototype.$getNowDate = getNowDate;
|
|
|
-Vue.prototype.$getNowDatetime = getNowDatetime;
|
|
|
-Vue.prototype.$setStorage = setStorage;
|
|
|
-Vue.prototype.$getStorage = getStorage;
|
|
|
-Vue.prototype.$removeStorage = removeStorage;
|
|
|
+ getNowDatetime
|
|
|
+} from 'common/utils/common'
|
|
|
+import { navToPage } from 'common/utils/navPag'
|
|
|
+Vue.prototype.$navToPage = navToPage
|
|
|
+Vue.prototype.$H5Href = process.env.VUE_APP_HREF
|
|
|
+Vue.prototype.$toast = toast
|
|
|
+Vue.prototype.$successToast = successToast
|
|
|
+Vue.prototype.$showLoading = showLoading
|
|
|
+Vue.prototype.$tipLoading = tipLoading
|
|
|
+Vue.prototype.$hideLoading = hideLoading
|
|
|
+Vue.prototype.$modal = modal
|
|
|
+Vue.prototype.$tips = tips
|
|
|
+Vue.prototype.$navPage = navPage
|
|
|
+Vue.prototype.$redPage = redPage
|
|
|
+Vue.prototype.$backPage = backPage
|
|
|
+Vue.prototype.$callPhone = callPhone
|
|
|
+Vue.prototype.$copy = copy
|
|
|
+Vue.prototype.$openLocation = openLocation
|
|
|
+Vue.prototype.$getLocation = getLocation
|
|
|
+Vue.prototype.$getAddress = getAddress
|
|
|
+Vue.prototype.$getNowDate = getNowDate
|
|
|
+Vue.prototype.$getNowDatetime = getNowDatetime
|
|
|
+Vue.prototype.$setStorage = setStorage
|
|
|
+Vue.prototype.$getStorage = getStorage
|
|
|
+Vue.prototype.$removeStorage = removeStorage
|
|
|
|
|
|
// 注入全局
|
|
|
-import pages from 'mixins';
|
|
|
-Vue.mixin(pages);
|
|
|
+import pages from 'mixins'
|
|
|
+Vue.mixin(pages)
|
|
|
|
|
|
App.mpType = 'app'
|
|
|
|
|
@@ -136,30 +127,23 @@ Vue.prototype.$onLaunched = new Promise((resolve, reject) => {
|
|
|
Vue.prototype.$isReject = reject
|
|
|
})
|
|
|
|
|
|
-import custom from '@/components/custom.vue';
|
|
|
-import Loading from '@/components/Loading.vue';
|
|
|
-import zjPageLayout from "@/components/zj-container/zj-page-layout.vue"
|
|
|
-Vue.component('custom', custom);
|
|
|
-Vue.component('Loading', Loading);
|
|
|
-Vue.component('zjPageLayout', zjPageLayout);
|
|
|
+import custom from '@/components/custom.vue'
|
|
|
+import Loading from '@/components/Loading.vue'
|
|
|
+import zjPageLayout from '@/components/zj-container/zj-page-layout.vue'
|
|
|
+Vue.component('custom', custom)
|
|
|
+Vue.component('Loading', Loading)
|
|
|
+Vue.component('zjPageLayout', zjPageLayout)
|
|
|
|
|
|
-import floatButton from '@/components/floatButton.vue';
|
|
|
+import floatButton from '@/components/floatButton.vue'
|
|
|
Vue.component('floatButton', floatButton)
|
|
|
|
|
|
-import {
|
|
|
- getUserInfo,
|
|
|
- getConfigInfo,
|
|
|
- getTemplateInfo,
|
|
|
-} from "@/common/utils/util.js";
|
|
|
-Vue.prototype.$getUserInfo = getUserInfo;
|
|
|
-Vue.prototype.$getConfigInfo = getConfigInfo;
|
|
|
-Vue.prototype.$getTemplateInfo = getTemplateInfo;
|
|
|
+import { getUserInfo, getConfigInfo, getTemplateInfo } from '@/common/utils/util.js'
|
|
|
+Vue.prototype.$getUserInfo = getUserInfo
|
|
|
+Vue.prototype.$getConfigInfo = getConfigInfo
|
|
|
+Vue.prototype.$getTemplateInfo = getTemplateInfo
|
|
|
|
|
|
// #ifdef H5
|
|
|
-import {
|
|
|
- router,
|
|
|
- RouterMount
|
|
|
-} from 'router'
|
|
|
+import { router, RouterMount } from 'router'
|
|
|
Vue.use(router)
|
|
|
import Mylink from 'uni-simple-router/dist/link.vue'
|
|
|
// 组件式导航
|
|
@@ -167,18 +151,27 @@ Vue.component('my-link', Mylink)
|
|
|
// #endif
|
|
|
|
|
|
// 渲染图片文件
|
|
|
-Vue.prototype.$imageUrl = process.env.VUE_APP_BASE_URL + process.env.VUE_APP_BASE_API + '/common/img/get?key=';
|
|
|
-
|
|
|
-const app = new Vue({
|
|
|
- ...App,
|
|
|
- store
|
|
|
+Vue.prototype.$imageUrl = process.env.VUE_APP_BASE_URL + process.env.VUE_APP_BASE_API + '/common/img/get?key='
|
|
|
+
|
|
|
+import { translaBeforeRegistration } from './global-text-processor' // 导入插件
|
|
|
+Vue.prototype.$setLanguage = function (type) {
|
|
|
+ window.localStorage.setItem('Vue_Translation_Of_Text_Type', type)
|
|
|
+ setTimeout(() => {
|
|
|
+ location.reload(true)
|
|
|
+ }, 200)
|
|
|
+}
|
|
|
+translaBeforeRegistration(function () {
|
|
|
+ const app = new Vue({
|
|
|
+ ...App,
|
|
|
+ store
|
|
|
+ })
|
|
|
+
|
|
|
+ //v1.3.5起 H5端 你应该去除原有的app.$mount();使用路由自带的渲染方式
|
|
|
+ // #ifdef H5
|
|
|
+ RouterMount(app, router, '#app')
|
|
|
+ // #endif
|
|
|
+
|
|
|
+ // #ifndef H5
|
|
|
+ app.$mount() //为了兼容小程序及app端必须这样写才有效果
|
|
|
+ // #endif
|
|
|
})
|
|
|
-
|
|
|
-//v1.3.5起 H5端 你应该去除原有的app.$mount();使用路由自带的渲染方式
|
|
|
-// #ifdef H5
|
|
|
-RouterMount(app, router, '#app')
|
|
|
-// #endif
|
|
|
-
|
|
|
-// #ifndef H5
|
|
|
-app.$mount(); //为了兼容小程序及app端必须这样写才有效果
|
|
|
-// #endif
|