1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- import Vue from 'vue'
- import App from './App'
- import uView from "uview-ui";
- Vue.use(uView);
- // ColorUI的 导航栏
- import cuCustom from './colorui/components/cu-custom.vue'
- Vue.component('cu-custom',cuCustom)
- import comSelectPicture from './components/comSelectPicture/comSelectPicture.vue'
- Vue.component('com-select-picture',comSelectPicture)
- // 此处为演示vuex使用,非uView的功能部分
- import store from '@/store';
- // 引入uView提供的对vuex的简写法文件
- let vuexStore = require('@/store/$u.mixin.js');
- Vue.mixin(vuexStore);
- App.mpType = 'app'
- // 全局过滤器 -- 金额保留两位
- Vue.filter('moneyFilter', function (value) {
- if (!value || isNaN(value)) return 0.0
- return new Number(value).toFixed(1)
- })
- const app = new Vue({
- ...App
- })
- const msg = (title, duration=1500, mask=false, icon='none')=>{
- //统一提示方便全局修改
- if(Boolean(title) === false){
- return;
- }
- uni.showToast({
- title,
- duration,
- mask,
- icon
- });
- }
- const json = type=>{
- //模拟异步请求数据
- return new Promise(resolve=>{
- setTimeout(()=>{
- resolve(Json[type]);
- }, 500)
- })
- }
- const prePage = ()=>{
- let pages = getCurrentPages();
- let prePage = pages[pages.length - 2];
- // #ifdef H5
- return prePage;
- // #endif
- return prePage.$vm;
- }
- Vue.prototype.$fire = new Vue();
- Vue.prototype.$store = store;
- Vue.prototype.$api = {msg, json, prePage};
- // http拦截器,将此部分放在new Vue()和app.$mount()之间,才能App.vue中正常使用
- import httpInterceptor from '@/common/http.interceptor.js'
- Vue.use(httpInterceptor, app)
- // http接口API集中管理引入部分
- import httpApi from '@/api/http.api.js'
- Vue.use(httpApi, app)
- // uni.addInterceptor('navigateTo', {
- // // 页面跳转前进行拦截, invoke根据返回值进行判断是否继续执行跳转
- // invoke(e) {
- // if (e.url === '/pages/login/index' ||e.url === '/pages/login/indexChoice') {
- // next()
- // }else{
- // var serverId = uni.getStorageSync('userInfo').serverId;
- // if (serverId == undefined || serverId == null || serverId == '') {
- // window.location.href="https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxb8aac61262a027d6&redirect_uri=https://test-plateform.uxianxin.com/%23/pages/login/index&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect";
- // }
- // }
- // },
- // success(e) {
- // debugger
- // }
- // })
- app.$mount()
|