|
@@ -36,6 +36,9 @@ import forwordTree from "@/components/forwordTree/index.vue"; //选择文件发
|
|
|
//websocket连接====
|
|
|
import useWebsoctStore from "@/store/modules/websocket";
|
|
|
import { ElMessage } from "element-plus";
|
|
|
+import { preview } from "@/api/common/common.js";
|
|
|
+import { canPreviewFile, rightMenuRole, setIcon } from "@/utils/index.js";
|
|
|
+import ImgPreview from '@/components/ImgPreview/ImgPreview.vue'
|
|
|
const router = useRouter(); //注册路由
|
|
|
const websoctStore = useWebsoctStore();
|
|
|
//====
|
|
@@ -56,6 +59,10 @@ const chatRecords = reactive({ data: [] });
|
|
|
const loading = ref(false);
|
|
|
const addFileTab = inject("addFileTab");
|
|
|
const wangzhi=import.meta.env.VITE_APP_BASE_API
|
|
|
+const copyFileType = ref();
|
|
|
+const previewData = ref();
|
|
|
+const showPreview = ref(false);
|
|
|
+const loadingPreview = ref(false);
|
|
|
const sendCont = reactive({
|
|
|
//发送聊天内容数据组装
|
|
|
data: {
|
|
@@ -193,11 +200,28 @@ const clickNewPerson = async () => {
|
|
|
open.value = true;
|
|
|
};
|
|
|
// 点击文件预览
|
|
|
-const toPreviewFile = (index,file)=>{
|
|
|
- const filedata = toRaw(file)
|
|
|
- addFileTab(filedata, 0,0);
|
|
|
- console.log('file',filedata);
|
|
|
+const toPreviewFile = async (index,file)=>{
|
|
|
+ copyFileType.value = file.fileType;
|
|
|
+ loadingPreview.value = true;
|
|
|
+ const filePreview = canPreviewFile(file.fileType);
|
|
|
+ if (filePreview) {
|
|
|
+ loadingPreview.value = false;
|
|
|
+ addFileTab(file, 0, 0);
|
|
|
+ } else {
|
|
|
+ const res = await preview(file.docId);
|
|
|
+ showPreview.value = true;
|
|
|
+ previewData.value = URL.createObjectURL(res);
|
|
|
+ loadingPreview.value = false;
|
|
|
+ }
|
|
|
}
|
|
|
+//关闭图片预览事件
|
|
|
+const closeImgPreview = () => {
|
|
|
+ // console.log('close');
|
|
|
+ showPreview.value = false;
|
|
|
+};
|
|
|
+const setImg = (type) => {
|
|
|
+ return setIcon(type);
|
|
|
+};
|
|
|
//点击左侧聊天列表
|
|
|
const clickPersonIndex = ref("");
|
|
|
const clickPersonId = ref(0);
|
|
@@ -812,7 +836,7 @@ onMounted(() => {
|
|
|
>
|
|
|
<img
|
|
|
v-if="record.msgType == '1'"
|
|
|
- :src="word"
|
|
|
+ :src="setImg(record.file.fileType)"
|
|
|
class="head-sculpture"
|
|
|
/>
|
|
|
<div
|
|
@@ -907,6 +931,17 @@ onMounted(() => {
|
|
|
:forwardTreeData="forwardTreeData.data"
|
|
|
@forwardChangeMsg="forwardChangeMsg"
|
|
|
></forwordTree>
|
|
|
+ <ImgPreview
|
|
|
+ :previewData="previewData"
|
|
|
+ :copyFileType="copyFileType"
|
|
|
+ :showPreview="showPreview"
|
|
|
+ @closeImgPreview="closeImgPreview"
|
|
|
+ ></ImgPreview>
|
|
|
+ <div
|
|
|
+ v-loading.fullscreen="loadingPreview"
|
|
|
+ v-if="loadingPreview"
|
|
|
+ class="lodingBox"
|
|
|
+ ></div>
|
|
|
</template>
|
|
|
|
|
|
<style lang="scss" scoped>
|