Przeglądaj źródła

加入获取未读接口 设置已读接口 解决了 一个以前的 多 tab 数据传递问题

于添 6 miesięcy temu
rodzic
commit
e3a3cefbce

+ 1 - 0
src/api/notice/index.js

@@ -19,3 +19,4 @@ export const courceDownList = (p) => request('disk/notice/delete', p, 'post')
 
 export const publish = (p) => request('disk/notice/publish', p, 'get')
 export const cancel = (p) => request('disk/notice/cancel', p, 'get')
+export const readPage = (p) => request('disk/notice/readPage', p, 'get')

+ 3 - 0
src/api/portal/index.js

@@ -47,3 +47,6 @@ export const getTalkPageList = (p) => request('disk/comment/pageList', p, 'get')
 export const getAllListFileFormat = (p) => request('disk/fileformat/allList', p, 'get')
 
 export const checkAuth = (p) => request('disk/fileformat/allList', p, 'get')
+//获取未读条数
+export const getCount = (p) => request('disk/userread/getCount', p, 'get')
+export const addCount = (p) => request('disk/userread/add', p, 'post')

+ 20 - 9
src/views/announcementLookManagement/components/DialogView.vue

@@ -1,25 +1,32 @@
 <template>
-	<a-modal v-model:visible="visible" :title="title" @ok="handleOk">
+	<a-modal v-model:visible="visible" :title="title" >
+		<template #footer>
+			<a-button key="back" @click="handleCancel">取消</a-button>
+		</template>
 		<a-form
 			:model="formState"
-			:rules="rules"
 			ref="formRef"
 			layout="horizontal"
 			:label-col="{ span: 7 }"
 			:wrapper-col="{ span: 12 }"
 		>
+
 			<a-form-item label="公告标题" name="title">
-				<a-input v-model:value="formState.title" :disabled="mode == 'look'" placeholder="输入公告标题"/>
+<!--				<a-input v-model:value="formState.title" :disabled="mode == 'look'" placeholder="输入公告标题"/>-->
+				<span >{{ formState.title }}</span>
 			</a-form-item>
 			<a-form-item label="公告标题" name="platform">
-				<a-radio-group v-model:value="formState.platform" :disabled="mode == 'look'">
-					<a-radio-button value="1">课程</a-radio-button>
-					<a-radio-button value="2">考试</a-radio-button>
-				</a-radio-group>
+<!--				<a-radio-group v-model:value="formState.platform" :disabled="mode == 'look'">-->
+<!--					<a-radio-button value="1">课程</a-radio-button>-->
+<!--					<a-radio-button value="2">考试</a-radio-button>-->
+<!--				</a-radio-group>-->
+				<span v-if="formState.platform == 1">课程</span>
+				<span v-if="formState.platform == 2">考试</span>
 			</a-form-item>
 			<a-form-item label="公告内容" name="content" >
-				<a-textarea v-model:value="formState.content" placeholder="输入公告内容" :disabled="mode == 'look'"
-							:auto-size="{ minRows: 5, maxRows: 8 }"/>
+<!--				<a-textarea v-model:value="formState.content" placeholder="输入公告内容" :disabled="mode == 'look'"-->
+<!--							:auto-size="{ minRows: 5, maxRows: 8 }"/>-->
+				<span>{{formState.content}}</span>
 			</a-form-item>
 
 		</a-form>
@@ -67,6 +74,10 @@ const open = () => {
 	mode.value = 'add'
 	title.value = '添加'
 }
+const handleCancel = () => {
+
+	visible.value = false
+}
 const edit = (item) => {
 	visible.value = true
 	mode.value = 'edit'

+ 28 - 7
src/views/announcementLookManagement/components/ListView.vue

@@ -17,14 +17,18 @@
 					<template #content>
 						{{ text }}
 					</template>
-					<template v-if="text.length > 10">
-						<span >{{ text.slice(0, 10) }}...</span>
+					<template v-if="text.length > 15">
+						<span >{{ text.slice(0, 15) }}...</span>
 					</template>
 				</a-popover>
-				<template v-if="text.length <= 10">
+				<template v-if="text.length <= 15">
 					<span >{{ text }}</span>
 				</template>
 			</template>
+			<template v-if="column.dataIndex === 'read'">
+						<span v-if="text == false" style="color: red">未读</span>
+						<span v-if="text == true"  style="color: blue">已读</span>
+			</template>
 
 			<template v-if="column.dataIndex === 'action'">
 <!--				<a-button size="small" @click="handleDetail(record)" style="margin-right: 5px">详情</a-button>-->
@@ -75,13 +79,14 @@
 import tool from '@/utils/tool'
 import {ref, onMounted} from 'vue'
 import {EyeOutlined, EditOutlined, SnippetsOutlined, DeleteOutlined} from '@ant-design/icons-vue'
-import {list, courceDownList, publish, cancel} from '@/api/notice'
+import {readPage, courceDownList, publish, cancel} from '@/api/notice'
 import {useRouter} from 'vue-router'
 import collegeApi from '@/api/college'
 import {updateCourseStatus} from '@/api/course/courseDetail'
+import {addCount} from "@/api/portal";
 
 const router = useRouter()
-
+import EventBus from '@/utils/EventBus'
 const emit = defineEmits(['handleLook'])
 //发布按钮状态
 const releaseVisible = ref(false)
@@ -108,6 +113,12 @@ const columns = [
 		// sorter: true,
 		width: '15%'
 	},
+	{
+		title: '是否阅读',
+		dataIndex: 'read',
+		// sorter: true,
+		width: '5%'
+	},
 	{
 		title: '发布时间',
 		dataIndex: 'createTime',
@@ -160,6 +171,16 @@ const handleEdit = (record) => {
 	// 在这里添加编辑记录的逻辑
 
 	emit('handleLook', record)
+
+	if(record.read == false){
+		addCount({mainId :record.noticeId , funcType : 2 }).then((res)=>{
+			EventBus.emit('getCount')
+			getList()
+		})
+	}
+
+
+
 }
 const handlePulish = (record) => {
 	console.log('编辑记录', record)
@@ -203,7 +224,7 @@ const handleDelete = (record) => {
 const getList = () => {
 	console.log('获取列表 getList')
 
-	list({...pagination.value}).then((data) => {
+	readPage({...pagination.value}).then((data) => {
 		if (data.code == 200) {
 			console.log('获取列表 新数组', data.data.records)
 			dataSources.value = []
@@ -225,7 +246,7 @@ const setList = (search) => {
 	// 	loacl: []
 	formState.value = search
 	pagination.value.current = 1
-	list({...pagination.value, ...formState.value}).then((data) => {
+	readPage({...pagination.value, ...formState.value}).then((data) => {
 		if (data.code == 200) {
 			dataSources.value = data.data.records
 			pagination.value.current = data.data.current

+ 1 - 1
src/views/courseAdd/components/courseInfo.vue

@@ -195,7 +195,7 @@
 	//获取教师人员
 	const getlecturerListSelector = () => {
 		courseCenterApi
-			.lecturerList()
+			.lecturerList({eduIdentity : 1})
 			.then((res) => {
 				console.log(res.data, '获取教师下拉数据')
 				teacherOptions.value = res.data

+ 48 - 15
src/views/courseAdd/components/courseProduction/addDialog.vue

@@ -8,16 +8,16 @@
 			class="add-class-hours-modal"
 		>
 			<a-tabs v-model:activeKey="activeKey" type="card" @change="handleChange">
-				<a-tab-pane key="1" tab="课时">
+				<a-tab-pane key="1" tab="课时" forceRender>
 					<addClassHours ref="addClassHoursRef" @handlerSelect="handlerSelect"
 								   @handlerUpSelect="handlerUpSelect" @handlerEx="handlerEx"
 								   @handlerExs="handlerExs"></addClassHours>
 				</a-tab-pane>
-				<a-tab-pane key="2" tab="作业">
-					<exList v-if="activeKey == '2'" ref="exListRef" @handlerEx="handlerEx"></exList>
+				<a-tab-pane key="2" tab="作业" forceRender>
+					<exList ref="exListRef" @handlerEx="handlerEx"></exList>
 				</a-tab-pane>
-				<a-tab-pane key="3" tab="章节测验">
-					<exLists v-if="activeKey == '3'" ref="exListsRef" @handlerExs="handlerExs"></exLists>
+				<a-tab-pane key="3" tab="章节测验" forceRender>
+					<exLists  ref="exListsRef" @handlerExs="handlerExs"></exLists>
 				</a-tab-pane>
 			</a-tabs>
 			<div class="footer-btns">
@@ -51,6 +51,11 @@ const exListRefData = ref(null)
 const exListsRefData = ref(null)
 const exListRefCount = ref(0)
 const exListsRefCount = ref(0)
+
+const item1 = ref(0)
+const item2 = ref(0)
+const item3 = ref(0)
+
 const activeKey = ref('1')
 const modeTag = ref('add')
 
@@ -87,22 +92,38 @@ const open = () => {
 	exListRefCount.value = 0
 	exListsRefCount.value = 0
 	modalVisible.value = true
+	 item1.value = 0
+	 item2.value = 0
+	 item3.value = 0
 	activeKey.value = '1'
 	modeTag.value = 'add'
 	nextTick(() => {
 		addClassHoursRef.value.reset()
 		addClassHoursRef.value.open()
+		item1.value = item1.value+1
+
+
+		exListRef.value.handleReset()
+		exListsRef.value.handleReset()
+
+
+		console.log("有木有 1 ",exListRef.value)
+		console.log("有木有 2 ",exListsRef.value)
 	})
 }
 const handleChange = (activeKey) => {
 	nextTick(() => {
+		console.log('选择activeKey', activeKey)
 		if (activeKey == '1' && addClassHoursRef.value) {
 			if (modeTag.value == 'add') {
 				// addClassHoursRef.value.reset()
 				addClassHoursRef.value.open()
 			}
 			if (modeTag.value == 'edit') {
-				addClassHoursRef.value.edit()
+				if(item1.value == 1){
+					addClassHoursRef.value.edit()
+				}
+
 			}
 		}
 		if (activeKey == '2' && exListRef.value) {
@@ -111,15 +132,20 @@ const handleChange = (activeKey) => {
 				}
 				if (modeTag.value == 'edit') {
 					console.log('走没走1', exListRefData.value)
-					if(exListRefData.value && exListRefData.value[0]&& exListRefData.value[0].relateId){
-						exListRef.value.edit(exListRefData.value[0].relateId)
-					}else if(exListRefData.value && exListRefData.value[0]&& exListRefData.value[0].id){
-						exListRef.value.edit(exListRefData.value[0].id)
+					if(item2.value == 1){
+						if(exListRefData.value && exListRefData.value[0]&& exListRefData.value[0].relateId){
+							exListRef.value.edit(exListRefData.value[0].relateId)
+						}else if(exListRefData.value && exListRefData.value[0]&& exListRefData.value[0].id){
+							exListRef.value.edit(exListRefData.value[0].id)
+						}
 					}
+
+
 					console.log('走没走2', exListRefData.value)
 					if(exListRefData.value  == null){
 						exListRef.value.open()
 					}
+					item2.value = item2.value+1
 				}
 
 		}
@@ -128,16 +154,19 @@ const handleChange = (activeKey) => {
 					exListsRef.value.open()
 				}
 				if (modeTag.value == 'edit') {
-
-					if(exListsRefData.value && exListsRefData.value[0]&& exListsRefData.value[0].relateId){
-						exListsRef.value.edit(exListsRefData.value[0].relateId)
-					}else if(exListsRefData.value && exListsRefData.value[0]&& exListsRefData.value[0].id){
-						exListsRef.value.edit(exListsRefData.value[0].id)
+					if(item3.value == 1){
+						if(exListsRefData.value && exListsRefData.value[0]&& exListsRefData.value[0].relateId){
+							exListsRef.value.edit(exListsRefData.value[0].relateId)
+						}else if(exListsRefData.value && exListsRefData.value[0]&& exListsRefData.value[0].id){
+							exListsRef.value.edit(exListsRefData.value[0].id)
+						}
 					}
 
+
 					if(exListsRefData.value  == null){
 						exListsRef.value.open()
 					}
+					item3.value = item3.value+1
 				}
 		}
 	})
@@ -152,6 +181,9 @@ const edit = (item) => {
 	exListsRefCount.value = 0
 	activeKey.value = '1'
 	modalVisible.value = true
+	item1.value = 0
+	item2.value = 0
+	item3.value = 0
 	console.log('修改进来的', item)
 	form.value.id = item.id
 	form.value.chapterId = item.courseId
@@ -160,6 +192,7 @@ const edit = (item) => {
 	console.log('有没有', addClassHoursRef.value)
 	nextTick(() => {
 		addClassHoursRef.value.edit(item)
+		item1.value = item1.value+1
 	})
 
 }

+ 4 - 3
src/views/courseAdd/components/courseProduction/exList.vue

@@ -305,13 +305,14 @@
 		}
 
 	}
-
+	const editNot = async (id) => {
+	}
 	// 生命周期
 	onMounted(async () => {
-
+		console.log('打开了  2')
 	})
 
-	defineExpose({getItemData,edit,open})
+	defineExpose({getItemData,edit,open,editNot,handleReset})
 </script>
 
 <style lang="less" scoped>

+ 4 - 1
src/views/courseAdd/components/courseProduction/exLists.vue

@@ -300,14 +300,17 @@
 			listLoading.value = false
 		}
 	}
+	const editNot = async (id) => {
+	}
 	// 生命周期
 	onMounted(async () => {
 		// examStore.initSubject(search)
+		console.log('打开了  3')
 	})
 	const open=() =>{
 		examStore.initSubject(search)
 	}
-	defineExpose({getItemData,edit,open})
+	defineExpose({getItemData,edit,open,editNot,handleReset})
 </script>
 
 <style lang="less" scoped>

+ 36 - 58
src/views/portal/components/UserHeader.vue

@@ -1,8 +1,8 @@
 <template>
 	<div>
 
-		<a-badge count="5" :offset=[x,y]>
-		<a-dropdown>
+		<a-badge :count="allCount" :offset=[x,y]>
+		<a-dropdown >
 
 			<div v-if="userInfo && userInfo.avatar" class="account-center-avatarHolder" style="margin-top: 5px">
 				<div class="avatar">
@@ -16,28 +16,26 @@
 
 			</div>
 			<template #overlay>
-				<a-menu>
+				<a-menu forceSubMenuRender>
 					<div>
 							<a-menu-item @click="onChangeCurrent('usercenter')">
 								个人中心
 							</a-menu-item>
 					</div>
 					<div>
-						<a-badge count="2" :offset=[xx,yy]>
+						<a-badge :count="myMsgCount" :offset=[xx,yy]>
 							<a-menu-item @click="onChangeCurrent('myMsg')">
 								站内信
 							</a-menu-item>
 						</a-badge>
 					</div>
 				<div>
-					<a-badge count="3" :offset=[xx,yy]>
 						<a-menu-item @click="onChangeCurrent('answerManagement')">
 							问答管理
 						</a-menu-item>
-					</a-badge>
 				</div>
 					<div>
-						<a-badge count="3" :offset=[xx,yy]>
+						<a-badge :count="announcementLookManagementCount" :offset=[xxx,yyy]>
 							<a-menu-item @click="onChangeCurrent('announcementLookManagement')">
 								课程公告
 							</a-menu-item>
@@ -62,6 +60,7 @@
 	import {ExclamationCircleOutlined, FolderOutlined} from '@ant-design/icons-vue'
 	import { Modal } from 'ant-design-vue'
 	import loginApi from '@/api/auth/loginApi'
+	import {getCount} from '@/api/portal/index'
 	import { message } from 'ant-design-vue'
 	import { ref } from 'vue'
 	import { useRouter, useRoute } from 'vue-router'
@@ -71,9 +70,16 @@
 	import tool from '@/utils/tool'
 	const emit = defineEmits(['onChangeCurrent'])
 	import { globalStore } from '@/store'
+	import EventBus from "@/utils/EventBus";
 
 	const global_store = globalStore()
 
+	const allCount = ref(0)
+	const myMsgCount = ref(0)
+	const answerManagementCount = ref(0)
+	const announcementLookManagementCount = ref(0)
+
+
 	const userInfo = computed(() => {
 		return global_store.userInfo
 	})
@@ -93,9 +99,12 @@
 	const x = ref(0);
 	const y = ref(10);
 
-	const xx = ref(0);
+	const xx = ref(15);
 	const yy = ref(15);
 
+	const xxx = ref(2);
+	const yyy = ref(15);
+
 	const onChangeCurrent = (current) => {
 
 		router.push({
@@ -142,59 +151,28 @@
 			})
 		}
 	}
+
+	const getCounts = async () => {
+		//站内信
+	  let funcType1 = await getCount({funcType : 1})
+		console.log('获取未读数量 站内信',funcType1)
+		let funcType2 = await getCount({funcType : 2})
+		console.log('获取未读数量 公告',funcType2)
+		myMsgCount.value = funcType1.data.unreadCount
+		announcementLookManagementCount.value = funcType2.data.unreadCount
+		allCount.value = funcType1.data.unreadCount+ funcType2.data.unreadCount
+
+
+	}
+
+
 	onMounted(() => {
-		list.value =[
-			{
-				key: '1',
-				title: '项目信息管理1',
-				path: '/infomationManage',
-				icon:'iconfont icon-information'
-			},
-			{
-				key: '2',
-				title: '安全信息管理2',
-				path: '/safeInfoManage',
-				icon:'iconfont icon-anquan',
-				children: [
-					{
-						key: '2.1',
-						title: '安全风险管理2.1',
-						path: '/safeRisk',
-						icon:'',
-						children: [
-							{
-								key: '2.1.1',
-								title: '风险分类管理2.1.1',
-								path: '/riskClassifyManage',
-								icon:'',
-							},
-							{
-								key: '2.1.2',
-								title: '分类辨识2.1.2',
-								path: '/classifyIdentity',
-								icon:'',
-							}
-						],
-					},
-				],
-			},
-			{
-				key: '3',
-				title: '质量信息管理3',
-				path: '/qualityInfoManage',
-				icon:'iconfont icon-zhiliang',
-				children:[
-					{
-						key: '3.1',
-						title: '质量控制点管理3.1',
-						path: '/controlPointManage',
-						icon:'',
-					}
-				]
-			}
-		]
+		getCounts()
 	})
 
+	EventBus.off('getCount', getCounts)
+	EventBus.on('getCount', getCounts)
+
 </script>
 
 <style scoped lang="less">

+ 10 - 0
src/views/sys/user/userTab/userMessage/detail.vue

@@ -32,6 +32,8 @@
 
 <script setup name="messageDetail">
 	import userCenterApi from '@/api/sys/userCenterApi'
+	import {addCount} from "@/api/portal";
+	import EventBus from "@/utils/EventBus";
 	const emits = defineEmits(['refresh'])
 	const receiveInfoList = ref([])
 
@@ -55,6 +57,14 @@
 	// 打开抽屉
 	const onOpen = (record) => {
 		visible = true
+		console.log('点进来看的站内信',record)
+		if(record.read == false){
+			addCount({mainId :record.id , funcType : 1 }).then((res)=>{
+				EventBus.emit('getCount')
+			})
+		}
+
+
 		getMessageList(record)
 	}
 	// 获取站内信列表