diff --git a/template/uni-app/api/user.js b/template/uni-app/api/user.js
index bec786358..d9775c407 100644
--- a/template/uni-app/api/user.js
+++ b/template/uni-app/api/user.js
@@ -697,3 +697,12 @@ export function getLangJson() {
noAuth: true
})
}
+
+/**
+ *
+ * 小程序绑定手机号
+ * @param object data
+ */
+export function mpBindingPhone(data) {
+ return request.post('v2/routine/binding_phone', data);
+}
\ No newline at end of file
diff --git a/template/uni-app/pages/user/index.vue b/template/uni-app/pages/user/index.vue
index 2062576f1..c287d123c 100644
--- a/template/uni-app/pages/user/index.vue
+++ b/template/uni-app/pages/user/index.vue
@@ -77,9 +77,15 @@
-->
+
+
+
+
{{$t('绑定手机号')}}
+
@@ -284,7 +290,8 @@
getMenuList,
getUserInfo,
setVisit,
- updateUserInfo
+ updateUserInfo,
+ mpBindingPhone
} from '@/api/user.js';
import {
wechatAuthV2,
@@ -521,6 +528,32 @@
url: '/pages/users/user_phone/index'
})
},
+ getphonenumber(e) {
+ Routine.getCode()
+ .then(code => {
+ let data = {
+ code,
+ iv: e.detail.iv,
+ encryptedData: e.detail.encryptedData,
+ }
+ mpBindingPhone(data).then(res => {
+ this.getUserInfo()
+ this.$util.Tips({
+ title: res.msg,
+ icon: 'success'
+ });
+ }).catch(err => {
+ return this.$util.Tips({
+ title: err
+ });
+ })
+ })
+ .catch(error => {
+ uni.hideLoading();
+ });
+
+ console.log(e)
+ },
/**
* 获取个人用户信息
*/
@@ -1260,6 +1293,7 @@
background-color: #CCC;
border-radius: 15px;
width: max-content;
+ font-size: 28rpx;
padding: 0 10px;
}
diff --git a/template/uni-app/pages/users/components/login_mobile/routine_phone.vue b/template/uni-app/pages/users/components/login_mobile/routine_phone.vue
index a6162838c..84fe170d5 100644
--- a/template/uni-app/pages/users/components/login_mobile/routine_phone.vue
+++ b/template/uni-app/pages/users/components/login_mobile/routine_phone.vue
@@ -60,7 +60,6 @@
});
Routine.getCode()
.then(code => {
-
this.getUserPhoneNumber(e.detail.encryptedData, e.detail.iv, code);
})
.catch(error => {
diff --git a/template/uni-app/pages/users/user_info/index.vue b/template/uni-app/pages/users/user_info/index.vue
index c664d0fba..a115ff2e5 100644
--- a/template/uni-app/pages/users/user_info/index.vue
+++ b/template/uni-app/pages/users/user_info/index.vue
@@ -43,15 +43,25 @@
{{$t(`昵称`)}}
-
+
{{$t(`手机号码`)}}
+
+
+
+
{{$t(`点击绑定手机号`)}}
+
+
@@ -160,7 +170,8 @@
userEdit,
getLogout,
getLangList,
- getLangJson
+ getLangJson,
+ mpBindingPhone
} from '@/api/user.js';
import {
switchH5Login,
@@ -174,6 +185,7 @@
import dayjs from "@/plugin/dayjs/dayjs.min.js";
// #ifdef MP
import authorize from '@/components/Authorize';
+ import Routine from '@/libs/routine';
// #endif
import Cache from '@/utils/cache';
import colors from '@/mixins/color.js';
@@ -244,6 +256,31 @@
title: this.$t(`当前为最新版本`)
});
},
+ getphonenumber(e) {
+ Routine.getCode()
+ .then(code => {
+ let data = {
+ code,
+ iv: e.detail.iv,
+ encryptedData: e.detail.encryptedData,
+ }
+ mpBindingPhone(data).then(res => {
+ this.getUserInfo()
+ this.$util.Tips({
+ title: res.msg,
+ icon: 'success'
+ });
+ }).catch(err => {
+ return this.$util.Tips({
+ title: err
+ });
+ })
+ })
+ .catch(error => {
+ uni.hideLoading();
+ });
+
+ },
setLang() {
this.array.map((item, i) => {
if (this.$i18n.locale == item.value) {
@@ -639,9 +676,11 @@
.personal-data .list .item .input {
max-width: 400rpx;
text-align: right;
- color: #868686;
- .icon-suozi{
- margin-left: 10rpx;
+ color: #868686;
+ font-size: 28rpx;
+
+ .icon-suozi {
+ margin-left: 10rpx;
}
}