登录增加协议选择逻辑

增加审核测试参数处理逻辑
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) => {
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) {
//id
@ -33,7 +58,7 @@ onLaunch((options) => {
uni.reLaunch({
url: '/pages/mine/subs/profile/index'
});
},500)
}, 500);
}
}
}

View File

@ -10,11 +10,15 @@
微信登录
</button>
<view class='hint'>
登录代表同意
<image @click.stop='bindCheck'
: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>
</view>
</view>
</template>
@ -22,10 +26,16 @@
<script setup lang='ts'>
import { useUserStore } from '@/store';
import { assetsUrl } from '@/utils/assets';
import { showToast } from '@/utils';
const userStore = useUserStore();
const isAgreePrivacy = ref(false);
function wechatLogin() {
if(!isAgreePrivacy.value) {
showToast('请先阅读并同意小程序隐私保护协议');
return;
}
uni.showLoading();
userStore.authLogin().then(() => {
uni.hideLoading();
@ -33,6 +43,10 @@ function wechatLogin() {
});
}
const bindCheck = () => {
isAgreePrivacy.value = !isAgreePrivacy.value;
};
const openPrivacy = () => {
wx.openPrivacyContract({
success: () => {
@ -43,6 +57,7 @@ const openPrivacy = () => {
}
});
};
</script>
<style lang='scss' scoped>
@ -81,14 +96,23 @@ const openPrivacy = () => {
}
.hint {
display: inline-block;
padding: 20rpx 50rpx;
font-size: 25rpx;
color: $u-tips-color;
position: absolute;
bottom: 0;
align-items: center;
bottom: 50rpx;
.link {
color: $u-warning;
}
image {
width: 30rpx;
height: 30rpx;
margin-right: 10rpx;
margin-bottom: -5rpx;
}
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB