Commit 15665412 authored by caimeng's avatar caimeng

完成隐私设置页面

parent ff0b1bdd
...@@ -11,19 +11,19 @@ export default { ...@@ -11,19 +11,19 @@ export default {
const appStart = uni.getStorageSync('appStart') const appStart = uni.getStorageSync('appStart')
if (appStart) { if (appStart) {
uni.switchTab({ // uni.switchTab({
url: "/pages/index/index", // url: "/pages/index/index",
success: function () {
plus.navigator.closeSplashscreen()
}
})
// uni.navigateTo({
// url: "/subPackage/setting/setting",
// success: function () { // success: function () {
// plus.navigator.closeSplashscreen() // plus.navigator.closeSplashscreen()
// } // }
// }) // })
uni.navigateTo({
url: "/subPackage/setting/setting",
success: function () {
plus.navigator.closeSplashscreen()
}
})
} else { } else {
uni.redirectTo({ uni.redirectTo({
......
...@@ -223,6 +223,13 @@ ...@@ -223,6 +223,13 @@
"enablePullDownRefresh": false, "enablePullDownRefresh": false,
"navigationBarTitleText": "" "navigationBarTitleText": ""
} }
},
{
"path" : "privacy/privacy",
"style" :
{
"navigationBarTitleText" : "隐私管理"
}
} }
] ]
} }
......
.privacy-page {
background-color: #F7FAFF;
width: 100vw;
height: 100vh;
box-sizing: border-box;
padding: 0rpx 30rpx;
.p-tips {
height: 133rpx;
box-sizing: border-box;
padding: 24rpx 0;
font-size: 24rpx;
line-height: 33rpx;
color: #2263E6;
letter-spacing: 0.24rpx;
}
.p-list {
margin-top: 24rpx;
}
.p-item {
position: relative;
width: 690rpx;
height: 164rpx;
background-color: #fff;
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(232, 232, 232, 0.49);
border-radius: 10rpx;
box-sizing: border-box;
padding-left: 89rpx;
padding-top: 38rpx;
margin-bottom: 24rpx;
.p-item-icon {
position: absolute;
left: 19rpx;
top: 55rpx;
width: 56rpx;
height: 55rpx;
image {
display: block;
width: 100%;
height: 100%;
}
}
.p-item-title {
font-weight: bold;
font-size: 28rpx;
color: #333333;
line-height: 40rpx;
margin-bottom: 16rpx;
}
.p-item-content {
font-weight: 400;
font-size: 24rpx;
color: #666666;
line-height: 33rpx;
}
.p-item-btn {
position: absolute;
right: 20rpx;
top: 38rpx;
box-sizing: border-box;
display: flex;
align-items: center;
text {
font-size: 28rpx;
color: #999;
line-height: 40rpx;
}
image {
display: block;
width: 31rpx;
height: 30rpx;
}
&.p-item-btn-uncheck {
text {
color: #333;
}
}
}
}
}
\ No newline at end of file
<template>
<view class="privacy-page">
<!-- 提示文案 -->
<view class="p-tips"
><text
>为向您提供更优质的服务,多典花在特定场景可能向您申请一下手机系统权限</text
></view
>
<!-- 隐私列表 -->
<view class="p-list">
<view
class="p-item"
v-for="(item, index) in list"
:key="index"
@click="JumpPermissionSetting"
>
<view class="p-item-icon">
<image :src="item.icon" mode="widthFix"></image>
</view>
<view class="p-item-title">
<text>{{ item.title }}</text>
</view>
<view class="p-item-content">
<text>{{ item.content }}</text>
</view>
<!-- 去设置 -->
<view v-if="item.status === 1" class="p-item-btn">
<text>{{ item.btn }}</text>
<image
src="https://ddh.yyhock.com/appStatic/i-arrow-gray.png"
mode="widthFix"
></image>
</view>
<!-- 已允许 -->
<view v-else class="p-item-btn p-item-btn-uncheck">
<text>{{ item.btn }}</text>
<image
src="https://ddh.yyhock.com/appStatic/i-arrow-black.png"
mode="widthFix"
></image>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
list: [
{
icon: "https://ddh.yyhock.com/appStatic/i-location.png",
title: "开启地理位置定位",
content: "为了向您提供扫码、拍照、身份验证服务",
btn: "去设置",
status: 0,
},
{
icon: "https://ddh.yyhock.com/appStatic/i-location.png",
title: "允许访问相机",
content: "为了向您提供扫码、拍照、身份验证服务",
btn: "去设置",
status: 0,
},
{
icon: "https://ddh.yyhock.com/appStatic/i-location.png",
title: "允许访问通讯录",
content: "为了方便您在使用授信服务时进行风险评估",
btn: "去设置",
status: 0,
},
{
icon: "https://ddh.yyhock.com/appStatic/i-location.png",
title: "允许访问相册",
content: "为便于您使用扫码、提交或发送指定图片等功能",
btn: "去设置",
status: 0,
},
],
};
},
methods: {
JumpPermissionSetting() {
uni.openAppAuthorizeSetting({
success: function (res) {
console.log(res, "成功");
},
});
},
},
};
</script>
<style src="./privacy.less" lang="less"></style>
<template> <template>
<view class="set-page"> <view class="set-page">
<view class="set-main"> <view class="set-main">
<view class="main-line"> <view class="main-line">
<view class="line-item" @click="getProtol"> <view class="line-item" @click="getProtol">
<view class="item-text">相关协议</view> <view class="item-text">相关协议</view>
<view class="item-icon"></view> <view class="item-icon"></view>
</view> </view>
<view class="line-item" @click="cancelSize">
<view class="item-text">清除缓存</view>
<view class="item-r">
<view class="r-text">{{ cacheSize }}</view>
<i class="r-icon"></i>
</view>
</view>
<view class="line-item" @click="cancelSize"> <navigator url="/subPackage/privacy/privacy" hover-class="none" class="line-item">
<view class="item-text">清除缓存</view> <view class="item-text">隐私管理</view>
<view class="item-r"> <view class="item-r">
<view class="r-text">{{ cacheSize }}</view> <i class="r-icon"></i>
<i class="r-icon"></i> </view>
</view> </navigator>
</view>
<view class="line-item">
<view class="line-item"> <view class="item-text">当前版本</view>
<view class="item-text">当前版本</view> <view class="item-version">{{ versionNumber }}</view>
<view class="item-version">{{ versionNumber }}</view> </view>
</view> </view>
</view>
<!-- 注销账号 -->
<!-- 注销账号 --> <view class="line-des">
<view class="line-des"> <text>如果您今后不打算使用APP,您可以选择</text
<text>如果您今后不打算使用APP,您可以选择</text ><text class="des-x" @click="handleLogoffCheck">注销账号</text>
><text class="des-x" @click="handleLogoffCheck">注销账号</text> </view>
</view> <view class="line-tips">注:该操作不可恢复</view>
<view class="line-tips">注:该操作不可恢复</view> </view>
</view>
<view class="set-footer" @click="handleLogout">退出登录</view>
<view class="set-footer" @click="handleLogout">退出登录</view>
<page-meta
<page-meta :page-style="'overflow:' + (visible ? 'hidden' : 'visible')"
:page-style="'overflow:' + (visible ? 'hidden' : 'visible')" ></page-meta>
></page-meta>
<!-- 注销弹框 -->
<!-- 注销弹框 --> <uni-popup
<uni-popup class="logoff-dialog"
class="logoff-dialog" ref="logoffDialog"
ref="logoffDialog" @change="handlePopupChange"
@change="handlePopupChange" type="dialog"
type="dialog" >
> <uni-popup-dialog
<uni-popup-dialog type="info"
type="info" :cancelText="confirmText"
:cancelText="confirmText" :confirmText="cancelText"
:confirmText="cancelText" :content="message"
:content="message" @confirm="logoffCancel"
@confirm="logoffCancel" @close="logoffConfirm"
@close="logoffConfirm" ></uni-popup-dialog>
></uni-popup-dialog> </uni-popup>
</uni-popup>
<!-- 退出 -->
<!-- 退出 --> <uni-popup
<uni-popup class="logout-dialog"
class="logout-dialog" ref="logoutDialog"
ref="logoutDialog" @change="handlePopupChange"
@change="handlePopupChange" type="dialog"
type="dialog" >
> <uni-popup-dialog
<uni-popup-dialog type="info"
type="info" cancelText="取消"
cancelText="取消" confirmText="确认"
confirmText="确认" title="提示"
title="提示" content="您确定退出登录吗?"
content="您确定退出登录吗?" @confirm="loginOut"
@confirm="loginOut" @close="logoutCancel"
@close="logoutCancel" ></uni-popup-dialog>
></uni-popup-dialog> </uni-popup>
</uni-popup> </view>
</view> </template>
</template>
<script>
<script> import { loadVersion } from "@/utils";
import { loadVersion } from "@/utils"; import API from "@/server/common.js";
import API from "@/server/common.js"; export default {
export default { data() {
data() { return {
return { versionNumber: "",
versionNumber: "", cacheSize: "",
cacheSize: "",
visible: false,
visible: false, message: "您一旦确认注销,您所有信息都会被清除,您确认注销账号?",
message: "您一旦确认注销,您所有信息都会被清除,您确认注销账号?", cancelText: "确认",
cancelText: "确认", confirmText: "取消",
confirmText: "取消", allowCancel: false,
allowCancel: false, result: null,
result: null, };
}; },
}, onShow() {
onShow() { this.init();
this.init(); },
}, methods: {
methods: { // 页面初始化
// 页面初始化 async init() {
async init() { try {
try { // 埋点
// 埋点 this.buryingPoint("app:setting_pageView");
this.buryingPoint("app:setting_pageView");
// 获取设备版本号
// 获取设备版本号 this.versionNumber = await loadVersion();
this.versionNumber = await loadVersion();
// 初始化缓存
// 初始化缓存 this.cacheSize = await this.getDeviceCache();
this.cacheSize = await this.getDeviceCache();
console.log(
console.log( this.versionNumber,
this.versionNumber, this.cacheSize,
this.cacheSize, "初始化信息000000000000"
"初始化信息000000000000" );
); } catch (err) {
} catch (err) { console.log(err, "页面初始化报错");
console.log(err, "页面初始化报错"); }
} },
}, toJSON() {},
toJSON() {}, // 获取设备缓存
// 获取设备缓存 getDeviceCache() {
getDeviceCache() { let cacheSize;
let cacheSize; return new Promise((resolve) => {
return new Promise((resolve) => { plus.cache.calculate((size) => {
plus.cache.calculate((size) => { if (size < 1024) {
if (size < 1024) { cacheSize = size + "B";
cacheSize = size + "B"; } else if (size / 1024 >= 1 && size / 1024 / 1024 < 1) {
} else if (size / 1024 >= 1 && size / 1024 / 1024 < 1) { cacheSize = Math.floor((size / 1024) * 100) / 100 + "KB";
cacheSize = Math.floor((size / 1024) * 100) / 100 + "KB"; } else if (size / 1024 / 1024 >= 1) {
} else if (size / 1024 / 1024 >= 1) { cacheSize = Math.floor((size / 1024 / 1024) * 100) / 100 + "M";
cacheSize = Math.floor((size / 1024 / 1024) * 100) / 100 + "M"; }
} resolve(cacheSize);
resolve(cacheSize); });
}); });
}); },
}, // 清除缓存
// 清除缓存 cancelSize() {
cancelSize() { try {
try { let self = this;
let self = this; plus.cache.clear(() => {
plus.cache.clear(() => { uni.showToast({
uni.showToast({ title: "清除成功!",
title: "清除成功!", icon: "none",
icon: "none", success() {
success() { self.cacheSize = "0B";
self.cacheSize = "0B"; },
}, });
}); });
}); } catch (error) {
} catch (error) { console.log(error, "清除缓存出错");
console.log(error, "清除缓存出错"); }
} },
},
// 跳转到协议列表页面
// 跳转到协议列表页面 getProtol() {
getProtol() { uni.navigateTo({
uni.navigateTo({ url: "/subPackage/prolist/prolist",
url: "/subPackage/prolist/prolist", });
}); },
},
handlePopupChange(e) {
handlePopupChange(e) { console.log(e, "弹窗变化");
console.log(e, "弹窗变化"); this.visible = e.show;
this.visible = e.show; },
}, // 账户注销前校验
// 账户注销前校验 async handleLogoffCheck() {
async handleLogoffCheck() { try {
try { const res = await API.userLogoffPreCheck();
const res = await API.userLogoffPreCheck(); if (res.success) {
if (res.success) { const { tips, status } = res.result;
const { tips, status } = res.result; this.result = res.result;
this.result = res.result; this.message = tips;
this.message = tips;
switch (status) {
switch (status) { case "APPLY_LOAN":
case "APPLY_LOAN": this.cancelText = "查看进度";
this.cancelText = "查看进度"; this.confirmText = "取消";
this.confirmText = "取消"; break;
break; case "NEED_REPAYMENT":
case "NEED_REPAYMENT": this.cancelText = "查看账单";
this.cancelText = "查看账单"; this.confirmText = "取消";
this.confirmText = "取消"; break;
break; default:
default: this.cancelText = "取消";
this.cancelText = "取消"; this.confirmText = "确认";
this.confirmText = "确认"; break;
break; }
} this.$refs.logoffDialog.open();
this.$refs.logoffDialog.open(); } else {
} else { uni.showToast({
uni.showToast({ title: res.message,
title: res.message, icon: "none",
icon: "none", });
}); }
} } catch (err) {
} catch (err) { console.log(err, "注销前校验报错");
console.log(err, "注销前校验报错"); }
} },
},
// 注销账号确认
// 注销账号确认 async logoffConfirm() {
async logoffConfirm() { try {
try { const { status } = this.result;
const { status } = this.result; switch (status) {
switch (status) { case "APPLY_LOAN":
case "APPLY_LOAN": case "NEED_REPAYMENT":
case "NEED_REPAYMENT": this.$refs.logoffDialog.close();
this.$refs.logoffDialog.close(); break;
break; default:
default: const res = await API.userLogoff();
const res = await API.userLogoff(); if (res.success) {
if (res.success) { uni.setTabBarItem({
uni.setTabBarItem({ index: 1,
index: 1, visible: false,
visible: false, });
}); uni.removeStorageSync("token");
uni.removeStorageSync("token"); this.$refs.logoffDialog.close();
this.$refs.logoffDialog.close(); uni.showToast({
uni.showToast({ title: "账号已注销",
title: "账号已注销", icon: "none",
icon: "none", });
}); setTimeout(() => {
setTimeout(() => { this.Go("uni:/pages/index/index", "tab");
this.Go("uni:/pages/index/index", "tab"); }, 1200);
}, 1200); }
} break;
break; }
} } catch (err) {
} catch (err) { console.log(err, "注销账号报错");
console.log(err, "注销账号报错"); }
} },
},
// 注销账号取消
// 注销账号取消 logoffCancel() {
logoffCancel() { try {
try { const { status, jumpPath } = this.result;
const { status, jumpPath } = this.result; switch (status) {
switch (status) { case "APPLY_LOAN":
case "APPLY_LOAN": this.Go("uni:/pages/web/web", "tab");
case "NEED_REPAYMENT": break;
const config = JSON.parse(uni.getStorageSync("APP-SETTING")); case "NEED_REPAYMENT":
const timestamp = new Date().getTime(); const config = JSON.parse(uni.getStorageSync("APP-SETTING"));
const token = uni.getStorageSync("tokenFinance"); const timestamp = new Date().getTime();
const mobile = uni.getStorageSync("l-mobile"); const token = uni.getStorageSync("tokenFinance");
const $src = const mobile = uni.getStorageSync("l-mobile");
config["h5Url"] + const $src =
`?token=${token}&mobile=${mobile}&timestamp=${timestamp}#/${jumpPath}`; config["h5Url"] +
const newSrc = $src.split("?"); `?token=${token}&mobile=${mobile}&timestamp=${timestamp}#/${jumpPath}`;
const targetSrc = `${newSrc[0]}?${encodeURIComponent(newSrc[1])}`; const newSrc = $src.split("?");
const targetSrc = `${newSrc[0]}?${encodeURIComponent(newSrc[1])}`;
uni.navigateTo({
url: `/pages/web/websrc?url=${targetSrc}`, uni.navigateTo({
}); url: `/pages/web/websrc?url=${targetSrc}`,
break; });
default: break;
this.$refs.logoffDialog.close(); default:
break; this.$refs.logoffDialog.close();
} break;
} catch (err) { }
console.log(err); } catch (err) {
} console.log(err);
}, }
},
// 退出登录弹框展示
handleLogout() { // 退出登录弹框展示
this.$refs.logoutDialog.open(); handleLogout() {
}, this.$refs.logoutDialog.open();
},
// 退出登录确认
async loginOut() { // 退出登录确认
try { async loginOut() {
const res = await API.userLogout(); try {
if (res.success) { const res = await API.userLogout();
uni.setTabBarItem({ if (res.success) {
index: 1, uni.setTabBarItem({
visible: false, index: 1,
}); visible: false,
this.logoutCancel(); });
uni.showToast({ this.logoutCancel();
title: "退出登录成功", uni.showToast({
icon: "success", title: "退出登录成功",
}); icon: "success",
setTimeout(() => { });
uni.removeStorageSync("token"); setTimeout(() => {
uni.navigateBack(); uni.removeStorageSync("token");
}, 1000); uni.navigateBack();
} }, 1000);
} catch (err) { }
console.log(err, "退出登录报错"); } catch (err) {
} console.log(err, "退出登录报错");
}, }
// 退出登录取消 },
logoutCancel() { // 退出登录取消
this.$refs.logoutDialog.close(); logoutCancel() {
}, this.$refs.logoutDialog.close();
}, },
}; },
</script> };
</script>
<style src="./index.less" lang="less"></style>
<style src="./index.less" lang="less"></style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment