完成前端帖子列表样式编写
This commit is contained in:
parent
863f81a3b3
commit
e2c9e21fb4
@ -12,4 +12,5 @@ public class TopicType implements BaseData {
|
|||||||
String name;
|
String name;
|
||||||
@TableField("`desc`")
|
@TableField("`desc`")
|
||||||
String desc;
|
String desc;
|
||||||
|
String color;
|
||||||
}
|
}
|
||||||
|
@ -7,4 +7,5 @@ public class TopicTypeVO {
|
|||||||
int id;
|
int id;
|
||||||
String name;
|
String name;
|
||||||
String desc;
|
String desc;
|
||||||
|
String color;
|
||||||
}
|
}
|
||||||
|
@ -4,17 +4,20 @@ springdoc:
|
|||||||
swagger-ui:
|
swagger-ui:
|
||||||
operations-sorter: alpha
|
operations-sorter: alpha
|
||||||
spring:
|
spring:
|
||||||
|
data:
|
||||||
|
redis:
|
||||||
|
host: 192.168.0.8
|
||||||
mail:
|
mail:
|
||||||
host: smtp.163.com
|
host: smtp.163.com
|
||||||
username: javastudy111@163.com
|
username: javastudy111@163.com
|
||||||
password: QGLYGBVECIASGPWQ
|
password: QGLYGBVECIASGPWQ
|
||||||
rabbitmq:
|
rabbitmq:
|
||||||
addresses: localhost
|
addresses: 192.168.0.8
|
||||||
username: admin
|
username: admin
|
||||||
password: admin
|
password: admin
|
||||||
virtual-host: /
|
virtual-host: /
|
||||||
datasource:
|
datasource:
|
||||||
url: jdbc:mysql://localhost:3306/test
|
url: jdbc:mysql://192.168.0.8:3306/test
|
||||||
username: root
|
username: root
|
||||||
password: 123456
|
password: 123456
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
@ -40,7 +43,7 @@ spring:
|
|||||||
credentials: false
|
credentials: false
|
||||||
methods: '*'
|
methods: '*'
|
||||||
minio:
|
minio:
|
||||||
endpoint: 'http://localhost:9000'
|
endpoint: 'http://192.168.0.8:9000'
|
||||||
username: 'minio'
|
username: 'minio'
|
||||||
password: 'password'
|
password: 'password'
|
||||||
weather:
|
weather:
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
spring:
|
spring:
|
||||||
profiles:
|
profiles:
|
||||||
active: '@environment@'
|
active: '@environment@'
|
||||||
|
servlet:
|
||||||
|
multipart:
|
||||||
|
max-file-size: 10MB
|
||||||
|
max-request-size: 10MB
|
||||||
|
@ -3,24 +3,25 @@ import {Document} from "@element-plus/icons-vue";
|
|||||||
import {QuillEditor, Quill} from "@vueup/vue-quill";
|
import {QuillEditor, Quill} from "@vueup/vue-quill";
|
||||||
import {computed, reactive, ref} from "vue";
|
import {computed, reactive, ref} from "vue";
|
||||||
import '@vueup/vue-quill/dist/vue-quill.snow.css';
|
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 axios from "axios";
|
||||||
import {ElMessage} from "element-plus";
|
import {ElMessage} from "element-plus";
|
||||||
import ImageResize from "quill-image-resize-vue";
|
import ImageResize from "quill-image-resize-vue";
|
||||||
import { ImageExtend, QuillWatch } from "quill-image-super-solution-module";
|
import { ImageExtend, QuillWatch } from "quill-image-super-solution-module";
|
||||||
|
import {useStore} from "@/store";
|
||||||
|
|
||||||
defineProps({ show: Boolean })
|
defineProps({ show: Boolean })
|
||||||
const emit = defineEmits(['close', 'created'])
|
const emit = defineEmits(['close', 'created'])
|
||||||
|
|
||||||
|
const store = useStore()
|
||||||
|
|
||||||
const refEditor = ref()
|
const refEditor = ref()
|
||||||
const editor = reactive({
|
const editor = reactive({
|
||||||
type: null,
|
type: null,
|
||||||
title: '',
|
title: '',
|
||||||
text: '',
|
text: '',
|
||||||
uploading: false,
|
uploading: false,
|
||||||
types: []
|
|
||||||
})
|
})
|
||||||
get('/api/forum/types', data => editor.types = data)
|
|
||||||
|
|
||||||
function initEditor() {
|
function initEditor() {
|
||||||
refEditor.value.setContents('', 'user')
|
refEditor.value.setContents('', 'user')
|
||||||
@ -132,8 +133,8 @@ const editorOption = {
|
|||||||
</template>
|
</template>
|
||||||
<div style="display: flex;gap: 10px">
|
<div style="display: flex;gap: 10px">
|
||||||
<div style="width: 120px">
|
<div style="width: 120px">
|
||||||
<el-select placeholder="选择类型..." v-model="editor.type" :disabled="!editor.types.length">
|
<el-select placeholder="选择类型..." v-model="editor.type" :disabled="!store.forum.types.length">
|
||||||
<el-option v-for="item in editor.types" :value="item.id" :label="item.name"/>
|
<el-option v-for="item in store.forum.types" :value="item.id" :label="item.name"/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
<div style="flex: 1">
|
<div style="flex: 1">
|
||||||
|
@ -10,6 +10,9 @@ export const useStore = defineStore('general', {
|
|||||||
role: '',
|
role: '',
|
||||||
registerTime: null,
|
registerTime: null,
|
||||||
avatar: null
|
avatar: null
|
||||||
|
},
|
||||||
|
forum: {
|
||||||
|
types: []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, getters: {
|
}, getters: {
|
||||||
@ -19,5 +22,9 @@ export const useStore = defineStore('general', {
|
|||||||
else
|
else
|
||||||
return 'https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png'
|
return 'https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png'
|
||||||
}
|
}
|
||||||
|
}, actions: {
|
||||||
|
findTypeById(id) {
|
||||||
|
return this.forum.types[id - 1]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -6,6 +6,9 @@ import Weather from "@/components/Weather.vue";
|
|||||||
import {get} from "@/net";
|
import {get} from "@/net";
|
||||||
import {ElMessage} from "element-plus";
|
import {ElMessage} from "element-plus";
|
||||||
import TopicEditor from "@/components/TopicEditor.vue";
|
import TopicEditor from "@/components/TopicEditor.vue";
|
||||||
|
import {useStore} from "@/store";
|
||||||
|
|
||||||
|
const store = useStore()
|
||||||
|
|
||||||
const weather = reactive({
|
const weather = reactive({
|
||||||
now: {},
|
now: {},
|
||||||
@ -20,7 +23,13 @@ const today = computed(() => {
|
|||||||
const date = new Date()
|
const date = new Date()
|
||||||
return `${date.getFullYear()} 年 ${date.getMonth() + 1} 月 ${date.getDate()} 日`
|
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 => {
|
navigator.geolocation.getCurrentPosition(position => {
|
||||||
const latitude = position.coords.latitude
|
const latitude = position.coords.latitude
|
||||||
@ -47,19 +56,37 @@ navigator.geolocation.getCurrentPosition(position => {
|
|||||||
<div style="flex: 1">
|
<div style="flex: 1">
|
||||||
<light-card>
|
<light-card>
|
||||||
<div class="edit-topic">
|
<div class="edit-topic">
|
||||||
<div @click="editor = true"><el-icon><EditPen/></el-icon> 点击发表主题...</div>
|
<div @click="editor = true">
|
||||||
|
<el-icon>
|
||||||
|
<EditPen/>
|
||||||
|
</el-icon>
|
||||||
|
点击发表主题...
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</light-card>
|
</light-card>
|
||||||
<light-card v-for="item in list" style="margin-top: 10px">
|
<light-card v-for="item in list" class="topic-card">
|
||||||
<div>{{item.title}}</div>
|
<div>
|
||||||
<div>{{item.text}}</div>
|
<div class="topic-type"
|
||||||
|
:style="{color: store.findTypeById(item.type)?.color+'EE',
|
||||||
|
'border-color': store.findTypeById(item.type)?.color+'EE',
|
||||||
|
'background-color': store.findTypeById(item.type)?.color+'22'}">
|
||||||
|
{{ store.findTypeById(item.type)?.name }}
|
||||||
|
</div>
|
||||||
|
<span style="margin-left: 7px;font-weight: bold">{{ item.title }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="topic-preview-content">{{ item.text }}</div>
|
||||||
|
<div style="display: grid;grid-template-columns: repeat(3, 1fr);grid-gap: 10px">
|
||||||
|
<el-image v-for="img in item.images" :src="img" class="topic-image"></el-image>
|
||||||
|
</div>
|
||||||
</light-card>
|
</light-card>
|
||||||
</div>
|
</div>
|
||||||
<div style="width: 280px">
|
<div style="width: 280px">
|
||||||
<div style="position: sticky;top: 20px">
|
<div style="position: sticky;top: 20px">
|
||||||
<light-card>
|
<light-card>
|
||||||
<div style="font-weight: bold;">
|
<div style="font-weight: bold;">
|
||||||
<el-icon><CollectionTag/></el-icon>
|
<el-icon>
|
||||||
|
<CollectionTag/>
|
||||||
|
</el-icon>
|
||||||
论坛公告
|
论坛公告
|
||||||
</div>
|
</div>
|
||||||
<el-divider style="margin: 10px 0"/>
|
<el-divider style="margin: 10px 0"/>
|
||||||
@ -70,7 +97,9 @@ navigator.geolocation.getCurrentPosition(position => {
|
|||||||
</light-card>
|
</light-card>
|
||||||
<light-card style="margin-top: 10px">
|
<light-card style="margin-top: 10px">
|
||||||
<div style="font-weight: bold;">
|
<div style="font-weight: bold;">
|
||||||
<el-icon><Calendar /></el-icon>
|
<el-icon>
|
||||||
|
<Calendar/>
|
||||||
|
</el-icon>
|
||||||
天气信息
|
天气信息
|
||||||
</div>
|
</div>
|
||||||
<el-divider style="margin: 10px 0"/>
|
<el-divider style="margin: 10px 0"/>
|
||||||
@ -79,7 +108,7 @@ navigator.geolocation.getCurrentPosition(position => {
|
|||||||
<light-card style="margin-top: 10px">
|
<light-card style="margin-top: 10px">
|
||||||
<div style="display: flex;justify-content: space-between;color: grey;font-size: 14px">
|
<div style="display: flex;justify-content: space-between;color: grey;font-size: 14px">
|
||||||
<div>当前日期</div>
|
<div>当前日期</div>
|
||||||
<div>{{today}}</div>
|
<div>{{ today }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="display: flex;justify-content: space-between;color: grey;font-size: 14px">
|
<div style="display: flex;justify-content: space-between;color: grey;font-size: 14px">
|
||||||
<div>当前IP地址</div>
|
<div>当前IP地址</div>
|
||||||
@ -87,28 +116,61 @@ navigator.geolocation.getCurrentPosition(position => {
|
|||||||
</div>
|
</div>
|
||||||
</light-card>
|
</light-card>
|
||||||
<div style="margin-top: 10px;color: grey;font-size: 14px">
|
<div style="margin-top: 10px;color: grey;font-size: 14px">
|
||||||
<el-icon><Link /></el-icon>
|
<el-icon>
|
||||||
|
<Link/>
|
||||||
|
</el-icon>
|
||||||
友情链接
|
友情链接
|
||||||
<el-divider style="margin: 10px 0"/>
|
<el-divider style="margin: 10px 0"/>
|
||||||
</div>
|
</div>
|
||||||
<div style="display: grid;grid-template-columns: repeat(2, 1fr);grid-gap: 10px;margin-top: 10px">
|
<div style="display: grid;grid-template-columns: repeat(2, 1fr);grid-gap: 10px;margin-top: 10px">
|
||||||
<div class="friend-link">
|
<div class="friend-link">
|
||||||
<el-image style="height: 100%" src="https://element-plus.org/images/js-design-banner.jpg"/>
|
<el-image src="https://element-plus.org/images/js-design-banner.jpg" style="height: 100%"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="friend-link">
|
<div class="friend-link">
|
||||||
<el-image style="height: 100%" src="https://element-plus.org/images/vform-banner.png"/>
|
<el-image src="https://element-plus.org/images/vform-banner.png" style="height: 100%"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="friend-link">
|
<div class="friend-link">
|
||||||
<el-image style="height: 100%" src="https://element-plus.org/images/sponsors/jnpfsoft.jpg"/>
|
<el-image src="https://element-plus.org/images/sponsors/jnpfsoft.jpg" style="height: 100%"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<topic-editor :show="editor" @close="editor = false" @created="editor = false"/>
|
<topic-editor :show="editor" @close="editor = false" @created="editor = false;updateList()"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
|
.topic-card {
|
||||||
|
margin-top: 10px;
|
||||||
|
transition: scale .3s;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
scale: 1.02;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.topic-type {
|
||||||
|
display: inline-block;
|
||||||
|
border: solid 1px grey;
|
||||||
|
border-radius: 5px;
|
||||||
|
font-size: 12px;
|
||||||
|
padding: 0 5px;
|
||||||
|
height: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.topic-preview-content {
|
||||||
|
font-size: 13px;
|
||||||
|
color: grey;
|
||||||
|
margin: 10px;
|
||||||
|
display: -webkit-box;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
-webkit-line-clamp: 3;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.friend-link {
|
.friend-link {
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
@ -128,7 +190,7 @@ navigator.geolocation.getCurrentPosition(position => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.dark .edit-topic{
|
.dark .edit-topic {
|
||||||
background-color: #282828;
|
background-color: #282828;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user