Commit cfae2628 by zhangxw

样式修改

1 parent f684eba7
.icon-anticons { .icon-anticons {
position: fixed; position: fixed;
bottom: 20px; bottom: 70px;
right: 40px; right: 50px;
text-align: right; text-align: right;
cursor: pointer; cursor: pointer;
transition: color 0.3s ease-in-out, background-color 0.3s ease-in-out; transition: color 0.3s ease-in-out, background-color 0.3s ease-in-out;
...@@ -10,6 +10,11 @@ ...@@ -10,6 +10,11 @@
border-radius: 50%; border-radius: 50%;
box-shadow: 0 10px 30px rgb(45 140 240 / 40%); box-shadow: 0 10px 30px rgb(45 140 240 / 40%);
} }
.icon-anticons span{
position: fixed;
bottom: 40px;
right: 40px;
}
.icon-anticons .anticon { .icon-anticons .anticon {
font-size: 36px; font-size: 36px;
color: #2d8cf0; color: #2d8cf0;
...@@ -19,3 +24,18 @@ ...@@ -19,3 +24,18 @@
.icon-anticons .anticon:hover { .icon-anticons .anticon:hover {
background: rgba(45, 140, 240, 0.2); background: rgba(45, 140, 240, 0.2);
} }
.icon-addDoc {
bottom: 70px;
right: 130px;
box-shadow: 0 10px 30px rgb(240 180 14 / 40%);;
}
.icon-addDoc .anticon {
color: #F0B40E;
}
.icon-addDoc span{
bottom: 40px;
right: 120px;
}
.icon-addDoc .anticon:hover {
background: rgba(45, 140, 240, 0.2);
}
\ No newline at end of file \ No newline at end of file
...@@ -10,6 +10,13 @@ ...@@ -10,6 +10,13 @@
<a-form-model-item label="文档描述" prop="docDescription"> <a-form-model-item label="文档描述" prop="docDescription">
<a-input v-model="form.docDescription" type="textarea" /> <a-input v-model="form.docDescription" type="textarea" />
</a-form-model-item> </a-form-model-item>
<a-form-model-item label="文档分类" prop="classifyId">
<a-select v-model="form.classifyId" @select="handleSelect(item)">
<a-select-option v-for="classitem in classifyData" :key="classitem.id" :value="classitem.id">
{{ classitem.title }}
</a-select-option>
</a-select>
</a-form-model-item>
<a-form-model-item :wrapper-col="{ span: 14, offset: 4 }"> <a-form-model-item :wrapper-col="{ span: 14, offset: 4 }">
<a-button type="primary" @click="onSubmit">{{ isNewAdd ? '创建' : '提交' }}</a-button> <a-button type="primary" @click="onSubmit">{{ isNewAdd ? '创建' : '提交' }}</a-button>
<a-button style="margin-left: 10px" @click="resetForm">重置</a-button> <a-button style="margin-left: 10px" @click="resetForm">重置</a-button>
...@@ -30,7 +37,8 @@ export default { ...@@ -30,7 +37,8 @@ export default {
form: { form: {
docTitle: '', docTitle: '',
docUrl: '', docUrl: '',
docDescription: '' docDescription: '',
classifyId: Number(this.$route.query.classify_id) || ''
}, },
rules: { rules: {
docTitle: [ docTitle: [
...@@ -38,14 +46,23 @@ export default { ...@@ -38,14 +46,23 @@ export default {
{ min: 1, max: 30, message: '请输入字符1~50之间', trigger: 'blur' } { min: 1, max: 30, message: '请输入字符1~50之间', trigger: 'blur' }
], ],
docUrl: [{ required: true, message: '请输入文档地址', trigger: 'blur' }], docUrl: [{ required: true, message: '请输入文档地址', trigger: 'blur' }],
docDescription: [{ required: true, message: '请输入文档描述', trigger: 'blur' }] docDescription: [{ required: true, message: '请输入文档描述', trigger: 'blur' }],
} classifyId: [{ required: true, message: '请选择文档分类', trigger: 'change' }]
},
classifyData: []
} }
}, },
mounted() { mounted() {
this.editeItemFn() this.editeItemFn()
this.getClassifyList()
}, },
methods: { methods: {
//获取全部的分类
getClassifyList() {
this.api.documentClassify.getList().then(res => {
this.classifyData = res
})
},
onSubmit() { onSubmit() {
this.$refs.ruleForm.validate(valid => { this.$refs.ruleForm.validate(valid => {
if (valid) { if (valid) {
...@@ -90,14 +107,14 @@ export default { ...@@ -90,14 +107,14 @@ export default {
editeItemFn() { editeItemFn() {
const editeItem = this.$route.query const editeItem = this.$route.query
console.log('editeItem: ', editeItem) console.log('editeItem: ', editeItem)
if (Object.keys(editeItem).length === 0) return if (!editeItem.id) return
this.isNewAdd = false this.isNewAdd = false
this.form = { this.form = {
docTitle: editeItem.doc_title, docTitle: editeItem.doc_title,
docUrl: editeItem.doc_url, docUrl: editeItem.doc_url,
docDescription: editeItem.doc_description, docDescription: editeItem.doc_description,
id: editeItem.id, id: editeItem.id,
classify_id: editeItem.classify_id classifyId: Number(editeItem.classifyId)
} }
} }
}, },
......
<template> <template>
<div> <div>
<h2>前端开发文档分类</h2> <h2>文档分类</h2>
<a-list :grid="{ gutter: 16, column: 4 }" :data-source="docData"> <a-list :grid="{ gutter: 16, column: 4 }" :data-source="docData">
<a-list-item slot="renderItem" slot-scope="item"> <a-list-item slot="renderItem" slot-scope="item">
<a rel="noopener noreferrer" @click="showDocumentList(item)"> <a rel="noopener noreferrer" @click="showDocumentList(item)">
...@@ -15,8 +15,13 @@ ...@@ -15,8 +15,13 @@
</a> </a>
</a-list-item> </a-list-item>
</a-list> </a-list>
<div class="icon-anticons" @click="add"> <div class="icon-anticons" @click="addDocument">
<a-icon type="plus-circle" theme="filled" /> <a-icon type="plus-circle" theme="filled" />
<span>添加文档</span>
</div>
<div class="icon-anticons icon-addDoc" @click="addClassify">
<a-icon type="plus-circle" theme="filled" />
<span>添加分类</span>
</div> </div>
</div> </div>
</template> </template>
...@@ -40,9 +45,13 @@ export default { ...@@ -40,9 +45,13 @@ export default {
}) })
}, },
// 添加项目文档分类 // 添加项目文档分类
add() { addClassify() {
this.to('DocClassifyAdd') this.to('DocClassifyAdd')
}, },
// 添加文档
addDocument() {
this.to('DocAdd')
},
showDocumentList(item) { showDocumentList(item) {
if (item) { if (item) {
this.$router.push({ name: 'Documentation', query: { id: item.id, title: item.title } }) this.$router.push({ name: 'Documentation', query: { id: item.id, title: item.title } })
......
<template> <template>
<div> <div>
<h2>{{ listItem.title }}</h2> <h2>{{ listItem.title }}</h2>
<a-list :grid="{ gutter: 16, column: 4 }" :data-source="docData"> <a-list :grid="{ gutter: 16, column: 2 }" :data-source="docData">
<a-list-item slot="renderItem" slot-scope="item"> <a-list-item slot="renderItem" slot-scope="item">
<a rel="noopener noreferrer" @click="showDocument(item.doc_url)"> <a rel="noopener noreferrer" @click="showDocument(item.doc_url)">
<a-card :title="item.doc_title"> <a-card :title="item.doc_title">
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<a-icon key="edit" type="edit" @click.stop="editFn(item)" /> <a-icon key="edit" type="edit" @click.stop="editFn(item)" />
<a-icon key="delete" type="delete" @click.stop="deleteFn(item)" /> <a-icon key="delete" type="delete" @click.stop="deleteFn(item)" />
<span @click.stop> <span @click.stop>
<a-select size="small" v-model="item.classify_id" @select="handleSelect(item)"> <a-select size="small" v-model="item.classifyId" @select="handleSelect(item)">
<!-- @change="handleChange(item)" --> <!-- @change="handleChange(item)" -->
<a-select-option v-for="classitem in classifyData" :key="classitem.id" :value="classitem.id"> <a-select-option v-for="classitem in classifyData" :key="classitem.id" :value="classitem.id">
{{ classitem.title }} {{ classitem.title }}
...@@ -60,6 +60,7 @@ export default { ...@@ -60,6 +60,7 @@ export default {
content: `您确定要移动项目文档到 ${classifyTitle} 分类?`, content: `您确定要移动项目文档到 ${classifyTitle} 分类?`,
onOk() { onOk() {
//编辑 //编辑
item.classify_id = undefined
that.api.documentation.update(item).then(res => { that.api.documentation.update(item).then(res => {
// console.log("res: ", res); // console.log("res: ", res);
if (res.id) { if (res.id) {
...@@ -79,11 +80,14 @@ export default { ...@@ -79,11 +80,14 @@ export default {
getList() { getList() {
this.api.documentation.getList(this.listItem.id).then(res => { this.api.documentation.getList(this.listItem.id).then(res => {
// console.log(res); // console.log(res);
res.forEach(val => {
val.classifyId = val.classify_id
})
this.docData = res this.docData = res
}) })
}, },
add() { add() {
this.to('DocAdd') this.to('DocAdd', { classify_id: this.listItem.id })
}, },
showDocument(url) { showDocument(url) {
if (url) { if (url) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!