🔨 Refactor: change vue-js -> vue-ts && add typos

This commit is contained in:
Molunerfinn 2019-12-21 17:28:29 +08:00
parent 29a55ed855
commit b8ec879e23
21 changed files with 333 additions and 300 deletions

View File

@ -252,7 +252,7 @@ const createMiniWidow = () => {
if (miniWindow) { if (miniWindow) {
return false return false
} }
let obj: BrowserWindowOptions = { let obj: IBrowserWindowOptions = {
height: 64, height: 64,
width: 64, width: 64,
show: process.platform === 'linux', show: process.platform === 'linux',
@ -284,7 +284,7 @@ const createMiniWidow = () => {
} }
const createSettingWindow = () => { const createSettingWindow = () => {
const options: BrowserWindowOptions = { const options: IBrowserWindowOptions = {
height: 450, height: 450,
width: 800, width: 800,
show: false, show: false,
@ -355,7 +355,7 @@ const createMenu = () => {
} }
} }
const toggleWindow = (bounds: Bounds) => { const toggleWindow = (bounds: IBounds) => {
if (window!.isVisible()) { if (window!.isVisible()) {
window!.hide() window!.hide()
} else { } else {
@ -363,7 +363,7 @@ const toggleWindow = (bounds: Bounds) => {
} }
} }
const showWindow = (bounds: Bounds) => { const showWindow = (bounds: IBounds) => {
window!.setPosition(bounds.x - 98 + 11, bounds.y, false) window!.setPosition(bounds.x - 98 + 11, bounds.y, false)
window!.webContents.send('updateFiles') window!.webContents.send('updateFiles')
window!.show() window!.show()
@ -404,7 +404,7 @@ const uploadClipboardFiles = async () => {
} }
} }
const uploadChoosedFiles = async (webContents: WebContents, files: FileWithPath[]) => { const uploadChoosedFiles = async (webContents: WebContents, files: IFileWithPath[]) => {
const input = files.map(item => item.path) const input = files.map(item => item.path)
const imgs = await new Uploader(input, webContents).upload() const imgs = await new Uploader(input, webContents).upload()
if (imgs !== false) { if (imgs !== false) {
@ -458,11 +458,11 @@ ipcMain.on('uploadClipboardFilesFromUploadPage', () => {
uploadClipboardFiles() uploadClipboardFiles()
}) })
ipcMain.on('uploadChoosedFiles', async (evt: IpcMainEvent, files: FileWithPath[]) => { ipcMain.on('uploadChoosedFiles', async (evt: IpcMainEvent, files: IFileWithPath[]) => {
return uploadChoosedFiles(evt.sender, files) return uploadChoosedFiles(evt.sender, files)
}) })
ipcMain.on('updateShortKey', (evt: IpcMainEvent, item: ShortKeyConfig, oldKey: string) => { ipcMain.on('updateShortKey', (evt: IpcMainEvent, item: IShortKeyConfig, oldKey: string) => {
shortKeyUpdater(globalShortcut, item, oldKey) shortKeyUpdater(globalShortcut, item, oldKey)
const notification = new Notification({ const notification = new Notification({
title: '操作成功', title: '操作成功',

View File

@ -1,6 +1,6 @@
import DB from '#/datastore' import DB from '#/datastore'
// from v2.1.2 // from v2.1.2
const updateShortKeyFromVersion212 = (db: typeof DB, shortKeyConfig: ShortKeyConfigs | OldShortKeyConfigs) => { const updateShortKeyFromVersion212 = (db: typeof DB, shortKeyConfig: IShortKeyConfigs | IOldShortKeyConfigs) => {
let needUpgrade = false let needUpgrade = false
if (shortKeyConfig.upload) { if (shortKeyConfig.upload) {
needUpgrade = true needUpgrade = true

View File

@ -12,13 +12,13 @@ const getPicBeds = (app: App) => {
const picBedTypes = picgo.helper.uploader.getIdList() const picBedTypes = picgo.helper.uploader.getIdList()
const picBedFromDB = db.get('picBed.list') || [] const picBedFromDB = db.get('picBed.list') || []
const picBeds = picBedTypes.map((item: string) => { const picBeds = picBedTypes.map((item: string) => {
const visible = picBedFromDB.find((i: PicBedType) => i.type === item) // object or undefined const visible = picBedFromDB.find((i: IPicBedType) => i.type === item) // object or undefined
return { return {
type: item, type: item,
name: picgo.helper.uploader.get(item).name || item, name: picgo.helper.uploader.get(item).name || item,
visible: visible ? visible.visible : true visible: visible ? visible.visible : true
} }
}) as PicBedType[] }) as IPicBedType[]
picgo.cmd.program.removeAllListeners() picgo.cmd.program.removeAllListeners()
return picBeds return picBeds
} }

View File

@ -24,7 +24,7 @@ const shortKeyHandler = (name: string) => {
/** /**
* *
*/ */
const shortKeyUpdater = (globalShortcut: GlobalShortcut, item: ShortKeyConfig, oldKey: string) => { const shortKeyUpdater = (globalShortcut: GlobalShortcut, item: IShortKeyConfig, oldKey: string) => {
// 如果提供了旧key则解绑 // 如果提供了旧key则解绑
if (oldKey) { if (oldKey) {
globalShortcut.unregister(oldKey) globalShortcut.unregister(oldKey)
@ -39,7 +39,7 @@ const shortKeyUpdater = (globalShortcut: GlobalShortcut, item: ShortKeyConfig, o
} }
// 初始化阶段的注册 // 初始化阶段的注册
const initShortKeyRegister = (globalShortcut: GlobalShortcut, shortKeys: ShortKeyConfig[]) => { const initShortKeyRegister = (globalShortcut: GlobalShortcut, shortKeys: IShortKeyConfig[]) => {
let errorList = [] let errorList = []
for (let i in shortKeys) { for (let i in shortKeys) {
try { try {

View File

@ -36,7 +36,7 @@ const renameURL = process.env.NODE_ENV === 'development'
// } // }
const createRenameWindow = (win: BrowserWindow) => { const createRenameWindow = (win: BrowserWindow) => {
let options: BrowserWindowOptions = { let options: IBrowserWindowOptions = {
height: 175, height: 175,
width: 300, width: 300,
show: true, show: true,

View File

@ -174,7 +174,7 @@ export default class extends Vue {
shortKey: ShortKeyMap = { shortKey: ShortKeyMap = {
upload: db.get('shortKey.upload') upload: db.get('shortKey.upload')
} }
picBed: PicBedType[] = [] picBed: IPicBedType[] = []
// for showInputBox // for showInputBox
showInputBoxVisible = false showInputBoxVisible = false
inputBoxValue = '' inputBoxValue = ''
@ -276,7 +276,7 @@ export default class extends Vue {
openMiniWindow () { openMiniWindow () {
ipcRenderer.send('openMiniWindow') ipcRenderer.send('openMiniWindow')
} }
getPicBeds (event: IpcRendererEvent, picBeds: PicBedType[]) { getPicBeds (event: IpcRendererEvent, picBeds: IPicBedType[]) {
this.picBed = picBeds this.picBed = picBeds
} }
handleInputBoxClose () { handleInputBoxClose () {

View File

@ -143,7 +143,7 @@ export default class extends Vue {
UBB: 'UBB', UBB: 'UBB',
Custom: 'Custom' Custom: 'Custom'
} }
picBed: PicBedType[] = [] picBed: IPicBedType[] = []
beforeRouteEnter (to: any, from: any, next: any) { beforeRouteEnter (to: any, from: any, next: any) {
next((vm: any) => { next((vm: any) => {
vm.getGallery() vm.getGallery()
@ -166,7 +166,7 @@ export default class extends Vue {
set filterList (val) { set filterList (val) {
this.images = val this.images = val
} }
getPicBeds (event: IpcRendererEvent, picBeds: PicBedType[]) { getPicBeds (event: IpcRendererEvent, picBeds: IPicBedType[]) {
this.picBed = picBeds this.picBed = picBeds
} }
getGallery () { getGallery () {

View File

@ -40,7 +40,7 @@ export default class extends Vue {
screenY: number = -1 screenY: number = -1
menu: Electron.Menu | null = null menu: Electron.Menu | null = null
os = '' os = ''
picBed: PicBedType[] = [] picBed: IPicBedType[] = []
created () { created () {
this.os = process.platform this.os = process.platform
ipcRenderer.on('uploadProgress', (event: IpcRendererEvent, progress: number) => { ipcRenderer.on('uploadProgress', (event: IpcRendererEvent, progress: number) => {
@ -90,7 +90,7 @@ export default class extends Vue {
document.getElementById('file-uploader').value = '' document.getElementById('file-uploader').value = ''
} }
ipcSendFiles (files: FileList) { ipcSendFiles (files: FileList) {
let sendFiles: FileWithPath[] = [] let sendFiles: IFileWithPath[] = []
Array.from(files).forEach((item, index) => { Array.from(files).forEach((item, index) => {
let obj = { let obj = {
name: item.name, name: item.name,

View File

@ -283,7 +283,7 @@ export default class extends Vue {
miniWindowOntop: db.get('settings.miniWindowOntop') || false, miniWindowOntop: db.get('settings.miniWindowOntop') || false,
logLevel logLevel
} }
picBed: PicBedType[] = [] picBed: IPicBedType[] = []
logFileVisible = false logFileVisible = false
keyBindingVisible = false keyBindingVisible = false
customLinkVisible = false customLinkVisible = false
@ -325,7 +325,7 @@ export default class extends Vue {
ipcRenderer.send('getPicBeds') ipcRenderer.send('getPicBeds')
ipcRenderer.on('getPicBeds', this.getPicBeds) ipcRenderer.on('getPicBeds', this.getPicBeds)
} }
getPicBeds (event: Event, picBeds: PicBedType[]) { getPicBeds (event: Event, picBeds: IPicBedType[]) {
this.picBed = picBeds this.picBed = picBeds
this.form.showPicBedList = this.picBed.map(item => { this.form.showPicBedList = this.picBed.map(item => {
if (item.visible) { if (item.visible) {

View File

@ -102,13 +102,13 @@ import { ipcRenderer } from 'electron'
name: 'shortcut-page' name: 'shortcut-page'
}) })
export default class extends Vue { export default class extends Vue {
list: ShortKeyConfig[] = [] list: IShortKeyConfig[] = []
keyBindingVisible = false keyBindingVisible = false
shortKeyName = '' shortKeyName = ''
shortKey = '' shortKey = ''
currentIndex = 0 currentIndex = 0
created () { created () {
const shortKeyConfig = this.$db.get('settings.shortKey') as ShortKeyConfigs const shortKeyConfig = this.$db.get('settings.shortKey') as IShortKeyConfigs
this.list = Object.keys(shortKeyConfig).map(item => shortKeyConfig[item]) this.list = Object.keys(shortKeyConfig).map(item => shortKeyConfig[item])
} }
@Watch('keyBindingVisible') @Watch('keyBindingVisible')
@ -119,7 +119,7 @@ export default class extends Vue {
const [origin] = item.split(':') const [origin] = item.split(':')
return origin return origin
} }
toggleEnable (item: ShortKeyConfig) { toggleEnable (item: IShortKeyConfig) {
const status = !item.enable const status = !item.enable
item.enable = status item.enable = status
this.$db.set(`settings.shortKey.${item.name}.enable`, status) this.$db.set(`settings.shortKey.${item.name}.enable`, status)

View File

@ -72,7 +72,7 @@ export default class extends Vue {
showProgress = false showProgress = false
showError = false showError = false
pasteStyle = '' pasteStyle = ''
picBed: PicBedType[] = [] picBed: IPicBedType[] = []
picBedName = '' picBedName = ''
menu: Electron.Menu | null= null menu: Electron.Menu | null= null
mounted () { mounted () {
@ -122,7 +122,7 @@ export default class extends Vue {
(document.getElementById('file-uploader') as HTMLInputElement).value = '' (document.getElementById('file-uploader') as HTMLInputElement).value = ''
} }
ipcSendFiles (files: FileList) { ipcSendFiles (files: FileList) {
let sendFiles: FileWithPath[] = [] let sendFiles: IFileWithPath[] = []
Array.from(files).forEach((item, index) => { Array.from(files).forEach((item, index) => {
let obj = { let obj = {
name: item.name, name: item.name,
@ -149,7 +149,7 @@ export default class extends Vue {
} }
}) })
} }
getPicBeds (event: Event, picBeds: PicBedType[]) { getPicBeds (event: Event, picBeds: IPicBedType[]) {
this.picBed = picBeds this.picBed = picBeds
this.getDefaultPicBed() this.getDefaultPicBed()
} }

View File

@ -64,14 +64,15 @@
</el-row> </el-row>
</div> </div>
</template> </template>
<script> <script lang="ts">
import { Component, Vue } from 'vue-property-decorator'
import mixin from '@/utils/ConfirmButtonMixin' import mixin from '@/utils/ConfirmButtonMixin'
export default { @Component({
mixins: [mixin],
name: 'aliyun', name: 'aliyun',
data () { mixins: [mixin]
return { })
form: { export default class extends Vue {
form: IAliYunConfig = {
accessKeyId: '', accessKeyId: '',
accessKeySecret: '', accessKeySecret: '',
bucket: '', bucket: '',
@ -79,21 +80,17 @@ export default {
path: '', path: '',
customUrl: '' customUrl: ''
} }
}
},
created () { created () {
const config = this.$db.get('picBed.aliyun') const config = this.$db.get('picBed.aliyun') as IAliYunConfig
if (config) { if (config) {
for (let i in config) { this.form = Object.assign({}, config)
this.form[i] = config[i]
} }
} }
},
methods: {
confirm () { confirm () {
// @ts-ignore
this.$refs.aliyun.validate((valid) => { this.$refs.aliyun.validate((valid) => {
if (valid) { if (valid) {
this.$db.set('picBed.aliyun', this.form).write() this.$db.set('picBed.aliyun', this.form)
const successNotification = new window.Notification('设置结果', { const successNotification = new window.Notification('设置结果', {
body: '设置成功' body: '设置成功'
}) })
@ -106,7 +103,6 @@ export default {
}) })
} }
} }
}
</script> </script>
<style lang='stylus'> <style lang='stylus'>
#aliyun-view #aliyun-view

View File

@ -56,36 +56,33 @@
</el-row> </el-row>
</div> </div>
</template> </template>
<script> <script lang="ts">
import { Component, Vue } from 'vue-property-decorator'
import mixin from '@/utils/ConfirmButtonMixin' import mixin from '@/utils/ConfirmButtonMixin'
export default { @Component({
name: 'github', name: 'github',
mixins: [mixin], mixins: [mixin]
data () { })
return { export default class extends Vue {
form: { form: IGitHubConfig = {
repo: '', repo: '',
token: '', token: '',
path: '', path: '',
customUrl: '', customUrl: '',
branch: '' branch: ''
} }
}
},
created () { created () {
const config = this.$db.get('picBed.github') const config = this.$db.get('picBed.github') as IGitHubConfig
if (config) { if (config) {
for (let i in config) { this.form = Object.assign({}, config)
this.form[i] = config[i]
} }
} }
},
methods: {
confirm () { confirm () {
// @ts-ignore
this.$refs.github.validate((valid) => { this.$refs.github.validate((valid) => {
if (valid) { if (valid) {
this.$db.set('picBed.github', this.form).write() this.$db.set('picBed.github', this.form)
const successNotification = new window.Notification('设置结果', { const successNotification = new Notification('设置结果', {
body: '设置成功' body: '设置成功'
}) })
successNotification.onclick = () => { successNotification.onclick = () => {
@ -97,7 +94,6 @@ export default {
}) })
} }
} }
}
</script> </script>
<style lang='stylus'> <style lang='stylus'>
#github-view #github-view

View File

@ -36,33 +36,30 @@
</el-row> </el-row>
</div> </div>
</template> </template>
<script> <script lang="ts">
import { Component, Vue } from 'vue-property-decorator'
import mixin from '@/utils/ConfirmButtonMixin' import mixin from '@/utils/ConfirmButtonMixin'
export default { @Component({
name: 'imgur', name: 'imgur',
mixins: [mixin], mixins: [mixin]
data () { })
return { export default class extends Vue {
form: { form: IImgurConfig = {
clientId: '', clientId: '',
proxy: '' proxy: ''
} }
}
},
created () { created () {
const config = this.$db.get('picBed.imgur') const config = this.$db.get('picBed.imgur') as IImgurConfig
if (config) { if (config) {
for (let i in config) { this.form = Object.assign({}, config)
this.form[i] = config[i]
} }
} }
},
methods: {
confirm () { confirm () {
// @ts-ignore
this.$refs.imgur.validate((valid) => { this.$refs.imgur.validate((valid) => {
if (valid) { if (valid) {
this.$db.set('picBed.imgur', this.form).write() this.$db.set('picBed.imgur', this.form)
const successNotification = new window.Notification('设置结果', { const successNotification = new Notification('设置结果', {
body: '设置成功' body: '设置成功'
}) })
successNotification.onclick = () => { successNotification.onclick = () => {
@ -74,7 +71,6 @@ export default {
}) })
} }
} }
}
</script> </script>
<style lang='stylus'> <style lang='stylus'>
#imgur-view #imgur-view

View File

@ -27,57 +27,61 @@
</el-row> </el-row>
</div> </div>
</template> </template>
<script> <script lang="ts">
import ConfigForm from '@/components/ConfigForm' import { Component, Vue } from 'vue-property-decorator'
import ConfigForm from '@/components/ConfigForm.vue'
import mixin from '@/utils/ConfirmButtonMixin' import mixin from '@/utils/ConfirmButtonMixin'
export default { import {
ipcRenderer,
IpcRendererEvent
} from 'electron'
@Component({
name: 'OtherPicBed', name: 'OtherPicBed',
mixins: [mixin], mixins: [mixin],
components: { components: {
ConfigForm ConfigForm
},
data () {
return {
type: '',
config: [],
picBedName: ''
} }
}, })
export default class extends Vue {
type: string = ''
config: any[] = []
picBedName: string = ''
created () { created () {
this.type = this.$route.params.type this.type = this.$route.params.type
this.$electron.ipcRenderer.send('getPicBedConfig', this.$route.params.type) ipcRenderer.send('getPicBedConfig', this.$route.params.type)
this.$electron.ipcRenderer.on('getPicBedConfig', this.getPicBeds) ipcRenderer.on('getPicBedConfig', this.getPicBeds)
}, }
methods: {
async handleConfirm () { async handleConfirm () {
// @ts-ignore
const result = await this.$refs.configForm.validate() const result = await this.$refs.configForm.validate()
if (result !== false) { if (result !== false) {
this.$db.set(`picBed.${this.type}`, result) this.$db.set(`picBed.${this.type}`, result)
const successNotification = new window.Notification('设置结果', { const successNotification = new Notification('设置结果', {
body: '设置成功' body: '设置成功'
}) })
successNotification.onclick = () => { successNotification.onclick = () => {
return true return true
} }
} }
}, }
setDefaultPicBed (type) { setDefaultPicBed (type: string) {
this.$db.set('picBed.current', type) this.$db.set('picBed.current', type)
// @ts-ignore mixin
this.defaultPicBed = type this.defaultPicBed = type
const successNotification = new window.Notification('设置默认图床', { const successNotification = new Notification('设置默认图床', {
body: '设置成功' body: '设置成功'
}) })
successNotification.onclick = () => { successNotification.onclick = () => {
return true return true
} }
}, }
getPicBeds (event, config, name) { getPicBeds (event: IpcRendererEvent, config: any[], name: string) {
this.config = config this.config = config
this.picBedName = name this.picBedName = name
} }
},
beforeDestroy () { beforeDestroy () {
this.$electron.ipcRenderer.removeListener('getPicBedConfig', this.getPicBeds) ipcRenderer.removeListener('getPicBedConfig', this.getPicBeds)
} }
} }
</script> </script>

View File

@ -71,14 +71,15 @@
</el-row> </el-row>
</div> </div>
</template> </template>
<script> <script lang="ts">
import { Component, Vue } from 'vue-property-decorator'
import mixin from '@/utils/ConfirmButtonMixin' import mixin from '@/utils/ConfirmButtonMixin'
export default { @Component({
mixins: [mixin],
name: 'qiniu', name: 'qiniu',
data () { mixins: [mixin]
return { })
form: { export default class extends Vue {
form: IQiniuConfig = {
accessKey: '', accessKey: '',
secretKey: '', secretKey: '',
bucket: '', bucket: '',
@ -87,22 +88,18 @@ export default {
options: '', options: '',
path: '' path: ''
} }
}
},
created () { created () {
const config = this.$db.get('picBed.qiniu') const config = this.$db.get('picBed.qiniu') as IQiniuConfig
if (config) { if (config) {
for (let i in config) { this.form = Object.assign({}, config)
this.form[i] = config[i]
} }
} }
},
methods: {
confirm () { confirm () {
// @ts-ignore
this.$refs.qiniu.validate((valid) => { this.$refs.qiniu.validate((valid) => {
if (valid) { if (valid) {
this.$db.set('picBed.qiniu', this.form).write() this.$db.set('picBed.qiniu', this.form)
const successNotification = new window.Notification('设置结果', { const successNotification = new Notification('设置结果', {
body: '设置成功' body: '设置成功'
}) })
successNotification.onclick = () => { successNotification.onclick = () => {
@ -114,7 +111,6 @@ export default {
}) })
} }
} }
}
</script> </script>
<style lang='stylus'> <style lang='stylus'>
#qiniu-view #qiniu-view

View File

@ -15,17 +15,17 @@
</el-row> </el-row>
</div> </div>
</template> </template>
<script> <script lang="ts">
import { Component, Vue } from 'vue-property-decorator'
import mixin from '@/utils/ConfirmButtonMixin' import mixin from '@/utils/ConfirmButtonMixin'
export default { @Component({
mixins: [mixin], name: 'smms',
name: 'upyun', mixins: [mixin]
data () { })
return {} export default class extends Vue {
},
methods: {
confirm () { confirm () {
this.$db.set('picBed.smms', true).write() this.$db.set('picBed.smms', true)
// @ts-ignore mixin
this.setDefaultPicBed('smms') this.setDefaultPicBed('smms')
const successNotification = new window.Notification('设置结果', { const successNotification = new window.Notification('设置结果', {
body: '设置成功' body: '设置成功'
@ -35,7 +35,6 @@ export default {
} }
} }
} }
}
</script> </script>
<style lang='stylus'> <style lang='stylus'>
#smms-view #smms-view

View File

@ -85,14 +85,16 @@
</el-row> </el-row>
</div> </div>
</template> </template>
<script> <script lang="ts">
import { Component, Vue } from 'vue-property-decorator'
import mixin from '@/utils/ConfirmButtonMixin' import mixin from '@/utils/ConfirmButtonMixin'
export default { import { remote } from 'electron'
mixins: [mixin], @Component({
name: 'tcyun', name: 'tcyun',
data () { mixins: [mixin]
return { })
form: { export default class extends Vue {
form: ITcYunConfig = {
secretId: '', secretId: '',
secretKey: '', secretKey: '',
bucket: '', bucket: '',
@ -102,21 +104,17 @@ export default {
customUrl: '', customUrl: '',
version: 'v4' version: 'v4'
} }
}
},
created () { created () {
const config = this.$db.get('picBed.tcyun') const config = this.$db.get('picBed.tcyun') as ITcYunConfig
if (config) { if (config) {
for (let i in config) { this.form = Object.assign({}, config)
this.form[i] = config[i]
} }
} }
},
methods: {
confirm () { confirm () {
// @ts-ignore
this.$refs.tcyun.validate((valid) => { this.$refs.tcyun.validate((valid) => {
if (valid) { if (valid) {
this.$db.set('picBed.tcyun', this.form).write() this.$db.set('picBed.tcyun', this.form)
const successNotification = new window.Notification('设置结果', { const successNotification = new window.Notification('设置结果', {
body: '设置成功' body: '设置成功'
}) })
@ -127,10 +125,9 @@ export default {
return false return false
} }
}) })
},
openWiki () {
this.$electron.remote.shell.openExternal('https://github.com/Molunerfinn/PicGo/wiki/%E8%AF%A6%E7%BB%86%E7%AA%97%E5%8F%A3%E7%9A%84%E4%BD%BF%E7%94%A8#腾讯云cos')
} }
openWiki () {
remote.shell.openExternal('https://github.com/Molunerfinn/PicGo/wiki/%E8%AF%A6%E7%BB%86%E7%AA%97%E5%8F%A3%E7%9A%84%E4%BD%BF%E7%94%A8#腾讯云cos')
} }
} }
</script> </script>

View File

@ -64,36 +64,33 @@
</el-row> </el-row>
</div> </div>
</template> </template>
<script> <script lang="ts">
import { Component, Vue } from 'vue-property-decorator'
import mixin from '@/utils/ConfirmButtonMixin' import mixin from '@/utils/ConfirmButtonMixin'
export default { @Component({
name: 'upyun', name: 'upyun',
mixins: [mixin], mixins: [mixin]
data () { })
return { export default class extends Vue {
form: { form: IUpYunConfig = {
bucket: '', bucket: '',
operator: '', operator: '',
password: '', password: '',
options: '', options: '',
path: '' path: ''
} }
}
},
created () { created () {
const config = this.$db.get('picBed.upyun') const config = this.$db.get('picBed.upyun') as IUpYunConfig
if (config) { if (config) {
for (let i in config) { this.form = Object.assign({}, config)
this.form[i] = config[i]
} }
} }
},
methods: {
confirm () { confirm () {
// @ts-ignore
this.$refs.tcyun.validate((valid) => { this.$refs.tcyun.validate((valid) => {
if (valid) { if (valid) {
this.$db.set('picBed.upyun', this.form).write() this.$db.set('picBed.upyun', this.form)
const successNotification = new window.Notification('设置结果', { const successNotification = new Notification('设置结果', {
body: '设置成功' body: '设置成功'
}) })
successNotification.onclick = () => { successNotification.onclick = () => {
@ -105,7 +102,6 @@ export default {
}) })
} }
} }
}
</script> </script>
<style lang='stylus'> <style lang='stylus'>
#tcyun-view #tcyun-view

View File

@ -3,7 +3,7 @@
<el-row :gutter="16"> <el-row :gutter="16">
<el-col :span="16" :offset="4"> <el-col :span="16" :offset="4">
<div class="view-title"> <div class="view-title">
微博图床设置 微博图床设置[已停止支持]
</div> </div>
<el-form <el-form
ref="weiboForm" ref="weiboForm"

View File

@ -19,30 +19,30 @@ interface ImgInfo {
[propName: string]: any [propName: string]: any
} }
interface PicBedType { interface IPicBedType {
type: string type: string
name: string name: string
visible: boolean visible: boolean
} }
// Config Settings // Config Settings
interface ShortKeyConfig { interface IShortKeyConfig {
enable: boolean enable: boolean
key: string // 按键 key: string // 按键
name: string name: string
label: string label: string
} }
interface ShortKeyConfigs { interface IShortKeyConfigs {
[propName: string]: ShortKeyConfig [propName: string]: IShortKeyConfig
} }
interface OldShortKeyConfigs { interface IOldShortKeyConfigs {
upload: string upload: string
} }
// Main process // Main process
interface BrowserWindowOptions { interface IBrowserWindowOptions {
height: number, height: number,
width: number, width: number,
show: boolean, show: boolean,
@ -67,12 +67,12 @@ interface BrowserWindowOptions {
alwaysOnTop?: boolean alwaysOnTop?: boolean
} }
interface FileWithPath { interface IFileWithPath {
path: string path: string
name?: string name?: string
} }
interface Bounds { interface IBounds {
x: number x: number
y: number y: number
} }
@ -140,3 +140,56 @@ interface IShowInputBoxOption {
title: string title: string
placeholder: string placeholder: string
} }
// PicBeds
interface IAliYunConfig {
accessKeyId: string
accessKeySecret: string,
bucket: string,
area: string,
path: string,
customUrl: string
}
interface IGitHubConfig {
repo: string,
token: string,
path: string,
customUrl: string,
branch: string
}
interface IImgurConfig {
clientId: string,
proxy: string
}
interface IQiniuConfig {
accessKey: string,
secretKey: string,
bucket: string,
url: string,
area: string,
options: string,
path: string
}
interface ITcYunConfig {
secretId: string,
secretKey: string,
bucket: string,
appId: string,
area: string,
path: string,
customUrl: string,
version: 'v4' | 'v5'
}
interface IUpYunConfig {
bucket: string,
operator: string,
password: string,
options: string,
path: string
}