瀏覽代碼

2022-7-22

codeMan 3 年之前
父節點
當前提交
8c18671bfd

+ 3 - 13
src/SManagement/archives/index.vue

@@ -4,7 +4,7 @@
     <bread-crumbs :tempFileData="tempFileData" @BreadCrumbsChange="BreadCrumbsChange">
     </bread-crumbs>
     <div class="header-panl">
-      <search @searchActive="searchActive" @clearData="clearData"></search>
+      <search @searchActive="searchActive" @clearData="clearData" ref="search"></search>
       <!--切换最热最新-->
       <hot-new-control @sortTypeChange="sortTypeChange" v-if="tool.checkAuth($route.name, 'read')"></hot-new-control>
     </div>
@@ -57,9 +57,6 @@ export default {
         id: null,
       }],
       fileData: [],
-      allFileData: [],
-      //当前选择的文件类型
-      isType: 'all',
       //当前所在文件夹位置
       currentFileIndex: 0,
       //文件信息面板是否显示
@@ -92,8 +89,7 @@ export default {
       let res = await this.$api.requested(this.params)
       this.total = res.total
       this.params.content.sort = res.sort
-      this.allFileData = this.fileType.fileList(res.data)
-      this.fileData = this.filterFileData(this.allFileData, this.isType)
+      this.fileData = this.fileType.fileList(res.data)
     },
     pageChange(n) {
       this.params.content.pageNumber = n
@@ -125,6 +121,7 @@ export default {
       this.params.content.parentid = index
       this.tempFileData.splice(this.tempFileData.indexOf(this.tempFileData.find(item => item.id == index)) + 1)
       this.params.content.pageNumber = 1
+      this.$refs.search.clearData()
       this.getFileList()
     },
     //修改收藏状态
@@ -140,13 +137,6 @@ export default {
       this.getFileList()
       this.currentFileIndex = 0
     },
-    //数据过滤
-    filterFileData(file, type) {
-      if (type == 'all') return file
-      return file.filter(item => {
-        return item.fileType == type
-      })
-    }
   }
 }
 </script>

+ 0 - 1
src/SManagement/archives_sc/index.vue

@@ -97,7 +97,6 @@ export default {
   },
   created () {
     this.getFileData()
-    this.getSelectList()
   },
   methods: {
     //获取列表数据

+ 4 - 19
src/SManagement/archives_upload/index.vue

@@ -146,25 +146,10 @@ export default {
           //判断所属ID是否为初始ID
           if (this.cacheInfo.content.sat_sharematerial_classid == '9999' + JSON.parse(window.sessionStorage.getItem("active_account")).userid) return this.$message.error('请选择素材分类');
           this.$api.requested(this.cacheInfo).then(res => {
-            let param = {
-              "classname": "webmanage.saletool.sharematerial.sharematerial",
-              "method": "audit",
-              "content": {
-                "sat_sharematerialid": res.data.sat_sharematerialid,
-                "type": 1
-              }
-            }
-            this.$api.requested(param).then(res => {
-              if (res.code == 1) {
-                this.uploadCacheData.status = '完成'
-                this.$notify({
-                  title: '提示',
-                  message: '操作成功',
-                  type: 'success'
-                })
-                this.insertCoursewareauth();
-                this.$router.go(-1)
-              }
+            this.tool.showMessage(res,() => {
+              this.uploadCacheData.status = '完成'
+              this.insertCoursewareauth()
+              this.$router.go(-1)
             })
           })
         } else {

+ 2 - 1
src/SManagement/archivesmag/index.vue

@@ -5,7 +5,7 @@
                   @BreadCrumbsChange="BreadCrumbsChange"></bread-crumbs>
     <div class="header-panl">
       <!--类型选择面板-->
-      <search @searchActive="searchActive" @clearData="clearData"></search>
+      <search @searchActive="searchActive" @clearData="clearData" ref="search"></search>
       <!--切换最热最新-->
       <hot-new-control :sortType= 'params.content.where.sorttype'
                        @sortTypeChange="sortTypeChange" v-if="tool.checkAuth($route.name,'read')"></hot-new-control>
@@ -120,6 +120,7 @@ export default {
       this.params.content.parentid = index
       this.params.content.pageNumber = 1
       this.tempFileData.splice(this.tempFileData.indexOf(this.tempFileData.find(item => item.id == index)) + 1)
+      this.$refs.search.clearData()
       this.getFileList()  
           
     },

+ 2 - 0
src/SManagement/submitedit_details/components/SubmiteditAction.vue

@@ -118,6 +118,8 @@ export default {
     },
     async save () {
       //新增
+      return console.log(this.param.content);
+      
       if (this.param.content.content == undefined && this.detailData.istextrequired == 1) {
         return this.$notify({
           title: '提示',

+ 1 - 0
src/components/search/index.vue

@@ -33,6 +33,7 @@ export default {
     },
     clearData() {
       this.$emit('clearData')
+      this.search = ''
     }
   },
   beforeDestroy() {

+ 139 - 0
src/components/socketMessage/index.vue

@@ -0,0 +1,139 @@
+<template>
+  <div class="messageBox" :class="panelIsShow?'show':''">
+    <div class="flex-align-center flex-between title-panel">
+      <p>消息提示</p>
+      <p @click="panelIsShow = false">忽略</p>
+    </div>
+    <p class="message-item" v-for="item in list" :key="item.index">
+      [{{item.type}}消息]&nbsp;{{item.title}}
+    </p>
+  </div>
+</template>
+<script>
+  export default {
+    components:{
+    },
+    data () {
+      return {
+        id:'',
+        path:"ws://121.37.152.76:8080/yos/webSocket/",
+        panelIsShow:false,
+        list:[]
+      }
+    },
+    created () {
+      let token = JSON.parse(sessionStorage.getItem('active_account')).token
+      this.path = this.path + token
+      console.log(this.path)
+    },
+    mounted () {
+      this.init()
+      this.getMessageList()
+    },
+    methods:{
+      async getMessageList () {
+        let param = {
+          "classname": "system.message.Message",
+          "method": "queryMessage",
+          "content": {
+            "nocache": true,
+            "pageNumber": 1,
+            "pageSize": 5,
+            "type": ''
+          }
+        }
+        let res = await this.$api.requested(param)
+        this.list = res.data
+      },
+      onCloseThemeChat () {
+      },
+      onTypeChange (val) {
+      },
+      onThemeChat (bool) {
+      },
+      onChange (type) {
+      },
+      init: function () {
+          if(typeof(WebSocket) === "undefined"){
+              alert("您的浏览器不支持socket")
+          }else{
+              // 实例化socket
+              this.socket = new WebSocket(this.path)
+              // 监听socket连接
+              this.socket.onopen = this.open
+              // 监听socket错误信息
+              this.socket.onerror = this.error
+              // 监听socket消息
+              this.socket.onmessage = this.getMessage
+              this.contectIsLive()
+          }
+      },
+      open: function (val) {
+          console.log("socket连接成功",val)
+      },
+      error: function () {
+          console.log("连接错误")
+      },
+      getMessage: function (msg) {
+        console.log(JSON.parse(msg.data))
+        this.panelIsShow = true
+        this.list = [JSON.parse(msg.data).message]
+      },
+      send: function (type,val,timsubjectid) {
+      },
+      close: function () {
+        console.log("socket已经关闭")
+      },
+      // 心跳链接
+      contectIsLive () {
+        const params = 'isalive'
+        this.realTimeClData = setInterval(() => {
+          console.log('监测连接')
+          this.socket.send(JSON.stringify(params))
+        }, 1000);
+      }
+    },
+    destroyed () {
+      // 销毁监听
+      this.socket.onclose = this.close
+    },
+    beforeDestroy () {
+      clearInterval(this.realTimeClData);
+    }
+  }
+</script>
+<style>
+</style>
+<style scoped>
+.messageBox{
+  position: fixed;
+  right:10px;
+  bottom: -310px;
+  width:250px;
+  height: 300px;
+  background: #fff;
+  box-shadow: 0 0 10px #ccc;
+  border-radius: 4px;
+  z-index: 9999;
+  transition: .5s linear;
+  overflow: hidden;
+}
+.show{
+  bottom:10px
+}
+.title-panel{
+  padding: 10px;
+  background: #3874F6;
+  color: #fff;
+  font-size: 14px;
+  cursor: pointer;
+}
+.message-item{
+  padding: 10px;
+  font-size: 14px;
+  width: 100%;
+  overflow: hidden;
+  white-space: nowrap;
+  text-overflow: ellipsis
+}
+</style>

+ 1 - 1
src/router/SManagement.js

@@ -104,7 +104,7 @@ const SManagement = [{
   name: 'usercenter',
   meta: {
     title: '个人中心',
-    ast_nav: true
+    ast_nav: false
   },
   component: () => import(/* webpackChunkName: "about" */ '@/SManagement/user/user-info/UserInfo')
 },

+ 1 - 0
src/views/message/components/list.vue

@@ -139,4 +139,5 @@ export default {
   flex-direction: column;
   align-items: center;
 }
+
 </style>

+ 52 - 16
src/views/message/index.vue

@@ -4,10 +4,15 @@
       <el-col :span="12">
         <div class="left">
           <div class="select">
-            <div @click="selectFun('系统')"
-              :style="currentItem==0 ? 'background:#3874F6;color:#ffffff' : 'border:1px solid #cccccc'">系统消息</div>
-            <div @click="selectFun('应用')"
-              :style="currentItem==1 ? 'background:#3874F6;color:#ffffff' : 'border:1px solid #cccccc'">应用消息</div>
+            <div class="select_left">
+              <div @click="selectFun('系统')"
+                :style="currentItem==0 ? 'background:#3874F6;color:#ffffff' : 'border:1px solid #cccccc'">系统消息</div>
+              <div @click="selectFun('应用')"
+                :style="currentItem==1 ? 'background:#3874F6;color:#ffffff' : 'border:1px solid #cccccc'">应用消息</div>
+            </div>
+            <div class="select_right">
+              <div class="all-read" @click="allRead">全部阅读</div>
+            </div>
           </div>
           <list :list="list" @messageItemClick="messageItemClick"></list>
           <pagination :total="total" :pageSize="param.content.pageSize" :currentPage="param.content.pageNumber"
@@ -16,7 +21,7 @@
         </div>
       </el-col>
       <el-col :span="12">
-        <div class="right">
+        <div class="right" v-if="message">
           <p class="title">{{message.title}}</p>
           <p class="info">
             <span>发布于:{{message.createdate}} | {{message.type}}</span>
@@ -48,7 +53,10 @@ export default {
           "nocache": true,
           "pageNumber": 1,
           "pageSize": 10,
-          "type": ''
+          "type": '',
+          "where": {
+
+          }
         }
       },
       list: '',
@@ -69,12 +77,13 @@ export default {
       this.param.content.type = this.currentItem == 0 ? '系统' : '应用'
       let res = await this.$api.requested(this.param)
       this.list = res.data
-      this.messageItemClick(this.list[0])
-      this.total = res.total
       console.log(this.list);
       
+      if(this.list[0]) this.messageItemClick(this.list[0])
+      this.total = res.total
     },
     selectFun (data) {
+      this.message = ''
       this.param.content.pageNumber = 1
       this.currentItem = data == '系统' ? 0 : 1
       this.getMessageList()
@@ -92,8 +101,13 @@ export default {
             "messageid":data.messageid
         }
       })
+      console.log(res);
+      
       data.isread = 1
       this.message = res.data
+    },
+    allRead() {
+
     }
   },
 };
@@ -105,42 +119,58 @@ export default {
 }
 .message {
   width: 100%;
-  min-height: 100%;
   margin: 0 auto;
   position: relative;
 }
 .message .left {
+  min-height: calc(100vh - 99px);
   position: relative;
   padding: 20px 0 60px 0;
   box-shadow: 1px 0px 0px 1px #DDDDDD;
-  border-radius: 4px 4px 4px 4px;
   background: #ffffff;
 }
 .message .select {
-  width: 200px;
+  width: 100%;
   height: 36px;
   border-radius: 4px;
   display: flex;
   justify-content: space-between;
-  line-height: 36px;
+  padding: 0 16px;
+}
+.message .select .select_left {
+  display: flex;
+  justify-content: space-between;
   font-size: 14px;
   margin-left: 16px;
 }
-.message .select div {
-  width: 50%;
+.message .select .select_left div {
   height: 34px;
   text-align: center;
   cursor: pointer;
+  padding: 8px 22px;
   transition: background 0.2s ease-in-out;
 }
-.message .select div:first-child {
+.message .select .select_left div:first-child {
   border-top-left-radius: 4px;
   border-bottom-left-radius: 4px;
 }
-.message .select div:last-child {
+.message .select .select_left div:last-child {
   border-top-right-radius: 4px;
   border-bottom-right-radius: 4px;
 }
+.message .select .select_right .all-read {
+  background: #FFFFFF;
+  border-radius: 4px 4px 4px 4px;
+  border: 1px solid #CCCCCC;
+  padding: 8px 22px;
+  font-size: 14px;
+  font-weight: 400;
+  color: #666666;
+  cursor: pointer;
+}
+.message .select .select_right .all-read:hover {
+  color: #3874F6;
+}
 .message .right {
   padding: 20px 16px;
 }
@@ -173,4 +203,10 @@ export default {
   right: 16px;
   bottom: 0;
 }
+/deep/.el-empty {
+  position: absolute;
+  left: 50%;
+  top: 50%;
+  transform: translate(-50%,-50%);
+}
 </style>