main.js
2.0 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import Vue from 'vue'
import App from './App'
import store from "./store/index.js"
import check from './check/index.js'
// 引入全局uView
import uView from 'uview-ui';
Vue.use(uView);
// import myImage from './components/myImage.vue'
// #ifdef H5
import wechat from './wechat'
Vue.prototype.$wechat =wechat;
// #endif
// #ifdef H5
// 提交前需要注释 本地调试使用
// const vconsole = require('vconsole')
// Vue.prototype.$vconsole = new vconsole() // 使用vconsole
// #endif
Vue.config.productionTip = false
Vue.prototype.$imgUrl="http://api.intewl.cn/uploads/"
Vue.prototype.apiUrl="https://car.goorcar.com"
Vue.prototype.appid="wxa9f996fcd50636d4"
Vue.prototype.appsecert="be55bfa1f04c59374620036ccbbbec2a"
// Vue.prototype.$imgUrl="http://www.mall.com/uploads/"
// Vue.prototype.apiUrl="http://www.mall.com/api"
Vue.prototype.check=check;
// Vue.component('my-image',myImage)
Vue.prototype.$request=function(url,data='',type=1){
// var that=this
return new Promise((reslove,reject)=>{
if(type == 1){
uni.showLoading({
title:'加载中'
})
}
if(type == 2){
uni.showLoading({
title:'提交中'
})
}
uni.request({
url:url,
method:"get",
header: {
'token': uni.getStorageSync('token')
},
data:data,
success:(res)=>{
reslove(res.data)
uni.hideLoading()
}
})
})
}
Vue.prototype.$href=function(data,type=1){
// if(uni.getStorageSync("token")){
if(type==1){
uni.navigateTo({
url:data
})
}
if(type==2){
uni.switchTab({
url:data
})
}
/* }else{
uni.navigateTo({
url:"/pages/login/login?backurl="+data
})
} */
}
Vue.prototype.$back=function(data,type=1){
if(uni.getStorageSync("token")){
if(type==1){
uni.navigateTo({
url:data
})
}else{
uni.switchTab({
url:data
})
}
}else{
uni.navigateTo({
url:"/pages/login/login?backurl=1"
})
}
}
// Vue.prototype.apiUrl="http://192.168.1.101/mall/public/api"
App.mpType = 'app'
const app = new Vue({
store,
...App
})
app.$mount()