Forráskód Böngészése

优化:增加用户隐私确认,优化优惠券分享布局

haiyang 1 hete
szülő
commit
0073a4f4ba

+ 13 - 4
src/pages-A/sharePage/index.vue

@@ -454,7 +454,7 @@ function drawCouponDescription(ctx, width, height, scale) {
     ctx.textAlign = 'center'
 
     // 文本自动换行辅助函数
-    const drawWrappedText = (text, fontSize, yPosition, color) => {
+    const drawWrappedText = (text, fontSize, yPosition, color, maxLines = 2) => {
         ctx.font = `${fontSize * scale}px sans-serif`
         ctx.fillStyle = color
         ctx.textAlign = 'center'
@@ -463,6 +463,7 @@ function drawCouponDescription(ctx, width, height, scale) {
         const lineHeight = fontSize * 1.5 * scale
         let currentY = yPosition
         let currentLine = ''
+        let lineCount = 0
 
         for (let char of text) {
             const testLine = currentLine + char
@@ -472,13 +473,21 @@ function drawCouponDescription(ctx, width, height, scale) {
                 ctx.fillText(currentLine, width / 2, currentY)
                 currentLine = char
                 currentY += lineHeight
+                lineCount++
+
+                // 超过最大行数则停止
+                if (lineCount >= maxLines) {
+                    // 最后一行添加省略号
+                    currentLine = `${currentLine}...`
+                    break
+                }
             }
             else {
                 currentLine = testLine
             }
         }
 
-        if (currentLine) {
+        if (currentLine && lineCount < maxLines) {
             ctx.fillText(currentLine, width / 2, currentY)
         }
 
@@ -516,7 +525,7 @@ function drawCouponDescription(ctx, width, height, scale) {
     // ctx.textAlign = 'center'
 
     // 有效期
-    let currentY = 350 * scale
+    let currentY = nextLineY - lineHeight + 40 * scale
     const validityType = couponDetail.value.validityType
     let validityText = ''
 
@@ -722,7 +731,7 @@ async function drawQRCodeArea(ctx, canvas, qrCodeImg, width, height, scale) {
 
     // 4. 优化二维码提示文字:使用更现代的字体和颜色
     ctx.fillStyle = '#424242'
-    ctx.font = `${22 * scale}px -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif`
+    ctx.font = `${20 * scale}px -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif`
     ctx.textAlign = 'center'
     ctx.textBaseline = 'middle'
     ctx.fillText('长按识别小程序码', width / 2, qrY + qrSize + 31 * scale)

+ 172 - 0
src/pages-fg/agreement/privacyPolicy.vue

@@ -0,0 +1,172 @@
+<script lang="ts" setup>
+import CustomNavigationBar from '@/components/CustomNavigationBar.vue'
+
+definePage({
+    style: {
+        navigationBarTitleText: '隐私政策',
+        navigationStyle: 'custom',
+    },
+})
+</script>
+
+<template>
+    <view class="agreement-container">
+        <CustomNavigationBar :is-shadow="false" title="隐私政策" background-color="#f7f7f7" />
+        <scroll-view class="content" scroll-y>
+            <view class="agreement-content">
+                <h1 class="title">
+                    隐私政策
+                </h1>
+                <p class="update-time">
+                    更新日期:2024年1月1日
+                </p>
+
+                <h2 class="section-title">
+                    一、隐私政策的接受
+                </h2>
+                <p class="paragraph">
+                    欢迎使用我们的优惠券管理系统。本隐私政策说明了我们如何收集、使用、存储和保护您的个人信息。
+                </p>
+
+                <h2 class="section-title">
+                    二、信息收集
+                </h2>
+                <p class="paragraph">
+                    1. 我们收集的信息类型:
+                </p>
+                <ul class="list">
+                    <li><strong>基本信息</strong>:包括但不限于昵称、头像等您主动提供的信息</li>
+                    <li><strong>设备信息</strong>:设备型号、操作系统版本、唯一设备标识符等</li>
+                    <li><strong>登录信息</strong>:微信OpenID等用于登录验证的信息</li>
+                    <li><strong>使用信息</strong>:您使用系统的行为数据,如浏览记录、操作记录等</li>
+                </ul>
+
+                <h2 class="section-title">
+                    三、信息使用
+                </h2>
+                <p class="paragraph">
+                    我们收集的信息将用于以下目的:
+                </p>
+                <ul class="list">
+                    <li>提供和维护服务:如登录验证、账户管理等</li>
+                    <li>优化用户体验:根据您的使用习惯提供个性化服务</li>
+                    <li>安全保障:保护系统安全,防止欺诈行为</li>
+                    <li>合规要求:根据法律法规要求提供必要信息</li>
+                </ul>
+
+                <h2 class="section-title">
+                    四、信息共享
+                </h2>
+                <p class="paragraph">
+                    我们不会向第三方出售或出租您的个人信息,但以下情况除外:
+                </p>
+                <ul class="list">
+                    <li>获得您的明确授权</li>
+                    <li>根据法律法规要求</li>
+                    <li>保护我们的合法权益</li>
+                    <li>与受信任的服务提供商共享(这些提供商必须遵守我们的隐私保护要求)</li>
+                </ul>
+
+                <h2 class="section-title">
+                    五、信息安全
+                </h2>
+                <p class="paragraph">
+                    我们采取多种安全措施保护您的个人信息,包括:
+                </p>
+                <ul class="list">
+                    <li>数据加密存储</li>
+                    <li>访问权限控制</li>
+                    <li>定期安全审计</li>
+                </ul>
+
+                <h2 class="section-title">
+                    六、用户权利
+                </h2>
+                <p class="paragraph">
+                    您有权:
+                </p>
+                <ul class="list">
+                    <li>访问和修改您的个人信息</li>
+                    <li>要求删除您的个人信息</li>
+                    <li>限制或拒绝信息处理</li>
+                    <li>撤回授权同意</li>
+                </ul>
+
+                <h2 class="section-title">
+                    七、隐私政策的更新
+                </h2>
+                <p class="paragraph">
+                    我们有权随时更新本隐私政策。更新后的政策将在系统内公告后生效,您继续使用系统将被视为接受更新后的政策。
+                </p>
+
+                <h2 class="section-title">
+                    八、联系我们
+                </h2>
+                <p class="paragraph">
+                    如有任何关于本隐私政策的问题,请通过以下方式联系我们:
+                </p>
+                <p class="paragraph">
+                    客服邮箱:support@example.com
+                </p>
+            </view>
+        </scroll-view>
+    </view>
+</template>
+
+<style lang="scss" scoped>
+.agreement-container {
+    min-height: 100vh;
+    background-color: #f7f7f7;
+}
+
+.content {
+    padding: 20rpx;
+    min-height: calc(100vh - 44px);
+}
+
+.agreement-content {
+    background-color: #fff;
+    padding: 30rpx;
+    border-radius: 10rpx;
+    box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
+}
+
+.title {
+    font-size: 36rpx;
+    font-weight: bold;
+    text-align: center;
+    margin-bottom: 20rpx;
+}
+
+.update-time {
+    font-size: 24rpx;
+    color: #999;
+    text-align: center;
+    margin-bottom: 40rpx;
+}
+
+.section-title {
+    font-size: 30rpx;
+    font-weight: bold;
+    margin: 30rpx 0 15rpx;
+}
+
+.paragraph {
+    font-size: 28rpx;
+    line-height: 44rpx;
+    margin-bottom: 20rpx;
+    text-indent: 56rpx;
+}
+
+.list {
+    margin-bottom: 20rpx;
+    padding-left: 84rpx;
+}
+
+.list li {
+    font-size: 28rpx;
+    line-height: 44rpx;
+    margin-bottom: 10rpx;
+    list-style-type: disc;
+}
+</style>

+ 156 - 0
src/pages-fg/agreement/userServiceAgreement.vue

@@ -0,0 +1,156 @@
+<script lang="ts" setup>
+import CustomNavigationBar from '@/components/CustomNavigationBar.vue'
+
+definePage({
+    style: {
+        navigationBarTitleText: '用户服务协议',
+        navigationStyle: 'custom',
+    },
+})
+</script>
+
+<template>
+    <view class="agreement-container">
+        <CustomNavigationBar :is-shadow="false" title="用户服务协议" background-color="#f7f7f7" />
+        <scroll-view class="content" scroll-y>
+            <view class="agreement-content">
+                <h1 class="title">
+                    用户服务协议
+                </h1>
+                <p class="update-time">
+                    更新日期:2026年1月1日
+                </p>
+
+                <h2 class="section-title">
+                    一、协议的接受与修改
+                </h2>
+                <p class="paragraph">
+                    欢迎使用我们的优惠券管理系统。本协议是您与我们之间关于使用本系统的法律协议。
+                </p>
+                <p class="paragraph">
+                    我们有权随时修改本协议的条款。修改后的协议将在系统内公告后生效,您继续使用系统将被视为接受修改后的协议。
+                </p>
+
+                <h2 class="section-title">
+                    二、用户信息收集与使用
+                </h2>
+                <p class="paragraph">
+                    1. 我们收集以下用户信息:
+                </p>
+                <ul class="list">
+                    <li>基本信息:包括但不限于昵称、头像等</li>
+                    <li>设备信息:设备型号、操作系统版本等</li>
+                    <li>登录信息:微信OpenID等</li>
+                </ul>
+                <p class="paragraph">
+                    2. 信息使用目的:
+                </p>
+                <ul class="list">
+                    <li>提供和优化服务:如登录验证、个性化推荐等</li>
+                    <li>合规要求:根据法律法规要求提供必要信息</li>
+                </ul>
+
+                <h2 class="section-title">
+                    三、用户权利与义务
+                </h2>
+                <p class="paragraph">
+                    1. 用户权利:
+                </p>
+                <ul class="list">
+                    <li>有权访问和修改个人信息</li>
+                    <li>有权随时注销账户</li>
+                </ul>
+                <p class="paragraph">
+                    2. 用户义务:
+                </p>
+                <ul class="list">
+                    <li>遵守法律法规和本协议</li>
+                    <li>不得利用系统进行非法活动</li>
+                </ul>
+
+                <h2 class="section-title">
+                    四、隐私保护
+                </h2>
+                <p class="paragraph">
+                    我们严格保护用户隐私,不会泄露用户信息给第三方,除非:
+                </p>
+                <ul class="list">
+                    <li>获得用户明确授权</li>
+                    <li>根据法律法规要求</li>
+                </ul>
+
+                <h2 class="section-title">
+                    五、终止服务
+                </h2>
+                <p class="paragraph">
+                    如用户违反本协议,我们有权终止提供服务。
+                </p>
+
+                <h2 class="section-title">
+                    六、法律适用与争议解决
+                </h2>
+                <p class="paragraph">
+                    本协议适用中华人民共和国法律,如有争议,双方应友好协商解决。
+                </p>
+            </view>
+        </scroll-view>
+    </view>
+</template>
+
+<style lang="scss" scoped>
+.agreement-container {
+    min-height: 100vh;
+    background-color: #f7f7f7;
+}
+
+.content {
+    padding: 20rpx;
+    min-height: calc(100vh - 44px);
+}
+
+.agreement-content {
+    background-color: #fff;
+    padding: 30rpx;
+    border-radius: 10rpx;
+    box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
+}
+
+.title {
+    font-size: 36rpx;
+    font-weight: bold;
+    text-align: center;
+    margin-bottom: 20rpx;
+}
+
+.update-time {
+    font-size: 24rpx;
+    color: #999;
+    text-align: center;
+    margin-bottom: 40rpx;
+}
+
+.section-title {
+    font-size: 30rpx;
+    font-weight: bold;
+    margin: 30rpx 0 15rpx;
+}
+
+.paragraph {
+    font-size: 28rpx;
+    line-height: 44rpx;
+    margin-bottom: 20rpx;
+    text-indent: 56rpx;
+}
+
+.list {
+    margin-bottom: 20rpx;
+    padding-left: 84rpx;
+}
+
+.list li {
+    font-size: 28rpx;
+    line-height: 44rpx;
+    margin-bottom: 10rpx;
+    list-style-type: disc;
+}
+</style>

+ 49 - 0
src/pages-fg/login/login.vue

@@ -15,6 +15,21 @@ definePage({
 })
 
 const tokenStore = useTokenStore()
+const agreeToTerms = ref(false)
+
+// 跳转至用户服务协议
+function goToUserServiceAgreement() {
+    uni.navigateTo({
+        url: '/pages-fg/agreement/userServiceAgreement',
+    })
+}
+
+// 跳转至隐私政策
+function goToPrivacyPolicy() {
+    uni.navigateTo({
+        url: '/pages-fg/agreement/privacyPolicy',
+    })
+}
 
 async function doLogin() {
     if (tokenStore.hasLogin) {
@@ -22,6 +37,15 @@ async function doLogin() {
         return
     }
 
+    // 检查是否同意协议
+    if (!agreeToTerms.value) {
+        uni.showToast({
+            title: '请先阅读并同意用户服务协议和隐私政策',
+            icon: 'none',
+        })
+        return
+    }
+
     try {
         uni.showLoading({
             title: '登录中...',
@@ -78,6 +102,19 @@ async function doLogin() {
                 <text class="btn-text">微信快捷登录</text>
             </button>
         </view>
+
+        <!-- 协议同意区域 -->
+        <view class="agreement-section">
+            <view class="agreement-text">
+                <view class="checkbox-container">
+                    <checkbox :checked="agreeToTerms" @tap="agreeToTerms = !agreeToTerms" />
+                    <text>我已阅读并同意</text>
+                    <text class="link" @click="goToUserServiceAgreement">《用户服务协议》</text>
+                    <text>和</text>
+                    <text class="link" @click="goToPrivacyPolicy">《隐私政策》</text>
+                </view>
+            </view>
+        </view>
     </view>
 </template>
 
@@ -133,6 +170,18 @@ async function doLogin() {
         font-size: 12px;
         color: #999;
 
+        .checkbox-container {
+            display: flex;
+            align-items: center;
+            justify-content: center;
+            flex-wrap: wrap;
+        }
+
+        checkbox {
+            margin-right: 5px;
+            transform: scale(0.8);
+        }
+
         .link {
             color: #07c160;
             text-decoration: underline;

+ 2 - 0
src/router/config.ts

@@ -24,6 +24,8 @@ export const EXCLUDE_LOGIN_PATH_LIST = [
     LOGIN_PAGE,
     HOME_PAGE,
     '/pages/receiveCoupon/index',
+    '/pages-fg/agreement/userServiceAgreement',
+    '/pages-fg/agreement/privacyPolicy',
     ...excludeLoginPathList, // 都是以 / 开头的 path
 ]