index.vue
5.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
<template>
<div class="home-project">
<a-list item-layout="horizontal" :data-source="projectData">
<a-list-item slot="renderItem" slot-scope="item">
<a-list-item-meta>
<!-- <a slot="title" href="https://www.antdv.com/">{{ item.title }}</a> -->
<a-avatar slot="avatar" :src="projectImgUrl" />
</a-list-item-meta>
<div>
<a-descriptions :title="item.project_title" :bordered="false">
<a-descriptions-item label="开发人员">
{{ item.developer_name }}
</a-descriptions-item>
<a-descriptions-item label="测试项目地址">
<a
:href="item.test_url"
target="_blank"
rel="noopener noreferrer"
>{{ item.test_url }}</a
>
</a-descriptions-item>
<a-descriptions-item label="生产项目地址">
<a
:href="item.test_url"
target="_blank"
rel="noopener noreferrer"
>{{ item.product_url }}</a
>
</a-descriptions-item>
<a-descriptions-item label="使用技术">
{{ item.technology }}
</a-descriptions-item>
<a-descriptions-item label="配置名称">
{{ item.config_name }}
</a-descriptions-item>
<a-descriptions-item label="git地址">
<a
:href="item.git_url"
target="_blank"
rel="noopener noreferrer"
>{{ item.git_url }}</a
>
</a-descriptions-item>
<a-descriptions-item label="git提交信息">
<!-- <a
:href="item.git_commit"
target="_blank"
rel="noopener noreferrer"
>{{ item.git_commit }}</a
> -->
<a-button type="link" @click="checkGitLog(item)">
查看git提交信息
</a-button>
</a-descriptions-item>
<a-descriptions-item label="git项目ID">
<a-popover title="什么是git ID">
<template slot="content">
<p>1.进入git仓库项目设置</p>
<p>2.查看 Project ID</p>
</template>
{{ item.git_id }} <a-icon type="question" />
</a-popover>
</a-descriptions-item>
</a-descriptions>
</div>
<a slot="actions" @click="editFn(item)">编辑</a>
<a slot="actions" @click="commentsFn(item)">评论</a>
<a slot="actions" @click="delFn(item)">删除</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,
project_title: "广联运营平台",
project_description: "广联运营平台",
developer_name: "胡悦、陈婉清",
config_name: "/admin_common",
test_url: "http://sso.test.glsx.com.cn/#/login",
product_url: "http://sso.glsx.com.cn/#/login",
technology: "vue",
git_url:'http://giturl.com/',
git_id:173
},
{
id: 2,
project_title: "账户管理",
project_description: "商户、角色、员工管理",
developer_name: "胡悦、陈婉清",
config_name: "/glsx-oss-account-config",
test_url: "http://glsx-account-merchants.test.glsx.com.cn",
product_url: "http://glsx-account.glsx.com.cn",
technology: "vue",
git_url:'http://giturl.com/',
git_id:173
},
];
import projectImgUrl from "@/assets/project.jpg";
export default {
name: "Home",
data() {
return {
projectData: data,
projectImgUrl,
};
},
mounted() {
this.getList();
},
methods: {
getList() {
this.api.project.getList().then((res) => {
// console.log(res);
this.projectData = res;
});
},
add() {
this.to("HomeAdd");
},
editFn(item) {
this.to("HomeAdd", item);
},
commentsFn(item) {
// this.to("Record", comments);
this.$router.push({
name: "Record",
query: { id: item.id, title: item.project_title },
});
},
delFn(item) {
let that = this;
this.$confirm({
title: "您确认删除吗?",
onOk() {
that.delApiFn(item);
},
onCancel() {},
okText: "确认",
cancelText: "取消",
});
},
delApiFn(item) {
this.api.project.delete({ id: item.id }).then((res) => {
if (res.id) {
this.$message.success("删除成功");
this.getList();
} else {
this.$message.error("删除失败");
}
});
},
checkGitLog(item){
if(!item.git_id){
return this.$message.error("请填写gitlab项目id");
}
// console.log('item: ', item);
this.$router.push({name:'GitLog',query:{projectId:item.git_id}})
}
},
};
</script>
<style lang="scss">
.home-project {
padding: 20px;
.ant-list-item {
padding: 10px;
}
}
.ant-list-split .ant-list-item {
transition: all 0.3s;
}
.ant-list-split .ant-list-item:hover {
border-color: rgba(0, 0, 0, 0.09);
box-shadow: 0 2px 8px rgba(0, 0, 0,0.09);
}
</style>