4 Star 1 Fork 0

泉子 / hx_bank

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
main.js 2.26 KB
一键复制 编辑 原始数据 按行查看 历史
1247086472@qq.com 提交于 2020-07-27 09:25 . a
import Vue from 'vue';
import App from './App';
// const headUrl = 'http://192.168.3.80:9999';
const headUrl = 'http://47.116.3.108:9999'
const imgUrl = 'http://47.116.3.108:9999/sys/common/static/';
Vue.config.productionTip = false
Vue.prototype.$headUrl = headUrl;
Vue.prototype.$imgUrl = imgUrl;
Vue.prototype.$get = function (url,data){
return new Promise((resolve,reject)=>{
uni.request({
url: this.$headUrl + url,
data: data,
header: {
// 'X-Access-Token': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1OTI5MjMwNTQsInVzZXJuYW1lIjoiYWRtaW4ifQ.VmZ8080q61We_dL3PkS531xyfgwGsEsVjn11FOgfPa0'
'X-Access-Token': uni.getStorageSync('hx_token')
},
success: (res) => {
// if(res.data.status == 500 && res.data.message == 'Token失效,请重新登录'){
// console.log(res.data.status);
// uni.showToast({
// title:'登录失效,请重新登录',
// icon:'none'
// })
// setTimeout(()=>{
// // localStorage.clear();
// // window.location.href='./pages/login/login.vue';
// // location.href = './pages/login/login.vue'
// uni.navigateTo({
// url:'/pages/login/login.vue'
// })
// },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': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1OTI5MjMwNTQsInVzZXJuYW1lIjoiYWRtaW4ifQ.VmZ8080q61We_dL3PkS531xyfgwGsEsVjn11FOgfPa0'
'X-Access-Token': uni.getStorageSync('hx_token')
},
success: (res) => {
// console.log(res.data);
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': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1OTI5MjMwNTQsInVzZXJuYW1lIjoiYWRtaW4ifQ.VmZ8080q61We_dL3PkS531xyfgwGsEsVjn11FOgfPa0'
'X-Access-Token': uni.getStorageSync('hx_token')
},
success: (res) => {
// console.log(res.data);
resolve(res)
}
});
})
}
App.mpType = 'app'
const app = new Vue({
...App
})
app.$mount()
其他
1
https://gitee.com/wuwq_327/hx_bank.git
git@gitee.com:wuwq_327/hx_bank.git
wuwq_327
hx_bank
hx_bank
master

搜索帮助