Browse Source

图片上传以及显示

PrettyCat1 1 year ago
parent
commit
2f42b9a41d

BIN
vue_project/src/assets/images/captain.jpg


+ 19 - 6
vue_project/src/components/indexBody.vue

@@ -237,19 +237,22 @@ export default {
       //注意:该方法在页面初始化时就会触发一次
       console.log(info);
     },
+    // 拖动备注   缩放备注  自动修改备注信息
     calendarEventDropOrResize(e) {
-      console.log(e);
       const index = this.calendarOptions.events.findIndex(
         (item) => item.id == e.event.id
       );
-      console.log(this.calendarOptions.events[index]);
       this.calendarOptions.events[index].start = e.event.startStr;
       this.calendarOptions.events[index].end = e.event.endStr;
     },
     // 鼠标悬浮至日历触发事件
     handleEventMouseEnter(e) {
+      var imageUrl = require("@/assets/images/captain.jpg");
+      var images = '<div><img src="' + imageUrl + '"+alt="Your Image"/></div>';
       new tippy(e.el, {
         content:
+          images +
+          "<br>" +
           e.event.title +
           "<br>From:" +
           e.event.startStr +
@@ -281,17 +284,27 @@ export default {
     },
     // 确认添加备注事件
     confirm() {
+      if (this.form.name == null || this.form.name == "") {
+        this.$message({
+          type: "error",
+          message: "备注名称不能为空",
+        });
+        return;
+      }
       this.Visible = false;
       // 将备注加入日历中
-      let data = this.GetInfo == null || this.GetInfo == "" ? this.form.date[0] : this.GetInfo.event.id
+      let data =
+        this.GetInfo == null || this.GetInfo == ""
+          ? this.form.date[0]
+          : this.GetInfo.event.id;
       const idx = this.calendarOptions.events.findIndex(
         (item) => item.id == data
       );
-      if (idx>-1) {
+      if (idx > -1) {
         this.calendarOptions.events.splice(idx, 1);
       }
       this.calendarOptions.events.push({
-        id:data,
+        id: data,
         title: this.form.name,
         start: this.form.date[0],
         end: this.form.date[1],
@@ -318,7 +331,7 @@ export default {
     },
     // 进行操作选中
     operate(value) {
-      console.log(this.GetInfo.event.id);
+      this.operateSelect = "";
       this.changeInfo = false;
       if (value == "delete") {
         this.$confirm("是否删除当前备注, 是否继续?", "提示", {