Merge branch 'v4.7.0dev' of https://gitee.com/ZhongBangKeJi/CRMEB into v4.7.0dev

This commit is contained in:
sugar1569 2023-02-24 15:26:58 +08:00
commit 95b1c79b01
7 changed files with 95 additions and 11 deletions

View File

@ -35,9 +35,9 @@ Route::group('v2', function () {
//是否强制绑定手机号
Route::get('bind_status', 'v2.PublicController/bindPhoneStatus');
//小程序授权绑定手机号
Route::post('auth_bindind_phone', 'v2.wechat.AuthController/bindingPhone');
Route::post('auth_bindind_phone', 'v2.wechat.AuthController/authBindingPhone');
//小程序授权后绑定手机号
Route::post('routine/binding_phone', 'v2.wechat.AuthController/authBindingPhone');
Route::post('routine/binding_phone', 'v2.wechat.AuthController/BindingPhone');
//小程序手机号登录直接绑定
Route::post('phone_silence_auth', 'v2.wechat.AuthController/silenceAuthBindingPhone');
//微信手机号登录直接绑定

View File

@ -481,10 +481,10 @@ class RoutineServices extends BaseServices
}
$uid = app()->make(WechatUserServices::class)->openidTouid($userInfoCong['openid']);
$userServices = app()->make(UserServices::class);
if ($userServices->count(['phone|account' => $userInfo['purePhoneNumber']])) {
if ($userServices->count(['phone' => $userInfo['purePhoneNumber']])) {
throw new ApiException(410028);
}
$res = app()->make(UserServices::class)->update(['id' => $uid], ['phone' => $userInfo['purePhoneNumber']]);
$res = app()->make(UserServices::class)->update(['uid' => $uid], ['phone' => $userInfo['purePhoneNumber']]);
if ($res) return true;
throw new ApiException(410017);
}

View File

@ -381,6 +381,9 @@ export default {
.ivu-menu-submenu-title {
padding-left: 23px !important;
}
.ivu-menu-item {
padding-left: 35px !important;
}
}
}
.ivu-menu-vertical .ivu-menu-submenu-title {

View File

@ -697,3 +697,12 @@ export function getLangJson() {
noAuth: true
})
}
/**
*
* 小程序绑定手机号
* @param object data
*/
export function mpBindingPhone(data) {
return request.post('v2/routine/binding_phone', data);
}

View File

@ -77,9 +77,15 @@
<image src="/static/images/edit.png" mode=""></image>
</view> -->
</view>
<!-- #ifdef MP -->
<button class="phone" v-if="!userInfo.phone && isLogin" open-type="getPhoneNumber"
@getphonenumber="getphonenumber">{{$t(`绑定手机号`)}}</button>
<!-- #endif -->
<!-- #ifndef MP -->
<view class="phone" v-if="!userInfo.phone && isLogin" @tap="bindPhone">
{{$t('绑定手机号')}}
</view>
<!-- #endif -->
</view>
<view class="message">
<navigator url="/pages/users/user_info/index" hover-class="none">
@ -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;
}

View File

@ -60,7 +60,6 @@
});
Routine.getCode()
.then(code => {
this.getUserPhoneNumber(e.detail.encryptedData, e.detail.iv, code);
})
.catch(error => {

View File

@ -43,15 +43,25 @@
</view>
<view class='item acea-row row-between-wrapper'>
<view>{{$t(`昵称`)}}</view>
<view class='input'><input type='nickname' name='nickname' :maxlength="16" :value='userInfo.nickname'></input>
<view class='input'><input type='nickname' name='nickname' :maxlength="16"
:value='userInfo.nickname'></input>
</view>
</view>
<view class='item acea-row row-between-wrapper'>
<view>{{$t(`手机号码`)}}</view>
<!-- #ifdef MP -->
<button class="input" open-type="getPhoneNumber" @getphonenumber="getphonenumber"
v-if="!userInfo.phone">{{$t(`点击绑定手机号`)}}
<text class="iconfont icon-xiangyou"></text>
</button>
<!-- #endif -->
<!-- #ifndef MP -->
<navigator url="/pages/users/user_phone/index" hover-class="none" class="input"
v-if="!userInfo.phone">
{{$t(`点击绑定手机号`)}}<text class="iconfont icon-xiangyou"></text>
</navigator>
<!-- #endif -->
<view class='input acea-row row-between-wrapper' v-else>
<input type='text' disabled='true' name='phone' :value='userInfo.phone' class='id'></input>
<text class='iconfont icon-suozi'></text>
@ -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;
}
}