diff --git a/package.json b/package.json
index 8f7ffd2..c6e8c13 100644
--- a/package.json
+++ b/package.json
@@ -42,7 +42,7 @@
"keycode": "^2.2.0",
"lodash-id": "^0.14.0",
"lowdb": "^1.0.0",
- "picgo": "^1.4.6",
+ "picgo": "^1.4.7",
"vue": "^2.6.10",
"vue-gallery": "^2.0.1",
"vue-lazyload": "^1.2.6",
diff --git a/src/renderer/pages/picbeds/SMMS.vue b/src/renderer/pages/picbeds/SMMS.vue
index b12c318..72d8693 100644
--- a/src/renderer/pages/picbeds/SMMS.vue
+++ b/src/renderer/pages/picbeds/SMMS.vue
@@ -5,12 +5,27 @@
SM.MS设置
-
- 感谢SM.MS提供的优质服务
-
-
- 设为默认图床
-
+
+
+
+
+
+
+ 确定
+ 设为默认图床
+
+
+
@@ -23,25 +38,58 @@ import mixin from '@/utils/ConfirmButtonMixin'
mixins: [mixin]
})
export default class extends Vue {
- confirm () {
- this.letPicGoSaveData({
- 'picBed.smms': true
- })
- // @ts-ignore 来自mixin
- this.setDefaultPicBed('smms')
- const successNotification = new window.Notification('设置结果', {
- body: '设置成功'
- })
- successNotification.onclick = () => {
- return true
+ form: ISMMSConfig = {
+ token: ''
+ }
+ created () {
+ const config = this.$db.get('picBed.smms.token') as (string | boolean)
+ if (typeof config !== 'boolean') {
+ this.form.token = config
}
}
+ confirm () {
+ // @ts-ignore
+ this.$refs.smms.validate((valid) => {
+ if (valid) {
+ this.letPicGoSaveData({
+ 'picBed.smms': this.form
+ })
+ const successNotification = new window.Notification('设置结果', {
+ body: '设置成功'
+ })
+ successNotification.onclick = () => {
+ return true
+ }
+ } else {
+ return false
+ }
+ })
+ }
}
diff --git a/src/universal/types/types.d.ts b/src/universal/types/types.d.ts
index 3305c10..4ada9cf 100644
--- a/src/universal/types/types.d.ts
+++ b/src/universal/types/types.d.ts
@@ -252,6 +252,10 @@ interface IQiniuConfig {
path: string
}
+interface ISMMSConfig {
+ token: string
+}
+
interface ITcYunConfig {
secretId: string,
secretKey: string,
diff --git a/yarn.lock b/yarn.lock
index 5e43266..a80db22 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -8292,10 +8292,10 @@ performance-now@^2.1.0:
resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=
-picgo@^1.4.6:
- version "1.4.6"
- resolved "https://registry.yarnpkg.com/picgo/-/picgo-1.4.6.tgz#aa90439a253c5a07068b136a0d1426f63236735b"
- integrity sha512-VNh5el0hkh0OrxqTPGkRAUtGmncr7cdKrjdvp6yf2Iwx+O+uJ4IHgKMmzAj+siJGTBENL0eWoujmzX07zAt30g==
+picgo@^1.4.7:
+ version "1.4.7"
+ resolved "https://registry.yarnpkg.com/picgo/-/picgo-1.4.7.tgz#ef9bea9e765ef9d77daa32f8a14c84c345677ece"
+ integrity sha512-r2j/cxfKdeHn/HnN/1XwbSM/xakO8XrAM0todTAbCDd4r+zIwDcl1pms5S+8YVDqQRAd/qNE4t9XESIIjhSVtA==
dependencies:
chalk "^2.4.1"
commander "^2.17.0"