diff --git a/package.json b/package.json
index 5f4ccb647..cc7c0c5f1 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "sub-store-front-end",
- "version": "2.14.85",
+ "version": "2.14.87",
"private": true,
"scripts": {
"dev": "vite --host",
diff --git a/src/store/settings.ts b/src/store/settings.ts
index 1f4081f47..a2aef1c11 100644
--- a/src/store/settings.ts
+++ b/src/store/settings.ts
@@ -12,6 +12,7 @@ const { t } = i18n.global;
export const useSettingsStore = defineStore('settingsStore', {
state: (): SettingsStoreState => {
return {
+ syncPlatform: '',
gistToken: '',
githubUser: '',
defaultUserAgent: '',
@@ -36,6 +37,7 @@ export const useSettingsStore = defineStore('settingsStore', {
const { showNotify } = useAppNotifyStore();
const res = await settingsApi.getSettings();
if (res?.data?.status === 'success' && res?.data?.data) {
+ this.syncPlatform = res.data.data.syncPlatform || '';
this.gistToken = res.data.data.gistToken || '';
this.githubUser = res.data.data.githubUser || '';
this.defaultUserAgent = res.data.data.defaultUserAgent || '';
@@ -71,6 +73,7 @@ export const useSettingsStore = defineStore('settingsStore', {
const { showNotify } = useAppNotifyStore();
const res = await settingsApi.setSettings(data);
if (res?.data?.status === 'success' && res?.data?.data) {
+ this.syncPlatform = res.data.data.syncPlatform || '';
this.gistToken = res.data.data.gistToken || '';
this.githubUser = res.data.data.githubUser || '';
this.defaultUserAgent = res.data.data.defaultUserAgent || '';
diff --git a/src/types/store/settings.d.ts b/src/types/store/settings.d.ts
index e5d283cde..3965935c3 100644
--- a/src/types/store/settings.d.ts
+++ b/src/types/store/settings.d.ts
@@ -9,6 +9,7 @@ interface SettingsBase {
}
interface SettingsPostData {
+ syncPlatform?: string;
gistToken?: string;
githubUser?: string;
defaultUserAgent?: string;
diff --git a/src/views/My.vue b/src/views/My.vue
index 49dab47d5..da9f2037b 100644
--- a/src/views/My.vue
+++ b/src/views/My.vue
@@ -153,7 +153,11 @@
type="text"
input-align="left"
:left-icon="iconUser"
- />
+ >
+
+ {{ syncPlatformInput === 'gitlab' ? ( isEditing ?'切换回 Gist' : 'GitLab Snippet (β)') : ( isEditing ?'切换到 GitLab Snippet (β)' : 'Gist') }}
+
+
{
@@ -278,7 +282,9 @@ const onClickAbout = () => {
router.push(`/aboutUs`);
};
+
// 编辑 更新
+const syncPlatformInput = ref("");
const userInput = ref("");
const tokenInput = ref("");
const uaInput = ref("");
@@ -293,6 +299,7 @@ const toggleEditMode = async () => {
isEditLoading.value = true;
if (isEditing.value) {
await settingsStore.editSettings({
+ syncPlatform: syncPlatformInput.value,
githubUser: userInput.value,
gistToken: tokenInput.value,
defaultUserAgent: uaInput.value,
@@ -300,6 +307,7 @@ const toggleEditMode = async () => {
});
setDisplayInfo();
} else {
+ syncPlatformInput.value = syncPlatform.value;
userInput.value = githubUser.value;
tokenInput.value = gistToken.value;
uaInput.value = defaultUserAgent.value;
@@ -314,8 +322,34 @@ const exitEditMode = () => {
isEditing.value = false;
isEditLoading.value = false;
};
+const toggleSyncPlatform = () => {
+ if (syncPlatformInput.value === 'gitlab') {
+ syncPlatformInput.value = ''
+ Toast.text(`已切换到 ${syncPlatformInput.value === 'gitlab' ? 'GitLab Snippet' : 'Gist'}`);
+ } else {
+ Dialog({
+ title: '切换同步平台',
+ content: 'GitLab Snippet 正在测试中, 相关文案仍然是 Gist, 请备份数据后使用',
+ popClass: 'auto-dialog',
+ okText: `使用 ${syncPlatformInput.value === 'gitlab' ? 'Gist' : ' Snippet'}`,
+ cancelText: '取消',
+ onOk: () => {
+ if (syncPlatformInput.value === 'gitlab') {
+ syncPlatformInput.value = ''
+ } else {
+ syncPlatformInput.value = 'gitlab'
+ }
+ Toast.text(`已切换到 ${syncPlatformInput.value === 'gitlab' ? 'GitLab Snippet' : 'Gist'}`);
+ },
+ closeOnPopstate: true,
+ lockScroll: false,
+ });
+ }
+
+};
const setDisplayInfo = () => {
+ syncPlatformInput.value = syncPlatform.value || '';
userInput.value = githubUser.value || t(`myPage.placeholder.noGithubUser`);
tokenInput.value = gistToken.value
? gistToken.value.slice(0, 6) + "************"
diff --git a/src/views/Sync.vue b/src/views/Sync.vue
index 1d57c6682..6c8ac63d0 100644
--- a/src/views/Sync.vue
+++ b/src/views/Sync.vue
@@ -50,6 +50,7 @@
/>