Compare commits

...

2 Commits

Author SHA1 Message Date
lyc 27b0457eef Merge pull request 'edit' (#62) from lyc-dev into main 2024-11-25 11:00:42 +08:00
lyc 34e74c5ec6 edit 2024-11-25 10:59:56 +08:00
5 changed files with 42 additions and 21 deletions

View File

@ -56,10 +56,10 @@ const title = computed(() => {
const radio = ref(1) const radio = ref(1)
const radioList = ref([ const radioList = ref([
{ label: '浏览研读', value: 1 }, { label: '浏览研读', value: 1 },
{ label: '跨学科研读', value: 2 }, // { label: '', value: 2 },
{ label: '跨学段研读', value: 3 }, // { label: '', value: 3 },
{ label: '课标修订研读', value: 4 }, // { label: '', value: 4 },
{ label: '自由研读', value: 5 }, // { label: '', value: 5 },
]) ])
const list = ref([ const list = ref([
{ {

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="container-header flex"> <div class="container-header flex">
<div class="header-left flex"> <div class="header-left flex">
<el-button link @click="showDialog = true"> <el-button link @click="onClick">
{{ curNode.edustage}}{{ curNode.edusubject }}{{ type == 1 ? '课标研读': '教材分析'}}<i class="iconfont icon-xiangxia"></i> {{ curNode.edustage}}{{ curNode.edusubject }}{{ type == 1 ? '课标研读': '教材分析'}}<i class="iconfont icon-xiangxia"></i>
</el-button> </el-button>
</div> </div>
@ -20,12 +20,14 @@
</template> </template>
</el-dropdown> </el-dropdown>
<div> <div>
<el-button type="primary" link @click="onAdd"> <el-button type="primary" link @click="onAdd">
<el-icon> <el-icon>
<Plus /> <Plus />
</el-icon> </el-icon>
添加提示词 添加提示词
</el-button> </el-button>
<!-- <el-button type="danger">删除</el-button> -->
<!-- <el-button type="primary" link>保存模板</el-button> --> <!-- <el-button type="primary" link>保存模板</el-button> -->
<el-button type="primary" @click="aiRead">一键研读</el-button> <el-button type="primary" @click="aiRead">一键研读</el-button>
</div> </div>
@ -53,9 +55,7 @@ const props = defineProps({
default: 1 default: 1
} }
}) })
watch(() => props.type, (newValue) => {
console.log(newValue, 'newValue2');
}, { immediate: true });
const emit = defineEmits(['changeTemp', 'onRead']) const emit = defineEmits(['changeTemp', 'onRead'])
@ -104,6 +104,11 @@ const onAdd = () => {
wordDialog.value = true wordDialog.value = true
} }
const onClick = () =>{
if(props.type == 1) return
showDialog.value = true
}
onUnmounted(() => { onUnmounted(() => {
emitter.off('onGetMain') emitter.off('onGetMain')
}) })

View File

@ -15,6 +15,8 @@ const pdfUrl = ref('')
onMounted(async () =>{ onMounted(async () =>{
await nextTick() await nextTick()
const { fileurl } = sessionStore.get('subject.curBook') const { fileurl } = sessionStore.get('subject.curBook')
console.log(fileurl,'fileurl');
pdfUrl.value = import.meta.env.VITE_APP_RES_FILE_PATH + fileurl.replace('.txt','.pdf') pdfUrl.value = import.meta.env.VITE_APP_RES_FILE_PATH + fileurl.replace('.txt','.pdf')
}) })
</script> </script>

View File

@ -60,6 +60,7 @@ import { sessionStore } from '@/utils/store'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { dataSetJson } from '@/utils/comm.js' import { dataSetJson } from '@/utils/comm.js'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import emitter from '@/utils/mitt';
const userInfo = useUserStore().user const userInfo = useUserStore().user
const textarea = ref('') const textarea = ref('')
@ -132,6 +133,8 @@ const saveAdjust = (item) =>{
} }
const curFile = reactive({}) const curFile = reactive({})
const dataset_id = ref('') const dataset_id = ref('')
const fileList = ref([]) const fileList = ref([])
@ -144,7 +147,9 @@ const getList = () =>{
Object.assign(curFile, fileList.value[0]) Object.assign(curFile, fileList.value[0])
}) })
} }
emitter.on('curFile', (item) =>{
changeFile(item)
})
const changeFile = (val) =>{ const changeFile = (val) =>{
Object.assign(curFile, val); Object.assign(curFile, val);

View File

@ -8,16 +8,16 @@
</template> </template>
<div class="dialog-content"> <div class="dialog-content">
<div class="flex dialog-top"> <div class="flex dialog-top">
<el-radio-group v-model="radio" @change="changeRadio"> <!-- <el-radio-group v-model="radio" @change="changeRadio">
<el-radio :value="item.value" v-for="item in radioList">{{ item.label }}</el-radio> <el-radio :value="item.value" v-for="item in radioList">{{ item.label }}</el-radio>
</el-radio-group> </el-radio-group> -->
</div> </div>
<div class="content-list"> <div class="content-list">
<ul> <ul>
<li v-for="(item, index) in list" :class="activeIndex == index ? 'li-active' : ''" @click="clickItem(index)"> <li v-for="(item, index) in fileList" :class="activeIndex == index ? 'li-active' : ''" @click="clickItem(index, item)">
<el-image class="img" :src="item.url" /> <el-image class="img" :src="url" />
<span>{{ item.name }}</span> <el-text truncated>{{ item.fileName }}</el-text>
</li> </li>
</ul> </ul>
</div> </div>
@ -47,6 +47,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 emitter from '@/utils/mitt';
const userInfo = useUserStore().user const userInfo = useUserStore().user
const uploadFileUrl = ref(import.meta.env.VITE_APP_BASE_API + "/common/upload"); const uploadFileUrl = ref(import.meta.env.VITE_APP_BASE_API + "/common/upload");
@ -93,11 +94,7 @@ const changeRadio = () => {
}) })
} }
} }
const activeIndex = ref(-1) const activeIndex = ref(0)
const clickItem = (index) => {
activeIndex.value = index
}
const dataset_id = ref('') const dataset_id = ref('')
@ -109,7 +106,7 @@ const onSuccess = async (response) =>{
dataset_id: dataset_id.value dataset_id: dataset_id.value
} }
const res = await completion(data) const res = await completion(data)
console.log(res)
if(res.data.code != 200) return if(res.data.code != 200) return
let docData = { let docData = {
fileUrl: response.url, fileUrl: response.url,
@ -123,19 +120,30 @@ const onSuccess = async (response) =>{
} }
const { msg } = await addDoc(docData) const { msg } = await addDoc(docData)
ElMessage.success(msg) ElMessage.success(msg)
getList()
} }
const curNode = reactive({}) const curNode = reactive({})
const fileList = ref([])
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 =>{
console.log(res) fileList.value = [...res.rows]
Object.assign(curFile, fileList.value[0])
}) })
} }
const clickItem = (index, item) => {
activeIndex.value = index
Object.assign(curFile, item)
emitter.emit('curFile',item)
}
onMounted(() =>{ onMounted(() =>{
let data = sessionStore.get('subject.curNode') let data = sessionStore.get('subject.curNode')
@ -174,6 +182,7 @@ onMounted(() =>{
flex-wrap: wrap; flex-wrap: wrap;
li { li {
width: 130px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
font-size: 13px; font-size: 13px;