zhangsq 8 місяців тому
батько
коміт
e9838a87fc

+ 1 - 1
.env.development

@@ -8,7 +8,7 @@ VITE_TITLE = Snowy
 # VITE_API_BASEURL = http://192.168.31.14:9003
 VITE_API_BASEURL = http://192.168.31.81:9003
 VITE_FILEURL = http://192.168.1.245:10005/education/
-VITE_API_BASEURL = http://192.168.31.14:9003
+# VITE_API_BASEURL = http://192.168.31.14:9003
 # VITE_API_BASEURL = http://192.168.31.6:9003
 
 # 本地端口

+ 37 - 11
src/views/myResources/myResources.vue

@@ -28,13 +28,22 @@
 					:options="majorOptions"
 					placeholder="请选择专业"
 				/> -->
-				<a-select
+				<a-cascader
+					style="width: 240px; margin-left: 8px"
+					v-model:value="resourceName"
+					:options="resourceTypeOptions"
+					:fieldNames="{ label: 'name', value: 'id', children: 'children' }"
+					placeholder="请选择资源类型"
+					changeOnSelect
+					@change="changeCollegeResource"
+				/>
+				<!-- <a-select
 					v-model:value="formState.resourceType"
 					style="width: 150px; margin-left: 8px"
 					:options="resourceTypeOptions"
 					:fieldNames="{ label: 'name', value: 'id', children: 'children' }"
 					placeholder="请选择资源类型"
-				/>
+				/> -->
 				<a-select
 					v-model:value="formState.suffix"
 					style="width: 150px; margin-left: 8px"
@@ -73,7 +82,7 @@
 
 		<!-- 表格 -->
 		<a-table
-			:columns="currentColumns"
+			:columns="columnsPending"
 			:data-source="dataSource"
 			:pagination="false"
 			:loading="loading"
@@ -84,7 +93,7 @@
 			<template #bodyCell="{ column, text, record }">
 				<template
 					v-if="
-						['fileName', 'collegeIdName', 'majorIdName', 'resourceTypeName', 'suffix', 'uploadTime'].includes(
+						['fileName', 'collegeAllIdName', 'majorIdName', 'resourceALLTypeName', 'suffix', 'uploadTime'].includes(
 							column.dataIndex
 						)
 					"
@@ -289,11 +298,13 @@
 		collegeId: null, //院校一级id
 		collegeTwoId: null, //院校二级id
 		collegeThreeId: null, //院校三级id
-		resourceType: null,
+		resourceType: null, //资源类型一级
+		resourceTwoType: null, //资源类型二级
 		suffix: null
 	})
 	// 添加选择状态
 	const majorIdName = ref([])
+	const resourceName = ref([])
 	const majorOptions = ref([]) //专业
 	const selectedRowKeys = ref([])
 	const selectedRows = ref([])
@@ -404,8 +415,8 @@
 		{
 			title: '资源类型',
 			align: 'center',
-			dataIndex: 'resourceTypeName',
-			key: 'resourceTypeName'
+			dataIndex: 'resourceALLTypeName',
+			key: 'resourceALLTypeName'
 		},
 		{
 			title: '资源格式',
@@ -475,6 +486,7 @@
 			verifyStatus: formState.verifyStatus,
 			fileName: formState.fileName,
 			resourceType: formState.resourceType,
+			resourceTwoType: formState.resourceTwoType,
 			suffix: formState.suffix,
 			// majorId: formState.majorId,
 			collegeTwoId: formState.collegeTwoId,
@@ -510,6 +522,12 @@
 			getCollegeMajor(lastSelected.id)
 		}
 	}
+	const changeCollegeResource = (value, selectedOptions) => {
+		console.log('Selected:', value, selectedOptions)
+		resourceName.value = selectedOptions.map((it) => it.name).join('/')
+		formState.resourceType = value[0] || null
+		formState.resourceTwoType = value[1] || null
+	}
 	const getList = () => {
 		getListData()
 		uploadModalVisible.value = false
@@ -532,7 +550,7 @@
 			.resourceTypeTree()
 			.then((res) => {
 				console.log(res.data, '资源类型下拉')
-				// resourceTypeOptions.value = res.data
+				resourceTypeOptions.value = res.data
 			})
 			.catch((err) => {
 				console.log(err)
@@ -572,6 +590,7 @@
 		majorIdName.value = null
 		formState.fileName = null
 		formState.resourceType = null
+		formState.resourceTwoType = null
 		formState.suffix = null
 		formState.collegeTwoId = null
 		// formState.majorId = null
@@ -662,9 +681,16 @@
 		auditModalVisible.value = true
 	}
 	const handleView = (record) => {
-		publishedData.value = record
-		auditState.value = false
-		auditModalVisible.value = true
+		router.push({
+			path: '/portal/resourceDetails',
+			query: {
+				id: record.id,
+				state: 1
+			}
+		})
+		// publishedData.value = record
+		// auditState.value = false
+		// auditModalVisible.value = true
 	}
 	const handleDownload = (record) => {
 		resourceAuditApi

+ 34 - 5
src/views/myResources/resourceUpload.vue

@@ -38,11 +38,14 @@
 				/>
 			</a-form-item> -->
 			<a-form-item label="资源类型" name="resourceType" :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }">
-				<a-select
-					v-model:value="formState.resourceType"
-					style="width: 200px"
-					:options="courseTypeOptions"
+				<a-cascader
+					style="width: 240px; margin-left: 8px"
+					v-model:value="resourceName"
+					:options="resourceTypeOptions"
+					:fieldNames="{ label: 'name', value: 'id', children: 'children' }"
 					placeholder="请选择资源类型"
+					changeOnSelect
+					@change="changeCollegeResource"
 				/>
 			</a-form-item>
 			<a-form-item
@@ -159,7 +162,8 @@
 		coverImage: null, //封面id
 		// courseId: null, //课程
 		// majorType: null, //专业
-		resourceType: null, //资源类型
+		resourceType: null, //资源类型一级
+		resourceTwoType: null, //资源类型二级
 		collegeId: null, //院校一级id
 		collegeTwoId: null, //院校二级id
 		collegeThreeId: null, //院校三级id
@@ -174,8 +178,10 @@
 	})
 	const formRef = ref() // 添加表单引用
 	const collegeMajorOptions = ref([]) //院系
+	const resourceTypeOptions = ref([]) //资源类型下拉数据
 	const HotKeywordsOptions = ref([]) //热门关键词列表
 	const majorIdName = ref([]) //院系回显
+	const resourceName = ref([]) //资源回显
 	const majorOptions = ref([]) //专业
 	const courseOptions = ref([]) //课程
 	// 上传资源模态框
@@ -278,6 +284,18 @@
 				console.log(err)
 			})
 	}
+	//资源类型下拉查询
+	const getResourceTypeTree = () => {
+		resourceAuditApi
+			.resourceTypeTree()
+			.then((res) => {
+				console.log(res.data, '资源类型下拉')
+				resourceTypeOptions.value = res.data
+			})
+			.catch((err) => {
+				console.log(err)
+			})
+	}
 	const handleChangeKeyword = (checkedValues) => {
 		formState.keyword = checkedValues
 		formState.keywordValue = HotKeywordsOptions.value
@@ -332,6 +350,12 @@
 			getCollegeMajor(lastSelected.id)
 		}
 	}
+	const changeCollegeResource = (value, selectedOptions) => {
+		console.log('Selected:', value, selectedOptions)
+		resourceName.value = selectedOptions.map((it) => it.name).join('/')
+		formState.resourceType = value[0] || null
+		formState.resourceTwoType = value[1] || null
+	}
 	const getCollegeMajor = (id) => {
 		resourceAuditApi
 			.zyselect({ collegeId: id })
@@ -357,6 +381,7 @@
 				id: props.resourcesId,
 				userfileIds: formState.userfileIds,
 				resourceType: formState.resourceType,
+				resourceTwoType: formState.resourceTwoType,
 				collegeId: formState.collegeId,
 				collegeTwoId: formState.collegeTwoId,
 				collegeThreeId: formState.collegeThreeId,
@@ -396,10 +421,12 @@
 		resourceAuditApi.detail({ id: props.resourcesId }).then((res) => {
 			console.log(res.data, '资源详情')
 			formState.resourceType = res.data.resourceType
+			formState.resourceTwoType = res.data.resourceTwoType
 			formState.collegeId = res.data.collegeId
 			formState.collegeTwoId = res.data.collegeTwoId
 			formState.collegeThreeId = res.data.collegeThreeId
 			majorIdName.value = res.data.collegeAllId.split(',')
+			resourceName.value.value = res.data.resourceAllType.split(',')
 			getCollegeMajor(majorIdName.value[majorIdName.value.length - 1])
 			formState.resourceDesc = res.data.resourceDesc
 			// formState.majorId = res.data.majorId
@@ -416,6 +443,7 @@
 			formState.collegeTwoId = res.data.collegeTwoId
 			formState.collegeThreeId = res.data.collegeThreeId
 			majorIdName.value = res.data.collegeAllId.split(',')
+			resourceName.value = res.data.resourceAllType.split(',')
 			getCollegeMajor(majorIdName.value[majorIdName.value.length - 1])
 			formState.resourceDesc = res.data.resourceDesc
 			// formState.majorId = res.data.majorId
@@ -476,6 +504,7 @@
 		getOrgTreeSelector()
 		getCourseAllList()
 		getHotKeywords()
+		getResourceTypeTree()
 		if (props.isState == 1) {
 			getDetail()
 		} else {

+ 2 - 1
src/views/resourceDetails/index.vue

@@ -5,7 +5,7 @@
 			<div style="width: 71%; margin-left: 10%">
 				<BreadCrumb />
 				<VideoDetails ref="VideoDetailsRef" />
-				<TallList />
+				<TallList v-if="!isState" />
 				<!-- <ResourceDetails v-if="indexType == 'resourceDetails'" ref="ResourceDetailsRef" /> -->
 			</div>
 		</a-layout>
@@ -30,6 +30,7 @@
 	const itemData = ref({})
 	const VideoDetailsRef = ref(null)
 	const route = useRoute()
+	const isState = ref(route.query.state)
 	//     {
 	//     "fileName": "Kettle文档",
 	//     "courseType": "0",

+ 1 - 1
vite.config.js

@@ -52,7 +52,7 @@ export default defineConfig(({ command, mode }) => {
 			port: envConfig.VITE_PORT,
 			proxy: {
 				'/api': {
-					target: 'http://192.168.31.14:9003',
+					target: 'http://192.168.31.81:9003',
 					ws: false,
 					changeOrigin: true
 					// rewrite: (path) => path.replace(/^\/api/, '')