mirror of
https://github.com/kuaifan/dootask.git
synced 2026-02-28 12:50:48 +00:00
perf: 聊天内容图片支持下载
This commit is contained in:
parent
d50d32147b
commit
9f8350da3f
@ -1622,13 +1622,23 @@ export default {
|
||||
value: event.target.href,
|
||||
})
|
||||
}
|
||||
if (msgData.type === 'text' && msgData.msg.text.replace(/<[^>]+>/g,"").length > 0) {
|
||||
this.operateCopys.push({
|
||||
type: 'text',
|
||||
icon: '',
|
||||
label: this.operateCopys.length > 0 ? '复制文本' : '复制',
|
||||
value: '',
|
||||
})
|
||||
if (msgData.type === 'text') {
|
||||
if (event.target.nodeName === 'IMG') {
|
||||
this.operateCopys.push({
|
||||
type: 'imagedown',
|
||||
icon: '',
|
||||
label: '下载图片',
|
||||
value: $A.rightDelete(event.target.currentSrc, '_thumb.jpg'),
|
||||
})
|
||||
}
|
||||
if (msgData.msg.text.replace(/<[^>]+>/g,"").length > 0) {
|
||||
this.operateCopys.push({
|
||||
type: 'text',
|
||||
icon: '',
|
||||
label: this.operateCopys.length > 0 ? '复制文本' : '复制',
|
||||
value: '',
|
||||
})
|
||||
}
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
const projectRect = el.getBoundingClientRect();
|
||||
@ -1735,6 +1745,14 @@ export default {
|
||||
}
|
||||
break;
|
||||
|
||||
case 'imagedown':
|
||||
this.$store.dispatch('downUrl', {
|
||||
url: value,
|
||||
token: false
|
||||
})
|
||||
|
||||
break;
|
||||
|
||||
case 'link':
|
||||
this.$copyText(value).then(_ => $A.messageSuccess('复制成功')).catch(_ => $A.messageError('复制失败'))
|
||||
break;
|
||||
|
||||
19
resources/assets/js/store/actions.js
vendored
19
resources/assets/js/store/actions.js
vendored
@ -171,14 +171,21 @@ export default {
|
||||
return
|
||||
}
|
||||
let url = data;
|
||||
let params = {
|
||||
token: state.userToken
|
||||
};
|
||||
let addToken = true
|
||||
if ($A.isJson(data)) {
|
||||
url = data.url;
|
||||
params = data.params || {};
|
||||
url = data.url
|
||||
addToken = !!data.token
|
||||
}
|
||||
if (addToken) {
|
||||
let params = {
|
||||
token: state.userToken
|
||||
};
|
||||
if ($A.isJson(data)) {
|
||||
url = data.url;
|
||||
params = data.params || {};
|
||||
}
|
||||
url = $A.urlAddParams(url, params);
|
||||
}
|
||||
url = $A.urlAddParams(url, params);
|
||||
if ($A.Electron) {
|
||||
$A.Electron.request({action: 'openExternal', url}, () => {
|
||||
// 成功
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user