Kaynağa Gözat

文件上传图片获取优化

Linyt 1 yıl önce
ebeveyn
işleme
8c6ded83d4

+ 13 - 0
java/src/main/java/boot/modules/calendar/controller/CalendarController.java

@@ -0,0 +1,13 @@
+package boot.modules.calendar.controller;
+
+import io.swagger.annotations.Api;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequiredArgsConstructor(onConstructor = @__(@Autowired))
+@Api(value = "日历模块", tags = "日历")
+public class CalendarController {
+
+}

+ 17 - 1
java/src/main/resources/sql/project.sql

@@ -32,4 +32,20 @@ create index level
     on user (level);
 
 create index status
-    on user (status);
+    on user (status);
+
+drop table if exists calendar;
+create table calendar
+(
+    id        bigint auto_increment primary key comment '日历表格id',
+    title     varchar(255) not null comment '活动 事件',
+    detail  varchar(255) null comment '详情',
+    start     date not null comment '活动 事件开始时间   2024-06-12T10:30:00为点状  2024-06-12为条状',
+    end       date not null comment '活动 事件结束时间   2024-06-12T10:30:00为点状  2024-06-12为条状',
+    overlap   boolean      null default false comment '该事件是否可以与其他事件并存',
+    editable  boolean      null default false comment '该事件是否允许拖动缩放',
+    color     varchar(100) null comment '背景颜色',
+    file      varchar(255) null comment '文件',
+    file_type varchar(50)  null comment '文件类型',
+    is_del    tinyint(1)        default 0 null comment '这条数据是否被删除 0未删除 1已删除'
+)

+ 2 - 2
java/target/classes/application.yml

@@ -15,7 +15,7 @@ single:
 
 # 图片或文件存放的地方 ( 选择你想存放的地方!!! )
 file:
-  #头像存放的位置
+  #头像存放的位置 格式 F:\File\学习\实训\upload\avatar\
   avatar : F:\File\学习\实训\upload\avatar\
-  #图片或文件存放的位置
+  #图片或文件存放的位置 格式 F:\File\学习\实训\upload\file\
   path : F:\File\学习\实训\upload\file\

BIN
java/target/classes/boot/modules/calendar/controller/CalendarController.class


+ 17 - 1
java/target/classes/sql/project.sql

@@ -32,4 +32,20 @@ create index level
     on user (level);
 
 create index status
-    on user (status);
+    on user (status);
+
+drop table if exists calendar;
+create table calendar
+(
+    id        bigint auto_increment primary key comment '日历表格id',
+    title     varchar(255) not null comment '活动 事件',
+    detail  varchar(255) null comment '详情',
+    start     date not null comment '活动 事件开始时间   2024-06-12T10:30:00为点状  2024-06-12为条状',
+    end       date not null comment '活动 事件结束时间   2024-06-12T10:30:00为点状  2024-06-12为条状',
+    overlap   boolean      null default false comment '该事件是否可以与其他事件并存',
+    editable  boolean      null default false comment '该事件是否允许拖动缩放',
+    color     varchar(100) null comment '背景颜色',
+    file      varchar(255) null comment '文件',
+    file_type varchar(50)  null comment '文件类型',
+    is_del    tinyint(1)        default 0 null comment '这条数据是否被删除 0未删除 1已删除'
+)

+ 9 - 0
vue_project/package-lock.json

@@ -32,6 +32,7 @@
         "element-plus": "^2.7.4",
         "js-cookie": "^3.0.5",
         "pinia": "^2.1.7",
+        "tippy.js": "^6.3.7",
         "vue": "^3.2.13",
         "vue-router": "^4.3.2"
       },
@@ -11700,6 +11701,14 @@
       "integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==",
       "dev": true
     },
+    "node_modules/tippy.js": {
+      "version": "6.3.7",
+      "resolved": "https://registry.npmmirror.com/tippy.js/-/tippy.js-6.3.7.tgz",
+      "integrity": "sha512-E1d3oP2emgJ9dRQZdf3Kkn0qJgI6ZLpyS5z6ZkY1DF3kaQaBsGZsndEpHwx+eC+tYM41HaSNvNtLx8tU57FzTQ==",
+      "dependencies": {
+        "@popperjs/core": "^2.9.0"
+      }
+    },
     "node_modules/to-fast-properties": {
       "version": "2.0.0",
       "resolved": "https://registry.npmmirror.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz",

+ 1 - 0
vue_project/package.json

@@ -31,6 +31,7 @@
     "element-plus": "^2.7.4",
     "js-cookie": "^3.0.5",
     "pinia": "^2.1.7",
+    "tippy.js": "^6.3.7",
     "vue": "^3.2.13",
     "vue-router": "^4.3.2"
   },

+ 79 - 60
vue_project/src/components/indexBody.vue

@@ -1,16 +1,24 @@
 <template>
-  <FullCalendar ref="fullCalendar" :options="calendarOptions" class="calendar" id="calendar" />
+  <FullCalendar
+    ref="fullCalendar"
+    :options="calendarOptions"
+    class="calendar"
+    id="calendar"
+  />
 </template>
 <script>
+import tippy from "tippy.js"; //引入 tippy.js
+import "tippy.js/dist/tippy.css"; //引入 tippy.js
+import "tippy.js/themes/light.css"; //引入主题
+import "tippy.js/animations/scale.css";
+
 import FullCalendar from "@fullcalendar/vue3";
 import dayGridPlugin from "@fullcalendar/daygrid";
 import timeGridPlugin from "@fullcalendar/timegrid";
 import interactionPlugin from "@fullcalendar/interaction";
 import listPlugin from "@fullcalendar/list";
 import multiMonthPlugin from "@fullcalendar/multimonth";
-import bootstrap5Plugin from '@fullcalendar/bootstrap5';
-
-
+import bootstrap5Plugin from "@fullcalendar/bootstrap5";
 
 export default {
   //import引入的组件需要注入到对象中才能使用
@@ -18,17 +26,24 @@ export default {
   data() {
     return {
       calendarOptions: {
-        plugins: [dayGridPlugin, timeGridPlugin, interactionPlugin, listPlugin, multiMonthPlugin, bootstrap5Plugin],
+        plugins: [
+          dayGridPlugin,
+          timeGridPlugin,
+          interactionPlugin,
+          listPlugin,
+          multiMonthPlugin,
+          bootstrap5Plugin,
+        ],
         initialView: "dayGridYear",
         locale: "zh",
         firstDay: 1,
         unselectAuto: true, //当点击页⾯⽇历以外的位置时,是否⾃动取消当前的选中状态。false是不取消
         selectable: true, //是否可以选中日历格
         editable: true,
-        
+
         buttonText: {
-          prev:"上一页",
-          next:"下一页",
+          prev: "上一页",
+          next: "下一页",
           today: "今天",
           month: "月",
           week: "周",
@@ -38,53 +53,53 @@ export default {
         headerToolbar: {
           left: "prev,next today",
           center: "title",
-          right: "dayGridYear,multiMonthYearGrid,multiMonthYearStack,dayGridMonth,timeGridWeek,timeGridDay listWeek",
+          right:
+            "dayGridYear,multiMonthYearGrid,multiMonthYearStack,dayGridMonth,timeGridWeek,timeGridDay listWeek",
           themeSystem: "bootstrap5",
         },
         views: {
           multiMonthYearGrid: {
-            type: 'multiMonthYear',
-            buttonText: '年(网格)'
+            type: "multiMonthYear",
+            buttonText: "年(网格)",
           },
           multiMonthYearStack: {
-            type: 'multiMonthYear',
-            buttonText: '年(叠)',
-            multiMonthMaxColumns: 1
+            type: "multiMonthYear",
+            buttonText: "年(叠)",
+            multiMonthMaxColumns: 1,
           },
           dayGridYear: {
-            buttonText: '年(连续的)'
-          }
+            buttonText: "年(连续的)",
+          },
         },
 
         height: 1150,
         validRange: this.validRange, //设置可显示的总日期范围
         events: [
-
-        {
-          id: 111,
-          title: "国庆节放假",
-          start: "2024-10-01",
-          end: "2024-10-08",
-          color: "#ffcc99",
-          editable: true, //允许拖动缩放,不写默认就是false
-          overlap: true, //允许时间重叠,即可以与其他事件并存,不写默认就是false
-        },
-        {
-          id: 222,
-          title: "五一劳动节放假",
-          start: "2024-05-01",
-          end: "2024-05-06",
-          color: "#ffcc99",
-          editable: true, //允许拖动缩放
-        },
-        {
-          id: 333,
-          title: "端午节放假",
-          start: "2024-06-08",
-          end: "2024-06-11",
-          color: "#ffcc99",
-          editable: true,
-        },
+          {
+            id: 111,
+            title: "国庆节放假",
+            start: "2024-10-01",
+            end: "2024-10-08",
+            color: "#ffcc99",
+            editable: true, //允许拖动缩放,不写默认就是false
+            overlap: true, //允许时间重叠,即可以与其他事件并存,不写默认就是false
+          },
+          {
+            id: 222,
+            title: "五一劳动节放假",
+            start: "2024-05-18 00:00:00",
+            end: "2024-05-18 00:00:00",
+            color: "#ffcc99",
+            editable: true, //允许拖动缩放
+          },
+          {
+            id: 333,
+            title: "端午节放假",
+            start: "2024-06-08",
+            end: "2024-06-11",
+            color: "#ffcc99",
+            editable: true,
+          },
         ], //背景色 (添加相同时间的背景色时颜色会重叠)
         datesSet: this.datesSet, //日期渲染;修改日期范围后触发
         eventMouseEnter: this.handleEventMouseEnter, //点击日程触发
@@ -92,10 +107,16 @@ export default {
         eventDrop: this.calendarEventDropOrResize, //拖动事件触发
         eventResize: this.calendarEventDropOrResize, //缩放事件触发
         displayEventTime: false, //不显示具体时间
-        themeSystem: 'bootstrap5',
+        themeSystem: "bootstrap5",
         aspectRatio: 1.2, //宽高比
-
-
+        eventDidMount: function (info) {
+          console.log('111',info);
+          var tooltip = new tippy(info.el, {
+            content: info.event.start, //悬浮框展示的内容
+            theme: "tomato", //自定义主题,//悬浮框主题,默认主题中的light主题(白底黑字)
+            allowHTML: true, //为true的时候,可以识别content中的html
+          });
+        },
       },
       validRange: {
         start: "2022-08-26",
@@ -108,23 +129,23 @@ export default {
       //注意:该方法在页面初始化时就会触发一次
       console.log(info);
       // this.search()  //请求本页数据
-      
     },
-    handleEventClick(info) { },
-    handleDateClick(info) { },
-    calendarEventDropOrResize(e) { 
-      console.log(e);
-      console.log(this.calendarOptions.events);
-      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
-      console.log(e.event.startStr);
-      console.log(e.event.endStr);
+    handleEventClick(info) {},
+    handleDateClick(info) {},
+    calendarEventDropOrResize(e) {
+      console.log("@", e);
+      console.log("@@", this.calendarOptions.events);
+      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;
+      console.log("@@@@", e.event.startStr);
+      console.log("@@@@@", e.event.endStr);
     },
   },
 };
-
 </script>
 
 <style scoped>
@@ -135,6 +156,4 @@ export default {
   margin-top: 70px;
   margin-bottom: 70px;
 }
-
-
 </style>

+ 8 - 1
vue_project/yarn.lock

@@ -1276,7 +1276,7 @@
   resolved "https://registry.npmmirror.com/@polka/url/-/url-1.0.0-next.25.tgz"
   integrity sha512-j7P6Rgr3mmtdkeDGTe0E/aYyWEWVtc5yFXtHCRHs28/jptDEWfaVOc5T7cblqy1XKPPfCxJc/8DwQ5YgLOZOVQ==
 
-"@popperjs/core@^2.11.8", "@popperjs/core@npm:@sxzz/popperjs-es@^2.11.7":
+"@popperjs/core@^2.11.8", "@popperjs/core@^2.9.0", "@popperjs/core@npm:@sxzz/popperjs-es@^2.11.7":
   version "2.11.8"
   resolved "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz"
   integrity sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==
@@ -6484,6 +6484,13 @@ thunky@^1.0.2:
   resolved "https://registry.npmmirror.com/thunky/-/thunky-1.1.0.tgz"
   integrity sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==
 
+tippy.js@^6.3.7:
+  version "6.3.7"
+  resolved "https://registry.npmmirror.com/tippy.js/-/tippy.js-6.3.7.tgz"
+  integrity sha512-E1d3oP2emgJ9dRQZdf3Kkn0qJgI6ZLpyS5z6ZkY1DF3kaQaBsGZsndEpHwx+eC+tYM41HaSNvNtLx8tU57FzTQ==
+  dependencies:
+    "@popperjs/core" "^2.9.0"
+
 to-fast-properties@^2.0.0:
   version "2.0.0"
   resolved "https://registry.npmmirror.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz"