Compare commits
2 Commits
2fb6828154
...
09e3264ee7
Author | SHA1 | Date |
---|---|---|
lyc | 09e3264ee7 | |
lyc | 7845d9bb1a |
|
@ -8,7 +8,7 @@
|
||||||
http-equiv="Content-Security-Policy"
|
http-equiv="Content-Security-Policy"
|
||||||
content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:"
|
content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:"
|
||||||
/> -->
|
/> -->
|
||||||
<meta http-equiv="Content-Security-Policy" content="connect-src * blob: data:; default-src 'self'; script-src 'self' 'unsafe-eval' http://www.wiris.net 'unsafe-inline'; style-src 'self' 'unsafe-inline' http://www.wiris.net; media-src * blob:;img-src * 'self' data: blob:;font-src 'self' http://www.wiris.net;" />
|
<meta http-equiv="Content-Security-Policy" content="connect-src * blob: data:; default-src 'self' https://wzyzoss.eos-chongqing-3.cmecloud.cn/; script-src 'self' 'unsafe-eval' http://www.wiris.net 'unsafe-inline'; style-src 'self' 'unsafe-inline' http://www.wiris.net; media-src * blob:;img-src * 'self' data: blob:;font-src 'self' http://www.wiris.net;" />
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<el-dialog v-model="isDialog" :show-close="false" width="900" destroy-on-close>
|
<el-dialog v-model="isDialog" :show-close="false" width="900" append-to-body destroy-on-close>
|
||||||
<template #header>
|
<template #header>
|
||||||
<div class="custom-header flex">
|
<div class="custom-header flex">
|
||||||
<span>选择{{ title }}</span>
|
<span>选择{{ title }}</span>
|
||||||
|
@ -15,8 +15,10 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="content-list">
|
<div class="content-list">
|
||||||
<ul>
|
<ul>
|
||||||
<li v-for="(item, index) in fileList" :class="activeIndex == index ? 'li-active' : ''" @click="clickItem(index, item)">
|
<li v-for="(item, index) in fileList" :class="activeIndex == index ? 'li-active' : ''"
|
||||||
|
@click="clickItem(index, item)">
|
||||||
<el-image class="img" :src="url" />
|
<el-image class="img" :src="url" />
|
||||||
|
<el-button type="primary" class="prev-btn" @click.stop="onPrevItem(item)">预览</el-button>
|
||||||
<el-text truncated>{{ item.fileName }}</el-text>
|
<el-text truncated>{{ item.fileName }}</el-text>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -24,8 +26,8 @@
|
||||||
</div>
|
</div>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
<el-upload class="upload-demo" :action="uploadFileUrl" :limit="1" :show-file-list="false"
|
<el-upload class="upload-demo" :action="uploadFileUrl" :limit="1" :show-file-list="false" :headers="headers"
|
||||||
:headers="headers" :on-success="onSuccess">
|
:on-success="onSuccess">
|
||||||
<el-button type="primary">上传</el-button>
|
<el-button type="primary">上传</el-button>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
<div>
|
<div>
|
||||||
|
@ -37,6 +39,31 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
<el-dialog v-model="prevVisible" fullscreen :show-close="false" class="prev-dialog">
|
||||||
|
<template #header>
|
||||||
|
<div class="custom-header flex">
|
||||||
|
<span>预览</span>
|
||||||
|
<i class="iconfont icon-guanbi" @click="prevVisible = false"></i>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<div style="height: calc(100vh - 120px);">
|
||||||
|
<template v-if="getFileSuffix(prevItem.fileUrl) == 'pdf'">
|
||||||
|
<iframe :src="prevItem.fileUrl"
|
||||||
|
frameborder="0" width="100%" height="100%"></iframe>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<el-image :src="prevItem.fileUrl" style="height:100%"/>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<div></div>
|
||||||
|
<el-button type="primary" @click="prevVisible = false">
|
||||||
|
关闭
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
@ -47,6 +74,7 @@ import { sessionStore } from '@/utils/store'
|
||||||
import { dataSetJson } from '@/utils/comm.js'
|
import { dataSetJson } from '@/utils/comm.js'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
import useUserStore from '@/store/modules/user'
|
import useUserStore from '@/store/modules/user'
|
||||||
|
import { getFileSuffix } from '@/utils/ruoyi.js'
|
||||||
import emitter from '@/utils/mitt';
|
import emitter from '@/utils/mitt';
|
||||||
|
|
||||||
const userInfo = useUserStore().user
|
const userInfo = useUserStore().user
|
||||||
|
@ -56,6 +84,7 @@ const headers = ref({ Authorization: "Bearer " + getToken() });
|
||||||
const url = 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fsafe-img.xhscdn.com%2Fbw1%2F11044b08-04c1-41a0-a453-1fd20b58a614%3FimageView2%2F2%2Fw%2F1080%2Fformat%2Fjpg&refer=http%3A%2F%2Fsafe-img.xhscdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1732953359&t=7ab1d1b3a903db85b1149914407aea35'
|
const url = 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fsafe-img.xhscdn.com%2Fbw1%2F11044b08-04c1-41a0-a453-1fd20b58a614%3FimageView2%2F2%2Fw%2F1080%2Fformat%2Fjpg&refer=http%3A%2F%2Fsafe-img.xhscdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1732953359&t=7ab1d1b3a903db85b1149914407aea35'
|
||||||
|
|
||||||
const isDialog = defineModel()
|
const isDialog = defineModel()
|
||||||
|
const prevVisible = ref(false)
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
modeType: {
|
modeType: {
|
||||||
|
@ -99,15 +128,15 @@ const activeIndex = ref(0)
|
||||||
const dataset_id = ref('')
|
const dataset_id = ref('')
|
||||||
|
|
||||||
// 上传成功
|
// 上传成功
|
||||||
const onSuccess = async (response) =>{
|
const onSuccess = async (response) => {
|
||||||
console.log(response,'response')
|
console.log(response, 'response')
|
||||||
let data = {
|
let data = {
|
||||||
url: response.url,
|
url: response.url,
|
||||||
dataset_id: dataset_id.value
|
dataset_id: dataset_id.value
|
||||||
}
|
}
|
||||||
const res = await completion(data)
|
const res = await completion(data)
|
||||||
|
|
||||||
if(res.data.code != 200) return
|
if (res.data.code != 200) return
|
||||||
let docData = {
|
let docData = {
|
||||||
fileUrl: response.url,
|
fileUrl: response.url,
|
||||||
fileId: response.file.id,
|
fileId: response.file.id,
|
||||||
|
@ -127,11 +156,11 @@ const curNode = reactive({})
|
||||||
|
|
||||||
const fileList = ref([])
|
const fileList = ref([])
|
||||||
const curFile = reactive({})
|
const curFile = reactive({})
|
||||||
const getList = () =>{
|
const getList = () => {
|
||||||
docList({
|
docList({
|
||||||
userId: userInfo.userId,
|
userId: userInfo.userId,
|
||||||
dataset_id: dataset_id.value
|
dataset_id: dataset_id.value
|
||||||
}).then( res =>{
|
}).then(res => {
|
||||||
fileList.value = [...res.rows]
|
fileList.value = [...res.rows]
|
||||||
Object.assign(curFile, fileList.value[0])
|
Object.assign(curFile, fileList.value[0])
|
||||||
})
|
})
|
||||||
|
@ -140,12 +169,19 @@ const getList = () =>{
|
||||||
const clickItem = (index, item) => {
|
const clickItem = (index, item) => {
|
||||||
activeIndex.value = index
|
activeIndex.value = index
|
||||||
Object.assign(curFile, item)
|
Object.assign(curFile, item)
|
||||||
emitter.emit('curFile',item)
|
emitter.emit('curFile', item)
|
||||||
|
}
|
||||||
|
|
||||||
|
const prevItem = reactive({})
|
||||||
|
const onPrevItem = (item) => {
|
||||||
|
console.log(item)
|
||||||
|
Object.assign(prevItem, item)
|
||||||
|
prevVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
onMounted(() =>{
|
onMounted(() => {
|
||||||
let data = sessionStore.get('subject.curNode')
|
let data = sessionStore.get('subject.curNode')
|
||||||
Object.assign(curNode, data);
|
Object.assign(curNode, data);
|
||||||
|
|
||||||
|
@ -155,7 +191,6 @@ onMounted(() =>{
|
||||||
})
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.custom-header {
|
.custom-header {
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
@ -192,6 +227,8 @@ onMounted(() =>{
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
margin-right: 20px;
|
margin-right: 20px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
.img {
|
.img {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
@ -203,6 +240,10 @@ onMounted(() =>{
|
||||||
&:hover {
|
&:hover {
|
||||||
background: #E0EAFF;
|
background: #E0EAFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&:hover .prev-btn {
|
||||||
|
transform: translate(-50%, -50%)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.li-active {
|
.li-active {
|
||||||
|
@ -212,9 +253,20 @@ onMounted(() =>{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.dialog-footer{
|
|
||||||
|
.dialog-footer {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.prev-btn {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%) translateY(-110px);
|
||||||
|
/* 按钮初始位置在容器外 */
|
||||||
|
transition: transform 0.3s ease-in-out;
|
||||||
|
/* 设置过渡效果 */
|
||||||
|
}
|
||||||
</style>
|
</style>
|
|
@ -14,8 +14,14 @@ const pdfUrl = ref('')
|
||||||
|
|
||||||
onMounted(async () =>{
|
onMounted(async () =>{
|
||||||
await nextTick()
|
await nextTick()
|
||||||
const { fileurl } = sessionStore.get('subject.curBook')
|
|
||||||
pdfUrl.value = import.meta.env.VITE_APP_RES_FILE_PATH + fileurl.replace('.txt','.pdf')
|
let data = sessionStore.get('subject.curBook')
|
||||||
|
let fileurl = data.fileurl
|
||||||
|
|
||||||
|
if(fileurl == ''){
|
||||||
|
fileurl = `${data.edustage}-${data.edusubject}-课标.txt`
|
||||||
|
}
|
||||||
|
pdfUrl.value = import.meta.env.VITE_APP_RES_FILE_PATH + fileurl.replace('.txt', '.pdf')
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue