diff --git a/package-lock.json b/package-lock.json
index 70d38ee9..e248badc 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -16623,6 +16623,11 @@
"codemirror": "^5.22.0"
}
},
+ "vue-contextmenujs": {
+ "version": "1.3.9",
+ "resolved": "https://registry.npmjs.org/vue-contextmenujs/-/vue-contextmenujs-1.3.9.tgz",
+ "integrity": "sha512-Y5QMBLsxnSFD+NIebYsqL6nA6hu9N8Kf4i+wB9WhqUkoyIRpBJVu2ZazU9tduHOp6kai2yJYzIgvfCOJDi18ag=="
+ },
"vue-count-to": {
"version": "1.0.13",
"resolved": "https://registry.npmjs.org/vue-count-to/-/vue-count-to-1.0.13.tgz",
diff --git a/package.json b/package.json
index 825b5ed8..6a79750c 100644
--- a/package.json
+++ b/package.json
@@ -29,7 +29,6 @@
"vue-router": "^3.1.6",
"vuejs-logger": "^1.5.3",
"vuex": "^3.1.1",
- "flv.js": "^1.5.0",
"vue-contextmenujs": "^1.3.9"
},
"devDependencies": {
diff --git a/src/views/attachment/AttachmentList.vue b/src/views/attachment/AttachmentList.vue
index 67218240..0bf7545c 100644
--- a/src/views/attachment/AttachmentList.vue
+++ b/src/views/attachment/AttachmentList.vue
@@ -275,11 +275,17 @@ export default {
this.queryParam.size = this.pagination.size
this.queryParam.sort = this.pagination.sort
this.listLoading = true
- attachmentApi.query(this.queryParam).then(response => {
- this.attachments = response.data.data.content
- this.pagination.total = response.data.data.total
- this.listLoading = false
- })
+ attachmentApi
+ .query(this.queryParam)
+ .then(response => {
+ this.attachments = response.data.data.content
+ this.pagination.total = response.data.data.total
+ })
+ .finally(() => {
+ setTimeout(() => {
+ this.listLoading = false
+ }, 200)
+ })
},
loadMediaTypes() {
attachmentApi.getMediaTypes().then(response => {
diff --git a/src/views/post/CategoryList.vue b/src/views/post/CategoryList.vue
index 7bd77b98..61873a66 100644
--- a/src/views/post/CategoryList.vue
+++ b/src/views/post/CategoryList.vue
@@ -13,28 +13,39 @@
:title="title"
:bodyStyle="{ padding: '16px' }"
>
-
-
+
-
-
+
-
-
+
+
-
-
+
-
-
+
-
-
+
+
保存
更新
返回添加
-
-
+
+
编辑
@@ -274,13 +285,20 @@ export default {
mixins: [mixin, mixinDevice],
data() {
return {
- formType: 'create',
categories: [],
categoryToCreate: {},
thumbnailDrawerVisible: false,
- menu: {},
loading: false,
- columns
+ columns,
+ categoryRules: {
+ name: [
+ { required: true, message: '* 分类名称不能为空', trigger: ['change', 'blur'] },
+ { max: 255, message: '* 分类名称的字符长度不能超过 255', trigger: ['change', 'blur'] }
+ ],
+ slug: [{ max: 255, message: '* 分类别名的字符长度不能超过 255', trigger: ['change', 'blur'] }],
+ thumbnail: [{ max: 1023, message: '* 封面图链接的字符长度不能超过 1023', trigger: ['change', 'blur'] }],
+ description: [{ max: 100, message: '* 分类描述的字符长度不能超过 100', trigger: ['change', 'blur'] }]
+ }
}
},
computed: {
@@ -289,6 +307,9 @@ export default {
return '修改分类'
}
return '添加分类'
+ },
+ isUpdateForm() {
+ return this.categoryToCreate.id
}
},
created() {
@@ -297,56 +318,68 @@ export default {
methods: {
loadCategories() {
this.loading = true
- categoryApi.listAll(true).then(response => {
- this.categories = response.data.data
- this.loading = false
- })
+ categoryApi
+ .listAll(true)
+ .then(response => {
+ this.categories = response.data.data
+ })
+ .finally(() => {
+ setTimeout(() => {
+ this.loading = false
+ }, 200)
+ })
},
handleSaveClick() {
this.createOrUpdateCategory()
},
- handleAddCategory() {
- this.formType = 'create'
- this.categoryToCreate = {}
- },
handleEditCategory(category) {
this.categoryToCreate = category
- this.formType = 'update'
},
handleDeleteCategory(id) {
- categoryApi.delete(id).then(response => {
- this.$message.success('删除成功!')
- this.loadCategories()
- this.handleAddCategory()
- })
+ categoryApi
+ .delete(id)
+ .then(response => {
+ this.$message.success('删除成功!')
+ this.categoryToCreate = {}
+ })
+ .finally(() => {
+ this.loadCategories()
+ })
},
createOrUpdateCategory() {
- if (!this.categoryToCreate.name) {
- this.$notification['error']({
- message: '提示',
- description: '分类名称不能为空!'
- })
- return
- }
- if (this.categoryToCreate.id) {
- categoryApi.update(this.categoryToCreate.id, this.categoryToCreate).then(response => {
- this.$message.success('更新成功!')
- this.loadCategories()
- })
- } else {
- categoryApi.create(this.categoryToCreate).then(response => {
- this.$message.success('保存成功!')
- this.loadCategories()
- })
- }
- this.handleAddCategory()
+ this.$refs.categoryForm.validate(valid => {
+ if (valid) {
+ if (this.categoryToCreate.id) {
+ categoryApi
+ .update(this.categoryToCreate.id, this.categoryToCreate)
+ .then(response => {
+ this.$message.success('更新成功!')
+ this.categoryToCreate = {}
+ })
+ .finally(() => {
+ this.loadCategories()
+ })
+ } else {
+ categoryApi
+ .create(this.categoryToCreate)
+ .then(response => {
+ this.$message.success('保存成功!')
+ this.categoryToCreate = {}
+ })
+ .finally(() => {
+ this.loadCategories()
+ })
+ }
+ }
+ })
},
handleCategoryToMenu(category) {
- this.menu['name'] = category.name
- this.menu['url'] = `${category.fullPath}`
- menuApi.create(this.menu).then(response => {
+ const menu = {
+ name: category.name,
+ url: `${category.fullPath}`
+ }
+ menuApi.create(menu).then(response => {
this.$message.success('添加到菜单成功!')
- this.menu = {}
})
},
handleSelectThumbnail(data) {
diff --git a/src/views/post/TagList.vue b/src/views/post/TagList.vue
index 91cf6d2d..6fca1a5f 100644
--- a/src/views/post/TagList.vue
+++ b/src/views/post/TagList.vue
@@ -13,22 +13,30 @@
:title="title"
:bodyStyle="{ padding: '16px' }"
>
-
-
+
-
-
+
-
-
+
-
-
+
+
保存
更新
返回添加
删除
-
-
+
+
{
- this.$message.success('删除成功!')
- this.loadTags()
- this.handleAddTag()
- })
+ tagApi
+ .delete(tagId)
+ .then(response => {
+ this.$message.success('删除成功!')
+ this.tagToCreate = {}
+ })
+ .finally(() => {
+ this.loadTags()
+ })
},
createOrUpdateTag() {
- if (!this.tagToCreate.name) {
- this.$notification['error']({
- message: '提示',
- description: '标签名称不能为空!'
- })
- return
- }
- if (this.tagToCreate.id) {
- tagApi.update(this.tagToCreate.id, this.tagToCreate).then(response => {
- this.$message.success('更新成功!')
- this.loadTags()
- this.tagToCreate = {}
- })
- } else {
- tagApi.create(this.tagToCreate).then(response => {
- this.$message.success('保存成功!')
- this.loadTags()
- this.tagToCreate = {}
- })
- }
- this.handleAddTag()
+ this.$refs.tagForm.validate(valid => {
+ if (valid) {
+ if (this.tagToCreate.id) {
+ tagApi.update(this.tagToCreate.id, this.tagToCreate).then(response => {
+ this.$message.success('更新成功!')
+ this.tagToCreate = {}
+ })
+ } else {
+ tagApi
+ .create(this.tagToCreate)
+ .then(response => {
+ this.$message.success('保存成功!')
+ this.tagToCreate = {}
+ })
+ .finally(() => {
+ this.loadTags()
+ })
+ }
+ }
+ })
},
handleSelectThumbnail(data) {
this.$set(this.tagToCreate, 'thumbnail', encodeURI(data.path))
diff --git a/src/views/system/Installation.vue b/src/views/system/Installation.vue
index 40a12907..2f843628 100644
--- a/src/views/system/Installation.vue
+++ b/src/views/system/Installation.vue
@@ -234,86 +234,34 @@ export default {
generalRules: {
username: [
- {
- required: true,
- message: '用户名不能为空',
- trigger: 'change'
- },
- {
- max: 50,
- message: '用户名的字符长度不能超过 50',
- trigger: 'change'
- }
+ { required: true, message: '* 用户名不能为空', trigger: ['change', 'blur'] },
+ { max: 50, message: '* 用户名的字符长度不能超过 50', trigger: ['change', 'blur'] }
],
nickname: [
- {
- required: true,
- message: '用户昵称不能为空',
- trigger: 'change'
- },
- {
- max: 255,
- message: '用户昵称的字符长度不能超过 255',
- trigger: 'change'
- }
+ { required: true, message: '* 用户昵称不能为空', trigger: ['change', 'blur'] },
+ { max: 255, message: '* 用户昵称的字符长度不能超过 255', trigger: ['change', 'blur'] }
],
email: [
- {
- required: true,
- message: '电子邮件地址不能为空',
- trigger: 'change'
- },
- {
- max: 127,
- message: '电子邮件地址的字符长度不能超过 127',
- trigger: 'change'
- },
+ { required: true, message: '* 电子邮件地址不能为空', trigger: ['change', 'blur'] },
+ { max: 127, message: '* 电子邮件地址的字符长度不能超过 127', trigger: ['change', 'blur'] },
{
pattern: /\w[-\w.+]*@([A-Za-z0-9][-A-Za-z0-9]+\.)+[A-Za-z]{2,14}/g,
- message: '电子邮件地址的格式不正确',
- trigger: 'change'
+ message: '* 电子邮件地址的格式不正确',
+ trigger: ['change', 'blur']
}
],
password: [
- {
- required: true,
- message: '密码不能为空',
- trigger: 'change'
- },
- {
- min: 8,
- max: 100,
- message: '密码的字符长度必须在 8 - 100 之间',
- trigger: 'change'
- }
+ { required: true, message: '* 密码不能为空', trigger: ['change', 'blur'] },
+ { min: 8, max: 100, message: '* 密码的字符长度必须在 8 - 100 之间', trigger: ['change', 'blur'] }
],
confirmPassword: [
- {
- required: true,
- message: '确认密码不能为空',
- trigger: 'change'
- },
- {
- validator: confirmPasswordValidate,
- trigger: 'change'
- }
+ { required: true, message: '* 确认密码不能为空', trigger: ['change', 'blur'] },
+ { validator: confirmPasswordValidate, trigger: ['change', 'blur'] }
]
},
blogRules: {
- url: [
- {
- required: true,
- message: '博客地址不能为空',
- trigger: 'change'
- }
- ],
- title: [
- {
- required: true,
- message: '博客标题不能为空',
- trigger: 'change'
- }
- ]
+ url: [{ required: true, message: '* 博客地址不能为空', trigger: ['change', 'blur'] }],
+ title: [{ required: true, message: '* 博客标题不能为空', trigger: ['change', 'blur'] }]
}
}
},