Skip to content

Commit ba3b25a

Browse files
committed
add multi-label
1 parent a312710 commit ba3b25a

174 files changed

Lines changed: 946 additions & 6946 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,23 +60,23 @@
6060
/server-golang/.vscode/settings.json
6161

6262
# front-end-gin
63-
/front-end-gin/.DS_Store
64-
/front-end-gin/node_modules/
65-
/front-end-gin/dist/
66-
/front-end-gin/npm-debug.log*
67-
/front-end-gin/yarn-debug.log*
68-
/front-end-gin/yarn-error.log*
69-
/front-end-gin/test/unit/coverage/
63+
/front-end/.DS_Store
64+
/front-end/node_modules/
65+
/front-end/dist/
66+
/front-end/npm-debug.log*
67+
/front-end/yarn-debug.log*
68+
/front-end/yarn-error.log*
69+
/front-end/test/unit/coverage/
7070

7171
# Editor directories and files
72-
/front-end-gin/.idea
73-
/front-end-gin/.vscode
74-
/front-end-gin/*.suo
75-
/front-end-gin/*.ntvs*
76-
/front-end-gin/*.njsproj
77-
/front-end-gin/*.sln
72+
/front-end/.idea
73+
/front-end/.vscode
74+
/front-end/*.suo
75+
/front-end/*.ntvs*
76+
/front-end/*.njsproj
77+
/front-end/*.sln
7878

79-
/front-end-gin/*.old
79+
/front-end/*.old
8080

8181

8282
_book/*

config/labelproject-java.yml

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ version: '3.3'
22
services:
33
db:
44
container_name: mysql
5-
image: danxing/mysql:latest
5+
image: mysql:latest
66
environment:
77
MYSQL_ROOT_PASSWORD: 123456
88
networks:
9-
extnetwork:
9+
extnetwork-java:
1010
ipv4_address: 172.20.0.2
1111
volumes:
12-
- "/home/xingzheng/data/mysql/data:/var/lib/mysql:rw"
12+
- "/home/xingzheng/data/mysql2/data:/var/lib/mysql:rw"
1313
ports:
1414
- 3306:3306
1515

@@ -18,30 +18,34 @@ services:
1818
image: redis:3.2
1919
command: redis-server
2020
networks:
21-
extnetwork:
21+
extnetwork-java:
2222
ipv4_address: 172.20.0.3
2323
web:
24-
container_name: labelproject-back
25-
image: danxing/labelproject-back:2.2.0
24+
container_name: labelproject-back-test
25+
image: labelproject-back:test
2626
networks:
27-
extnetwork:
27+
extnetwork-java:
2828
ipv4_address: 172.20.0.4
2929
volumes:
30-
- "/home/xingzheng/data/labelproject/home:/home"
30+
- "/home/xingzheng/data/labelproject2/home:/home"
3131
ports:
3232
- 8887:8887
33+
links:
34+
- cache:redis
35+
- db:mysql
36+
3337
web-fore:
3438
container_name: labelproject-fore-jave
35-
image: labelproject-fore-spring:latest
39+
image: labelproject-foreground-java:test
3640
networks:
37-
extnetwork:
38-
ipv4_address: 172.20.0.5
41+
extnetwork-java:
42+
ipv4_address: 172.20.0.6
3943
ports:
4044
- 8889:80
4145

4246

4347
networks:
44-
extnetwork:
48+
extnetwork-java:
4549
ipam:
4650
config:
4751
- subnet: 172.20.0.0/16

front-end/src/assets/css/label.core.css

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,19 @@ html {
108108
border-radius: 3px;
109109
}
110110

111+
.label-popup .multi-label-label,
112+
.label-popup textarea {
113+
width: 100%;
114+
border: 0;
115+
background-color: rgb(255, 255, 255);
116+
color: #000;
117+
padding: 5px 3px;
118+
font-size: 15px;
119+
resize: none;
120+
margin: 0 0 5px 0;
121+
border-radius: 3px;
122+
}
123+
111124
.label-popup button {
112125
border: 0;
113126
background-color: rgba(231, 76, 60, 0.85);

front-end/src/assets/js/label.core.js

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
author:q6q64399([email protected])
44
*/
55
"use strict";
6-
function LabelCore(element, labelList, data, saveCB, confirmCB, addCB, deleteCB) {
6+
function LabelCore(element, labelList, multi, data, saveCB, confirmCB, addCB, deleteCB) {
77
const threshold = 5;
88
const strokeWidth = 3;
99

@@ -32,6 +32,8 @@ function LabelCore(element, labelList, data, saveCB, confirmCB, addCB, deleteCB)
3232
save: element.querySelector(".label-save-label"),
3333
delete: element.querySelector(".label-delete-label"),
3434
label: element.querySelector(".label-label"),
35+
// label: document.getElementById("test"),
36+
// label_multi: element.querySelectorAll(".label_label-multi"),
3537
crowd: element.querySelector(".label-crowd"),
3638
desc: element.querySelector(".label-desc")
3739
};
@@ -175,7 +177,18 @@ function LabelCore(element, labelList, data, saveCB, confirmCB, addCB, deleteCB)
175177
e.querySelector("li").classList.add("active");
176178
},
177179
savelabel: function() {
178-
method.createArea(panel.label.value, panel.desc.value, labelList[panel.label.value].color, panel.crowd.checked);
180+
// method.createArea(panel.label.value, panel.desc.value, labelList[panel.label.value].color, panel.crowd.checked);
181+
182+
const selected = panel.label.querySelectorAll("option:checked");
183+
const values = Array.from(selected).map(el => el.value);
184+
method.createArea(
185+
values,
186+
panel.desc.value,
187+
labelList[panel.label.value].color,
188+
panel.crowd.checked
189+
);
190+
191+
179192
popup.style.display = "none";
180193
lock = false;
181194
mode == 4 && (svgLock = false);
@@ -367,15 +380,27 @@ function LabelCore(element, labelList, data, saveCB, confirmCB, addCB, deleteCB)
367380
for (const item of pointList) {
368381
item[2] == 0 && tempList.push(item);
369382
}
370-
areaList.push({
371-
id: labelList[index].id,
372-
index: index,
373-
desc: desc,
374-
color: color,
375-
type: mode == 2 || (mode == 4 && nowDrawType == 0) ? 0 : 1,
376-
points: tempList,
377-
iscrowd: crowd ? 1 : 0
378-
});
383+
// areaList.push({
384+
// id: labelList[index].id,
385+
// index: index,
386+
// desc: desc,
387+
// color: color,
388+
// type: mode == 2 || (mode == 4 && nowDrawType == 0) ? 0 : 1,
389+
// points: tempList,
390+
// iscrowd: crowd ? 1 : 0
391+
// });
392+
!Array.isArray(index) && (index = [index]);
393+
for (const key of index) {
394+
areaList.push({
395+
id: labelList[key].id,
396+
index: index,
397+
desc: desc,
398+
color: labelList[key].color,
399+
type: mode == 2 || (mode == 4 && nowDrawType == 0) ? 0 : 1,
400+
points: tempList,
401+
iscrowd: crowd ? 1 : 0
402+
});
403+
}
379404
let pathStr = "";
380405
for (let point of tempList) {
381406
pathStr += `${point[0]},${point[1]} `;
@@ -498,7 +523,9 @@ function LabelCore(element, labelList, data, saveCB, confirmCB, addCB, deleteCB)
498523
e.value = key;
499524
e.innerHTML = item.label;
500525
e.style.color = item.color;
526+
console.log("i:",i,"label",panel.label)
501527
panel.label.appendChild(e);
528+
// panel.label_multi.appendChild(e);
502529

503530
if (tempSelectId != -1 && item.id == tempSelectId) {
504531
p = i;

front-end/src/components/Label.vue

Lines changed: 41 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,25 @@
128128
</div>
129129
</div>
130130
<div class="label-popup" style="display: none;">
131-
<select class="label-label"></select>
131+
<select class="label-label" multiple></select>
132+
<!-- <el-button type="primary" disabled>多选</el-button> -->
133+
<!-- <el-select class="multi-label-label" v-model="value1" multiple placeholder="请选择">
134+
<el-option
135+
v-for="item in label"
136+
:key="item.id"
137+
:label="item.label"
138+
:value="item.id">
139+
</el-option>
140+
</el-select> -->
141+
132142
<div class="label-checkbox">
133143
<input type="checkbox" class="label-crowd" value="iscrowd" />
134144
<label for="iscrowd">使用RLE格式</label>
135145
</div>
136146
<textarea class="label-desc" rows="5" placeholder="描述"></textarea>
137-
<button class="label-save-label" type="button">保存</button>
147+
<button class="label-save-label" @click="print" type="button">保存</button>
138148
<button class="label-delete-label" type="button">删除</button>
149+
139150
</div>
140151

141152
<div class="label-list">
@@ -169,7 +180,7 @@
169180

170181
</div>
171182
<!-- 类型 -->
172-
<el-dialog title="添加分类标签" :visible.sync="classify.dialogVisible" width="30%">
183+
<!-- <el-dialog title="添加分类标签" :visible.sync="classify.dialogVisible" width="30%">
173184
<el-form :inline="true">
174185
<el-form-item label="标签" prop="group">
175186
<el-select v-model="classify.select" multiple collapse-tags style="margin-left: 20px;" placeholder="请选择标签">
@@ -182,7 +193,7 @@
182193
<el-button @click="classify.dialogVisible = false">取 消</el-button>
183194
<el-button type="primary" @click="classifyAdd">确 定</el-button>
184195
</span>
185-
</el-dialog>
196+
</el-dialog> -->
186197
</div>
187198
</template>
188199
<script>
@@ -197,6 +208,8 @@ export default {
197208
return {
198209
img: "",
199210
label: [],
211+
select: [],
212+
value1: [],
200213
name: "",
201214
area: [],
202215
count: 0,
@@ -223,15 +236,36 @@ export default {
223236
select: [],
224237
dialogVisible: false
225238
},
226-
labelIndex: 0
227-
};
239+
labelIndex: 0,
240+
options: [{
241+
value: '选项1',
242+
label: '黄金糕'
243+
}, {
244+
value: '选项2',
245+
label: '双皮奶'
246+
}, {
247+
value: '选项3',
248+
label: '蚵仔煎'
249+
}, {
250+
value: '选项4',
251+
label: '龙须面'
252+
}, {
253+
value: '选项5',
254+
label: '北京烤鸭'
255+
}]
256+
}
228257
},
229258
watch: {
230259
id() {
231260
this.load(true);
232261
}
233262
},
234263
methods: {
264+
print(){
265+
console.log(this.options.value1);
266+
console.log(this.label);
267+
console.log(this.value1);
268+
},
235269
showDelete(){
236270
console.log("delete");
237271
this.loadMark();
@@ -257,20 +291,6 @@ export default {
257291
format(percentage) {
258292
return percentage === 100 ? '' : `${percentage}%`;
259293
},
260-
classifyClick() {
261-
this.classify.label = [];
262-
for (const item of this.label) {
263-
this.classify.label.push({ label: item.label, value: item.id });
264-
}
265-
this.classify.dialogVisible = true;
266-
},
267-
classifyAdd() {
268-
this.labelCore.clean();
269-
for (const id of this.classify.select) {
270-
this.labelCore.setClassify(id);
271-
}
272-
this.classify.dialogVisible = false;
273-
},
274294
load(hasCom) {
275295
if (this.account.group == 1) {
276296
this.getImgInfo(hasCom);
@@ -377,6 +397,7 @@ export default {
377397
this.labelCore = new LabelCore(
378398
document.querySelector(".label-core"),
379399
this.label,
400+
this.value1,
380401
this.area,
381402
data => {
382403
this.saveLabelArea(data);

front-end/src/models/Login.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ function logout(account) {
33
return ajax("/api/logout",account);
44
}
55
function login(username, password) {
6-
// return ajaxPost("/api/login", `username=${username}&password=${password}`);
7-
var login = {'username':username,'password':password};
8-
return ajaxPost("/api/login", login);
6+
return ajaxPost("/api/login", `username=${username}&password=${password}`);
7+
// var login = {'username':username,'password':password};
8+
// return ajaxPost("/api/login", login);
99
}
1010
export {login, logout };

front-end/src/models/Service.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//const HOST = "http://121.48.165.37:8887";
33
//const HOST = "http://47.100.254.133:23333";
44
//const HOST="http://47.95.0.117:8887";
5-
const HOST = "http://localhost:9998";
5+
const HOST = "http://47.95.0.117:8887";
66
//upload image files(*.png,*.jpe?g)
77
const AppendFileAPI = HOST + "/api/appendFile";
88
//upload compressed file(*.zip)
@@ -20,8 +20,8 @@ function ajaxPost(path, body, noCode) {
2020
method: "POST",
2121
credentials: "include",
2222
headers,
23-
// body: path == "/api/login" ? body : JSON.stringify(body)
24-
body:JSON.stringify(body)
23+
body: path == "/api/login" ? body : JSON.stringify(body)
24+
// body:JSON.stringify(body)
2525
})
2626
.then(response => {
2727
console.log(response)

front-end/src/src/App.vue

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)