mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-12 11:19:56 +00:00
perf: 图片预览使用当前页组件,支持多图
This commit is contained in:
parent
5497bd97b2
commit
af9b5ab014
3
resources/assets/js/app.js
vendored
3
resources/assets/js/app.js
vendored
@ -45,12 +45,15 @@ import {
|
|||||||
DropdownMenu,
|
DropdownMenu,
|
||||||
DropdownItem,
|
DropdownItem,
|
||||||
} from 'element-ui';
|
} from 'element-ui';
|
||||||
|
import ImageViewer from 'element-ui/packages/image/src/image-viewer';
|
||||||
|
|
||||||
Vue.component('EAvatar', Avatar);
|
Vue.component('EAvatar', Avatar);
|
||||||
Vue.component('ETooltip', Tooltip);
|
Vue.component('ETooltip', Tooltip);
|
||||||
Vue.component('EPopover', Popover);
|
Vue.component('EPopover', Popover);
|
||||||
Vue.component('EDropdown', Dropdown);
|
Vue.component('EDropdown', Dropdown);
|
||||||
Vue.component('EDropdownMenu', DropdownMenu);
|
Vue.component('EDropdownMenu', DropdownMenu);
|
||||||
Vue.component('EDropdownItem', DropdownItem);
|
Vue.component('EDropdownItem', DropdownItem);
|
||||||
|
Vue.component('EImageViewer', ImageViewer);
|
||||||
|
|
||||||
const originalPush = VueRouter.prototype.push
|
const originalPush = VueRouter.prototype.push
|
||||||
VueRouter.prototype.push = function push(location) {
|
VueRouter.prototype.push = function push(location) {
|
||||||
|
|||||||
@ -342,6 +342,13 @@
|
|||||||
<Badge :count="unreadTotal"/>
|
<Badge :count="unreadTotal"/>
|
||||||
</div>
|
</div>
|
||||||
</DragBallComponent>
|
</DragBallComponent>
|
||||||
|
|
||||||
|
<!--预览图片-->
|
||||||
|
<EImageViewer
|
||||||
|
v-if="previewImageList.length > 0"
|
||||||
|
:urlList="previewImageList"
|
||||||
|
:initialIndex="previewImageIndex"
|
||||||
|
:on-close="closePreviewImage"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -483,7 +490,10 @@ export default {
|
|||||||
'wsMsg',
|
'wsMsg',
|
||||||
|
|
||||||
'clientNewVersion',
|
'clientNewVersion',
|
||||||
'cacheTaskBrowse'
|
'cacheTaskBrowse',
|
||||||
|
|
||||||
|
'previewImageList',
|
||||||
|
'previewImageIndex',
|
||||||
]),
|
]),
|
||||||
|
|
||||||
...mapGetters(['taskData', 'dashboardTask']),
|
...mapGetters(['taskData', 'dashboardTask']),
|
||||||
@ -970,6 +980,11 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
closePreviewImage() {
|
||||||
|
this.$store.state.previewImageIndex = 0;
|
||||||
|
this.$store.state.previewImageList = [];
|
||||||
|
},
|
||||||
|
|
||||||
notificationInit() {
|
notificationInit() {
|
||||||
this.notificationClass = new notificationKoro(this.$L("打开通知成功"));
|
this.notificationClass = new notificationKoro(this.$L("打开通知成功"));
|
||||||
if (this.notificationClass.support) {
|
if (this.notificationClass.support) {
|
||||||
|
|||||||
@ -108,7 +108,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['userToken', 'userId']),
|
...mapState(['userToken', 'userId', 'dialogMsgs']),
|
||||||
|
|
||||||
readList() {
|
readList() {
|
||||||
return this.allList.filter(({read_at}) => read_at)
|
return this.allList.filter(({read_at}) => read_at)
|
||||||
@ -220,6 +220,23 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
viewFile() {
|
viewFile() {
|
||||||
|
const {id, dialog_id, msg} = this.msgData;
|
||||||
|
if (['jpg', 'jpeg', 'gif', 'png'].includes(msg.ext)) {
|
||||||
|
const list = $A.cloneJSON(this.dialogMsgs.filter(item => {
|
||||||
|
return item.dialog_id === dialog_id && item.type === 'file' && ['jpg', 'jpeg', 'gif', 'png'].includes(item.msg.ext);
|
||||||
|
})).sort((a, b) => {
|
||||||
|
return a.id - b.id;
|
||||||
|
});
|
||||||
|
const index = list.findIndex(item => item.id === id);
|
||||||
|
if (index > -1) {
|
||||||
|
this.$store.state.previewImageIndex = index;
|
||||||
|
this.$store.state.previewImageList = list.map(({msg}) => msg.path);
|
||||||
|
} else {
|
||||||
|
this.$store.state.previewImageIndex = 0;
|
||||||
|
this.$store.state.previewImageList = [msg.path];
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
if (this.$Electron) {
|
if (this.$Electron) {
|
||||||
this.$Electron.sendMessage('windowRouter', {
|
this.$Electron.sendMessage('windowRouter', {
|
||||||
name: 'file-msg-' + this.msgData.id,
|
name: 'file-msg-' + this.msgData.id,
|
||||||
|
|||||||
@ -1234,6 +1234,18 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
viewFile(file) {
|
viewFile(file) {
|
||||||
|
if (['jpg', 'jpeg', 'gif', 'png'].includes(file.ext)) {
|
||||||
|
const list = this.fileList.filter(item => ['jpg', 'jpeg', 'gif', 'png'].includes(item.ext))
|
||||||
|
const index = list.findIndex(item => item.id === file.id);
|
||||||
|
if (index > -1) {
|
||||||
|
this.$store.state.previewImageIndex = index;
|
||||||
|
this.$store.state.previewImageList = list.map(({path}) => path);
|
||||||
|
} else {
|
||||||
|
this.$store.state.previewImageIndex = 0;
|
||||||
|
this.$store.state.previewImageList = [file.path];
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
if (this.$Electron) {
|
if (this.$Electron) {
|
||||||
this.$Electron.sendMessage('windowRouter', {
|
this.$Electron.sendMessage('windowRouter', {
|
||||||
name: 'file-task-' + file.id,
|
name: 'file-task-' + file.id,
|
||||||
|
|||||||
6
resources/assets/js/store/state.js
vendored
6
resources/assets/js/store/state.js
vendored
@ -121,7 +121,11 @@ const stateData = {
|
|||||||
themeIsDark: false,
|
themeIsDark: false,
|
||||||
|
|
||||||
// 客户端新版本号
|
// 客户端新版本号
|
||||||
clientNewVersion: null
|
clientNewVersion: null,
|
||||||
|
|
||||||
|
// 预览图片
|
||||||
|
previewImageIndex: 0,
|
||||||
|
previewImageList: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
// 会员信息
|
// 会员信息
|
||||||
|
|||||||
1
resources/assets/sass/element.scss
vendored
1
resources/assets/sass/element.scss
vendored
@ -14,6 +14,7 @@ $--dropdown-menuItem-hover-color: #606266;
|
|||||||
@import "~element-ui/packages/theme-chalk/src/dropdown-menu";
|
@import "~element-ui/packages/theme-chalk/src/dropdown-menu";
|
||||||
@import "~element-ui/packages/theme-chalk/src/dropdown-item";
|
@import "~element-ui/packages/theme-chalk/src/dropdown-item";
|
||||||
@import "~element-ui/packages/theme-chalk/src/notification";
|
@import "~element-ui/packages/theme-chalk/src/notification";
|
||||||
|
@import "~element-ui/packages/theme-chalk/src/image";
|
||||||
|
|
||||||
|
|
||||||
.el-dropdown-menu__item {
|
.el-dropdown-menu__item {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user