登录增加协议选择逻辑

增加审核测试参数处理逻辑
This commit is contained in:
Waiting 2024-05-17 13:12:03 +08:00
parent cb40ce643f
commit 531a955fe2
4 changed files with 57 additions and 8 deletions

View File

@ -3,7 +3,32 @@ import { mpUpdate, setCompanyId, setReferrerUserId, setRegisterStoreId } from '@
onLaunch((options) => { onLaunch((options) => {
console.log('App Launch options ', options); console.log('App Launch options ', options);
// setRegisterStoreId('1144085996641443841');
const miniProgram = uni.getAccountInfoSync().miniProgram;
const env = miniProgram.envVersion;
console.table(miniProgram);
//
if(env === 'release') {
uni.request({
url: 'https://api.lakeapp.cn/wechat/version_info',
success(res) {
console.log(res);
const { version, audit } = res.data;
if(miniProgram.version === version && audit == 1) {
setCompanyId('1144085996213624833');
setRegisterStoreId('1150930317436633090');
}
}
});
// setCompanyId('1144085996213624833');
// setRegisterStoreId('1150930317436633090');
}
// trial,develop
else {
setCompanyId('1150930317231112193');
setRegisterStoreId('1144085996641443841');
}
if(options?.query) { if(options?.query) {
//id //id
@ -29,11 +54,11 @@ onLaunch((options) => {
} }
if(options?.query.scene === 'edit_avatar_nickname') { if(options?.query.scene === 'edit_avatar_nickname') {
setTimeout(()=>{ setTimeout(() => {
uni.reLaunch({ uni.reLaunch({
url: '/pages/mine/subs/profile/index' url: '/pages/mine/subs/profile/index'
}); });
},500) }, 500);
} }
} }
} }

View File

@ -10,11 +10,15 @@
微信登录 微信登录
</button> </button>
<view class='hint'> <view class='hint'>
登录代表同意 <image @click.stop='bindCheck'
<text class='link' @click.stop='openPrivacy'> :src='isAgreePrivacy?("/static/images/ic_checked_green.png"):("/static/images/ic_checked_gray.png")' />
小程序隐私保护协议
<text @click.stop='bindCheck'>请先阅读并同意
<text class='link' @click.stop='openPrivacy'>
小程序隐私保护协议
</text>
并授权使用您的账号信息如昵称头像收获地址以便您统一管理
</text> </text>
并授权使用您的账号信息如昵称头像收获地址以便您统一管理
</view> </view>
</view> </view>
</template> </template>
@ -22,10 +26,16 @@
<script setup lang='ts'> <script setup lang='ts'>
import { useUserStore } from '@/store'; import { useUserStore } from '@/store';
import { assetsUrl } from '@/utils/assets'; import { assetsUrl } from '@/utils/assets';
import { showToast } from '@/utils';
const userStore = useUserStore(); const userStore = useUserStore();
const isAgreePrivacy = ref(false);
function wechatLogin() { function wechatLogin() {
if(!isAgreePrivacy.value) {
showToast('请先阅读并同意小程序隐私保护协议');
return;
}
uni.showLoading(); uni.showLoading();
userStore.authLogin().then(() => { userStore.authLogin().then(() => {
uni.hideLoading(); uni.hideLoading();
@ -33,6 +43,10 @@ function wechatLogin() {
}); });
} }
const bindCheck = () => {
isAgreePrivacy.value = !isAgreePrivacy.value;
};
const openPrivacy = () => { const openPrivacy = () => {
wx.openPrivacyContract({ wx.openPrivacyContract({
success: () => { success: () => {
@ -43,6 +57,7 @@ const openPrivacy = () => {
} }
}); });
}; };
</script> </script>
<style lang='scss' scoped> <style lang='scss' scoped>
@ -81,14 +96,23 @@ const openPrivacy = () => {
} }
.hint { .hint {
display: inline-block;
padding: 20rpx 50rpx; padding: 20rpx 50rpx;
font-size: 25rpx; font-size: 25rpx;
color: $u-tips-color; color: $u-tips-color;
position: absolute; position: absolute;
bottom: 0; align-items: center;
bottom: 50rpx;
.link { .link {
color: $u-warning; color: $u-warning;
} }
image {
width: 30rpx;
height: 30rpx;
margin-right: 10rpx;
margin-bottom: -5rpx;
}
} }
</style> </style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB