LiuJ 1 月之前
父節點
當前提交
c0d17450e4
共有 4 個文件被更改,包括 300 次插入8 次删除
  1. 二進制
      src/assets/public/nav/notice1.png
  2. 31 7
      src/layout/components/Navbar.vue
  3. 18 1
      src/router/index.js
  4. 251 0
      src/views/news/ncomplaintList.vue

二進制
src/assets/public/nav/notice1.png


+ 31 - 7
src/layout/components/Navbar.vue

@@ -19,11 +19,14 @@
       <el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
         <div class="avatar-wrapper">
 
-          <!-- <img src="@/assets/public/nav/notice.png" class="user-notice"></img> -->
-          <span
-            style="display: inline-block; width: 40px; height: 40px; border-radius: 50%; background-color: red; color: white; text-align: center; line-height: 40px; font-size: 12px;">{{
-              msg.count }}</span>
-          <img src="@/assets/public/nav/arrowDown.png" class="arrowDown">
+          <div class="avatar-wrapper">
+            <img src="@/assets/public/nav/notice1.png" class="user-notice" style="width: 40px; height: 40px;" />
+            <span class="unread-count">{{ msg.count }}</span>
+            <img src="@/assets/public/nav/arrowDown.png" class="arrowDown" />
+          </div>
+          <!-- <span
+            style="display: inline-block; width: 40px; height: 40px; border-radius: 50%; background-color: red; color: white; text-align: center; line-height: 40px; font-size: 12px;"></span> -->
+          <!-- <img src="@/assets/public/nav/arrowDown.png" class="arrowDown"> -->
           <!--向下按钮-->
           <!-- <i class="el-icon-caret-bottom" /> -->
         </div>
@@ -46,7 +49,7 @@
             </div>
           </router-link>
 
-          <router-link to="/hall" v-if=" msg.chat && msg.chat.length > 0">
+          <router-link to="/hall" v-if="msg.chat && msg.chat.length > 0">
             <div class="userMenuDownItem">
               <el-dropdown-item>
                 <span style="display:block;  color: #409EFF;">未读单聊</span>
@@ -67,7 +70,7 @@
 
 
 
-          <router-link to="/hall" v-if=" msg.chat_group  && msg.chat_group.length > 0">
+          <router-link to="/hall" v-if="msg.chat_group && msg.chat_group.length > 0">
             <div class="userMenuDownItem">
               <el-dropdown-item>
                 <span style="display:block; color: #409EFF;">未读群聊</span>
@@ -356,4 +359,25 @@ export default {
   background: none;
   color: #606266;
 }
+
+.unread-count {
+  position: relative;
+  display: inline-block;
+  width: 20px;
+  height: 20px;
+  border-radius: 50%;
+  background-color: red;
+  color: white;
+  font-size: 12px;
+  text-align: center;
+  line-height: 20px;
+  margin-left: -40px;
+  margin-top: -20px;
+  /* 调整位置,使其贴合通知图标 */
+}
+
+/* 如果未读数量为 0,则隐藏角标 */
+.unread-count:empty {
+  display: none;
+}
 </style>

+ 18 - 1
src/router/index.js

@@ -508,7 +508,24 @@ export const constantRoutes = [
         path: '',
         component: () => import('@/views/news/noticeList'),
         meta: {
-          title: '通知列表',
+          title: '行政通知列表',
+          hidden: true,
+          breadcrumb: true
+        }
+      }
+    ]
+
+  },
+  {
+    path: '/ncomplaintList',
+    component: Layout,
+    children: [
+      {
+        name: '',
+        path: '',
+        component: () => import('@/views/news/ncomplaintList'),
+        meta: {
+          title: '投诉举报',
           hidden: true,
           breadcrumb: true
         }

+ 251 - 0
src/views/news/ncomplaintList.vue

@@ -0,0 +1,251 @@
+<template>
+  <div class="mainBox">
+    <!--搜索功能 start------------------------------------------------------------>
+    <div class="layerBox_search">
+      <div class="layerBoxLine">
+        <el-row>
+
+          <el-col :span="8">
+            <div class="searchBox">
+              <div class="searchTitle">标题:</div>
+              <el-input placeholder="请输入标题" autocomplete="off" v-model="getApiData.title" />
+            </div>
+          </el-col>
+          <el-col :span="8">
+            <div class="searchBox">
+              <div class="searchTitle">公告级别:</div>
+              <el-select v-model="getApiData.level" placeholder="请选择..">
+                <el-option label="常规" value="1"></el-option>
+                <el-option label="紧急" value="2"></el-option>
+                <el-option label="特急" value="3"></el-option>
+              </el-select>
+            </div>
+          </el-col>
+        </el-row>
+      </div>
+
+    </div>
+
+    <div class="layerBoxNoBg">
+      <div>
+        <el-button type="primary" @click="goCreat">发布通知</el-button>
+      </div>
+      <div>
+        <el-button @click="clearSearchList">重置</el-button>
+        <el-button type="primary" @click="getData('search')">搜索</el-button>
+      </div>
+    </div>
+    <!--搜索功能 end------------------------------------------------------------>
+
+    <!--表格内容 start------------------------------------------------------------>
+    <div class="layerBox">
+      <tableTitle :name="tableDivTitle" />
+      <el-row>
+        <template>
+          <el-table :data="tableData" style="width: 100%">
+            <el-table-column fixed prop="id" label="编号" width="50"></el-table-column>
+            <el-table-column prop="title" label="标题" width="">
+
+            </el-table-column>
+            <el-table-column prop="type" label="类型" width="">
+
+
+              <template slot-scope="scope">
+                <span v-if="scope.row.type == 1">
+                  公告
+                </span>
+                <span v-if="scope.row.type == 2">
+                  通知
+                </span>
+              </template>
+            </el-table-column>
+            <el-table-column prop="level" label="级别" width="">
+              <template slot-scope="scope">
+                <span v-if="scope.row.level == 1">
+                  常规
+                </span>
+                <span v-if="scope.row.level == 2">
+                  紧急
+                </span>
+                <span v-if="scope.row.level == 3">
+                  特急
+                </span>
+              </template>
+            </el-table-column>
+            <el-table-column prop="start" label="开始时间" width="">
+
+            </el-table-column>
+            <el-table-column prop="end" label="到期时间" width=""></el-table-column>
+            <el-table-column prop="created_at" label="创建时间" width=""></el-table-column>
+
+            <el-table-column fixed="right" label="操作" width="200" header-align="center">
+              <template slot-scope="scope">
+                <div class="listBtnBox">
+                  <div class="listDeleteBtn" @click="deleteRow(scope.row.id, tableData)"><i
+                      class="el-icon-delete"></i>删除</div>
+                  <div class="listEditBtn" @click="goEdit(scope.row.id, tableData)"><i
+                      class="el-icon-edit-outline"></i>编辑</div>
+                </div>
+              </template>
+            </el-table-column>
+          </el-table>
+        </template>
+      </el-row>
+    </div>
+    <!--分页 start------------------------------------------------------------>
+    <div class="alignBox">
+      <el-row>
+        <el-col :span="24">
+          <el-pagination @size-change="handleSizeChange" :current-page="getApiData.page"
+            @current-change="handleCurrentChange" :page-size="10" layout="total, prev, pager, next, jumper"
+            :total="allCount"></el-pagination>
+        </el-col>
+      </el-row>
+    </div>
+    <!--分页 end------------------------------------------------------------>
+    <!--表格内容 end------------------------------------------------------------>
+  </div>
+</template>
+
+<script>
+//表格标题
+import tableTitle from './components/tableTitle';
+//引入公用样式
+import '@/styles/global.less';
+
+export default {
+  components: {
+    tableTitle,//表格标题
+  },
+  data() {
+    return {
+      //1.列表和分页相关 start ------------------------------------------------------------>
+      tableDivTitle: "通知列表",
+      tableData: [],//内容
+      editId: 0,//要修改的网站id
+      getApiData: {
+        name: "",//标题
+        category_name: "",//导航池id
+        website_name: "",//网站名称
+        type_id: "",//发布类型
+
+        page: 1,//当前是第几页
+        page_size: 10,//一共多少条
+      },
+      allCount: 0,//总条数
+      //分页相关 end ------------------------------------------------------------>
+
+    }
+  },
+  methods: {
+    //1.列表和分页相关 start ------------------------------------------------------------>
+    //1.1 开始请求列表信息方法
+    getData(type) {
+      if (type == "search") {
+        this.getApiData.page = 1;
+      }
+      console.log(this.getApiData, '---1--')
+      this.$store.dispatch('news/getNoticeList', this.getApiData).then(res => {
+        console.log(this.getApiData, '---2-')
+        let data = [];
+        for (let item of res.data.rows) {
+          data.push(item)
+        }
+        this.tableData = res.data.rows; //给与内容
+        this.allCount = res.data.count; //给与总条数
+      })
+    },
+    //1.2 删除内容
+    deleteRow(id) {
+      this.$confirm('此操作将永久删除该条数据, 是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        console.log("当前删除:" + id)
+        this.$store.dispatch('news/deleteNotice', { id: id }).then(res => {
+          this.getData();
+          this.$message({
+            type: 'success',
+            message: '删除成功!'
+          });
+        }).catch(() => {
+          this.$message({
+            type: 'warning',
+            message: '网络错误,请重试!'
+          });
+        })
+      }).catch(() => {
+        this.$message({
+          type: 'warning',
+          message: '已取消删除'
+        });
+      });
+    },
+    //1.3 修改网站状态
+    upRow(id, status) {
+      let data = {
+        id: id,
+        status: status
+      }
+      this.$store.dispatch('news/upArticleStatus', data).then(res => {
+        if (res.code == 200) {
+          this.$message({
+            type: 'success',
+            message: '通知状态已修改!'
+          });
+        }
+      }).catch(() => {
+        this.$message({
+          type: 'warning',
+          message: '已取消删除'
+        });
+      });
+    },
+    //1.4 列表内容分页
+    //直接跳转
+    handleSizeChange(val) {
+      this.getApiData.page = val;
+      this.getData();
+    },
+    //1.5 点击分页
+    handleCurrentChange(val) {
+      this.getApiData.page = val;
+      this.getData();
+    },
+    //1.6 重置按钮
+    clearSearchList() {
+      this.tableData = [];
+      this.getApiData.title = "";
+      this.getApiData.level = "";
+
+      this.getApiData.page = 1;
+      this.getApiData.pageSize = 10;
+      this.getData();
+    },
+    //列表和分页相关 end ------------------------------------------------------------>
+    //2.添加新闻 start ------------------------------------------------------------>
+    //跳转到通知发布页面
+    goCreat() {
+      this.$router.push({
+        path: '/addNotice',
+      });
+    },
+    goEdit(id) {
+      let data = {
+        id: id
+      }
+      this.$router.push({
+        path: '/addNotice',
+        query: data
+      });
+    }
+    //添加新闻 end ------------------------------------------------------------>
+  },
+  mounted() {
+    //1.获得初始数据
+    this.getData();
+  }
+}
+</script>
+<style scoped lang="less"></style>