Browse Source

隐私协议

dev_YWQ
HolyKnightIX 1 year ago
parent
commit
417f8fd87f
4 changed files with 155 additions and 4 deletions
  1. BIN
      src/assets/icon/delete.png
  2. +2
    -1
      src/manifest.json
  3. +152
    -3
      src/pages/login/index.vue
  4. +1
    -0
      src/pages/uploadPhoto/uploadPhoto.vue

BIN
src/assets/icon/delete.png View File

Before After
Width: 400  |  Height: 400  |  Size: 15 KiB

+ 2
- 1
src/manifest.json View File

@@ -70,7 +70,8 @@
"ignoreDevUnusedFiles": false,
"ignoreUploadUnusedFiles": false
},
"usingComponents": true
"usingComponents": true,
"usePrivacyCheck": true
},
"h5": {
"title": "",


+ 152
- 3
src/pages/login/index.vue View File

@@ -119,6 +119,32 @@
</u--form>
<view class="loginBtn" @click="loginByCode">登录</view>
</view>

<view class="outSide" v-if="showPrivacy">
<view class="showPrivacy">
<view class="title">隐私协议更新</view>
<view class="content">
感谢您一直以来对我们的信任和支持。为了更好地保护您的个人信息安全我们已经更新了隐私协议。如您继续使用我们的服务即表示同意并接受更新后的隐私协议。如您有任何疑问或意见,欢迎您联系我们的客户服务团队。
</view>
<button
class="agree"
type="primary"
open-type="agreePrivacyAuthorization"
@agreeprivacyauthorization="handleAgreePrivacyAuthorization"
>
同意
</button>
<button class="check" @click="handleOpenPrivacyContract">
查看《隐私保护指引》
</button>
<image
@click="closePrivacy"
class="delete"
src="../../assets/icon/delete.png"
mode=""
/>
</view>
</view>
</view>
</template>

@@ -135,6 +161,9 @@ import {
import { userInfoModules } from "@/store/modules/userInfo";
//#endregion
const userInfoModulesPinia = userInfoModules();

const showPrivacy = ref(false);

console.log(userInfoModulesPinia.platForm);
const pageClass = computed(() => {
if (userInfoModulesPinia.platForm == 1) {
@@ -375,6 +404,55 @@ async function loginByCode() {
}
//#endregion ---------------------

const getPrivacySetting = (num) => {
const canIUsePrivacy = wx.canIUse("getPrivacySetting");
console.log(canIUsePrivacy, "canIUse getPrivacySetting");
if (canIUsePrivacy) {
wx.getPrivacySetting({
success: (res) => {
console.log(res, "getPrivacySetting"); // 返回结果为: res = { needAuthorization: true/false, privacyContractName: '《xxx隐私保护指引》' }
if (res.needAuthorization) {
// 需要弹出隐私协议
showPrivacy.value = true;
} else {
// 用户已经同意过隐私协议,所以不需要再弹出隐私协议,也能调用已声明过的隐私接口
if (num == 1) {
// 返回token,直接跳转首页
uni.switchTab({
url: "/pages/uploadPhoto/uploadPhoto",
});
} else if (num == 2) {
// 没有返回token,无事发生
}
}
},
fail: () => {},
complete: () => {},
});
}
};

// 关闭弹框直接退出小程序,仅对微信小程序生效
const closePrivacy = () => {
wx.exitMiniProgram();
};

const handleAgreePrivacyAuthorization = () => {
console.log("Privacy Agreed!");
showPrivacy.value = false;
// 用户同意隐私协议事件回调
// 用户点击了同意,之后所有已声明过的隐私接口和组件都可以调用了
};

const handleOpenPrivacyContract = () => {
// 打开隐私协议页面
wx.openPrivacyContract({
success: () => {}, // 打开成功
fail: () => {}, // 打开失败
complete: () => {},
});
};

//#region
onLoad((options) => {
uni.hideHomeButton();
@@ -421,9 +499,7 @@ onLoad((options) => {
// }
uni.hideLoading();
if (res2.data.token) {
uni.switchTab({
url: "/pages/uploadPhoto/uploadPhoto",
});
getPrivacySetting(1);
} else {
console.log("error1");
uni.showToast({
@@ -431,6 +507,8 @@ onLoad((options) => {
icon: "none",
});
}
} else {
getPrivacySetting(2);
}
uni.hideLoading();
} catch (error) {
@@ -539,13 +617,16 @@ onLoad((options) => {
padding: 0;
min-height: 100vh;
}

.bgImg {
width: 750rpx;
height: 100vh;
}

.videoBox {
width: 750rpx;
height: 1120rpx;

// aspect-ratio: 9/12;
video {
width: 100%;
@@ -553,6 +634,7 @@ onLoad((options) => {
// aspect-ratio: 9/12;
}
}

.bottomBox {
position: absolute;
bottom: 0;
@@ -563,6 +645,7 @@ onLoad((options) => {
align-items: center;
background-color: rgba(0, 0, 0, 0.8);
color: #fff !important;

.bottomBtn {
margin-top: 55rpx;
margin-bottom: 65rpx;
@@ -576,10 +659,12 @@ onLoad((options) => {
font-size: 30rpx;
font-weight: 900;
}

.checkPro {
display: inline-block;
height: 27rpx;
line-height: 54rpx;

.goPro {
color: #ff4f00;
}
@@ -594,21 +679,85 @@ onLoad((options) => {
z-index: 9;
background-color: #fff;
padding: 30rpx;

.u-code {
width: 100%;
height: 50rpx;
background-color: green;
color: #ff4f00;
}

.getCodeBtn {
background-color: green;
text-align: center;
line-height: 50rpx;
}

.loginBtn {
background-color: #ff4f00;
text-align: center;
line-height: 50rpx;
}
}

.outSide {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
color: #000000;
background-color: #00000059;

.showPrivacy {
position: fixed;
width: 520rpx;
background-color: #fff;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
padding: 60rpx 50rpx;
border-radius: 20rpx;
box-shadow: #00000047 2px 1px 2px 2px;

.title {
text-align: center;
font-size: 30rpx;
font-weight: 600;
}

.content {
text-indent: 2em;
margin: 40rpx 0;
}

button {
width: 350rpx;

&.agree {
margin-bottom: 25rpx;
background-color: #ff4f00;
}

&.check {
background-color: #ffffff00;
font-size: 21rpx;
text-decoration: underline;
padding: 0;

&::after {
border: none;
}
}
}

.delete {
position: absolute;
top: 15rpx;
right: 15rpx;
width: 65rpx;
height: 65rpx;
}
}
}
</style>

+ 1
- 0
src/pages/uploadPhoto/uploadPhoto.vue View File

@@ -86,6 +86,7 @@
<script setup>
//#region 导入
import { ref, reactive, nextTick } from "vue";
import { BASE_URL } from "../../utils/request";
import { onLoad, onShow } from "@dcloudio/uni-app";
import { loginApi } from "../../api/login";
import { addImageApi } from "../../api/uploadphoto.js";


Loading…
Cancel
Save