zhangback
2025-11-27 3849263b31a16a91ff08acaa42786ecfde76f33c
ui/admin-ui3/src/layout/components/Navbar.vue
@@ -5,6 +5,36 @@
    <top-nav id="topmenu-container" class="topmenu-container" v-if="settingsStore.topNav" />
    <div class="right-menu">
      <el-dropdown>
        <el-badge :value="noCount" class="item" :hidden="noCount == 0" :offset="[-1, 15]">
          <el-image style="width: 30px;height: 30px;" :src="tongzhi"></el-image>
          <!--        <el-button>comments</el-button>-->
        </el-badge>
        <template #dropdown>
          <el-dropdown-menu>
            <el-dropdown-item disabled v-if="noCount == 0" >
              <div style="margin: 0 auto;width: 325px;">
                <el-empty :image-size="30" description="暂无通知" />
              </div>
            </el-dropdown-item>
            <el-dropdown-item v-for="(item,index) in noList"
      @click="itemClick(item)"
                              :key="index" :divided="index > 0">
              <div style="width: 200px;">
                <div style="line-height: 16px;font-size: 14px;margin-top: 10px;">{{ item.createTime }}</div>
                <div>
                  <div style="line-height: 24px;font-size: 16px;font-weight: 700;">{{ item.title }}</div>
                  <div
                      style="line-height: 16px;display: block;font-size: 10px;  width: 100%;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;">
                    {{ item.content }}</div>
                </div>
              </div>
            </el-dropdown-item>
            <el-dropdown-item v-if="noCount != 0">查看更多消息 》</el-dropdown-item>
          </el-dropdown-menu>
        </template>
      </el-dropdown>
      <template v-if="device !== 'mobile'">
        <screenfull id="screenfull" class="right-menu-item hover-effect" />
@@ -32,6 +62,19 @@
        </el-dropdown>
      </div>
    </div>
    <el-dialog :title="onDetail.title" v-model="open" class="avue-dialog avue-dialog--top" width="50%">
      <div style="font-size: 14px">
        {{onDetail.content}}
      </div>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary"   @click="goToDetail">
            查看详情
          </el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>
@@ -42,11 +85,13 @@
import Hamburger from '@/components/Hamburger/index.vue'
import Screenfull from '@/components/Screenfull/index.vue'
import {computed} from "vue";
import {computed,ref} from "vue";
import {useAppStore} from "@/store/modules/app";
import {useSettingsStore} from "@/store/modules/settings";
import {useUserStore} from "@/store/modules/user";
import tongzhi from "@/assets/tongzhi.png"
import {getNoCountApi, getReadApi} from "@/api/common";
import router from "@/router";
const userStore = useUserStore();
const appStore = useAppStore();
const settingsStore = useSettingsStore();
@@ -88,6 +133,39 @@
function setLayout() {
  emits('setLayout');
}
const noCount = ref(0);
const noList = ref([]);
const onDetail = ref<any>({});
const open = ref(false);
/**
 * 查询未读
 */
const getMessage = () => {
  getNoCountApi().then(res=>{
    let resData = res.data || {};
    noCount.value = resData.count ;
    noList.value  = resData.list;
  })
}
getMessage();
const itemClick = (item:any)=>{
  getReadApi(item.id).then(res=>{
    open.value = true;
    onDetail.value = res.data || {};
    getMessage();
  })
}
const goToDetail = () => {
  open.value =false;
  let extraData:any = {};
  if (onDetail.value.extraData){
    extraData = JSON.parse(onDetail.value.extraData)
  }
  router.push("/customer/tmsContract?contactStatus=" + extraData.contactStatus);
}
</script>
<style lang='scss' scoped>
@@ -178,4 +256,9 @@
    }
  }
}
.item {
  display: flex;
  align-items: center;
  //margin-right: 20px;
}
</style>