Commit 8db1339e by lijiabin

【需求 17679】 feat: 完善类型等

parent bc4ba780
......@@ -188,6 +188,11 @@ export interface ArticleItemDto {
viewCount: number
childNum: number
}
relateColumnId: number
sendType: SendTypeEnum
sendTime: string
tagIdList: number[]
pushList: { valueId: string; valueType: number; valueName: string }[]
}
/**
......
import service from '@/utils/request/index'
import type { BooleanFlag } from '@/constants'
import type { OtherUserInfoDto } from './types'
import type { OtherUserInfoDto, OtherUserPostDataSearchParams, OtherUserPostDataDto } from './types'
import type { BackendServicePageResult } from '@/utils/request/types'
// 其他用户页面数据
......@@ -18,13 +19,8 @@ export const getOtherUserData = (data: { userId: string; isReal: BooleanFlag })
/**
* 显示其他用户的发帖数据
*/
export const getOtherUserPostData = (data: {
createUserId: string
isReal: BooleanFlag
current: number
size: number
}) => {
return service.request({
export const getOtherUserPostData = (data: OtherUserPostDataSearchParams) => {
return service.request<BackendServicePageResult<OtherUserPostDataDto>>({
url: '/api/personalCenter/getUserArticleData',
method: 'POST',
data,
......
/**
* 添加或更新案例库DTO
*/
import { BooleanFlag } from '@/constants'
import { ArticleTypeEnum, BooleanFlag, ReleaseStatusTypeEnum } from '@/constants'
import type { PageSearchParams } from '@/utils/request/types'
export interface OtherUserInfoDto {
ayabiAvailable: number
......@@ -17,3 +18,36 @@ export interface OtherUserInfoDto {
signature: string
updateTime: string
}
export interface OtherUserPostDataSearchParams extends PageSearchParams {
createUserId: string
isReal: BooleanFlag
}
export interface OtherUserPostDataDto {
collectionCount: number
content: string
createTime: number
createUserId: string
cultureCommentListVo: null
description: string
faceUrl: string
hasAddQuestion: BooleanFlag
hasCollect: BooleanFlag
hasPraised: BooleanFlag
id: number
isRecommend: BooleanFlag
isRelateColleague: BooleanFlag
playCount: number
praiseCount: number
releaseStatus: ReleaseStatusTypeEnum
replyCount: number
showAvatar: string
showName: string
tagNameList: string[]
title: string
type: ArticleTypeEnum
videoDuration: string
videoUrl: string
viewCount: number
}
import service from '@/utils/request/index'
import type { BackendServicePageResult, PageSearchParams } from '@/utils/request/types'
import type { BackendServicePageResult } from '@/utils/request/types'
import type {
ExchangeGoodsParams,
ExchangeGoodsRecordItemDto,
......@@ -8,6 +8,7 @@ import type {
ExchangeYabiRecordItemDto,
ExchangeGoodsRecordSearchParams,
BackendShopItemDto,
ExchangeYabiRecordSearchParams,
} from './types'
/**
* 获取用户亚币相关数据
......@@ -56,7 +57,7 @@ export const getExchangeGoodsRecordList = (data: ExchangeGoodsRecordSearchParams
/**
* 获取用户YA币兑换记录
*/
export const getExchangeYabiRecordList = (data: PageSearchParams) => {
export const getExchangeYabiRecordList = (data: ExchangeYabiRecordSearchParams) => {
return service.request<BackendServicePageResult<ExchangeYabiRecordItemDto>>({
url: '/api/culture/action/record/yabiList',
method: 'POST',
......
......@@ -91,3 +91,11 @@ export interface ExchangeYabiRecordItemDto {
subType: string
userId: number
}
/**
* 获取用户YA币兑换记录搜索参数
*/
export interface ExchangeYabiRecordSearchParams extends PageSearchParams {
type: ShopGoodsTypeEnum
dateRange: [number, number]
}
......@@ -83,7 +83,7 @@ export interface SelfPraiseDetailDto {
replyCount: number
tagNameList: string[]
title: string
type: string
type: ArticleTypeEnum
videoUrl: string
viewCount: number
}
......
import { createPinia } from 'pinia'
import type { App } from 'vue'
const store = createPinia()
export default store
export function setupStore(app: App) {
app.use(store)
}
export * from './modules/user'
export * from './modules/device'
export * from './modules/app'
export * from './modules/post'
export * from './modules/emoji'
import { localCache } from '@/utils/storage'
import { defineStore } from 'pinia'
import type { RouteLocationNormalized } from 'vue-router'
type ICallbackType = (...args: any[]) => any
export const useAppStore = defineStore('app', {
id: 'app',
state: () => {
return {
// 上一级路由
lastRoute: {} as RouteLocationNormalized,
// 移动端下拉刷新 0不显示 1下拉中 2准备刷新 3 刷新中 4 刷新完成
refreshStatus: 0,
// 移动端是否弹出键盘
isShowKeyBoard: false,
// 记忆页面滚动位置,key:页面地址 value:Y轴滚动
cacheScrollPage: {} as { [key: string]: number },
// 应用内是否存在全局覆盖层,如果存在,返回上一级改成退出全局覆盖层
// 如:图片预览,评论弹窗
fullScreenInstance: {
state: 0,
instance: null, // 打开的示例
close: undefined as ICallbackType | undefined, // 关闭方法
curUrl: '', // 页面Url
},
// 上一次公告弹出时间
announcementTime: 0,
}
},
actions: {
updateLastRoute(route: RouteLocationNormalized) {
this.lastRoute = route
},
updateRefreshStatus(status: number) {
this.refreshStatus = status
},
//软键盘收起的事件处理
handleShowKeyBoard(device = '') {
// ios处理
if (device === 'ios') {
document.body.addEventListener('focusin', () => {
this.isShowKeyBoard = true
})
document.body.addEventListener('focusout', () => {
this.isShowKeyBoard = false
})
} else if (device === 'android') {
const originalHeight = document.documentElement.clientHeight || document.body.clientHeight
window.onresize = () => {
//键盘弹起与隐藏都会引起窗口的高度发生变化
const resizeHeight = document.documentElement.clientHeight || document.body.clientHeight
if (resizeHeight - 0 < originalHeight - 0) {
this.isShowKeyBoard = true
} else {
this.isShowKeyBoard = false
}
}
}
},
/**
* 页面滚动位置
*/
setScrollPage(url: string, top: number) {
this.cacheScrollPage[url] = top
},
getScrollPage(url: string) {
return this.cacheScrollPage[url]
},
/**
* 全局覆盖层
* @returns 返回false,说明 不要返回上一页,而是关闭全局覆盖层
*/
closeFullScreen() {
if (this.fullScreenInstance.state) {
this.fullScreenInstance.close && this.fullScreenInstance.close()
this.clearFullScreenInstance()
return false
}
return true
},
// 清除全屏模态框实例
clearFullScreenInstance() {
this.fullScreenInstance = {
state: 0,
curUrl: '',
instance: null,
close: undefined,
}
},
// 插入全屏模态框示例
updateFullScreenInstance(curUrl: string, instance: any, closeCallback: any) {
this.fullScreenInstance = {
state: 1,
instance,
curUrl,
close: closeCallback,
}
},
/**
* 公告时间
*/
showAnnouncement() {
localCache.setCache('announcementTime', Date.now())
},
getAnnouncement() {
this.announcementTime = localCache.getCache<number>('announcementTime') || 0
return this.announcementTime
},
},
})
import { checkUserAgent } from '@/utils/app'
import { defineStore } from 'pinia'
export const useDeviceStore = defineStore({
id: 'device',
state: () => {
return {
device: '',
isPc: false,
AndroidOrIphone: '',
}
},
actions: {
updateDevice(device: string) {
this.device = device
console.log(['sm', 'md'].indexOf(device) === -1)
// this.updateDeviceType(['sm','md'].indexOf(device) === -1)
},
updateDeviceType(isPc: boolean) {
this.isPc = isPc
},
// 判断设备
handleUserAgent() {
this.AndroidOrIphone = checkUserAgent()
},
},
})
/**
* 表情相关的 缓存
*/
import { defineStore } from 'pinia'
export interface IEmoji {
url: string
name: string
group: string
className: string
}
interface IEmojiObj {
[name: string]: IEmoji
}
interface IGroupEmojy {
[groupName: string]: IEmojiObj
}
export const useEmojiStore = defineStore({
id: 'emoji',
state: () => {
return {
emoji: {} as IGroupEmojy,
}
},
actions: {
/**
* 获取emojy标签
*/
async getEmojiUrl(name: string, group: string) {
if (this.emoji[group]) {
return this.emoji[group][name]
}
const data = await this.generateEmojiGroup(group)
if (!data) {
return
}
this.emoji[group] = data
return this.emoji[group][name]
},
async generateEmojiGroup(group: string): Promise<IEmojiObj | null> {
let jsonData
// 这里必须这样写,否则vite打包,会导致这个找不到文件
if (group === 'face') {
jsonData = (await import(`../../utils/emoji/face.json`)) as { default: IEmoji[] }
}
if (!jsonData) return null
const obj: IEmojiObj = {}
jsonData.default.forEach((v) => {
obj[v.name] = v
})
return obj
},
},
})
/**
* 帖子相关的 缓存
*/
import {
type IOfficialTagList,
type IPostType,
type IShieldType,
getColleagueTagList,
getPostType,
getShieldTypeList,
} from '@/api'
import { localCache } from '@/utils/storage'
import { defineStore } from 'pinia'
interface ICachePostTime {
[id: string]: number
}
export const usePostStore = defineStore({
id: 'post',
state: () => {
return {
// 缓存上一次查看帖子的时间
cachePostTime: {} as { [id: string]: number },
// 分类数据
typeData: [] as IPostType[],
// 已屏蔽的分类
shieldTypeData: [] as IShieldType[],
// 官方标签
tagData: [] as IOfficialTagList[],
}
},
actions: {
/**
* 页面滚动位置
*/
setPostTime(id: string, number: number) {
this.cachePostTime[id] = number
localCache.setCache('post_time', this.cachePostTime, 1000 * 60 * 60 * 48)
},
getPostTime(id: string) {
if (this.cachePostTime[id]) {
return this.cachePostTime[id]
}
const time = localCache.getCache<ICachePostTime>('post_time')
if (time) {
return time[id]
}
return undefined
},
/**
* 分类获取
*/
async queryPostType() {
if (this.typeData.length > 0) {
return this.typeData
}
const res = await getPostType()
this.typeData = res.data
return this.typeData
},
/**
* 获取屏蔽帖子分类列表
* @param isFresh 是否强制刷新
*/
async queryShieType(isFresh = false) {
if (!isFresh && this.shieldTypeData.length > 0) {
return this.shieldTypeData
}
const res = await getShieldTypeList()
this.shieldTypeData = res.data
return this.shieldTypeData
},
/**
* 标签获取
*/
async queryOfficialTag() {
if (this.tagData.length > 0) {
return this.tagData
}
const res = await getColleagueTagList()
this.tagData = res.data
return this.tagData
},
},
})
import { defineStore } from 'pinia'
import { localCache } from '@/utils/storage'
import {
getChatPeople,
getPendingReviewCount,
getUserByCode,
type IPendingCountMap,
type IUserInfo,
} from '@/api'
export const useUserStore = defineStore({
id: 'user',
state: () => {
return {
id: '',
name: '',
isManager: false,
isOfficial: false, // 是否官方
userInfo: {} as IUserInfo,
expireTime: 0, // 过期时间
// 私信:消息维度
unReadNotice: 0,
// 管理员未处理数量
unDoneNum: {} as IPendingCountMap,
// 是否已被封禁
isBanned: false,
// 没有权限名单
// noAuthList: ['yuxueqin']
noAuthList: [] as string[],
}
},
getters: {
getUserInfo(state) {
if (state.userInfo && Object.keys(state.userInfo).length) return state.userInfo
const userInfo = localCache.getCache<IUserInfo>('userInfo')
if (userInfo) {
state.userInfo = userInfo
state.id = userInfo.userId
state.name = userInfo.username
state.isManager = userInfo.hasManagerBtn
state.isBanned = !!userInfo.isBan
state.isOfficial = !!userInfo.isOfficialAccount
}
return userInfo
},
getExpireTime(state) {
if (state.expireTime) return state.expireTime
const expireTime = localCache.getCache<number>('expireTime')
if (expireTime) {
state.expireTime = expireTime
}
return expireTime
},
isNoAuth(state) {
return state.noAuthList.includes(state.userInfo.account)
},
manageArea(state) {
return (state.userInfo.manageArea || '').split(',') || []
},
},
actions: {
// 判断是否拥有管理权限,传入地区,不传则不判断地区
hasManagerPermission(area?: string) {
if (!this.isManager) return false
if (area) {
return this.manageArea.includes(area)
}
return true
},
setUserInfo(userInfo: IUserInfo) {
const expireTime = Date.now() + 3600 * 1000 * 24 * 4 // 4个小时
this.id = userInfo.userId
this.name = userInfo.username
this.isManager = userInfo.hasManagerBtn
this.isOfficial = !!userInfo.isOfficialAccount
this.isBanned = !!userInfo.isBan
this.userInfo = userInfo
this.expireTime = expireTime
localCache.setCache('userInfo', userInfo)
localCache.setCache('expireTime', expireTime)
},
/**
* 通过code获取用户数据
* @param isCodeLogin code来自系统生成还是企业微信 0 来自企业微信,1来自系统生成,默认来自企业微信
*/
async getUserInfoByCode(code: string, isCodeLogin: number = 0, cutEmail?: string) {
try {
const res = await getUserByCode(code, isCodeLogin, cutEmail)
this.setUserInfo(res.data)
} catch (error) {
return Promise.reject(error)
}
},
// 获取未读消息
async refreshNoticeStatus() {
const res = await getChatPeople()
this.unReadNotice = res.data.dialogList.reduce((pre, cur) => {
return cur.un_read_count + pre
}, 0)
},
// 获取管理员未处理数量
async getPendingReviewCount() {
if (!this.isManager) return
const res = await getPendingReviewCount()
const obj: IPendingCountMap = {}
res.data.forEach((v) => {
if (v.type === 1) {
obj.auditCount = v
} else if (v.type === 2) {
obj.topCount = v
} else if (v.type === 3) {
obj.reportCount = v
} else if (v.type === 4) {
obj.unbanCount = v
}
})
this.unDoneNum = obj
},
},
})
......@@ -50,7 +50,11 @@
</template> -->
</div>
<div class="text-gray-500 text-14px">
<el-radio-group size="default" v-model="searchParams.sortLogic" @change="changeSort">
<el-radio-group
size="default"
v-model="searchParams.sortLogic"
@change="(e) => changeSort(e as number)"
>
<el-radio-button
v-for="sort in sortOptions"
:key="sort.value"
......@@ -181,7 +185,7 @@ import type { SearchMoreColumnItemDto } from '@/api'
const router = useRouter()
const route = useRoute()
const searchPageRef = ref<HTMLElement | null>(null)
const { ScrollTopComp, handleBackTop } = useScrollTop(searchPageRef)
const { handleBackTop } = useScrollTop(searchPageRef)
const columnTitle = route.query.columnTitle || ''
......
......@@ -2,7 +2,7 @@
<div>
<!-- 头部Tabs -->
<div class="flex gap-3 items-center">
<Tabs v-model="activeTab" :tabs="tabs" @change="handleTabChange" />
<Tabs v-model="activeTab" :tabs="tabs" @change="(e) => handleTabChange(e as string)" />
<el-icon
size="15"
class="cursor-pointer hover:rotate-180 transition-all duration-300"
......
......@@ -323,10 +323,7 @@ const { list, total, searchParams, goToPage, changePageSize, loading, refresh }
const {
list: listMore,
total: totalMore,
searchParams: searchParamsMore,
goToPage: goToPageMore,
changePageSize: changePageSizeMore,
loading: loadingMore,
refresh: refreshMore,
} = usePageSearch(getVideoListViewMore, {
......
......@@ -93,12 +93,8 @@
</template>
<script lang="tsx" setup>
import { useUserStore } from '@/stores/user'
import { storeToRefs } from 'pinia'
import { generateLoginKey, hasOfficialAccount, getOtherUserData, getOtherUserPostData } from '@/api'
import { hasOfficialAccount, getOtherUserData, getOtherUserPostData } from '@/api'
import type { OfficialAccountItemDto } from '@/api/user/types'
import { wxLogin } from '@/utils/wxUtil'
import dayjs from 'dayjs'
import { usePageSearch } from '@/hooks'
import { ArticleTypeEnum, articleTypeListOptions } from '@/constants'
......@@ -106,15 +102,15 @@ import type { OtherUserInfoDto } from '@/api/otherUserPage/types'
const route = useRoute()
const userStore = useUserStore()
const { list, total, loading, searchParams, search, reset, goToPage, changePageSize, refresh } =
usePageSearch(getOtherUserPostData, {
const { list, total, searchParams, goToPage, changePageSize } = usePageSearch(
getOtherUserPostData,
{
defaultParams: {
createUserId: route.params.userId as string,
isReal: +(route.params.isReal as string),
},
})
},
)
const officialAccountList = ref<OfficialAccountItemDto[]>([])
const getIsOfficial = async () => {
......@@ -131,113 +127,6 @@ onMounted(async () => {
userInfo.value = data
})
const handleSwitchAccount = async () => {
const selectedEmail = ref('')
ElMessageBox({
title: '切换官方账号',
message: () => (
<div class="flex flex-wrap gap-3 p-4">
{officialAccountList.value.map((item) => {
return (
<el-card
key={item.email}
shadow="hover"
class={[
'flex items-center justify-center cursor-pointer transition-all relative',
'hover:shadow-lg border-2 rounded-lg',
selectedEmail.value === item.email
? 'border-blue-500! bg-blue-50!'
: 'border-gray-200!',
]}
style="width: 160px; padding: 16px"
onClick={() => {
selectedEmail.value = item.email
}}
>
{/* 右上角单选框 */}
<div class="absolute top-2 right-2">
<el-checkbox
modelValue={selectedEmail.value}
true-value={item.email}
size="large"
/>
</div>
{/* 内容区域 */}
<div class="flex flex-col items-center gap-3 w-full">
<el-avatar size={80} src={item.avatar} />
<div class="flex flex-col items-center gap-1 w-full">
<span class="text-sm font-medium text-gray-800 truncate w-full text-center">
{item.officialTag}
</span>
</div>
</div>
</el-card>
)
})}
</div>
),
showCancelButton: true,
confirmButtonText: '确认切换',
cancelButtonText: '取消',
customClass: 'min-w-740px',
beforeClose: async (action, instance, done) => {
if (action === 'confirm') {
if (!selectedEmail.value) return ElMessage.warning('请选择要切换的账号')
instance.confirmButtonLoading = true
try {
const { data } = await generateLoginKey({
timestamp: Date.now(),
type: 2,
userId: userInfo.value.userId,
cutEmail: selectedEmail.value,
})
console.log(data)
sessionStorage.clear()
await userStore.getUserInfoByCode({
code: data,
isCodeLogin: 1,
cutEmail: selectedEmail.value,
})
done()
window.location.reload()
} catch (error) {
console.log(error)
} finally {
instance.confirmButtonLoading = false
}
} else {
done()
}
},
})
}
const handleBackUser = () => {
sessionStorage.clear()
wxLogin(route.fullPath)
}
const handleAdmin = () => {
window.open('/backend')
}
const handleClearCache = async () => {
// 获取登陆的key
const { data } = await generateLoginKey({
timestamp: Date.now(),
type: 1,
userId: userInfo.value.userId,
})
// 清理sessionStorage
sessionStorage.clear()
await userStore.getUserInfoByCode({
code: data,
isCodeLogin: 1,
})
window.location.reload()
}
const handleOpenArticle = (item: any) => {
if (item.type === ArticleTypeEnum.VIDEO) {
window.open(`/videoDetail/${item.id}`)
......
......@@ -87,7 +87,9 @@ const open = () => {
refresh()
}
const onSearch = () => {}
const onSearch = () => {
refresh()
}
defineExpose({
open,
......
......@@ -134,9 +134,9 @@ const [form, resetForm] = useResetData({
title: '',
content: '',
mainTagId: '',
subTagIds: [],
subTagIds: [] as number[],
relatedScenariosMainTagId: '',
relatedScenariosSubTagIds: [],
relatedScenariosSubTagIds: [] as number[],
isSync: BooleanFlag.NO,
departmentList: [] as ISelectDept[],
})
......@@ -186,6 +186,8 @@ const transformData = (releaseStatus: ReleaseStatusTypeEnum): AddOrUpdateCaseDto
releaseStatus,
tagRelationDtoList: [],
sourceUser: '',
deptId: '',
deptName: '',
}
// 添加文化标签内容
obj.tagRelationDtoList.push({
......@@ -332,8 +334,8 @@ onActivated(async () => {
.map((i) => i.tagId),
isSync: data.isSync,
departmentList: data.depIdList.map((id, index) => ({
id,
name: data.depNameList[index],
id: String(id),
name: data.depNameList[index] || '',
})),
}
form.value = obj
......
......@@ -251,8 +251,8 @@ import { storeToRefs } from 'pinia'
import { addOrUpdateArticle, addOrUpdatePractice, getArticleDetail } from '@/api'
import { useRouter, useRoute } from 'vue-router'
import { useUserStore } from '@/stores/user'
import { selectDepOrUser, type ISelectDept, type ISelectUser } from '@/utils'
import { selectDepOrUser } from '@/utils'
import type { FormItemRule } from 'element-plus'
const columnStore = useColumnStore()
const { columnList } = storeToRefs(columnStore)
const interviewStore = useInterviewStore()
......@@ -279,14 +279,15 @@ const drawerVisible = ref(false)
const formRef = useTemplateRef<FormInstance>('formRef')
const [form, resetForm] = useResetData({
id: undefined as number | undefined,
type,
title: '',
content: '',
faceUrl: '',
imgUrl: '',
relateColumnId: null,
relateColumnId: '' as string | number,
mainTagId: '',
tagList: [],
tagList: [] as number[],
isRelateColleague: BooleanFlag.NO,
isRecommend: BooleanFlag.NO,
sendType: SendTypeEnum.IMMEDIATE,
......@@ -299,7 +300,7 @@ const [form, resetForm] = useResetData({
pushList: [],
})
const rules = {
const rules: Record<string, FormItemRule[]> = {
title: [{ required: true, message: '请输入文章标题', trigger: 'blur' }],
content: [{ required: true, message: '请输入文章内容', trigger: 'blur' }],
type: [{ required: true, message: '请选择文章类型', trigger: 'blur' }],
......@@ -367,7 +368,7 @@ const filterTagsFn = (allTags: any[]) => {
}
const transFormData = (releaseStatus: ReleaseStatusTypeEnum) => {
const { tagList, ...data } = form.value
const { tagList, ...data } = form.value as any
data.tagList = [data.mainTagId, ...tagList].map((item, index) => ({
tagId: Number(item),
......@@ -377,7 +378,7 @@ const transFormData = (releaseStatus: ReleaseStatusTypeEnum) => {
if (data.type === ArticleTypeEnum.PRACTICE || data.type === ArticleTypeEnum.QUESTION) {
// 手动设置一下封面图
if (data.imgUrl) {
data.faceUrl = data.imgUrl.split(',')[0]
data.faceUrl = data.imgUrl.split(',')[0] || ''
}
}
......@@ -451,7 +452,7 @@ onActivated(async () => {
if (isEdit.value) {
console.log(route.query.id, '编辑 或者 草稿箱')
// 要编辑回显
const { data } = await getArticleDetail(route.query.id)
const { data } = await getArticleDetail(route.query.id as string)
// 首先回显基础的信息
// 标题 内容 主标签 副标签 所属栏目 是否推荐 是否同步同事吧 发布时间 发布状态
const {
......
......@@ -296,7 +296,9 @@
</div>
<div class="flex justify-end items-center gap-2">
<p class="text-sm text-gray-500">拖动进度条找到合适的画面,点击截取按钮生成封面</p>
<el-button type="primary" @click="captureFrame" :icon="Camera"> 截取当前帧 </el-button>
<el-button type="primary" @click="captureFrame">
<el-icon class="mr-2"> <IEpCamera /> </el-icon>截取当前帧
</el-button>
or
<el-button type="primary" @click="coverInputRef?.click()">
手动上传封面
......@@ -360,28 +362,28 @@ const showSpecialInput = computed(
)
const router = useRouter()
const route = useRoute()
const formRef = useTemplateRef('formRef')
const coverInputRef = useTemplateRef('coverInputRef')
const uploadVideoRef = useTemplateRef('uploadVideoRef')
const [form, resetData] = useResetData({
id: undefined as number | undefined,
videoUrl: '',
title: '',
type: ArticleTypeEnum.VIDEO,
content: '',
mainTagId: '',
tagList: [],
tagList: [] as number[],
sendType: SendTypeEnum.IMMEDIATE,
sendTime: '',
releaseStatus: ReleaseStatusTypeEnum.PUBLISH,
faceUrl: '', // 封面URL
videoDuration: '',
relateColumnId: undefined,
relateColumnId: '' as string | number,
// 推送设置
pushType: SendTypeEnum.IMMEDIATE,
pushTime: '',
pushList: [],
pushList: [] as { valueId: string; valueType: number; valueName: string }[],
})
const selectedDepts = ref<{ id: string; name: string }[]>([])
......@@ -515,7 +517,7 @@ const rules = {
pushList: [{ required: true, message: '请选择推送对象', trigger: 'trigger' }],
}
const tansformData = (releaseStatus: ReleaseStatusTypeEnum) => {
const tansformData = (releaseStatus: ReleaseStatusTypeEnum): AddOrUpdateVideoDto => {
const data = {
...form.value,
tagList: [form.value.mainTagId, ...form.value.tagList].map((item, index) => ({
......@@ -539,7 +541,7 @@ const tansformData = (releaseStatus: ReleaseStatusTypeEnum) => {
})),
]
}
return data
return data as AddOrUpdateVideoDto
}
const loading = ref(false)
......
......@@ -39,14 +39,18 @@
'text-blue-600 bg-blue-50': searchParams.type === sort.value,
'text-gray-600 hover:text-blue-600': searchParams.type !== sort.value,
}"
@click="changeType(sort.value)"
@click="changeType(sort.value as ArticleTypeEnum)"
>
{{ sort.label }}
</button>
</div>
</div>
<div class="text-gray-500 text-14px">
<el-radio-group size="default" v-model="searchParams.sortLogic" @change="changeSort">
<el-radio-group
size="default"
v-model="searchParams.sortLogic"
@change="(val) => changeSort(val as number)"
>
<el-radio-button
v-for="sort in sortOptions"
:key="sort.value"
......@@ -207,15 +211,15 @@ import { getArticleList } from '@/api/article'
import { usePageSearch, useScrollTop } from '@/hooks'
import { ArticleTypeEnum } from '@/constants'
import dayjs from 'dayjs'
import type { ArticleListItemDto } from '@/api'
import type { ArticleItemDto } from '@/api'
const router = useRouter()
const route = useRoute()
const searchPageRef = ref<HTMLElement | null>(null)
const { ScrollTopComp, handleBackTop } = useScrollTop(searchPageRef)
const { handleBackTop } = useScrollTop(searchPageRef)
const queryType = route.query.type || ('' as ArticleTypeEnum | undefined)
const querySearchTitle = route.query.title
const queryType = (route.query.type as ArticleTypeEnum) || ''
const querySearchTitle = (route.query.title as string) || ''
const sortOptions = [
{ label: '最新', value: 1 },
......@@ -247,7 +251,7 @@ const handleSearch = () => {
refresh()
}
const handleClick = (item: ArticleListItemDto) => {
const handleClick = (item: ArticleItemDto) => {
if (item.type === ArticleTypeEnum.VIDEO) {
window.open(`/videoDetail/${item.id}`)
} else {
......@@ -256,8 +260,8 @@ const handleClick = (item: ArticleListItemDto) => {
}
onActivated(() => {
searchParams.value.title = route.query.title || ''
searchParams.value.type = route.query.type || ''
searchParams.value.title = (route.query.title as string) || ''
searchParams.value.type = (route.query.type as ArticleTypeEnum) || ''
refresh()
})
</script>
......
......@@ -51,7 +51,11 @@
</template> -->
</div>
<div class="text-gray-500 text-14px">
<el-radio-group size="default" v-model="searchParams.sortLogic" @change="changeSort">
<el-radio-group
size="default"
v-model="searchParams.sortLogic"
@change="(val) => changeSort(val as number)"
>
<el-radio-button
v-for="sort in sortOptions"
:key="sort.value"
......@@ -182,9 +186,9 @@ import type { SearchMoreVideoItemDto } from '@/api'
const router = useRouter()
const route = useRoute()
const searchPageRef = ref<HTMLElement | null>(null)
const { ScrollTopComp, handleBackTop } = useScrollTop(searchPageRef)
const { handleBackTop } = useScrollTop(searchPageRef)
const columnTitle = route.query.columnTitle || ''
const columnTitle = (route.query.columnTitle as string) || ''
const sortOptions = [
{ label: '最新', value: 1 },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment