فهرست منبع

加上了 转换模式

于添 7 ماه پیش
والد
کامیت
8c75034993

+ 6 - 0
src/api/userfileconvert/index.js

@@ -0,0 +1,6 @@
+import { baseRequest } from '@/utils/request'
+import {moduleRequest} from "@/utils/reSourceRequest";
+
+const request = moduleRequest(`/api/webapp/`)
+
+export const list = (p) => request('disk/userfileconvert/page', p, 'get')

+ 5 - 0
src/router/portal.js

@@ -98,6 +98,11 @@ const portal = [
 		name: 'answerManagement',
 		path: '/portal/answerManagement',
 		component: () => import('@/views/answerManagement/index.vue'),
+	},
+	{
+		name: 'userfileconvert',
+		path: '/userfileconvert',
+		component: () => import('@/views/userfileconvert/index.vue'),
 	}
 
 ]

+ 1 - 2
src/views/portal/components/BreadCrumb.vue

@@ -6,8 +6,7 @@
 				:key="index"
 				style="cursor: pointer"
 				@click="handleItem(index)"
-				>{{ item }}</a-breadcrumb-item
-			>
+				>{{ item }}</a-breadcrumb-item>
 		</a-breadcrumb>
 	</div>
 </template>

+ 1 - 0
src/views/portal/components/Header.vue

@@ -55,6 +55,7 @@
 					<a-menu-item style="margin-left: 10px; margin-right: 10px" key="forum">论坛</a-menu-item>
 <!--					<a-menu-item style="margin-left: 10px; margin-right: 10px" key="portal/courseManagement">站内信</a-menu-item>-->
 					<a-menu-item style="margin-left: 10px; margin-right: 10px" key="announcementManagement">课程公告发布</a-menu-item>
+					<a-menu-item style="margin-left: 10px; margin-right: 10px" key="userfileconvert">资源转换</a-menu-item>
 				</a-menu>
 			</div>
 

+ 151 - 0
src/views/userfileconvert/components/DialogView.vue

@@ -0,0 +1,151 @@
+<template>
+	<a-modal v-model:visible="visible" title="上传" @ok="handleOk">
+		<a-form
+			:model="formState"
+			:rules="rules"
+			ref="formRef"
+			layout="horizontal"
+			:label-col="{ span: 7 }"
+			:wrapper-col="{ span: 12 }"
+		>
+			<a-form-item label="公告标题" name="fileName">
+				<a-input v-model:value="formState.fileName" placeholder="输入公告标题"/>
+			</a-form-item>
+
+			<a-form-item label="公告内容" name="extendName">
+				<a-input v-model:value="formState.extendName" placeholder="输入公告标题"/>
+<!--				<a-textarea v-model:value="formState.content" placeholder="输入公告内容"-->
+<!--							:auto-size="{ minRows: 5, maxRows: 8 }"/>-->
+			</a-form-item>
+
+		</a-form>
+	</a-modal>
+</template>
+<script setup>
+import {reactive, ref} from 'vue'
+import resourceAuditApi from '@/api/resourceAudit.js'
+
+const collegeMajorOptions = ref([]) //院系
+const majorIdName = ref([]) //院系回显
+const majorOptions = ref([]) //专业
+const formRef = ref() //专业
+const mode = ref('add') //专业
+import {addItem, detail, editItem} from '@/api/notice'
+
+const visible = ref(false)
+const emit = defineEmits([ "handleAddItem" ])
+const formState = reactive({
+	noticeId : undefined,
+	fileName: undefined,
+	extendName: undefined,
+})
+const rules = {
+	fileName: [{required: true, message: '请输入文件名称', trigger: 'blur'}],
+	extendName: [{required: true, message: '请输入后缀名称', trigger: 'blur'}],
+}
+
+watch(
+	() => visible.value,
+	(newVal, oldVal) => {
+		if (newVal == false && formRef.value) {
+			formRef.value.resetFields()
+		}
+	},
+	{deep: true, immediate: true}
+)
+const open = () => {
+
+	visible.value = true
+	mode.value = 'add'
+}
+const edit = (item) => {
+	visible.value = true
+	mode.value = 'edit'
+	console.log('编辑内容',item)
+
+
+	detail({noticeId : item.noticeId}).then((res)=>{
+		if(res.code ==200){
+			formState.noticeId = item.noticeId
+			formState.content = res.data.content
+			formState.title = res.data.title
+		}
+	})
+
+}
+const handleOk = (e) => {
+	formRef.value.validate().then(() => {
+		let json = JSON.parse(JSON.stringify(formState))
+
+
+		if (mode.value == 'add') {
+			addItem(json).then((res) => {
+					if(res.code == 200){
+						emit("handleAddItem")
+						visible.value = false
+					}
+			})
+		}
+		if (mode.value == 'edit') {
+			editItem(json).then((res) => {
+				if(res.code == 200){
+					emit("handleAddItem")
+					visible.value = false
+				}
+			})
+		}
+	})
+	// console.logckPoint.value = false
+}
+const getOrgTreeSelector = () => {
+	resourceAuditApi
+		.orgList()
+		.then((res) => {
+			console.log(res.data, '获取学院')
+			collegeMajorOptions.value = res.data
+		})
+		.catch((err) => {
+			console.log(err)
+		})
+}
+const changeCollegeMajor = (value, selectedOptions) => {
+	console.log('Selected:', value, selectedOptions)
+	if (!value) {
+		formState.collegeTwoId = ''
+		// majorIdName.value = ''
+		return false
+	}
+	formState.majorId = undefined
+	// majorIdName.value = selectedOptions.map((it) => it.name).join('/')
+	// formState.collegeId = value[0] || null
+	// formState.collegeTwoId = value[1] || null
+	// formState.collegeThreeId = value[2] || null
+	// if (selectedOptions.length) {
+	// 获取选中的最后一级
+	// const lastSelected = selectedOptions[selectedOptions.length - 1]
+	// formState.selectedCollegeMajor = {
+	// 	id: lastSelected.id,
+	// 	name: lastSelected.name,
+	// 	fullPath: selectedOptions.map((opt) => opt.name).join(' / ')
+	// }
+	console.log(formState.collegeTwoId, '最后一级id')
+	getCollegeMajor(formState.collegeTwoId)
+	// }
+}
+const getCollegeMajor = (id) => {
+	resourceAuditApi
+		.zyselect({collegeId: id})
+		.then((res) => {
+			console.log(res.data, '专业下拉数据')
+			majorOptions.value = res.data
+		})
+		.catch((err) => {
+			console.log(err)
+		})
+}
+onMounted(() => {
+	// getOrgTreeSelector()
+})
+
+defineExpose({open,edit})
+</script>

+ 212 - 0
src/views/userfileconvert/components/ListView.vue

@@ -0,0 +1,212 @@
+<template>
+	<a-table
+		ref="table"
+		:columns="columns"
+		:data-source="dataSources"
+		:row-key="(record) => record.courseId"
+		bordered
+		:expand-row-by-click="true"
+		:pagination="false"
+		size="small"
+	>
+		<template #bodyCell="{ column, text, record }">
+			<template v-if="column.dataIndex === 'createTime'">
+				<span>{{ formatDateTime(record.createTime) }}</span>
+			</template>
+
+			<template v-if="column.dataIndex === 'action'">
+<!--				<a-button size="small" @click="handleDetail(record)" style="margin-right: 5px">详情</a-button>-->
+<!--				<a-button size="small" @click="handleEdit(record)" style="margin-right: 5px">编辑</a-button>-->
+				<a-popover v-model:visible="popoverVisibles[record.collegeId]" title="确定删除?" trigger="click">
+					<template #content>
+						<a-button style="margin-right: 10px" type="primary" @click="handleShelf(record,1)">确定
+						</a-button>
+						<a-button @click="()=>{	popoverVisibles[record.collegeId] = false}">取消</a-button>
+					</template>
+					<!--					<a-button size="small" style="margin-right: 5px">选择</a-button>-->
+					<a-button size="small" @click="handleDelete(record)" style="margin-right: 5px">删除</a-button>
+				</a-popover>
+			</template>
+		</template>
+	</a-table>
+	<div style="display: flex; width: 100%; justify-content: flex-end; margin-top: 10px">
+		<a-pagination
+			v-model:current="pagination.current"
+			v-model:pageSize="pagination.size"
+			:total="total"
+			show-less-items
+			@change="handlerChange"
+		/>
+	</div>
+</template>
+
+<script setup>
+import tool from '@/utils/tool'
+import {ref, onMounted} from 'vue'
+import {list} from '@/api/userfileconvert'
+import {useRouter} from 'vue-router'
+import {parseTime} from "@/utils/exam";
+
+const router = useRouter()
+
+const emit = defineEmits(['handleEdit'])
+//发布按钮状态
+const releaseVisible = ref(false)
+const loading = ref(false) // 列表loading
+const dataSources = ref([])
+const popoverVisible = ref({})
+const popoverVisibles = ref({})
+const formState = ref({
+	name: '',
+	loacl: ''
+}) // 列表loading
+const columns = [
+	{
+		title: '资源名称',
+		dataIndex: 'fileName',
+		sorter: true,
+		width: '15%'
+	},
+	{
+		title: '文件后缀',
+		dataIndex: 'extendName',
+		sorter: true,
+		width: '15%'
+	},
+	{
+		title: '发布时间',
+		dataIndex: 'createTime',
+		sorter: true,
+		width: '12%'
+	},
+	{
+		title: '操作',
+		dataIndex: 'action',
+		sorter: true,
+		width: '2%'
+	}
+]
+// tool.formatTimestamp()
+const formatDateTime = (val) => {
+	if (!val) return ''
+	return parseTime(val, '{y}-{m}-{d} {h}:{i}:{s}')
+}
+const formatTimestamp = (time) => {
+	return tool.formatTimestamp(time)
+}
+const total = ref(0)
+const pagination = ref({
+	size: 10,
+	current: 1,
+})
+// const onChangeCurrent = (current) => {
+// 	router.push({
+// 		path: '/' + current
+// 	})
+// }
+const handlerChange = (page, pageSize) => {
+	console.log('分页参数', page, pageSize)
+	// pagination.value.size = pageSize
+	// pagination.value.current = page
+
+	getList()
+}
+const handleDetail = (record) => {
+	console.log('查看详情', record)
+	router.push({
+		path: '/portal/courseDetails',
+		query: {
+			id: record.courseId
+		}
+	})
+	// 在这里添加查看详情的逻辑
+}
+
+// 编辑按钮点击事件
+const handleEdit = (record) => {
+	console.log('编辑记录', record)
+	// 在这里添加编辑记录的逻辑
+
+	emit('handleEdit', record)
+}
+
+// 上架按钮点击事件
+const handleShelf = (record,num) => {
+	console.log('上架记录', record)
+	popoverVisible.value[record.collegeId] = false
+	// 在这里添加上架记录的逻辑
+	// {
+	// 	"courseId": "1948183431150227458",
+	// 	"putawayStatus": 1
+	// }
+	// updateCourseStatus({courseId : record.courseId,putawayStatus : num}).then((res)=>{
+	// 	getList()
+	// })
+
+}
+
+// 删除按钮点击事件
+const handleDelete = (record) => {
+	console.log('删除记录', record)
+	// 在这里添加删除记录的逻辑
+}
+const getList = () => {
+	console.log('获取列表 getList')
+
+	list({...pagination.value}).then((data) => {
+		if (data.code == 200) {
+			console.log('获取列表 新数组', data.data.records)
+			dataSources.value = []
+			dataSources.value = data.data.records
+			console.log('获取列表 最新数组', dataSources.value)
+			pagination.value.current = data.data.current
+			pagination.value.size = data.data.size
+			total.value = data.data.total
+		}
+		// data.records
+	})
+}
+const setList = (search) => {
+	console.log('获取列表 setList',search)
+	// courseName: '',
+	// 	collegeId: '',
+	// 	majorId: '',
+	// 	courseType: '',
+	// 	loacl: []
+	formState.value = search
+	pagination.value.current = 1
+	list({...pagination.value, ...formState.value}).then((data) => {
+		if (data.code == 200) {
+			dataSources.value = data.data.records
+			pagination.value.current = data.data.current
+			pagination.value.size = data.data.size
+			total.value = data.data.total
+		}
+		// data.records
+	})
+}
+
+// 重置按钮点击事件
+onMounted(() => {
+	// getListData()
+	getList()
+})
+
+
+// watch(
+// 	() => dataSources.value,
+// 	(newVal, oldVal) => {
+// 		console.log('数据源变化了 ', ' 新的 ',newVal, '  旧的 ',oldVal)
+// 	},
+// 	{ deep: true, immediate: true }
+// )
+defineExpose({
+	setList,getList
+})
+</script>
+
+<style scoped>
+.desc p {
+	margin-bottom: 1em;
+}
+</style>

+ 166 - 0
src/views/userfileconvert/components/QueryView.vue

@@ -0,0 +1,166 @@
+<template>
+	<div style="display: flex; justify-content: space-between; align-items: center">
+		<div>
+			<a-form layout="inline" :model="fileName">
+				<a-form-item label="" >
+					<a-input v-model:value="formState.fileName" placeholder="请输入资源名称" allowClear />
+				</a-form-item>
+<!--				<a-form-item label="" style="width: 50%">-->
+<!--					<a-range-picker 	v-model:value="formState.time" allowClear />-->
+<!--				</a-form-item>-->
+			</a-form>
+		</div>
+		<div>
+			<a-button type="primary" @click="handleSearch">
+				<template #icon><SearchOutlined /></template>
+				查询
+			</a-button>
+			<a-button style="margin-left: 10px" @click="handleReset">
+				<template #icon><ReloadOutlined /></template>
+				重置
+			</a-button>
+		</div>
+	</div>
+</template>
+
+<script setup>
+	import { ref, onMounted } from 'vue'
+	import { SearchOutlined, ReloadOutlined } from '@ant-design/icons-vue'
+	import { useRouter } from 'vue-router'
+	import collegeApi from '@/api/college'
+	import resourceAuditApi from '@/api/resourceAudit.js'
+	import tool from '@/utils/tool'
+	import Footer from "@/views/portal/components/Footer.vue";
+	const emit = defineEmits([])
+	const router = useRouter()
+	const collegeMajorOptions = ref([]) //院系
+	//发布按钮状态
+	const releaseVisible = ref(false)
+	const loading = ref(false) // 列表loading
+	const COURSE_TYPE = tool.dictTypeList('COURSE_TYPE')
+	const formState = ref({
+		title: undefined,
+		time : [],
+		loacl: []
+	}) // 列表loading
+
+	const options = ref([
+		// {
+		// 	value: 'zhejiang',
+		// 	label: 'Zhejiang',
+		// 	isLeaf: false
+		// },
+		// {
+		// 	value: 'jiangsu',
+		// 	label: 'Jiangsu',
+		// 	isLeaf: false
+		// }
+	])
+
+	// 搜索值
+	const searchValue = ref('')
+
+	const pagination = reactive({
+		pageSize: 10,
+		pageNum: 1,
+		total: 0
+	})
+	// const onChangeCurrent = (current) => {
+	// 	router.push({
+	// 		path: '/' + current
+	// 	})
+	// }
+	const publishedData = ref()
+	//发布确定
+
+	// 上传资源模态框
+	const uploadModalVisible = ref(false)
+	//院系组织查询
+	// const getOrgTreeSelector = () => {
+	// 	resourceAuditApi
+	// 		.orgList()
+	// 		.then((res) => {
+	// 			console.log(res.data, '获取学院')
+	// 			collegeMajorOptions.value = res.data
+	// 		})
+	// 		.catch((err) => {
+	// 			console.log(err)
+	// 		})
+	// }
+	const loadData = (selectedOptions) => {
+		const targetOption = selectedOptions[selectedOptions.length - 1]
+		targetOption.loading = true
+
+		// load options lazily
+		setTimeout(() => {
+			targetOption.loading = false
+			targetOption.children = [
+				{
+					label: `${targetOption.label} Dynamic 1`,
+					value: 'dynamic1'
+				},
+				{
+					label: `${targetOption.label} Dynamic 2`,
+					value: 'dynamic2'
+				}
+			]
+			options.value = [...options.value]
+		}, 1000)
+	}
+	const getList = () => {
+		// collegeApi.treeAll().then((data) => {
+		// 	options.value = data
+		// })
+
+		// resourceAuditApi
+		// 	.orgList()
+		// 	.then((res) => {
+		// 		collegeMajorOptions.value = res.data
+		// 	})
+		// 	.catch((err) => {
+		// 		console.log(err)
+		// 	})
+	}
+	const handleSearch = () => {
+		console.log('执行查询操作', formState.value,COURSE_TYPE)
+		// 在这里添加查询逻辑
+
+		let newJson =  JSON.parse(JSON.stringify(formState.value))
+		console.log('执行查询操作123   ', newJson.loacl.length)
+
+		if(newJson.time.length == 2){
+		 let beginTime =	tool.formatTimesYearMonthDay(newJson.time[0])
+		let endTime=	tool.formatTimesYearMonthDay(newJson.time[1])
+			newJson.beginTime = beginTime
+			newJson.endTime = endTime
+			newJson.time= undefined
+		}
+
+		emit('handlerSearch', newJson)
+	}
+
+	// 重置按钮点击事件
+	const handleReset = () => {
+		formState.value = {
+			courseName: undefined,
+			collegeId: undefined,
+			majorId: undefined,
+			courseType: undefined,
+			time : [],
+			loacl: []
+			// 其他需要重置的字段
+		}
+		emit('handlerSearch', formState.value)
+	}
+	onMounted(() => {
+		// getListData()
+
+		getList()
+	})
+</script>
+
+<style scoped>
+	.desc p {
+		margin-bottom: 1em;
+	}
+</style>

+ 81 - 0
src/views/userfileconvert/index.vue

@@ -0,0 +1,81 @@
+<template>
+				<QueryView style="margin-top: 10px" @handlerSearch="handlerSearch"></QueryView>
+				<!-- 新建课程按钮 -->
+<!--				<a-button style="margin-top: 10px" type="primary" @click="handleNewCourse">-->
+<!--					<template #icon>-->
+<!--						<PlusOutlined />-->
+<!--					</template>-->
+<!--					新建-->
+<!--				</a-button>-->
+				<div style="height: 10px"></div>
+				<ListView ref="listViewRef" style="margin-top: 10px" @handleEdit="handleEdit"></ListView>
+		<DialogView ref="dialogViewRef"  @handleAddItem="handleAddItem"></DialogView>
+</template>
+
+<script setup>
+	import { ref, onMounted } from 'vue'
+	import { PlusOutlined } from '@ant-design/icons-vue'
+	import tool from '@/utils/tool'
+	import Header from '@/views/portal/components/Header.vue'
+	import Footer from '@/views/portal/components/Footer.vue'
+	import QueryView from './components/QueryView.vue'
+	import ListView from './components/ListView.vue'
+	import DialogView from './components/DialogView.vue'
+	import { useRouter } from 'vue-router'
+	const router = useRouter()
+	//发布按钮状态
+	const releaseVisible = ref(false)
+	const loading = ref(false) // 列表loading
+
+	const isState = ref(0) // 列表loading
+	const listViewRef = ref(null)
+	const dialogViewRef = ref(null)
+
+	// 搜索值
+	const searchValue = ref('')
+	const open = ref(false)
+
+	const handleNewCourse = () => {
+		// 在这里添加新建课程的逻辑
+		dialogViewRef.value.open()
+	}
+	const handleAddItem = () => {
+		console.log('要去刷新',listViewRef.value)
+		// 在这里添加新建课程的逻辑
+		listViewRef.value.getList()
+	}
+	const handlerSearch = (data) => {
+		console.log('新建课程')
+		// 在这里添加新建课程的逻辑
+		listViewRef.value.setList(data)
+	}
+	const handleEdit = (item) => {
+		dialogViewRef.value.edit(item)
+	}
+
+	const pagination = reactive({
+		pageSize: 10,
+		pageNum: 1,
+		total: 0
+	})
+	const onChangeCurrent = (current) => {
+		router.push({
+			path: '/' + current
+		})
+	}
+	const publishedData = ref()
+	//发布确定
+
+	// 上传资源模态框
+	const uploadModalVisible = ref(false)
+
+	onMounted(() => {
+		// getListData()
+	})
+</script>
+
+<style scoped>
+	.desc p {
+		margin-bottom: 1em;
+	}
+</style>