refactor: 右键在手机上的操作为长按,所以手机上统一长按为删除

This commit is contained in:
maxmon 2022-04-16 22:57:43 +08:00
parent 9a002f1df8
commit 600f636819
2 changed files with 14 additions and 7 deletions

2
fe/dist/index.html vendored
View File

@ -29,7 +29,7 @@
} }
console.log(isPhone?'手机用户':'电脑用户') console.log(isPhone?'手机用户':'电脑用户')
if (isPhone) { if (isPhone) {
alert('NER中,双击删除实体\n待标注文本需要txt格式的压缩包') alert('NER中,长按删除实体\n待标注文本需要txt格式的压缩包')
} else { } else {
alert('NER中,鼠标右键删除实体\n待标注文本需要txt格式的压缩包') alert('NER中,鼠标右键删除实体\n待标注文本需要txt格式的压缩包')
} }

View File

@ -97,7 +97,7 @@
</div> </div>
</div> </div>
<div v-if="projectType === '命名实体识别'"> <div v-if="projectType === '命名实体识别'">
<span class="word" v-for="(word, idx) in nowText" :key="idx" :id="idx" @contextmenu="stopPrev" @mousedown="startSelect(idx, $event)" @touchstart="startSelect(idx, $event)" @mousemove="pointWord(idx)" @touchmove="pointWordByTouch($event)" <span class="word" v-for="(word, idx) in nowText" :key="idx" :id="idx" @contextmenu="stopPrev" @mousedown="startSelect(idx, $event)" @touchstart="startSelect(idx, $event)" @touchend="stopSelect()" @mousemove="pointWord(idx)" @touchmove="pointWordByTouch($event)"
> >
{{ word }} {{ word }}
</span> </span>
@ -532,13 +532,17 @@ export default {
}, },
startSelect: function (idx, event) { startSelect: function (idx, event) {
if (this.projectType !== '命名实体识别') return if (this.projectType !== '命名实体识别') return
let that = this
let isNeedDel = false let isNeedDel = false
if (event.touches) { if (event.touches) {
// //
if (this.startSelectTouchTs && Date.now() - this.startSelectTouchTs < 300) { setTimeout(() => {
isNeedDel = true if (window.delMarkIdx === idx) {
} delete window.delMarkIdx
this.startSelectTouchTs = Date.now() that.delIdx(idx)
}
}, 300)
window.delMarkIdx = idx
} }
if (event.which === 3) { if (event.which === 3) {
// //
@ -556,6 +560,9 @@ export default {
this.endIdx = idx this.endIdx = idx
this.pointWord(idx, {isDefaultClick: true}) this.pointWord(idx, {isDefaultClick: true})
}, },
stopSelect: function () {
delete window.delMarkIdx
},
checkIsRepeat: function (tarNer) { checkIsRepeat: function (tarNer) {
for (let i = 0; i < this.ners.length; i += 1) { for (let i = 0; i < this.ners.length; i += 1) {
const ner = this.ners[i] const ner = this.ners[i]