Commit bcad63e4 authored by zhengke's avatar zhengke

修改

parent 65aa4c6c
export default {
install(Vue, options) {
Vue.prototype.host = "https://wx.weibaoge.cn/web/index.php?_mall_id=1285"
//Vue.prototype.host2 = "http://192.168.0.110:8200"
Vue.prototype.host2 = "http://192.168.0.110:8200"
//Vue.prototype.host2 = "https://mallApi.oytour.com"
//Vue.prototype.host2 = "http://mallapi.oytour.com"
Vue.prototype.request = function(param, success, failed) {
......@@ -16,13 +16,7 @@ export default {
data: param.data,
success: res => {
if (res.data.code != 0 && res.data.msg != "商品未上架") {
// wx.showModal({
// content: '网络开小差了,刷新页面重新加载吧',
// showCancel: false
// })
console.group("发生了异常情况");
console.error(res.data.msg);
console.groupEnd();
}
typeof success == "function" && success(res.data);
},
......@@ -51,17 +45,11 @@ export default {
UserId: this.GetOpenId().UserId,
MiniAppId: this.GetMiniAppId(),
msg: param.data,
token:'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1ODg5MDg5MjkuMCwiZXhwIjoxNTkxNTAwOTI5LjAsIm1hbGxfdXNlckluZm8iOnsidWlkIjoiMyIsInJlcXVlc3RGcm9tIjoyfX0.wvWlZWUmi-sqoCaxB6C9kdQSvyYyMzvgleFLLRW71Sw'
token: this.GetOpenId().token
},
success: res => {
if (res.data.resultCode != 1) {
// wx.showModal({
// content: '网络开小差了,刷新页面重新加载吧',
// showCancel: false
// })
console.group("发生了异常情况");
console.error(res.data.msg);
console.groupEnd();
} else {
typeof success == "function" && success(res.data);
}
......@@ -75,21 +63,24 @@ export default {
}
});
}
// 获取小程序APPID
Vue.prototype.GetMiniAppId = function() {
return 'wxacd9f8cc3480d29e'
}
//获取OpenId
Vue.prototype.GetOpenId = function() {
let mall_userinfo =wx.getStorageSync('mall_UserInfo')
let mall_userinfo = wx.getStorageSync('mall_UserInfo')
var obj = {
OpenId: '',
UserId: 0
UserId: 0,
token:''
}
if(mall_userinfo){
if(mall_userinfo.OpenId){
obj.OpenId=mall_userinfo.OpenId;
obj.UserId=mall_userinfo.UserId;
if (mall_userinfo) {
if (mall_userinfo.OpenId) {
obj.OpenId = mall_userinfo.OpenId;
obj.UserId = mall_userinfo.UserId;
obj.token = mall_userinfo.Token;
}
}
return obj
......@@ -123,13 +114,5 @@ export default {
'content-type': "application/json"
}
}
// Vue.prototype.post = function(obj, success, failed) {
// this.sendRequest(obj.url, 'POST', obj.data, success, failed)
// }
// Vue.prototype.get = function(obj, success, failed) {
// this.sendRequest(obj.url, 'GET', obj.data, success, failed)
// }
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment