Browse Source

消息推送管理 删掉一些不用的接口

cxmo 8 months ago
parent
commit
3e8c503f0d

+ 1 - 0
package.json

@@ -12,6 +12,7 @@
   "dependencies": {
   "dependencies": {
     "@element-plus/icons-vue": "^2.3.1",
     "@element-plus/icons-vue": "^2.3.1",
     "axios": "^1.6.8",
     "axios": "^1.6.8",
+    "dayjs": "^1.11.12",
     "element-plus": "^2.7.3",
     "element-plus": "^2.7.3",
     "highcharts": "^11.4.3",
     "highcharts": "^11.4.3",
     "js-base64": "^3.7.7",
     "js-base64": "^3.7.7",

+ 6 - 3
pnpm-lock.yaml

@@ -11,6 +11,9 @@ dependencies:
   axios:
   axios:
     specifier: ^1.6.8
     specifier: ^1.6.8
     version: 1.6.8
     version: 1.6.8
+  dayjs:
+    specifier: ^1.11.12
+    version: 1.11.12
   element-plus:
   element-plus:
     specifier: ^2.7.3
     specifier: ^2.7.3
     version: 2.7.3(vue@3.4.21)
     version: 2.7.3(vue@3.4.21)
@@ -1188,8 +1191,8 @@ packages:
       is-data-view: 1.0.1
       is-data-view: 1.0.1
     dev: true
     dev: true
 
 
-  /dayjs@1.11.11:
-    resolution: {integrity: sha512-okzr3f11N6WuqYtZSvm+F776mB41wRZMhKP+hc34YdW+KmtYYK9iqvHSwo2k9FEH3fhGXvOPV6yz2IcSrfRUDg==}
+  /dayjs@1.11.12:
+    resolution: {integrity: sha512-Rt2g+nTbLlDWZTwwrIXjy9MeiZmSDI375FvZs72ngxx8PDC6YXOeR3q5LAuPzjZQxhiWdRKac7RKV+YyQYfYIg==, tarball: https://registry.npmmirror.com/dayjs/-/dayjs-1.11.12.tgz}
     dev: false
     dev: false
 
 
   /debug@2.6.9:
   /debug@2.6.9:
@@ -1333,7 +1336,7 @@ packages:
       '@types/lodash-es': 4.17.12
       '@types/lodash-es': 4.17.12
       '@vueuse/core': 9.13.0(vue@3.4.21)
       '@vueuse/core': 9.13.0(vue@3.4.21)
       async-validator: 4.2.5
       async-validator: 4.2.5
-      dayjs: 1.11.11
+      dayjs: 1.11.12
       escape-html: 1.0.3
       escape-html: 1.0.3
       lodash: 4.17.21
       lodash: 4.17.21
       lodash-es: 4.17.21
       lodash-es: 4.17.21

+ 1 - 3
src/api/customer/index.js

@@ -1,8 +1,6 @@
-import apiCustomerUser from './modules/user'
-import apiCustomerStatistic from './modules/statistic'
+import apiCustomerUser from './user'
 
 
 export {
 export {
   apiCustomerUser,
   apiCustomerUser,
-  apiCustomerStatistic,
 }
 }
 
 

+ 0 - 21
src/api/customer/modules/statistic.js

@@ -1,21 +0,0 @@
-import { get, post } from "@/api/index";
-
-export default {
-  //用户阅读统计列表数据
-  readRecordList: params => {
-    return get("/read/list", params);
-  },
-  // 用户阅读统计详情数据
-  readRecordInfo: params => {
-    return get("/read/detail", params);
-  },
-  // 用户阅读量统计图数据
-  readTimesChartData:params=>{
-    return get('/read/readCntChart',params)
-  },
-  // 用户阅读品种分布图数据
-  readPermissionChartData:params=>{
-    return get('/read/readPermissionChart',params)
-  },
-  
-};

+ 0 - 0
src/api/customer/modules/user.js → src/api/customer/user.js


+ 1 - 1
src/api/index.js

@@ -58,7 +58,7 @@ _axios.interceptors.response.use(
     }
     }
     if(data.Ret===408){//token失效
     if(data.Ret===408){//token失效
       ElMessage.error(data.Msg)
       ElMessage.error(data.Msg)
-      //router.replace('/login')
+      router.replace('/login')
     }
     }
     if(data.Ret===403){
     if(data.Ret===403){
       setTimeout(() => {
       setTimeout(() => {

+ 55 - 0
src/api/message/common.js

@@ -0,0 +1,55 @@
+import { get, post } from "@/api/index";
+export default{
+    /**
+     * 消息推送-报告列表
+     * @param {Object} params 
+     * @param {String} params.KeyWord
+     * @param {String} params.PermissionIds 筛选的品种id 用,隔开
+     * @param {String} params.AnalystNames 筛选的研究员名称 用,隔开
+     * @param {String} params.SortType asc desc
+     * @param {Number} params.CurrentIndex
+     * @param {Number} params.PageSize
+     * @returns 
+     */
+    getReportMsgList:params=>{
+        return get('/message/reportList',params)
+    },
+    /**
+     * 消息推送-音频列表
+     * @param {Object} params 
+     * @param {String} params.KeyWord
+     * @param {String} params.PermissionIds 筛选的品种id 用,隔开
+     * @param {String} params.AnalystIds 筛选的研究员id 用,隔开
+     * @param {String} params.SortType asc desc
+     * @param {Number} params.CurrentIndex
+     * @param {Number} params.PageSize
+     * @returns
+     */
+    getAudioMsgList:params=>{
+        return get('/message/audioList',params)
+    },
+    /**
+     * 消息推送-视频列表
+     * @param {Object} params 
+     * @param {String} params.KeyWord
+     * @param {String} params.PermissionIds 筛选的品种id 用,隔开
+     * @param {String} params.AnalystIds 筛选的研究员id 用,隔开
+     * @param {String} params.SortType asc desc
+     * @param {Number} params.CurrentIndex
+     * @param {Number} params.PageSize
+     * @returns
+     */
+    getVideoMsgList:params=>{
+        return get('/message/videoList',params)
+    },
+    /**
+     * 消息推送-推送
+     * @param {Object} params
+     * @param {Number} params.DataId reportId/mediaId
+     * @param {String} params.DataType report audio video
+     * @returns 
+     */
+    pushMessage:params=>{
+        return post('/message/sendTemplateMsg',params)
+    }
+}

+ 4 - 0
src/api/message/index.js

@@ -0,0 +1,4 @@
+import apiMessage from './common'
+export {
+    apiMessage
+}

+ 0 - 12
src/api/report/common.js

@@ -1,12 +0,0 @@
-import { get, post } from "@/api/index";
-
-export default {
-  //报告分类
-  classifyList: () => {
-    return get('/classify/list',{})
-  },
-  // 研报作者
-  reportAuthorList:()=>{
-    return get('/report_pdf/author',{})
-  }
-};

+ 0 - 7
src/api/report/index.js

@@ -1,7 +0,0 @@
-import apiReportCommon from './common'
-import apiReportPdf from './pdf'
-
-export {
-  apiReportCommon,
-  apiReportPdf,
-}

+ 0 - 28
src/api/report/pdf.js

@@ -1,28 +0,0 @@
-import { get, post } from "@/api/index";
-
-export default {
-  //新增pdf报告
-  reportPdfAdd: params => {
-    return post('/report_pdf/add',params)
-  },
-  //编辑pdf报告
-  reportPdfEdit: params => {
-    return post('/report_pdf/edit',params)
-  },
-  //pdf报告列表
-  reportPdfList: params => {
-    return get('/report_pdf/list',params)
-  },
-  //pdf报告发布
-  reportPdfPubllish: params => {
-    return get('/report_pdf/publish',params)
-  },
-  //pdf报告取消发布
-  reportPdfCancelPubllish: params => {
-    return get('/report_pdf/publishCancel',params)
-  },
-  //pdf报告删除
-  reportPdfDelete: params => {
-    return get('/report_pdf/delete',params)
-  },
-};

+ 5 - 0
src/styles/element.scss

@@ -43,4 +43,9 @@
     .el-icon{
     .el-icon{
         font-size: 15px;
         font-size: 15px;
     }
     }
+}
+.el-select{
+    .el-select__wrapper{
+        height: 100%;
+    }
 }
 }

+ 152 - 33
src/views/customer/NotificationList.vue

@@ -1,6 +1,12 @@
 <script setup>
 <script setup>
 import { ref, reactive, computed } from 'vue'
 import { ref, reactive, computed } from 'vue'
 import { Search } from '@element-plus/icons-vue'
 import { Search } from '@element-plus/icons-vue'
+import { apiMediaCommon } from '@/api/media'
+import { apiAuthor } from '@/api/author'
+import { apiMessage } from '@/api/message'
+import { ElMessage } from 'element-plus'
+
+import MediaPlayer from '@/views/media/components/MediaPlayer.vue'
 
 
 const tableQuery = reactive({
 const tableQuery = reactive({
     keyWord:'',
     keyWord:'',
@@ -10,32 +16,49 @@ const tableQuery = reactive({
     currentPage:1,
     currentPage:1,
     pageSize:10,
     pageSize:10,
     totals:0,
     totals:0,
+    sortType:''
 })
 })
 
 
-const classifyOptions = ref([])
+const classifyOptions = ref([]) //报告分类 这期没做
 const labelOptions = ref([])
 const labelOptions = ref([])
+function getLableList(){
+    apiMediaCommon.getPermissionList().then(res=>{
+        if(res.Ret!==200) return
+        labelOptions.value = res.Data.List||[]
+    })
+}
+getLableList()
 const authorList = ref([])
 const authorList = ref([])
-
+function getAuthorList(){
+    apiAuthor.getAuthorList({
+        PageSize:999,
+        CurrentIndex:1,
+    }).then(res=>{
+        if(res.Ret!==200) return 
+        authorList.value = res.Data.List||[]
+    })
+}
+getAuthorList()
 const reportColumns = [
 const reportColumns = [
-    {label:'报告名称',key:'name',},
-    {label:'摘要',key:'abs',},
-    {label:'分类',key:'classify',},
-    {label:'研究员',key:'author',},
-    {label:'标签',key:'label',},
-    {label:'发布/审批时间',key:'time',width:250,sortable:true}
+    {label:'报告名称',key:'Title',},
+    {label:'摘要',key:'Abstract',},
+    /* {label:'分类',key:'classify',}, */
+    {label:'研究员',key:'Author',},
+    {label:'标签',key:'PermissionNames',},
+    {label:'发布/审批时间',key:'PublishedTime',width:250,sortable:true}
 ]
 ]
 const audioColumns = [
 const audioColumns = [
-    {label:'音频名称',key:'name',},
-    {label:'研究员',key:'author',},
-    {label:'标签',key:'label',},
-    {label:'添加时间',key:'time',width:250,sortable:true}
+    {label:'音频名称',key:'mediaName',},
+    {label:'研究员',key:'authorName',},
+    {label:'标签',key:'PermissionNames',},
+    {label:'添加时间',key:'publishedTime',width:250,sortable:true}
 ]
 ]
 const videoColumns = [
 const videoColumns = [
-    {label:'视频封面',key:'cover',},
-    {label:'视频名称',key:'name',},
-    {label:'研究员',key:'author',},
-    {label:'标签',key:'label',},
-    {label:'添加时间',key:'time',width:250,sortable:true}
+    {label:'视频封面',key:'coverSrc',},
+    {label:'视频名称',key:'mediaName',},
+    {label:'研究员',key:'authorName',},
+    {label:'标签',key:'PermissionNames',},
+    {label:'添加时间',key:'publishedTime',width:250,sortable:true}
 ]
 ]
 
 
 const activeType = ref('report')
 const activeType = ref('report')
@@ -46,33 +69,107 @@ const tableColumns = computed(()=>{
         'video':videoColumns
         'video':videoColumns
     }[activeType.value]
     }[activeType.value]
 })
 })
+const placeholderText = computed(()=>{
+    return {
+        'report':'报告名称',
+        'audio':'音频名称',
+        'video':'视频名称'
+    }[activeType.value]
+})
 function handleTabChange(){
 function handleTabChange(){
+    //清空筛选项
+    tableQuery.labels=''
+    tableQuery.author=''
+    tableQuery.keyWord=''
     //重置页码
     //重置页码
-    //getTableData
+    handlePageChange(1)
+}
+function handlePageChange(page){
+    tableQuery.currentPage = page
+    getTableData()
 }
 }
-function handlePageChange(){}
 const tableData = ref([])
 const tableData = ref([])
-function getTableData(){
-    tableData.value = [
-        {
-            name:'aaa',
-            time:'2024-08-02 12:30'
-        }
-    ]
+async function getTableData(){
+    const params = {
+        KeyWord:tableQuery.keyWord,
+        PermissionIds:Array.isArray(tableQuery.labels)?tableQuery.labels.join(','):'',
+        SortType:tableQuery.sortType,
+        CurrentIndex:tableQuery.currentPage,
+        PageSize:tableQuery.pageSize,
+    }
+    const otherParams = activeType.value==='report'?{
+        AnalystNames:Array.isArray(tableQuery.author)?tableQuery.author.map(i=>i.Name).join(','):''
+    }:{
+        AnalystIds:Array.isArray(tableQuery.author)?tableQuery.author.map(i=>i.Id).join(','):''
+    }
+    const apiMap = {
+        'report':apiMessage.getReportMsgList,
+        'audio':apiMessage.getAudioMsgList,
+        'video':apiMessage.getVideoMsgList,
+    }
+    const res = await apiMap[activeType.value]({...params,...otherParams})
+    if(res.Ret!==200) return 
+    tableData.value = res.Data.List||[]
+    tableQuery.totals = res.Data.Paging.Totals||0
 }
 }
 getTableData()
 getTableData()
 
 
 function handleClassifyChange(){}
 function handleClassifyChange(){}
-function handleLabelChange(){}
+function handleLabelChange(){
+    handlePageChange(1)
+}
+function handleAuthorChange(){
+    handlePageChange(1)
+}
+let mediaPlayerShow = ref(false)
+let curData = reactive({})
+function handlePreviewMedia(data){
+    curData.mediaName = data.mediaName||''
+    curData.fileUrl=data.src||''
+    mediaPlayerShow.value = true
+}
+function checkDataStatus(data){
+    const status = activeType.value==='report'?data.SendStatus:data.sendStatus
+    return status==='UNSEND'
+}
+function pushMessage(data){
+    apiMessage.pushMessage({
+        DataId:activeType.value==='report'?data.Id:data.mediaId,
+        DataType:activeType.value
+    }).then(res=>{
+        if(res.Ret!==200) return 
+        ElMessage.success('推送成功')
+        getTableData()
+    })
+}
 </script>
 </script>
 
 
 <template>
 <template>
     <div class="notification-list-wrap">
     <div class="notification-list-wrap">
         <div class="select-box">
         <div class="select-box">
-            <el-cascader style="width:160px" placeholder="分类" v-model="tableQuery.classify" :options="classifyOptions" @change="handleClassifyChange" v-if="activeType==='report'"></el-cascader>
-            <el-cascader style="width:160px" placeholder="标签" v-model="tableQuery.labels" :options="labelOptions" @change="handleLabelChange"></el-cascader>
-            <el-select style="width:160px" placeholder="研究员"></el-select>
-            <el-input style="width:400px" placeholder="报告名称" v-model="tableQuery.keyWord" :prefix-icon="Search" clearable></el-input>
+            <!-- <el-cascader style="width:160px" placeholder="分类" v-model="tableQuery.classify" :options="classifyOptions" @change="handleClassifyChange" v-if="activeType==='report'"></el-cascader> -->
+            <el-cascader style="width:240px" placeholder="标签" v-model="tableQuery.labels" @change="handleLabelChange"
+                :options="labelOptions"
+                collapse-tags
+                collapse-tags-tooltip
+                :props="{
+                    value:'id',
+                    label:'name',
+                    emitPath:false,
+                    multiple:true
+                }"
+            ></el-cascader>
+            <el-select style="width:160px" placeholder="研究员" v-model="tableQuery.author" @change="handleAuthorChange"
+                multiple collapse-tags collapse-tags-tooltip value-key="Id">
+                <el-option 
+                    v-for="item in authorList" 
+                    :key="item.Id"
+                    :label="item.Name"
+                    :value="item"></el-option>
+            </el-select>
+            <el-input style="width:400px" :placeholder="placeholderText" v-model="tableQuery.keyWord" 
+            @input="handlePageChange(1)"
+            :prefix-icon="Search" clearable />
         </div>
         </div>
         <div class="tab-box">
         <div class="tab-box">
             <el-tabs v-model="activeType" class="tabs" @tab-change="handleTabChange">
             <el-tabs v-model="activeType" class="tabs" @tab-change="handleTabChange">
@@ -87,11 +184,26 @@ function handleLabelChange(){}
                     align="center"
                     align="center"
                     v-for="column in tableColumns" :key="column.key"
                     v-for="column in tableColumns" :key="column.key"
                     :prop="column.key" :label="column.label" :sortable="column.sortable" :width="column.width">
                     :prop="column.key" :label="column.label" :sortable="column.sortable" :width="column.width">
-
+                    <template #default="{row}">
+                        <span v-if="column.key==='mediaName'" @click="handlePreviewMedia(row)" style="color:#086CE0;cursor: pointer;">
+                            {{ row.mediaName }}
+                        </span>
+                        <div v-else-if="column.key==='coverSrc'" style="color:#086CE0;cursor: pointer;">
+                            <el-image 
+                                v-if="row[column.key]"
+                                fit="cover"
+                                :src="row[column.key]||''" 
+                                :preview-src-list="[row[column.key]||'']" 
+                                style="display: inline-block;width:60px;height: 60px;" preview-teleported/>
+                            <span v-else style="display: inline-block;width:60px;height: 60px;line-height: 60px;">-</span> 
+                        </div>
+                        <span v-else>{{ row[column.key]||'-' }}</span>
+                    </template>
                 </el-table-column>
                 </el-table-column>
                 <el-table-column label="操作">
                 <el-table-column label="操作">
                     <template #default="{row}">
                     <template #default="{row}">
-                        <el-link type="primary" :underline="false" @click="">推送</el-link>
+                        <el-link type="primary" :underline="false" @click="pushMessage(row)" v-if="checkDataStatus(row)">推送</el-link>
+                        <span v-else style="color:#666666;">已推送</span>
                     </template>
                     </template>
                 </el-table-column>
                 </el-table-column>
             </el-table>
             </el-table>
@@ -106,6 +218,13 @@ function handleLabelChange(){}
             />
             />
         </div>
         </div>
     </div>
     </div>
+    <MediaPlayer 
+        v-model:show="mediaPlayerShow"
+        :title="curData.mediaName"
+        :src="curData.fileUrl"
+        :mediaType="activeType"
+    >
+    </MediaPlayer>
 </template>
 </template>
 
 
 <style scoped lang="scss">
 <style scoped lang="scss">

+ 2 - 0
src/views/media/components/MediaUpload.vue

@@ -252,6 +252,8 @@ function handleUploadImg(file){
                 <el-form-item prop="labels" label="标签">
                 <el-form-item prop="labels" label="标签">
                     <el-cascader style="width: 100%;" 
                     <el-cascader style="width: 100%;" 
                         v-model="mediaData.labels"
                         v-model="mediaData.labels"
+                        collapse-tags
+                        collapse-tags-tooltip
                         :options="labelList"
                         :options="labelList"
                         :props="{
                         :props="{
                             value:'id',
                             value:'id',