@aochuang/client-sdk 1.0.285 → 1.0.287
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -246,10 +246,10 @@ export default {
|
|
|
246
246
|
if (!nearest) {
|
|
247
247
|
this.closeSuggestions()
|
|
248
248
|
}
|
|
249
|
-
this.loadSuggestions(nearest)
|
|
249
|
+
this.loadSuggestions(nearest, nearsetInfo)
|
|
250
250
|
}, 200)
|
|
251
251
|
},
|
|
252
|
-
loadSuggestions (keyword) {
|
|
252
|
+
loadSuggestions (keyword, nearestInfo) {
|
|
253
253
|
if (!this.fetchSuggestionsMethod) {
|
|
254
254
|
return
|
|
255
255
|
}
|
|
@@ -258,7 +258,9 @@ export default {
|
|
|
258
258
|
this.suggestionsKeyword = keyword
|
|
259
259
|
clearTimeout(this._loadSuggestionsTimer)
|
|
260
260
|
return this.fetchSuggestionsMethod({
|
|
261
|
-
keyword
|
|
261
|
+
keyword,
|
|
262
|
+
nearestInfo,
|
|
263
|
+
isAtContext: !!(nearestInfo && nearestInfo.isAtContext)
|
|
262
264
|
}).then(rs => {
|
|
263
265
|
this.suggestionsData = rs || []
|
|
264
266
|
}).finally(() => {
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ui-dialog
|
|
3
|
+
v-model="visible"
|
|
4
|
+
title="选择缩略图/原图"
|
|
5
|
+
size="mini"
|
|
6
|
+
:closeable="!loading"
|
|
7
|
+
:close-on-click-modal="false"
|
|
8
|
+
@closed="handleClosed"
|
|
9
|
+
>
|
|
10
|
+
<div class="sdk-chat-control-image-dragable-confirm">
|
|
11
|
+
<div class="sdk-chat-control-image-dragable-confirm__check">
|
|
12
|
+
<ui-radio-group v-model="currentType">
|
|
13
|
+
<ui-radio label="thumb">使用缩略图</ui-radio>
|
|
14
|
+
<ui-radio label="origin">使用原图</ui-radio>
|
|
15
|
+
</ui-radio-group>
|
|
16
|
+
</div>
|
|
17
|
+
<div class="sdk-chat-control-image-dragable-confirm__preview">
|
|
18
|
+
<ui-image :src="innerSrc" width="100%" height="100%" :enable-thumbnail="false"></ui-image>
|
|
19
|
+
</div>
|
|
20
|
+
<div class="sdk-chat-control-image-dragable-confirm__text">
|
|
21
|
+
<template v-if="currentType === 'thumb'">
|
|
22
|
+
缩略图文件较小,拖拽更快,但显示可能失真。
|
|
23
|
+
</template>
|
|
24
|
+
<template v-if="currentType === 'origin'">
|
|
25
|
+
原图显示效果更好,但文件较大,加载可能较慢。
|
|
26
|
+
</template>
|
|
27
|
+
</div>
|
|
28
|
+
<div class="sdk-chat-control-image-dragable-confirm__actions">
|
|
29
|
+
<ui-button :disabled="loading" @click="handleCancelClick">取消</ui-button>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</ui-dialog>
|
|
33
|
+
</template>
|
|
34
|
+
<script>
|
|
35
|
+
import { formatOssPath } from '@aochuang/common/utils/oss'
|
|
36
|
+
import { Dialog as UiDialog, Button as UiButton, Image as UiImage, RadioGroup as UiRadioGroup, Radio as UiRadio } from '@aochuang/common/components'
|
|
37
|
+
import { getOriginImageSrc, getNewImageSrc } from './util'
|
|
38
|
+
|
|
39
|
+
export default {
|
|
40
|
+
name: 'ImageDragableConfirm',
|
|
41
|
+
components: {
|
|
42
|
+
UiDialog,
|
|
43
|
+
UiButton,
|
|
44
|
+
UiImage,
|
|
45
|
+
UiRadioGroup,
|
|
46
|
+
UiRadio
|
|
47
|
+
},
|
|
48
|
+
props: {
|
|
49
|
+
src: {
|
|
50
|
+
type: String
|
|
51
|
+
},
|
|
52
|
+
loading: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: false
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
data () {
|
|
58
|
+
return {
|
|
59
|
+
visible: true,
|
|
60
|
+
currentType: 'thumb'
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
computed: {
|
|
64
|
+
innerSrc () {
|
|
65
|
+
let src = this.src
|
|
66
|
+
if (this.currentType === 'origin') {
|
|
67
|
+
src = getOriginImageSrc(src)
|
|
68
|
+
} else {
|
|
69
|
+
src = getNewImageSrc(src)
|
|
70
|
+
}
|
|
71
|
+
return formatOssPath(src)
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
methods: {
|
|
75
|
+
handleCancelClick () {
|
|
76
|
+
if (this.loading) {
|
|
77
|
+
return
|
|
78
|
+
}
|
|
79
|
+
this.visible = false
|
|
80
|
+
},
|
|
81
|
+
handleClosed () {
|
|
82
|
+
this.$emit('closed')
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
</script>
|
|
87
|
+
<style lang="less">
|
|
88
|
+
.sdk-chat-control-image-dragable-confirm{
|
|
89
|
+
padding: 20px 22px;
|
|
90
|
+
}
|
|
91
|
+
.sdk-chat-control-image-dragable-confirm__check{
|
|
92
|
+
margin-bottom: 6px;
|
|
93
|
+
}
|
|
94
|
+
.sdk-chat-control-image-dragable-confirm__preview{
|
|
95
|
+
height: 360px;
|
|
96
|
+
}
|
|
97
|
+
.sdk-chat-control-image-dragable-confirm__text{
|
|
98
|
+
color: #999;
|
|
99
|
+
line-height: 1.6;
|
|
100
|
+
text-align: left;
|
|
101
|
+
font-size: 12px;
|
|
102
|
+
margin-top: 6px;
|
|
103
|
+
}
|
|
104
|
+
.sdk-chat-control-image-dragable-confirm__actions{
|
|
105
|
+
margin-top: 18px;
|
|
106
|
+
text-align: right;
|
|
107
|
+
.ui-button + .ui-button{
|
|
108
|
+
margin-left: 8px;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
</style>
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
fit="contain"
|
|
44
44
|
@error="handleError"
|
|
45
45
|
@click.native="handleImageClick"
|
|
46
|
+
@dragstart.native="handleImageDragStart"
|
|
46
47
|
></ui-image>
|
|
47
48
|
<template v-if="isOriginImage && innerOptimize">
|
|
48
49
|
<span class="sdk-chat-control-image__hd">
|
|
@@ -69,6 +70,7 @@
|
|
|
69
70
|
fit="contain"
|
|
70
71
|
@error="handleError"
|
|
71
72
|
@click.native="handleImageClick"
|
|
73
|
+
@dragstart.native="handleImageDragStart"
|
|
72
74
|
></ui-image>
|
|
73
75
|
<template v-if="isOriginImage && innerOptimize">
|
|
74
76
|
<span class="sdk-chat-control-image__hd">
|
|
@@ -80,12 +82,18 @@
|
|
|
80
82
|
</div>
|
|
81
83
|
</template>
|
|
82
84
|
</div>
|
|
85
|
+
<image-dragable-confirm
|
|
86
|
+
v-if="showDragOriginConfirm"
|
|
87
|
+
:src="src"
|
|
88
|
+
@closed="handleDragOriginConfirmClosed"
|
|
89
|
+
></image-dragable-confirm>
|
|
83
90
|
</div>
|
|
84
91
|
</template>
|
|
85
92
|
<script>
|
|
86
|
-
import { Image as UiImage, Button as UiButton, Icon as UiIcon
|
|
93
|
+
import { Image as UiImage, Button as UiButton, Icon as UiIcon } from '@aochuang/common/components'
|
|
87
94
|
import { isOriginImage, getNewImageSrc, isNewImage } from './util'
|
|
88
95
|
import BiTooltip from '@aochuang/common/common/tooltip'
|
|
96
|
+
import ImageDragableConfirm from './image-dragable-confirm.vue'
|
|
89
97
|
|
|
90
98
|
export default {
|
|
91
99
|
name: 'SdkChatControlImage',
|
|
@@ -93,8 +101,8 @@ export default {
|
|
|
93
101
|
UiIcon,
|
|
94
102
|
UiImage,
|
|
95
103
|
UiButton,
|
|
96
|
-
|
|
97
|
-
|
|
104
|
+
BiTooltip,
|
|
105
|
+
ImageDragableConfirm
|
|
98
106
|
},
|
|
99
107
|
props: {
|
|
100
108
|
id: {
|
|
@@ -169,13 +177,21 @@ export default {
|
|
|
169
177
|
*/
|
|
170
178
|
onCorrectSrcMethod: {
|
|
171
179
|
type: Function
|
|
180
|
+
},
|
|
181
|
+
/**
|
|
182
|
+
* 拖拽原图拦截。开启后,已下载过原图的图片拖拽时会打开缩略图/原图选择弹窗。
|
|
183
|
+
*/
|
|
184
|
+
enableDragOriginImage: {
|
|
185
|
+
type: Boolean,
|
|
186
|
+
default: false
|
|
172
187
|
}
|
|
173
188
|
},
|
|
174
189
|
data () {
|
|
175
190
|
return {
|
|
176
191
|
defrostMsg: null,
|
|
177
192
|
errorMsg: null,
|
|
178
|
-
correctSrc: null // 纠正后的图片地址,一般是开启了enableOptimize,大图找不到的时候,会回退到小图地址
|
|
193
|
+
correctSrc: null, // 纠正后的图片地址,一般是开启了enableOptimize,大图找不到的时候,会回退到小图地址
|
|
194
|
+
showDragOriginConfirm: false
|
|
179
195
|
}
|
|
180
196
|
},
|
|
181
197
|
computed: {
|
|
@@ -246,6 +262,11 @@ export default {
|
|
|
246
262
|
return !!this.defrostMethod
|
|
247
263
|
}
|
|
248
264
|
},
|
|
265
|
+
watch: {
|
|
266
|
+
src () {
|
|
267
|
+
this.showDragOriginConfirm = false
|
|
268
|
+
}
|
|
269
|
+
},
|
|
249
270
|
methods: {
|
|
250
271
|
handleClick () {
|
|
251
272
|
this.$emit('click')
|
|
@@ -253,6 +274,17 @@ export default {
|
|
|
253
274
|
handleImageClick () {
|
|
254
275
|
this.imageClickMethod && this.imageClickMethod()
|
|
255
276
|
},
|
|
277
|
+
handleImageDragStart (event) {
|
|
278
|
+
if (!this.enableDragOriginImage || !this.isOriginImage) {
|
|
279
|
+
return
|
|
280
|
+
}
|
|
281
|
+
event.preventDefault()
|
|
282
|
+
event.stopPropagation()
|
|
283
|
+
this.showDragOriginConfirm = true
|
|
284
|
+
},
|
|
285
|
+
handleDragOriginConfirmClosed () {
|
|
286
|
+
this.showDragOriginConfirm = false
|
|
287
|
+
},
|
|
256
288
|
handleError () {
|
|
257
289
|
if (this.defrostMethod) {
|
|
258
290
|
this.errorMsg = '加载失败,可能资源被归档~'
|