README 修改

This commit is contained in:
simple321vip
2022-10-28 10:18:43 +08:00
parent 2e2dbbbf72
commit 2fb3af05dc
3 changed files with 116 additions and 28 deletions
+12 -5
View File
@@ -28,18 +28,25 @@
## js-cookie ## js-cookie
npm install js-cookie -S npm install js-cookie -S
## vite-plugin-mock
// to enter the home page:
localhost:3000/home?tenantId=XXX&account=YYY&token=ABCDEFG
## 环境配置 ## 环境配置
前后端分离,所以前端单独服务器,所以生产环境需要装node.js 添加了.env.development ebv.test .env.production 文件
添加了.env.production .env.development 文件 development:
对vite.config.ts做了修改。 开发环境,使用mock,不需要后台联动
test:
测试环境需要 后台java程序支持,同时需要百度第三方认证。
prod:
生产环境通过 jenkins cicd进行发布配置。
# 云服务器 # 云服务器
nginx as a veb server, i use the official image to build this app image. nginx as a veb server, i use the official image to build this app image.
## 发布 ## 发布
- npm run build 生成dist 文件夹 - npm run build 生成dist 文件夹
把这个文件夹放到nginx的html文件夹下改名ghome
nginx那个 location /ghome 也要有。
## 百度网盘开放平台 ## 百度网盘开放平台
https://pan.baidu.com/union/home?menuKey=union-home https://pan.baidu.com/union/home?menuKey=union-home
+47
View File
@@ -28,4 +28,51 @@ export default [
} }
} }
}, },
{
url: '/auth/api/v1/author/blog/0001',
method: 'delete',
response: () => {
return {
btId: "001",
btName: "your world---",
blog_list: [
{
bid: "0002",
title: "two",
content: "anything",
btId: "001",
order: 0,
},
],
order: 0
}
},
},
{
url: '/auth/api/v1/author/blog/content',
method: 'PUT',
response: () => {
return {
bid: "0003",
title: "three",
content: "just a insert test",
btId: "001",
order: 2,
}
},
},
{
url: '/auth/api/v1/author/blog/content',
method: 'POST',
response: () => {
return {
bid: "0003",
title: "three",
content: "just a insert test",
btId: "001",
order: 2,
}
},
},
] as MockMethod[] ] as MockMethod[]
// /auth/api/v1/author/blog/content
+57 -23
View File
@@ -15,7 +15,7 @@
<draggable :list="blogTypes" ghost-class="ghost" handle=".move" animation="300" :force-fallback="true" itemKey="" <draggable :list="blogTypes" ghost-class="ghost" handle=".move" animation="300" :force-fallback="true" itemKey=""
filter=".forbid" chosen-class="chosenClass" :fallback-class="true" :fallback-on-body="true" filter=".forbid" chosen-class="chosenClass" :fallback-class="true" :fallback-on-body="true"
:touch-start-threshold="50" :fallback-tolerance="50" @start="onStart" @end="onEnd" group="group1" :touch-start-threshold="50" :fallback-tolerance="50" @start="onStart" @end="sortBlogType" group="group1"
:move="onMove"> :move="onMove">
<template #item="{ element }"> <template #item="{ element }">
<div class="item"> <div class="item">
@@ -43,14 +43,14 @@
</div> </div>
<draggable :list="blogTypes[checkedBlogIndex].blogs" ghost-class="ghost" handle=".move" animation="300" <draggable :list="blogTypes[checkedBlogIndex].blogs" ghost-class="ghost" handle=".move" animation="300"
:force-fallback="true" itemKey="" filter=".forbid" chosen-class="chosenClass" :fallback-class="true" :force-fallback="true" itemKey="" filter=".forbid" chosen-class="chosenClass" :fallback-class="true"
:fallback-on-body="true" :touch-start-threshold="50" :fallback-tolerance="50" @start="onStart" @end="onEnd" :fallback-on-body="true" :touch-start-threshold="50" :fallback-tolerance="50" @start="onStart" @end="sortBlog"
group="group2" :move="onMove"> group="group2" :move="onMove">
<template #item="{ element }"> <template #item="{ element }">
<div class="item"> <div class="item">
<label class="move"></label> <label class="move"></label>
<p class="bt-input" @click="onclickBlogTab(element)">{{ element.title }}</p> <p class="bt-input" @click="onclickBlogTab(element)">{{ element.title }}</p>
<div> <div>
<el-button class="operate_button" v-show="checkedIndex == element.order" :icon="Edit" size="small" <el-button class="operate_button" v-show="checkedIndex == element.order" :icon="Delete" size="small"
@click="deleteDialogVisible = true" /> @click="deleteDialogVisible = true" />
</div> </div>
</div> </div>
@@ -121,8 +121,10 @@
import { onMounted, reactive, ref, watch } from 'vue' import { onMounted, reactive, ref, watch } from 'vue'
import $moment from "moment" import $moment from "moment"
import MdEditor from 'md-editor-v3' import MdEditor from 'md-editor-v3'
import { Edit, CaretRight, CaretLeft, Setting } from "@element-plus/icons-vue" import { Edit, CaretRight, CaretLeft, Setting, Delete } from "@element-plus/icons-vue"
import 'md-editor-v3/lib/style.css' import 'md-editor-v3/lib/style.css'
import { h } from 'vue'
import { ElMessage } from 'element-plus'
import { import {
updateBtName, updateBtName,
updateContent, updateContent,
@@ -276,8 +278,13 @@ const saveContent = () => {
updateContent(query).then(response => { updateContent(query).then(response => {
if (response.status == 200) { if (response.status == 200) {
updated.value = false updated.value = false
// blogTypes.get(checkedBlogIndex.value)?.blogs.get(checkedIndex.value)?.content =
} }
}).then(() => {
ElMessage({
message: h('p', null, [
h('i', { style: 'color: teal' }, "文章保存失败"),
]),
})
}) })
} }
@@ -295,7 +302,7 @@ const saveTitle = () => {
bid: checkedIndex.value, bid: checkedIndex.value,
title: blogTypes[checkedBlogIndex.value].blogs[checkedIndex.value].title title: blogTypes[checkedBlogIndex.value].blogs[checkedIndex.value].title
} }
updateContent(query).then(response => { updateContent(query).then(() => {
updated.value = false updated.value = false
}) })
} }
@@ -324,7 +331,7 @@ const insertBlog = () => {
} as Blog } as Blog
blogTypes[checkedBlogIndex.value].blogs.push(blog) blogTypes[checkedBlogIndex.value].blogs.push(blog)
checkedIndex.value = bid checkedIndex.value = order
isclicked.value = false isclicked.value = false
}) })
} }
@@ -338,19 +345,26 @@ const deleteBlog = () => {
btId: blogTypes[checkedBlogIndex.value].btId btId: blogTypes[checkedBlogIndex.value].btId
} }
deleteContent(blogTypes[checkedBlogIndex.value].blogs[checkedIndex.value].bid, delete_data).then(response => { deleteContent(blogTypes[checkedBlogIndex.value].blogs[checkedIndex.value].bid, delete_data).then(response => {
if (response.data.process_status) { blogTypes[checkedBlogIndex.value].blogs.length = 0
const deleteKey = checkedIndex.value response.data.blog_list.forEach((item: any) => {
checkedIndex.value = blogTypes[checkedBlogIndex.value].blogs.keys().next().value const blog: Blog = {
blogTypes[checkedBlogIndex.value].blogs.splice(checkedIndex.value, 1) bid: item.bid,
deleteDialogVisible.value = false btId: item.btId,
} btName: item.btName,
title: item.title,
blog_prex: item.blog_prex,
autosave_control: item.autosave_control,
content: item.content,
order: item.order
}
blogTypes[checkedBlogIndex.value].blogs.push(blog)
})
deleteDialogVisible.value = false deleteDialogVisible.value = false
btName.value = "" btName.value = ""
}).catch(() => { }).catch(() => {
deleteDialogVisible.value = false deleteDialogVisible.value = false
btName.value = "" btName.value = ""
}) })
} }
} }
@@ -463,6 +477,9 @@ const deleteBlogType = () => {
} }
const sortBlogType = () => { const sortBlogType = () => {
blogTypes.forEach((blogType, index) => {
blogType.order = index
})
const sortData: BlogType[] = [] const sortData: BlogType[] = []
blogTypes.forEach((blogType: BlogType) => { blogTypes.forEach((blogType: BlogType) => {
@@ -474,24 +491,44 @@ const sortBlogType = () => {
}) })
}) })
sortBlogTypes(sortData).then(response => { sortBlogTypes(sortData).then(() => {
}).catch() }).catch(() => {
ElMessage({
message: h('p', null, [
h('i', { style: 'color: teal' }, "分类排序失败"),
]),
})
})
} }
const sortBlog = () => { const sortBlog = () => {
blogTypes[checkedBlogIndex.value].blogs.forEach((blog, index) => {
if (checkedIndex.value == blog.order) {
checkedIndex.value = index
}
})
const sortData: any[] = [] const sortData: any[] = []
blogTypes[checkedBlogIndex.value].blogs.forEach((blog: Blog) => {
blogTypes[checkedBlogIndex.value].blogs.forEach((blog: Blog, index) => {
blog.order = index
sortData.push({ sortData.push({
bid: blog.btId, bid: blog.btId,
order: blog.order order: blog.order
}) })
}) })
sortBlogs(sortData, blogTypes[checkedBlogIndex.value].btId).then(response => { sortBlogs(sortData, blogTypes[checkedBlogIndex.value].btId).then(() => {
}).catch() }).catch(() => {
ElMessage({
message: h('p', null, [
h('i', { style: 'color: teal' }, "blog排序失败"),
]),
})
})
} }
// Created 段階の関数呼び出す処理 // Created 段階の関数呼び出す処理
@@ -506,10 +543,7 @@ const onStart = () => {
//拖拽结束的事件 //拖拽结束的事件
const onEnd = () => { const onEnd = () => {
blogTypes.forEach((blogType, index) => {
blogType.order = index
})
sortBlogType()
} }
const onMove = (e: any) => { const onMove = (e: any) => {