diff --git a/components/ns-login/ns-login.vue b/components/ns-login/ns-login.vue
index 8fdcc49..8172f78 100644
--- a/components/ns-login/ns-login.vue
+++ b/components/ns-login/ns-login.vue
@@ -2,7 +2,7 @@
-
-
+
-
@@ -113,6 +143,10 @@ export default {
name: 'ns-login',
data() {
return {
+ // 是否开启昵称和头像
+ enableNickAndAvatar: false,
+ // 协议勾选
+ isAgree: false,
url: '',
registerConfig: {},
avatarUrl: '', // 头像预览路径
@@ -142,7 +176,8 @@ export default {
authMobileData: {
iv: '',
encryptedData: ''
- }
+ },
+ site_name: ''
};
},
options: {
@@ -172,13 +207,10 @@ export default {
if (this.formData.mobile.length == 0) return true;
// #ifdef H5
-
// 验证码
if (this.isOpenCaptcha == 1 && this.formData.vercode.length == 0) return true;
-
// 动态码
if (this.formData.dynacode.length == 0) return true;
-
// #endif
}
return false;
@@ -189,7 +221,25 @@ export default {
else return false;
}
},
+ created() {
+ const siteInfo = uni.getStorageSync('siteInfo');
+ if (siteInfo) {
+ this.site_name = siteInfo.site_name;
+ }
+ },
methods: {
+ // 同意协议
+ authno() {
+ if (!this.isAgree) {
+ this.$util.showToast({ title: '请确认相关协议' });
+ }
+ },
+
+ // 关闭登录
+ closeLogin() {
+ this.$refs.completeInfoPopup.close();
+ },
+
// 获取注册配置
getRegisterConfig(callback = null) {
this.$api.sendRequest({
@@ -202,6 +252,8 @@ export default {
}
});
},
+
+ // 打开弹窗
open(url) {
if (url) this.url = url;
// #ifdef MP
@@ -229,6 +281,7 @@ export default {
this.toLogin();
// #endif
},
+
// 跳转去登录页
toLogin() {
if (this.url) this.$util.redirectTo('/pages_tool/login/login', {
@@ -236,13 +289,19 @@ export default {
});
else this.$util.redirectTo('/pages_tool/login/login');
},
+
+ // 取消完善信息
cancelCompleteInfo() {
if (this.$refs.completeInfoPopup) this.$refs.completeInfoPopup.close();
this.$store.commit('setBottomNavHidden', false); // 显示底部导航
},
+
+ // 昵称失焦
blurNickName(e) {
if (e.detail.value) this.nickName = e.detail.value;
},
+
+ // 选择头像
onChooseAvatar(e) {
this.avatarUrl = e.detail.avatarUrl;
uni.getFileSystemManager().readFile({
@@ -250,7 +309,6 @@ export default {
encoding: 'base64', //编码格式
success: res => {
let base64 = 'data:image/jpeg;base64,' + res.data; //不加上这串字符,在页面无法显示的哦
-
this.$api.uploadBase64({
base64,
success: res => {
@@ -271,6 +329,8 @@ export default {
}
});
},
+
+ // 打开完善信息弹窗
openCompleteInfoPop() {
this.getRegisterConfig();
@@ -283,6 +343,7 @@ export default {
});
this.$store.commit('setBottomNavHidden', true); //隐藏底部导航
},
+
// 获取前台登录验证码开关配置
getCaptchaConfig() {
this.$api.sendRequest({
@@ -295,6 +356,7 @@ export default {
}
});
},
+
// 获取验证码
getCaptcha() {
this.$api.sendRequest({
@@ -310,6 +372,7 @@ export default {
}
});
},
+
// 发送手机动态码
sendMobileCode() {
if (this.dynacodeData.seconds != 120 || this.dynacodeData.isSend) return;
@@ -371,6 +434,8 @@ export default {
}
});
},
+
+ // 刷新动态码数据
refreshDynacodeData() {
this.getCaptcha();
clearInterval(this.dynacodeData.timer);
@@ -381,6 +446,8 @@ export default {
isSend: false
};
},
+
+
// 表单验证
verify(data) {
let rule = [{
@@ -415,6 +482,7 @@ export default {
return false;
}
},
+
// 微信公众号强制绑定手机号
forceBindMobile() {
let authData = uni.getStorageSync('authInfo');
@@ -462,13 +530,16 @@ export default {
}
});
},
+
// 微信小程序获取手机号
getPhoneNumber(e) {
- console.log(e)
- if (e.detail.errMsg == 'getPhoneNumber:ok') {
- let authData = uni.getStorageSync('authInfo');
- if (authData) Object.assign(this.authMobileData, authData, e.detail);
- if (uni.getStorageSync('source_member')) this.authMobileData.source_member = uni.getStorageSync('source_member');
+ if (e.detail.errMsg === 'getPhoneNumber:ok') {
+ const authInfo = uni.getStorageSync('authInfo');
+ if (authInfo) { Object.assign(this.authMobileData, authInfo, e.detail);
+ }
+ if (uni.getStorageSync('source_member')) {
+ this.authMobileData.source_member = uni.getStorageSync('source_member');
+ }
this.$api.sendRequest({
url: '/api/tripartite/getPhoneNumber',
@@ -476,6 +547,9 @@ export default {
success: res => {
if (res.code >= 0) {
this.formData.mobile = res.data.mobile;
+ if (!this.enableNickAndAvatar) { // 不开启昵称和头像绑定,直接保存手机号
+ this.saveMp();
+ }
} else {
this.formData.mobile = '';
this.$util.showToast({
@@ -490,6 +564,7 @@ export default {
})
}
},
+
// 微信小程序强制绑定手机号
bindMobile() {
let data = this.authMobileData;
@@ -521,9 +596,8 @@ export default {
}
});
},
- /**
- * 授权登录
- */
+
+ // 授权登录
authLogin(data, type = 'authLogin') {
uni.showLoading({
title: '登录中'
@@ -571,7 +645,8 @@ export default {
}
});
},
- // 微信公众号,强制绑定手机号,验证
+
+ // H5保存:微信公众号,强制绑定手机号,验证
saveH5() {
if (this.$util.isWeiXin() && this.forceBindingMobileControl) {
let data = {
@@ -587,24 +662,35 @@ export default {
}
this.forceBindMobile();
},
+
// 微信小程序保存数据
saveMp() {
- if (this.nickName.length == 0) {
- this.$util.showToast({
- title: '请输入昵称'
- });
+ if (this.formData.mobile === '') {
+ this.$util.showToast({ title: '请授权您的手机号码' });
return;
}
- let authData = uni.getStorageSync('authInfo');
- if (authData) Object.assign(authData, {
- nickName: this.nickName,
- avatarUrl: this.headImg
- });
- uni.setStorageSync('authInfo', authData);
- if (this.forceBindingMobileControl) this.bindMobile();
- else this.authLogin(authData);
+ if (this.nickName.length == 0 && this.enableNickAndAvatar) {
+ this.$util.showToast({ title: '请输入昵称' });
+ return;
+ }
+
+ let authInfo = uni.getStorageSync('authInfo');
+ if (authInfo) {
+ Object.assign(authInfo, {
+ nickName: this.nickName,
+ avatarUrl: this.headImg
+ });
+ uni.setStorageSync('authInfo', authInfo);
+ }
+
+ if (this.forceBindingMobileControl) {
+ this.bindMobile();
+ } else {
+ this.authLogin(authInfo);
+ }
},
+
// #ifdef MP-ALIPAY
aliappGetUserinfo() {
my.getOpenUserInfo({
@@ -646,6 +732,8 @@ export default {
});
},
// #endif
+
+ // 获取会员信息
getMemberInfo() {
this.$api.sendRequest({
url: '/api/member/info',
@@ -656,12 +744,17 @@ export default {
}
}
});
- }
+ },
+
+ // 跳转页面
+ tourl(url) {
+ this.$util.redirectTo(url);
+ }
}
};
-
-
\ No newline at end of file
diff --git a/pages_goods/cart.vue b/pages_goods/cart.vue
index 379b051..f72c838 100644
--- a/pages_goods/cart.vue
+++ b/pages_goods/cart.vue
@@ -358,10 +358,8 @@
-
-
+
-
diff --git a/pages_goods/category.vue b/pages_goods/category.vue
index 2ed3067..0f41340 100644
--- a/pages_goods/category.vue
+++ b/pages_goods/category.vue
@@ -12,10 +12,8 @@
-
-
+
-
diff --git a/pages_goods/detail.vue b/pages_goods/detail.vue
index 60e6351..2328b31 100644
--- a/pages_goods/detail.vue
+++ b/pages_goods/detail.vue
@@ -513,10 +513,8 @@
-
-
+
-
diff --git a/pages_goods/list.vue b/pages_goods/list.vue
index f4d0517..d7eef2a 100644
--- a/pages_goods/list.vue
+++ b/pages_goods/list.vue
@@ -294,10 +294,8 @@
-
-
+
-
diff --git a/pages_promotion/fenxiao/goods_list.vue b/pages_promotion/fenxiao/goods_list.vue
index d53d88b..6bd030a 100644
--- a/pages_promotion/fenxiao/goods_list.vue
+++ b/pages_promotion/fenxiao/goods_list.vue
@@ -124,10 +124,8 @@
-
-
+
-
diff --git a/pages_promotion/fenxiao/promote_code.vue b/pages_promotion/fenxiao/promote_code.vue
index 6adca17..7646fce 100644
--- a/pages_promotion/fenxiao/promote_code.vue
+++ b/pages_promotion/fenxiao/promote_code.vue
@@ -35,10 +35,8 @@
-
-
+
-
diff --git a/pages_promotion/merch/detail.vue b/pages_promotion/merch/detail.vue
index 55ae6f9..acbd9bb 100644
--- a/pages_promotion/merch/detail.vue
+++ b/pages_promotion/merch/detail.vue
@@ -308,10 +308,8 @@
-
-
+
-
diff --git a/pages_promotion/point/detail.vue b/pages_promotion/point/detail.vue
index b035f3f..592c3bb 100644
--- a/pages_promotion/point/detail.vue
+++ b/pages_promotion/point/detail.vue
@@ -220,10 +220,8 @@
-
-
+
-