123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>消息中心-创业帮</title>
- <meta name="keywords" content="消息中心-创业帮">
- <meta name="description" content="消息中心-创业帮">
- <meta content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,shrink-to-fit=no,user-scalable=no" name="viewport" viewport="cover">
- <meta name="apple-mobile-web-app-capable" content="yes">
- <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
- <meta content="telephone=no" name="format-detection">
- <meta content="email=no" name="format-detection">
- <meta name="apple-mobile-web-app-title" content="消息中心-创业帮">
- <meta http-equiv="Cache-Control" content="no-siteapp">
- <link rel="stylesheet" href="./static/css/main.css">
- </head>
- <body class="bgcf7f7f7 pt0" style="padding-top:0;">
- <div id="app">
- <van-nav-bar class="mall_title bottom_line" title="消息中心" v-if="tabsisshow"></van-nav-bar>
- <van-pull-refresh v-model="isLoading" @refresh="onRefresh">
- <div style="height:80vh;">
- <van-cell-group class="notice-center">
- <van-cell class="cm" is-link @click="systemnotice">
- <template #title><img class="notice-center-img vm" src="./static/images/notice-btn1@2x.png" alt=""><span class="f14 c333 pl6">系统消息</span></template>
- <template #right-icon>
- <van-tag class="cm" type="warning" round v-if="unreadnoticenum.PlacardCount > 0">{{unreadnoticenum.PlacardCount}}</van-tag>
- <van-icon name="arrow"></van-icon>
- </template>
- </van-cell>
- <van-cell class="cm" is-link @click="personalnotice">
- <template #title><img class="notice-center-img vm" src="./static/images/notice-btn2@2x.png" alt=""><span class="f14 c333 pl6">个人消息</span></template>
- <template #right-icon>
- <van-tag class="cm" type="warning" round v-if="unreadnoticenum.PersonalCount > 0">{{unreadnoticenum.PersonalCount}}</van-tag>
- <van-icon name="arrow"></van-icon>
- </template>
- </van-cell>
- </van-cell-group>
- </div>
- </van-pull-refresh>
- <van-tabbar v-model="active" active-color="#333" inactive-color="#999" v-cloak v-if="tabsisshow">
- <van-tabbar-item icon="home-o" @click="index">首页
- <template #icon="props"><img :src="props.active ? icon1.active : icon1.inactive"></template>
- </van-tabbar-item>
- <van-tabbar-item icon="search" @click="mall">商城
- <template #icon="props"><img :src="props.active ? icon2.active : icon2.inactive"></template>
- </van-tabbar-item>
- <van-tabbar-item icon="friends-o" :dot="isnotice">消息
- <template #icon="props"><img :src="props.active ? icon3.active : icon3.inactive"></template>
- </van-tabbar-item>
- <van-tabbar-item icon="setting-o" @click="user">我的
- <template #icon="props"><img :src="props.active ? icon4.active : icon4.inactive"></template>
- </van-tabbar-item>
- </van-tabbar>
- </div>
- <script src="./static/js/klm-vv.min.js"></script>
- <script src="./static/js/appfunc.min.js"></script>
- <script src="./static/js/klm-axios-config.js"></script>
- <script src="./static/js/publicfn.js"></script>
- <script>
- function OnStart(){
- app.getnoticecount();
- };
- // 通过 CDN 引入时不会自动注册 Lazyload 组件
- // 可以通过下面的方式手动注册
- Vue.use(vant.Lazyload);
- //- PublicLib.SetStatusBarBgColor({bgcolor:'ffffff'});
- // 在 #app 标签下渲染一个按钮组件
- let app = new Vue({
- el: '#app',
- data() {
- return {
- active: 2,
- unreadnoticenum:{
- PersonalCount:0,
- PlacardCount:0,
- },
- icon1: {
- active: './static/images/tab-icon1-active1@3x.png',
- inactive: './static/images/tab-icon1-no@3x.png',
- },
- icon2: {
- active: './static/images/tab-icon2-active1@3x.png',
- inactive: './static/images/tab-icon2-no@3x.png',
- },
- icon3: {
- active: './static/images/tab-icon3-active1@3x.png',
- inactive: './static/images/tab-icon3-no@3x.png',
- },
- icon4: {
- active: './static/images/tab-icon4-active1@3x.png',
- inactive: './static/images/tab-icon4-no@3x.png',
- },
- tabsisshow:false,
- isLoading:false,
- };
- },
- created() {
- this.tabsisshow = bottomtabisshow;
- this.getnoticecount();
- },
- computed:{
- isnotice:function(){
- if(this.unreadnoticenum.PersonalCount !== 0 || this.unreadnoticenum.PlacardCount !== 0){
- PublicLib.putCookieInfo('noticeiscount', true);
- } else {
- PublicLib.putCookieInfo('noticeiscount', "");
- };
- return PublicLib.getCookieInfo('noticeiscount') !== "";
- }
- },
- methods: {
- SetBadgeValue(num){
- const type = browsertype.versions.ios ? 'ios' : 'android';
- if (type !== 'ios') {
- Func.SetBadgeValue('2',String(num));
- } else {
- window.webkit.messageHandlers.SetBadgeValue.postMessage({Index:2,BadgeNum:Number(num)});
- }
- },
- ClearBadgeValue(){
- const type = browsertype.versions.ios ? 'ios' : 'android';
- if (type !== 'ios') {
- Func.ClearBadgeValue('2');
- } else{
- window.webkit.messageHandlers.ClearBadgeValue.postMessage({Index:2});
- }
- },
- async onRefresh(){
- await this.getnoticecount();
- this.isLoading = false;
- },
- //- 跳转商城
- mall(){
- PublicLib.Goto({Url:'mall'});
- },
- //- 跳转主页
- index(){
- PublicLib.Goto({Url:'index'});
- },
- //- 跳转我的
- user(){
- PublicLib.Goto({Url:'user-center'});
- },
- //- 跳转系统消息
- systemnotice(){
- PublicLib.putCookieInfo('noticeType', '系统消息');
- PublicLib.Goto({Url:'notice-list'});
- },
- //- 跳转个人消息
- personalnotice(){
- PublicLib.putCookieInfo('noticeType', '个人消息');
- PublicLib.Goto({Url:'notice-list'});
- },
- //- 活动页面
- goactive(){
- PublicLib.Goto({Url:'market-active'});
- },
- //- 获取消息数量
- async getnoticecount(){
- //- PublicLib.ShowLoading({Message:''});
- const UserId = PublicLib.getCookieInfo('userId');
- const res = await getRequest('api/v1/msgplacard/notread?t='+Math.random(6),JSON.stringify({UserId}));
- if(res.status === '1'){
- //- PublicLib.HideLoading();
- this.unreadnoticenum = res.data;
- if(PublicLib.getCookieInfo('userId') === '14'){
- const count = res.data.PersonalCount + res.data.PlacardCount;
- if(count > 0){
- this.SetBadgeValue(count);
- }else{
- this.ClearBadgeValue();
- };
- };
- };
- }
-
- }
- });
- </script>
- </body>
- </html>
|