Files
xk-doctor-wx/main.js

98 lines
2.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import App from './App'
import {
addStyle,
navbarHeight,
m_by_checkID,
getAge
} from '@/common/js/util.js'
// 引入uView主JS库
import uView from "uview-ui";
import timeFormatIOSFix from '@/common/js/timeFormat.js'
import store from './store';
import share from '@/common/share.js'
Vue.mixin(share)
Vue.use(uView);
// 覆盖 uView 的 timeFormat / date修复 iOS 下 `yyyy-MM-dd HH:mm:ss` 无法解析
if (uni && uni.$u) {
uni.$u.timeFormat = timeFormatIOSFix
uni.$u.date = timeFormatIOSFix
}
let systemInfo = uni.getSystemInfoSync();
const $d = {
addStyle,
navbarHeight,
sys: systemInfo,
getAge
}
Vue.prototype.$toast = (title='', icon = 'none',duration=1500) => {
uni.showToast({
icon,
title,
duration
})
}
Vue.prototype.$go = (url, type = 0) => {
let userInfo = uni.getStorageSync('userInfo') || true;
const whitelist = ['pages', 'pharmacist_setInfo','workbench_succeed']
if (type!=4&&!whitelist.find(item => url.includes(item)) && userInfo && userInfo.status <= 1) {
Vue.prototype.$toast('资质审核通过后可开通')
return
}
let way = 'navigateTo';
switch (type) {
case 0:
way = 'navigateTo';
break;
case 1:
way = 'redirectTo';
break;
case 2:
way = 'reLaunch';
break;
case 3:
way = 'switchTab';
break;
case 4:
way = 'navigateBack';
break;
}
type == 4 ? uni.navigateBack(url) : uni[way]({
url: url,
fail: (e) => {
console.log(e);
}
})
}
// $d挂载到uni对象上
uni.$d = $d
Vue.prototype.$statusBarHeight = systemInfo.statusBarHeight
Vue.prototype.$d = $d
Vue.prototype.$navbarHeight = uni.$d.navbarHeight()
Vue.prototype.$windowHeight = systemInfo.windowHeight
Vue.prototype.$screenHeight = systemInfo.screenHeight
Vue.prototype.$checkID = m_by_checkID
Vue.prototype.$male = require('@/static/image/nan.png')
Vue.prototype.$girl = require('@/static/image/nv.png')
// #ifndef VUE3
import Vue from 'vue'
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
store,
...App
})
app.$mount()
// #endif
// #ifdef VUE3
import {
createSSRApp
} from 'vue'
export function createApp() {
const app = createSSRApp(App)
return {
app
}
}
// #endif