SanHQin 1 год назад
Родитель
Сommit
66fbb95a18

+ 6 - 0
src/assets/icon/course/copy.svg

@@ -0,0 +1,6 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 32 32" width="24" height="24" style="" filter="none">
+    
+    <g>
+    <path d="M9.333 8v-4c0-0.736 0.597-1.333 1.333-1.333v0h16c0.736 0 1.333 0.597 1.333 1.333v0 18.667c0 0.736-0.597 1.333-1.333 1.333v0h-4v4c0 0.736-0.6 1.333-1.343 1.333h-15.981c-0.002 0-0.005 0-0.008 0-0.737 0-1.334-0.597-1.335-1.333v-0l0.004-18.667c0-0.736 0.6-1.333 1.343-1.333h3.987zM6.671 10.667l-0.004 16h13.333v-16h-13.329zM12 8h10.667v13.333h2.667v-16h-13.333v2.667z" fill="rgba(79,79,79,1)"></path>
+    </g>
+  </svg>

+ 6 - 0
src/assets/icon/course/del.svg

@@ -0,0 +1,6 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 32 32" width="24" height="24" style="" filter="none">
+    
+    <g>
+    <path d="M22.129 5.301l-1.614-3.687h-8.758l-1.614 3.687h-7.837v2.305h2.766v22.822h22.358v-22.823h2.536v-2.304h-7.837zM12.909 3.918h5.992l0.691 1.384h-7.146l0.462-1.38zM24.895 28.121h-17.749v-20.515h17.749v20.515zM9.451 11.526h2.305v13.138h-2.305zM14.752 11.526h2.305v13.138h-2.305zM20.285 11.526h2.305v13.138h-2.305z" fill="rgba(79,79,79,1)"></path>
+    </g>
+  </svg>

+ 6 - 0
src/assets/icon/course/edit.svg

@@ -0,0 +1,6 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="64 64 896 896" width="24" height="24" style="" filter="none">
+    
+    <g>
+    <path d="M257.7 752c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 0 0 0-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 0 0 9.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9zm67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z" fill="rgba(79,79,79,1)"></path>
+    </g>
+  </svg>

+ 6 - 0
src/assets/icon/course/lookeye.svg

@@ -0,0 +1,6 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 48 48" width="24" height="24" style="" filter="none">
+    
+    <g>
+    <path fill-rule="evenodd" clip-rule="evenodd" d="M24 37C30.6274 37 36.6274 32.6667 42 24C36.6274 15.3333 30.6274 11 24 11C17.3726 11 11.3726 15.3333 6 24C11.3726 32.6667 17.3726 37 24 37Z" stroke="rgba(79,79,79,1)" stroke-width="4" fill="none"></path><path d="M29 24C29 26.7614 26.7614 29 24 29C21.2386 29 19 26.7614 19 24C19 21.2386 21.2386 19 24 19C26.7614 19 29 21.2386 29 24Z" stroke="rgba(79,79,79,1)" stroke-width="4" fill="none"></path>
+    </g>
+  </svg>

+ 6 - 0
src/assets/icon/course/share.svg

@@ -0,0 +1,6 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 32 32" width="24" height="24" style="" filter="none">
+    
+    <g>
+    <path d="M13.333 4v2.667h-6.667v18.667h18.667v-6.667h2.667v8c0 0.736-0.597 1.333-1.333 1.333v0h-21.333c-0.736 0-1.333-0.597-1.333-1.333v0-21.333c0-0.736 0.597-1.333 1.333-1.333v0h8zM23.448 6.667h-6.115v-2.667h10.667v10.667h-2.667v-6.115l-9.333 9.333-1.885-1.885 9.333-9.333z" fill="rgba(79,79,79,1)"></path>
+    </g>
+  </svg>

Разница между файлами не показана из-за своего большого размера
+ 560 - 442
src/components/pages/classroomObservation/components/tape.vue


+ 91 - 12
src/components/pages/course.vue

@@ -214,10 +214,60 @@
               </div>
             </div>
             <div class="three_bottom">
-              <!-- v-if="role == '1'" -->
-              <div @click="get(item)">预览</div>
+							<el-tooltip effect="dark" content="预览" placement="top">
+    					  <div class="t_b_Item" @click="get(item)">
+									<img src="../../assets/icon/course/lookeye.svg">
+								</div>
+    					</el-tooltip>
+
+							<el-tooltip effect="dark" content="复制" placement="top">
+    					  <div class="t_b_Item" @click="copyCourse(item.courseId)">
+									<img src="../../assets/icon/course/copy.svg">
+								</div>
+    					</el-tooltip>
+
+							<el-tooltip effect="dark" content="修改" placement="top">
+    					  <div class="t_b_Item" v-if="((item.userid == userid) ||
+                (item.course_teacher &&
+                  item.course_teacher.indexOf(userid) !== -1) || role == '1') &&
+                item.state == 1
+                " @click="goToCourse(item.courseId)">
+									<img src="../../assets/icon/course/edit.svg">
+								</div>
+
+								<div class="t_b_Item" v-if="((item.userid == userid) ||
+                (item.course_teacher &&
+                  item.course_teacher.indexOf(userid) !== -1) || role == '1') &&
+                item.state == 2
+                "  @click="goToCourse(item.courseId)">
+									<img src="../../assets/icon/course/edit.svg">
+								</div>
+
+								<div class="t_b_Item" v-if="((item.userid == userid) ||
+                (item.course_teacher &&
+                  item.course_teacher.indexOf(userid) !== -1) || role == '1') &&
+                item.state == 3
+                " @click="goToCourse3(item.courseId)">
+									<img src="../../assets/icon/course/edit.svg">
+								</div>
+    					</el-tooltip>
+
+							<el-tooltip effect="dark" content="删除" placement="top">
+    					  <div class="t_b_Item" @click="deleteCourse(item.courseId)">
+									<img src="../../assets/icon/course/del.svg">
+								</div>
+    					</el-tooltip>
+
+							<el-tooltip effect="dark" content="分享" placement="top">
+    					  <div class="t_b_Item" @click="shareCourse(item.courseId)">
+									<img src="../../assets/icon/course/share.svg">
+								</div>
+    					</el-tooltip>
+
+							<!-- v-if="role == '1'" -->
+              <!-- <div @click="get(item)">预览</div> -->
               <!-- <div @click="jump(item.courseId)" v-else>评课</div> -->
-              <div v-if="((item.userid == userid) ||
+              <!-- <div v-if="((item.userid == userid) ||
                 (item.course_teacher &&
                   item.course_teacher.indexOf(userid) !== -1) || role == '1') &&
                 item.state == 1
@@ -237,7 +287,7 @@
                 item.state == 3
                 " @click="goToCourse3(item.courseId)">
                 修改
-              </div>
+              </div> -->
               <!-- <div v-if="groupA == '0'" @click="
                 goTo(
                   '/works?cid=' +
@@ -254,12 +304,12 @@
                 ">
                 评价
               </div> -->
-              <div @click="copyCourse(item.courseId)">
+              <!-- <div @click="copyCourse(item.courseId)">
                 复制
               </div>
               <div v-if="item.isCourseType == 1 || role == '1'" @click="deleteCourse(item.courseId)">
                 删除
-              </div>
+              </div> -->
               <!-- <div class="more">
                 <span style="font-size: 18px; font-weight: 700">...</span>
                 <div>
@@ -334,6 +384,7 @@
         <el-button @click="dialogVisibleCourse = false">关 闭</el-button>
       </span>
     </el-dialog>
+		<shareDialog ref="shareDialogRef"/>
   </div>
 </template>
 
@@ -341,8 +392,9 @@
 import "../../common/aws-sdk-2.235.1.min";
 import EditorBar from "../../components/tools/wangEnduit";
 import CourseProblem from "./components/courseProblem";
+import shareDialog from './dialog/shareDialog.vue'
 export default {
-  components: { EditorBar, CourseProblem },
+  components: { EditorBar, CourseProblem,shareDialog },
   data() {
     return {
       itemCount: 1,
@@ -396,6 +448,10 @@ export default {
     };
   },
   methods: {
+		// 分析按钮
+		shareCourse(courseId){
+			this.$refs.shareDialogRef.open(courseId)
+		},
     change(val) {
       console.log(val);
     },
@@ -1601,7 +1657,8 @@ export default {
 .three_bottom {
   display: flex;
   flex-direction: row;
-  justify-content: space-around;
+  /* justify-content: space-around; */
+	justify-content: flex-end;
   height: 45px;
   align-items: center;
   background: #fff;
@@ -1610,7 +1667,29 @@ export default {
   box-sizing: border-box;
 }
 
-.three_bottom>div {
+.t_b_Item{
+	width: 30px;
+	height: 30px;
+	background-color: white;
+	border-radius: 2px;
+	display: flex;
+	justify-content: center;
+	align-items: center;
+	transition: .3s;
+	margin-right: 10px;
+	cursor: pointer;
+}
+
+.t_b_Item:hover{
+	background-color: #E8E8E8;
+}
+
+.t_b_Item>img{
+	width: 80%;
+	height: 80%;
+}
+
+/* .three_bottom>div {
   cursor: pointer;
   width: 100%;
   text-align: center;
@@ -1618,12 +1697,12 @@ export default {
 
 .three_bottom>div+div {
   border-left: 1px solid #ddd;
-}
+} */
 
-.three_bottom>div:hover {
+/* .three_bottom>div:hover {
   color: #3681FC;
   font-weight: bold;
-}
+} */
 
 .three_bottom .deleteB {
   color: #E96E6E;

+ 477 - 0
src/components/pages/dialog/shareDialog.vue

@@ -0,0 +1,477 @@
+<template>
+  <div>
+    <el-dialog
+      title="分享设置"
+      :visible.sync="dialogVisible"
+      width="600px"
+      v-loading="loading"
+    >
+      <!-- <div class="shareContent">
+        <div class="sc_formItemDate">
+          <div>有效期:</div>
+          <el-radio
+            class="sc_fd_radio"
+            :disabled="form.id ? true : false"
+            v-model="date"
+            label="7"
+            >7天</el-radio
+          >
+          <el-radio
+            class="sc_fd_radio"
+            :disabled="form.id ? true : false"
+            v-model="date"
+            label="31"
+            >31天</el-radio
+          >
+          <el-radio
+            class="sc_fd_radio"
+            :disabled="form.id ? true : false"
+            v-model="date"
+            label="0"
+            >永久有效</el-radio
+          >
+        </div>
+
+        <div class="sc_formAuthorityItem">
+          <el-switch
+            class="sc_fai_switch"
+            :disabled="form.id ? true : false"
+            v-model="form.setPassword"
+            active-text="密码设置"
+          >
+          </el-switch>
+          <el-input
+            class="sc_fai_input"
+            :disabled="!form.setPassword || form.id ? true : false"
+            placeholder="请输入密码"
+            v-model="form.password"
+          ></el-input>
+          <span>仅支持数字及英文字母</span>
+        </div>
+
+        <div class="sc_formAuthorityItem">
+          <el-switch
+            class="sc_fai_switch"
+            :disabled="form.id ? true : false"
+            v-model="form.setStudentLook"
+            active-text="查看学生作业权限"
+          >
+          </el-switch>
+          <el-radio
+            class="sc_fai_radio"
+            :disabled="!form.setStudentLook || form.id ? true : false"
+            v-model="form.studentLook"
+            label="0"
+            >显示学生姓名</el-radio
+          >
+          <el-radio
+            class="sc_fai_radio"
+            :disabled="!form.setStudentLook || form.id ? true : false"
+            v-model="form.studentLook"
+            label="1"
+            >不显示学生真实姓名</el-radio
+          >
+        </div>
+
+        <div class="sc_formAuthorityItem">
+          <el-switch
+            class="sc_fai_switch"
+            :disabled="form.id ? true : false"
+            v-model="form.setComment"
+            active-text="评论权限"
+          >
+          </el-switch>
+          <el-radio
+            class="sc_fai_radio"
+            :disabled="!form.setComment || form.id ? true : false"
+            v-model="form.comment"
+            label="0"
+            >组织内人员</el-radio
+          >
+          <el-radio
+            class="sc_fai_radio"
+            :disabled="!form.setComment || form.id ? true : false"
+            v-model="form.comment"
+            label="1"
+            >所有人(包括游客用户)</el-radio
+          >
+        </div>
+
+        <div class="sc_formAuthorityItem">
+          <el-switch
+            class="sc_fai_switch"
+            :disabled="form.id ? true : false"
+            v-model="form.setDownload"
+            active-text="课程资源下载权限"
+          >
+          </el-switch>
+          <el-radio
+            class="sc_fai_radio"
+            :disabled="!form.setDownload || form.id ? true : false"
+            v-model="form.download"
+            label="0"
+            >组织内人员</el-radio
+          >
+          <el-radio
+            class="sc_fai_radio"
+            :disabled="!form.setDownload || form.id ? true : false"
+            v-model="form.download"
+            label="1"
+            >所有人(包括游客用户)</el-radio
+          >
+        </div>
+
+        <div class="sc_formAuthorityItem">
+          <el-switch
+            class="sc_fai_switch"
+            :disabled="form.id ? true : false"
+            v-model="form.setHomeWorkUpload"
+            active-text="作业上传权限"
+          >
+          </el-switch>
+          <span>仅组织内成员可使用工具上传内容</span>
+        </div>
+      </div> -->
+
+      <div class="sc_formUrl" v-show="form.url">
+        <el-input
+          class="sc_fu_input"
+          style="color: black"
+          disabled
+          v-model="form.url"
+        >
+          <template slot="append"
+            ><div class="sc_fu_copyBtn" @click.stop="copyUrl()">
+              复制链接
+            </div></template
+          >
+        </el-input>
+        <div class="qrcode" ref="qrCodeRef"></div>
+				<el-link class="qrcodeBtn" type="primary" @click="downloadQrCode()">下载二维码</el-link>
+      </div>
+      <span slot="footer" class="shareFooter">
+        <el-button @click="close()">取 消</el-button>
+        <!-- <el-button type="primary" v-if="!form.id" @click="generate()"
+					>生成</el-button
+				>
+				<el-button type="primary" v-else @click="resetGenerate()"
+					>重置生成</el-button
+				> -->
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import QRCode from "qrcodejs2";
+export default {
+  data() {
+    return {
+      dialogVisible: false,
+      loading: false,
+      date: "0",
+      courseId: "",
+      form: {
+        setPassword: false,
+        password: "",
+        setStudentLook: false,
+        studentLook: "1",
+        setComment: false,
+        comment: "1",
+        setDownload: false,
+        download: "1",
+        setHomeWorkUpload: false,
+        url: ""
+      }
+    };
+  },
+  watch: {
+    "form.url"(newValue) {
+      this.$nextTick(() => {
+        this.$refs.qrCodeRef.innerHTML = "";
+        if (!newValue) return;
+        new QRCode(this.$refs.qrCodeRef, {
+          text: `https://beta.cloud.cocorobo.cn/#/?shareCourseId=${this.courseId}`, // 需要转换为二维码的内容
+          width: 100,
+          height: 100,
+          colorDark: "#000000",
+          colorLight: "#ffffff",
+          correctLevel: QRCode.CorrectLevel.H
+        });
+      });
+    }
+  },
+  methods: {
+    open(courseId) {
+      this.courseId = courseId;
+      this.dialogVisible = true;
+      this.form.id = "default";
+      this.form.url = `https://beta.cloud.cocorobo.cn/#/?shareCourseId=${this.courseId}`;
+      // this.getData();
+    },
+    close() {
+      this.dialogVisible = false;
+      this.form = {
+        setPassword: false,
+        password: "",
+        setStudentLook: false,
+        studentLook: "1",
+        setComment: false,
+        comment: "1",
+        setDownload: false,
+        download: "1",
+        setHomeWorkUpload: false,
+        url: ""
+      };
+      this.date = "0";
+      this.courseId = "";
+    },
+    generate() {
+      if (!this.courseId) return this.$message.error("错误:无课程ID");
+      if (this.loading) return;
+      this.loading = true;
+      if (this.form.setPassword) {
+        // 判断密码是否没输入
+        if (!this.form.password) {
+          this.loading = false;
+          return this.$message.error("请输入密码");
+        }
+        // 判断密码是否符合规则
+        const reg = /^[A-Za-z0-9]+$/;
+        if (!reg.test(this.form.password)) {
+          this.loading = false;
+          return this.$message.error("密码仅支持数字及英文字母");
+        }
+      }
+      this.form.url = `https://beta.cloud.cocorobo.cn/#/?shareCourseId=${this.courseId}`;
+      let pram = [
+        {
+          cid: this.courseId,
+          jsonData: JSON.stringify(this.form),
+          date: this.date,
+          type: 1
+        }
+      ];
+      this.ajax
+        .post(this.$store.state.api + "addShareCourse", pram)
+        .then(res => {
+          if (res.data == 1) {
+            this.$message.success("生成成功");
+          } else {
+            this.$message.error("生成失败");
+          }
+          this.getData();
+        })
+        .catch(err => {
+          console.log(err);
+          this.$message.error("生成失败");
+          this.getData();
+          this.loading = false;
+        });
+
+      // this.$message.success("生成成功");
+      this.loading = false;
+    },
+    resetGenerate() {
+      this.$confirm("此操作将重置分享链接, 是否继续?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        this.loading = true;
+        let pram = [
+          {
+            cid: this.courseId,
+            type: 1
+          }
+        ];
+        this.ajax
+          .post(this.$store.state.api + "delShareCourse", pram)
+          .then(res => {
+            if (res.data == 1) {
+              this.$message.success("重置成功");
+            } else {
+              this.$message.error("重置失败");
+            }
+            this.getData();
+          })
+          .catch(err => {
+            console.log(err);
+            this.$message.error("重置失败");
+            this.getData();
+            this.loading = false;
+          });
+        // this.form = {
+        // 	setPassword: false,
+        // 	password: "",
+        // 	setStudentLook: false,
+        // 	studentLook: "1",
+        // 	setComment: false,
+        // 	comment: "1",
+        // 	setDownload: false,
+        // 	download: "1",
+        // 	setHomeWorkUpload: false,
+        // 	url: "",
+        // };
+        // this.date = "0";
+        // this.$message.success('重置成功')
+      });
+    },
+    copyUrl() {
+      if (!this.form.url) {
+        return this.$message.info("请先生成链接");
+      }
+      const input = document.createElement("input");
+      // 设置 display为none会导致无法复制
+      // input.style.display = "none";
+      // 所以只能用其他方法隐藏
+      input.style.opacity = 0;
+      // 为了不影响布局
+      input.style.position = "fixed";
+      input.style.left = "-100%";
+      input.style.top = "-100%";
+      input.value = this.form.url;
+      document.body.appendChild(input);
+      input.select();
+      const success = document.execCommand("copy");
+      document.body.removeChild(input);
+      if (!success) {
+        return this.$message.error("复制失败");
+      } else {
+        return this.$message.success("复制成功");
+      }
+    },
+    getData() {
+      this.form = {
+        setPassword: false,
+        password: "",
+        setStudentLook: false,
+        studentLook: "1",
+        setComment: false,
+        comment: "1",
+        setDownload: false,
+        download: "1",
+        setHomeWorkUpload: false,
+        url: ""
+      };
+      this.date = "0";
+      this.loading = true;
+      // 这里查询数据库是否有数据
+      this.ajax
+        .get(this.$store.state.api + "getShareCourse", {
+          cid: this.courseId,
+          type: 1
+        })
+        .then(res => {
+          let _data = res.data[0];
+          if (_data.length == 0) return (this.loading = false);
+          let jsonData = _data[0].json ? JSON.parse(_data[0].json) : {};
+          this.form = { ...jsonData, id: _data[0].id };
+          this.date = _data[0].time;
+          this.loading = false;
+        })
+        .catch(err => {
+          this.loading = false;
+          console.error(err);
+        });
+    },
+		downloadQrCode(){
+			let canvas = this.$refs.qrCodeRef.getElementsByTagName('canvas')[0];
+			let ctx = canvas.getContext('2d');
+
+			// 创建一个新的canvas,大小为原来的两倍
+			var newCanvas = document.createElement("canvas");
+			newCanvas.width = canvas.width * 2;
+			newCanvas.height = canvas.height * 2;
+
+			// 获取新canvas的context,并绘制原来的canvas到新canvas上
+			var newCtx = newCanvas.getContext("2d");
+			newCtx.drawImage(canvas, 0, 0, newCanvas.width, newCanvas.height);
+
+			// 创建一个链接来下载图片
+			var link = document.createElement("a");
+			link.download = "课程分享二维码.png";
+			link.href = newCanvas.toDataURL();
+			link.click();
+		}
+  }
+};
+</script>
+
+<style scoped>
+.shareContent {
+  width: 600px;
+  max-width: 600px;
+  height: auto;
+}
+
+.shareFooter {
+  display: flex;
+  justify-content: flex-end;
+}
+
+.sc_formItemDate {
+  width: 100%;
+  height: auto;
+  display: flex;
+  align-items: center;
+  margin: 10px 0;
+}
+
+.sc_fd_radio {
+  margin-left: 55px;
+}
+
+.sc_formAuthorityItem {
+  margin-top: 30px;
+  margin-bottom: 20px;
+}
+
+.sc_formAuthorityItem > span {
+  font-size: 14px;
+  color: #7f7f7f;
+  margin-left: 20px;
+}
+
+.sc_fai_switch {
+  width: 190px;
+}
+
+.sc_fai_input {
+  width: 120px;
+  text-align: center;
+  margin-left: 20px;
+}
+
+.sc_fai_radio {
+  width: 120px;
+  margin-left: 20px;
+}
+.sc_fu_copyBtn {
+  color: black;
+  cursor: pointer;
+}
+
+.qrcode {
+  width: 100px;
+  height: 100px;
+  margin-top: 20px;
+}
+
+.sc_fu_input /deep/.el-input__inner {
+  color: black !important;
+  cursor: text !important;
+}
+
+.sc_fu_input >>> .el-input__inner {
+  color: black !important;
+  cursor: text !important;
+}
+
+.qrcodeBtn{
+	width: 100px;
+	display: flex;
+	justify-content: center;
+	margin-top: 10px;
+}
+</style>

Некоторые файлы не были показаны из-за большого количества измененных файлов