Browse Source

Merge branch 'release' into dev4.6.1.4

luwenna 3 years ago
parent
commit
8acb893f80

+ 6 - 3
src/jfw/modules/app/src/web/staticres/jyapp/js/common.js

@@ -1042,12 +1042,16 @@ function autoLogin (url, callBack) {
 function checkMsgCount(acync, str, callback) {
   $.ajax({
     type: 'GET',
-    url: '/jymessageCenter/isMsgOpen?t=' + Date.now(),
+    url: '/jymessageCenter/getCount?t=' + Date.now(),
     async: acync || false,
     success: function (r) {
       var num = r.data.count
+      console.info(num)
       try {
-        JyObj.sendMsgCount(num)
+        window.onlyUserID =JyObj.getUserToken()
+        if (window.onlyUserID) {
+          JyObj.sendMsgCount(num)
+        }
       } catch (e) {
         console.log(e)
       }
@@ -1605,7 +1609,6 @@ function afterReceivePushMessage (type, url) {
 	}else if (type == "entnichepush" || type == "member" || type == "projectforecast" || type == "entchange" || type == "memberreport") {
       	JyObj.hideRedSpotOnMenu("my");
     }
-    checkMsgCount(true, 1)
     receivePushMessageHandle(type, url);
   } catch (e) { }
 }

+ 1 - 0
src/jfw/modules/app/src/web/templates/me/login.html

@@ -139,6 +139,7 @@
 		<!--微信登录end-->
 	</div>
 	<script type="text/javascript">
+		JyObj.sendMsgCount(0)
 		var wait = 60;
 		var dcsOne = false;
 		var bodyWidth = document.body.clientWidth;

+ 1 - 0
src/jfw/modules/app/src/web/templates/me/setting.html

@@ -158,6 +158,7 @@
                 $('.logout').on('click', function (e) {
                     setLiActive(e.currentTarget)
                     appQuit(false)
+                    JyObj.sendMsgCount(0)
                 })
             },
             // 更新开关状态

+ 9 - 5
src/jfw/modules/app/src/web/templates/weixin/search/mainSearch.html

@@ -731,11 +731,15 @@
     var isMember = false;
     var vSwitch = 'f'
     // 消息总数
-    try {
-        checkMsgCount(true, 0)
-    } catch (e) {
-        console.log(e)
-    }
+    // if (userId == '' || userId == null) {
+        // JyObj.sendMsgCount(0)
+    // } else {
+        try {
+            checkMsgCount(true, 0)
+        } catch (e) {
+            console.log(e)
+        }
+    // }
     // 子账户判断
     window.jyAddInfo = {
         isUpgrade: false

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

@@ -21,15 +21,17 @@ var vm = new Vue({
     }
   },
   created() {
-    let wxType = getType()
-    if (!wxType) {
-      checkMsgCount(true, 0)
-    }
     let indx = getQueryString('type')
     let nums = getQueryString('num')
     if (nums != 0) {
       this.setRead(indx)
     }
+    setTimeout(() => {
+      let wxType = getType()
+      if (!wxType) {
+        checkMsgCount(true, 0)
+      }
+    }, 300)
     this.tit = this.imgSrcs[indx - 1].title
     document.title = this.imgSrcs[indx - 1].title
   },

+ 1 - 0
src/web/staticres/common-module/messageCenter/js/index.js

@@ -17,6 +17,7 @@ var vm = new Vue({
     }
   },
   created() {
+    Object.assign(this.$data, this.$options.data())
     this.lastMsg()
     this.msgData()
     let wxType = getType()

+ 5 - 14
src/web/staticres/frontRouter/pc/mesgCenter/js/index-pc.js

@@ -72,7 +72,7 @@ var vm = new Vue({
       this.tabsList.lists = []
       this.tabsData(this.isTabs)
     },
-    readed(ids, type) {
+    readed(ids, type, url) {
       const _this = this
       $.ajax({
         type:'GET',
@@ -85,23 +85,14 @@ var vm = new Vue({
           _this.tabsData(_this.isTabs)
           _this.tabsCount()
           message.checkOpened()
+          if (url) {
+            location.href = url
+          }
         }
       })
     },
     linked(id, url, str, num, type) {
-      if (url) {
-        location.href = url
-      }
-      if (num == 1) {
-        if (url) {
-          this.readed(id, type)
-        }
-      }
-      if (num == 2) {
-        if (!str) {
-          this.readed(id, type)
-        }
-      }
+      this.readed(id, type, url)
     }
   }
 })

+ 16 - 1
src/web/staticres/js/message.js

@@ -46,7 +46,7 @@ function Message() {
                 needFilter: 1,
                 msgType: '0',
                 isRead: '-1',
-                offset: 0,
+                offset: 1,
                 pageSize: 5
             },
             success: function (r) {
@@ -77,7 +77,22 @@ function Message() {
 
                     _this.isOpened = r.data.open
                     _this.openedChange()
+                } else {
+                    $("#public-nav .iner .jynav li").bind("mouseleave",function(){
+                        $("#public-nav .iner .jynav li").find('.msg-style').hide()
+                    })
+                    $('#public-nav .iner').find('.useronline').bind("mouseleave", function () {
+                        $('#public-nav .iner .jynav li').find('.msg-style').hide()
+                    })
                 }
+            },
+            error:function () {
+                $("#public-nav .iner .jynav li").bind("mouseleave",function(){
+                    $("#public-nav .iner .jynav li").find('.msg-style').hide()
+                })
+                $('#public-nav .iner').find('.useronline').bind("mouseleave", function () {
+                    $('#public-nav .iner .jynav li').find('.msg-style').hide()
+                })
             }
         })
     }

+ 81 - 80
src/web/templates/weixin/tabbar.html

@@ -40,94 +40,95 @@
     return {
 			tabActive: 0,
 			counts: 0,
-            tabList: [
-              {
-                label: '首页',
-                icon: 'home',
-                url: '/jylab/mainSearch',
-                index: 0
-              },
-              {
-                label: '订阅',
-                icon: 'book',
-                url: '/swordfish/newhistorypush',
-                index: 1
-              },
-              {
-                label: '消息',
-                icon: 'mesg',
-                url: '/weixin/frontPage/messageCenter/sess/index',
-                index: 2
-              },
-              {
-                label: '百宝箱',
-                icon: 'box',
-                url: '/page_treasurebox/index.html',
-                index: 3
-              },
-              {
-                label: '我的',
-                icon: 'mine',
-                url: '/front/wxMyOrder/myMenu',
-                index: 4
-              },
-            ]
+      tabList: [
+        {
+          label: '首页',
+          icon: 'home',
+          url: '/jylab/mainSearch',
+          index: 0
+        },
+        {
+          label: '订阅',
+          icon: 'book',
+          url: '/swordfish/newhistorypush',
+          index: 1
+        },
+        {
+          label: '消息',
+          icon: 'mesg',
+          url: '/weixin/frontPage/messageCenter/sess/index',
+          index: 2
+        },
+        {
+          label: '百宝箱',
+          icon: 'box',
+          url: '/page_treasurebox/index.html',
+          index: 3
+        },
+        {
+          label: '我的',
+          icon: 'mine',
+          url: '/front/wxMyOrder/myMenu',
+          index: 4
+        },
+      ]
 		}
 	},
-	created() {
+
+	mounted() {
+    Object.assign(this.$data, this.$options.data())
+    var uMsg = Number(getQueryString('msg') || this.getURLIndex())
+    this.tabActive = uMsg
 		this.tabsCount()
-        var uMsg = Number(getQueryString('msg') || this.getURLIndex())
-        this.tabActive = uMsg
 	},
-    computed: {
-      getMsgCount: function () {
-        return this.counts ? (this.counts > 99 ? '99+' : this.counts) : ''
+  computed: {
+    getMsgCount: function () {
+      return this.counts ? (this.counts > 99 ? '99+' : this.counts) : ''
+    }
+  },
+	methods: {
+    getURLIndex: function () {
+      try {
+        var tempUrl = this.findMapsForUrl(this.tabList, location.pathname)
+        if (tempUrl.length) {
+          return tempUrl[0].index
+        } else {
+          return ''
+        }
+      } catch (e) {
+        return ''
       }
     },
-	methods: {
-        getURLIndex: function () {
-          try {
-            var tempUrl = this.findMapsForUrl(this.tabList, location.pathname)
-            if (tempUrl.length) {
-              return tempUrl[0].index
-            } else {
-              return ''
-            }
-          } catch (e) {
-            return ''
-          }
-        },
-        findMapsForUrl: function (arr, url) {
-          var tempReuslt = []
-          arr.forEach(function (v) {
-            if (url.indexOf(v.url) !== -1) {
-              tempReuslt.push(v)
-            }
-          })
-          return tempReuslt.sort(function(a,b) {
-            return b.url.length - a.url.length
-          })
-        },
+    findMapsForUrl: function (arr, url) {
+      var tempReuslt = []
+      arr.forEach(function (v) {
+        if (url.indexOf(v.url) !== -1) {
+          tempReuslt.push(v)
+        }
+      })
+      return tempReuslt.sort(function(a,b) {
+        return b.url.length - a.url.length
+      })
+    },
 		tabsCount() {
-          const _this = this
-          $.ajax({
-            type:'GET',
-            url:'/jymessageCenter/isMsgOpen',
-            data: {},
-            success:function (res) {
-              if (res && res.status == 1 && res.data && res.data.count) {
-                _this.counts = res.data.count
-              }
-            }
-          })
-        },
-		routeHref(index) {
-          var goHref = this.tabList[index].url + '?msg=' + index
-          if (index === this.tabActive) {
-            location.replace(goHref)
-          } else {
-            location.href = goHref
+      const _this = this
+      $.ajax({
+        type:'GET',
+        url:'/jymessageCenter/getCount?t=' + Date.now(),
+        success:function (res) {
+          if (res && res.status == 1 && res.data && res.data.count) {
+            _this.counts = res.data.count
           }
+        }
+      })
+    },
+		routeHref(index) {
+      var goHref = this.tabList[index].url + '?msg=' + index
+      if (index === this.tabActive) {
+        location.replace(goHref)
+      } else {
+        location.href = goHref
+      }
 		}
 	}
 })