diff --git a/public/appmini/old/wechat/app.js b/public/appmini/old/wechat/app.js
index db3443d15..7bdfea8e5 100755
--- a/public/appmini/old/wechat/app.js
+++ b/public/appmini/old/wechat/app.js
@@ -181,23 +181,6 @@ App({
);
},
- /**
- * 获取平台用户信息
- * object 回调操作对象
- * method 回调操作对象的函数
- * return 有用户数据直接返回, 则回调调用者
- */
- get_user_info(object, method) {
- var user = this.get_user_cache_info();
- if (user == false) {
- // 唤醒用户授权
- this.user_auth_code(object, method);
-
- return false;
- }
- return user;
- },
-
/**
* 从缓存获取用户信息
*/
@@ -209,50 +192,13 @@ App({
return user;
},
- /**
- * 用户授权
- * object 回调操作对象
- * method 回调操作对象的函数
- */
- user_auth_code(object, method) {
- // 加载loding
- wx.showLoading({ title: '授权中...' });
- var $this = this;
-
- // 请求授权接口
- wx.getSetting({
- success(res) {
- if (!res.authSetting['scope.userInfo']) {
- wx.navigateTo({
- url: "/pages/login/login"
- });
- // wx.authorize({
- // scope: 'scope.userInfo',
- // success() {
- // $this.user_auth_login(object, method);
- // },
- // fail: (e) => {
- // wx.hideLoading();
- // $this.showToast('授权失败');
- // }
- // });
- } else {
- $this.user_auth_login(object, method);
- }
- },
- fail: (e) => {
- wx.hideLoading();
- $this.showToast('授权校验失败');
- }
- });
- },
-
/**
* 用户登录
* object 回调操作对象
* method 回调操作对象的函数
*/
user_auth_login(object, method) {
+ wx.showLoading({ title: "授权中..." });
var $this = this;
wx.checkSession({
success: function () {
diff --git a/public/appmini/old/wechat/app.wxss b/public/appmini/old/wechat/app.wxss
index 69bb3c302..2f9859015 100755
--- a/public/appmini/old/wechat/app.wxss
+++ b/public/appmini/old/wechat/app.wxss
@@ -120,20 +120,20 @@ textarea {
.my-btn-default{
font-size: 38rpx;
- color: #fff;
- border: none;
- background-color:#d2364c;
+ color: #fff !important;
+ border: none !important;
+ background-color:#d2364c !important;
border-radius: 2px;
}
.my-btn-default.btn-disabled{
- background-color: #a6a6a6;
- color: #fff;
+ background-color: #a6a6a6 !important;
+ color: #fff !important;
}
.my-btn-gray{
font-size: 30rpx;
- color: #fff;
- border: none;
- background-color:#a6a6a6;
+ color: #fff !important;
+ border: none !important;
+ background-color:#a6a6a6 !important;
border-radius: 2px;
}
@@ -240,7 +240,7 @@ textarea {
background-color: #ed6977 !important;
}
.bg-warning {
- background-color: #F37B1D !important;
+ background-color: #F37B1D !important;
}
.bg-active-main {
background-color: #d2364c !important;
diff --git a/public/appmini/old/wechat/pages/buy/buy.wxml b/public/appmini/old/wechat/pages/buy/buy.wxml
index 64dec6fca..86ba920c7 100755
--- a/public/appmini/old/wechat/pages/buy/buy.wxml
+++ b/public/appmini/old/wechat/pages/buy/buy.wxml
@@ -42,7 +42,7 @@
-
+
diff --git a/public/appmini/old/wechat/pages/cart/cart.js b/public/appmini/old/wechat/pages/cart/cart.js
index 46cf71fc9..9831fd43b 100755
--- a/public/appmini/old/wechat/pages/cart/cart.js
+++ b/public/appmini/old/wechat/pages/cart/cart.js
@@ -17,26 +17,24 @@ Page({
},
init(e) {
- var user = app.get_user_info(this, "init");
- if (user != false) {
- // 用户未绑定用户则转到登录页面
- if ((user.mobile || null) == null) {
- wx.showModal({
- title: '温馨提示',
- content: '绑定手机号码',
- confirmText: '确认',
- cancelText: '暂不',
- success: (result) => {
- if (result.confirm) {
- wx.navigateTo({
- url: "/pages/login/login?event_callback=init"
- });
- }
- },
- });
- } else {
- this.get_data();
- }
+ var user = app.get_user_cache_info(this, "init");
+ // 用户未绑定用户则转到登录页面
+ if (user == false || ((user.mobile || null) == null)) {
+ wx.showModal({
+ title: '温馨提示',
+ content: '绑定手机号码',
+ confirmText: '确认',
+ cancelText: '暂不',
+ success: (result) => {
+ if (result.confirm) {
+ wx.navigateTo({
+ url: "/pages/login/login?event_callback=init"
+ });
+ }
+ },
+ });
+ } else {
+ this.get_data();
}
},
@@ -75,10 +73,7 @@ Page({
data_bottom_line_status: false,
data_list_loding_msg: res.data.msg,
});
- wx.showToast({
- type: "fail",
- content: res.data.msg
- });
+ app.showToast(res.data.msg);
}
},
fail: () => {
@@ -89,10 +84,7 @@ Page({
data_list_loding_msg: '服务器请求出错',
});
- wx.showToast({
- type: "fail",
- content: "服务器请求出错"
- });
+ app.showToast("服务器请求出错");
}
});
},
@@ -132,18 +124,18 @@ Page({
if (buy_number < buy_min_number) {
buy_number = buy_min_number;
if (buy_min_number > 1) {
- wx.showToast({ content: '起购' + buy_min_number + inventory_unit });
+ app.showToast('起购' + buy_min_number + inventory_unit );
return false;
}
}
if (buy_max_number > 0 && buy_number > buy_max_number) {
buy_number = buy_max_number;
- wx.showToast({ content: '限购' + buy_max_number + inventory_unit });
+ app.showToast('限购' + buy_max_number + inventory_unit );
return false;
}
if (buy_number > inventory) {
buy_number = inventory;
- wx.showToast({ content: '库存数量' + inventory + inventory_unit });
+ app.showToast( '库存数量' + inventory + inventory_unit );
return false;
}
@@ -167,17 +159,11 @@ Page({
// 选择处理
this.selected_calculate();
} else {
- wx.showToast({
- type: "fail",
- content: res.data.msg
- });
+ app.showToast(res.data.msg);
}
},
fail: () => {
- wx.showToast({
- type: "fail",
- content: "服务器请求出错"
- });
+ app.showToast("服务器请求出错");
}
});
},
@@ -225,17 +211,11 @@ Page({
if (res.data.code == 0) {
this.cart_delete(id, type);
} else {
- wx.showToast({
- type: 'fail',
- content: res.data.msg
- });
+ app.showToast(res.data.msg);
}
},
fail: () => {
- wx.showToast({
- type: 'fail',
- content: '服务器请求出错'
- });
+ app.showToast("服务器请求出错");
}
});
},
@@ -257,22 +237,13 @@ Page({
data_list_loding_status: temp_data_list.length == 0 ? 0 : this.data.data_list_loding_status,
});
- wx.showToast({
- type: 'success',
- content: (type == 'delete') ? '删除成功' : '收藏成功'
- });
+ app.showToast(((type == 'delete') ? '删除成功' : '收藏成功'), 'success');
} else {
- wx.showToast({
- type: 'fail',
- content: (type == 'delete') ? '删除失败' : '收藏失败'
- });
+ app.showToast((type == 'delete') ? '删除失败' : '收藏失败');
}
},
fail: () => {
- wx.showToast({
- type: 'fail',
- content: '服务器请求出错'
- });
+ app.showToast("服务器请求出错");
}
});
},
@@ -342,10 +313,7 @@ Page({
}
if (selected_count <= 0) {
- wx.showToast({
- type: "fail",
- content: '请选择商品'
- });
+ app.showToast("请选择商品");
return false
}
diff --git a/public/appmini/old/wechat/pages/cart/cart.wxml b/public/appmini/old/wechat/pages/cart/cart.wxml
index 41072614a..e30128847 100755
--- a/public/appmini/old/wechat/pages/cart/cart.wxml
+++ b/public/appmini/old/wechat/pages/cart/cart.wxml
@@ -23,7 +23,7 @@
-
-
+
+
diff --git a/public/appmini/old/wechat/pages/goods-detail/goods-detail.wxml b/public/appmini/old/wechat/pages/goods-detail/goods-detail.wxml
index 1d56656fc..797b9311e 100755
--- a/public/appmini/old/wechat/pages/goods-detail/goods-detail.wxml
+++ b/public/appmini/old/wechat/pages/goods-detail/goods-detail.wxml
@@ -121,7 +121,7 @@
购买数量
-
-
+
+
diff --git a/public/appmini/old/wechat/pages/login/login.js b/public/appmini/old/wechat/pages/login/login.js
index 56eab627e..a4e2dadb3 100755
--- a/public/appmini/old/wechat/pages/login/login.js
+++ b/public/appmini/old/wechat/pages/login/login.js
@@ -30,9 +30,38 @@ Page({
* 登录授权事件
*/
get_user_info_event(e) {
- console.log(e, e.detail.userInfo);
- //app.user_auth_login();
- wx.navigateBack();
+ this.user_auth_code();
+ },
+
+ /**
+ * 用户授权
+ * object 回调操作对象
+ * method 回调操作对象的函数
+ */
+ user_auth_code(object, method) {
+ // 请求授权接口
+ var $this = this;
+ wx.getSetting({
+ success(res) {
+ if (!res.authSetting['scope.userInfo']) {
+ $this.setData({ user: null});
+ } else {
+ app.user_auth_login($this, 'user_auth_back_event');
+ }
+ },
+ fail: (e) => {
+ app.showToast("授权校验失败");
+ }
+ });
+ },
+
+ /**
+ * 授权返回事件
+ */
+ user_auth_back_event() {
+ this.setData({
+ user: app.get_user_cache_info() || null
+ });
},
/**
@@ -83,20 +112,14 @@ Page({
} else {
this.setData({verify_submit_text: '获取验证码', verify_loading: false, verify_disabled: false});
- wx.showToast({
- type: 'fail',
- content: res.data.msg
- });
+ app.showToast(res.data.msg);
}
},
fail: () => {
wx.hideLoading();
this.setData({verify_submit_text: '获取验证码', verify_loading: false, verify_disabled: false});
- wx.showToast({
- type: 'fail',
- content: '服务器请求出错'
- });
+ app.showToast("服务器请求出错");
}
});
}
@@ -111,16 +134,16 @@ Page({
var validation = [
{fields: 'mobile', msg: '请填写手机号码'},
{fields: 'verify', msg: '请填写验证码'},
- {fields: 'alipay_openid', msg: '授权id不能为空'}
+ {fields: 'weixin_openid', msg: '授权id不能为空'}
];
- e.detail.value['alipay_openid'] = this.data.user.alipay_openid;
+ e.detail.value['weixin_openid'] = this.data.user.weixin_openid;
e.detail.value['nickname'] = this.data.user.nickname;
e.detail.value['avatar'] = this.data.user.avatar;
e.detail.value['province'] = this.data.user.province;
e.detail.value['city'] = this.data.user.city;
e.detail.value['gender'] = this.data.user.gender;
e.detail.value['referrer'] = this.data.user.referrer;
- e.detail.value['app_type'] = 'alipay';
+ e.detail.value['app_type'] = 'weixin';
if(app.fields_check(e.detail.value, validation))
{
wx.showLoading({content: '处理中...'});
@@ -139,10 +162,7 @@ Page({
if(res.data.code == 0 && (res.data.data || null) != null)
{
clearInterval(this.data.temp_clear_time);
- wx.showToast({
- type: 'success',
- content: res.data.msg
- });
+ app.showToast(res.data.msg, 'success');
wx.setStorage({
key: app.data.cache_user_info_key,
@@ -162,20 +182,14 @@ Page({
} else {
this.setData({form_submit_loading: false});
- wx.showToast({
- type: 'fail',
- content: res.data.msg
- });
+ app.showToast(res.data.msg);
}
},
fail: () => {
wx.hideLoading();
this.setData({form_submit_loading: false});
- wx.showToast({
- type: 'fail',
- content: '服务器请求出错'
- });
+ app.showToast("服务器请求出错");
}
});
}
diff --git a/public/appmini/old/wechat/pages/login/login.wxml b/public/appmini/old/wechat/pages/login/login.wxml
index 3737c480e..0562f949f 100755
--- a/public/appmini/old/wechat/pages/login/login.wxml
+++ b/public/appmini/old/wechat/pages/login/login.wxml
@@ -1,9 +1,9 @@
diff --git a/public/appmini/old/wechat/pages/login/login.wxss b/public/appmini/old/wechat/pages/login/login.wxss
index 48bd97576..dfdeb0a24 100755
--- a/public/appmini/old/wechat/pages/login/login.wxss
+++ b/public/appmini/old/wechat/pages/login/login.wxss
@@ -23,6 +23,7 @@ page{
.content .code{
margin: 20rpx 0;
border-bottom: solid 1px #eee;
+ position: relative;
}
.content .code .verify{
width: 63%;
@@ -34,6 +35,9 @@ page{
height: 35px;
line-height: 35px;
border-radius: 10rpx;
+ position: absolute;
+ top: 0;
+ right: 0;
}
.content .code .verify-sub.sub-disabled{
border: solid 1px #eee;