lsc 3 vuotta sitten
vanhempi
commit
b857e47ceb

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
dist/static/css/app.654e9d5a861aba20b78fb2c6a934d227.css


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
dist/static/css/app.654e9d5a861aba20b78fb2c6a934d227.css.map


BIN
dist/static/img/logo.e71f93d.png


BIN
dist/static/img/user.7f16b85.png


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
dist/static/js/0.3b37f01931486d1cbfb4.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
dist/static/js/0.3b37f01931486d1cbfb4.js.map


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
dist/static/js/1.f9c1b8270f13d6ab2959.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
dist/static/js/1.f9c1b8270f13d6ab2959.js.map


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
dist/static/js/app.62619426341971b56731.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
dist/static/js/app.62619426341971b56731.js.map


+ 2 - 0
dist/static/js/manifest.b69adc3c3354a986f1ce.js

@@ -0,0 +1,2 @@
+!function(e){var n=window.webpackJsonp;window.webpackJsonp=function(r,c,a){for(var i,u,f,s=0,l=[];s<r.length;s++)u=r[s],t[u]&&l.push(t[u][0]),t[u]=0;for(i in c)Object.prototype.hasOwnProperty.call(c,i)&&(e[i]=c[i]);for(n&&n(r,c,a);l.length;)l.shift()();if(a)for(s=0;s<a.length;s++)f=o(o.s=a[s]);return f};var r={},t={4:0};function o(n){if(r[n])return r[n].exports;var t=r[n]={i:n,l:!1,exports:{}};return e[n].call(t.exports,t,t.exports,o),t.l=!0,t.exports}o.e=function(e){var n=t[e];if(0===n)return new Promise(function(e){e()});if(n)return n[2];var r=new Promise(function(r,o){n=t[e]=[r,o]});n[2]=r;var c=document.getElementsByTagName("head")[0],a=document.createElement("script");a.type="text/javascript",a.charset="utf-8",a.async=!0,a.timeout=12e4,o.nc&&a.setAttribute("nonce",o.nc),a.src=o.p+"static/js/"+e+"."+{0:"3b37f01931486d1cbfb4",1:"f9c1b8270f13d6ab2959"}[e]+".js";var i=setTimeout(u,12e4);function u(){a.onerror=a.onload=null,clearTimeout(i);var n=t[e];0!==n&&(n&&n[1](new Error("Loading chunk "+e+" failed.")),t[e]=void 0)}return a.onerror=a.onload=u,c.appendChild(a),r},o.m=e,o.c=r,o.d=function(e,n,r){o.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},o.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(n,"a",n),n},o.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},o.p="./",o.oe=function(e){throw console.error(e),e}}([]);
+//# sourceMappingURL=manifest.b69adc3c3354a986f1ce.js.map

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
dist/static/js/manifest.b69adc3c3354a986f1ce.js.map


+ 6 - 6
src/App.vue

@@ -5,20 +5,20 @@
       <span style="margin-left: 10px; color: #fff; font-weight: 600"
       <span style="margin-left: 10px; color: #fff; font-weight: 600"
         >PBL教育平台-总后台管理</span
         >PBL教育平台-总后台管理</span
       >
       >
-      <div class="user_head">
+      <div class="user_head" v-if="!this.$store.state.isLogin">
         <div>
         <div>
           <el-button type="text" style="color: white" @click="Login()"
           <el-button type="text" style="color: white" @click="Login()"
             >登录</el-button
             >登录</el-button
           >
           >
         </div>
         </div>
       </div>
       </div>
-      <!-- <div class="user_head" v-if="this.$store.state.isLogin">
-        <div class="noticeBox">
+      <div class="user_head" v-else>
+        <!-- <div class="noticeBox">
           <i class="noticeI" @click="goTo('/userManage?cclass=1')"></i>
           <i class="noticeI" @click="goTo('/userManage?cclass=1')"></i>
           <span v-if="this.$store.state.nCount != 0">{{
           <span v-if="this.$store.state.nCount != 0">{{
             this.$store.state.nCount > 99 ? "99+" : this.$store.state.nCount
             this.$store.state.nCount > 99 ? "99+" : this.$store.state.nCount
           }}</span>
           }}</span>
-        </div>
+        </div> -->
         <span class="user_name">管理员</span>
         <span class="user_name">管理员</span>
         <div>
         <div>
           <i></i>
           <i></i>
@@ -26,7 +26,7 @@
             >退出</el-button
             >退出</el-button
           >
           >
         </div>
         </div>
-      </div> -->
+      </div>
     </div>
     </div>
     <div class="app">
     <div class="app">
       <!-- main 内容 -->
       <!-- main 内容 -->
@@ -126,7 +126,7 @@ export default {
       let router_path = this.$route.path;
       let router_path = this.$route.path;
       console.log(router_path);
       console.log(router_path);
       if (router_path != "/login") {
       if (router_path != "/login") {
-        // this.isLogin();
+        this.isLogin();
       }
       }
       var a = 0;
       var a = 0;
       for (var i = 0; i < navTabs.length; i++) {
       for (var i = 0; i < navTabs.length; i++) {

+ 29 - 29
src/components/login.vue

@@ -69,35 +69,35 @@ export default {
       }
       }
     },
     },
     findPhone() {
     findPhone() {
-      this.$router.push("/");
-      // if (this.phoneNum === "") {
-      //   this.$message.error("请输入账号");
-      //   return;
-      // } else if (this.password === "") {
-      //   this.$message.error("请输入密码");
-      //   return;
-      // }
-      // let params = { phone: this.phoneNum };
-      // this.ajax
-      //   .get(this.$store.state.api + "findPhone", params)
-      //   .then((res) => {
-      //     if (res.data[0].length > 0) {
-      //       if (res.data[0][0].type == 0) {
-      //         // this.sqlPassword = res.data[0][0].userpassword;
-      //       } else {
-      //         this.$message.error("您的账号不是管理员账号");
-      //         return;
-      //       }
-      //     } else {
-      //       this.$message.error("请使用管理员账号登录");
-      //       return;
-      //     }
-      //     this.login();
-      //     console.log(res.data[0][0]);
-      //   })
-      //   .catch((err) => {
-      //     console.error(err);
-      //   });
+      // this.$router.push("/");
+      if (this.phoneNum === "") {
+        this.$message.error("请输入账号");
+        return;
+      } else if (this.password === "") {
+        this.$message.error("请输入密码");
+        return;
+      }
+      let params = { un: this.phoneNum };
+      this.ajax
+        .get(this.$store.state.api + "findPhone", params)
+        .then((res) => {
+          if (res.data[0].length > 0) {
+            if (res.data[0][0].type == 0) {
+              // this.sqlPassword = res.data[0][0].userpassword;
+            } else {
+              this.$message.error("您的账号不是管理员账号");
+              return;
+            }
+          } else {
+            this.$message.error("请使用管理员账号登录");
+            return;
+          }
+          this.login();
+          console.log(res.data[0][0]);
+        })
+        .catch((err) => {
+          console.error(err);
+        });
     },
     },
     login() {
     login() {
       if (this.time()) {
       if (this.time()) {

+ 100 - 118
src/components/pages/class.vue

@@ -14,10 +14,12 @@
             >
             >
             </el-input>
             </el-input>
           </span>
           </span>
-          <el-button type="primary" @click="searchClass">查询</el-button>
+          <el-button type="primary" @click="searchClass" size="small"
+            >查询</el-button
+          >
         </div>
         </div>
         <div class="student_button">
         <div class="student_button">
-          <el-button type="primary" @click="dialogVisible = true"
+          <el-button type="primary" size="small" @click="dialogVisible = true"
             >添加班级</el-button
             >添加班级</el-button
           >
           >
         </div>
         </div>
@@ -48,8 +50,8 @@
             align="center"
             align="center"
           >
           >
           </el-table-column>
           </el-table-column>
-                    <el-table-column
-            prop="pCount"
+          <el-table-column
+            prop="pNum"
             label="人数"
             label="人数"
             min-width="25%"
             min-width="25%"
             align="center"
             align="center"
@@ -125,32 +127,7 @@ export default {
       className: "",
       className: "",
       formLabelWidth: "80px",
       formLabelWidth: "80px",
       dialogVisible: false,
       dialogVisible: false,
-      tableData: [
-        {
-          create_at: "2021-09-09T13:44:27.000Z",
-          createuserid: "0",
-          id: "77cccfe1-110f-11ec-80ad-005056b86db5",
-          name: "一年级七班",
-          num: 44,
-          oid: "1123",
-          order: 100,
-          pCount:"53",
-          parentid: "3",
-          school: "深圳市龙岗区麓城外国语小学",
-        },
-        {
-          create_at: "2021-09-09T13:44:27.000Z",
-          createuserid: "0",
-          id: "77cccfe1-110f-11ec-80ad-005056b86db4",
-          name: "初一一班",
-          num: 44,
-          oid: "1123",
-          order: 100,
-          pCount:"46",
-          parentid: "3",
-          school: "深圳市龙岗区麓城外国语小学",
-        },
-      ],
+      tableData: [],
       total: 0,
       total: 0,
       page: 1,
       page: 1,
       oid: "",
       oid: "",
@@ -179,8 +156,8 @@ export default {
   },
   },
   created() {
   created() {
     this.page = 1;
     this.page = 1;
-    // this.getClass();
-    // this.getOrg();
+    this.getClass();
+    this.getOrg();
   },
   },
   methods: {
   methods: {
     tableRowClassName({ row, rowIndex }) {
     tableRowClassName({ row, rowIndex }) {
@@ -206,7 +183,7 @@ export default {
     //查询学校
     //查询学校
     getOrg() {
     getOrg() {
       this.ajax
       this.ajax
-        .get(this.$store.state.api + "getAllOrg", "")
+        .get(this.$store.state.api + "selectOrg", "")
         .then((res) => {
         .then((res) => {
           this.schoolArray = res.data[0];
           this.schoolArray = res.data[0];
           console.log(res.data[0]);
           console.log(res.data[0]);
@@ -217,20 +194,19 @@ export default {
     },
     },
     //搜索班级
     //搜索班级
     searchClass() {
     searchClass() {
-      // this.page = 1;
+      this.page = 1;
       // this.isListAjax = true;
       // this.isListAjax = true;
-      // this.getClass();
+      this.getClass();
     },
     },
     //获取班级
     //获取班级
     getClass() {
     getClass() {
       this.isLoading = true;
       this.isLoading = true;
       let params = {
       let params = {
-        username: "",
         cn: this.sClassName,
         cn: this.sClassName,
         page: this.page,
         page: this.page,
       };
       };
       this.ajax
       this.ajax
-        .get(this.$store.state.api + "getClass", params)
+        .get(this.$store.state.api + "getClassAdmin", params)
         .then((res) => {
         .then((res) => {
           this.isListAjax = false;
           this.isListAjax = false;
           this.isLoading = false;
           this.isLoading = false;
@@ -259,89 +235,93 @@ export default {
     },
     },
     //添加班级
     //添加班级
     insertClass() {
     insertClass() {
-      // let _this = this
-      // console.log(this.$store.state.userInfo);
-      // if (this.oid === "") {
-      //   this.$message.error("请选择学校");
-      //   return;
-      // }
-      // if (this.className === "") {
-      //   this.$message.error("班级名字不能为空");
-      //   return;
-      // }
-      // let params = [{ oid: this.oid, n: this.className, cuid: "0" }];
-      // let params2 = { pid: this.oid, n: this.className };
-      // let a = 1
-      // $.ajax({
-      //     url: this.$store.state.api + "getClassRepeat", //url路径
-      //     type: "GET", //GET
-      //     async: false, //或false,是否异步
-      //     data: params2,
-      //     timeout: 5000, //超时时间
-      //     dataType: "json", //返回的数据格式:
-      //     beforeSend: function (xhr) {},
-      //     success: function (res, textStatus, jqXHR) {
-      //       if (res[0][0].num > 0) {
-      //         _this.$message.error(
-      //           "此学校已存在此班级!"
-      //         );
-      //         a = 2;
-      //       }
-      //     },
-      //     error: function (xhr, textStatus) {
-      //       console.log(textStatus);
-      //     },
-      //     complete: function () {},
-      //   });
-      // if (this.time() && a == 1) {
-      //   this.ajax
-      //     .post(this.$store.state.api + "insertClass", params)
-      //     .then((res) => {
-      //       this.$message({
-      //         message: "添加成功",
-      //         type: "success",
-      //       });
-      //       this.sClassName = "";
-      //       this.className = "";
-      //       this.page = 1;
-      //       this.getClass();
-      //       this.dialogVisible = false;
-      //     })
-      //     .catch((err) => {
-      //       this.$message.error("添加失败");
-      //       console.error(err);
-      //     });
-      // }
+      let _this = this;
+      console.log(this.$store.state.userInfo);
+      if (this.oid === "") {
+        this.$message.error("请选择学校");
+        return;
+      }
+      if (this.className === "") {
+        this.$message.error("班级名字不能为空");
+        return;
+      }
+      let params = [
+        {
+          n: this.className,
+          oid: this.oid,
+          cuid: this.$store.state.userInfo.uid,
+        },
+      ];
+      let params2 = { oid: this.oid, n: this.className };
+      let a = 1;
+      $.ajax({
+        url: this.$store.state.api + "getClassRepeat", //url路径
+        type: "GET", //GET
+        async: false, //或false,是否异步
+        data: params2,
+        timeout: 5000, //超时时间
+        dataType: "json", //返回的数据格式:
+        beforeSend: function (xhr) {},
+        success: function (res, textStatus, jqXHR) {
+          if (res[0][0].num > 0) {
+            _this.$message.error("此学校已存在此班级!");
+            a = 2;
+          }
+        },
+        error: function (xhr, textStatus) {
+          console.log(textStatus);
+        },
+        complete: function () {},
+      });
+      if (this.time() && a == 1) {
+        this.ajax
+          .post(this.$store.state.api + "addClassAdmin", params)
+          .then((res) => {
+            this.$message({
+              message: "添加成功",
+              type: "success",
+            });
+            this.sClassName = "";
+            this.className = "";
+            this.page = 1;
+            this.getClass();
+            this.dialogVisible = false;
+          })
+          .catch((err) => {
+            this.$message.error("添加失败");
+            console.error(err);
+          });
+      }
     },
     },
     //删除班级
     //删除班级
     deleteClass(row) {
     deleteClass(row) {
-      // let params = [{ id: row.id }];
-      // this.$confirm("确定删除此班级吗?", "提示", {
-      //   confirmButtonText: "确定",
-      //   cancelButtonText: "取消",
-      //   type: "warning",
-      // })
-      //   .then(() => {
-      //     this.ajax
-      //       .post(this.$store.state.api + "deleteClass", params)
-      //       .then((res) => {
-      //         this.$message({
-      //           message: "删除成功",
-      //           type: "success",
-      //         });
-      //         this.className = "";
-      //         if (this.page != 1 && this.tableData.length == 1) {
-      //           this.page--;
-      //         }
-      //         this.getClass();
-      //         this.dialogVisible = false;
-      //       })
-      //       .catch((err) => {
-      //         this.$message.error("删除失败");
-      //         console.error(err);
-      //       });
-      //   })
-      //   .catch(() => {});
+      let params = { id: row.id };
+      this.$confirm("确定删除此班级吗?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          this.ajax
+            .get(this.$store.state.api + "deleteClass", params)
+            .then((res) => {
+              this.$message({
+                message: "删除成功",
+                type: "success",
+              });
+              this.className = "";
+              if (this.page != 1 && this.tableData.length == 1) {
+                this.page--;
+              }
+              this.getClass();
+              this.dialogVisible = false;
+            })
+            .catch((err) => {
+              this.$message.error("删除失败");
+              console.error(err);
+            });
+        })
+        .catch(() => {});
     },
     },
   },
   },
 };
 };
@@ -383,10 +363,12 @@ export default {
 .student_head {
 .student_head {
   display: flex;
   display: flex;
   justify-content: space-between;
   justify-content: space-between;
+  align-items: center;
 }
 }
 .student_search {
 .student_search {
   display: flex;
   display: flex;
   width: 300px;
   width: 300px;
+  align-items: center;
 }
 }
 .student_search span {
 .student_search span {
   margin: 0 10px 0 0;
   margin: 0 10px 0 0;
@@ -394,7 +376,7 @@ export default {
 .student_button {
 .student_button {
   display: flex;
   display: flex;
   overflow: hidden;
   overflow: hidden;
-  height: 40px;
+  /* height: 40px; */
 }
 }
 .student_button .el-button--primary {
 .student_button .el-button--primary {
   /* margin-right: 10px; */
   /* margin-right: 10px; */

+ 56 - 47
src/components/pages/curriculum.vue

@@ -23,11 +23,14 @@
           v-loading="isLoading"
           v-loading="isLoading"
         >
         >
           <el-table-column prop="cuser" label="创建人" min-width="10">
           <el-table-column prop="cuser" label="创建人" min-width="10">
+            <template slot-scope="scope">
+              <div>
+                {{scope.row.name ? scope.row.name : scope.row.username}}
+              </div>
+            </template>
           </el-table-column>
           </el-table-column>
           <el-table-column prop="title" label="课程名称" min-width="25">
           <el-table-column prop="title" label="课程名称" min-width="25">
           </el-table-column>
           </el-table-column>
-          <el-table-column prop="groupName" label="课程分组" min-width="15">
-          </el-table-column>
           <el-table-column prop="time" label="创建时间" min-width="10">
           <el-table-column prop="time" label="创建时间" min-width="10">
           </el-table-column>
           </el-table-column>
           <el-table-column label="操作" min-width="10">
           <el-table-column label="操作" min-width="10">
@@ -184,11 +187,23 @@
                 v-model="homeworkList[index].name"
                 v-model="homeworkList[index].name"
               ></el-input>
               ></el-input>
             </div>
             </div>
-            <div style="display: flex;flex-direction: column;align-items: center;justify-content: center;">
+            <div
+              style="
+                display: flex;
+                flex-direction: column;
+                align-items: center;
+                justify-content: center;
+              "
+            >
               <el-button size="small" type="primary" @click="addHomeworkBox"
               <el-button size="small" type="primary" @click="addHomeworkBox"
                 >点击添加</el-button
                 >点击添加</el-button
               >
               >
-              <el-button size="small" type="primary" style="margin:5px 0 0 0" @click="reduceHomeworkBox" v-if="itemCount > 1 "
+              <el-button
+                size="small"
+                type="primary"
+                style="margin: 5px 0 0 0"
+                @click="reduceHomeworkBox"
+                v-if="itemCount > 1"
                 >点击删除</el-button
                 >点击删除</el-button
               >
               >
             </div>
             </div>
@@ -231,12 +246,6 @@ export default {
       courseName: "",
       courseName: "",
       dialogVisible: false,
       dialogVisible: false,
       tableData: [
       tableData: [
-        {
-"cuser":"张子林",
-"title":"我是小小邮递员",
-"groupName":"文化之旅",
-"time":"2020-12-28 10:18",
-        }
       ],
       ],
       page: 1,
       page: 1,
       total: 0,
       total: 0,
@@ -261,7 +270,7 @@ export default {
       dialogImageUrl: "",
       dialogImageUrl: "",
       classX: "",
       classX: "",
       classListX: [],
       classListX: [],
-      isListAjax:false,
+      isListAjax: false,
     };
     };
   },
   },
   methods: {
   methods: {
@@ -280,9 +289,9 @@ export default {
       this.homeworkList.push({ name: "" });
       this.homeworkList.push({ name: "" });
       this.itemCount++;
       this.itemCount++;
     },
     },
-     reduceHomeworkBox(){
-      var a = this.homeworkList
-      a.splice(a.length-1)
+    reduceHomeworkBox() {
+      var a = this.homeworkList;
+      a.splice(a.length - 1);
       this.itemCount--;
       this.itemCount--;
     },
     },
     handle_remove(file, fileList) {
     handle_remove(file, fileList) {
@@ -464,7 +473,7 @@ export default {
       this.ajax
       this.ajax
         .get(this.$store.state.api + "getCourseAdmin", params)
         .get(this.$store.state.api + "getCourseAdmin", params)
         .then((res) => {
         .then((res) => {
-      this.isListAjax = false;
+          this.isListAjax = false;
           this.isLoading = false;
           this.isLoading = false;
           this.total = res.data[0].length > 0 ? res.data[0][0].num : 0;
           this.total = res.data[0].length > 0 ? res.data[0][0].num : 0;
           this.tableData = res.data[0];
           this.tableData = res.data[0];
@@ -506,39 +515,39 @@ export default {
       }
       }
     },
     },
     search() {
     search() {
-      // this.page = 1;
-      // this.isListAjax = true;
-      // this.getCourse();
+      this.page = 1;
+      this.isListAjax = true;
+      this.getCourse();
     },
     },
     //删除课程
     //删除课程
     deleteCourse(cid) {
     deleteCourse(cid) {
-      // let params = [{ cid: cid }];
-      // if (this.time()) {
-      //   this.$confirm("确定删除此课程吗?", "提示", {
-      //     confirmButtonText: "确定",
-      //     cancelButtonText: "取消",
-      //     type: "warning",
-      //   })
-      //     .then(() => {
-      //       this.ajax
-      //         .post(this.$store.state.api + "deleteCourse", params)
-      //         .then((res) => {
-      //           this.$message({
-      //             message: "删除成功",
-      //             type: "success",
-      //           });
-      //           if (this.page != 1 && this.tableData.length == 1) {
-      //             this.page--;
-      //           }
-      //           this.getCourse();
-      //         })
-      //         .catch((err) => {
-      //           this.$message.error("修改失败");
-      //           console.error(err);
-      //         });
-      //     })
-      //     .catch(() => {});
-      // }
+      let params = [{ cid: cid }];
+      if (this.time()) {
+        this.$confirm("确定删除此课程吗?", "提示", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning",
+        })
+          .then(() => {
+            this.ajax
+              .post(this.$store.state.api + "deleteCourseAdmin", params)
+              .then((res) => {
+                this.$message({
+                  message: "删除成功",
+                  type: "success",
+                });
+                if (this.page != 1 && this.tableData.length == 1) {
+                  this.page--;
+                }
+                this.getCourse();
+              })
+              .catch((err) => {
+                this.$message.error("修改失败");
+                console.error(err);
+              });
+          })
+          .catch(() => {});
+      }
     },
     },
     //uuid生成
     //uuid生成
     guid() {
     guid() {
@@ -712,9 +721,9 @@ export default {
   created() {
   created() {
     this.$nextTick(function () {
     this.$nextTick(function () {
       this.page = 1;
       this.page = 1;
-      // this.getCourse();
+      this.getCourse();
       this.changeHeight();
       this.changeHeight();
-      this.getGroup();
+      // this.getGroup();
       // this.getJuri();
       // this.getJuri();
     });
     });
   },
   },

+ 195 - 236
src/components/pages/home.vue

@@ -6,8 +6,10 @@
         <div>
         <div>
           <div class="home_titleHead">
           <div class="home_titleHead">
             <div class="ban">Banner管理</div>
             <div class="ban">Banner管理</div>
-            <el-button size="small" type="primary">添加图片</el-button>
-            <!-- @click="dialogVisible = true" -->
+            <el-button size="small" type="primary" @click="dialogVisible = true"
+              >添加图片</el-button
+            >
+            <!-- -->
           </div>
           </div>
           <el-table
           <el-table
             :data="tableData"
             :data="tableData"
@@ -89,6 +91,7 @@
             height="500"
             height="500"
             :cell-style="{ 'text-align': 'center' }"
             :cell-style="{ 'text-align': 'center' }"
             style="width: 100%"
             style="width: 100%"
+            v-loading="loading[item.id]"
           >
           >
             <el-table-column prop="title" label="课程名称" min-width="25">
             <el-table-column prop="title" label="课程名称" min-width="25">
             </el-table-column>
             </el-table-column>
@@ -330,64 +333,10 @@ export default {
       linkInput: "",
       linkInput: "",
       checkList: [],
       checkList: [],
       courseList: [],
       courseList: [],
-      tableData: [
-        {
-          create_at: "2021-04-23T20:14:49.000Z",
-          id: "f9010b15-a40b-11eb-80ad-005056b86db5",
-          number: 0,
-          poster:
-            "https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/组211619165665500.png",
-          title: "麓城外国语小学-我是种植小能手-406胡智航",
-          url: "5fbbdeb1-96a2-11eb-80ad-005056b86db5",
-          userid: "0",
-        },
-      ],
-      zoneList: [
-        {
-          create_at: "2021-04-06T19:37:56.000Z",
-          createuserid: "0",
-          id: "1",
-          name: "热门推荐",
-          oid: null,
-          order: 6,
-          parentid: "1",
-        },
-        {
-          create_at: "2021-04-06T19:37:56.000Z",
-          createuserid: "0",
-          id: "2",
-          name: "PBL热门项目",
-          oid: null,
-          order: 6,
-          parentid: "1",
-        },
-      ],
-      zoneClass: {
-        1: [
-          {
-            title: "印象中秋",
-            brief: "印象中秋",
-            vcount: "123",
-          },
-          {
-            title: "深圳发展40周年",
-            brief: "深圳发展40周年",
-            vcount: "456",
-          },
-        ],
-        2: [
-          {
-            title: "印象中秋",
-            brief: "印象中秋",
-            vcount: "123",
-          },
-          {
-            title: "深圳发展40周年",
-            brief: "深圳发展40周年",
-            vcount: "456",
-          },
-        ],
-      },
+      tableData: [],
+      zoneList: [],
+      zoneClass: {},
+      loading: {},
       page: {},
       page: {},
       total: {},
       total: {},
       pid: "",
       pid: "",
@@ -527,6 +476,7 @@ export default {
           this.zoneList = res.data[0];
           this.zoneList = res.data[0];
           this.zoneList.filter((element) => {
           this.zoneList.filter((element) => {
             this.page[element.id] = 1;
             this.page[element.id] = 1;
+            this.loading[element.id] = true;
             this.getZoneClass(element.id);
             this.getZoneClass(element.id);
           });
           });
         })
         })
@@ -536,10 +486,12 @@ export default {
     },
     },
     //获取专区下的课程
     //获取专区下的课程
     getZoneClass(zid) {
     getZoneClass(zid) {
+      this.loading[zid] = true;
       let params = { bid: zid, page: this.page[zid] };
       let params = { bid: zid, page: this.page[zid] };
       this.ajax
       this.ajax
         .get(this.$store.state.api + "getZoneClass", params)
         .get(this.$store.state.api + "getZoneClass", params)
         .then((res) => {
         .then((res) => {
+          this.loading[zid] = false;
           this.isListAjax = false;
           this.isListAjax = false;
           // this.zoneClass[zid] = res.data[0];
           // this.zoneClass[zid] = res.data[0];
           this.$set(this.zoneClass, zid, res.data[0]);
           this.$set(this.zoneClass, zid, res.data[0]);
@@ -556,77 +508,79 @@ export default {
     },
     },
     //添加课程专区
     //添加课程专区
     addZone() {
     addZone() {
-      // if (this.zoneName === "") {
-      //   this.$message.error("请填写添加课程专区名称");
-      //   return;
-      // }
-      // if (this.time()) {
-      //   let params = [{ n: this.zoneName, cuid: "0" }];
-      //   this.ajax
-      //     .post(this.$store.state.api + "addZone", params)
-      //     .then((res) => {
-      //       this.$message({
-      //         message: "添加成功",
-      //         type: "success",
-      //       });
-      //       this.zoneName = "";
-      //       this.dialogVisible4 = false;
-      //       this.init();
-      //       this.getZone();
-      //     })
-      //     .catch((err) => {
-      //       this.$message.error("添加失败");
-      //       console.error(err);
-      //     });
-      // }
+      if (this.zoneName === "") {
+        this.$message.error("请填写添加课程专区名称");
+        return;
+      }
+      if (this.time()) {
+        let params = [
+          { n: this.zoneName, cuid: this.$store.state.userInfo.uid },
+        ];
+        this.ajax
+          .post(this.$store.state.api + "addZone", params)
+          .then((res) => {
+            this.$message({
+              message: "添加成功",
+              type: "success",
+            });
+            this.zoneName = "";
+            this.dialogVisible4 = false;
+            this.init();
+            this.getZone();
+          })
+          .catch((err) => {
+            this.$message.error("添加失败");
+            console.error(err);
+          });
+      }
     },
     },
     //获取专区下的课程数量
     //获取专区下的课程数量
     getZoneNum(zid) {
     getZoneNum(zid) {
-      // let params = { bid: zid };
-      // this.ajax
-      //   .get(this.$store.state.api + "getZoneClassNum", params)
-      //   .then((res) => {
-      //     if (res.data[0][0].num > 0) {
-      //       this.$message.error("请把专区底下的课程全部删除才可以删除专区");
-      //     } else {
-      //       this.deleteZone(zid);
-      //     }
-      //   })
-      //   .catch((err) => {
-      //     console.error(err);
-      //   });
+      let params = { bid: zid };
+      this.ajax
+        .get(this.$store.state.api + "getZoneClassNum", params)
+        .then((res) => {
+          if (res.data[0][0].num > 0) {
+            this.$message.error("请把专区底下的课程全部删除才可以删除专区");
+          } else {
+            this.deleteZone(zid);
+          }
+        })
+        .catch((err) => {
+          console.error(err);
+        });
     },
     },
     //删除课程专区
     //删除课程专区
     deleteZone(zid) {
     deleteZone(zid) {
-      // let params = [{ id: zid }];
-      // this.$confirm("确定删除此专区吗?", "提示", {
-      //   confirmButtonText: "确定",
-      //   cancelButtonText: "取消",
-      //   type: "warning",
-      // })
-      //   .then(() => {
-      //     this.ajax
-      //       .post(this.$store.state.api + "deleteZone", params)
-      //       .then((res) => {
-      //         this.$message({
-      //           message: "删除成功",
-      //           type: "success",
-      //         });
-      //         this.getZone();
-      //       })
-      //       .catch((err) => {
-      //         this.$message.error("删除失败");
-      //         console.error(err);
-      //       });
-      //   })
-      //   .catch(() => {});
+      let params = [{ id: zid }];
+      this.$confirm("确定删除此专区吗?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          this.ajax
+            .post(this.$store.state.api + "deleteZone", params)
+            .then((res) => {
+              this.$message({
+                message: "删除成功",
+                type: "success",
+              });
+              this.getZone();
+            })
+            .catch((err) => {
+              this.$message.error("删除失败");
+              console.error(err);
+            });
+        })
+        .catch(() => {});
     },
     },
     //打开添加弹窗
     //打开添加弹窗
     addPop(zid) {
     addPop(zid) {
-      // this.init();
-      // this.dialogVisible1 = true;
-      // this.pid = zid;
-      // this.Search();
+      this.init();
+      this.dialogVisible1 = true;
+      this.pid = zid;
+      this.Search();
     },
     },
     //打开添加弹窗
     //打开添加弹窗
     addBannerUrlPop() {
     addBannerUrlPop() {
@@ -725,59 +679,64 @@ export default {
     },
     },
     //删除课程专区
     //删除课程专区
     deleteZoneCourse(id, zid) {
     deleteZoneCourse(id, zid) {
-      // let params = [{ id: id }];
-      // this.$confirm("确定把此课程从次专区删除吗?", "提示", {
-      //   confirmButtonText: "确定",
-      //   cancelButtonText: "取消",
-      //   type: "warning",
-      // })
-      //   .then(() => {
-      //     this.ajax
-      //       .post(this.$store.state.api + "deleteZoneCourse", params)
-      //       .then((res) => {
-      //         this.$message({
-      //           message: "删除成功",
-      //           type: "success",
-      //         });
-      //         this.getZoneClass(zid);
-      //       })
-      //       .catch((err) => {
-      //         this.$message.error("删除失败");
-      //         console.error(err);
-      //       });
-      //   })
-      //   .catch(() => {});
+      let params = [{ id: id }];
+      this.$confirm("确定把此课程从次专区删除吗?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          this.ajax
+            .post(this.$store.state.api + "deleteZoneCourse", params)
+            .then((res) => {
+              this.$message({
+                message: "删除成功",
+                type: "success",
+              });
+              this.getZoneClass(zid);
+            })
+            .catch((err) => {
+              this.$message.error("删除失败");
+              console.error(err);
+            });
+        })
+        .catch(() => {});
     },
     },
     //把课程添加进专区
     //把课程添加进专区
     addBanner() {
     addBanner() {
-      // var list = this.fileList;
-      // if (list.length == 0) {
-      //   this.$message.error("请上传需要添加的banner");
-      //   return;
-      // } else if (this.bannerCourse === "") {
-      //   this.$message.error("请填写选择banner的链接");
-      //   return;
-      // }
-      // if (this.time()) {
-      //   let params = [
-      //     { p: list[0].url, url: this.bannerCourse.courseId, uid: "0", n: "0" },
-      //   ];
-      //   this.ajax
-      //     .post(this.$store.state.api + "addBanner", params)
-      //     .then((res) => {
-      //       this.$message({
-      //         message: "添加成功",
-      //         type: "success",
-      //       });
-      //       this.dialogVisible = false;
-      //       this.init();
-      //       this.getBanner();
-      //     })
-      //     .catch((err) => {
-      //       this.$message.error("添加失败");
-      //       console.error(err);
-      //     });
-      // }
+      var list = this.fileList;
+      if (list.length == 0) {
+        this.$message.error("请上传需要添加的banner");
+        return;
+      } else if (this.bannerCourse === "") {
+        this.$message.error("请填写选择banner的链接");
+        return;
+      }
+      if (this.time()) {
+        let params = [
+          //this.bannerCourse.courseId
+          {
+            p: list[0].url,
+            url: this.bannerCourse.courseId,
+            uid: this.$store.state.userInfo.uid,
+          },
+        ];
+        this.ajax
+          .post(this.$store.state.api + "addBanner", params)
+          .then((res) => {
+            this.$message({
+              message: "添加成功",
+              type: "success",
+            });
+            this.dialogVisible = false;
+            this.init();
+            this.getBanner();
+          })
+          .catch((err) => {
+            this.$message.error("添加失败");
+            console.error(err);
+          });
+      }
     },
     },
     //获取banner
     //获取banner
     getBanner() {
     getBanner() {
@@ -793,72 +752,72 @@ export default {
     },
     },
     //删除banner
     //删除banner
     deleteBanner(id) {
     deleteBanner(id) {
-      // let params = [{ id: id }];
-      // this.$confirm("确定删除此banner吗?", "提示", {
-      //   confirmButtonText: "确定",
-      //   cancelButtonText: "取消",
-      //   type: "warning",
-      // })
-      //   .then(() => {
-      //     this.ajax
-      //       .post(this.$store.state.api + "deleteBanner", params)
-      //       .then((res) => {
-      //         this.$message({
-      //           message: "删除成功",
-      //           type: "success",
-      //         });
-      //         this.getBanner();
-      //       })
-      //       .catch((err) => {
-      //         this.$message.error("删除失败");
-      //         console.error(err);
-      //       });
-      //   })
-      //   .catch(() => {});
+      let params = [{ id: id }];
+      this.$confirm("确定删除此banner吗?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          this.ajax
+            .post(this.$store.state.api + "deleteBanner", params)
+            .then((res) => {
+              this.$message({
+                message: "删除成功",
+                type: "success",
+              });
+              this.getBanner();
+            })
+            .catch((err) => {
+              this.$message.error("删除失败");
+              console.error(err);
+            });
+        })
+        .catch(() => {});
     },
     },
     up(index) {
     up(index) {
-      // if (index == 0) {
-      //   this.$message.error("已经是最上面的一个,不可以再上移了");
-      //   return;
-      // }
-      // let params = [
-      //   { aid: this.zoneList[index].id, bid: this.zoneList[index - 1].id },
-      // ];
-      // this.ajax
-      //   .post(this.$store.state.api + "zoneRank", params)
-      //   .then((res) => {
-      //     this.$message({
-      //       message: "上移成功",
-      //       type: "success",
-      //     });
-      //     this.getZone();
-      //   })
-      //   .catch((err) => {
-      //     this.$message.error("上移失败");
-      //     console.error(err);
-      //   });
+      if (index == 0) {
+        this.$message.error("已经是最上面的一个,不可以再上移了");
+        return;
+      }
+      let params = [
+        { aid: this.zoneList[index].id, bid: this.zoneList[index - 1].id },
+      ];
+      this.ajax
+        .post(this.$store.state.api + "zoneRank", params)
+        .then((res) => {
+          this.$message({
+            message: "上移成功",
+            type: "success",
+          });
+          this.getZone();
+        })
+        .catch((err) => {
+          this.$message.error("上移失败");
+          console.error(err);
+        });
     },
     },
     down(index) {
     down(index) {
-      // if (index == this.zoneList.length - 1) {
-      //   this.$message.error("已经是最下面的一个,不可以再下移了");
-      //   return;
-      // }
-      // let params = [
-      //   { aid: this.zoneList[index].id, bid: this.zoneList[index + 1].id },
-      // ];
-      // this.ajax
-      //   .post(this.$store.state.api + "zoneRank", params)
-      //   .then((res) => {
-      //     this.$message({
-      //       message: "下移成功",
-      //       type: "success",
-      //     });
-      //     this.getZone();
-      //   })
-      //   .catch((err) => {
-      //     this.$message.error("下移失败");
-      //     console.error(err);
-      //   });
+      if (index == this.zoneList.length - 1) {
+        this.$message.error("已经是最下面的一个,不可以再下移了");
+        return;
+      }
+      let params = [
+        { aid: this.zoneList[index].id, bid: this.zoneList[index + 1].id },
+      ];
+      this.ajax
+        .post(this.$store.state.api + "zoneRank", params)
+        .then((res) => {
+          this.$message({
+            message: "下移成功",
+            type: "success",
+          });
+          this.getZone();
+        })
+        .catch((err) => {
+          this.$message.error("下移失败");
+          console.error(err);
+        });
     },
     },
     //设置banner链接
     //设置banner链接
     setBannerUrl() {
     setBannerUrl() {
@@ -871,8 +830,8 @@ export default {
     },
     },
   },
   },
   created() {
   created() {
-    // this.getBanner();
-    // this.getZone();
+    this.getBanner();
+    this.getZone();
   },
   },
 };
 };
 </script>
 </script>

+ 70 - 95
src/components/pages/notice.vue

@@ -32,13 +32,13 @@
           >
           >
             <template slot-scope="scope">
             <template slot-scope="scope">
               <div
               <div
-                v-html="snippet(scope.row.newscontent)"
+                v-html="snippet(scope.row.content)"
                 class="DivOverflow"
                 class="DivOverflow"
               ></div>
               ></div>
               <div></div>
               <div></div>
             </template>
             </template>
           </el-table-column>
           </el-table-column>
-          <el-table-column prop="time" label="创建时间" min-width="20">
+          <el-table-column prop="creatTime" label="创建时间" min-width="20">
           </el-table-column>
           </el-table-column>
           <el-table-column prop="do" label="操作" min-width="20">
           <el-table-column prop="do" label="操作" min-width="20">
             <template slot-scope="scope">
             <template slot-scope="scope">
@@ -114,9 +114,9 @@
     >
     >
       <div class="head">
       <div class="head">
         <span>{{ NoticeDeatail.title }}</span>
         <span>{{ NoticeDeatail.title }}</span>
-        <span class="name">{{ NoticeDeatail.time }}</span>
+        <span class="name">{{ NoticeDeatail.creatTime }}</span>
       </div>
       </div>
-      <div class="cont" v-html="NoticeDeatail.newscontent"></div>
+      <div class="cont" v-html="NoticeDeatail.content"></div>
       <span slot="footer" class="dialog-footer">
       <span slot="footer" class="dialog-footer">
         <el-button type="primary" @click="dialogVisible2 = false"
         <el-button type="primary" @click="dialogVisible2 = false"
           >关闭</el-button
           >关闭</el-button
@@ -138,21 +138,7 @@ export default {
       detail: "",
       detail: "",
       dialogVisible1: false,
       dialogVisible1: false,
       dialogVisible2: false,
       dialogVisible2: false,
-      tableData: [
-        {
-          created_at: "2021-04-09T18:25:40.000Z",
-          isRead: 2,
-          newscontent:
-            ' <span style="margin-left:1rem">\r\n            打造”规范+特色“模式。在保证学校劳动教育常\r\n            规课程开设的同时,鼓励各校结合自身优势与历史人\r\n            文资源,发展特色项目,形成全面普及、一校一特色\r\n            的良好局面。军埠口中心小学的”关爱母亲河“探究\r\n            体验、东夏庄小学的”萝卜种植“、望留中学的”剪\r\n            纸艺术“等主题特色鲜明,育人效果明显。</span\r\n          >\r\n          <span style="margin-left:1rem">\r\n            开发劳动教育课程。外国语学校和北门大街小学的\r\n            以“家乡的二十四节气”为主题的课程资源和活动指\r\n            导手册,向阳路小学的“强国+飞天”系列科技主题\r\n            劳动课程,潍城区实验小学的“板桥探究”体验探究\r\n            课程,利昌学校的“神奇的飞行器”科技制作课程,\r\n            潍坊三中的“印出中国心——3D打印设计”课程等一\r\n            系列富有时代感和地域特色的劳动教育课程,极大地\r\n            丰富了劳动教育课程资源。</span\r\n          >',
-          newsid: "1f2b5064-94e6-4025-931f-8c1b0a8d70dd",
-          newsidtype: null,
-          num: 1,
-          recipientid: "0",
-          senderid: "0",
-          time: "2021-04-09 14:25:40",
-          title: "实践出真知,劳动最光荣",
-        },
-      ],
+      tableData: [],
       isLoading: false,
       isLoading: false,
       total: 0,
       total: 0,
       page: 1,
       page: 1,
@@ -210,9 +196,9 @@ export default {
     //获取通知
     //获取通知
     getNotice() {
     getNotice() {
       this.isLoading = true;
       this.isLoading = true;
-      let params = { page: this.page };
+      let params = { uid: "0", page: this.page };
       this.ajax
       this.ajax
-        .get(this.$store.state.api + "getNotice", params)
+        .get(this.$store.state.api + "getNewsTeacher", params)
         .then((res) => {
         .then((res) => {
           this.isLoading = false;
           this.isLoading = false;
           this.total = res.data[0].length > 0 ? res.data[0][0].num : 0;
           this.total = res.data[0].length > 0 ? res.data[0][0].num : 0;
@@ -230,88 +216,77 @@ export default {
     },
     },
     //添加通知
     //添加通知
     addNotice() {
     addNotice() {
-      // if (this.noticeTitle === "") {
-      //   this.$message.error("请输入文章标题");
-      //   return;
-      // } else if (this.detail === "") {
-      //   this.$message.error("请输入文章内容");
-      //   return;
-      // }
-      // console.log(this.detail);
-      // if (this.time()) {
-      //   let params = [
-      //     {
-      //       t: this.noticeTitle,
-      //       nc: this.detail.replace(/%/g, "%25"),
-      //       s: 0,
-      //       r: 0,
-      //     },
-      //   ];
-      //   this.ajax
-      //     .post(this.$store.state.api + "addNotice", params)
-      //     .then((res) => {
-      //       this.$message({
-      //         message: "添加成功",
-      //         type: "success",
-      //       });
-      //       this.init();
-      //       this.getNotice();
-      //       this.dialogVisible1 = false;
-      //     })
-      //     .catch((err) => {
-      //       this.$message.error("添加失败");
-      //       console.error(err);
-      //     });
-      // }
+      if (this.noticeTitle === "") {
+        this.$message.error("请输入文章标题");
+        return;
+      } else if (this.detail === "") {
+        this.$message.error("请输入文章内容");
+        return;
+      }
+      console.log(this.detail);
+      if (this.time()) {
+        let params = [
+          {
+            t: this.noticeTitle,
+            nc: this.detail.replace(/%/g, "%25"),
+            s: 0,
+            r: 0,
+          },
+        ];
+        this.ajax
+          .post(this.$store.state.api + "addNews", params)
+          .then((res) => {
+            this.$message({
+              message: "添加成功",
+              type: "success",
+            });
+            this.init();
+            this.getNotice();
+            this.dialogVisible1 = false;
+          })
+          .catch((err) => {
+            this.$message.error("添加失败");
+            console.error(err);
+          });
+      }
     },
     },
     //删除通知
     //删除通知
     deleteNotice(id) {
     deleteNotice(id) {
-      // let params = [{ nid: id }];
-
-      // this.$confirm("确定删除此通知吗?", "提示", {
-      //   confirmButtonText: "确定",
-      //   cancelButtonText: "取消",
-      //   type: "warning",
-      // })
-      //   .then(() => {
-      //     this.ajax
-      //       .post(this.$store.state.api + "deleteNotice", params)
-      //       .then((res) => {
-      //         this.$message({
-      //           message: "删除成功",
-      //           type: "success",
-      //         });
-      //         if (this.page != 1 && this.tableData.length == 1) {
-      //           this.page--;
-      //         }
-      //         this.getNotice();
-      //       })
-      //       .catch((err) => {
-      //         this.$message.error("删除失败");
-      //         console.error(err);
-      //       });
-      //   })
-      //   .catch(() => {});
+      let params = [{ nid: id }];
+      this.$confirm("确定删除此通知吗?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          this.ajax
+            .post(this.$store.state.api + "deleteNews", params)
+            .then((res) => {
+              this.$message({
+                message: "删除成功",
+                type: "success",
+              });
+              if (this.page != 1 && this.tableData.length == 1) {
+                this.page--;
+              }
+              this.getNotice();
+            })
+            .catch((err) => {
+              this.$message.error("删除失败");
+              console.error(err);
+            });
+        })
+        .catch(() => {});
     },
     },
-    getNoticeDetail(id) {
+    getNoticeDetail(res) {
       this.dialogVisible2 = true;
       this.dialogVisible2 = true;
-      this.NoticeDeatail = id;
-      // let params = { nid: id };
-      // this.ajax
-      //   .get(this.$store.state.api + "getNoticeById", params)
-      //   .then((res) => {
-      //     this.dialogVisible2 = true;
-      //     this.NoticeDeatail = res.data[0][0];
-      //   })
-      //   .catch((err) => {
-      //     console.error(err);
-      //   });
+      this.NoticeDeatail = res;
     },
     },
   },
   },
   created() {
   created() {
     this.$nextTick(function () {
     this.$nextTick(function () {
       this.page = 1;
       this.page = 1;
-      // this.getNotice();
+      this.getNotice();
       this.changeHeight();
       this.changeHeight();
     });
     });
   },
   },
@@ -335,6 +310,7 @@ export default {
   display: block;
   display: block;
 }
 }
 .head {
 .head {
+  margin: 0 0 15px;
   font-size: 20px;
   font-size: 20px;
   border-bottom: 1px solid;
   border-bottom: 1px solid;
   /* height: 35px; */
   /* height: 35px; */
@@ -342,12 +318,11 @@ export default {
   align-items: center;
   align-items: center;
   padding-bottom: 10px;
   padding-bottom: 10px;
   justify-content: space-between;
   justify-content: space-between;
+  align-items: flex-end;
 }
 }
 .name {
 .name {
-  float: right;
   /* margin-top: -30px; */
   /* margin-top: -30px; */
   font-size: 14px;
   font-size: 14px;
-  width: 200px;
 }
 }
 .cont {
 .cont {
   font-size: 16px;
   font-size: 16px;

+ 47 - 72
src/components/pages/organization.vue

@@ -79,32 +79,7 @@ export default {
     return {
     return {
       dialogVisible: false,
       dialogVisible: false,
       dialogVisible1: false,
       dialogVisible1: false,
-      tableData: [
-        {
-          create_at: "2021-03-25T14:29:04.000Z",
-          createuserid: "0",
-          describe: "深圳",
-          id: "1123",
-          logo: null,
-          name: "深圳市龙岗区麓城外国语小学",
-        },
-        {
-          create_at: null,
-          createuserid: "0",
-          describe: "深圳",
-          id: "1233",
-          logo: null,
-          name: "海口市灵山镇中心学校",
-        },
-        {
-          create_at: "2021-04-05T18:27:26.000Z",
-          createuserid: "0",
-          describe: "深圳",
-          id: "fd6a9fa8-95d7-11eb-80ad-005056b86db5",
-          logo: "",
-          name: "深圳市福田区荔园小学(荔园教育集团)",
-        },
-      ],
+      tableData: [],
       orgName: "",
       orgName: "",
       page: 1,
       page: 1,
       total: 0,
       total: 0,
@@ -152,53 +127,53 @@ export default {
     },
     },
 
 
     addOrg() {
     addOrg() {
-      // if (this.time()) {
-      //   let params = [{ n: this.orgName }];
-      //   this.ajax
-      //     .post(this.$store.state.api + "addSchool", params)
-      //     .then((res) => {
-      //       this.$message({
-      //         message: "添加成功",
-      //         type: "success",
-      //       });
-      //       this.dialogVisible1 = false;
-      //       this.orgName = "";
-      //       this.getOrg();
-      //     })
-      //     .catch((err) => {
-      //       this.$message.error("添加失败");
-      //       console.error(err);
-      //     });
-      // }
+      if (this.time()) {
+        let params = [{ n: this.orgName,cuid:this.$store.state.userInfo.uid }];
+        this.ajax
+          .post(this.$store.state.api + "addSchoolAdmin", params)
+          .then((res) => {
+            this.$message({
+              message: "添加成功",
+              type: "success",
+            });
+            this.dialogVisible1 = false;
+            this.orgName = "";
+            this.getOrg();
+          })
+          .catch((err) => {
+            this.$message.error("添加失败");
+            console.error(err);
+          });
+      }
     },
     },
     deleteOrg(id) {
     deleteOrg(id) {
-      // let params = [{ id: id }];
-      // var _this = this;
-      // _this
-      //   .$confirm("确定删除此学校吗?", "提示", {
-      //     confirmButtonText: "确定",
-      //     cancelButtonText: "取消",
-      //     type: "warning",
-      //   })
-      //   .then(() => {
-      //     _this.ajax
-      //       .post(_this.$store.state.api + "deleteSchool", params)
-      //       .then((res) => {
-      //         _this.$message({
-      //           message: "删除成功",
-      //           type: "success",
-      //         });
-      //         if (_this.page != 1 && _this.tableData.length == 1) {
-      //           _this.page--;
-      //         }
-      //         _this.getOrg();
-      //       })
-      //       .catch((err) => {
-      //         _this.$message.error("删除失败");
-      //         console.error(err);
-      //       });
-      //   })
-      //   .catch(() => {});
+      let params = [{ id: id }];
+      var _this = this;
+      _this
+        .$confirm("确定删除此学校吗?", "提示", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning",
+        })
+        .then(() => {
+          _this.ajax
+            .post(_this.$store.state.api + "deleteSchoolAdmin", params)
+            .then((res) => {
+              _this.$message({
+                message: "删除成功",
+                type: "success",
+              });
+              if (_this.page != 1 && _this.tableData.length == 1) {
+                _this.page--;
+              }
+              _this.getOrg();
+            })
+            .catch((err) => {
+              _this.$message.error("删除失败");
+              console.error(err);
+            });
+        })
+        .catch(() => {});
     },
     },
     changeHeight() {
     changeHeight() {
       this.tableHeight =
       this.tableHeight =
@@ -222,7 +197,7 @@ export default {
     this.$nextTick(function () {
     this.$nextTick(function () {
       this.page = 1;
       this.page = 1;
       this.changeHeight();
       this.changeHeight();
-      // this.getOrg();
+      this.getOrg();
     });
     });
   },
   },
 };
 };

+ 231 - 45
src/components/pages/template.vue

@@ -4,7 +4,9 @@
       <div class="tou">模板管理管理</div>
       <div class="tou">模板管理管理</div>
       <div>
       <div>
         <div style="margin: 15px 0; display: flex; justify-content: flex-end">
         <div style="margin: 15px 0; display: flex; justify-content: flex-end">
-          <el-button type="primary">新建文档模板</el-button>
+          <el-button type="primary" size="small" @click="dialogVisible1 = true"
+            >新建文档模板</el-button
+          >
         </div>
         </div>
         <el-table
         <el-table
           ref="table"
           ref="table"
@@ -24,16 +26,14 @@
           <el-table-column label="操作" min-width="10">
           <el-table-column label="操作" min-width="10">
             <template slot-scope="scope">
             <template slot-scope="scope">
               <div class="pb_buttonBox">
               <div class="pb_buttonBox">
-                <el-button
-                  size="mini"
-                  type="primary"
-                  @click="goTo('/course?index=1&id=' + scope.row.courseId)"
+                <el-button size="mini" type="primary" @click="check(scope.row)"
                   >查看</el-button
                   >查看</el-button
                 >
                 >
+                <!-- @click="goTo('/course?index=1&id=' + scope.row.courseId)" -->
                 <el-button
                 <el-button
                   size="mini"
                   size="mini"
                   type="primary"
                   type="primary"
-                  @click="deleteCourse(scope.row.courseId)"
+                  @click="deleteTemplate(scope.row.id)"
                   >删除</el-button
                   >删除</el-button
                 >
                 >
               </div>
               </div>
@@ -53,61 +53,93 @@
         </el-pagination>
         </el-pagination>
       </div>
       </div>
     </el-main>
     </el-main>
+    <el-dialog
+      title="添加模板文档"
+      :visible.sync="dialogVisible1"
+      width="550px"
+      :before-close="handleClose"
+      class="dialog_diy"
+      center
+    >
+      <div>
+        <div class="tian1">
+          <span>模板文档标题</span>
+          <el-input
+            v-model="tTitle"
+            style="width: 250px; margin: 15px 0px"
+            placeholder="请输入通知标题"
+          ></el-input>
+        </div>
+        <div class="tian1">
+          <span>模板文档内容</span>
+          <editor-bar
+            v-model="detail"
+            :isClear="isClear"
+            @change="change"
+          ></editor-bar>
+        </div>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="addTemplate">确认添加</el-button>
+        <el-button @click="dialogVisible1 = false">取 消</el-button>
+      </span>
+    </el-dialog>
+    <el-dialog
+      title="查看详情"
+      :visible.sync="dialogVisible2"
+      width="700px"
+      :before-close="handleClose"
+      class="dialog_diy dialog_diyA"
+      center
+    >
+      <div class="head">
+        <span>{{ templateD.title }}</span>
+        <span class="name">{{ templateD.time }}</span>
+      </div>
+      <div class="cont" v-html="templateD.content"></div>
+      <span slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="dialogVisible2 = false"
+          >关闭</el-button
+        >
+      </span>
+    </el-dialog>
   </div>
   </div>
 </template>
 </template>
 
 
 <script>
 <script>
+import EditorBar from "../../components/tools/wangEnduit";
+
 export default {
 export default {
+  components: { EditorBar },
   data() {
   data() {
     return {
     return {
       tableHeight: 500,
       tableHeight: 500,
       courseName: "",
       courseName: "",
-      dialogVisible: false,
-      tableData: [
-        {
-          title: "人工智能风车-项目概论",
-          time: "2022-12-28",
-        },
-        {
-          title: "智慧物流课程",
-          time: "2022-12-28",
-        },
-        {
-          title: "AI劳动实践通用课程",
-          time: "2022-12-28",
-        },
-        {
-          title: "AI造物(乐高版)",
-          time: "2022-12-28",
-        },
-      ],
+      dialogVisible1: false,
+      dialogVisible2: false,
+      isClear: false,
+      tableData: [],
       page: 1,
       page: 1,
       total: 0,
       total: 0,
       isLoading: false,
       isLoading: false,
-      itemCount: 1,
-      courseTitle: "",
-      courseText: "",
-      fileList: [],
-      fileList1: [],
-      homeworkList: [{ name: "" }],
-      group: "",
-      Juri: "",
-      className: "",
-      groupList: [],
-      // JuriList: [],
-      uploadLoading1: false,
-      uploadLoading: false,
-      updateId: "",
-      groupA: "",
-      isClear: true,
-      dialogVisible1: false,
-      dialogImageUrl: "",
-      classX: "",
-      classListX: [],
       isListAjax: false,
       isListAjax: false,
+      tTitle: "",
+      detail: "",
+      templateD: {},
     };
     };
   },
   },
   methods: {
   methods: {
+    handleClose(done) {
+      done();
+    },
+    change(val) {
+      console.log(val);
+    },
+    //在method里面写方法
+    snippet(value) {
+      return value.replace(/<[^>]*>/g, "");
+    },
+
     changeHeight() {
     changeHeight() {
       this.tableHeight =
       this.tableHeight =
         window.innerHeight - this.$refs.table.$el.offsetTop - 200;
         window.innerHeight - this.$refs.table.$el.offsetTop - 200;
@@ -143,11 +175,98 @@ export default {
       // console.log(`当前页: ${val}`);
       // console.log(`当前页: ${val}`);
       this.page = val;
       this.page = val;
     },
     },
+    init() {
+      this.detail = "";
+      this.tTitle = "";
+    },
+    addTemplate() {
+      if (this.tTitle === "") {
+        this.$message.error("请输入模板文档标题");
+        return;
+      } else if (this.detail === "") {
+        this.$message.error("请输入模板文档内容");
+        return;
+      }
+      console.log(this.detail);
+      if (this.time()) {
+        let params = [
+          {
+            t: this.tTitle,
+            nc: this.detail.replace(/%/g, "%25"),
+            uid: this.$store.state.userInfo.uid,
+          },
+        ];
+        this.ajax
+          .post(this.$store.state.api + "addTemplateAdmin", params)
+          .then((res) => {
+            this.$message({
+              message: "添加成功",
+              type: "success",
+            });
+            this.init();
+            this.getTemplate();
+            this.dialogVisible1 = false;
+          })
+          .catch((err) => {
+            this.$message.error("添加失败");
+            console.error(err);
+          });
+      }
+    },
+    getTemplate() {
+      this.isLoading = true;
+      let params = { page: this.page };
+      this.ajax
+        .get(this.$store.state.api + "getTemplateAdmin", params)
+        .then((res) => {
+          this.isLoading = false;
+          this.total = res.data[0].length > 0 ? res.data[0][0].num : 0;
+          this.tableData = res.data[0];
+          console.log(this.tableData);
+        })
+        .catch((err) => {
+          this.isLoading = false;
+          console.error(err);
+        });
+    },
+     //删除通知
+    deleteTemplate(id) {
+      let params = [{ nid: id }];
+      this.$confirm("确定删除此模板吗?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          this.ajax
+            .post(this.$store.state.api + "deleteTemplateAdmin", params)
+            .then((res) => {
+              this.$message({
+                message: "删除成功",
+                type: "success",
+              });
+              if (this.page != 1 && this.tableData.length == 1) {
+                this.page--;
+              }
+              this.getTemplate();
+            })
+            .catch((err) => {
+              this.$message.error("删除失败");
+              console.error(err);
+            });
+        })
+        .catch(() => {});
+    },
+    check(res) {
+      this.dialogVisible2 = true;
+      this.templateD = res;
+    },
   },
   },
   created() {
   created() {
     this.$nextTick(function () {
     this.$nextTick(function () {
       this.page = 1;
       this.page = 1;
       this.changeHeight();
       this.changeHeight();
+      this.getTemplate();
     });
     });
   },
   },
 };
 };
@@ -178,4 +297,71 @@ export default {
 .student_page {
 .student_page {
   margin-top: 15px;
   margin-top: 15px;
 }
 }
+.tian1 {
+  margin-top: 15px;
+}
+.tian1 span {
+  display: block;
+}
+/* table 样式 */
+.cont >>> table {
+  border-top: 1px solid #ccc;
+  border-left: 1px solid #ccc;
+}
+.cont >>> table td,
+.cont >>> table th {
+  border-bottom: 1px solid #ccc;
+  border-right: 1px solid #ccc;
+  padding: 3px 5px;
+}
+.cont >>> table th {
+  border-bottom: 2px solid #ccc;
+  text-align: center;
+}
+
+/* blockquote 样式 */
+.cont >>> blockquote {
+  display: block;
+  border-left: 8px solid #d0e5f2;
+  padding: 5px 10px;
+  margin: 10px 0;
+  line-height: 1.4;
+  font-size: 100%;
+  background-color: #f1f1f1;
+}
+
+/* code 样式 */
+.cont >>> code {
+  display: inline-block;
+  *display: inline;
+  *zoom: 1;
+  background-color: #f1f1f1;
+  border-radius: 3px;
+  padding: 3px 5px;
+  margin: 0 3px;
+}
+.cont >>> pre code {
+  display: block;
+}
+
+/* ul ol 样式 */
+.cont >>> ul,
+ol {
+  margin: 10px 0 10px 20px;
+}
+.head {
+  margin: 0 0 15px;
+  font-size: 20px;
+  border-bottom: 1px solid;
+  /* height: 35px; */
+  display: flex;
+  align-items: center;
+  padding-bottom: 10px;
+  justify-content: space-between;
+  align-items: flex-end;
+}
+.name {
+  /* margin-top: -30px; */
+  font-size: 14px;
+}
 </style>
 </style>

+ 2 - 2
src/components/tools/leftBar.vue

@@ -62,7 +62,7 @@
               </div>
               </div>
               <span slot="title">通知公告</span>
               <span slot="title">通知公告</span>
             </el-menu-item>
             </el-menu-item>
-            <el-menu-item index="/grouping">
+            <!-- <el-menu-item index="/grouping">
               <div class="img" v-if="path == '/grouping'">
               <div class="img" v-if="path == '/grouping'">
                 <img src="../../assets/icon/group-active.png" alt="" />
                 <img src="../../assets/icon/group-active.png" alt="" />
               </div>
               </div>
@@ -70,7 +70,7 @@
                 <img src="../../assets/icon/group.png" alt="" />
                 <img src="../../assets/icon/group.png" alt="" />
               </div>
               </div>
               <span slot="title">分组管理</span>
               <span slot="title">分组管理</span>
-            </el-menu-item>
+            </el-menu-item> -->
             <el-menu-item index="/organization">
             <el-menu-item index="/organization">
               <div class="img" v-if="path == '/organization'">
               <div class="img" v-if="path == '/organization'">
                 <img src="../../assets/icon/class-active.png" alt="" />
                 <img src="../../assets/icon/class-active.png" alt="" />

+ 25 - 25
src/main.js

@@ -34,32 +34,32 @@ router.beforeEach((to, from, next) => {
   }
   }
   const requireAuth = to.meta.requireAuth
   const requireAuth = to.meta.requireAuth
   // 判断该路由是否需要登录权限
   // 判断该路由是否需要登录权限
-  // if (requireAuth) {
-  //   var isLogin = VueCookies.get("Alogin")
-  //   var info = VueCookies.get("AuserInfo")
-  //   if (isLogin == "1") {
-  //     store.commit("update", ["isLogin", true]);
-  //     // var info = JSON.parse(window.sessionStorage.getItem("userInfo"))
-  //     store.commit("update", ["userInfo", info]);
+  if (requireAuth) {
+    var isLogin = VueCookies.get("Alogin")
+    var info = VueCookies.get("AuserInfo")
+    if (isLogin == "1") {
+      store.commit("update", ["isLogin", true]);
+      //     // var info = JSON.parse(window.sessionStorage.getItem("userInfo"))
+      store.commit("update", ["userInfo", info]);
       store.state.luyou = store.state.luyou + 1
       store.state.luyou = store.state.luyou + 1
       store.commit("update", ["luyou", store.state.luyou]);
       store.commit("update", ["luyou", store.state.luyou]);
-  //     next()
-  //   } else {
-  //     const loading = Loading.service({
-  //       background: "rgba(255, 255, 255)",
-  //       target: document.querySelector("body"),
-  //     });
-  //     store.commit("update", ["isLogin", false]);
-  //     Message({
-  //       message: '未登录,请登录',
-  //       type: 'warning'
-  //     });
-  //     setTimeout(() => {
-  //       loading.close();
-  //       next('/login')
-  //     }, 2000);
-  //   }
-  // } else {
+      next()
+    } else {
+      const loading = Loading.service({
+        background: "rgba(255, 255, 255)",
+        target: document.querySelector("body"),
+      });
+      store.commit("update", ["isLogin", false]);
+      Message({
+        message: '未登录,请登录',
+        type: 'warning'
+      });
+      setTimeout(() => {
+        loading.close();
+        next('/login')
+      }, 2000);
+    }
+  } else {
     next()  // 确保一定要有next()被调用
     next()  // 确保一定要有next()被调用
-  // }
+  }
 })
 })

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä