notice-center.html 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>消息中心-爽客邦</title>
  6. <meta name="keywords" content="消息中心-爽客邦">
  7. <meta name="description" content="消息中心-爽客邦">
  8. <meta content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,shrink-to-fit=no,user-scalable=no" name="viewport" viewport="cover">
  9. <meta name="apple-mobile-web-app-capable" content="yes">
  10. <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
  11. <meta content="telephone=no" name="format-detection">
  12. <meta content="email=no" name="format-detection">
  13. <meta name="apple-mobile-web-app-title" content="消息中心-爽客邦">
  14. <meta http-equiv="Cache-Control" content="no-siteapp">
  15. <link rel="stylesheet" href="./static/css/main.css">
  16. </head>
  17. <body class="bgcf7f7f7">
  18. <div id="app">
  19. <van-nav-bar class="mall_title bottom_line" title="消息中心" v-if="toptitleisshow"></van-nav-bar>
  20. <van-pull-refresh v-model="isLoading" @refresh="onRefresh">
  21. <van-cell-group class="notice-center">
  22. <van-cell class="cm" is-link @click="systemnotice">
  23. <template #title><img class="notice-center-img vm" src="./static/images/notice-btn1@2x.png" alt=""><span class="f14 c333 pl6">系统消息</span></template>
  24. <template #right-icon>
  25. <van-tag class="cm" type="warning" round v-if="unreadnoticenum.PlacardCount !== 0">{{unreadnoticenum.PlacardCount}}</van-tag>
  26. <van-icon name="arrow"></van-icon>
  27. </template>
  28. </van-cell>
  29. <van-cell class="cm" is-link @click="personalnotice">
  30. <template #title><img class="notice-center-img vm" src="./static/images/notice-btn2@2x.png" alt=""><span class="f14 c333 pl6">个人消息</span></template>
  31. <template #right-icon>
  32. <van-tag class="cm" type="warning" round v-if="unreadnoticenum.PersonalCount !== 0">{{unreadnoticenum.PersonalCount}}</van-tag>
  33. <van-icon name="arrow"></van-icon>
  34. </template>
  35. </van-cell>
  36. </van-cell-group>
  37. </van-pull-refresh>
  38. <van-tabbar v-model="active" active-color="#FF502A" v-cloak v-if="tabsisshow">
  39. <van-tabbar-item icon="home-o" @click="index">首页
  40. <template #icon="props"><img :src="props.active ? icon1.active : icon1.inactive"></template>
  41. </van-tabbar-item>
  42. <van-tabbar-item icon="friends-o" :dot="isnotice">消息
  43. <template #icon="props"><img :src="props.active ? icon3.active : icon3.inactive"></template>
  44. </van-tabbar-item>
  45. <van-tabbar-item icon="setting-o" @click="user">我的
  46. <template #icon="props"><img :src="props.active ? icon4.active : icon4.inactive"></template>
  47. </van-tabbar-item>
  48. </van-tabbar>
  49. </div>
  50. <script src="./static/js/klm-vv.min.js"></script>
  51. <script src="./static/js/klm-axios-config.js"></script>
  52. <script>
  53. function OnStart(){
  54. app.getnoticecount();
  55. };
  56. // 通过 CDN 引入时不会自动注册 Lazyload 组件
  57. // 可以通过下面的方式手动注册
  58. Vue.use(vant.Lazyload);
  59. // 在 #app 标签下渲染一个按钮组件
  60. let app = new Vue({
  61. el: '#app',
  62. data() {
  63. return {
  64. toptitleisshow:false,
  65. active: 1,
  66. unreadnoticenum:{
  67. PersonalCount:0,
  68. PlacardCount:0,
  69. },
  70. icon1: {
  71. active: './static/images/tab-icon1-active.png',
  72. inactive: './static/images/tab-icon1-no.png',
  73. },
  74. icon2: {
  75. active: './static/images/tab-icon2-active.png',
  76. inactive: './static/images/tab-icon2-no.png',
  77. },
  78. icon3: {
  79. active: './static/images/tab-icon3-active.png',
  80. inactive: './static/images/tab-icon3-no.png',
  81. },
  82. icon4: {
  83. active: './static/images/tab-icon4-active.png',
  84. inactive: './static/images/tab-icon4-no.png',
  85. },
  86. tabsisshow:'',
  87. isLoading:false,
  88. };
  89. },
  90. created() {
  91. this.toptitleisshow = toptitleisshow;
  92. this.tabsisshow = bottomtabisshow;
  93. this.getnoticecount();
  94. },
  95. computed:{
  96. isnotice:function(){
  97. if(this.unreadnoticenum.PersonalCount !== 0 || this.unreadnoticenum.PlacardCount !== 0){
  98. PublicLib.putCookieInfo('noticeiscount', true);
  99. } else {
  100. PublicLib.putCookieInfo('noticeiscount', "");
  101. }
  102. return PublicLib.getCookieInfo('noticeiscount') !== "";
  103. }
  104. },
  105. methods: {
  106. async onRefresh(){
  107. await this.getnoticecount();
  108. this.isLoading = false;
  109. },
  110. //- 跳转商城
  111. mall(){
  112. PublicLib.Goto({Url:'mall'});
  113. },
  114. //- 跳转主页
  115. index(){
  116. PublicLib.Goto({Url:'index'});
  117. },
  118. //- 跳转我的
  119. user(){
  120. PublicLib.Goto({Url:'user-center'});
  121. },
  122. //- 跳转系统消息
  123. systemnotice(){
  124. PublicLib.putCookieInfo('noticeType', '系统消息');
  125. PublicLib.Goto({Url:'notice-list'});
  126. },
  127. //- 跳转个人消息
  128. personalnotice(){
  129. PublicLib.putCookieInfo('noticeType', '个人消息');
  130. PublicLib.Goto({Url:'notice-list'});
  131. },
  132. //- 活动页面
  133. goactive(){
  134. PublicLib.Goto({Url:'market-active'});
  135. },
  136. //- 获取消息数量
  137. async getnoticecount(){
  138. PublicLib.ShowLoading({Message:''});
  139. const UserId = PublicLib.getCookieInfo('userId');
  140. const res = await getRequest('/api/v1/msgplacard/notread',JSON.stringify({UserId}));
  141. if(res.status === '1'){
  142. PublicLib.HideLoading();
  143. this.unreadnoticenum = res.data;
  144. }
  145. }
  146. }
  147. });
  148. </script>
  149. </body>
  150. </html>