Browse Source

通知公告详情取url参数

RaoMeng 6 years ago
parent
commit
ae9bfe2683

+ 17 - 5
frontend/wechat-web/src/modules/notificationCenter/NotifyBoardDetail.jsx

@@ -5,7 +5,7 @@
 
 import React, {Component} from 'react'
 import ImagesViewer from "../../components/imagesVIewer";
-import {getArrayValue, getIntValue, getStrValue, isObjEmpty} from "../../utils/common";
+import {getArrayValue, getIntValue, getSearchParams, getStrValue, isObjEmpty} from "../../utils/common";
 import NotifyBoBean from "../../model/NotifyBoBean";
 import {fetchGet, fetchPost} from "../../utils/fetchRequest";
 import {_baseURL, API} from "../../configs/api.config";
@@ -25,11 +25,15 @@ class NotifyBoardDetail extends Component {
         }
     }
 
-    componentDidMount() {
-        document.title = '通知公告详情'
+    componentWillMount() {
+        this.searchParams = getSearchParams(this.props.location.search)
 
         this.notifyId = this.props.match.params.notifyId
         this.role = this.props.match.params.role
+    }
+
+    componentDidMount() {
+        document.title = '通知公告详情'
 
         this.obtainDetail()
     }
@@ -125,15 +129,23 @@ class NotifyBoardDetail extends Component {
         let url = '', params = {}
         if (this.role === 'teacher') {
             url = API.NOTIFY_DETAIL_TEACHER
+            let id = this.props.userInfo.user.userFunId
+            if (this.searchParams && this.searchParams.teacherId) {
+                id = this.searchParams.teacherId
+            }
             params = {
                 notifyId: this.notifyId,
-                teacherId: this.props.userInfo.user.userFunId
+                teacherId: id
             }
         } else if (this.role === 'parent') {
             url = API.NOTIFY_DETAIL_PARENT
+            let id = this.props.userInfo.user.student.stuId
+            if (this.searchParams && this.searchParams.stuId) {
+                id = this.searchParams.stuId
+            }
             params = {
                 notifyId: this.notifyId,
-                stuId: this.props.userInfo.user.student.stuId
+                stuId: id
             }
         } else {
             return