import Vue from 'vue' import App from './App' import store from './store' // store import plugins from './plugins' // plugins import './permission' // permission import share from 'utils/share.js'//share.js import uView from '@/uni_modules/uview-ui' import configListMinxin from '@/mixins/configList.js' Vue.use(uView) Vue.use(plugins) Vue.mixin(configListMinxin) Vue.config.productionTip = false Vue.prototype.$store = store App.mpType = 'app' Vue.mixin(share) // 创建一个空的Vue实例作为事件中心 Vue.prototype.$eventHub = new Vue() Vue.prototype.uploadFilePromise = function(url) { return new Promise((resolve, reject) => { let a = uni.uploadFile({ url: 'https://store-test.catmdogd.com/test-api/h5/oss/upload', filePath: url, name: 'file', formData: { user: 'test' }, success: (res) => { setTimeout(() => { if (res && res.data) { let resData = JSON.parse(res.data); resolve(resData.url); } reject("上传失败"); }, 1000) } }); }) } Vue.prototype.initGlobalData = function() { Vue.prototype.$globalData = { isAgree:false, submitData: { "phone": "", "wechatId": "", "note": "", "totalPrice": "", "address": { "province": "", "city": "", "district": "", "detailAddress": "" } }, mainSku:[], augmentedSku:[], itemPrices:[], servicePrices:[], openIdStr:'', confirmData: { phone: "", wechatId: "", note: "", }, newOrderData:{ orderId : '',//需要取消的订单id currentAddress:{}, currentPets:[], totalPrice:0, needPreFamiliarize:[], distancePrice : 0, // 距离加价 } } } Vue.prototype.initGlobalData() // 创建全局变量 // Vue.prototype.$globalData = { // isAgree:false, // submitData: { // "phone": "", // "wechatId": "", // "note": "", // "totalPrice": "", // "address": { // "province": "", // "city": "", // "district": "", // "detailAddress": "" // }, // "skuList": [], // "service": { // "serviceFrequency": "once_a_day", // "serviceDate": [], // "serviceTimeFirst": "", // "serviceTimeSecond": "", // "pet": [] // } // }, // mainSku:[], // augmentedSku:[], // itemPrices:[], // servicePrices:[], // openIdStr:'', // confirmData: { // phone: "", // wechatId: "", // note: "", // }, // newOrderData:{ // orderId : '',//需要取消的订单id // currentAddress:{}, // currentPets:[], // totalPrice:0, // needPreFamiliarize:[] // } // } const app = new Vue({ ...App }) app.$mount()