yuanyiming 2 rokov pred
rodič
commit
b8f3f4ad42
1 zmenil súbory, kde vykonal 87 pridanie a 49 odobranie
  1. 87 49
      src/views/messageNotification.vue

+ 87 - 49
src/views/messageNotification.vue

@@ -23,27 +23,27 @@
       :data="tableData"
       tooltip-effect="dark"
       stripe
-      style="height: 550px;"
+      style="height: 535px;"
       class="fontSize"
       :header-cell-style="{ background: '#f2f2f2',color:'#000' }"
       >
      
       <el-table-column
-        prop="projectName"
+        prop="title"
         label="通知内容"
         align="center"
         min-width="25%">
       </el-table-column>
 
       <el-table-column
-        prop="founder"
+        prop="tname"
         label="创建者"
         align="center"
         min-width="20%">
       </el-table-column>
 
       <el-table-column
-        prop="date"
+        prop="create_at"
         label="创建时间"
         align="center"
         min-width="25%">
@@ -58,8 +58,8 @@
         <template #default="scope">
             <div class="operations">
                 <!-- <el-button type="primary" > -->
-                    <el-button type="primary"  size="mini" @click="lookIntro(scope)">查看信息</el-button>
-                    <el-button type="primary" size="mini"  @click="del" >删除</el-button>
+                    <el-button type="primary"  size="mini" @click="lookIntro(scope.row.newId)">查看信息</el-button>
+                    <el-button type="primary" size="mini"  @click="del(scope.row.newId)" >删除</el-button>
                 <!-- </el-button> -->
             </div>
         </template>
@@ -74,6 +74,7 @@
             :page-size="table.packageSize"
             layout=" prev, pager, next"
             background
+
             class="pagination"
             :total="table.total">
           </el-pagination>
@@ -103,8 +104,8 @@
         </div>
       </div>
       <span slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="confirmAdd" class="btn5">确认添加</el-button>
-        <el-button @click="init" class="btn5">取 消</el-button>
+        <el-button type="primary" @click="confirmAdd" >确认添加</el-button>
+        <el-button @click="init" >取 消</el-button>
       </span>
     </el-dialog>
 <!-- 添加全站通知结束-->
@@ -119,8 +120,8 @@
       <div class="addDialogLogo">LOGO</div>
       <span class="deleteContent">确定删除通知?</span>
       <span slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="dialogVisible1=false" class="btn5">确认删除</el-button>
-        <el-button @click="dialogVisible1=false" class="btn5" >取消</el-button>
+        <el-button type="primary" @click="confirmDel" >确认删除</el-button>
+        <el-button @click="dialogVisible1=false"  >取消</el-button>
       </span>
     </el-dialog>
 <!-- 删除通知结束-->
@@ -134,17 +135,12 @@
       <div class="addDialogLogo">LOGO</div>
       <div class="addDialogMid">
         <div class="addDialogTit1">
-          <div style="font-size:18px;color:#000">关于"一校一案"创客有关通知</div>
-          <div style="margin-top: 13px;font-size: 16px;">蝎子莱莱</div>
+          <div style="font-size:18px;color:#000">{{ messageCon.title }}</div>
+          <div style="margin-top: 13px;font-size: 14px;">{{ messageCon.tname }}</div>
         </div>
         <hr>
         <div class="addDialogTit2">
-            <p>
-              活过,总要留下些什么
-              每一个活过的人,都能给后人的路途上添些光亮,也许是一颗巨
-              星,也许是一把火炬,也许只是一支含泪的蜡烛
-              -《奶奶的星星》
-            </p>
+              {{ messageCon.brief }}
         </div>
       </div>
       <span slot="footer" class="dialog-footer">
@@ -167,27 +163,16 @@
           dialogVisible1:false,
           dialogVisible2:false,
           input:'',
-         
-          tableData:[{
-          projectName:'创业孵化基地企业情况信息表',
-          date:'2022-11-12 10:18',
-          size:'50k',
-          founder:'黄猿',
-        },
-        {
-          projectName:'创业孵化基地企业情况信息表',
-          size:'50k',
-          date:'2022-11-12 10:18',
-          founder:'黄猿'
-
-        }
-        ],
+          infromId:'',
+          //列表数据
+          tableData:[],
         // 分页数据
         table:{
-          total:10,
-          packageSize:10,
+          total:0,
+          packageSize:9,
           currentPage:1
         },
+        messageCon:{},
         // 添加数据
           addMess:{
             tit:'',
@@ -197,9 +182,26 @@
         
       },
       methods:{
-        del(){
+        del(val){
+          this.infromId=val
+          console.log(val);
           this.dialogVisible1=true;
-          
+        },
+        confirmDel(){
+          let param={
+            uid:this.$store.state.userInfo.userid,
+            nid:this.infromId
+          }
+          this.ajax
+              .post(this.$store.state.api+"/DeleteNotification",param)
+              .then(res=>{
+                  console.log(res);
+                  this.getCourseManagement()
+                  this.dialogVisible1=false;
+                  
+              },err=>{
+                console.log(err);
+              })
         },
         init(){
           //重置
@@ -220,6 +222,11 @@
           this.dialogVisible=true;
         },
         confirmAdd(){   //新建全站通知发送数据
+            if(this.addMess.tit =='' || this.addMess.con ==''){
+              this.$message.error('请输入内容')
+              return
+            }
+
             let param ={
               uid:this.$store.state.userInfo.userid,
               title:this.addMess.tit,
@@ -230,36 +237,55 @@
                 .post(this.$store.state.api+"/CreateNewNotification",param)
                 .then(res=>{
                     console.log(res);
-                    this.init()
+                    this.dialogVisible=false;
+                    this.addMess.tit='';
+                    this.addMess.con='';
+                    this.getCourseManagement();
                 },err=>{
                   console.log(err);
                 })
 
         },
-        lookIntro(){
+        lookIntro(val){
+          console.log(val);
+          let param={
+            uid:this.$store.state.userInfo.userid,
+            nid:val
+          }
+          this.ajax
+          .get(this.$store.state.api+'/SelectNotificationDetail',param)
+          .then(res=>{
+              this.messageCon=res.data.data
+              console.log(res);
+          },err=>{
+            console.log(err);
+          })
+
           this.dialogVisible2=true;
         },
         getCourseManagement(){    //分页获取数据请求
-            if(this.value==1){
-              this.value=''
-            }
+            // if(this.value==1){
+            //   this.value=''
+            // }
             let currentPage=this.table.currentPage;
-            let packageSize=this.table.packageSize;
             const param={
               uid:this.$store.state.userInfo.userid,
               title:this.selectInput,
-              noePage:currentPage,
-              lim:10
+              nowPage:currentPage,
+              lim:9
             }
             this.ajax
               .get(this.$store.state.api+'/SelectNotification',param)
               .then(res=>{  
                 // 不是在第一页进行分页请求,请求数据为空,再发送一次请求获取数据,判断是否为第一页,防止无限循环
                 console.log(res)
-                // if(this.table.currentPage!==1 && res.data[1].length==0){
-                //   this.table.currentPage=1
-                //   this.getCourseManagement();
-                // }
+                if(this.table.currentPage!==1 && res.data.data[0].length==0){
+                  this.table.currentPage=1
+                  this.getCourseManagement();
+                }
+                this.tableData=res.data.data[0];
+                this.table.total=res.data.data[1][0].total;
+                // console.log(this.table)
                 // console.log(res.data);
                 // this.items=res.data[1]
                 // this.table.total=res.data[0][0].total
@@ -274,6 +300,15 @@
           this.getCourseManagement()
         },
       },
+      watch:{
+        selectInput:{
+          handler(){
+            immediate:true
+            deep:true
+            this.getCourseManagement()
+          },
+        },
+    },
       mounted(){
         this.getCourseManagement()
       }
@@ -351,6 +386,8 @@
       font-size: 16px;
       color: #000;
       text-indent: 2em;
+      text-align: left;
+      line-height: 1.7em;
     }
     .addDialogCon{
       margin-top: 20px;
@@ -361,6 +398,7 @@
     justify-content: center;
     box-sizing: border-box;
     .btn5{
+      width: 300px;
       font-size: 16px;
     }
   }