PrivacyAgreementModal.vue
12.3 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
<template>
<nut-popup
v-model:visible="modalVisible"
position="bottom"
:closeable="false"
:close-on-click-overlay="false"
round
:safe-area-inset-bottom="true"
:catch-move="true"
class="privacy-modal"
>
<view class="privacy-content">
<!-- 标题 -->
<view class="privacy-header">
<text class="privacy-title">隐私政策与用户协议</text>
</view>
<!-- 内容 -->
<view class="privacy-body">
<text class="privacy-text">
你好,小程序涉及收集、使用和存储用户信息,增加了
<text class="privacy-link" @tap="onUserAgreementClick">《用户服务协议》</text>
及
<text class="privacy-link" @tap="onPrivacyPolicyClick">《隐私政策》</text>
,明确告知收集用户信息的使用目的、方式和用途,并取得用户授权同意后,才能获取用户收集用户信息。
</text>
</view>
<!-- 同意选择 -->
<view class="privacy-agreement">
<nut-checkbox v-model="agreed" class="agreement-checkbox">
<text class="agreement-text">我已阅读并同意上述协议</text>
</nut-checkbox>
</view>
<!-- 操作按钮 -->
<view class="privacy-actions">
<nut-button
class="action-btn cancel-btn"
@click="onCancel"
>
关闭
</nut-button>
<nut-button
class="action-btn confirm-btn"
type="primary"
:disabled="!agreed"
@click="onConfirm"
>
确认进入
</nut-button>
</view>
</view>
</nut-popup>
<!-- 内容全屏显示弹框 -->
<nut-popup
v-model:visible="showContentModal"
position="right"
:closeable="true"
:close-on-click-overlay="true"
:safe-area-inset-bottom="true"
:style="{ width: '100%', height: '100%' }"
@close="onCloseContentModal"
>
<view class="content-container">
<!-- 标题栏 -->
<view class="content-header">
<text class="content-title">{{ contentTitle }}</text>
<view class="close-btn" @click="onCloseContentModal">
<text class="close-text">×</text>
</view>
</view>
<!-- 内容区域 -->
<scroll-view class="content-scroll" :scroll-y="true">
<view class="content-body">
<view class="content-text" v-html="contentText"></view>
</view>
</scroll-view>
</view>
</nut-popup>
</template>
<script setup>
import { ref, computed, watch, defineEmits, defineProps } from 'vue'
import Taro from '@tarojs/taro'
// Props
const props = defineProps({
visible: {
type: Boolean,
default: false
}
})
// Emits
const emit = defineEmits(['update:visible', 'confirm', 'cancel'])
// 响应式数据
const agreed = ref(false)
// 监听弹框显示状态,每次打开时重置agreed
watch(() => props.visible, (newVisible) => {
if (newVisible) {
agreed.value = false
}
})
// 计算属性
const modalVisible = computed({
get() {
return props.visible
},
set(value) {
emit('update:visible', value)
}
})
// 用户服务协议内容
const userAgreementContent = `
<div class="agreement-section">
<div class="section-title">1.总则</div>
<div class="section-content">
<div class="clause-item">用户在使用本平台(以下简称"平台")服务前,请务必仔细阅读并同意本协议。</div>
<div class="clause-item">注册或使用即视为接受本协议全部条款,包括免责声明及责任限制。</div>
</div>
</div>
<div class="agreement-section">
<div class="section-title">2.服务内容</div>
<div class="section-content">
<div class="clause-item">平台仅为校园用户提供二手电动车交易信息发布、浏览及沟通的中介服务,不参与实际交易(如定价、支付、交付),亦不保证车辆质量、合法性或卖家描述的真实性。</div>
</div>
</div>
<div class="agreement-section">
<div class="section-title">3.用户义务</div>
<div class="section-content">
<div class="clause-item">实名认证:需通过手机号注册,并提供真实学生身份信息(如校园邮箱/学号)。</div>
<div class="clause-item">信息真实性:卖家需如实描述车辆状况(如年限、里程、维修记录),禁止虚假宣传。</div>
<div class="clause-item">合法交易:禁止交易赃车、改装车或不符合校园安全规定的车辆。</div>
</div>
</div>
<div class="agreement-section">
<div class="section-title">4.责任限制与免责</div>
<div class="section-content">
<div class="clause-item">交易风险自担:平台不对车辆质量、权属纠纷或交易损失承担责任,用户需自行验车并签订书面交易协议。</div>
<div class="clause-item">纠纷处理:如发生争议,用户应协商解决或通过法律途径处理,平台无义务参与调解。</div>
<div class="clause-item">服务中断:因技术维护、不可抗力导致的服务暂停,平台不承担赔偿责任。</div>
</div>
</div>
<div class="agreement-section">
<div class="section-title">5.知识产权</div>
<div class="section-content">
<div class="clause-item">平台所有内容(包括Logo、界面设计)版权归开发者所有,未经许可不得复制、商用。</div>
</div>
</div>
<div class="agreement-section">
<div class="section-title">6.协议修改</div>
<div class="section-content">
<div class="clause-item">平台有权修订本协议,修改后将通过公告或站内通知生效,继续使用视为接受新条款。</div>
</div>
</div>
<div class="agreement-section">
<div class="section-title">7.关键免责条款强化建议</div>
<div class="section-content">
<div class="clause-item">平台仅提供信息服务,交易风险由用户自行承担。任何车辆质量问题、权属纠纷或资金损失均与平台无关。</div>
</div>
</div>
`
// 隐私政策内容
const privacyPolicyContent = `
<div class="agreement-section">
<div class="section-title">1.信息收集范围</div>
<div class="section-content">
<div class="clause-item">必要信息:手机号(用于注册、登录、交易沟通)。</div>
<div class="clause-item">可选信息:昵称、头像(用于个性化展示)。</div>
<div class="clause-item">设备信息:IP地址、设备型号(用于反欺诈及安全风控)。</div>
</div>
</div>
<div class="agreement-section">
<div class="section-title">2.信息使用目的</div>
<div class="section-content">
<div class="clause-item">提供交易撮合服务(如向买家展示卖家联系方式)。</div>
<div class="clause-item">发送安全验证短信或重要通知(如交易状态更新)。</div>
<div class="clause-item">防止滥用行为(如虚假账号、诈骗)。</div>
</div>
</div>
<div class="agreement-section">
<div class="section-title">3.信息保护措施</div>
<div class="section-content">
<div class="clause-item">加密存储:手机号等敏感信息经加密后存储,访问权限严格限制。</div>
<div class="clause-item">最小必要原则:不收集与交易无关的信息(如通讯录、位置)。</div>
<div class="clause-item">第三方共享:未经用户同意,不向第三方出售或共享数据,除非法律要求。</div>
</div>
</div>
<div class="agreement-section">
<div class="section-title">4.用户权利</div>
<div class="section-content">
<div class="clause-item">查询/删除信息:通过"账号设置"导出或删除个人信息。</div>
<div class="clause-item">撤回授权:停止使用后,可联系客服注销账号并清除数据。</div>
</div>
</div>
<div class="agreement-section">
<div class="section-title">5.免责例外</div>
<div class="section-content">
<div class="clause-item">因用户自行公开联系方式导致的骚扰或诈骗,平台不承担责任。</div>
<div class="clause-item">因黑客攻击等不可抗力导致数据泄露,平台将及时通知但免于赔偿。</div>
</div>
</div>
`
// 显示内容的状态
const showContentModal = ref(false)
const contentTitle = ref('')
const contentText = ref('')
/**
* 点击用户服务协议
*/
const onUserAgreementClick = () => {
contentTitle.value = '用户服务协议'
contentText.value = userAgreementContent
showContentModal.value = true
}
/**
* 点击隐私政策
*/
const onPrivacyPolicyClick = () => {
contentTitle.value = '隐私政策'
contentText.value = privacyPolicyContent
showContentModal.value = true
}
/**
* 关闭内容弹框
*/
const onCloseContentModal = () => {
showContentModal.value = false
contentTitle.value = ''
contentText.value = ''
}
/**
* 取消操作
*/
const onCancel = () => {
agreed.value = false
emit('update:visible', false)
emit('cancel')
}
/**
* 确认操作
*/
const onConfirm = () => {
if (!agreed.value) {
Taro.showToast({
title: '请先同意协议',
icon: 'none'
})
return
}
emit('update:visible', false)
emit('confirm')
}
</script>
<style lang="less">
.privacy-modal {
// width: 680rpx;
}
.privacy-content {
padding: 40rpx 32rpx;
background: white;
border-radius: 16rpx;
}
.privacy-header {
text-align: center;
margin-bottom: 32rpx;
}
.privacy-title {
font-size: 36rpx;
font-weight: bold;
color: #333;
}
.privacy-body {
margin-bottom: 32rpx;
}
.privacy-text {
font-size: 28rpx;
line-height: 1.6;
color: #666;
}
.privacy-link {
color: #fb923c;
text-decoration: underline;
font-weight: 500;
}
.privacy-agreement {
margin-bottom: 32rpx;
padding: 16rpx 0;
}
.agreement-checkbox {
display: flex;
align-items: center;
}
.agreement-text {
font-size: 28rpx;
color: #666;
margin-left: 16rpx;
}
.privacy-actions {
display: flex;
gap: 24rpx;
}
.action-btn {
flex: 1;
height: 88rpx;
border-radius: 44rpx;
font-size: 32rpx;
}
.cancel-btn {
background: #f5f5f5;
color: #666;
border: none;
}
.confirm-btn {
background: #fb923c;
border: none;
}
.confirm-btn:disabled {
background: #ccc;
color: #999;
}
/* 内容弹框样式 */
.content-modal {
width: 100vw;
height: 100vh;
}
.content-container {
width: 100%;
height: 100vh;
background: white;
display: flex;
flex-direction: column;
}
.content-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 32rpx 40rpx;
border-bottom: 1rpx solid #eee;
background: white;
position: sticky;
top: 0;
z-index: 10;
}
.content-title {
font-size: 36rpx;
font-weight: bold;
color: #333;
}
.close-btn {
width: 60rpx;
height: 60rpx;
display: flex;
align-items: center;
justify-content: center;
background: #f5f5f5;
border-radius: 50%;
cursor: pointer;
}
.close-text {
font-size: 40rpx;
color: #666;
line-height: 1;
}
.content-scroll {
flex: 1;
height: 0;
}
.content-body {
padding: 40rpx;
}
// .content-text {
// font-size: 28rpx;
// line-height: 1.8;
// color: #333;
// white-space: pre-line;
// word-wrap: break-word;
// }
// 协议内容样式
.agreement-title {
font-size: 36rpx;
font-weight: bold;
color: #333;
text-align: center;
margin-bottom: 40rpx;
padding-bottom: 20rpx;
border-bottom: 2rpx solid #e5e5e5;
}
.agreement-section {
margin-bottom: 30rpx;
}
.section-title {
font-size: 32rpx;
font-weight: bold;
color: #333;
margin-bottom: 20rpx;
padding-left: 10rpx;
border-left: 6rpx solid #007aff;
}
.section-content {
padding-left: 20rpx;
}
.clause-item {
font-size: 28rpx;
color: #666;
line-height: 1.6;
margin-bottom: 15rpx;
}
.clause-list {
margin: 15rpx 0;
padding-left: 20rpx;
}
.list-item {
font-size: 26rpx;
color: #666;
line-height: 1.5;
margin-bottom: 10rpx;
padding-left: 20rpx;
position: relative;
}
.list-item::before {
content: '•';
position: absolute;
left: 0;
color: #007aff;
font-weight: bold;
}
.list-item1 {
font-size: 26rpx;
color: #666;
line-height: 1.5;
margin-bottom: 10rpx;
padding-left: 20rpx;
position: relative;
}
.list-item1::before {
content: '•';
position: absolute;
left: 0;
color: #007aff;
font-weight: bold;
}
.agreement-footer {
font-size: 28rpx;
color: #999;
text-align: center;
margin-top: 40rpx;
padding-top: 20rpx;
border-top: 2rpx solid #e5e5e5;
font-style: italic;
}
</style>