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.
|
|
|
import App from './App'
|
|
|
|
import auth from './libs/auth.js'
|
|
|
|
import alert from './libs/alert.js'
|
|
|
|
import request from './libs/request.js'
|
|
|
|
import config from './config.js'
|
|
|
|
import store from './store.js'
|
|
|
|
import qs from 'qs'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import {
|
|
|
|
$http
|
|
|
|
} from '@escook/request-miniprogram'
|
|
|
|
|
|
|
|
// #ifndef VUE3
|
|
|
|
import Vue from 'vue'
|
|
|
|
uni.$http = $http
|
|
|
|
$http.baseUrl = 'https://121.36.37.70:8204'
|
|
|
|
Vue.config.productionTip = false
|
|
|
|
App.mpType = 'app'
|
|
|
|
Vue.prototype.$auth = auth
|
|
|
|
Vue.prototype.$alert = alert
|
|
|
|
Vue.prototype.$request = request
|
|
|
|
Vue.prototype.$config = config
|
|
|
|
const app = new Vue({
|
|
|
|
...App,
|
|
|
|
store
|
|
|
|
})
|
|
|
|
|
|
|
|
uni.addInterceptor('request', {
|
|
|
|
|
|
|
|
invoke(args) {
|
|
|
|
// request 触发前拼接 url
|
|
|
|
|
|
|
|
const {
|
|
|
|
data,
|
|
|
|
method,
|
|
|
|
} = args;
|
|
|
|
if (method === "GET") {
|
|
|
|
if(uni.getStorageSync("token")){
|
|
|
|
request.getToken()
|
|
|
|
}
|
|
|
|
// 如果是get请求,且params是数组类型如arr=[1,2],则转换成arr=1&arr=2
|
|
|
|
const newData = qs.stringify(data, {
|
|
|
|
arrayFormat: "repeat"
|
|
|
|
})
|
|
|
|
console.log(newData,7777);
|
|
|
|
delete args.data;
|
|
|
|
args.url = `${args.url}?${newData}`;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
success(args) {},
|
|
|
|
fail(err) {},
|
|
|
|
complete(res) {}
|
|
|
|
})
|
|
|
|
|
|
|
|
app.$mount()
|
|
|
|
// #endif
|
|
|
|
|
|
|
|
// #ifdef VUE3
|
|
|
|
import { createSSRApp } from 'vue'
|
|
|
|
export function createApp() {
|
|
|
|
const app = createSSRApp(App)
|
|
|
|
return {
|
|
|
|
app
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// #endif
|