代码拉取完成,页面将自动刷新
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()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。