diff --git a/my-project-backend/src/main/java/com/example/entity/dto/TopicType.java b/my-project-backend/src/main/java/com/example/entity/dto/TopicType.java index d09ae15..844e456 100644 --- a/my-project-backend/src/main/java/com/example/entity/dto/TopicType.java +++ b/my-project-backend/src/main/java/com/example/entity/dto/TopicType.java @@ -12,4 +12,5 @@ public class TopicType implements BaseData { String name; @TableField("`desc`") String desc; + String color; } diff --git a/my-project-backend/src/main/java/com/example/entity/vo/response/TopicTypeVO.java b/my-project-backend/src/main/java/com/example/entity/vo/response/TopicTypeVO.java index 2adb0cc..eef51ec 100644 --- a/my-project-backend/src/main/java/com/example/entity/vo/response/TopicTypeVO.java +++ b/my-project-backend/src/main/java/com/example/entity/vo/response/TopicTypeVO.java @@ -7,4 +7,5 @@ public class TopicTypeVO { int id; String name; String desc; + String color; } diff --git a/my-project-backend/src/main/resources/application-dev.yml b/my-project-backend/src/main/resources/application-dev.yml index c0b5e18..4af430e 100644 --- a/my-project-backend/src/main/resources/application-dev.yml +++ b/my-project-backend/src/main/resources/application-dev.yml @@ -4,17 +4,20 @@ springdoc: swagger-ui: operations-sorter: alpha spring: + data: + redis: + host: 192.168.0.8 mail: host: smtp.163.com username: javastudy111@163.com password: QGLYGBVECIASGPWQ rabbitmq: - addresses: localhost + addresses: 192.168.0.8 username: admin password: admin virtual-host: / datasource: - url: jdbc:mysql://localhost:3306/test + url: jdbc:mysql://192.168.0.8:3306/test username: root password: 123456 driver-class-name: com.mysql.cj.jdbc.Driver @@ -40,7 +43,7 @@ spring: credentials: false methods: '*' minio: - endpoint: 'http://localhost:9000' + endpoint: 'http://192.168.0.8:9000' username: 'minio' password: 'password' weather: diff --git a/my-project-backend/src/main/resources/application.yml b/my-project-backend/src/main/resources/application.yml index 2ddba41..8fb403d 100644 --- a/my-project-backend/src/main/resources/application.yml +++ b/my-project-backend/src/main/resources/application.yml @@ -1,3 +1,7 @@ spring: profiles: active: '@environment@' + servlet: + multipart: + max-file-size: 10MB + max-request-size: 10MB diff --git a/my-project-frontend/src/components/TopicEditor.vue b/my-project-frontend/src/components/TopicEditor.vue index f93fcd7..00da360 100644 --- a/my-project-frontend/src/components/TopicEditor.vue +++ b/my-project-frontend/src/components/TopicEditor.vue @@ -3,24 +3,25 @@ import {Document} from "@element-plus/icons-vue"; import {QuillEditor, Quill} from "@vueup/vue-quill"; import {computed, reactive, ref} from "vue"; import '@vueup/vue-quill/dist/vue-quill.snow.css'; -import {accessHeader, get, post} from "@/net"; +import {accessHeader, post} from "@/net"; import axios from "axios"; import {ElMessage} from "element-plus"; import ImageResize from "quill-image-resize-vue"; import { ImageExtend, QuillWatch } from "quill-image-super-solution-module"; +import {useStore} from "@/store"; defineProps({ show: Boolean }) const emit = defineEmits(['close', 'created']) +const store = useStore() + const refEditor = ref() const editor = reactive({ type: null, title: '', text: '', uploading: false, - types: [] }) -get('/api/forum/types', data => editor.types = data) function initEditor() { refEditor.value.setContents('', 'user') @@ -132,8 +133,8 @@ const editorOption = {
- - + +
diff --git a/my-project-frontend/src/store/index.js b/my-project-frontend/src/store/index.js index de1ff23..8304251 100644 --- a/my-project-frontend/src/store/index.js +++ b/my-project-frontend/src/store/index.js @@ -10,6 +10,9 @@ export const useStore = defineStore('general', { role: '', registerTime: null, avatar: null + }, + forum: { + types: [] } } }, getters: { @@ -19,5 +22,9 @@ export const useStore = defineStore('general', { else return 'https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png' } + }, actions: { + findTypeById(id) { + return this.forum.types[id - 1] + } } }) diff --git a/my-project-frontend/src/views/forum/TopicList.vue b/my-project-frontend/src/views/forum/TopicList.vue index 12bd121..c4ee9f4 100644 --- a/my-project-frontend/src/views/forum/TopicList.vue +++ b/my-project-frontend/src/views/forum/TopicList.vue @@ -6,6 +6,9 @@ import Weather from "@/components/Weather.vue"; import {get} from "@/net"; import {ElMessage} from "element-plus"; import TopicEditor from "@/components/TopicEditor.vue"; +import {useStore} from "@/store"; + +const store = useStore() const weather = reactive({ now: {}, @@ -20,7 +23,13 @@ const today = computed(() => { const date = new Date() return `${date.getFullYear()} 年 ${date.getMonth() + 1} 月 ${date.getDate()} 日` }) -get('/api/forum/list-topic?page=0&type=0', data => list.value = data) + +function updateList() { + get('/api/forum/list-topic?page=0&type=0', data => list.value = data) +} + +updateList() +get('/api/forum/types', data => store.forum.types = data) navigator.geolocation.getCurrentPosition(position => { const latitude = position.coords.latitude @@ -47,19 +56,37 @@ navigator.geolocation.getCurrentPosition(position => {
-
点击发表主题...
+
+ + + + 点击发表主题... +
- -
{{item.title}}
-
{{item.text}}
+ +
+
+ {{ store.findTypeById(item.type)?.name }} +
+ {{ item.title }} +
+
{{ item.text }}
+
+ +
- + + + 论坛公告
@@ -70,7 +97,9 @@ navigator.geolocation.getCurrentPosition(position => {
- + + + 天气信息
@@ -79,7 +108,7 @@ navigator.geolocation.getCurrentPosition(position => {
当前日期
-
{{today}}
+
{{ today }}
当前IP地址
@@ -87,28 +116,61 @@ navigator.geolocation.getCurrentPosition(position => {
- + + + 友情链接
- +