feat:173版本

This commit is contained in:
2026-08-29 13:02:46 +08:00
parent 23b30c8f04
commit 388c0d5185
17 changed files with 704 additions and 197 deletions
+105 -16
View File
@@ -1,13 +1,18 @@
<template>
<view class="register_warp">
<view class="header_">
<view style="margin-top: 10rpx">
<up-image src="/static/common/left.png" width="18" height="20" bgColor="#f1f6ff00" @click="jumpMine" />
<!-- 顶部固定导航栏 -->
<view class="navbar-sticky-wrapper" :style="mpWarpStyle">
<view class="custom-navbar" :style="mpHeaderStyle">
<view class="back_btn" @click="jumpMine">
<up-image src="/static/common/left.png" width="18" height="20" bgColor="#f1f6ff00" />
</view>
<view class="nav-title">绑定手机号</view>
<view class="nav-right"></view>
</view>
<view class="title_">绑定手机号</view>
<view></view>
</view>
<view class="register_content">
<view class="register_ifo_warp">
<view class="register_info_item">
<up-input placeholder="请输入手机号" border="surround" v-model="form.mobile" :customStyle="inputCss"></up-input>
@@ -46,6 +51,8 @@
</up-checkbox>
</view>
</view>
<up-toast ref="uToastRef"></up-toast>
<u-modal :show="tipsShow" title="提示" showCancelButton @cancel="onCancel" @confirm="onConfirm">
<view class="slot-content">
@@ -71,6 +78,8 @@ import {
export default {
data() {
return {
mpWarpStyle: {},
mpHeaderStyle: {},
form: {
mobile: null,
smsCode: null, // 验证码
@@ -94,6 +103,7 @@ export default {
},
onLoad(option) {
this.initMPHeader();
this.form.token = option.token;
this.type = option.type;
console.log("-----1", option, this.form.token, this.type);
@@ -102,7 +112,9 @@ export default {
submit() {
if (!this.isPolicy) {
this.tipsShow = true;
return;
}
this.registerFun();
},
onCancel() {
this.tipsShow = false;
@@ -112,9 +124,54 @@ export default {
this.isPolicy = true;
this.registerFun();
},
initMPHeader() {
try {
const systemInfo = uni.getSystemInfoSync();
const statusBarHeight = systemInfo.statusBarHeight || 0;
// #ifdef MP-WEIXIN || MP
const menuButton = uni.getMenuButtonBoundingClientRect();
if (menuButton && menuButton.top && menuButton.top > 0) {
const menuButtonHeight = menuButton.height || 32;
const menuButtonTop = menuButton.top;
const menuButtonLeft = menuButton.left;
const windowWidth = systemInfo.windowWidth;
this.mpWarpStyle = {
paddingTop: `${menuButtonTop}px`
};
this.mpHeaderStyle = {
height: `${menuButtonHeight}px`,
paddingRight: `${windowWidth - menuButtonLeft + 10}px`,
display: 'flex',
alignItems: 'center'
};
return;
}
// #endif
// APP-PLUS 或 H5 或 无胶囊环境
this.mpWarpStyle = {
paddingTop: `${statusBarHeight}px`
};
this.mpHeaderStyle = {
height: '88rpx',
display: 'flex',
alignItems: 'center'
};
} catch (e) {
console.error("initMPHeader error:", e);
}
},
jumpMine() {
uni.reLaunch({
url: "/pages/login_package/login/login",
uni.navigateBack({
fail: () => {
uni.redirectTo({
url: "/pages/login_package/login/login",
});
}
});
},
// 用户协议
@@ -237,21 +294,53 @@ export default {
</script>
<style lang="scss" scoped>
.header_ {
.register_warp {
min-height: 100vh;
box-sizing: border-box;
background-color: #ffffff;
}
.navbar-sticky-wrapper {
position: sticky;
top: 0;
z-index: 100;
background-color: #ffffff;
width: 100%;
}
.custom-navbar {
height: 88rpx;
background-color: #ffffff;
display: flex;
align-items: center;
padding: calc(24rpx + env(safe-area-inset-bottom)) 30rpx 0 30rpx;
justify-content: space-between;
padding: 0 24rpx;
position: relative;
box-sizing: border-box;
.title_ {
font-weight: bold;
font-size: 36rpx;
margin-left: 20rpx;
.back_btn {
width: 60rpx;
height: 100%;
display: flex;
align-items: center;
justify-content: flex-start;
}
.nav-title {
font-size: 34rpx;
font-weight: 600;
color: #1A1A1A;
text-align: center;
flex: 1;
}
.nav-right {
width: 60rpx;
}
}
.register_warp {
height: calc(100vh - 280rpx);
padding: 40rpx;
.register_content {
padding: 0 40rpx;
}
.register_title_warp {
+111 -34
View File
@@ -1,5 +1,5 @@
<template>
<view class="login_warp">
<view class="login_warp" @touchmove.stop.prevent>
<u-icon size="30rpx" name="arrow-left" color="#333" @click="onBack"></u-icon>
<view class="login_logo_warp">
<view style="text-align: center">
@@ -72,20 +72,18 @@
<!-- #ifdef APP-PLUS -->
<view class="other_login">其他登录方式</view>
<view class="login_other_icon">
<view class="login_other_item" @click="wechatOneLogin(2)">
<up-image src="/pages/login_package/static/login/WXICON.png" width="44" height="44"
<view class="login_other_item" v-if="(isIOS && isWechatInstalled) || !isIOS" @click="wechatOneLogin(2)">
<up-image src="https://static.tbmall.xin/static/home/wechat.png" width="44" height="44"
bgColor="#f1f6ff00"></up-image>
微信登录
</view>
<!-- <view class="login_other_item" @click="aa"> -->
<view v-if="!isIOS" class="login_other_item" @click="alipayOneLogin">
<up-image src="/pages/login_package/static/login/ZFB.png" width="44" height="44"
<up-image src="https://static.tbmall.xin/static/home/alipay.png" width="44" height="44"
bgColor="#f1f6ff00"></up-image>
支付宝登录
</view>
<view v-if="isIOS" class="login_other_item" @click="appleOneLogin">
<up-icon name="apple-fill" size="44" color="#000000"></up-icon>
Apple登录
<up-image src="https://static.tbmall.xin/static/home/apple.png" width="44" height="44"
bgColor="#f1f6ff00"></up-image>
</view>
</view>
<!-- #endif -->
@@ -93,11 +91,14 @@
<!-- #ifdef MP-WEIXIN -->
<view class="other_login">其他登录方式</view>
<view class="login_other_icon">
<view class="login_other_item" @click="wechatOneLogin(1)">
<up-image src="/pages/login_package/static/login/WXICON.png" width="44" height="44"
<view v-if="!isPolicy" class="login_other_item" @click="handleUnpolicyWXLogin">
<up-image src="https://static.tbmall.xin/static/home/wechat.png" width="44" height="44"
bgColor="#f1f6ff00"></up-image>
微信登录
</view>
<button v-else class="login_other_item" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
<up-image src="https://static.tbmall.xin/static/home/wechat.png" width="44" height="44"
bgColor="#f1f6ff00"></up-image>
</button>
</view>
<view class="login_other_icon">
<view class="login_other_item_you" @click="jumpHome">
@@ -124,6 +125,7 @@
<script>
import InputCodeComm from "@/pages/login_package/components/code-comm/code-comm.vue";
import {
SMS_TYPE
} from "@/utils/enumUtils.js";
@@ -145,6 +147,7 @@ import {
USER_LOGIN_TIME,
} from "@/utils/auth.js";
import CryptoJS from "crypto-js";
import { loginFn, getPhoneNumberFn } from "@/utils/login.js";
// #ifdef APP-PLUS
const hyyAlipay = uni.requireNativePlugin("Hyy-Alipay");
@@ -162,9 +165,17 @@ export default {
uni.setStorageSync("version-1", inf.version); // 大版本号
uni.setStorageSync("versionCode", inf.versionCode); // 小版本号
});
let uuid = plus.device.uuid;
// #endif
},
onLoad() {
// #ifdef APP-PLUS
// 判断微信是否安装 (iOS 的 scheme 为 weixin://)
this.isWechatInstalled = plus.runtime.isApplicationExist({
action: 'weixin://'
});
// #endif
},
components: {
InputCodeComm,
},
@@ -189,6 +200,7 @@ export default {
countdown: false, // 清空倒计时
loading: false,
showPolicyModal: false,
isWechatInstalled: false,
};
},
methods: {
@@ -198,31 +210,14 @@ export default {
url: '/pages/home/home'
})
},
aa() {
const nativiPlugin = uni.requireNativePlugin('WITTestUniPlugin');
console.log("隐藏原生tabbar", nativiPlugin)
nativiPlugin.testAsyncFunc({},
(ret) => {
uni.showToast({
title: '调用异步方法 ' + ret,
icon: "none"
})
console.log(ret);
});
},
jumpHome() {
// const sysPlatform = getCurrentSysPlatform();
// if(sysPlatform === "android"){
// uni.switchTab({
// url: '/pages/message/message',
// })
// }else{
uni.switchTab({
url: "/pages/home/home",
});
// }
},
async loginFun(val = {}) {
const then = this;
const form = this.form;
@@ -268,7 +263,6 @@ export default {
uni.setStorageSync('version-1', inf.version); // 大版本号
uni.setStorageSync('versionCode', inf.versionCode); // 小版本号
});
let uuid = plus.device.uuid;
// #endif
this.$refs.uToastRef.show({
@@ -593,6 +587,79 @@ export default {
});
// #endif
},
handleUnpolicyWXLogin() {
this.showPolicyModal = true;
},
handlePolicyConfirm() {
this.isPolicy = true;
this.showPolicyModal = false;
// #ifdef MP-WEIXIN
this.$refs.uToastRef.show({
type: "success",
message: "已同意协议,请再次点击微信登录",
});
// #endif
// #ifndef MP-WEIXIN
this.loginFun();
// #endif
},
getPhoneNumber(e) { // 在bindgetphonenumber回调中获取code动态令牌
if (!e || !e.detail || !e.detail.code) {
console.log('用户拒绝授权手机号或获取失败:', e);
return;
}
loginFn().then(res => { // 微信登录&服务端获取code
console.log("微信登录", res.code, e.detail.code)
// return
getPhoneNumberFn(res.code, e.detail.code).then(response => { // 服务端获取手机号
if (response && response.bizcode === 100) {
const data = response.data;
setStorageFun(TOKEN_NAME, data.token);
// 用于无感登录
setStorageFun(USER_KEY, "");
const userInfo = {
avatar: data.avatarUrl,
name: data.name,
userId: data.userId,
grade: data.grade,
inviteCode: data.inviteCode,
};
setStorageFun(USER_DATA, userInfo);
// 当前登录得时间戳
let currentTimeStamp = new Date().getTime();
setStorageFun(USER_LOGIN_TIME, currentTimeStamp);
const sysInfo = uni.getSystemInfoSync();
uni.setStorageSync("platform", sysInfo.platform);
// #ifdef APP-PLUS
// 获取应用版本信息
plus.runtime.getProperty(plus.runtime.appid, function (inf) {
console.log("版本信息", inf.versionCode);
uni.setStorageSync("version-1", inf.version); // 大版本号
uni.setStorageSync("versionCode", inf.versionCode); // 小版本号
});
// #endif
this.$refs.uToastRef.show({
type: "success",
message: response.msg,
});
setTimeout(() => {
uni.switchTab({
url: "/pages/home/home",
});
}, 1200);
} else if (response && response.msg) {
this.$refs.uToastRef.show({
type: "error",
message: response.msg,
});
}
});
});
},
},
computed: {
@@ -608,7 +675,8 @@ export default {
<style lang="scss" scoped>
.login_warp {
min-height: 100vh;
height: 100vh;
overflow: hidden;
box-sizing: border-box;
padding: 120rpx 50rpx 40rpx;
display: flex;
@@ -697,6 +765,15 @@ export default {
flex-direction: column;
align-items: center;
margin-bottom: 80rpx;
background: transparent;
border: none;
padding: 0;
line-height: normal;
color: inherit;
&::after {
border: none;
}
}
.login_other_item_you {
+166
View File
@@ -0,0 +1,166 @@
<template>
<view class="privacy" v-if="showPrivacy">
<view class="content">
<view class="title">隐私保护指引</view>
<view class="des">
在使用当前小程序服务之前,请仔细阅读<text class="link" @tap="openPrivacyContract">{{ privacyContractName }}</text>。如你同意{{
privacyContractName }},请点击“同意”开始使用。
</view>
<view class="btns">
<button class="item reject" @tap="exitMiniProgram">拒绝</button>
<button id="agree-btn" class="item agree" open-type="agreePrivacyAuthorization"
@agreeprivacyauthorization="handleAgreePrivacyAuthorization">同意</button>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
privacyContractName: '《XXX隐私保护引导》',
showPrivacy: false
}
},
methods: {
checkPrivacySetting() {
uni.getPrivacySetting({
success: res => {
console.log("getPrivacySetting", res)
this.showPrivacy = true
// 返回结果为: res = { needAuthorization: true/false, privacyContractName: '《xxx隐私保护指引》' }
// if (res.needAuthorization) {
// 需要弹出隐私协议
// this.showPrivacy = false
// } else {
// this.showPrivacy = true
// 用户已经同意过隐私协议,所以不需要再弹出隐私协议,也能调用已声明过的隐私接口
// wx.getUserProfile()
// wx.chooseMedia()
// wx.getClipboardData()
// wx.startRecord()
// }
},
fail: () => { },
complete: () => { }
})
},
// 打开隐私协议
openPrivacyContract() {
uni.openPrivacyContract({
fail: () => {
uni.showToast({
title: '遇到错误',
icon: 'error'
})
}
})
},
// 拒绝隐私协议
exitMiniProgram() {
console.log("拒绝隐私协议")
const that = this;
// 直接退出小程序
// wx.exitMiniProgram()
uni.showModal({
// 如果拒绝,我们将无法获取您的信息, 包括手机号、位置信息、相册等该小程序十分重要的功能,您确定要拒绝吗?
content: '您确定要拒绝吗?',
success: res => {
if (res.confirm) {
that.showPrivacy = false;
uni.exitMiniProgram({
success: () => {
console.log('退出小程序成功');
}
});
}
}
});
},
// 同意隐私协议
handleAgreePrivacyAuthorization() {
wx.requirePrivacyAuthorize({
success: () => {
// 用户同意授权
// 继续小程序逻辑
this.showPrivacy = false
},
fail: () => { }, // 用户拒绝授权
complete: () => { }
})
}
}
}
</script>
<style scoped>
.privacy {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: rgba(0, 0, 0, .5);
z-index: 9999999;
display: flex;
align-items: center;
justify-content: center;
}
.content {
width: 632rpx;
padding: 48rpx;
box-sizing: border-box;
background: #fff;
border-radius: 16rpx;
}
.content .title {
text-align: center;
color: #333;
font-weight: bold;
font-size: 32rpx;
}
.content .des {
font-size: 26rpx;
color: #666;
margin-top: 40rpx;
text-align: justify;
line-height: 1.6;
}
.content .des .link {
color: #07c160;
text-decoration: underline;
}
.btns {
margin-top: 48rpx;
display: flex;
}
.btns .item {
justify-content: space-between;
width: 244rpx;
height: 80rpx;
display: flex;
align-items: center;
justify-content: center;
border-radius: 16rpx;
box-sizing: border-box;
border: none;
}
.btns .reject {
background: #f4f4f5;
color: #909399;
}
.btns .agree {
background: #07c160;
color: #fff;
}
</style>