星球加入标签
parent
13eea2f2d9
commit
73baf0a166
|
@ -10,10 +10,12 @@ declare module 'vue' {
|
||||||
NAffix: typeof import('naive-ui')['NAffix']
|
NAffix: typeof import('naive-ui')['NAffix']
|
||||||
NAvatar: typeof import('naive-ui')['NAvatar']
|
NAvatar: typeof import('naive-ui')['NAvatar']
|
||||||
NButton: typeof import('naive-ui')['NButton']
|
NButton: typeof import('naive-ui')['NButton']
|
||||||
|
NButtonGroup: typeof import('naive-ui')['NButtonGroup']
|
||||||
NCard: typeof import('naive-ui')['NCard']
|
NCard: typeof import('naive-ui')['NCard']
|
||||||
NCarousel: typeof import('naive-ui')['NCarousel']
|
NCarousel: typeof import('naive-ui')['NCarousel']
|
||||||
NCascader: typeof import('naive-ui')['NCascader']
|
NCascader: typeof import('naive-ui')['NCascader']
|
||||||
NCheckbox: typeof import('naive-ui')['NCheckbox']
|
NCheckbox: typeof import('naive-ui')['NCheckbox']
|
||||||
|
NCheckboxGroup: typeof import('naive-ui')['NCheckboxGroup']
|
||||||
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
|
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
|
||||||
NDatePicker: typeof import('naive-ui')['NDatePicker']
|
NDatePicker: typeof import('naive-ui')['NDatePicker']
|
||||||
NDivider: typeof import('naive-ui')['NDivider']
|
NDivider: typeof import('naive-ui')['NDivider']
|
||||||
|
|
|
@ -413,11 +413,12 @@ function handleDownload(index: number, item: any) {
|
||||||
v-for="(subItem, subIndex) in item.fileName.split(',')"
|
v-for="(subItem, subIndex) in item.fileName.split(',')"
|
||||||
:key="subIndex"
|
:key="subIndex"
|
||||||
title="点击下载"
|
title="点击下载"
|
||||||
class="text-[#4a5563] text-sm cursor-pointer flex items-center hover:text-[#4a5563]/80 my-1"
|
class="text-[#4a5563] text-sm flex items-center hover:text-[#4a5563]/80 my-1"
|
||||||
@click="handleDownload(subIndex, item)"
|
|
||||||
>
|
>
|
||||||
<FileChartColumn size="16" class="mr-1" />
|
<FileChartColumn size="16" class="mr-1" />
|
||||||
{{ subItem }}
|
<span class="truncate cursor-pointer" @click="handleDownload(subIndex, item)">
|
||||||
|
{{ subItem }}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="item.imageUrl" class="flex items-center my-1 gap-2">
|
<div v-if="item.imageUrl" class="flex items-center my-1 gap-2">
|
||||||
|
|
|
@ -171,7 +171,7 @@ function handleShowMessage() {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="text-sm text-[#4a5563] flex justify-center items-center my-4 cursor-pointer" @click="handleLogout">
|
<div class="text-sm text-[#4a5563] flex justify-center items-center my-4 cursor-pointer" @click="handleLogout">
|
||||||
推出登录
|
退出登录
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -24,6 +24,8 @@ const formData = ref({
|
||||||
fileUrl: '',
|
fileUrl: '',
|
||||||
fileName: '',
|
fileName: '',
|
||||||
imageUrl: '',
|
imageUrl: '',
|
||||||
|
labelName: null,
|
||||||
|
isElite: 0,
|
||||||
})
|
})
|
||||||
|
|
||||||
// 图片上传相关
|
// 图片上传相关
|
||||||
|
@ -59,6 +61,8 @@ async function handlePublish() {
|
||||||
fileUrl: '',
|
fileUrl: '',
|
||||||
fileName: '',
|
fileName: '',
|
||||||
imageUrl: '',
|
imageUrl: '',
|
||||||
|
labelName: '',
|
||||||
|
isElite: 0,
|
||||||
}
|
}
|
||||||
fileUrl.value = []
|
fileUrl.value = []
|
||||||
fileName.value = []
|
fileName.value = []
|
||||||
|
@ -125,6 +129,25 @@ async function handlePictureChange(event: Event) {
|
||||||
message.error(currentUploadType.value === 'img' ? '图片上传失败' : '文件上传失败')
|
message.error(currentUploadType.value === 'img' ? '图片上传失败' : '文件上传失败')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const tagList = ref([])
|
||||||
|
async function getTagList() {
|
||||||
|
const params = {
|
||||||
|
communityId: props.communityId,
|
||||||
|
tenantId: props.tenantId,
|
||||||
|
}
|
||||||
|
const res = await request.post('/publishLabel/list', params)
|
||||||
|
for (let i = 0; i < res.data.length; i++) {
|
||||||
|
tagList.value.push({
|
||||||
|
label: res.data[i],
|
||||||
|
value: res.data[i],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getTagList()
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -136,7 +159,7 @@ async function handlePictureChange(event: Event) {
|
||||||
label-width="auto"
|
label-width="auto"
|
||||||
require-mark-placement="right-hanging"
|
require-mark-placement="right-hanging"
|
||||||
>
|
>
|
||||||
<n-form-item path="content" :show-label="false">
|
<!-- <n-form-item path="content" :show-label="false">
|
||||||
<n-input
|
<n-input
|
||||||
v-model:value="formData.content"
|
v-model:value="formData.content"
|
||||||
type="textarea"
|
type="textarea"
|
||||||
|
@ -144,6 +167,25 @@ async function handlePictureChange(event: Event) {
|
||||||
:autosize="{ minRows: 5, maxRows: 10 }"
|
:autosize="{ minRows: 5, maxRows: 10 }"
|
||||||
class="rounded-lg"
|
class="rounded-lg"
|
||||||
/>
|
/>
|
||||||
|
</n-form-item> -->
|
||||||
|
|
||||||
|
<n-form-item label="标签" path="labelName">
|
||||||
|
<n-select
|
||||||
|
v-model:value="formData.labelName"
|
||||||
|
placeholder="选择标签"
|
||||||
|
:options="tagList"
|
||||||
|
/>
|
||||||
|
</n-form-item>
|
||||||
|
<n-form-item label="内容" path="content">
|
||||||
|
<n-input
|
||||||
|
v-model:value="formData.content"
|
||||||
|
placeholder="点击发表主题"
|
||||||
|
type="textarea"
|
||||||
|
:autosize="{
|
||||||
|
minRows: 3,
|
||||||
|
maxRows: 5,
|
||||||
|
}"
|
||||||
|
/>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
|
|
||||||
<div v-if="fileName.length > 0" class="mt-4 flex flex-wrap gap-3 mb-2">
|
<div v-if="fileName.length > 0" class="mt-4 flex flex-wrap gap-3 mb-2">
|
||||||
|
@ -185,6 +227,11 @@ async function handlePictureChange(event: Event) {
|
||||||
<div class="border border-gray-300 rounded p-1 cursor-pointer hover:bg-gray-50 transition-colors" @click="handlePictureInput('file')">
|
<div class="border border-gray-300 rounded p-1 cursor-pointer hover:bg-gray-50 transition-colors" @click="handlePictureInput('file')">
|
||||||
<FolderPlus class="w-5 h-5" />
|
<FolderPlus class="w-5 h-5" />
|
||||||
</div>
|
</div>
|
||||||
|
<div v-if="userStore.userInfo.userId === props.tenantId" class="ml-6 flex items-center gap-2">
|
||||||
|
<n-checkbox v-model:checked="formData.isElite" checked-value="1" unchecked-value="0">
|
||||||
|
是否为精选
|
||||||
|
</n-checkbox>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex items-center gap-8">
|
<div class="flex items-center gap-8">
|
||||||
|
|
|
@ -1,15 +1,17 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
import { FolderPlus, ImagePlus, MessageCircle, Star, ThumbsUp } from 'lucide-vue-next'
|
import { FolderPlus, ImagePlus, MessageCircle, Plus, Star, ThumbsUp } from 'lucide-vue-next'
|
||||||
|
|
||||||
import { NConfigProvider, NImage, NMessageProvider } from 'naive-ui'
|
import { NConfigProvider, NImage, NMessageProvider } from 'naive-ui'
|
||||||
import { onMounted, ref } from 'vue'
|
import { onMounted, ref } from 'vue'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
|
|
||||||
|
const userStore = useUserStore()
|
||||||
|
const message = useMessage()
|
||||||
definePageMeta({
|
definePageMeta({
|
||||||
layout: 'planet',
|
layout: 'planet',
|
||||||
})
|
})
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
const isShowInputLabel = ref(false)
|
||||||
const typeList = ref([
|
const typeList = ref([
|
||||||
{
|
{
|
||||||
label: '最新',
|
label: '最新',
|
||||||
|
@ -53,15 +55,6 @@ async function handleTypeChange(type: number | null) {
|
||||||
questionParams.value.pageNum = 1
|
questionParams.value.pageNum = 1
|
||||||
if (type === 999) { // 问答
|
if (type === 999) { // 问答
|
||||||
isShow.value = 'question'
|
isShow.value = 'question'
|
||||||
// try {
|
|
||||||
// const res = await request.post('/question/list', questionParams.value)
|
|
||||||
// if (res.code === 200) {
|
|
||||||
// questionList.value = res.rows
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// catch (error) {
|
|
||||||
// console.error(error)
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
publishListParams.value.pageNum = 1
|
publishListParams.value.pageNum = 1
|
||||||
|
@ -76,6 +69,42 @@ function closePublishModal() {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 标签
|
||||||
|
// 获取标签列表
|
||||||
|
const tagList = ref([])
|
||||||
|
async function getTagList() {
|
||||||
|
const params = {
|
||||||
|
communityId: questionParams.value.communityId,
|
||||||
|
tenantId: questionParams.value.tenantId,
|
||||||
|
}
|
||||||
|
const res = await request.post('/publishLabel/list', params)
|
||||||
|
tagList.value = res.data
|
||||||
|
}
|
||||||
|
// 添加标签
|
||||||
|
const inputLabel = ref('')
|
||||||
|
async function handleAddLabel() {
|
||||||
|
const params = {
|
||||||
|
communityId: questionParams.value.communityId,
|
||||||
|
tenantId: questionParams.value.tenantId,
|
||||||
|
labelName: inputLabel.value,
|
||||||
|
}
|
||||||
|
const res = await request.post('/publishLabel/add', params)
|
||||||
|
if (res.code === 200) {
|
||||||
|
message.success('添加成功')
|
||||||
|
isShowInputLabel.value = false
|
||||||
|
inputLabel.value = ''
|
||||||
|
getTagList()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 点击标签
|
||||||
|
function handleTagClick(tag: string) {
|
||||||
|
if (publishListParams.value.type === 999)
|
||||||
|
return
|
||||||
|
publishListParams.value.labelName = tag
|
||||||
|
publishListParams.value.pageNum = 1
|
||||||
|
isShow.value = 'publish'
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
const state = history.state
|
const state = history.state
|
||||||
if (state && state.communityId && state.tenantId) {
|
if (state && state.communityId && state.tenantId) {
|
||||||
|
@ -107,6 +136,7 @@ onMounted(() => {
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
getTagList()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -149,6 +179,25 @@ onMounted(() => {
|
||||||
>
|
>
|
||||||
{{ item.label }}
|
{{ item.label }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
v-for="tag in tagList" :key="tag.id" class="flex items-center px-4 py-1 rounded cursor-pointer mr-2" :style="{
|
||||||
|
backgroundColor: publishListParams.type === tag.id ? '#000000' : '#ffffff',
|
||||||
|
color: publishListParams.type === tag.id ? '#ffffff' : '#878d95',
|
||||||
|
}" @click="handleTagClick(tag)"
|
||||||
|
>
|
||||||
|
{{ tag }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="tagList.length < 3 && questionParams.tenantId === userStore.userInfo.userId" class="flex items-center justify-center bg-white w-10 h-8 cursor-pointer" title="添加标签" @click="isShowInputLabel = true">
|
||||||
|
<Plus class="w-4 h-4" />
|
||||||
|
</div>
|
||||||
|
<n-input-group v-if="isShowInputLabel" class="ml-4 w-64">
|
||||||
|
<n-input v-model:value="inputLabel" :style="{ width: '200px' }" placeholder="请输入标签名" />
|
||||||
|
<n-button type="primary" @click="handleAddLabel">
|
||||||
|
确定
|
||||||
|
</n-button>
|
||||||
|
</n-input-group>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="isShow === 'publish'">
|
<div v-if="isShow === 'publish'">
|
||||||
|
|
|
@ -85,9 +85,9 @@ export default defineNuxtConfig({
|
||||||
preset: 'node-server',
|
preset: 'node-server',
|
||||||
devProxy: {
|
devProxy: {
|
||||||
'/api': {
|
'/api': {
|
||||||
target: 'http://113.45.190.154:8080', // 线上
|
// target: 'http://113.45.190.154:8080', // 线上
|
||||||
// target: 'http://192.168.2.29:8080', // 代
|
// target: 'http://192.168.2.29:8080', // 代
|
||||||
// target: 'http://192.168.2.21:8080', // 嗨
|
target: 'http://192.168.2.21:8080', // 嗨
|
||||||
// target: 'https://2d1a399f.r27.cpolar.top', // 嗨
|
// target: 'https://2d1a399f.r27.cpolar.top', // 嗨
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
prependPath: true,
|
prependPath: true,
|
||||||
|
|
Loading…
Reference in New Issue