Skip to content

Commit f8d4e74

Browse files
committed
✨ feat: 更新用户协议
1 parent 41ece1d commit f8d4e74

4 files changed

Lines changed: 45 additions & 12 deletions

File tree

src/components/Modal/UserAgreement.vue

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
<!-- 用户协议 -->
22
<template>
33
<div class="user-agreement">
4-
<n-h1 class="title">用户协议</n-h1>
4+
<n-h1 class="title">软件许可使用协议</n-h1>
55
<n-scrollbar class="scrollbar">
66
<n-flex class="date" justify="center">
77
<n-tag round>生效日期:2024 年 7 月 16 日</n-tag>
8-
<n-tag type="warning" round>更新日期:2024 年 9 月 28 日</n-tag>
8+
<n-tag type="warning" round>更新日期:2025 年 12 月 10 日</n-tag>
9+
<n-tag type="info" round>协议版本:v2.0</n-tag>
910
</n-flex>
11+
<n-alert type="warning" title="重要声明">
12+
SPlayer 是一款完全免费且开源的音乐播放软件,遵循 AGPL-3.0 开源协议发布。
13+
本软件永远不会向用户收取任何费用。如果您是从第三方渠道付费购买本软件,
14+
您可能遇到了诈骗,请立即停止使用并举报。
15+
</n-alert>
1016
<n-p>
11-
欢迎使用 SPlayer(以下简称本软件)。本软件是一个本地音乐播放软件,可能会调用第三方 API
12-
来增强其功能。请在使用本软件前仔细阅读本用户协议。本协议是您(以下简称“用户”)与 SPlayer
13-
开发团队(以下简称开发者)之间的法律协议。一旦您下载、安装或使用本软件,即表示您同意接受本协议的所有条款和条件。
17+
欢迎使用 SPlayer(以下简称"本软件")。本软件是一个本地音乐播放软件,可能会调用第三方 API
18+
来增强其功能。请在使用本软件前仔细阅读本用户协议。本协议是您(以下简称"用户")与 SPlayer
19+
开发团队(以下简称"开发者")之间的法律协议。一旦您下载、安装或使用本软件,即表示您同意接受本协议的所有条款和条件。
1420
</n-p>
1521
<n-h3 prefix="bar"> 软件使用 </n-h3>
1622
<n-ol>
@@ -99,6 +105,9 @@
99105
<n-li>
100106
如果本协议的任何条款被视为无效或不可执行,该条款将被修改以反映双方的意图,其余条款仍然完全有效。
101107
</n-li>
108+
<n-li>
109+
本协议的所有标题仅仅是为了醒目及阅读方便,本身并没有实际涵义,不能作为解释本协议涵义的依据。
110+
</n-li>
102111
<n-li>
103112
本协议构成您与开发者之间关于使用本软件的完整协议,并取代之前的所有口头或书面协议和陈述。
104113
</n-li>
@@ -109,7 +118,7 @@
109118
</n-scrollbar>
110119
<n-flex justify="center">
111120
<n-button v-if="isElectron" type="error" @click="closeApp">不同意</n-button>
112-
<n-button type="success" @click="emit('close')" :disabled="!isReadOver">
121+
<n-button type="success" @click="agreeToAgreement" :disabled="!isReadOver">
113122
{{ isReadOver ? "同意并使用" : "请先完整阅读" }}
114123
</n-button>
115124
</n-flex>
@@ -118,16 +127,28 @@
118127

119128
<script setup lang="ts">
120129
import { isElectron } from "@/utils/env";
130+
import { useSettingStore } from "@/stores";
131+
import { CURRENT_AGREEMENT_VERSION } from "@/constants/agreement";
121132
122133
const emit = defineEmits<{
123134
close: [];
124135
}>();
125136
137+
const settingStore = useSettingStore();
126138
const readOverRef = ref<HTMLElement | null>(null);
127139
128140
// 是否阅读完毕
129141
const isReadOver = useElementVisibility(readOverRef);
130142
143+
// 同意协议
144+
const agreeToAgreement = () => {
145+
if (!isReadOver.value) return;
146+
// 更新协议版本
147+
settingStore.userAgreementVersion = CURRENT_AGREEMENT_VERSION;
148+
// 关闭弹窗
149+
emit("close");
150+
};
151+
131152
// 关闭软件
132153
const closeApp = () => {
133154
window.electron.ipcRenderer.send("quit-app");
@@ -144,6 +165,9 @@ const closeApp = () => {
144165
padding-right: 12px;
145166
}
146167
}
168+
.n-alert {
169+
margin: 20px 0;
170+
}
147171
.title {
148172
text-align: center;
149173
}

src/constants/agreement.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/**
2+
* 用户协议版本常量
3+
*/
4+
export const CURRENT_AGREEMENT_VERSION = "v2.0";

src/stores/setting.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,8 @@ export interface SettingState {
240240
visible: boolean;
241241
order: number;
242242
}>;
243+
/** 用户协议版本 */
244+
userAgreementVersion: string;
243245
/** 自定义协议注册 **/
244246
registryProtocol: {
245247
orpheus: boolean;
@@ -364,6 +366,7 @@ export const useSettingStore = defineStore("setting", {
364366
{ key: "radio", name: "推荐播客", visible: true, order: 4 },
365367
{ key: "album", name: "新碟上架", visible: true, order: 5 },
366368
],
369+
userAgreementVersion: "",
367370
registryProtocol: {
368371
orpheus: false,
369372
},

src/utils/modal.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { h } from "vue";
22
import type { CoverType, UpdateInfoType, SettingType, SongType } from "@/types/main";
3+
import { CURRENT_AGREEMENT_VERSION } from "@/constants/agreement";
34
import { NScrollbar } from "naive-ui";
45
import { isLogin } from "./auth";
56
import { isArray, isFunction } from "lodash-es";
6-
import { useDataStore } from "@/stores";
7+
import { useDataStore, useSettingStore } from "@/stores";
78
import router from "@/router";
89
import Login from "@/components/Modal/Login/Login.vue";
910
import JumpArtist from "@/components/Modal/JumpArtist.vue";
@@ -27,10 +28,12 @@ import HomePageSectionManager from "@/components/Modal/Setting/HomePageSectionMa
2728
import CopyLyrics from "@/components/Modal/CopyLyrics.vue";
2829
import AMLLServer from "@/components/Modal/Setting/AMLLServer.vue";
2930

30-
// 用户协议
3131
export const openUserAgreement = () => {
32-
const isAgree = window.localStorage.getItem("isAgree");
33-
if (isAgree) return;
32+
const settingStore = useSettingStore();
33+
// 检查是否需要重新同意协议
34+
const needReAgree = settingStore.userAgreementVersion !== CURRENT_AGREEMENT_VERSION;
35+
// 如果已经同意了当前版本,则不需要再弹窗
36+
if (!needReAgree) return;
3437
const modal = window.$modal.create({
3538
preset: "card",
3639
transformOrigin: "center",
@@ -45,8 +48,7 @@ export const openUserAgreement = () => {
4548
return h(UserAgreement, {
4649
onClose: () => {
4750
modal.destroy();
48-
// 储存状态
49-
window.localStorage.setItem("isAgree", Date.now().toString());
51+
// 储存状态(这个逻辑现在在 UserAgreement 组件内部处理)
5052
},
5153
});
5254
},

0 commit comments

Comments
 (0)