Browse Source

提交代码

wangxiaogang 3 years ago
parent
commit
7f933596f5

+ 2 - 2
src/jfw/modules/app/src/web/templates/frontRouter/messageCenter/sess/index.html

@@ -23,7 +23,7 @@
         <div class="j-main" v-show="msgList">
           <div class="head-mesg" v-show="!$.isEmptyObject(lastData)">
             <h5>重要提醒</h5>
-            <div class="h-conts" @click="msgClick(lastData.url,lastData.isRead,lastData.id,lastData.msg_type)">
+            <div class="h-conts" @click="msgClick(lastData.url,lastData.isRead,lastData.id,lastData.msg_type,lastData.msgLogId)">
               <div class="p1">
                 <span class="spa-tit">{lastData.title}</span>
                 <span class="spa flex" @click.stop="toggleClick" v-show="isRow">{isToggle?'收起':'展开'}&nbsp;<van-icon :class="isToggle?'is-icon1':'is-icon2'" name="arrow-down" /></span>
@@ -32,7 +32,7 @@
             </div>
           </div>
           <div class="t-list">
-            <div class="tips" v-for="(ite, index) in msgList" :key="index" @click="msgDetailed(ite.type,ite.count)" v-show="!$.isEmptyObject(ite.newMsg)">
+            <div class="tips" v-for="(ite, index) in msgList" :key="index" @click="msgDetailed(ite.type,ite.count,ite.msgLogId)" v-show="!$.isEmptyObject(ite.newMsg)">
               <div class="imgs">
                 <van-badge :class="{'no-active':ite.count <= 0}" :content="ite.count" max="99">
                   <img :src="'/common-module/messageCenter/image/'+imgSrcs[ite.type - 1].url+'@2x.png'">

+ 25 - 4
src/web/staticres/common-module/messageCenter/js/detail.js

@@ -43,22 +43,44 @@ var vm = new Vue({
     el.scrollTop = el.scrollHeight
   },
   methods: {
+    platType() {
+      let wxType = getType()
+      if (wxType) {
+        return 3
+      } else {
+        return 2
+      }
+    },
     // 点击分类修改分类下的消息为已读
     setRead(val) {
+      const _this = this
       $.ajax({
         type:'POST',
         url:'/jymessageCenter/setReadStatus',
         data: {
           msgType: val
         },
-        success:function (res) {
-          console.log(res)
-        }
+        success:function () {}
+      })
+    },
+    appMesg(type) {
+      const _this = this
+      $.ajax({
+        type: 'GET',
+        url: '/jymessageCenter/appClickMessage',
+        data: {
+          msgType: type,
+          platform: _this.platType(),
+          offset: this.tabsList.offset,
+          pageSize: this.tabsList.pageSize
+        },
+        success:function () {}
       })
     },
     // 消息详情
     msgData() {
       const _this = this
+      this.appMesg(getQueryString('type'))
       $.ajax({
         type: 'POST',
         url: '/jymessageCenter/messageList',
@@ -106,7 +128,6 @@ var vm = new Vue({
       })
     },
     msgClick(url) {
-      console.log(url)
       let wxType = getType()
       let appType = androidOrIOS()
       if (wxType) {

+ 42 - 27
src/web/staticres/common-module/messageCenter/js/index.js

@@ -65,7 +65,7 @@ var vm = new Vue({
       })
     },
     // 点击置顶消息为已读
-    topRead(ids) {
+    topRead(ids, url, type) {
       const _this = this
       $.ajax({
         type:'POST',
@@ -74,48 +74,63 @@ var vm = new Vue({
           msgId: ids,
           msgType: type
         },
-        success:function (res) {
-          console.log(res)
+        success:function () {
           _this.msgData()
+          if (url) {
+            location.href = url
+          }
         }
       })
     },
+    platType() {
+      let wxType = getType()
+      if (wxType) {
+        return 3
+      } else {
+        return 2
+      }
+    },
+    clickMesg(logid) {
+      const _this = this
+      $.ajax({
+        type: 'GET',
+        url: '/jymessageCenter/clickMessage',
+        data: {
+          msgLogId: logid,
+          platform: _this.platType()
+        },
+        success:function () {}
+      })
+    },
     // 置顶消息跳转
-    msgClick(url, num, ids, type) {
-      console.log(url)
+    msgClick(url, num, ids, type, logid) {
+      this.clickMesg(logid)
       let wxType = getType()
       let appType = androidOrIOS()
       if (wxType) {
-        if (url.weChatUrl) {
-          if (!num) {
-            this.topRead(ids, type)
-          }
-          setTimeout(() => {
-            location.href = url.weChatUrl
-          }, 300)
+        if (!num) {
+          this.topRead(ids, url.weChatUrl, type)
         } else {
-          return
+          if (url.weChatUrl) {
+            location.href = url.weChatUrl
+          }
         }
       } else {
         if (appType == 'android') {
-          if (url.androidUrl) {
-            location.href = url.androidUrl
-            if (!num) {
-              this.topRead(ids)
-            }
+          if (!num) {
+            this.topRead(ids, url.androidUrl, type)
           } else {
-            return
+            if (url.androidUrl) {
+              location.href = url.androidUrl
+            }
           }
         } else {
-          if (url.iosUrl) {
-            if (!num) {
-              this.topRead(ids)
-            }
-            setTimeout(() => {
-              location.href = url.iosUrl
-            }, 300)
+          if (!num) {
+            this.topRead(ids, url.iosUrl, type)
           } else {
-            return
+            if (url.iosUrl) {
+              location.href = url.iosUrl
+            }
           }
         }
       }

+ 22 - 3
src/web/staticres/frontRouter/pc/mesgCenter/js/index-pc.js

@@ -75,7 +75,7 @@ var vm = new Vue({
     readed(ids, type, url) {
       const _this = this
       $.ajax({
-        type:'GET',
+        type: 'POST',
         url:'/jymessageCenter/markRead',
         data: {
           msgId: ids,
@@ -85,14 +85,33 @@ var vm = new Vue({
           _this.tabsData(_this.isTabs)
           _this.tabsCount()
           message.checkOpened()
+          message.checkMessage()
           if (url) {
             location.href = url
           }
         }
       })
     },
-    linked(id, url, str, num, type) {
-      this.readed(id, type, url)
+    clickMesg(logid) {
+      $.ajax({
+        type: 'GET',
+        url: '/jymessageCenter/clickMessage',
+        data: {
+          msgLogId: logid,
+          platform: '1'
+        },
+        success:function () {}
+      })
+    },
+    linked(id, url, str, num, type, msgLogid) {
+      this.clickMesg(msgLogid)
+      if (str == 0) {
+        this.readed(id, type, url)
+      } else {
+        if (url) {
+          location.href = url
+        }
+      }
     }
   }
 })

+ 29 - 13
src/web/staticres/js/message.js

@@ -1,5 +1,5 @@
 // 点击置顶消息为已读
-function topRead(ids, type) {
+function topRead(ids, type, url) {
     $.ajax({
       type:'POST',
       url:'/jymessageCenter/markRead',
@@ -7,20 +7,36 @@ function topRead(ids, type) {
         msgId: ids,
         msgType: type
       },
-      success:function (res) {
+      success:function () {
         message.checkMessage()
         message.checkOpened()
+        if (url) {
+            window.location.href = url
+        }
       }
     })
-  }
+}
+// 消息统计
+function clickMesge(msgLogid) {
+    $.ajax({
+      type:'POST',
+      url:'/jymessageCenter/clickMessage',
+      data: {
+        msgLogId: msgLogid,
+        platform: '1'
+      },
+      success:function () {}
+    })
+}
 // 消息悬浮窗列表跳转详情页
-function linked (ids, url, num, type) {
-    console.info(ids, url, num, type)
-    if (url) {
-        window.location.href = url
-    }
+function linked (ids, url, num, type, msgLogid) {
+    this.clickMesge(msgLogid)
     if (num == 0) {
-        topRead(ids, type)
+        topRead(ids, type, url)
+    } else {
+        if (url) {
+            window.location.href = url
+        }
     }
 }
 function Message() {
@@ -124,17 +140,17 @@ function Message() {
         var temp = ''
         if (lasts) {
             if (lasts.isRead == 0) {
-                temp += '<div id="firsted" class="m-li" onclick="linked(\''+lasts.id+'\',\''+lasts.link+'\',\''+lasts.isRead+'\',\''+lasts.msg_type+'\')"><div class="lis-cont"><img src="/images/pc/'+imgArrs[lasts.msg_type]+'@2x.png"><i class="dots"></i><div class="r-lis"><div class="title"><span>'+lasts.title+'</span><span>'+dateMatter(lasts.createtime)+'</span></div><p>'+lasts.content+'</p></div></div></div>'
+                temp += '<div id="firsted" class="m-li" onclick="linked(\''+lasts.id+'\',\''+lasts.link+'\',\''+lasts.isRead+'\',\''+lasts.msg_type+'\',\''+lasts.msgLogId+'\')"><div class="lis-cont"><img src="/images/pc/'+imgArrs[lasts.msg_type]+'@2x.png"><i class="dots"></i><div class="r-lis"><div class="title"><span>'+lasts.title+'</span><span>'+dateMatter(lasts.createtime)+'</span></div><p>'+lasts.content+'</p></div></div></div>'
             } else {
-                temp += '<div id="firsted" class="m-li" onclick="linked(\''+lasts.id+'\',\''+lasts.link+'\',\''+lasts.isRead+'\',\''+lasts.msg_type+'\')"><div class="lis-cont"><img src="/images/pc/'+imgArrs[lasts.msg_type]+'@2x.png"><div class="r-lis"><div class="title"><span>'+lasts.title+'</span><span>'+dateMatter(lasts.createtime)+'</span></div><p>'+lasts.content+'</p></div></div></div>'
+                temp += '<div id="firsted" class="m-li" onclick="linked(\''+lasts.id+'\',\''+lasts.link+'\',\''+lasts.isRead+'\',\''+lasts.msg_type+'\',\''+lasts.msgLogId+'\')"><div class="lis-cont"><img src="/images/pc/'+imgArrs[lasts.msg_type]+'@2x.png"><div class="r-lis"><div class="title"><span>'+lasts.title+'</span><span>'+dateMatter(lasts.createtime)+'</span></div><p>'+lasts.content+'</p></div></div></div>'
             }
         }
         if (lists) {
             for (var i = 0; i < lists.length; i++) {
                 if (lists[i].isRead == 0) {
-                    temp += '<div class="m-li" onclick="linked(\''+lists[i].id+'\',\''+lists[i].link+'\',\''+lists[i].isRead+'\',\''+lists[i].msg_type+'\')"><div class="lis-cont"><img src="/images/pc/'+imgArrs[lists[i].msg_type]+'@2x.png"><i class="dots"></i><div class="r-lis"><div class="title"><span>'+lists[i].title+'</span><span>'+dateMatter(lists[i].createtime)+'</span></div><p>'+lists[i].content+'</p></div></div></div>'
+                    temp += '<div class="m-li" onclick="linked(\''+lists[i].id+'\',\''+lists[i].link+'\',\''+lists[i].isRead+'\',\''+lists[i].msg_type+'\',\''+lists[i].msgLogId+'\')"><div class="lis-cont"><img src="/images/pc/'+imgArrs[lists[i].msg_type]+'@2x.png"><i class="dots"></i><div class="r-lis"><div class="title"><span>'+lists[i].title+'</span><span>'+dateMatter(lists[i].createtime)+'</span></div><p>'+lists[i].content+'</p></div></div></div>'
                 } else {
-                    temp += '<div class="m-li" onclick="linked(\''+lists[i].id+'\',\''+lists[i].link+'\',\''+lists[i].isRead+'\',\''+lists[i].msg_type+'\')"><div class="lis-cont"><img src="/images/pc/'+imgArrs[lists[i].msg_type]+'@2x.png"><div class="r-lis"><div class="title"><span>'+lists[i].title+'</span><span>'+dateMatter(lists[i].createtime)+'</span></div><p>'+lists[i].content+'</p></div></div></div>'
+                    temp += '<div class="m-li" onclick="linked(\''+lists[i].id+'\',\''+lists[i].link+'\',\''+lists[i].isRead+'\',\''+lists[i].msg_type+'\',\''+lists[i].msgLogId+'\')"><div class="lis-cont"><img src="/images/pc/'+imgArrs[lists[i].msg_type]+'@2x.png"><div class="r-lis"><div class="title"><span>'+lists[i].title+'</span><span>'+dateMatter(lists[i].createtime)+'</span></div><p>'+lists[i].content+'</p></div></div></div>'
                 }
             }
         }

+ 2 - 2
src/web/templates/frontRouter/pc/messageCenter/sess/index.html

@@ -22,7 +22,7 @@
 	  <section class="mesg-container" v-cloak>
         <div class="main-mesg">
           <h3>消息中心</h3>
-          <div class="tips" @click="linked(tabsList.lasts.id, tabsList.lasts.link, tabsList.lasts.isRead,1,tabsList.lasts.msg_type)" v-show="tabsList.lasts">
+          <div class="tips" @click="linked(tabsList.lasts.id, tabsList.lasts.link, tabsList.lasts.isRead,1,tabsList.lasts.msg_type,tabsList.lasts.msgLogId)" v-show="tabsList.lasts">
             <div class="imgs">
               <img :src='imgSrcs[tabsList.lasts.msg_type].url' v-if="tabsList.lasts.msg_type">
               <i class="dots" v-if="tabsList.lasts.isRead == 0"></i>
@@ -46,7 +46,7 @@
                 <div
                   class="tips tab-tips"
                   v-for="(ite, indx) in tabsList.lists"
-                  @click="linked(ite.id, ite.link, ite.isRead,2,ite.msg_type)"
+                  @click="linked(ite.id, ite.link, ite.isRead,2,ite.msg_type,ite.msgLogId)"
                   v-if="tabsList.lists"
                 >
                   <div class="imgs">

+ 2 - 2
src/web/templates/frontRouter/wx/messageCenter/sess/index.html

@@ -31,7 +31,7 @@
         <div class="j-main" v-show="msgList">
           <div class="head-mesg" v-show="!$.isEmptyObject(lastData)">
             <h5>重要提醒</h5>
-            <div class="h-conts" @click="msgClick(lastData.url,lastData.isRead,lastData.id,lastData.msg_type)">
+            <div class="h-conts" @click="msgClick(lastData.url,lastData.isRead,lastData.id,lastData.msg_type,lastData.msgLogId)">
               <div class="p1">
                 <span class="spa-tit">{lastData.title}</span>
                 <span class="spa flex" @click.stop="toggleClick" v-show="isRow">{isToggle?'收起':'展开'}&nbsp;<van-icon :class="isToggle?'is-icon1':'is-icon2'" name="arrow-down" /></span>
@@ -40,7 +40,7 @@
             </div>
           </div>
           <div class="t-list">
-            <div class="tips" v-for="(ite, index) in msgList" :key="index" @click="msgDetailed(ite.type,ite.count)" v-show="!$.isEmptyObject(ite.newMsg)">
+            <div class="tips" v-for="(ite, index) in msgList" :key="index" @click="msgDetailed(ite.type,ite.count,ite.msgLogId)" v-show="!$.isEmptyObject(ite.newMsg)">
               <div class="imgs">
                 <van-badge :class="{'no-active':ite.count <= 0}" :content="ite.count" max="99">
                   <img :src="'/common-module/messageCenter/image/'+imgSrcs[ite.type - 1].url+'@2x.png'">