Skip to content

Commit

Permalink
feat: 新增简洁模式备注展示开关,预备分享管理API
Browse files Browse the repository at this point in the history
  • Loading branch information
hsingyin committed Nov 4, 2024
1 parent 56eda1f commit 038ec62
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sub-store-front-end",
"version": "2.14.285",
"version": "2.14.286",
"private": true,
"scripts": {
"dev": "vite --host",
Expand Down
15 changes: 14 additions & 1 deletion src/api/subs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,25 @@ export function useSubsApi() {
data,
});
},
shareSub: (data: ShareToken): AxiosPromise<MyAxiosRes> => {
shareCreate: (data: ShareToken): AxiosPromise<MyAxiosRes> => {
return request({
url: `/api/token`,
method: 'post',
data,
});
},
shareDelete: (token: string): AxiosPromise<MyAxiosRes> => {
return request({
url: `/api/token/${encodeURIComponent(token)}`,
method: 'delete',
});
},
shareQuery: (type: string, name: string): AxiosPromise<MyAxiosRes> => {
return request({
url: `/api/tokens`,
method: 'get',
params: { type, name },
});
},
};
}
6 changes: 6 additions & 0 deletions src/components/FileListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@
</span>
</template>
</p>
<p
v-if="remark && appearanceSetting.isSimpleShowRemark"
class="sub-item-remark"
>
<span>{{ remarkText }}</span>
</p>
</template>
</div>
</div>
Expand Down
6 changes: 6 additions & 0 deletions src/components/SubListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@
<p v-else-if="type === 'collection'" class="sub-item-detail-isSimple">
{{ collectionDetail }}
</p>
<p
v-if="remark && appearanceSetting.isSimpleShowRemark"
class="sub-item-remark"
>
<span>{{ remarkText }}</span>
</p>
</template>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,7 @@ export default {
isShowIcon: 'Show icon',
isEditorCommon: "Show editor common settings",
isSimpleReicon: "Show items refresh button",
isSimpleShowRemarks: "Simple Mode Show items remarks",
showFloatingRefreshButton: "Show floating refresh button",
tabBar: 'Hide "Sync" Page',
tabBar2: 'Hide "File" Page',
Expand Down
1 change: 1 addition & 0 deletions src/locales/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,7 @@ export default {
isShowIcon: '展示图标',
isEditorCommon: '展示编辑页常用配置',
isSimpleReicon: '简洁模式展示订阅刷新按钮',
isSimpleShowRemarks: '简洁模式列表展示备注',
showFloatingRefreshButton: '显示悬浮刷新按钮',
tabBar: '隐藏 "Gist 同步" 页',
tabBar2: '隐藏 "文件" 页',
Expand Down
2 changes: 2 additions & 0 deletions src/store/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const useSettingsStore = defineStore("settingsStore", {
isDefaultIcon: false,
isIconColor: false,
isShowIcon: true,
isSimpleShowRemark: false,
isEditorCommon: true,
isSimpleReicon: false,
showFloatingRefreshButton: false,
Expand Down Expand Up @@ -74,6 +75,7 @@ export const useSettingsStore = defineStore("settingsStore", {
this.appearanceSetting.isDefaultIcon = res.data.data.appearanceSetting?.isDefaultIcon ?? "";
this.appearanceSetting.isIconColor = res.data.data.appearanceSetting?.isIconColor ?? "";
this.appearanceSetting.isShowIcon = res.data.data.appearanceSetting?.isShowIcon ?? true;
this.appearanceSetting.isSimpleShowRemark = res.data.data.appearanceSetting?.isSimpleShowRemark ?? "";
this.appearanceSetting.isEditorCommon = res.data.data.appearanceSetting?.isEditorCommon ?? true;
this.appearanceSetting.isSimpleReicon = res.data.data.appearanceSetting?.isSimpleReicon ?? "";
this.appearanceSetting.showFloatingRefreshButton = res.data.data.appearanceSetting?.showFloatingRefreshButton ?? "";
Expand Down
1 change: 1 addition & 0 deletions src/types/store/settings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ interface SettingsPostData {
isIconColor?: boolean; // 自定义图标使用原始颜色
isEditorCommon?: boolean; // 展示编辑页常用配置
isSimpleReicon?: boolean; // 展示订阅刷新按钮
isSimpleShowRemark?: boolean; // 展示简洁模式下的备注
showFloatingRefreshButton?: boolean; // 显示悬浮刷新按钮
istabBar?: boolean; // 隐藏 "Gist 同步" 页
istabBar2?: boolean; // 隐藏 "文件" 页
Expand Down
24 changes: 24 additions & 0 deletions src/views/settings/moreSetting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,19 @@
/>
</template>
</nut-cell>
<nut-cell
:title="$t(`moreSettingPage.isSimpleShowRemarks`)"
class="cell-item"
>
<template v-slot:link>
<nut-switch
class="my-switch"
v-model="awSimpleShowRemark"
size="mini"
@change="setSimpleShowRemark"
/>
</template>
</nut-cell>
<nut-cell :title="$t(`moreSettingPage.showFloatingRefreshButton`)" class="cell-item">
<template v-slot:link>
<nut-switch
Expand Down Expand Up @@ -244,6 +257,7 @@
const awIsShowIcon = ref(true);
const awEditorCommon = ref(false);
const awSimpleReicon = ref(true);
const awSimpleShowRemark = ref(false);
const awShowFloatingRefreshButton = ref(false);
const awtabBar = ref(true);
const awtabBar2 = ref(true);
Expand Down Expand Up @@ -330,6 +344,15 @@
changeAppearanceSetting({ appearanceSetting: data });
};
const setSimpleShowRemark = (isSimpleShowRemark: boolean) => {
// globalStore.setSimpleReicon(isSimpleReicon);
const data = {
...appearanceSetting.value,
isSimpleShowRemark: isSimpleShowRemark
}
changeAppearanceSetting({ appearanceSetting: data });
};
const setShowFloatingRefreshButton = (showFloatingRefreshButton: boolean) => {
// globalStore.setShowFloatingRefreshButton(showFloatingRefreshButton);
const data = {
Expand Down Expand Up @@ -537,6 +560,7 @@
awIsShowIcon.value = appearanceSetting.value.isShowIcon;
awEditorCommon.value = appearanceSetting.value.isEditorCommon;
awSimpleReicon.value = appearanceSetting.value.isSimpleReicon;
awSimpleShowRemark.value = appearanceSetting.value.isSimpleShowRemark;
awShowFloatingRefreshButton.value = appearanceSetting.value.showFloatingRefreshButton;
awtabBar.value = appearanceSetting.value.istabBar;
awtabBar2.value = appearanceSetting.value.istabBar2;
Expand Down
2 changes: 1 addition & 1 deletion src/views/share/SharePopup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ const handleCreateShare = async () => {
if (form.token) {
params.payload.token = form.token;
}
const res = await subsApi.shareSub(params);
const res = await subsApi.shareCreate(params);
if (res?.data?.status === "success") {
isCreateShareLinkSuccess.value = true;
const { secret, token } = res.data.data;
Expand Down

0 comments on commit 038ec62

Please sign in to comment.