uni-agree.nvue 3.6 KB
Newer Older
DCloud_JSON's avatar
DCloud_JSON 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
<template>
    <view class="page">
        <view>
            <text class="title">个人信息保护指引</text>
        </view>
        <view class="text-item">
            <text class="tl">1.在浏览使用时,我们会收集、使用设备标识信息用于推荐。</text>
        </view>
        <view class="text-item">
            <text class="tl">2.我们可能会申请位置权限,用于演示 uni-app 的地图、定位能力。</text>
        </view>
        <view class="text-item">
            <text class="tl">3.你可以查看完整版</text>
        </view>
        <view class="text-item flex-r">
            <text class="tl hl" @click="openprotocol">《用户协议》</text>
            <text class="tl"> 和 </text>
            <text class="tl hl" @click="openPrivacyPolicy">《隐私政策》</text>
        </view>
        <view class="text-item">
            <text class="tl">以便了解我们收集、使用、共享、存储信息的情况,以及对信息的保护措施。</text>
        </view>
        <view class="text-item">
            <text class="service">如果你同意请点击下面的按钮以接受我们的服务</text>
        </view>
        <view class="text-item confirm">
            <button class="btn-privacy" type="primary" @click="agree">同意</button>
28
			<button class="btn-privacy btn-disagree" @click="disagree">暂不使用</button>
DCloud_JSON's avatar
DCloud_JSON 已提交
29 30 31 32 33 34 35
        </view>
        <view class="exit-area">
            
        </view>
    </view>
</template>

36
<script>
37 38
import config from '@/uni-starter.config.js';
const { about } = config
DCloud_JSON's avatar
DCloud_JSON 已提交
39 40 41 42 43 44 45 46 47 48 49 50 51 52
    export default {
        data() {
            return {
            }
        },
        onLoad() {
            this._canBack = false;
        },
        onBackPress() {
            return !this._canBack;
        },
        methods: {
            openprotocol(e) {
                uni.navigateTo({
DCloud_JSON's avatar
DCloud_JSON 已提交
53
                    url: "/pages/common/webview/webview?url="+about.agreements[0].url
DCloud_JSON's avatar
DCloud_JSON 已提交
54 55 56 57
                })
            },
			openPrivacyPolicy(e) {
			    uni.navigateTo({
DCloud_JSON's avatar
DCloud_JSON 已提交
58
			        url: "/pages/common/webview/webview?url="+about.agreements[1].url
DCloud_JSON's avatar
DCloud_JSON 已提交
59 60 61 62 63 64 65 66 67 68 69 70
			    })
			},
            agree(e) {
                var saveStatus = uni.setStorageSync("userprotocol", 1);
                this._canBack = true;
                setTimeout(() => {
                    uni.navigateBack({
                        animationDuration: 0
                    });
                }, 100)
            },
            disagree() {
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
				// #ifdef APP-PLUS
				plus.runtime.quit();
				// #endif
				// #ifdef H5
				uni.showModal({
					content: '确定退出本应用?',
					cancelText:"退出",
					confirmText:"取消",
					success: (e) => {
						if(!e.confirm){
							window.location.href="about:blank";
							window.close();
						}
					}
				});
				// #endif
DCloud_JSON's avatar
DCloud_JSON 已提交
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
            }
        }
    }
</script>

<style>
    .page {
        padding: 80px 30px;
    }

    .title {
        font-size: 18px;
        line-height: 30px;
        margin-bottom: 20px;
    }

    .flex-r {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .text-item {
        margin-bottom: 5px;
    }

    .tl {
        font-size: 14px;
        line-height: 20px;
    }

    .hl {
        color: #007AFF;
    }

    .service {
        font-size: 16px;
        line-height: 20px;
        margin-top: 20px;
    }

    .confirm {
        margin-top: 50px;
		flex-direction: row;
    }

    .btn-privacy {
       flex: 1;
    }

    .btn-disagree {
        margin-left: 20px;
    }
</style>