From 5f00696dfb25bc90034448ceb634ed1ef256681a Mon Sep 17 00:00:00 2001
From: qiyunfeng-create <1940665526@qq.com>
Date: 星期四, 21 八月 2025 21:13:35 +0800
Subject: [PATCH] Merge branch 'master' of http://182.92.203.7:2001/r/xiehe_website

---
 src/views/classManage/talkDetail.vue |  481 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 481 insertions(+), 0 deletions(-)

diff --git a/src/views/classManage/talkDetail.vue b/src/views/classManage/talkDetail.vue
new file mode 100644
index 0000000..dfa5168
--- /dev/null
+++ b/src/views/classManage/talkDetail.vue
@@ -0,0 +1,481 @@
+<template>
+  <div class="classManagePage-box">
+    <div class="classManagePage-nav">
+      <el-breadcrumb :separator-icon="ArrowRight">
+        <el-breadcrumb-item>鎴戠殑鐝骇</el-breadcrumb-item>
+        <el-breadcrumb-item>{{ classInfo?.name }}</el-breadcrumb-item>
+        <el-breadcrumb-item>璇濋璇︽儏</el-breadcrumb-item>
+      </el-breadcrumb>
+    </div>
+    <div class="classManagePage-content">
+      <div class="backBtn">
+        <el-button @click="goBack()" type="primary" link>
+          <el-icon style="margin-right: 5px"><ArrowLeftBold /></el-icon> 杩斿洖
+        </el-button>
+      </div>
+      <div class="talkBox">
+        <div class="leftBox">
+          <div class="MessageCount">{{ dataList.length }} 鏉″洖澶�</div>
+          <div class="inputBox">
+            <el-input v-model="textarea" :rows="8" type="textarea" placeholder="璇疯緭鍏�" />
+            <el-button
+              class="submit"
+              :type="textarea.length > 0 ? 'primary' : 'info'"
+              :disabled="textarea.length == 0"
+              round
+              @click="submitText('1')"
+            >
+              鍥� 澶�
+            </el-button>
+          </div>
+          <div v-if="dataList.length > 0 && !childLoading">
+            <div class="MessageBox" v-for="(item, index) in dataList" :key="index">
+              <div class="MessageHeader">
+                <div class="userBox">
+                  <el-avatar
+                    :src="
+                      item.publicText?.icon ??
+                      'https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png'
+                    "
+                  />
+                  <el-text class="userName mx-1">{{ item.publicText?.publisher }}</el-text>
+                  <el-text class="mx-1">{{ item.createDate }}</el-text>
+                </div>
+                <div class="options">
+                  <!-- <el-button type="primary" link @click="openSubmit()"> 鍥炲 </el-button> -->
+                  <!-- <el-button
+                    type="success"
+                    link
+                    @click="pubTalk(item)"
+                    v-if="userInfo.role == 'Teacher' && item.state == 'WaitAudit'"
+                  >
+                    鍙戝竷
+                  </el-button> -->
+                  <el-button
+                    type="danger"
+                    v-if="userInfo.role == 'Teacher'"
+                    link
+                    @click="removeMessageItem(item)"
+                  >
+                    鍒犻櫎
+                  </el-button>
+                </div>
+                <!-- <el-dialog v-model="dialogVisible" title="鍥炲璇濋" width="800">
+                  <div class="talkWall">
+                    <div class="talKBox">
+                      <el-input
+                        style="flex: 1"
+                        v-model="talkContent"
+                        :autosize="{ minRows: 10, maxRows: 15 }"
+                        type="textarea"
+                        placeholder="璇疯緭鍏ュ唴瀹�"
+                      />
+                    </div>
+                  </div>
+                  <template #footer>
+                    <div class="dialog-footer">
+                      <el-button @click="dialogVisible = false"> 鍙栨秷 </el-button>
+                      <el-button type="primary" @click="submitText('2')"> 鍥炲 </el-button>
+                    </div>
+                  </template>
+                </el-dialog> -->
+              </div>
+              <div class="MessageContent" v-html="item.publicText?.content"></div>
+            </div>
+          </div>
+          <div v-if="childLoading" v-loading="childLoading" style="height: 100px"></div>
+        </div>
+        <div class="rightBox" v-if="ownData && !isLoading">
+          <div class="talkHeader">
+            <div class="talkUser">
+              <el-avatar
+                src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png"
+              />
+              <el-text class="userName mx-1">{{ ownData?.publicText?.publisher }}</el-text>
+            </div>
+            <el-text class="mx-1">{{ ownData?.updateDate }}</el-text>
+          </div>
+          <div class="talkContent">
+            <div class="contentTilte">{{ ownData?.name }}</div>
+            <div
+              v-if="ownData?.publicText"
+              class="contentText"
+              v-html="ownData?.publicText?.content"
+            ></div>
+            <div v-else class="contentText" v-html="ownData?.content"></div>
+          </div>
+        </div>
+        <div class="rightBox" v-if="isLoading" v-loading="isLoading"></div>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script setup lang="ts">
+import { useRoute, useRouter } from 'vue-router'
+import { ArrowRight } from '@element-plus/icons-vue'
+import { inject, onMounted, ref } from 'vue'
+import moment from 'moment'
+import { ElMessage } from 'element-plus'
+import { getPublicImage } from '@/assets/js/middleGround/tool.js'
+
+const route: any = useRoute()
+const router = useRouter()
+const classInfo = JSON.parse(route.query.classInfo)
+const userInfo = ref()
+const textarea = ref('')
+const talkContent = ref('')
+const dialogVisible = ref(false)
+const MG: any = inject('MG')
+const config: any = inject('config')
+const talkTopicInfo = ref()
+const dataList: any = ref([])
+const ownData = ref()
+const isLoading = ref(false)
+const childLoading = ref(false)
+
+onMounted(() => {
+  const userCache: any = localStorage.getItem(config.userInfoKey)
+  if (userCache) {
+    userInfo.value = JSON.parse(userCache)
+  }
+  getTopicInfo()
+})
+
+const openSubmit = () => {
+  talkContent.value = ''
+  dialogVisible.value = true
+}
+
+const submitText = (val: string) => {
+  const userCache: any = localStorage.getItem(config.userInfoKey)
+  const userInfo = JSON.parse(userCache)
+  if (userInfo?.data) {
+    const iconData = JSON.parse(userInfo.data)
+    userInfo.icon = iconData?.relevantCertificates[0]?.md5 ?? ''
+  }
+  const textObj = {
+    content: val == '1' ? textarea.value : talkContent.value,
+    publisher: userInfo?.name ?? '',
+    publishRole: userInfo?.role ?? '',
+    icon: userInfo.icon ?? '',
+    type: userInfo.type ?? ''
+  }
+  const data = {
+    description: '',
+    icon: '',
+    state: 'Normal',
+    parentId: ownData?.value.id,
+    topicIdOrRefCode: String(talkTopicInfo.value.id),
+    name: userInfo?.name,
+    content: JSON.stringify(textObj),
+    type: 'Normal',
+    cmsTypeRefCode: '',
+    newDataListRequest: []
+  }
+  MG.ugc.newTopicMessage(data).then((res: any) => {
+    if (res) {
+      ElMessage({
+        message: '宸插洖澶�',
+        type: 'success'
+      })
+      dialogVisible.value = false
+      textarea.value = ''
+      getMessageChildren()
+    }
+  })
+}
+
+// 鑾峰彇璇濋topic
+const getTopicInfo = () => {
+  const pramas = {
+    classId: classInfo.id,
+    refCodes: [config.refCodes.talk]
+  }
+  MG.edu.getClassTopic(pramas).then((res: any) => {
+    const list = res
+    talkTopicInfo.value = list.find((item: any) => item.refCode == config.refCodes.talk)
+    if (talkTopicInfo.value.id) {
+      getMessage()
+    }
+  })
+}
+
+// 鑾峰彇褰撳墠璇濋
+const getMessage = () => {
+  isLoading.value = true
+  const data = {
+    start: 0,
+    size: 1,
+    searchList: [
+      {
+        keywords: classInfo.MessageName,
+        field: 'Name',
+        compareType: 'Contains'
+      }
+    ],
+    appRefCode: config.appRefCode,
+    topicIdOrRefCode: String(talkTopicInfo.value.id)
+  }
+  MG.ugc.getTopicMessageList(data).then((res: any) => {
+    const list = res.datas
+    isLoading.value = false
+    list.map((item: any) => {
+      const str = item.content.indexOf('publisher')
+      if (str > -1) {
+        item.publicText = JSON.parse(item.content)
+        if (item.publicText && item.publicText.publishRole) {
+          item.publicText.publishRole = item.publicText.publishRole == 'Teacher' ? '鍔╂暀' : '瀛︾敓'
+        }
+      }
+      item.createDate = moment(item.createDate).format('YYYY-MM-DD HH:mm:ss')
+      item.updateDate = moment(item.updateDate).format('YYYY-MM-DD HH:mm:ss')
+      return {
+        ...item
+      }
+    })
+    ownData.value = list[0]
+    getMessageChildren()
+  })
+}
+
+// 鑾峰彇褰撳墠璇濋鐨勫洖澶嶆秷鎭�
+const getMessageChildren = () => {
+  childLoading.value = true
+  const data = {
+    start: 0,
+    size: 999,
+    parentId: ownData?.value.id,
+    topicIdOrRefCode: String(talkTopicInfo.value.id)
+  }
+  MG.ugc.getTopicMessageSubList(data).then((res: any) => {
+    const list = res.datas
+    childLoading.value = false
+    dataList.value = list.map((item: any) => {
+      const str = item.content.indexOf('publisher')
+      if (str > -1) {
+        item.publicText = JSON.parse(item.content)
+        if (item.publicText && item.publicText.publishRole) {
+          item.publicText.publishRole = item.publicText.publishRole == 'Teacher' ? '鍔╂暀' : '瀛︾敓'
+        }
+        if (item.publicText?.icon && item.publicText?.type == 'teacherInfo') {
+          item.publicText.icon = getPublicImage(item.publicText?.icon, 60)
+        }
+      }
+      item.createDate = moment(item.createDate).format('YYYY-MM-DD HH:mm:ss')
+      item.updateDate = moment(item.updateDate).format('YYYY-MM-DD HH:mm:ss')
+      return {
+        ...item
+      }
+    })
+  })
+}
+
+// 鍒犻櫎鍥炲璇濋
+const removeMessageItem = (item: any) => {
+  const data = {
+    messageIds: [item.id]
+  }
+  MG.ugc.delTopicMessage(data).then((res: any) => {
+    if (res) {
+      ElMessage({
+        message: '宸插垹闄�',
+        type: 'success'
+      })
+    }
+    getMessage()
+  })
+}
+
+// 瀹℃牳璇濋
+const pubTalk = (item: any) => {
+  const data = {
+    id: item.id,
+    name: item.name,
+    description: item.description,
+    icon: item.icon,
+    type: item.type,
+    state: 'Normal',
+    content: JSON.stringify(item.publicText),
+    newDataRequests: [],
+    updateDataRequests: []
+  }
+  MG.ugc
+    .updateTopicMessage(data)
+    .then((res: any) => {
+      if (res) {
+        ElMessage({
+          type: 'success',
+          message: '宸插彂甯�'
+        })
+        getMessage()
+      }
+    })
+    .catch((err: any) => {
+      console.log(err, '瀹℃牳璇濋')
+    })
+}
+
+const goBack = () => {
+  router.go(-1)
+}
+</script>
+
+<style lang="less" scoped>
+.classManagePage-box {
+  // padding: 20px 0;
+  background: #fff;
+
+  .classManagePage-nav {
+    width: 100%;
+    padding: 0 20px;
+    height: 40px;
+    border-bottom: 1px solid #e6e8ed;
+    position: sticky;
+    top: 0;
+    z-index: 999;
+    display: flex;
+    align-items: center;
+    background: #fff;
+  }
+  .classManagePage-content {
+    width: 100%;
+    position: relative;
+    .backBtn {
+      width: 100%;
+      height: 45px;
+      margin-bottom: 10px;
+      padding: 0 20px;
+      display: flex;
+      align-items: center;
+      position: sticky;
+      top: 40px;
+      z-index: 99;
+      background: #fff;
+      box-shadow: 0px 0px 20px 1px #eee;
+    }
+    .talkBox {
+      width: 100%;
+      display: flex;
+      justify-content: space-between;
+      align-items: flex-start;
+      padding: 0 20px;
+      .leftBox {
+        flex: 1;
+        min-width: 500px;
+        min-height: 700px;
+        background: #ffffff;
+        box-shadow: 0px 0px 10px 1px rgba(0, 0, 0, 0.08);
+        border-radius: 5px 5px 5px 5px;
+        border: 1px solid #e7eaec;
+        margin-right: 20px;
+        .MessageCount {
+          padding: 0 30px;
+          width: 100%;
+          height: 60px;
+          border-bottom: 1px solid #e7eaec;
+          line-height: 60px;
+        }
+        :deep(.inputBox) {
+          padding: 20px 30px;
+          position: relative;
+
+          .el-textarea__inner {
+            padding: 15px;
+            padding-bottom: 45px;
+            box-sizing: border-box;
+          }
+
+          .submit {
+            position: absolute;
+            bottom: 30px;
+            right: 40px;
+          }
+        }
+        .MessageBox {
+          width: 100%;
+          padding: 0 30px;
+          .MessageHeader {
+            width: 100%;
+            display: flex;
+            justify-content: space-between;
+            align-items: center;
+            .userBox {
+              display: flex;
+              align-items: center;
+              .userName {
+                margin: 0 20px;
+              }
+            }
+          }
+          .MessageContent {
+            padding: 0 60px;
+            padding-bottom: 20px;
+            margin-bottom: 10px;
+            font-family: PingFang SC;
+            font-weight: 400;
+            font-size: 13px;
+            color: #333333;
+            line-height: 25px;
+            border-bottom: 1px solid #e7eaec;
+          }
+        }
+      }
+      .rightBox {
+        width: 650px;
+        min-width: 500px;
+        height: 650px;
+        background: #ffffff;
+        box-shadow: 0px 0px 10px 1px rgba(0, 0, 0, 0.08);
+        border-radius: 5px 5px 5px 5px;
+        border: 1px solid #e7eaec;
+        position: sticky;
+        top: 95px;
+        z-index: 99;
+        background: #fff;
+        .talkHeader {
+          width: 100%;
+          padding: 0 30px;
+          height: 60px;
+          display: flex;
+          justify-content: space-between;
+          align-items: center;
+          border-bottom: 1px solid #e7eaec;
+
+          .talkUser {
+            display: flex;
+            align-items: center;
+            .userName {
+              margin-left: 20px;
+            }
+          }
+        }
+        .talkContent {
+          width: 100%;
+          height: calc(100% - 60px);
+          overflow: auto;
+
+          padding: 20px 30px;
+          .contentTilte {
+            font-family: PingFang SC;
+            font-weight: bold;
+            font-size: 16px;
+            color: #333333;
+            margin-bottom: 20px;
+          }
+          .contentText {
+            font-family: PingFang SC;
+            font-weight: 400;
+            font-size: 13px;
+            color: #333333;
+            line-height: 30px;
+            text-align: left;
+            word-break: break-all;
+            word-wrap: break-word;
+          }
+        }
+      }
+    }
+  }
+}
+</style>

--
Gitblit v1.9.1