gitLog.vue
4.88 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
<template>
<div class="gitlog">
<div class="branch">
<a-select
default-value="master"
style="width: 120px"
@change="handleChange"
>
<a-select-option v-for="(item,index) in branchs" :key="index+'branch'" :value="index"> {{ item.name}} </a-select-option>
</a-select>
<span class="current">当前分支:{{currentBranch.name}}</span>
</div>
<a-list item-layout="horizontal" :data-source="data">
<a-list-item slot="renderItem" slot-scope="item">
<a-list-item-meta :description="item.message">
<span slot="title"
>{{ item.title }}---{{ item.created_at | dateTime }} by author:
{{ item.author }}
<span class="author">{{ item.author_name }}</span></span
>
<a-avatar
slot="avatar"
src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"
/>
</a-list-item-meta>
</a-list-item>
</a-list>
</div>
</template>
<script>
import moment from "moment";
export default {
name: "",
props: {},
data() {
return {
data: [
{
id: "98285ed4f3df5ef58a01607651f61592248dd101",
short_id: "98285ed4",
title: "add:主题色加深色值调整",
created_at: "2022-02-10T14:00:54.000+08:00",
parent_ids: ["37efaa1ece09035aafd490a8e4d94931b23fedd2"],
message: "add:主题色加深色值调整\n",
author_name: "luyt",
author_email: "q9OUYzI2",
authored_date: "2022-02-10T14:00:54.000+08:00",
committer_name: "luyt",
committer_email: "q9OUYzI2",
committed_date: "2022-02-10T14:00:54.000+08:00",
},
],
branchs: [
{
name: "SCRM-V1.0.2",
commit: {
id: "266eb49b58dbc3dfdf12e52395fb5de9edcbf47a",
short_id: "266eb49b",
title: "1.3.7",
created_at: "2022-01-17T14:26:31.000+08:00",
parent_ids: ["aa7f2e56c33073428325efb7deff5f25e1da9c80"],
message: "1.3.7\n",
author_name: "limin",
author_email: "17653212@qq.com",
authored_date: "2022-01-17T14:26:31.000+08:00",
committer_name: "limin",
committer_email: "17653212@qq.com",
committed_date: "2022-01-17T14:26:31.000+08:00",
},
merged: true,
protected: false,
developers_can_push: false,
developers_can_merge: false,
},
{
name: "dev",
commit: {
id: "d51cb098bf2eae3295c336c9cf8000776e8e2a3a",
short_id: "d51cb098",
title: "add:修改table左对齐,金额右对齐",
created_at: "2022-02-16T15:39:30.000+08:00",
parent_ids: ["a423fa7e0afb347a2854ac03069dd19167d3acbb"],
message: "add:修改table左对齐,金额右对齐\n",
author_name: "luyt",
author_email: "q9OUYzI2",
authored_date: "2022-02-16T15:39:30.000+08:00",
committer_name: "luyt",
committer_email: "q9OUYzI2",
committed_date: "2022-02-16T15:39:30.000+08:00",
},
merged: false,
protected: false,
developers_can_push: false,
developers_can_merge: false,
},
],
currentBranch: {
"name": "master",
"commit": {
"id": "98285ed4f3df5ef58a01607651f61592248dd101",
"short_id": "98285ed4",
"title": "add:主题色加深色值调整",
"created_at": "2022-02-10T14:00:54.000+08:00",
"parent_ids": [
"37efaa1ece09035aafd490a8e4d94931b23fedd2"
],
"message": "add:主题色加深色值调整\n",
"author_name": "luyt",
"author_email": "q9OUYzI2",
"authored_date": "2022-02-10T14:00:54.000+08:00",
"committer_name": "luyt",
"committer_email": "q9OUYzI2",
"committed_date": "2022-02-10T14:00:54.000+08:00"
},
"merged": false,
"protected": true,
"developers_can_push": false,
"developers_can_merge": false
},
};
},
filters: {
dateTime(value) {
if (!value) return;
return moment(value).format("YYYY-MM-DD HH:MM:ss");
},
},
created() {
this.getBranchData()
},
mounted() {},
methods: {
handleChange(value) {
this.currentBranch = this.branchs[value]
// console.log('value: ', value);
},
defaultBranch(){
},
getBranchData(value) {
console.log('value: ', value);
this.api.gitLog.getBranches(173).then(res=>{
console.log('res: ', res);
})
}
},
components: {},
computed: {},
};
</script>
<style lang='scss'>
.gitlog {
.branch {
margin-bottom: 30px;
.current {
margin-left: 20px;
}
}
.author {
color: #008dff;
}
}
</style>