Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
文件
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
main.js 2.12 KB
Copy Edit Raw Blame History
游志金 authored 2020-06-29 19:25 . 6/29
import Vue from 'vue'
import App from './App'
import cuCustom from './colorui/components/cu-custom.vue'
// const headUrl = 'http://8.129.181.12:9080/fxj-boot/'
// const headUrl = 'http://47.113.194.153/fxj-boot/'
const headUrl = 'https://www.huichenghuitong.com/fxj-boot/'
Vue.component('cu-custom',cuCustom)
Vue.config.productionTip = false
Vue.prototype.$headUrl = headUrl
Vue.prototype.$get = function (url,data){
return new Promise((resolve,reject)=>{
uni.request({
url: this.$headUrl + url,
data: data,
header: {
'X-Access-Token': uni.getStorageSync('token')
},
success: (res) => {
if(res.data.status == 500){
console.log(res.data.status);
uni.showToast({
title:'登录失效,请重新登录',
icon:'none'
})
setTimeout(()=>{
uni.reLaunch({
url:'/pages/login/login'
})
},1000)
}else{
resolve(res)
}
resolve(res)
}
});
})
}
Vue.prototype.$post = function (url,data){
return new Promise((resolve,reject)=>{
uni.request({
url: this.$headUrl + url,
data: data,
method:'POST',
header: {
'X-Access-Token': uni.getStorageSync('token')
},
success: (res) => {
if(res.data.status == 500){
console.log(res.data.status);
uni.showToast({
title:'登录失效,请重新登录',
icon:'none'
})
setTimeout(()=>{
uni.reLaunch({
url:'/pages/login/login'
})
},1000)
}else{
resolve(res)
}
resolve(res)
}
});
})
}
Vue.prototype.$put = function (url,data){
return new Promise((resolve,reject)=>{
uni.request({
url: this.$headUrl + url,
data: data,
method:'PUT',
header: {
'X-Access-Token': uni.getStorageSync('token')
},
success: (res) => {
if(res.data.status == 500){
console.log(res.data.status);
uni.showToast({
title:'登录失效,请重新登录',
icon:'none'
})
setTimeout(()=>{
uni.reLaunch({
url:'/pages/login/login'
})
},1000)
}else{
resolve(res)
}
resolve(res)
}
});
})
}
App.mpType = 'app'
const app = new Vue({
...App
})
app.$mount()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化