diff --git a/App.vue b/App.vue
index 8ba286d..0a2329f 100644
--- a/App.vue
+++ b/App.vue
@@ -62,7 +62,7 @@
test: '',
// baseUrl: "http://192.168.3.32:80",
baseUrl: "http://192.168.1.106:80",
- imgPrefix: "http://47.104.224.41:9000/etriphome/appresource/image/",//图片资源
+ imgPrefix: "http://47.104.224.41:9000/etriphome/appresource/image/", //图片资源
},
methods: {
...mapMutations(['setUniverifyErrorMsg', 'setUniverifyLogin']),
@@ -74,9 +74,11 @@
success: (res) => {
// console.log(res)
if (res.data.code == 200) {
- uni.setStorageSync('userInfo', JSON.stringify(res.data.data));
- uni.setStorageSync('phone', res.data.data.phone);
- this.doLogin(res.data.data.username, res.data.data.phone);
+ if (JSON.stringify(res.data.data) != '{}') {
+ uni.setStorageSync('userInfo', JSON.stringify(res.data.data));
+ uni.setStorageSync('phone', res.data.data.phone);
+ this.doLogin(res.data.data.username, res.data.data.phone);
+ }
} else {
uni.showToast({
title: res.data.msg,
diff --git a/pages/pages_zhentou/homePage/homePage.vue b/pages/pages_zhentou/homePage/homePage.vue
index 69451ed..b866a50 100644
--- a/pages/pages_zhentou/homePage/homePage.vue
+++ b/pages/pages_zhentou/homePage/homePage.vue
@@ -15,7 +15,8 @@
-
+
@@ -83,9 +84,26 @@
},
success: (res) => {
if (res.data.code == 200) {
- console.log('下单成功')
+ console.log('下单成功');
+ uni.navigateTo({
+ url: '/pages/pages_zhentou/order/order'
+ })
} else if (res.data.code == 401) {
this.doLogin();
+ } else if (res.data.code == 1001) {
+ uni.showModal({
+ title: '提示',
+ content: res.data.msg,
+ success: (res2) => {
+ if (res2.confirm) {
+ uni.navigateTo({
+ url: '/pages/pages_zhentou/order/order'
+ })
+ } else if (res.cancel) {
+ console.log('用户点击取消');
+ }
+ }
+ });
} else {
uni.showToast({
title: res.data.msg,
@@ -120,7 +138,10 @@
console.log(res)
this.userInfo = res.userInfo;
this.hasUserInfo = true;
- // uni.setStorageSync('userInfo', JSON.stringify(res.userInfo));
+ if (this.phone) {
+ //如果手机号存在直接调取保存
+ this.doSave();
+ }
},
fail: (err) => {
console.log(err)
@@ -129,7 +150,7 @@
},
//获取手机号
getPhoneNumber(e) {
- console.log(e)
+ console.log(e, '获取手机号授权')
uni.request({
url: getApp().globalData.baseUrl + '/app/phone', //仅为示例,并非真实接口地址。
method: 'POST',
@@ -148,6 +169,17 @@
icon: 'none'
})
}
+ },
+ fail: function(res) {
+ // 获取手机号码失败
+ if (res.errMsg == 'getPhoneNumber:fail user deny') {
+ // 用户取消授权
+ uni.showToast({
+ title: '您未授权获取手机号码',
+ icon: 'none',
+ duration: 2000
+ })
+ }
}
})
},
@@ -165,6 +197,8 @@
success: (res) => {
if (res.data.code == 200) {
uni.setStorageSync('userInfo', JSON.stringify(res.data.data));
+ //登录
+ this.doLogin();
} else {
uni.showToast({
title: res.data.msg,
diff --git a/pages/pages_zhentou/order/order.vue b/pages/pages_zhentou/order/order.vue
index e73b9f1..167e16f 100644
--- a/pages/pages_zhentou/order/order.vue
+++ b/pages/pages_zhentou/order/order.vue
@@ -11,11 +11,11 @@
壹人壹枕
- 待付款
- 待发货
- 待收货
- 已完成
- 已取消
+ 待付款
+ 待发货
+ 待收货
+ 已完成
+ 已取消
@@ -32,7 +32,7 @@
-
+
@@ -48,11 +48,11 @@
¥699.0
- 查看物流
- 确认收货
- 取消订单
- 立即支付
- 完善定制信息
+ 查看物流
+ 确认收货
+ 取消订单
+ 立即支付
+ 完善定制信息
删除订单
再次定制