2018-04-27 12:16:17 -04:00
|
|
|
|
<template>
|
|
|
|
|
<div id="picgo-setting">
|
2018-04-28 04:22:35 -04:00
|
|
|
|
<div class="view-title">
|
2019-04-18 23:00:51 -04:00
|
|
|
|
PicGo设置 - <i class="el-icon-document" @click="goConfigPage"></i>
|
2018-04-28 04:22:35 -04:00
|
|
|
|
</div>
|
|
|
|
|
<el-row class="setting-list">
|
|
|
|
|
<el-col :span="15" :offset="4">
|
|
|
|
|
<el-row>
|
2018-04-27 12:16:17 -04:00
|
|
|
|
<el-form
|
|
|
|
|
label-width="120px"
|
|
|
|
|
label-position="right"
|
|
|
|
|
size="small"
|
|
|
|
|
>
|
2018-12-19 03:46:07 -05:00
|
|
|
|
<el-form-item
|
|
|
|
|
label="打开配置文件"
|
|
|
|
|
>
|
2019-04-04 03:08:47 -04:00
|
|
|
|
<el-button type="primary" round size="mini" @click="openFile('data.json')">点击打开</el-button>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item
|
|
|
|
|
label="设置日志文件"
|
|
|
|
|
>
|
|
|
|
|
<el-button type="primary" round size="mini" @click="openLogSetting">点击设置</el-button>
|
2018-12-19 03:46:07 -05:00
|
|
|
|
</el-form-item>
|
2018-04-27 12:16:17 -04:00
|
|
|
|
<el-form-item
|
2019-09-11 03:31:27 -04:00
|
|
|
|
label="修改快捷键"
|
2018-04-27 12:16:17 -04:00
|
|
|
|
>
|
2019-09-11 03:31:27 -04:00
|
|
|
|
<el-button type="primary" round size="mini" @click="goShortCutPage">点击设置</el-button>
|
2018-04-27 12:16:17 -04:00
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item
|
|
|
|
|
label="自定义链接格式"
|
|
|
|
|
>
|
2018-05-02 04:04:55 -04:00
|
|
|
|
<el-button type="primary" round size="mini" @click="customLinkVisible = true">点击设置</el-button>
|
2018-04-27 12:16:17 -04:00
|
|
|
|
</el-form-item>
|
2018-12-20 09:30:08 -05:00
|
|
|
|
<el-form-item
|
|
|
|
|
label="设置代理"
|
|
|
|
|
>
|
|
|
|
|
<el-button type="primary" round size="mini" @click="proxyVisible = true">点击设置</el-button>
|
|
|
|
|
</el-form-item>
|
2018-06-04 08:41:40 -04:00
|
|
|
|
<el-form-item
|
|
|
|
|
label="检查更新"
|
|
|
|
|
>
|
2018-12-21 04:25:42 -05:00
|
|
|
|
<el-button type="primary" round size="mini" @click="checkUpdate">点击检查</el-button>
|
2018-06-04 08:41:40 -04:00
|
|
|
|
</el-form-item>
|
2018-04-27 12:16:17 -04:00
|
|
|
|
<el-form-item
|
|
|
|
|
label="打开更新助手"
|
|
|
|
|
>
|
|
|
|
|
<el-switch
|
|
|
|
|
v-model="form.updateHelper"
|
|
|
|
|
active-text="开"
|
|
|
|
|
inactive-text="关"
|
2018-05-02 04:04:55 -04:00
|
|
|
|
@change="updateHelperChange"
|
2018-04-27 12:16:17 -04:00
|
|
|
|
></el-switch>
|
|
|
|
|
</el-form-item>
|
2018-04-28 04:22:35 -04:00
|
|
|
|
<el-form-item
|
|
|
|
|
label="开机自启"
|
|
|
|
|
>
|
|
|
|
|
<el-switch
|
|
|
|
|
v-model="form.autoStart"
|
|
|
|
|
active-text="开"
|
|
|
|
|
inactive-text="关"
|
2018-05-02 05:17:55 -04:00
|
|
|
|
@change="handleAutoStartChange"
|
2018-04-28 04:22:35 -04:00
|
|
|
|
></el-switch>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item
|
|
|
|
|
label="上传前重命名"
|
|
|
|
|
>
|
|
|
|
|
<el-switch
|
|
|
|
|
v-model="form.rename"
|
|
|
|
|
active-text="开"
|
|
|
|
|
inactive-text="关"
|
2018-05-08 02:04:43 -04:00
|
|
|
|
@change="handleRename"
|
2018-04-28 04:22:35 -04:00
|
|
|
|
></el-switch>
|
|
|
|
|
</el-form-item>
|
2018-06-04 08:13:17 -04:00
|
|
|
|
<el-form-item
|
|
|
|
|
label="时间戳重命名"
|
|
|
|
|
>
|
|
|
|
|
<el-switch
|
|
|
|
|
v-model="form.autoRename"
|
|
|
|
|
active-text="开"
|
|
|
|
|
inactive-text="关"
|
|
|
|
|
@change="handleAutoRename"
|
|
|
|
|
></el-switch>
|
|
|
|
|
</el-form-item>
|
2018-06-05 08:03:53 -04:00
|
|
|
|
<el-form-item
|
|
|
|
|
label="开启上传提示"
|
|
|
|
|
>
|
|
|
|
|
<el-switch
|
|
|
|
|
v-model="form.uploadNotification"
|
|
|
|
|
active-text="开"
|
|
|
|
|
inactive-text="关"
|
|
|
|
|
@change="handleUploadNotification"
|
|
|
|
|
></el-switch>
|
|
|
|
|
</el-form-item>
|
2018-09-07 05:32:11 -04:00
|
|
|
|
<el-form-item
|
2019-01-07 06:37:20 -05:00
|
|
|
|
v-if="os !== 'darwin'"
|
2018-12-21 04:25:42 -05:00
|
|
|
|
label="Mini窗口置顶"
|
2018-09-07 05:32:11 -04:00
|
|
|
|
>
|
|
|
|
|
<el-switch
|
|
|
|
|
v-model="form.miniWindowOntop"
|
|
|
|
|
active-text="开"
|
|
|
|
|
inactive-text="关"
|
|
|
|
|
@change="handleMiniWindowOntop"
|
|
|
|
|
></el-switch>
|
|
|
|
|
</el-form-item>
|
2018-04-28 04:22:35 -04:00
|
|
|
|
<el-form-item
|
|
|
|
|
label="选择显示的图床"
|
|
|
|
|
>
|
2018-05-02 04:04:55 -04:00
|
|
|
|
<el-checkbox-group
|
|
|
|
|
v-model="form.showPicBedList"
|
|
|
|
|
@change="handleShowPicBedListChange"
|
|
|
|
|
>
|
2018-04-28 04:22:35 -04:00
|
|
|
|
<el-checkbox
|
2018-05-08 02:04:43 -04:00
|
|
|
|
v-for="item in picBed"
|
2018-04-28 04:22:35 -04:00
|
|
|
|
:label="item.name"
|
2018-05-08 02:04:43 -04:00
|
|
|
|
:key="item.name"
|
2018-04-28 04:22:35 -04:00
|
|
|
|
></el-checkbox>
|
|
|
|
|
</el-checkbox-group>
|
|
|
|
|
</el-form-item>
|
2018-04-27 12:16:17 -04:00
|
|
|
|
</el-form>
|
2018-04-28 04:22:35 -04:00
|
|
|
|
</el-row>
|
2018-04-27 12:16:17 -04:00
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
2018-05-02 04:04:55 -04:00
|
|
|
|
<el-dialog
|
|
|
|
|
title="自定义链接格式"
|
|
|
|
|
:visible.sync="customLinkVisible"
|
|
|
|
|
:modal-append-to-body="false"
|
|
|
|
|
>
|
|
|
|
|
<el-form
|
|
|
|
|
label-position="top"
|
|
|
|
|
:model="customLink"
|
|
|
|
|
ref="customLink"
|
|
|
|
|
:rules="rules"
|
2019-04-18 23:00:51 -04:00
|
|
|
|
size="small"
|
2018-05-02 04:04:55 -04:00
|
|
|
|
>
|
|
|
|
|
<el-form-item
|
|
|
|
|
prop="value"
|
|
|
|
|
>
|
2019-04-18 23:00:51 -04:00
|
|
|
|
<div class="custom-title">
|
|
|
|
|
用占位符 <b>$url</b> 来表示url的位置
|
|
|
|
|
</div>
|
|
|
|
|
<div class="custom-title">
|
|
|
|
|
用占位符 <b>$fileName</b> 来表示文件名的位置
|
|
|
|
|
</div>
|
2018-05-02 04:04:55 -04:00
|
|
|
|
<el-input
|
|
|
|
|
class="align-center"
|
|
|
|
|
v-model="customLink.value"
|
|
|
|
|
:autofocus="true"
|
|
|
|
|
></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
<div>
|
2019-04-18 23:00:51 -04:00
|
|
|
|
如[$fileName]($url)
|
2018-05-02 04:04:55 -04:00
|
|
|
|
</div>
|
|
|
|
|
<span slot="footer">
|
2018-12-21 04:25:42 -05:00
|
|
|
|
<el-button @click="cancelCustomLink" round>取消</el-button>
|
|
|
|
|
<el-button type="primary" @click="confirmCustomLink" round>确定</el-button>
|
2018-05-02 04:04:55 -04:00
|
|
|
|
</span>
|
|
|
|
|
</el-dialog>
|
2018-12-20 09:30:08 -05:00
|
|
|
|
<el-dialog
|
|
|
|
|
title="设置代理"
|
|
|
|
|
:visible.sync="proxyVisible"
|
|
|
|
|
:modal-append-to-body="false"
|
|
|
|
|
>
|
|
|
|
|
<el-form
|
|
|
|
|
label-position="right"
|
|
|
|
|
:model="customLink"
|
|
|
|
|
ref="customLink"
|
|
|
|
|
:rules="rules"
|
|
|
|
|
label-width="80px"
|
|
|
|
|
>
|
|
|
|
|
<el-form-item
|
|
|
|
|
label="代理地址"
|
|
|
|
|
>
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="proxy"
|
|
|
|
|
:autofocus="true"
|
|
|
|
|
placeholder="例如:http://127.0.0.1:1080"
|
|
|
|
|
></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
<span slot="footer">
|
|
|
|
|
<el-button @click="cancelProxy" round>取消</el-button>
|
|
|
|
|
<el-button type="primary" @click="confirmProxy" round>确定</el-button>
|
|
|
|
|
</span>
|
|
|
|
|
</el-dialog>
|
2018-06-04 08:41:40 -04:00
|
|
|
|
<el-dialog
|
|
|
|
|
title="检查更新"
|
|
|
|
|
:visible.sync="checkUpdateVisible"
|
|
|
|
|
:modal-append-to-body="false"
|
|
|
|
|
>
|
|
|
|
|
<div>
|
|
|
|
|
当前版本:{{ version }}
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
最新版本:{{ latestVersion ? latestVersion : '正在获取中...' }}
|
|
|
|
|
</div>
|
|
|
|
|
<div v-if="needUpdate">
|
|
|
|
|
PicGo更新啦,请点击确定打开下载页面
|
|
|
|
|
</div>
|
|
|
|
|
<span slot="footer">
|
2018-12-20 09:30:08 -05:00
|
|
|
|
<el-button @click="cancelCheckVersion" round>取消</el-button>
|
|
|
|
|
<el-button type="primary" @click="confirmCheckVersion" round>确定</el-button>
|
2018-06-04 08:41:40 -04:00
|
|
|
|
</span>
|
|
|
|
|
</el-dialog>
|
2019-04-04 03:08:47 -04:00
|
|
|
|
<el-dialog
|
|
|
|
|
title="设置日志文件"
|
|
|
|
|
:visible.sync="logFileVisible"
|
|
|
|
|
:modal-append-to-body="false"
|
|
|
|
|
>
|
|
|
|
|
<el-form
|
|
|
|
|
label-position="right"
|
|
|
|
|
label-width="100px"
|
|
|
|
|
>
|
|
|
|
|
<el-form-item
|
|
|
|
|
label="日志文件"
|
|
|
|
|
>
|
|
|
|
|
<el-button type="primary" round size="mini" @click="openFile('picgo.log')">点击打开</el-button>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item
|
|
|
|
|
label="日志记录等级"
|
|
|
|
|
>
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="form.logLevel"
|
|
|
|
|
multiple
|
|
|
|
|
collapse-tags
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="(value, key) of logLevel"
|
|
|
|
|
:key="key"
|
|
|
|
|
:label="value"
|
|
|
|
|
:value="key"
|
|
|
|
|
:disabled="handleLevelDisabled(key)"
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
<span slot="footer">
|
|
|
|
|
<el-button @click="cancelLogLevelSetting" round>取消</el-button>
|
|
|
|
|
<el-button type="primary" @click="confirmLogLevelSetting" round>确定</el-button>
|
|
|
|
|
</span>
|
|
|
|
|
</el-dialog>
|
2018-04-27 12:16:17 -04:00
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
2018-05-02 04:04:55 -04:00
|
|
|
|
import keyDetect from 'utils/key-binding'
|
2018-12-10 04:13:48 -05:00
|
|
|
|
import pkg from 'root/package.json'
|
2018-12-19 03:46:07 -05:00
|
|
|
|
import path from 'path'
|
2018-06-04 08:41:40 -04:00
|
|
|
|
const release = 'https://api.github.com/repos/Molunerfinn/PicGo/releases/latest'
|
|
|
|
|
const downloadUrl = 'https://github.com/Molunerfinn/PicGo/releases/latest'
|
2018-04-27 12:16:17 -04:00
|
|
|
|
export default {
|
|
|
|
|
name: 'picgo-setting',
|
2018-06-04 08:41:40 -04:00
|
|
|
|
computed: {
|
|
|
|
|
needUpdate () {
|
|
|
|
|
if (this.latestVersion) {
|
|
|
|
|
return this.compareVersion2Update(this.version, this.latestVersion)
|
|
|
|
|
} else {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2018-04-27 12:16:17 -04:00
|
|
|
|
data () {
|
2018-05-02 04:04:55 -04:00
|
|
|
|
const customLinkRule = (rule, value, callback) => {
|
|
|
|
|
if (!/\$url/.test(value)) {
|
|
|
|
|
return callback(new Error('必须含有$url'))
|
|
|
|
|
} else {
|
|
|
|
|
return callback()
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-09-11 07:30:08 -04:00
|
|
|
|
let logLevel = this.$db.get('settings.logLevel')
|
2019-04-16 21:28:36 -04:00
|
|
|
|
if (!Array.isArray(logLevel)) {
|
2019-04-18 04:23:21 -04:00
|
|
|
|
if (logLevel && logLevel.length > 0) {
|
2019-04-16 21:28:36 -04:00
|
|
|
|
logLevel = [logLevel]
|
|
|
|
|
} else {
|
|
|
|
|
logLevel = ['all']
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-04-27 12:16:17 -04:00
|
|
|
|
return {
|
|
|
|
|
form: {
|
2019-09-11 07:30:08 -04:00
|
|
|
|
updateHelper: this.$db.get('settings.showUpdateTip'),
|
2018-04-28 04:22:35 -04:00
|
|
|
|
showPicBedList: [],
|
2019-09-11 07:30:08 -04:00
|
|
|
|
autoStart: this.$db.get('settings.autoStart') || false,
|
|
|
|
|
rename: this.$db.get('settings.rename') || false,
|
|
|
|
|
autoRename: this.$db.get('settings.autoRename') || false,
|
|
|
|
|
uploadNotification: this.$db.get('settings.uploadNotification') || false,
|
|
|
|
|
miniWindowOntop: this.$db.get('settings.miniWindowOntop') || false,
|
2019-04-16 21:28:36 -04:00
|
|
|
|
logLevel
|
2018-05-02 04:04:55 -04:00
|
|
|
|
},
|
2018-12-23 10:15:00 -05:00
|
|
|
|
picBed: [],
|
2019-04-04 03:08:47 -04:00
|
|
|
|
logFileVisible: false,
|
2018-05-02 04:04:55 -04:00
|
|
|
|
keyBindingVisible: false,
|
|
|
|
|
customLinkVisible: false,
|
2018-06-04 08:41:40 -04:00
|
|
|
|
checkUpdateVisible: false,
|
2018-12-20 09:30:08 -05:00
|
|
|
|
proxyVisible: false,
|
2018-05-02 04:04:55 -04:00
|
|
|
|
customLink: {
|
2019-09-11 07:30:08 -04:00
|
|
|
|
value: this.$db.get('settings.customLink') || '$url'
|
2018-05-02 04:04:55 -04:00
|
|
|
|
},
|
|
|
|
|
shortKey: {
|
2019-09-11 07:30:08 -04:00
|
|
|
|
upload: this.$db.get('settings.shortKey.upload')
|
2018-04-28 04:22:35 -04:00
|
|
|
|
},
|
2019-09-11 07:30:08 -04:00
|
|
|
|
proxy: this.$db.get('picBed.proxy') || undefined,
|
2018-05-02 04:04:55 -04:00
|
|
|
|
rules: {
|
|
|
|
|
value: [
|
|
|
|
|
{ validator: customLinkRule, trigger: 'blur' }
|
|
|
|
|
]
|
2018-06-04 08:41:40 -04:00
|
|
|
|
},
|
2019-04-04 03:08:47 -04:00
|
|
|
|
logLevel: {
|
|
|
|
|
all: '全部-All',
|
|
|
|
|
success: '成功-Success',
|
|
|
|
|
error: '错误-Error',
|
|
|
|
|
info: '普通-Info',
|
|
|
|
|
warn: '提醒-Warn',
|
|
|
|
|
none: '不记录日志-None'
|
|
|
|
|
},
|
2018-06-04 08:41:40 -04:00
|
|
|
|
version: pkg.version,
|
2019-01-07 06:37:20 -05:00
|
|
|
|
latestVersion: '',
|
|
|
|
|
os: ''
|
2018-05-02 04:04:55 -04:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
created () {
|
2019-01-07 06:37:20 -05:00
|
|
|
|
this.os = process.platform
|
2018-12-24 03:05:30 -05:00
|
|
|
|
this.$electron.ipcRenderer.send('getPicBeds')
|
|
|
|
|
this.$electron.ipcRenderer.on('getPicBeds', this.getPicBeds)
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
getPicBeds (event, picBeds) {
|
2018-12-23 10:15:00 -05:00
|
|
|
|
this.picBed = picBeds
|
|
|
|
|
this.form.showPicBedList = this.picBed.map(item => {
|
|
|
|
|
if (item.visible) {
|
|
|
|
|
return item.name
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
2019-04-04 03:08:47 -04:00
|
|
|
|
openFile (file) {
|
2018-12-19 03:46:07 -05:00
|
|
|
|
const { app, shell } = this.$electron.remote
|
|
|
|
|
const STORE_PATH = app.getPath('userData')
|
2019-04-04 03:08:47 -04:00
|
|
|
|
const FILE = path.join(STORE_PATH, `/${file}`)
|
|
|
|
|
shell.openItem(FILE)
|
|
|
|
|
},
|
|
|
|
|
openLogSetting () {
|
|
|
|
|
this.logFileVisible = true
|
2018-12-19 03:46:07 -05:00
|
|
|
|
},
|
2018-05-02 04:04:55 -04:00
|
|
|
|
keyDetect (type, event) {
|
|
|
|
|
this.shortKey[type] = keyDetect(event).join('+')
|
|
|
|
|
},
|
|
|
|
|
cancelKeyBinding () {
|
|
|
|
|
this.keyBindingVisible = false
|
2019-09-11 07:30:08 -04:00
|
|
|
|
this.shortKey = this.$db.get('settings.shortKey')
|
2018-05-02 04:04:55 -04:00
|
|
|
|
},
|
|
|
|
|
cancelCustomLink () {
|
|
|
|
|
this.customLinkVisible = false
|
2019-09-11 07:30:08 -04:00
|
|
|
|
this.customLink.value = this.$db.get('settings.customLink') || '$url'
|
2018-05-02 04:04:55 -04:00
|
|
|
|
},
|
|
|
|
|
confirmCustomLink () {
|
|
|
|
|
this.$refs.customLink.validate((valid) => {
|
|
|
|
|
if (valid) {
|
2019-09-11 07:30:08 -04:00
|
|
|
|
this.$db.set('settings.customLink', this.customLink.value)
|
2018-05-02 04:04:55 -04:00
|
|
|
|
this.customLinkVisible = false
|
|
|
|
|
this.$electron.ipcRenderer.send('updateCustomLink')
|
|
|
|
|
} else {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
2018-12-20 09:30:08 -05:00
|
|
|
|
cancelProxy () {
|
|
|
|
|
this.proxyVisible = false
|
2019-09-11 07:30:08 -04:00
|
|
|
|
this.proxy = this.$db.get('picBed.proxy') || undefined
|
2018-12-20 09:30:08 -05:00
|
|
|
|
},
|
|
|
|
|
confirmProxy () {
|
|
|
|
|
this.proxyVisible = false
|
2019-09-11 07:30:08 -04:00
|
|
|
|
this.$db.set('picBed.proxy', this.proxy)
|
2018-12-20 09:30:08 -05:00
|
|
|
|
const successNotification = new window.Notification('设置代理', {
|
|
|
|
|
body: '设置成功'
|
|
|
|
|
})
|
|
|
|
|
successNotification.onclick = () => {
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
},
|
2018-05-02 04:04:55 -04:00
|
|
|
|
updateHelperChange (val) {
|
2019-09-11 07:30:08 -04:00
|
|
|
|
this.$db.set('settings.showUpdateTip', val)
|
2018-05-02 04:04:55 -04:00
|
|
|
|
},
|
|
|
|
|
handleShowPicBedListChange (val) {
|
|
|
|
|
const list = this.picBed.map(item => {
|
|
|
|
|
if (!val.includes(item.name)) {
|
|
|
|
|
item.visible = false
|
|
|
|
|
} else {
|
|
|
|
|
item.visible = true
|
|
|
|
|
}
|
|
|
|
|
return item
|
|
|
|
|
})
|
2019-09-11 07:30:08 -04:00
|
|
|
|
this.$db.set('picBed.list', list)
|
2018-12-24 03:05:30 -05:00
|
|
|
|
this.$electron.ipcRenderer.send('getPicBeds')
|
2018-05-02 05:17:55 -04:00
|
|
|
|
},
|
|
|
|
|
handleAutoStartChange (val) {
|
2019-09-11 07:30:08 -04:00
|
|
|
|
this.$db.set('settings.autoStart', val)
|
2018-05-02 07:34:24 -04:00
|
|
|
|
this.$electron.ipcRenderer.send('autoStart', val)
|
2018-05-08 02:04:43 -04:00
|
|
|
|
},
|
|
|
|
|
handleRename (val) {
|
2019-09-11 07:30:08 -04:00
|
|
|
|
this.$db.set('settings.rename', val)
|
2018-06-04 08:13:17 -04:00
|
|
|
|
},
|
|
|
|
|
handleAutoRename (val) {
|
2019-09-11 07:30:08 -04:00
|
|
|
|
this.$db.set('settings.autoRename', val)
|
2018-06-04 08:41:40 -04:00
|
|
|
|
},
|
|
|
|
|
compareVersion2Update (current, latest) {
|
|
|
|
|
const currentVersion = current.split('.').map(item => parseInt(item))
|
|
|
|
|
const latestVersion = latest.split('.').map(item => parseInt(item))
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < 3; i++) {
|
|
|
|
|
if (currentVersion[i] < latestVersion[i]) {
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
if (currentVersion[i] > latestVersion[i]) {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false
|
|
|
|
|
},
|
|
|
|
|
checkUpdate () {
|
|
|
|
|
this.checkUpdateVisible = true
|
|
|
|
|
this.$http.get(release)
|
|
|
|
|
.then(res => {
|
|
|
|
|
this.latestVersion = res.data.name
|
|
|
|
|
}).catch(err => {
|
|
|
|
|
console.log(err)
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
confirmCheckVersion () {
|
|
|
|
|
if (this.needUpdate) {
|
|
|
|
|
this.$electron.remote.shell.openExternal(downloadUrl)
|
|
|
|
|
}
|
|
|
|
|
this.checkUpdateVisible = false
|
|
|
|
|
},
|
|
|
|
|
cancelCheckVersion () {
|
|
|
|
|
this.checkUpdateVisible = false
|
2018-06-05 08:03:53 -04:00
|
|
|
|
},
|
|
|
|
|
handleUploadNotification (val) {
|
2019-09-11 07:30:08 -04:00
|
|
|
|
this.$db.set('settings.uploadNotification', val)
|
2018-09-07 05:32:11 -04:00
|
|
|
|
},
|
|
|
|
|
handleMiniWindowOntop (val) {
|
2019-09-11 07:30:08 -04:00
|
|
|
|
this.$db.set('settings.miniWindowOntop', val)
|
2018-09-07 05:32:11 -04:00
|
|
|
|
this.$message('需要重启生效')
|
2019-04-04 03:08:47 -04:00
|
|
|
|
},
|
|
|
|
|
confirmLogLevelSetting () {
|
|
|
|
|
if (this.form.logLevel.length === 0) {
|
|
|
|
|
return this.$message.error('请选择日志记录等级')
|
|
|
|
|
}
|
2019-09-11 07:30:08 -04:00
|
|
|
|
this.$db.set('settings.logLevel', this.form.logLevel)
|
2019-04-04 03:08:47 -04:00
|
|
|
|
const successNotification = new window.Notification('设置日志', {
|
|
|
|
|
body: '设置成功'
|
|
|
|
|
})
|
|
|
|
|
successNotification.onclick = () => {
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
this.logFileVisible = false
|
|
|
|
|
},
|
|
|
|
|
cancelLogLevelSetting () {
|
|
|
|
|
this.logFileVisible = false
|
2019-09-11 07:30:08 -04:00
|
|
|
|
let logLevel = this.$db.get('settings.logLevel')
|
2019-04-18 04:23:21 -04:00
|
|
|
|
if (!Array.isArray(logLevel)) {
|
|
|
|
|
if (logLevel && logLevel.length > 0) {
|
|
|
|
|
logLevel = [logLevel]
|
|
|
|
|
} else {
|
|
|
|
|
logLevel = ['all']
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.form.logLevel = logLevel
|
2019-04-04 03:08:47 -04:00
|
|
|
|
},
|
|
|
|
|
handleLevelDisabled (val) {
|
|
|
|
|
let currentLevel = val
|
|
|
|
|
let flagLevel
|
|
|
|
|
let result = this.form.logLevel.some(item => {
|
|
|
|
|
if (item === 'all' || item === 'none') {
|
|
|
|
|
flagLevel = item
|
|
|
|
|
}
|
|
|
|
|
return (item === 'all' || item === 'none')
|
|
|
|
|
})
|
|
|
|
|
if (result) {
|
|
|
|
|
if (currentLevel !== flagLevel) {
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
} else if (this.form.logLevel.length > 0) {
|
|
|
|
|
if (val === 'all' || val === 'none') {
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false
|
2019-04-18 23:00:51 -04:00
|
|
|
|
},
|
|
|
|
|
goConfigPage () {
|
|
|
|
|
this.$electron.remote.shell.openExternal('https://picgo.github.io/PicGo-Doc/zh/guide/config.html#picgo设置')
|
2019-09-11 03:31:27 -04:00
|
|
|
|
},
|
|
|
|
|
goShortCutPage () {
|
|
|
|
|
this.$router.push('shortcut-page')
|
2018-04-27 12:16:17 -04:00
|
|
|
|
}
|
2018-12-23 10:15:00 -05:00
|
|
|
|
},
|
|
|
|
|
beforeDestroy () {
|
2018-12-24 03:05:30 -05:00
|
|
|
|
this.$electron.ipcRenderer.removeListener('getPicBeds', this.getPicBeds)
|
2018-04-27 12:16:17 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
<style lang='stylus'>
|
|
|
|
|
.el-message
|
|
|
|
|
left 60%
|
2019-04-18 23:00:51 -04:00
|
|
|
|
.view-title
|
|
|
|
|
.el-icon-document
|
|
|
|
|
cursor pointer
|
|
|
|
|
transition color .2s ease-in-out
|
|
|
|
|
&:hover
|
|
|
|
|
color #49B1F5
|
2018-04-27 12:16:17 -04:00
|
|
|
|
#picgo-setting
|
2018-05-02 02:24:59 -04:00
|
|
|
|
.sub-title
|
|
|
|
|
font-size 14px
|
2018-04-28 04:22:35 -04:00
|
|
|
|
.setting-list
|
2018-05-02 04:04:55 -04:00
|
|
|
|
height 360px
|
2018-04-28 04:22:35 -04:00
|
|
|
|
box-sizing border-box
|
|
|
|
|
overflow-y auto
|
|
|
|
|
overflow-x hidden
|
2018-05-02 04:04:55 -04:00
|
|
|
|
.setting-list
|
|
|
|
|
.el-form
|
|
|
|
|
label
|
|
|
|
|
line-height 32px
|
|
|
|
|
padding-bottom 0
|
|
|
|
|
color #eee
|
|
|
|
|
.el-button-group
|
|
|
|
|
width 100%
|
|
|
|
|
.el-button
|
|
|
|
|
width 50%
|
|
|
|
|
.el-input__inner
|
|
|
|
|
border-radius 19px
|
|
|
|
|
.el-radio-group
|
|
|
|
|
margin-left 25px
|
|
|
|
|
.el-switch__label
|
|
|
|
|
color #eee
|
|
|
|
|
&.is-active
|
|
|
|
|
color #409EFF
|
|
|
|
|
.el-icon-question
|
|
|
|
|
font-size 20px
|
|
|
|
|
float right
|
|
|
|
|
margin-top 9px
|
|
|
|
|
color #eee
|
|
|
|
|
cursor pointer
|
|
|
|
|
transition .2s color ease-in-out
|
|
|
|
|
&:hover
|
|
|
|
|
color #409EFF
|
|
|
|
|
.el-checkbox-group
|
|
|
|
|
label
|
|
|
|
|
margin-right 30px
|
|
|
|
|
width 100px
|
|
|
|
|
.el-checkbox+.el-checkbox
|
2018-04-28 04:22:35 -04:00
|
|
|
|
margin-right 30px
|
2018-05-02 04:04:55 -04:00
|
|
|
|
margin-left 0
|
|
|
|
|
.confirm-button
|
|
|
|
|
width 100%
|
2018-04-27 12:16:17 -04:00
|
|
|
|
</style>
|