Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
front-document
/
vue-front
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 5af1d2b9
authored
Mar 14, 2022
by
luyt
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat:按业务区分,文件夹列表页添加
1 parent
2f7baf4d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
318 additions
and
44 deletions
src/App.vue
src/router/routes.js
src/views/folder/add/index.vue
src/views/folder/index.vue
src/App.vue
View file @
5af1d2b
<
template
>
<div
id=
"app"
>
<div
class=
"wrapper-header"
>
<img
class=
"logo"
src=
"./assets/logo.png"
alt=
""
>
<img
class=
"logo"
src=
"./assets/logo.png"
alt=
""
/
>
<a-menu
v-model=
"current"
mode=
"horizontal"
>
<a-menu-item
key=
"home"
@
click=
"handleTab('Home')"
><a-icon
type=
"home"
/>
项目主页
</a-menu-item>
<a-menu-item
key=
"documentation"
@
click=
"handleTab('Documentation')"
><a-icon
type=
"file-text"
/>
项目文档描述
</a-menu-item>
<a-menu-item
key=
"record"
@
click=
"handleTab('Record')"
><a-icon
type=
"message"
/>
问题记录
</a-menu-item>
<a-menu-item
key=
"folder"
@
click=
"handleTab('Folder')"
><a-icon
type=
"home"
/>
项目主页
</a-menu-item
>
<a-menu-item
key=
"documentation"
@
click=
"handleTab('Documentation')"
><a-icon
type=
"file-text"
/>
项目文档描述
</a-menu-item
>
<a-menu-item
key=
"record"
@
click=
"handleTab('Record')"
><a-icon
type=
"message"
/>
问题记录
</a-menu-item
>
</a-menu>
</div>
<div
class=
"wrapper-content"
>
...
...
@@ -15,26 +21,26 @@
</
template
>
<
script
>
let
currentName
=
''
let
currentName
=
""
;
export
default
{
name
:
'App'
,
name
:
"App"
,
data
()
{
return
{
current
:
[
'home'
],
}
current
:
[
"folder"
],
}
;
},
mounted
()
{
currentName
=
window
.
location
.
pathname
.
substr
(
1
)
console
.
log
(
currentName
)
if
(
!
currentName
)
this
.
current
=
[
'home'
]
else
this
.
current
=
[
currentName
]
currentName
=
window
.
location
.
pathname
.
substr
(
1
)
;
console
.
log
(
currentName
)
;
if
(
!
currentName
)
this
.
current
=
[
"folder"
];
else
this
.
current
=
[
currentName
]
;
},
methods
:
{
handleTab
(
name
)
{
this
.
to
(
name
)
}
this
.
to
(
name
)
;
}
,
},
}
}
;
</
script
>
<
style
>
...
...
src/router/routes.js
View file @
5af1d2b
/*
* @Author: huyue
* @Date: 2021-08-31 11:40:04
* @Author: huyue
* @Date: 2021-08-31 11:40:04
* @Last Modified by: huyue
* @Last Modified time: 2021-09-10 15:26:10
*/
const
routes
=
Object
.
freeze
([
{
path
:
'/'
,
redirect
:
'/home'
,
path
:
"/"
,
redirect
:
"/folder"
,
},
{
name
:
'Home'
,
path
:
'/home'
,
component
:
resolve
=>
require
([
'../views/home/index.vue'
],
resolve
)
name
:
"Folder"
,
path
:
"/folder"
,
component
:
(
resolve
)
=>
require
([
"../views/folder/index.vue"
],
resolve
),
},
{
name
:
'HomeAdd'
,
path
:
'/home/add'
,
component
:
resolve
=>
require
([
'../views/home/add/index.vue'
],
resolve
)
name
:
"FolderAdd"
,
path
:
"/folder/add"
,
component
:
(
resolve
)
=>
require
([
"../views/folder/add/index.vue"
],
resolve
),
},
{
name
:
'Documentation'
,
path
:
'/documentation'
,
component
:
resolve
=>
require
([
'../views/documentation/index.vue'
],
resolve
)
name
:
"Home"
,
path
:
"/home"
,
component
:
(
resolve
)
=>
require
([
"../views/home/index.vue"
],
resolve
),
},
{
name
:
'DocAdd'
,
path
:
'/documentation/add'
,
component
:
resolve
=>
require
([
'../views/documentation/add/index.vue'
],
resolve
)
name
:
"HomeAdd"
,
path
:
"/home/add"
,
component
:
(
resolve
)
=>
require
([
"../views/home/add/index.vue"
],
resolve
),
},
{
name
:
'Record'
,
path
:
'/record'
,
component
:
resolve
=>
require
([
'../views/record/index.vue'
],
resolve
)
}
,
{
name
:
'GitLog'
,
path
:
'/gitLog'
,
component
:
resolve
=>
require
([
'../views/gitLog.vue'
],
resolve
)
}
])
{
name
:
"Documentation"
,
path
:
"/documentation"
,
component
:
(
resolve
)
=>
require
([
"../views/documentation/index.vue"
],
resolve
),
},
{
name
:
"DocAdd"
,
path
:
"/documentation/add"
,
component
:
(
resolve
)
=>
require
([
"../views/documentation/add/index.vue"
],
resolve
),
},
{
name
:
"Record"
,
path
:
"/record"
,
component
:
(
resolve
)
=>
require
([
"../views/record/index.vue"
],
resolve
),
},
{
name
:
"GitLog"
,
path
:
"/gitLog"
,
component
:
(
resolve
)
=>
require
([
"../views/gitLog.vue"
],
resolve
),
},
]);
export
default
routes
\ No newline at end of file
export
default
routes
;
src/views/folder/add/index.vue
0 → 100644
View file @
5af1d2b
<
template
>
<div>
<a-form-model
ref=
"ruleForm"
:model=
"form"
:rules=
"rules"
:label-col=
"labelCol"
:wrapper-col=
"wrapperCol"
>
<a-form-model-item
label=
"分类标题"
prop=
"classify_title"
>
<a-input
v-model=
"form.classify_title"
/>
</a-form-model-item>
<a-form-model-item
label=
"分类字段"
prop=
"classify"
>
<a-input
v-model=
"form.classify"
:disabled=
"!isNewAdd"
/>
<!--
<a-select
v-model=
"form.classify"
placeholder=
"请选择你的分类"
>
<a-select-option
v-for=
"item in classifyList"
:key=
"item.value"
:alue=
"item.value"
>
{{
item
.
name
}}
</a-select-option>
</a-select>
-->
</a-form-model-item>
<a-form-model-item
label=
"分类描述"
prop=
"classify_description"
>
<a-input
v-model=
"form.classify_description"
type=
"textarea"
/>
</a-form-model-item>
<a-form-model-item
:wrapper-col=
"
{ span: 14, offset: 4 }">
<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=
"closeForm"
>
关闭
</a-button>
</a-form-model-item>
</a-form-model>
</div>
</
template
>
<
script
type=
"text/ecmascript-6"
>
export
default
{
name
:
""
,
data
()
{
return
{
isNewAdd
:
true
,
labelCol
:
{
span
:
4
},
wrapperCol
:
{
span
:
14
},
classifyList
:
[
{
name
:
"oss-web"
,
value
:
"oss-web"
,
},
{
name
:
"micro-service"
,
value
:
"micro-service"
,
},
{
name
:
"scrm"
,
value
:
"scrm"
,
},
{
name
:
"scrm-mobile"
,
value
:
"scrm-mobile"
,
},
],
form
:
{
classify_title
:
""
,
classify
:
""
,
classify_description
:
""
,
},
rules
:
{
classify_title
:
[
{
required
:
true
,
message
:
"请输入分类名称"
,
trigger
:
"blur"
},
{
min
:
1
,
max
:
30
,
message
:
"请输入字符1~50之间"
,
trigger
:
"blur"
},
],
classify
:
[
{
required
:
true
,
message
:
"请输入分类字段"
,
trigger
:
"blur"
},
],
classify_description
:
[
{
required
:
true
,
message
:
"请输入分类描述"
,
trigger
:
"blur"
},
],
},
};
},
mounted
()
{
this
.
editeItemFn
();
},
methods
:
{
onSubmit
()
{
this
.
$refs
.
ruleForm
.
validate
((
valid
)
=>
{
if
(
valid
)
{
if
(
this
.
isNewAdd
)
{
//新增
this
.
api
.
documentation
.
create
(
this
.
form
).
then
((
res
)
=>
{
// console.log(res);
if
(
res
.
id
)
{
this
.
$message
.
success
(
"添加成功"
);
this
.
closeForm
();
this
.
resetForm
();
}
else
{
this
.
$message
.
error
(
"添加失败"
);
}
});
}
else
{
//编辑
this
.
api
.
documentation
.
update
(
this
.
form
).
then
((
res
)
=>
{
console
.
log
(
res
);
if
(
res
.
id
)
{
this
.
$message
.
success
(
"编辑成功"
);
this
.
closeForm
();
this
.
resetForm
();
}
else
{
this
.
$message
.
error
(
"编辑失败"
);
}
});
}
}
else
{
return
false
;
}
});
},
resetForm
()
{
this
.
isNewAdd
=
true
;
this
.
$refs
.
ruleForm
.
resetFields
();
},
closeForm
()
{
this
.
to
(
-
1
);
},
//编辑项目
editeItemFn
()
{
const
editeItem
=
this
.
$route
.
params
;
console
.
log
(
"editeItem: "
,
editeItem
);
if
(
Object
.
keys
(
editeItem
).
length
===
0
)
return
;
this
.
isNewAdd
=
false
;
this
.
form
=
{
classify_title
:
editeItem
.
classify_title
,
classify
:
editeItem
.
classify
,
classify_description
:
editeItem
.
classify_description
,
id
:
editeItem
.
id
,
};
},
},
// 重置
beforeDestroy
()
{
this
.
resetForm
();
},
};
</
script
>
<
style
scoped
lang=
"scss"
></
style
>
src/views/folder/index.vue
0 → 100644
View file @
5af1d2b
<
template
>
<div>
<h2>
项目分类
</h2>
<a-list
:grid=
"
{ gutter: 16, column: 4 }" :data-source="docData">
<a-list-item
slot=
"renderItem"
slot-scope=
"item"
>
<a
rel=
"noopener noreferrer"
@
click=
"shoClassify(item)"
>
<a-card
:title=
"item.classify_title"
>
<p>
{{
item
.
classify_description
}}
</p>
<!--
<p
v-for=
"(i, idx) in item.content"
:key=
"i"
>
{{
idx
+
1
}}
.
{{
i
}}
</p>
-->
<template
slot=
"actions"
class=
"ant-card-actions"
>
<a-icon
key=
"edit"
type=
"edit"
@
click
.
stop=
"editFn(item)"
/>
<a-icon
key=
"delete"
type=
"delete"
@
click
.
stop=
"deleteFn(item)"
/>
</
template
>
</a-card>
</a>
</a-list-item>
</a-list>
<div
class=
"icon-anticons"
@
click=
"add"
>
<a-icon
type=
"plus-circle"
theme=
"filled"
/>
</div>
</div>
</template>
<
script
>
const
data
=
[
{
id
:
"1"
,
classify
:
"oss-web"
,
classify_title
:
"广联赛讯Vue业务模块1"
,
classify_description
:
"vue模板介绍与使用"
,
},
{
id
:
"2"
,
classify
:
"micro-service"
,
classify_title
:
"广联赛讯Vue业务模块2"
,
classify_description
:
"vue模板介绍与使用"
,
},
{
id
:
"3"
,
classify
:
"scrm"
,
classify_title
:
"广联赛讯Vue业务模块3"
,
classify_description
:
"vue模板介绍与使用"
,
},
{
id
:
"4"
,
classify
:
"scrm-mobile"
,
classify_title
:
"广联赛讯Vue业务模块4"
,
classify_description
:
"vue模板介绍与使用"
,
},
];
export
default
{
name
:
"folder"
,
data
()
{
return
{
docData
:
data
,
};
},
mounted
()
{
this
.
getList
();
},
methods
:
{
getList
()
{
this
.
api
.
documentation
.
getList
().
then
((
res
)
=>
{
// console.log(res);
this
.
docData
=
res
;
});
},
add
()
{
this
.
to
(
"FolderAdd"
);
},
shoClassify
(
item
)
{
this
.
$router
.
push
({
name
:
"Home"
,
query
:
{
classify
:
item
.
classify
}
});
// if (url) {
// window.open(url, "target");
// }
},
editFn
(
item
)
{
this
.
to
(
"FolderAdd"
,
item
);
},
deleteFn
(
item
)
{
let
that
=
this
;
this
.
$confirm
({
title
:
"您确认删除吗?"
,
onOk
()
{
that
.
deleteApiFn
(
item
);
},
onCancel
()
{},
okText
:
"确认"
,
cancelText
:
"取消"
,
});
},
async
deleteApiFn
(
item
)
{
let
params
=
{
id
:
item
.
id
,
};
const
res
=
await
this
.
api
.
documentation
.
delete
(
params
);
// console.log('res: ', res);
if
(
res
.
id
)
{
this
.
$message
.
success
(
"删除成功"
);
this
.
getList
();
}
else
{
this
.
$message
.
error
(
"删除失败"
);
}
},
},
};
</
script
>
<
style
></
style
>
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment