You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
959 B
45 lines
959 B
import Vue from 'vue'
|
|
import App from './App'
|
|
import {appConfig} from './config'
|
|
import {weixin} from './utils/weixin.js'
|
|
|
|
Vue.config.productionTip = false
|
|
Vue.prototype.baseUrl = appConfig.baseUrl
|
|
Vue.prototype.openidInfoKey = appConfig.openidInfoKey
|
|
|
|
Vue.prototype.arrayCol = (arr, column) => {
|
|
const res = []
|
|
arr.forEach(i => {
|
|
res.push(i[column])
|
|
})
|
|
return res
|
|
}
|
|
Vue.prototype.alert = msg => {
|
|
uni.showToast({title: msg, duration: 2000, icon: 'none'})
|
|
}
|
|
Vue.prototype.sendReq = (url, params, cb, method) => {
|
|
method = method || 'POST'
|
|
weixin.getOpenidInfo(info => {
|
|
params.openid = info.openid
|
|
uni.request({
|
|
url: appConfig.baseUrl + '/api/wechat/' + url,
|
|
method: method,
|
|
data: params,
|
|
success: (r) => {
|
|
if (r.data.status === 0) {
|
|
uni.showToast({title: r.data.msg, duration: 2000, icon: 'none'})
|
|
} else {
|
|
cb(r.data.data)
|
|
}
|
|
}
|
|
})
|
|
})
|
|
}
|
|
|
|
App.mpType = 'app'
|
|
|
|
const app = new Vue({
|
|
...App
|
|
})
|
|
app.$mount()
|