178 lines
4.3 KiB
Vue
178 lines
4.3 KiB
Vue
<template>
|
||
<view>
|
||
<!-- 隐私条款弹窗 -->
|
||
<view class="privacy-modal" v-if="showPrivacyModal">
|
||
<view class="privacy-modal-mask"></view>
|
||
<view class="privacy-modal-content">
|
||
<view class="privacy-modal-title">隐私声明</view>
|
||
<view class="privacy-modal-body">
|
||
<text>请你务必审慎阅读、充分理解"隐私政策"各条款,包括但不限于:为了更好的向您提供</text>
|
||
<text class="highlight">远程控制生产机器</text>
|
||
<text>服务,我们需要收集您的</text>
|
||
<text class="underline">设备标识</text>
|
||
<text>、</text>
|
||
<text class="underline">操作日志</text>
|
||
<text>、</text>
|
||
<text class="underline">机器运行参数</text>
|
||
<text>等信息用于分析、优化应用性能。你可阅读</text>
|
||
<text class="privacy-link" @click="openPrivacyPolicy">《隐私政策》</text>
|
||
<text>了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。</text>
|
||
</view>
|
||
<view class="privacy-modal-footer">
|
||
<button class="privacy-confirm-btn" @click="agreePrivacy">同意</button>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
<script>
|
||
import { BASE_API_URL} from "@/config.js";
|
||
export default {
|
||
data() {
|
||
return {
|
||
showPrivacyModal: true, // 隐私条款弹窗显示状态
|
||
}
|
||
},
|
||
onLaunch: function () {
|
||
console.log("App Launch");
|
||
uni.login({
|
||
success: (res) => {
|
||
if (res.code) {
|
||
this.loginWithPhoneNumber(res.code);
|
||
}
|
||
},
|
||
});
|
||
},
|
||
onShow: function () {
|
||
console.log("App Show");
|
||
},
|
||
onHide: function () {
|
||
console.log("App Hide");
|
||
},
|
||
methods: {
|
||
//隐私条款按钮
|
||
openPrivacyPolicy(){
|
||
// 跳转到隐私政策页面或打开网页
|
||
uni.navigateTo({
|
||
url: '/pages/privacy/index' // 如果有隐私政策页面
|
||
});
|
||
},
|
||
async loginWithPhoneNumber (code) {
|
||
try {
|
||
const res = await uni.request({
|
||
url: BASE_API_URL + "/api/front/wechat/authorize/login",
|
||
method: "POST",
|
||
data: { code },
|
||
header: {
|
||
"Content-Type": "application/x-www-form-urlencoded", // 关键配置
|
||
},
|
||
});
|
||
if (res.data.status == 400) {
|
||
// 1. 显示无按钮的 Toast(无法关闭)
|
||
uni.showToast({
|
||
title: res.data.message,
|
||
icon: 'none',
|
||
duration: 9999999, // 极长时间,相当于不自动关闭
|
||
mask: true, // 透明遮罩层,阻止触摸
|
||
});
|
||
}
|
||
if (res.statusCode == 200) {
|
||
// showPrivacyModal: true, //显示隐私条款
|
||
if(res.data.type === 'register'){
|
||
|
||
}
|
||
|
||
|
||
// 存储用户信息到本地缓存(uni-app接口)
|
||
uni.setStorageSync("userInfo", res.data);
|
||
// uni.showToast({ title: "登录成功" });
|
||
}
|
||
} catch (error) {
|
||
// uni.showToast({ title: "登录失败", icon: "none" });
|
||
}
|
||
},
|
||
},
|
||
};
|
||
</script>
|
||
|
||
<style>
|
||
/*每个页面公共css */
|
||
/* 隐私政策弹窗样式 */
|
||
.privacy-modal {
|
||
position: fixed;
|
||
top: 0;
|
||
left: 0;
|
||
width: 100%;
|
||
height: 100%;
|
||
z-index: 9999;
|
||
}
|
||
|
||
.privacy-modal-mask {
|
||
position: absolute;
|
||
top: 0;
|
||
left: 0;
|
||
width: 100%;
|
||
height: 100%;
|
||
background-color: rgba(0, 0, 0, 0.5);
|
||
}
|
||
|
||
.privacy-modal-content {
|
||
position: absolute;
|
||
top: 50%;
|
||
left: 50%;
|
||
transform: translate(-50%, -50%);
|
||
width: 80%;
|
||
max-width: 600rpx;
|
||
background-color: #fff;
|
||
border-radius: 20rpx;
|
||
padding: 40rpx;
|
||
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.1);
|
||
}
|
||
|
||
.privacy-modal-title {
|
||
font-size: 36rpx;
|
||
font-weight: 600;
|
||
color: #333;
|
||
text-align: center;
|
||
margin-bottom: 30rpx;
|
||
}
|
||
|
||
.privacy-modal-body {
|
||
font-size: 28rpx;
|
||
color: #666;
|
||
line-height: 1.6;
|
||
margin-bottom: 40rpx;
|
||
}
|
||
|
||
.privacy-link {
|
||
color: #007AFF;
|
||
text-decoration: underline;
|
||
}
|
||
|
||
.privacy-modal-footer {
|
||
text-align: center;
|
||
}
|
||
|
||
.privacy-confirm-btn {
|
||
background-color: #1893d7;
|
||
color: #fff;
|
||
border: none;
|
||
border-radius: 10rpx;
|
||
padding: 20rpx 60rpx;
|
||
font-size: 32rpx;
|
||
font-weight: 500;
|
||
}
|
||
|
||
/* 重点内容加粗样式 */
|
||
.highlight {
|
||
font-weight: 700;
|
||
color: #333;
|
||
}
|
||
|
||
/* 下划线样式 */
|
||
.underline {
|
||
text-decoration: underline;
|
||
color: #007AFF;
|
||
}
|
||
</style>
|