上传小程序的代码
This commit is contained in:
parent
6be68b4dbf
commit
f40c0d17ed
7
app.js
7
app.js
@ -1,5 +1,5 @@
|
||||
var util = require('utils/util.js');
|
||||
var api = require('config/api.js');
|
||||
//var util = require('utils/util.js');
|
||||
//var api = require('config/api.js');
|
||||
App({
|
||||
data: {
|
||||
deviceInfo: {}
|
||||
@ -17,7 +17,8 @@ App({
|
||||
util.request(api.AuthLoginByWeixin, {
|
||||
code: res.code
|
||||
}, 'POST').then(function (res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
console.log(11111111)
|
||||
let userInfo = res.data.userInfo;
|
||||
wx.setStorageSync('token', res.data.token);
|
||||
wx.setStorageSync('userInfo', userInfo);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
const ApiRoot = 'http://localhost:8361';
|
||||
// const ApiRoot = 'http://192.168.0.113:8361';
|
||||
// const ApiRoot = 'https://www.qile.club:8688';
|
||||
const ApiRootUrl = ApiRoot + '/api/'
|
||||
const ApiRootUrl = ApiRoot + '/api/v1/'
|
||||
|
||||
module.exports = {
|
||||
ApiRoot: ApiRoot,
|
||||
|
||||
@ -71,7 +71,8 @@ Page({
|
||||
util.request(api.AuthLoginByWeixin, {
|
||||
info: info
|
||||
}, 'POST').then(function (res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
console.log(222222222)
|
||||
wx.setStorageSync('userInfo', res.data.userInfo);
|
||||
wx.setStorageSync('token', res.data.token);
|
||||
app.globalData.userInfo = res.data.userInfo;
|
||||
|
||||
@ -61,7 +61,7 @@ Page({
|
||||
getCartList: function() {
|
||||
let that = this;
|
||||
util.request(api.CartList).then(function(res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
let hasCartGoods = res.data.cartList;
|
||||
if (hasCartGoods.length != 0) {
|
||||
hasCartGoods = 1;
|
||||
@ -117,7 +117,7 @@ Page({
|
||||
productIds: productIds.join(','),
|
||||
isChecked: that.isCheckedAll() ? 0 : 1
|
||||
}, 'POST').then(function(res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
that.setData({
|
||||
cartGoods: res.data.cartList,
|
||||
cartTotal: res.data.cartTotal
|
||||
@ -154,7 +154,7 @@ Page({
|
||||
number: number,
|
||||
id: id
|
||||
}, 'POST').then(function(res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
that.setData({
|
||||
cartGoods: res.data.cartList,
|
||||
cartTotal: res.data.cartTotal
|
||||
@ -196,7 +196,7 @@ Page({
|
||||
},
|
||||
getCartNum: function() {
|
||||
util.request(api.CartGoodsCount).then(function(res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
let cartGoodsCount = '';
|
||||
if (res.data.cartTotal.goodsCount == 0) {
|
||||
wx.removeTabBarBadge({
|
||||
@ -249,7 +249,7 @@ Page({
|
||||
productIds: that.data.cartGoods[itemIndex].product_id,
|
||||
isChecked: that.data.cartGoods[itemIndex].checked ? 0 : 1
|
||||
}, 'POST').then(function(res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
that.setData({
|
||||
cartGoods: res.data.cartList,
|
||||
cartTotal: res.data.cartTotal
|
||||
@ -344,7 +344,7 @@ Page({
|
||||
util.request(api.CartDelete, {
|
||||
productIds: productIds
|
||||
}, 'POST').then(function(res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
let cartList = res.data.cartList;
|
||||
that.setData({
|
||||
cartGoods: cartList,
|
||||
|
||||
@ -23,7 +23,7 @@ Page({
|
||||
getChannelShowInfo: function (e) {
|
||||
let that = this;
|
||||
util.request(api.ShowSettings).then(function (res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
let index_banner_img = res.data.index_banner_img;
|
||||
that.setData({
|
||||
index_banner_img: index_banner_img
|
||||
@ -68,7 +68,7 @@ Page({
|
||||
page: that.data.allPage,
|
||||
id: id
|
||||
}, 'POST').then(function(res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
let count = res.data.count;
|
||||
that.setData({
|
||||
allCount: count,
|
||||
|
||||
@ -97,7 +97,7 @@ Page({
|
||||
util.request(api.GoodsDetail, {
|
||||
id: that.data.id
|
||||
}).then(function(res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
let _specificationList = res.data.specificationList;
|
||||
// 如果仅仅存在一种货品,那么商品页面初始化时默认checked
|
||||
if (_specificationList.valueList.length == 1) {
|
||||
@ -334,7 +334,7 @@ Page({
|
||||
getCartCount: function() {
|
||||
let that = this;
|
||||
util.request(api.CartGoodsCount).then(function(res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
that.setData({
|
||||
cartGoodsCount: res.data.cartTotal.goodsCount
|
||||
});
|
||||
@ -434,7 +434,7 @@ Page({
|
||||
}, "POST")
|
||||
.then(function(res) {
|
||||
let _res = res;
|
||||
if (_res.errno == 0) {
|
||||
if (_res.code == 0) {
|
||||
wx.showToast({
|
||||
title: '添加成功',
|
||||
});
|
||||
@ -517,7 +517,7 @@ Page({
|
||||
.then(function(res) {
|
||||
let _res = res;
|
||||
wx.hideLoading()
|
||||
if (_res.errno == 0) {
|
||||
if (_res.code == 0) {
|
||||
let id = that.data.id;
|
||||
wx.navigateTo({
|
||||
url: '/pages/order-check/index?addtype=1'
|
||||
|
||||
@ -73,7 +73,7 @@ Page({
|
||||
getIndexData: function () {
|
||||
let that = this;
|
||||
util.request(api.IndexUrl).then(function (res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
that.setData({
|
||||
floorGoods: res.data.categoryList,
|
||||
banner: res.data.banner,
|
||||
@ -117,7 +117,7 @@ Page({
|
||||
getChannelShowInfo: function (e) {
|
||||
let that = this;
|
||||
util.request(api.ShowSettings).then(function (res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
let show_channel = res.data.channel;
|
||||
let show_banner = res.data.banner;
|
||||
let show_notice = res.data.notice;
|
||||
|
||||
@ -120,7 +120,7 @@ Page({
|
||||
orderFrom: orderFrom,
|
||||
type: 0
|
||||
}).then(function (res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
let addressId = 0;
|
||||
if (res.data.checkedAddress != 0) {
|
||||
addressId = res.data.checkedAddress.id;
|
||||
@ -167,7 +167,7 @@ Page({
|
||||
actualPrice: actualPrice,
|
||||
offlinePay: 0
|
||||
}, 'POST').then(res => {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
wx.removeStorageSync('orderId');
|
||||
wx.setStorageSync('addressId', 0);
|
||||
const orderId = res.data.orderInfo.id;
|
||||
@ -202,7 +202,7 @@ Page({
|
||||
actualPrice: actualPrice,
|
||||
offlinePay: 1
|
||||
}, 'POST').then(res => {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
wx.removeStorageSync('orderId');
|
||||
wx.setStorageSync('addressId', 0);
|
||||
wx.redirectTo({
|
||||
|
||||
@ -34,7 +34,7 @@ Page({
|
||||
getSearchKeyword() {
|
||||
let that = this;
|
||||
util.request(api.SearchIndex).then(function (res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
that.setData({
|
||||
historyKeyword: res.data.historyKeywordList,
|
||||
defaultKeyword: res.data.defaultKeyword,
|
||||
@ -54,7 +54,7 @@ Page({
|
||||
getHelpKeyword: function () {
|
||||
let that = this;
|
||||
util.request(api.SearchHelper, { keyword: that.data.keyword }).then(function (res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
that.setData({
|
||||
helpKeyword: res.data
|
||||
});
|
||||
@ -83,7 +83,7 @@ Page({
|
||||
getGoodsList: function () {
|
||||
let that = this;
|
||||
util.request(api.GoodsList, { keyword: that.data.keyword,sort: that.data.currentSortType, order: that.data.currentSortOrder, sales: that.data.salesSortOrder}).then(function (res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
that.setData({
|
||||
searchStatus: true,
|
||||
// categoryFilter: false,
|
||||
|
||||
@ -15,7 +15,7 @@ Page({
|
||||
util.request(api.GetBase64, {
|
||||
goodsId: id
|
||||
}, 'POST').then(function(res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
that.getQrcodeJpg(res.data);
|
||||
}
|
||||
});
|
||||
@ -59,7 +59,7 @@ Page({
|
||||
util.request(api.GoodsShare, {
|
||||
id: id
|
||||
}).then(function(res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
that.setData({
|
||||
goods: res.data,
|
||||
});
|
||||
|
||||
@ -80,7 +80,7 @@ Page({
|
||||
util.request(api.AddressDetail, {
|
||||
id: that.data.addressId
|
||||
}).then(function(res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
that.setData({
|
||||
address: res.data
|
||||
});
|
||||
@ -97,7 +97,7 @@ Page({
|
||||
util.request(api.DeleteAddress, {
|
||||
id: id
|
||||
}, 'POST').then(function(res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
wx.removeStorageSync('addressId');
|
||||
util.showErrorToast('删除成功');
|
||||
wx.navigateBack();
|
||||
@ -299,7 +299,7 @@ Page({
|
||||
util.request(api.RegionList, {
|
||||
parentId: regionId
|
||||
}).then(function(res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
that.setData({
|
||||
regionList: res.data.map(item => {
|
||||
|
||||
@ -345,7 +345,7 @@ Page({
|
||||
address: address.address,
|
||||
is_default: address.is_default,
|
||||
}, 'POST').then(function(res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
wx.navigateBack()
|
||||
}
|
||||
});
|
||||
|
||||
@ -17,7 +17,7 @@ Page({
|
||||
getAddresses() {
|
||||
let that = this;
|
||||
util.request(api.GetAddresses).then(function(res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
that.setData({
|
||||
addresses: res.data
|
||||
})
|
||||
|
||||
@ -15,7 +15,7 @@ Page({
|
||||
getExpressList(orderId) {
|
||||
let that = this;
|
||||
util.request(api.OrderExpressInfo, {orderId: orderId}).then(function (res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
let expressList = res.data;
|
||||
let traces = JSON.parse(res.data.traces);
|
||||
expressList.traces = traces;
|
||||
|
||||
@ -16,7 +16,7 @@ Page({
|
||||
getFootprintList() {
|
||||
let that = this;
|
||||
util.request(api.FootprintList, { page: that.data.allPage, size: that.data.size }).then(function (res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
let count = res.data.count;
|
||||
let f1 = that.data.footprintList;
|
||||
let f2 = res.data.data;
|
||||
@ -55,7 +55,7 @@ Page({
|
||||
let that = this;
|
||||
let id = e.currentTarget.dataset.val;
|
||||
util.request(api.FootprintDelete, { footprintId: id }, 'POST').then(function (res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
wx.showToast({
|
||||
title: '取消成功',
|
||||
icon: 'success',
|
||||
|
||||
@ -15,7 +15,7 @@ Page({
|
||||
util.request(api.OrderGoods, {
|
||||
orderId: id
|
||||
}).then(function(res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
that.setData({
|
||||
goodsList: res.data
|
||||
});
|
||||
|
||||
@ -74,7 +74,8 @@ Page({
|
||||
util.request(api.AuthLoginByWeixin, {
|
||||
code: code
|
||||
}, 'POST').then(function (res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
console.log(33333333)
|
||||
let userInfo = res.data.userInfo;
|
||||
that.setData({
|
||||
is_new: res.data.is_new,
|
||||
@ -97,8 +98,9 @@ Page({
|
||||
},
|
||||
getSettingsDetail() {
|
||||
let that = this;
|
||||
|
||||
util.request(api.SettingsDetail).then(function (res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
let userInfo = res.data;
|
||||
// wx.setStorageSync('userInfo', userInfo);
|
||||
that.setData({
|
||||
@ -117,7 +119,7 @@ Page({
|
||||
getOrderInfo: function (e) {
|
||||
let that = this;
|
||||
util.request(api.OrderCountInfo).then(function (res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
let status = res.data;
|
||||
that.setData({
|
||||
status: status
|
||||
|
||||
@ -129,7 +129,7 @@ Page({
|
||||
util.request(api.OrderExpressInfo, {
|
||||
orderId: that.data.orderId
|
||||
}).then(function (res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
let express = res.data;
|
||||
express.traces = JSON.parse(res.data.traces);
|
||||
that.setData({
|
||||
@ -144,7 +144,7 @@ Page({
|
||||
util.request(api.OrderDetail, {
|
||||
orderId: that.data.orderId
|
||||
}).then(function (res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
that.setData({
|
||||
orderInfo: res.data.orderInfo,
|
||||
orderGoods: res.data.orderGoods,
|
||||
@ -172,7 +172,7 @@ Page({
|
||||
util.request(api.OrderCancel, {
|
||||
orderId: that.data.orderId
|
||||
}, 'POST').then(function (res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
that.getOrderDetail();
|
||||
} else {
|
||||
util.showErrorToast(res.errmsg);
|
||||
@ -190,7 +190,7 @@ Page({
|
||||
util.request(api.OrderDelete, {
|
||||
orderId: that.data.orderId
|
||||
}, 'POST').then(function (res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
wx.showToast({
|
||||
title: '删除订单成功'
|
||||
});
|
||||
@ -216,7 +216,7 @@ Page({
|
||||
util.request(api.OrderConfirm, {
|
||||
orderId: that.data.orderId
|
||||
}, 'POST').then(function (res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
wx.showToast({
|
||||
title: '确认收货成功!'
|
||||
});
|
||||
@ -241,7 +241,7 @@ Page({
|
||||
util.request(api.OrderCancel, {
|
||||
orderId: that.data.orderId
|
||||
}, 'POST').then(function (res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
wx.showToast({
|
||||
title: '取消订单成功'
|
||||
});
|
||||
|
||||
@ -44,7 +44,7 @@ Page({
|
||||
getOrderInfo: function(e) {
|
||||
let that = this;
|
||||
util.request(api.OrderCountInfo).then(function(res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
let status = res.data;
|
||||
that.setData({
|
||||
status: status
|
||||
@ -59,7 +59,7 @@ Page({
|
||||
size: that.data.size,
|
||||
page: that.data.allPage,
|
||||
}).then(function(res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
let count = res.data.count;
|
||||
that.setData({
|
||||
allCount: count,
|
||||
@ -126,7 +126,7 @@ Page({
|
||||
util.request(api.OrderCancel, {
|
||||
orderId: orderId
|
||||
}, 'POST').then(function(res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
wx.showToast({
|
||||
title: '取消订单成功'
|
||||
});
|
||||
|
||||
@ -59,8 +59,9 @@ Page({
|
||||
},
|
||||
getSettingsDetail() {
|
||||
let that = this;
|
||||
|
||||
util.request(api.SettingsDetail).then(function (res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
that.setData({
|
||||
name: res.data.name,
|
||||
mobile: res.data.mobile,
|
||||
@ -104,7 +105,7 @@ Page({
|
||||
nickName: nickName,
|
||||
avatar: avatar,
|
||||
}, 'POST').then(function (res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
util.showErrorToast('保存成功');
|
||||
wx.navigateBack()
|
||||
}
|
||||
|
||||
@ -1,57 +1,40 @@
|
||||
{
|
||||
"description": "项目配置文件。",
|
||||
"setting": {
|
||||
"urlCheck": false,
|
||||
"es6": true,
|
||||
"postcss": true,
|
||||
"preloadBackgroundData": false,
|
||||
"minified": true,
|
||||
"newFeature": true,
|
||||
"coverView": true,
|
||||
"autoAudits": false,
|
||||
"showShadowRootInWxmlPanel": true,
|
||||
"scopeDataCheck": false,
|
||||
"checkInvalidKey": true,
|
||||
"checkSiteMap": false,
|
||||
"uploadWithSourceMap": true,
|
||||
"babelSetting": {
|
||||
"ignore": [],
|
||||
"disablePlugins": [],
|
||||
"outputPath": ""
|
||||
}
|
||||
},
|
||||
"compileType": "miniprogram",
|
||||
"libVersion": "2.9.4",
|
||||
"appid": "wxf3d768d1818218f1",
|
||||
"projectname": "%e6%b5%b7%e9%a3%8e%e5%b0%8f%e5%ba%97",
|
||||
"isGameTourist": false,
|
||||
"scripts": {
|
||||
"beforeCompile": "",
|
||||
"beforePreview": "",
|
||||
"beforeUpload": ""
|
||||
},
|
||||
"simulatorType": "wechat",
|
||||
"simulatorPluginLibVersion": {},
|
||||
"condition": {
|
||||
"search": {
|
||||
"current": -1,
|
||||
"list": []
|
||||
},
|
||||
"conversation": {
|
||||
"current": -1,
|
||||
"list": []
|
||||
},
|
||||
"plugin": {
|
||||
"current": -1,
|
||||
"list": []
|
||||
},
|
||||
"game": {
|
||||
"currentL": -1,
|
||||
"list": []
|
||||
},
|
||||
"miniprogram": {
|
||||
"current": 2,
|
||||
"list": []
|
||||
}
|
||||
}
|
||||
"description": "项目配置文件。",
|
||||
"setting": {
|
||||
"urlCheck": false,
|
||||
"es6": true,
|
||||
"postcss": true,
|
||||
"preloadBackgroundData": false,
|
||||
"minified": true,
|
||||
"newFeature": true,
|
||||
"coverView": true,
|
||||
"autoAudits": false,
|
||||
"showShadowRootInWxmlPanel": true,
|
||||
"scopeDataCheck": false,
|
||||
"checkInvalidKey": true,
|
||||
"checkSiteMap": false,
|
||||
"uploadWithSourceMap": true,
|
||||
"babelSetting": {
|
||||
"ignore": [],
|
||||
"disablePlugins": [],
|
||||
"outputPath": ""
|
||||
},
|
||||
"enhance": false,
|
||||
"packNpmRelationList": [],
|
||||
"ignoreUploadUnusedFiles": true
|
||||
},
|
||||
"compileType": "miniprogram",
|
||||
"simulatorType": "wechat",
|
||||
"simulatorPluginLibVersion": {},
|
||||
"condition": {},
|
||||
"editorSetting": {
|
||||
"tabIndent": "insertSpaces",
|
||||
"tabSize": 2
|
||||
},
|
||||
"libVersion": "2.9.4",
|
||||
"packOptions": {
|
||||
"ignore": [],
|
||||
"include": []
|
||||
},
|
||||
"appid": "wx23d29bab9e02327f"
|
||||
}
|
||||
7
project.private.config.json
Normal file
7
project.private.config.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
|
||||
"projectname": "hioshop-miniprogram",
|
||||
"setting": {
|
||||
"compileHotReLoad": true
|
||||
}
|
||||
}
|
||||
@ -8,7 +8,7 @@ function payOrder(orderId) {
|
||||
util.request(api.PayPrepayId, {
|
||||
orderId: orderId
|
||||
}).then((res) => {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
const payParam = res.data;
|
||||
// 如果没有支付想直接支付成功,下面注释。
|
||||
// -----------------------------------
|
||||
|
||||
@ -18,8 +18,11 @@ function loginByWeixin() {
|
||||
code: code,
|
||||
userInfo: userInfo
|
||||
}, 'POST').then(res => {
|
||||
if (res.errno === 0) {
|
||||
|
||||
if (res.code === 0) {
|
||||
//存储用户信息
|
||||
console.log(44444444)
|
||||
console.log(res.data)
|
||||
wx.setStorageSync('userInfo', res.data.userInfo);
|
||||
wx.setStorageSync('token', res.data.token);
|
||||
resolve(res);
|
||||
@ -40,6 +43,7 @@ function loginByWeixin() {
|
||||
function checkLogin() {
|
||||
return new Promise(function(resolve, reject) {
|
||||
if (wx.getStorageSync('userInfo') && wx.getStorageSync('token')) {
|
||||
console.log(1111111111)
|
||||
util.checkSession().then(() => {
|
||||
resolve(true);
|
||||
}).catch(() => {
|
||||
|
||||
@ -68,13 +68,14 @@ function testMobile(num) {
|
||||
*/
|
||||
function request(url, data = {}, method = "GET") {
|
||||
return new Promise(function(resolve, reject) {
|
||||
|
||||
wx.request({
|
||||
url: url,
|
||||
data: data,
|
||||
method: method,
|
||||
header: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-Hioshop-Token': wx.getStorageSync('token')
|
||||
'Authorization': wx.getStorageSync('token')
|
||||
},
|
||||
success: function(res) {
|
||||
if (res.statusCode == 200) {
|
||||
@ -92,7 +93,7 @@ function request(url, data = {}, method = "GET") {
|
||||
// code: code,
|
||||
// userInfo: userInfo
|
||||
// }, 'POST').then(res => {
|
||||
// if (res.errno === 0) {
|
||||
// if (res.code === 0) {
|
||||
// //存储用户信息
|
||||
// wx.setStorageSync('userInfo', res.data.userInfo);
|
||||
// wx.setStorageSync('token', res.data.token);
|
||||
@ -243,7 +244,8 @@ function loginNow() {
|
||||
request(api.AuthLoginByWeixin, {
|
||||
code: res.code
|
||||
}, 'POST').then(function (res) {
|
||||
if (res.errno === 0) {
|
||||
if (res.code === 0) {
|
||||
console.log(555555555)
|
||||
let userInfo = res.data.userInfo;
|
||||
wx.setStorageSync('token', res.data.token);
|
||||
wx.setStorageSync('userInfo', userInfo);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user