mirror of https://github.com/halo-dev/halo-admin
refactor: cleanup code. (#351)
* refactor: cleanup code. * refactor: cleanup code. * refactor: cleanup code. * fix: post list render error.pull/353/head
parent
70548be6b0
commit
66955f94d8
18
package.json
18
package.json
|
@ -21,21 +21,21 @@
|
|||
"test:unit": "vue-cli-service test:unit"
|
||||
},
|
||||
"dependencies": {
|
||||
"ant-design-vue": "^1.7.6",
|
||||
"axios": "^0.21.1",
|
||||
"dayjs": "^1.10.5",
|
||||
"ant-design-vue": "^1.7.8",
|
||||
"axios": "^0.21.4",
|
||||
"dayjs": "^1.10.7",
|
||||
"enquire.js": "^2.1.6",
|
||||
"filepond": "^4.28.2",
|
||||
"filepond": "^4.29.1",
|
||||
"filepond-plugin-file-validate-type": "^1.2.6",
|
||||
"filepond-plugin-image-preview": "^4.6.6",
|
||||
"flv.js": "^1.5.0",
|
||||
"filepond-plugin-image-preview": "^4.6.10",
|
||||
"flv.js": "^1.6.2",
|
||||
"halo-editor": "^2.8.3",
|
||||
"marked": "^2.1.3",
|
||||
"nprogress": "^0.2.0",
|
||||
"tiny-pinyin": "^1.3.2",
|
||||
"verte": "^0.0.12",
|
||||
"vue": "^2.6.14",
|
||||
"vue-clipboard2": "^0.3.1",
|
||||
"vue-clipboard2": "^0.3.2",
|
||||
"vue-codemirror-lite": "^1.0.4",
|
||||
"vue-contextmenujs": "^1.3.13",
|
||||
"vue-count-to": "^1.0.13",
|
||||
|
@ -54,14 +54,14 @@
|
|||
"@vue/cli-plugin-unit-jest": "^4.5.13",
|
||||
"@vue/cli-service": "^4.5.13",
|
||||
"@vue/eslint-config-prettier": "^6.0.0",
|
||||
"@vue/test-utils": "^1.2.1",
|
||||
"@vue/test-utils": "^1.2.2",
|
||||
"babel-core": "7.0.0-bridge.0",
|
||||
"babel-eslint": "^10.1.0",
|
||||
"babel-jest": "^26.6.3",
|
||||
"babel-plugin-import": "^1.13.3",
|
||||
"eslint": "^6.8.0",
|
||||
"eslint-plugin-html": "^6.1.2",
|
||||
"eslint-plugin-prettier": "^3.4.0",
|
||||
"eslint-plugin-prettier": "^3.4.1",
|
||||
"eslint-plugin-vue": "^6.2.2",
|
||||
"husky": "^6.0.0",
|
||||
"less": "^3.13.1",
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<a-row type="flex" align="middle">
|
||||
<a-col :span="24">
|
||||
<a-spin :spinning="loading">
|
||||
<a-empty v-if="attachments.length == 0" />
|
||||
<a-empty v-if="attachments.length === 0" />
|
||||
<div
|
||||
v-else
|
||||
class="attach-item"
|
||||
|
@ -153,20 +153,13 @@ export default {
|
|||
}
|
||||
},
|
||||
handleJudgeMediaType(attachment) {
|
||||
var mediaType = attachment.mediaType
|
||||
const mediaType = attachment.mediaType
|
||||
// 判断文件类型
|
||||
if (mediaType) {
|
||||
var prefix = mediaType.split('/')[0]
|
||||
const prefix = mediaType.split('/')[0]
|
||||
|
||||
if (prefix === 'image') {
|
||||
// 是图片
|
||||
return true
|
||||
} else {
|
||||
// 非图片
|
||||
return false
|
||||
}
|
||||
return prefix === 'image'
|
||||
}
|
||||
// 没有获取到文件返回false
|
||||
return false
|
||||
},
|
||||
onClose() {
|
||||
|
|
|
@ -45,11 +45,11 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
handleAttachmentUpload(pos, $file) {
|
||||
var formdata = new FormData()
|
||||
const formdata = new FormData()
|
||||
formdata.append('file', $file)
|
||||
attachmentApi.upload(formdata).then(response => {
|
||||
var responseObject = response.data
|
||||
var HaloEditor = this.$refs.md
|
||||
const responseObject = response.data
|
||||
const HaloEditor = this.$refs.md
|
||||
HaloEditor.$img2Url(pos, encodeURI(responseObject.data.path))
|
||||
})
|
||||
},
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<script>
|
||||
import Tooltip from 'ant-design-vue/es/tooltip'
|
||||
import { cutStrByFullLength, getStrFullLength } from '@/components/_util/util'
|
||||
|
||||
export default {
|
||||
name: 'Ellipsis',
|
||||
components: {
|
||||
|
@ -44,8 +45,7 @@ export default {
|
|||
const { tooltip, length } = this.$props
|
||||
const str = this.$slots.default.map(vNode => vNode.text).join('')
|
||||
const fullLength = getStrFullLength(str)
|
||||
const strDom = tooltip && fullLength > length ? this.getTooltip(str, fullLength) : this.getStrDom(str, fullLength)
|
||||
return strDom
|
||||
return tooltip && fullLength > length ? this.getTooltip(str, fullLength) : this.getStrDom(str, fullLength)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
@change="handleContentWidthChange"
|
||||
>
|
||||
<a-select-option value="Fixed">固定</a-select-option>
|
||||
<a-select-option value="Fluid" v-if="layoutMode != 'sidemenu'">流式</a-select-option>
|
||||
<a-select-option value="Fluid" v-if="layoutMode !== 'sidemenu'">流式</a-select-option>
|
||||
</a-select>
|
||||
</a-tooltip>
|
||||
<a-list-item-meta>
|
||||
|
@ -230,8 +230,8 @@ export default {
|
|||
float: left;
|
||||
cursor: pointer;
|
||||
margin-right: 8px;
|
||||
padding-left: 0px;
|
||||
padding-right: 0px;
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
font-weight: 700;
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
</a-menu-item>
|
||||
<a-menu-divider />
|
||||
<a-menu-item key="1">
|
||||
<a href="javascript:;" @click="handleLogout">
|
||||
<a href="javascript:void(0);" @click="handleLogout">
|
||||
<a-icon type="logout" />
|
||||
<span>退出登录</span>
|
||||
</a>
|
||||
|
|
|
@ -37,7 +37,7 @@ import FilePondPluginImagePreview from 'filepond-plugin-image-preview'
|
|||
import 'filepond-plugin-image-preview/dist/filepond-plugin-image-preview.min.css'
|
||||
import FilePondPluginFileValidateType from 'filepond-plugin-file-validate-type'
|
||||
|
||||
// Create component and regist plugins
|
||||
// Create component and register plugins
|
||||
const FilePond = vueFilePond(FilePondPluginImagePreview, FilePondPluginFileValidateType)
|
||||
export default {
|
||||
name: 'FilePondUpload',
|
||||
|
|
|
@ -4,14 +4,15 @@ import dayjs from 'dayjs'
|
|||
import 'dayjs/locale/zh-cn'
|
||||
|
||||
import { timeAgo } from '@/utils/datetime'
|
||||
|
||||
dayjs.locale('zh-cn')
|
||||
|
||||
Vue.filter('NumberFormat', function(value) {
|
||||
if (!value) {
|
||||
return '0'
|
||||
}
|
||||
const intPartFormat = value.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') // 将整数部分逢三一断
|
||||
return intPartFormat
|
||||
// 将整数部分逢三一断
|
||||
return value.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,')
|
||||
})
|
||||
|
||||
Vue.filter('moment', function(dataStr, pattern = 'YYYY-MM-DD HH:mm') {
|
||||
|
@ -36,20 +37,18 @@ Vue.filter('fileSizeFormat', function(value) {
|
|||
if (!value) {
|
||||
return '0 Bytes'
|
||||
}
|
||||
var unitArr = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
|
||||
var index = 0
|
||||
var srcsize = parseFloat(value)
|
||||
index = Math.floor(Math.log(srcsize) / Math.log(1024))
|
||||
var size = srcsize / Math.pow(1024, index)
|
||||
const unitArr = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
|
||||
const srcsize = parseFloat(value)
|
||||
let index = Math.floor(Math.log(srcsize) / Math.log(1024))
|
||||
let size = srcsize / Math.pow(1024, index)
|
||||
size = size.toFixed(2)
|
||||
return size + ' ' + unitArr[index]
|
||||
})
|
||||
|
||||
Vue.filter('dayTime', function(value) {
|
||||
var days = Math.floor(value / 86400)
|
||||
var hours = Math.floor((value % 86400) / 3600)
|
||||
var minutes = Math.floor(((value % 86400) % 3600) / 60)
|
||||
var seconds = Math.floor(((value % 86400) % 3600) % 60)
|
||||
var duration = days + 'd ' + hours + 'h ' + minutes + 'm ' + seconds + 's'
|
||||
return duration
|
||||
const days = Math.floor(value / 86400)
|
||||
const hours = Math.floor((value % 86400) / 3600)
|
||||
const minutes = Math.floor(((value % 86400) % 3600) / 60)
|
||||
const seconds = Math.floor(((value % 86400) % 3600) % 60)
|
||||
return days + 'd ' + hours + 'h ' + minutes + 'm ' + seconds + 's'
|
||||
})
|
||||
|
|
|
@ -7,18 +7,18 @@ function datetimeFormat(datetime = new Date(), pattern = 'YYYY-MM-DD HH:mm') {
|
|||
}
|
||||
|
||||
function timeAgo(datetime) {
|
||||
var currentTime = new Date().getTime()
|
||||
var between = currentTime - datetime
|
||||
var days = Math.floor(between / (24 * 3600 * 1000))
|
||||
const currentTime = new Date().getTime()
|
||||
const between = currentTime - datetime
|
||||
const days = Math.floor(between / (24 * 3600 * 1000))
|
||||
if (days === 0) {
|
||||
var leave1 = between % (24 * 3600 * 1000)
|
||||
var hours = Math.floor(leave1 / (3600 * 1000))
|
||||
const leave1 = between % (24 * 3600 * 1000)
|
||||
const hours = Math.floor(leave1 / (3600 * 1000))
|
||||
if (hours === 0) {
|
||||
var leave2 = leave1 % (3600 * 1000)
|
||||
var minutes = Math.floor(leave2 / (60 * 1000))
|
||||
const leave2 = leave1 % (3600 * 1000)
|
||||
const minutes = Math.floor(leave2 / (60 * 1000))
|
||||
if (minutes === 0) {
|
||||
var leave3 = leave2 % (60 * 1000)
|
||||
var seconds = Math.round(leave3 / 1000)
|
||||
const leave3 = leave2 % (60 * 1000)
|
||||
const seconds = Math.round(leave3 / 1000)
|
||||
return seconds + ' 秒前'
|
||||
}
|
||||
return minutes + ' 分钟前'
|
||||
|
|
|
@ -21,8 +21,7 @@ function setTokenToHeader(config) {
|
|||
async function reRequest(error) {
|
||||
const config = error.response.config
|
||||
setTokenToHeader(config)
|
||||
const res = await axios.request(config)
|
||||
return res
|
||||
return await axios.request(config)
|
||||
}
|
||||
|
||||
let refreshTask = null
|
||||
|
@ -61,7 +60,6 @@ function getFieldValidationError(data) {
|
|||
service.interceptors.request.use(
|
||||
config => {
|
||||
config.baseURL = store.getters.apiUrl
|
||||
// TODO set token
|
||||
setTokenToHeader(config)
|
||||
return config
|
||||
},
|
||||
|
@ -92,7 +90,6 @@ service.interceptors.response.use(
|
|||
// Business response
|
||||
Vue.$log.error('Business response status', data.status)
|
||||
if (data.status === 400) {
|
||||
// TODO handle 400 status error
|
||||
const errorDetails = getFieldValidationError(data)
|
||||
if (errorDetails) {
|
||||
handled = true
|
||||
|
@ -116,7 +113,6 @@ service.interceptors.response.use(
|
|||
})
|
||||
}
|
||||
} else if (data.status === 401) {
|
||||
// TODO handle 401 status error
|
||||
if (store.getters.token && store.getters.token.access_token === data.data) {
|
||||
const res = refreshToken(error)
|
||||
if (res !== error) {
|
||||
|
|
|
@ -9,20 +9,6 @@ export function isObject(value) {
|
|||
return value && typeof value === 'object' && value.constructor === Object
|
||||
}
|
||||
|
||||
/**
|
||||
* decode html tag
|
||||
* @param {*} html
|
||||
* @returns
|
||||
* @deprecated
|
||||
*/
|
||||
export function decodeHTML(html) {
|
||||
let elem = document.createElement('div')
|
||||
elem.innerHTML = html
|
||||
const output = elem.innerText || elem.textContent
|
||||
elem = null
|
||||
return output
|
||||
}
|
||||
|
||||
export function deepClone(source) {
|
||||
if (!source && typeof source !== 'object') {
|
||||
throw new Error('error arguments', 'deepClone')
|
||||
|
|
|
@ -249,11 +249,7 @@ export default {
|
|||
},
|
||||
handleShowDetailDrawer(attachment) {
|
||||
this.selectAttachment = attachment
|
||||
if (this.supportMultipleSelection) {
|
||||
this.drawerVisible = false
|
||||
} else {
|
||||
this.drawerVisible = true
|
||||
}
|
||||
this.drawerVisible = !this.supportMultipleSelection
|
||||
},
|
||||
handleContextMenu(event, item) {
|
||||
this.$contextmenu({
|
||||
|
@ -320,18 +316,12 @@ export default {
|
|||
this.handleListTypes()
|
||||
},
|
||||
handleJudgeMediaType(attachment) {
|
||||
var mediaType = attachment.mediaType
|
||||
const mediaType = attachment.mediaType
|
||||
// 判断文件类型
|
||||
if (mediaType) {
|
||||
var prefix = mediaType.split('/')[0]
|
||||
const prefix = mediaType.split('/')[0]
|
||||
|
||||
if (prefix === 'image') {
|
||||
// 是图片
|
||||
return true
|
||||
} else {
|
||||
// 非图片
|
||||
return false
|
||||
}
|
||||
return prefix === 'image'
|
||||
}
|
||||
// 没有获取到文件返回false
|
||||
return false
|
||||
|
@ -351,24 +341,24 @@ export default {
|
|||
this.supportMultipleSelection = false
|
||||
this.drawerVisible = false
|
||||
this.batchSelectedAttachments = []
|
||||
for (var key in this.selectedCheckbox) {
|
||||
for (const key in this.selectedCheckbox) {
|
||||
this.$set(this.selectedAttachmentCheckbox, key, false)
|
||||
}
|
||||
},
|
||||
handleAttachmentSelectionChanged(e, item) {
|
||||
var isChecked = e.target.checked || false
|
||||
const isChecked = e.target.checked || false
|
||||
if (isChecked) {
|
||||
this.$set(this.selectedAttachmentCheckbox, item.id, true)
|
||||
this.batchSelectedAttachments.push(item.id)
|
||||
} else {
|
||||
this.$set(this.selectedAttachmentCheckbox, item.id, false)
|
||||
// 从选中id集合中删除id
|
||||
var index = this.batchSelectedAttachments.indexOf(item.id)
|
||||
const index = this.batchSelectedAttachments.indexOf(item.id)
|
||||
this.batchSelectedAttachments.splice(index, 1)
|
||||
}
|
||||
},
|
||||
handleDeleteAttachmentInBatch() {
|
||||
var that = this
|
||||
const that = this
|
||||
if (this.batchSelectedAttachments.length <= 0) {
|
||||
this.$message.warn('你还未选择任何附件,请至少选择一个!')
|
||||
return
|
||||
|
|
|
@ -260,18 +260,18 @@ export default {
|
|||
this.$emit('close', false)
|
||||
},
|
||||
handleJudgeMediaType(attachment) {
|
||||
var mediaType = attachment.mediaType
|
||||
const mediaType = attachment.mediaType
|
||||
// 判断文件类型
|
||||
if (mediaType) {
|
||||
var prefix = mediaType.split('/')[0]
|
||||
const prefix = mediaType.split('/')[0]
|
||||
|
||||
if (prefix === 'video' || prefix === 'flv') {
|
||||
// 控制各个组件的显示
|
||||
this.handlePreviewVisible(false, true, false)
|
||||
|
||||
// 去除视频地址后面的参数
|
||||
var lastIndex = attachment.path.lastIndexOf('?')
|
||||
var path = attachment.path.substring(0, lastIndex)
|
||||
const lastIndex = attachment.path.lastIndexOf('?')
|
||||
const path = attachment.path.substring(0, lastIndex)
|
||||
|
||||
// 设置视频地址
|
||||
this.$set(this.videoOptions.video, 'url', path)
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<a-row type="flex" align="middle">
|
||||
<a-col :span="24">
|
||||
<a-spin :spinning="loading">
|
||||
<a-empty v-if="formattedDatas.length == 0" />
|
||||
<a-empty v-if="formattedDatas.length === 0" />
|
||||
<div
|
||||
v-else
|
||||
class="attach-item"
|
||||
|
@ -196,18 +196,12 @@ export default {
|
|||
}
|
||||
},
|
||||
handleJudgeMediaType(attachment) {
|
||||
var mediaType = attachment.mediaType
|
||||
const mediaType = attachment.mediaType
|
||||
// 判断文件类型
|
||||
if (mediaType) {
|
||||
var prefix = mediaType.split('/')[0]
|
||||
const prefix = mediaType.split('/')[0]
|
||||
|
||||
if (prefix === 'image') {
|
||||
// 是图片
|
||||
return true
|
||||
} else {
|
||||
// 非图片
|
||||
return false
|
||||
}
|
||||
return prefix === 'image'
|
||||
}
|
||||
// 没有获取到文件返回false
|
||||
return false
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
</div>
|
||||
|
||||
<div class="table-operator">
|
||||
<a-dropdown v-show="queryParam.status != null && queryParam.status != '' && !isMobile()">
|
||||
<a-dropdown v-show="queryParam.status != null && queryParam.status !== '' && !isMobile()">
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item key="1" v-if="queryParam.status === 'AUDITING'">
|
||||
<a href="javascript:void(0);" @click="handleEditStatusMore(commentStatus.PUBLISHED.value)">
|
||||
|
@ -74,13 +74,13 @@
|
|||
</span>
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item v-if="item.status === 'AUDITING'">
|
||||
<a href="javascript:;" @click="handleEditStatusClick(item.id, 'PUBLISHED')">通过</a>
|
||||
<a href="javascript:void(0);" @click="handleEditStatusClick(item.id, 'PUBLISHED')">通过</a>
|
||||
</a-menu-item>
|
||||
<a-menu-item v-if="item.status === 'AUDITING'">
|
||||
<a href="javascript:;" @click="handleReplyAndPassClick(item)">通过并回复</a>
|
||||
<a href="javascript:void(0);" @click="handleReplyAndPassClick(item)">通过并回复</a>
|
||||
</a-menu-item>
|
||||
<a-menu-item v-else-if="item.status === 'PUBLISHED'">
|
||||
<a href="javascript:;" @click="handleReplyClick(item)">回复</a>
|
||||
<a href="javascript:void(0);" @click="handleReplyClick(item)">回复</a>
|
||||
</a-menu-item>
|
||||
<a-menu-item v-else-if="item.status === 'RECYCLE'">
|
||||
<a-popconfirm
|
||||
|
@ -89,7 +89,7 @@
|
|||
okText="确定"
|
||||
cancelText="取消"
|
||||
>
|
||||
<a href="javascript:;">还原</a>
|
||||
<a href="javascript:void(0);">还原</a>
|
||||
</a-popconfirm>
|
||||
</a-menu-item>
|
||||
<a-menu-item v-if="item.status === 'PUBLISHED' || item.status === 'AUDITING'">
|
||||
|
@ -99,7 +99,7 @@
|
|||
okText="确定"
|
||||
cancelText="取消"
|
||||
>
|
||||
<a href="javascript:;">回收站</a>
|
||||
<a href="javascript:void(0);">回收站</a>
|
||||
</a-popconfirm>
|
||||
</a-menu-item>
|
||||
<a-menu-item v-else-if="item.status === 'RECYCLE'">
|
||||
|
@ -109,7 +109,7 @@
|
|||
okText="确定"
|
||||
cancelText="取消"
|
||||
>
|
||||
<a href="javascript:;">删除</a>
|
||||
<a href="javascript:void(0);">删除</a>
|
||||
</a-popconfirm>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
|
@ -212,7 +212,7 @@
|
|||
cancelText="取消"
|
||||
v-else-if="record.status === 'RECYCLE'"
|
||||
>
|
||||
<a href="javascript:;">还原</a>
|
||||
<a href="javascript:void(0);">还原</a>
|
||||
</a-popconfirm>
|
||||
|
||||
<a-divider type="vertical" />
|
||||
|
@ -224,7 +224,7 @@
|
|||
cancelText="取消"
|
||||
v-if="record.status === 'PUBLISHED' || record.status === 'AUDITING'"
|
||||
>
|
||||
<a href="javascript:;">回收站</a>
|
||||
<a href="javascript:void(0);">回收站</a>
|
||||
</a-popconfirm>
|
||||
|
||||
<a-popconfirm
|
||||
|
@ -234,7 +234,7 @@
|
|||
cancelText="取消"
|
||||
v-else-if="record.status === 'RECYCLE'"
|
||||
>
|
||||
<a href="javascript:;">删除</a>
|
||||
<a href="javascript:void(0);">删除</a>
|
||||
</a-popconfirm>
|
||||
</span>
|
||||
</a-table>
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<a-divider />
|
||||
<a-col :span="24">
|
||||
<a-spin :spinning="list.loading">
|
||||
<a-empty v-if="list.data.length == 0" />
|
||||
<a-empty v-if="list.data.length === 0" />
|
||||
<TargetCommentTree
|
||||
v-else
|
||||
v-for="(comment, index) in list.data"
|
||||
|
|
|
@ -50,20 +50,20 @@
|
|||
<a-list-item slot="renderItem" slot-scope="item, index" :key="index">
|
||||
<a-list-item-meta>
|
||||
<a
|
||||
v-if="item.status == 'PUBLISHED' || item.status == 'INTIMATE'"
|
||||
v-if="['PUBLISHED', 'INTIMATE'].includes(item.status)"
|
||||
slot="title"
|
||||
:href="item.fullPath"
|
||||
target="_blank"
|
||||
>{{ item.title }}</a
|
||||
>
|
||||
<a
|
||||
v-else-if="item.status == 'DRAFT'"
|
||||
v-else-if="item.status === 'DRAFT'"
|
||||
slot="title"
|
||||
href="javascript:void(0)"
|
||||
@click="handlePostPreview(item.id)"
|
||||
>{{ item.title }}</a
|
||||
>
|
||||
<a v-else-if="item.status == 'RECYCLE'" slot="title" href="javascript:void(0);" disabled>
|
||||
<a v-else-if="item.status === 'RECYCLE'" slot="title" href="javascript:void(0);" disabled>
|
||||
{{ item.title }}
|
||||
</a>
|
||||
</a-list-item-meta>
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
<a-comment :avatar="item.avatar">
|
||||
<template slot="author" v-if="type === 'posts'">
|
||||
<a :href="item.authorUrl" target="_blank">{{ item.author }}</a> 发表在 《<a
|
||||
v-if="item.post.status == 'PUBLISHED' || item.post.status == 'INTIMATE'"
|
||||
v-if="['PUBLISHED', 'INTIMATE'].includes(item.post.status)"
|
||||
:href="item.post.fullPath"
|
||||
target="_blank"
|
||||
>{{ item.post.title }}</a
|
||||
><a
|
||||
v-else-if="item.post.status == 'DRAFT'"
|
||||
v-else-if="item.post.status === 'DRAFT'"
|
||||
href="javascript:void(0)"
|
||||
@click="handlePostPreview(item.post.id)"
|
||||
>{{ item.post.title }}</a
|
||||
|
@ -18,12 +18,12 @@
|
|||
</template>
|
||||
<template slot="author" v-else-if="type === 'sheets'">
|
||||
<a :href="item.authorUrl" target="_blank">{{ item.author }}</a> 发表在 《<a
|
||||
v-if="item.sheet.status == 'PUBLISHED'"
|
||||
v-if="item.sheet.status === 'PUBLISHED'"
|
||||
:href="item.sheet.fullPath"
|
||||
target="_blank"
|
||||
>{{ item.sheet.title }}</a
|
||||
><a
|
||||
v-else-if="item.sheet.status == 'DRAFT'"
|
||||
v-else-if="item.sheet.status === 'DRAFT'"
|
||||
href="javascript:void(0)"
|
||||
@click="handleSheetPreview(item.sheet.id)"
|
||||
>{{ item.sheet.title }}</a
|
||||
|
|
|
@ -265,9 +265,9 @@ export default {
|
|||
return menus
|
||||
},
|
||||
handleGetMenusWithoutLevel(menus, result) {
|
||||
for (var i = 0; i < menus.length; i++) {
|
||||
for (let i = 0; i < menus.length; i++) {
|
||||
result.push(menus[i])
|
||||
var children = menus[i].children
|
||||
const children = menus[i].children
|
||||
if (children.length > 0) {
|
||||
this.handleGetMenusWithoutLevel(children, result)
|
||||
}
|
||||
|
|
|
@ -29,25 +29,25 @@
|
|||
<a-tab-pane v-for="(group, index) in themeConfigurations" :key="index.toString()" :tab="group.label">
|
||||
<a-form layout="vertical" :wrapperCol="wrapperCol">
|
||||
<a-form-item v-for="(item, index1) in group.items" :label="item.label + ':'" :key="index1">
|
||||
<p v-if="item.description && item.description != ''" slot="help" v-html="item.description"></p>
|
||||
<p v-if="item.description && item.description !== ''" slot="help" v-html="item.description"></p>
|
||||
<a-input
|
||||
v-model="themeSettings[item.name]"
|
||||
:defaultValue="item.defaultValue"
|
||||
:placeholder="item.placeholder"
|
||||
v-if="item.type == 'TEXT'"
|
||||
v-if="item.type === 'TEXT'"
|
||||
/>
|
||||
<a-input
|
||||
type="textarea"
|
||||
:autoSize="{ minRows: 5 }"
|
||||
v-model="themeSettings[item.name]"
|
||||
:placeholder="item.placeholder"
|
||||
v-else-if="item.type == 'TEXTAREA'"
|
||||
v-else-if="item.type === 'TEXTAREA'"
|
||||
/>
|
||||
<a-radio-group
|
||||
v-decorator="['radio-group']"
|
||||
:defaultValue="item.defaultValue"
|
||||
v-model="themeSettings[item.name]"
|
||||
v-else-if="item.type == 'RADIO'"
|
||||
v-else-if="item.type === 'RADIO'"
|
||||
>
|
||||
<a-radio v-for="(option, index2) in item.options" :key="index2" :value="option.value">{{
|
||||
option.label
|
||||
|
@ -56,7 +56,7 @@
|
|||
<a-select
|
||||
v-model="themeSettings[item.name]"
|
||||
:defaultValue="item.defaultValue"
|
||||
v-else-if="item.type == 'SELECT'"
|
||||
v-else-if="item.type === 'SELECT'"
|
||||
>
|
||||
<a-select-option v-for="option in item.options" :key="option.value" :value="option.value">{{
|
||||
option.label
|
||||
|
@ -67,13 +67,13 @@
|
|||
model="hex"
|
||||
v-model="themeSettings[item.name]"
|
||||
:defaultValue="item.defaultValue"
|
||||
v-else-if="item.type == 'COLOR'"
|
||||
v-else-if="item.type === 'COLOR'"
|
||||
style="display: inline-block;height: 24px;"
|
||||
></verte>
|
||||
<a-input
|
||||
v-model="themeSettings[item.name]"
|
||||
:defaultValue="item.defaultValue"
|
||||
v-else-if="item.type == 'ATTACHMENT'"
|
||||
v-else-if="item.type === 'ATTACHMENT'"
|
||||
>
|
||||
<a href="javascript:void(0);" slot="addonAfter" @click="handleShowSelectAttachment(item.name)">
|
||||
<a-icon type="picture" />
|
||||
|
@ -82,13 +82,13 @@
|
|||
<a-input-number
|
||||
v-model="themeSettings[item.name]"
|
||||
:defaultValue="item.defaultValue"
|
||||
v-else-if="item.type == 'NUMBER'"
|
||||
v-else-if="item.type === 'NUMBER'"
|
||||
style="width:100%"
|
||||
/>
|
||||
<a-switch
|
||||
v-model="themeSettings[item.name]"
|
||||
:defaultChecked="item.defaultValue"
|
||||
v-else-if="item.type == 'SWITCH'"
|
||||
v-else-if="item.type === 'SWITCH'"
|
||||
/>
|
||||
<a-input
|
||||
v-model="themeSettings[item.name]"
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
<router-link :to="{ name: 'PostWrite' }">
|
||||
<a-button type="primary" icon="plus">写文章</a-button>
|
||||
</router-link>
|
||||
<a-dropdown v-show="queryParam.status != null && queryParam.status != '' && !isMobile()">
|
||||
<a-dropdown v-show="queryParam.status != null && queryParam.status !== '' && !isMobile()">
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item key="1" v-if="queryParam.status === 'DRAFT' || queryParam.status === 'RECYCLE'">
|
||||
<a href="javascript:void(0);" @click="handleEditStatusMore(postStatus.PUBLISHED.value)">
|
||||
|
@ -117,7 +117,7 @@
|
|||
<a-menu-item
|
||||
v-if="item.status === 'PUBLISHED' || item.status === 'DRAFT' || item.status === 'INTIMATE'"
|
||||
>
|
||||
<a href="javascript:;" @click="handleEditClick(item)">编辑</a>
|
||||
<a href="javascript:void(0);" @click="handleEditClick(item)">编辑</a>
|
||||
</a-menu-item>
|
||||
<a-menu-item v-else-if="item.status === 'RECYCLE'">
|
||||
<a-popconfirm
|
||||
|
@ -126,7 +126,7 @@
|
|||
okText="确定"
|
||||
cancelText="取消"
|
||||
>
|
||||
<a href="javascript:;">还原</a>
|
||||
<a href="javascript:void(0);">还原</a>
|
||||
</a-popconfirm>
|
||||
</a-menu-item>
|
||||
<a-menu-item
|
||||
|
@ -138,7 +138,7 @@
|
|||
okText="确定"
|
||||
cancelText="取消"
|
||||
>
|
||||
<a href="javascript:;">回收站</a>
|
||||
<a href="javascript:void(0);">回收站</a>
|
||||
</a-popconfirm>
|
||||
</a-menu-item>
|
||||
<a-menu-item v-else-if="item.status === 'RECYCLE'">
|
||||
|
@ -148,7 +148,7 @@
|
|||
okText="确定"
|
||||
cancelText="取消"
|
||||
>
|
||||
<a href="javascript:;">删除</a>
|
||||
<a href="javascript:void(0);">删除</a>
|
||||
</a-popconfirm>
|
||||
</a-menu-item>
|
||||
<a-menu-item>
|
||||
|
@ -174,13 +174,13 @@
|
|||
>
|
||||
<a-icon
|
||||
type="pushpin"
|
||||
v-if="item.topPriority != 0"
|
||||
v-if="item.topPriority !== 0"
|
||||
theme="twoTone"
|
||||
twoToneColor="red"
|
||||
style="margin-right: 3px;"
|
||||
/>
|
||||
<a
|
||||
v-if="item.status == 'PUBLISHED' || item.status == 'INTIMATE'"
|
||||
v-if="['PUBLISHED', 'INTIMATE'].includes(item.status)"
|
||||
:href="item.fullPath"
|
||||
target="_blank"
|
||||
class="no-underline"
|
||||
|
@ -188,7 +188,7 @@
|
|||
<a-tooltip placement="top" :title="'点击访问【' + item.title + '】'">{{ item.title }}</a-tooltip>
|
||||
</a>
|
||||
<a
|
||||
v-else-if="item.status == 'DRAFT'"
|
||||
v-else-if="item.status === 'DRAFT'"
|
||||
href="javascript:void(0)"
|
||||
class="no-underline"
|
||||
@click="handlePreview(item.id)"
|
||||
|
@ -240,13 +240,13 @@
|
|||
<span slot="postTitle" slot-scope="text, record">
|
||||
<a-icon
|
||||
type="pushpin"
|
||||
v-if="record.topPriority != 0"
|
||||
v-if="record.topPriority !== 0"
|
||||
theme="twoTone"
|
||||
twoToneColor="red"
|
||||
style="margin-right: 3px;"
|
||||
/>
|
||||
<a
|
||||
v-if="record.status == 'PUBLISHED' || record.status == 'INTIMATE'"
|
||||
v-if="['PUBLISHED', 'INTIMATE'].includes(record.status)"
|
||||
:href="record.fullPath"
|
||||
target="_blank"
|
||||
class="no-underline"
|
||||
|
@ -254,7 +254,7 @@
|
|||
<a-tooltip placement="top" :title="'点击访问【' + text + '】'">{{ text }}</a-tooltip>
|
||||
</a>
|
||||
<a
|
||||
v-else-if="record.status == 'DRAFT'"
|
||||
v-else-if="record.status === 'DRAFT'"
|
||||
href="javascript:void(0)"
|
||||
class="no-underline"
|
||||
@click="handlePreview(record.id)"
|
||||
|
@ -320,7 +320,7 @@
|
|||
|
||||
<span slot="action" slot-scope="text, post">
|
||||
<a
|
||||
href="javascript:;"
|
||||
href="javascript:void(0);"
|
||||
@click="handleEditClick(post)"
|
||||
v-if="post.status === 'PUBLISHED' || post.status === 'DRAFT' || post.status === 'INTIMATE'"
|
||||
>编辑</a
|
||||
|
@ -332,7 +332,7 @@
|
|||
cancelText="取消"
|
||||
v-else-if="post.status === 'RECYCLE'"
|
||||
>
|
||||
<a href="javascript:;">还原</a>
|
||||
<a href="javascript:void(0);">还原</a>
|
||||
</a-popconfirm>
|
||||
|
||||
<a-divider type="vertical" />
|
||||
|
@ -344,7 +344,7 @@
|
|||
cancelText="取消"
|
||||
v-if="post.status === 'PUBLISHED' || post.status === 'DRAFT' || post.status === 'INTIMATE'"
|
||||
>
|
||||
<a href="javascript:;">回收站</a>
|
||||
<a href="javascript:void(0);">回收站</a>
|
||||
</a-popconfirm>
|
||||
|
||||
<a-popconfirm
|
||||
|
@ -354,12 +354,12 @@
|
|||
cancelText="取消"
|
||||
v-else-if="post.status === 'RECYCLE'"
|
||||
>
|
||||
<a href="javascript:;">删除</a>
|
||||
<a href="javascript:void(0);">删除</a>
|
||||
</a-popconfirm>
|
||||
|
||||
<a-divider type="vertical" />
|
||||
|
||||
<a href="javascript:;" @click="handleShowPostSettings(post)">设置</a>
|
||||
<a href="javascript:void(0);" @click="handleShowPostSettings(post)">设置</a>
|
||||
</span>
|
||||
</a-table>
|
||||
<div class="page-wrapper">
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
<a-col :xl="14" :lg="14" :md="14" :sm="24" :xs="24" class="pb-3">
|
||||
<a-card title="所有标签" :bodyStyle="{ padding: '16px' }">
|
||||
<a-spin :spinning="list.loading">
|
||||
<a-empty v-if="list.data.length == 0" />
|
||||
<a-empty v-if="list.data.length === 0" />
|
||||
<a-tooltip placement="topLeft" v-for="tag in list.data" :key="tag.id" v-else>
|
||||
<template slot="title">
|
||||
<span>{{ tag.postCount }} 篇文章</span>
|
||||
|
|
|
@ -342,7 +342,7 @@ export default {
|
|||
},
|
||||
pickerDefaultValue() {
|
||||
if (this.selectedPost.createTime) {
|
||||
var date = new Date(this.selectedPost.createTime)
|
||||
const date = new Date(this.selectedPost.createTime)
|
||||
return datetimeFormat(date, 'YYYY-MM-DD HH:mm:ss')
|
||||
}
|
||||
return datetimeFormat(new Date(), 'YYYY-MM-DD HH:mm:ss')
|
||||
|
@ -522,7 +522,7 @@ export default {
|
|||
this.selectedPost.createTime = value.valueOf()
|
||||
},
|
||||
handleRemovePostMeta(item) {
|
||||
var index = this.selectedMetas.indexOf(item)
|
||||
const index = this.selectedMetas.indexOf(item)
|
||||
if (index !== -1) {
|
||||
this.selectedMetas.splice(index, 1)
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
</span>
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item v-if="item.status === 'PUBLISHED' || item.status === 'DRAFT'">
|
||||
<a href="javascript:;" @click="handleEditClick(item)">编辑</a>
|
||||
<a href="javascript:void(0);" @click="handleEditClick(item)">编辑</a>
|
||||
</a-menu-item>
|
||||
<a-menu-item v-else-if="item.status === 'RECYCLE'">
|
||||
<a-popconfirm
|
||||
|
@ -34,7 +34,7 @@
|
|||
okText="确定"
|
||||
cancelText="取消"
|
||||
>
|
||||
<a href="javascript:;">还原</a>
|
||||
<a href="javascript:void(0);">还原</a>
|
||||
</a-popconfirm>
|
||||
</a-menu-item>
|
||||
<a-menu-item v-if="item.status === 'PUBLISHED' || item.status === 'DRAFT'">
|
||||
|
@ -44,7 +44,7 @@
|
|||
okText="确定"
|
||||
cancelText="取消"
|
||||
>
|
||||
<a href="javascript:;">回收站</a>
|
||||
<a href="javascript:void(0);">回收站</a>
|
||||
</a-popconfirm>
|
||||
</a-menu-item>
|
||||
<a-menu-item v-else-if="item.status === 'RECYCLE'">
|
||||
|
@ -54,7 +54,7 @@
|
|||
okText="确定"
|
||||
cancelText="取消"
|
||||
>
|
||||
<a href="javascript:;">删除</a>
|
||||
<a href="javascript:void(0);">删除</a>
|
||||
</a-popconfirm>
|
||||
</a-menu-item>
|
||||
<a-menu-item>
|
||||
|
@ -76,11 +76,11 @@
|
|||
slot="title"
|
||||
style="max-width: 300px;display: block;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"
|
||||
>
|
||||
<a v-if="item.status == 'PUBLISHED'" :href="item.fullPath" target="_blank" class="no-underline">
|
||||
<a v-if="item.status === 'PUBLISHED'" :href="item.fullPath" target="_blank" class="no-underline">
|
||||
<a-tooltip placement="top" :title="'点击访问【' + item.title + '】'">{{ item.title }}</a-tooltip>
|
||||
</a>
|
||||
<a
|
||||
v-else-if="item.status == 'DRAFT'"
|
||||
v-else-if="item.status === 'DRAFT'"
|
||||
href="javascript:void(0)"
|
||||
class="no-underline"
|
||||
@click="handlePreview(item.id)"
|
||||
|
@ -107,11 +107,11 @@
|
|||
:scrollToFirstRowOnChange="true"
|
||||
>
|
||||
<span slot="sheetTitle" slot-scope="text, record">
|
||||
<a v-if="record.status == 'PUBLISHED'" :href="record.fullPath" target="_blank" class="no-underline">
|
||||
<a v-if="record.status === 'PUBLISHED'" :href="record.fullPath" target="_blank" class="no-underline">
|
||||
<a-tooltip placement="top" :title="'点击访问【' + text + '】'">{{ text }}</a-tooltip>
|
||||
</a>
|
||||
<a
|
||||
v-else-if="record.status == 'DRAFT'"
|
||||
v-else-if="record.status === 'DRAFT'"
|
||||
href="javascript:void(0)"
|
||||
class="no-underline"
|
||||
@click="handlePreview(record.id)"
|
||||
|
@ -156,7 +156,7 @@
|
|||
|
||||
<span slot="action" slot-scope="text, sheet">
|
||||
<a
|
||||
href="javascript:;"
|
||||
href="javascript:void(0);"
|
||||
@click="handleEditClick(sheet)"
|
||||
v-if="sheet.status === 'PUBLISHED' || sheet.status === 'DRAFT'"
|
||||
>编辑</a
|
||||
|
@ -169,7 +169,7 @@
|
|||
cancelText="取消"
|
||||
v-else-if="sheet.status === 'RECYCLE'"
|
||||
>
|
||||
<a href="javascript:;">还原</a>
|
||||
<a href="javascript:void(0);">还原</a>
|
||||
</a-popconfirm>
|
||||
|
||||
<a-divider type="vertical" />
|
||||
|
@ -181,7 +181,7 @@
|
|||
cancelText="取消"
|
||||
v-if="sheet.status === 'PUBLISHED' || sheet.status === 'DRAFT'"
|
||||
>
|
||||
<a href="javascript:;">回收站</a>
|
||||
<a href="javascript:void(0);">回收站</a>
|
||||
</a-popconfirm>
|
||||
|
||||
<a-popconfirm
|
||||
|
@ -191,7 +191,7 @@
|
|||
cancelText="取消"
|
||||
v-else-if="sheet.status === 'RECYCLE'"
|
||||
>
|
||||
<a href="javascript:;">删除</a>
|
||||
<a href="javascript:void(0);">删除</a>
|
||||
</a-popconfirm>
|
||||
<a-divider type="vertical" />
|
||||
<a href="javascript:void(0);" @click="handleShowSheetSettings(sheet)">设置</a>
|
||||
|
|
|
@ -245,7 +245,7 @@ export default {
|
|||
},
|
||||
pickerDefaultValue() {
|
||||
if (this.selectedSheet.createTime) {
|
||||
var date = new Date(this.selectedSheet.createTime)
|
||||
const date = new Date(this.selectedSheet.createTime)
|
||||
return datetimeFormat(date, 'YYYY-MM-DD HH:mm:ss')
|
||||
}
|
||||
return datetimeFormat(new Date(), 'YYYY-MM-DD HH:mm:ss')
|
||||
|
@ -385,7 +385,7 @@ export default {
|
|||
this.selectedSheet.createTime = value.valueOf()
|
||||
},
|
||||
handleRemoveSheetMeta(item) {
|
||||
var index = this.selectedMetas.indexOf(item)
|
||||
const index = this.selectedMetas.indexOf(item)
|
||||
if (index !== -1) {
|
||||
this.selectedMetas.splice(index, 1)
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
</div>
|
||||
<a-divider />
|
||||
<div class="mt-4">
|
||||
<a-empty v-if="!list.loading && list.data.length == 0" />
|
||||
<a-empty v-if="!list.loading && list.data.length === 0" />
|
||||
<a-list v-else itemLayout="vertical" :pagination="false" :dataSource="list.data" :loading="list.loading">
|
||||
<a-list-item slot="renderItem" slot-scope="item, index" :key="index">
|
||||
<template slot="actions">
|
||||
|
@ -52,7 +52,7 @@
|
|||
{{ item.commentCount }}
|
||||
</a>
|
||||
</span>
|
||||
<span v-if="item.type == 'INTIMATE'">
|
||||
<span v-if="item.type === 'INTIMATE'">
|
||||
<a href="javascript:void(0);" disabled>
|
||||
<a-icon type="lock" />
|
||||
</a>
|
||||
|
|
|
@ -86,7 +86,7 @@
|
|||
okText="确定"
|
||||
cancelText="取消"
|
||||
>
|
||||
<a href="javascript:;">删除</a>
|
||||
<a href="javascript:void(0);">删除</a>
|
||||
</a-popconfirm>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
|
@ -133,7 +133,7 @@
|
|||
okText="确定"
|
||||
cancelText="取消"
|
||||
>
|
||||
<a href="javascript:;">删除</a>
|
||||
<a href="javascript:void(0);">删除</a>
|
||||
</a-popconfirm>
|
||||
</span>
|
||||
</a-table>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<a-row type="flex" justify="center" align="middle" class="h-screen">
|
||||
<a-col :xxl="8" :xl="12" :lg="16" :md="20" :sm="20" :xs="23">
|
||||
<div class="card-container animated fadeIn">
|
||||
<a-card :bordered="false" style="box-shadow: rgba(99, 99, 99, 0.2) 0px 2px 8px 0px;">
|
||||
<a-card :bordered="false" style="box-shadow: rgba(99, 99, 99, 0.2) 0 2px 8px 0;">
|
||||
<div class="halo-logo">
|
||||
<span
|
||||
>Halo
|
||||
|
@ -195,7 +195,7 @@ export default {
|
|||
async handleVerifyIsInstall() {
|
||||
const response = await adminApi.isInstalled()
|
||||
if (response.data.data) {
|
||||
this.$router.push({ name: 'Login' })
|
||||
await this.$router.push({ name: 'Login' })
|
||||
}
|
||||
},
|
||||
handleInstall() {
|
||||
|
@ -242,7 +242,7 @@ export default {
|
|||
migrateApi
|
||||
.migrate(this.form.importData)
|
||||
.then(() => {
|
||||
this.$log.debug('Migrated successfullly')
|
||||
this.$log.debug('Migrated successfully')
|
||||
})
|
||||
.catch(() => {
|
||||
this.form.importErrored = true
|
||||
|
|
|
@ -166,11 +166,11 @@ export default {
|
|||
}
|
||||
},
|
||||
created() {
|
||||
this.hanldeListOptions()
|
||||
this.handleListOptions()
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['refreshUserCache', 'refreshOptionsCache']),
|
||||
hanldeListOptions() {
|
||||
handleListOptions() {
|
||||
optionApi.listAll().then(response => {
|
||||
this.options = response.data.data
|
||||
})
|
||||
|
@ -189,7 +189,7 @@ export default {
|
|||
setTimeout(() => {
|
||||
this.saving = false
|
||||
}, 400)
|
||||
this.hanldeListOptions()
|
||||
this.handleListOptions()
|
||||
this.refreshOptionsCache()
|
||||
this.refreshUserCache()
|
||||
})
|
||||
|
|
|
@ -134,8 +134,8 @@ export default {
|
|||
backupApi
|
||||
.fetchWorkDir(item.filename)
|
||||
.then(response => {
|
||||
var downloadElement = document.createElement('a')
|
||||
var href = new window.URL(response.data.data.downloadLink)
|
||||
const downloadElement = document.createElement('a')
|
||||
const href = new window.URL(response.data.data.downloadLink)
|
||||
downloadElement.href = href
|
||||
downloadElement.download = response.data.data.filename
|
||||
document.body.appendChild(downloadElement)
|
||||
|
|
|
@ -134,8 +134,8 @@ export default {
|
|||
backupApi
|
||||
.fetchData(item.filename)
|
||||
.then(response => {
|
||||
var downloadElement = document.createElement('a')
|
||||
var href = new window.URL(response.data.data.downloadLink)
|
||||
const downloadElement = document.createElement('a')
|
||||
const href = new window.URL(response.data.data.downloadLink)
|
||||
downloadElement.href = href
|
||||
downloadElement.download = response.data.data.filename
|
||||
document.body.appendChild(downloadElement)
|
||||
|
|
|
@ -141,8 +141,8 @@ export default {
|
|||
backupApi
|
||||
.fetchMarkdown(item.filename)
|
||||
.then(response => {
|
||||
var downloadElement = document.createElement('a')
|
||||
var href = new window.URL(response.data.data.downloadLink)
|
||||
const downloadElement = document.createElement('a')
|
||||
const href = new window.URL(response.data.data.downloadLink)
|
||||
downloadElement.href = href
|
||||
downloadElement.download = response.data.data.filename
|
||||
document.body.appendChild(downloadElement)
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
<a-table
|
||||
:rowKey="option => option.id"
|
||||
:columns="columns"
|
||||
:dataSource="formattedDatas"
|
||||
:dataSource="formattedData"
|
||||
:loading="loading"
|
||||
:pagination="false"
|
||||
:scrollToFirstRowOnChange="true"
|
||||
|
@ -70,7 +70,7 @@
|
|||
cancelText="取消"
|
||||
@confirm="handleDeleteOption(record.id)"
|
||||
>
|
||||
<a href="javascript:;">删除</a>
|
||||
<a href="javascript:void(0);">删除</a>
|
||||
</a-popconfirm>
|
||||
</span>
|
||||
</a-table>
|
||||
|
@ -194,7 +194,7 @@ export default {
|
|||
}
|
||||
},
|
||||
computed: {
|
||||
formattedDatas() {
|
||||
formattedData() {
|
||||
return this.options.map(option => {
|
||||
option.typeProperty = this.optionType[option.type]
|
||||
return option
|
||||
|
|
|
@ -70,9 +70,9 @@ export default {
|
|||
adminApi
|
||||
.getLogFiles(this.logLines)
|
||||
.then(response => {
|
||||
var blob = new Blob([response.data.data])
|
||||
var downloadElement = document.createElement('a')
|
||||
var href = window.URL.createObjectURL(blob)
|
||||
const blob = new Blob([response.data.data])
|
||||
const downloadElement = document.createElement('a')
|
||||
const href = window.URL.createObjectURL(blob)
|
||||
downloadElement.href = href
|
||||
downloadElement.download = 'halo-log-' + datetimeFormat(new Date(), 'YYYY-MM-DD-HH-mm-ss') + '.log'
|
||||
document.body.appendChild(downloadElement)
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
ref="attachmentOptionsForm"
|
||||
:model="options"
|
||||
:rules="rules"
|
||||
layout="vertical"
|
||||
:wrapperCol="wrapperCol"
|
||||
layout="vertical"
|
||||
>
|
||||
<a-form-model-item label="上传图片时预览:">
|
||||
<a-switch v-model="options.attachment_upload_image_preview_enable" />
|
||||
|
@ -18,21 +18,21 @@
|
|||
</a-form-model-item>
|
||||
<a-form-model-item label="存储位置:">
|
||||
<a-select v-model="options.attachment_type">
|
||||
<a-select-option v-for="item in Object.keys(attachmentType)" :key="item" :value="item">{{
|
||||
attachmentType[item].text
|
||||
}}</a-select-option>
|
||||
<a-select-option v-for="item in Object.keys(attachmentType)" :key="item" :value="item">
|
||||
{{ attachmentType[item].text }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</a-form-model-item>
|
||||
<div id="smmsForm" v-show="options.attachment_type === 'SMMS'">
|
||||
<div v-show="options.attachment_type === 'SMMS'" id="smmsForm">
|
||||
<a-form-model-item label="Secret Token:">
|
||||
<a-input-password
|
||||
v-model="options.smms_api_secret_token"
|
||||
placeholder="需要到 sm.ms 官网注册后获取"
|
||||
autocomplete="new-password"
|
||||
placeholder="需要到 sm.ms 官网注册后获取"
|
||||
/>
|
||||
</a-form-model-item>
|
||||
</div>
|
||||
<div id="upOssForm" v-show="options.attachment_type === 'UPOSS'">
|
||||
<div v-show="options.attachment_type === 'UPOSS'" id="upOssForm">
|
||||
<a-form-model-item label="绑定域名协议:">
|
||||
<a-select v-model="options.oss_upyun_domain_protocol">
|
||||
<a-select-option value="https://">HTTPS</a-select-option>
|
||||
|
@ -64,7 +64,7 @@
|
|||
/>
|
||||
</a-form-model-item>
|
||||
</div>
|
||||
<div id="qiniuOssForm" v-show="options.attachment_type === 'QINIUOSS'">
|
||||
<div v-show="options.attachment_type === 'QINIUOSS'" id="qiniuOssForm">
|
||||
<a-form-model-item label="绑定域名协议:">
|
||||
<a-select v-model="options.oss_qiniu_domain_protocol">
|
||||
<a-select-option value="https://">HTTPS</a-select-option>
|
||||
|
@ -75,7 +75,7 @@
|
|||
<a-input v-model="options.oss_qiniu_domain" placeholder="无需再加上 http:// 或者 https://" />
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="区域:">
|
||||
<a-auto-complete :dataSource="qiniuOssZones" v-model="options.oss_qiniu_zone" allowClear />
|
||||
<a-auto-complete v-model="options.oss_qiniu_zone" :dataSource="qiniuOssZones" allowClear />
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="Access Key:">
|
||||
<a-input-password v-model="options.oss_qiniu_access_key" autocomplete="new-password" />
|
||||
|
@ -99,7 +99,7 @@
|
|||
/>
|
||||
</a-form-model-item>
|
||||
</div>
|
||||
<div id="aliOssForm" v-show="options.attachment_type === 'ALIOSS'">
|
||||
<div v-show="options.attachment_type === 'ALIOSS'" id="aliOssForm">
|
||||
<a-form-model-item label="绑定域名协议:">
|
||||
<a-select v-model="options.oss_ali_domain_protocol">
|
||||
<a-select-option value="https://">HTTPS</a-select-option>
|
||||
|
@ -134,7 +134,7 @@
|
|||
/>
|
||||
</a-form-model-item>
|
||||
</div>
|
||||
<div id="baiduBosForm" v-show="options.attachment_type === 'BAIDUBOS'">
|
||||
<div v-show="options.attachment_type === 'BAIDUBOS'" id="baiduBosForm">
|
||||
<a-form-model-item label="绑定域名协议:">
|
||||
<a-select v-model="options.bos_baidu_domain_protocol">
|
||||
<a-select-option value="https://">HTTPS</a-select-option>
|
||||
|
@ -166,7 +166,7 @@
|
|||
/>
|
||||
</a-form-model-item>
|
||||
</div>
|
||||
<div id="tencentCosForm" v-show="options.attachment_type === 'TENCENTCOS'">
|
||||
<div v-show="options.attachment_type === 'TENCENTCOS'" id="tencentCosForm">
|
||||
<a-form-model-item label="绑定域名协议:">
|
||||
<a-select v-model="options.cos_tencent_domain_protocol">
|
||||
<a-select-option value="https://">HTTPS</a-select-option>
|
||||
|
@ -180,7 +180,7 @@
|
|||
<a-input v-model="options.cos_tencent_bucket_name" placeholder="存储桶名称" />
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="区域:">
|
||||
<a-auto-complete :dataSource="tencentCosRegions" v-model="options.cos_tencent_region" allowClear />
|
||||
<a-auto-complete v-model="options.cos_tencent_region" :dataSource="tencentCosRegions" allowClear />
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="Secret Id:">
|
||||
<a-input-password v-model="options.cos_tencent_secret_id" autocomplete="new-password" />
|
||||
|
@ -201,7 +201,7 @@
|
|||
/>
|
||||
</a-form-model-item>
|
||||
</div>
|
||||
<div id="huaweiObsForm" v-show="options.attachment_type === 'HUAWEIOBS'">
|
||||
<div v-show="options.attachment_type === 'HUAWEIOBS'" id="huaweiObsForm">
|
||||
<a-form-model-item label="绑定域名协议:">
|
||||
<a-select v-model="options.obs_huawei_domain_protocol">
|
||||
<a-select-option value="https://">HTTPS</a-select-option>
|
||||
|
@ -236,7 +236,7 @@
|
|||
/>
|
||||
</a-form-model-item>
|
||||
</div>
|
||||
<div id="minioForm" v-show="options.attachment_type === 'MINIO'">
|
||||
<div v-show="options.attachment_type === 'MINIO'" id="minioForm">
|
||||
<a-form-model-item label="EndPoint(终端节点):">
|
||||
<a-input v-model="options.minio_endpoint" placeholder="Endpoint" />
|
||||
</a-form-model-item>
|
||||
|
@ -258,14 +258,14 @@
|
|||
</div>
|
||||
<a-form-model-item>
|
||||
<ReactiveButton
|
||||
type="primary"
|
||||
@click="handleSaveOptions"
|
||||
@callback="$emit('callback')"
|
||||
:loading="saving"
|
||||
:errored="errored"
|
||||
text="保存"
|
||||
loadedText="保存成功"
|
||||
:loading="saving"
|
||||
erroredText="保存失败"
|
||||
loadedText="保存成功"
|
||||
text="保存"
|
||||
type="primary"
|
||||
@callback="$emit('callback')"
|
||||
@click="handleSaveOptions"
|
||||
></ReactiveButton>
|
||||
</a-form-model-item>
|
||||
</a-form-model>
|
||||
|
@ -273,6 +273,7 @@
|
|||
</template>
|
||||
<script>
|
||||
import attachmentApi from '@/api/attachment'
|
||||
|
||||
const tencentCosRegions = [
|
||||
{
|
||||
text: '北京一区',
|
||||
|
|
|
@ -36,16 +36,6 @@
|
|||
<a-form-model-item label="占位提示:">
|
||||
<a-input v-model="options.comment_content_placeholder" />
|
||||
</a-form-model-item>
|
||||
<!-- <a-form-model-item
|
||||
label="自定义样式:"
|
||||
|
||||
>
|
||||
<a-input
|
||||
type="textarea"
|
||||
:autoSize="{ minRows: 5 }"
|
||||
v-model="options.comment_custom_style"
|
||||
/>
|
||||
</a-form-model-item> -->
|
||||
<a-form-model-item>
|
||||
<ReactiveButton
|
||||
type="primary"
|
||||
|
|
|
@ -85,7 +85,7 @@ export default {
|
|||
async handleVerifyIsInstall() {
|
||||
const response = await adminApi.isInstalled()
|
||||
if (!response.data.data) {
|
||||
this.$router.push({ name: 'Install' })
|
||||
await this.$router.push({ name: 'Install' })
|
||||
}
|
||||
},
|
||||
onLoginSucceed() {
|
||||
|
|
|
@ -423,7 +423,6 @@ export default {
|
|||
this.attachmentDrawer.visible = false
|
||||
},
|
||||
handleMFASwitch(useMFAuth) {
|
||||
// loding
|
||||
this.mfaParam.switch.loading = true
|
||||
if (!useMFAuth && this.mfaUsed) {
|
||||
// true -> false
|
||||
|
@ -444,7 +443,7 @@ export default {
|
|||
},
|
||||
handleSetMFAuth() {
|
||||
const _this = this
|
||||
var mfaType = _this.mfaUsed ? 'NONE' : 'TFA_TOTP'
|
||||
const mfaType = _this.mfaUsed ? 'NONE' : 'TFA_TOTP'
|
||||
_this.$refs.mfaForm.validate(valid => {
|
||||
if (valid) {
|
||||
_this.mfaParam.saving = true
|
||||
|
|
Loading…
Reference in New Issue