!96 fix: 获取FreePublic出错&分页溢出

Merge pull request !96 from dhb52/N/A
This commit is contained in:
芋道源码 2023-04-08 09:03:01 +00:00 committed by Gitee
commit 2d65c2a0c1
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -5,7 +5,8 @@
移除 avue 组件使用 ElementUI 原生组件 移除 avue 组件使用 ElementUI 原生组件
--> -->
<template> <template>
<!-- 类型图片 --> <div class="pb-30px">
<!-- 类型image -->
<div v-if="objData.type === 'image'"> <div v-if="objData.type === 'image'">
<div class="waterfall" v-loading="loading"> <div class="waterfall" v-loading="loading">
<div class="waterfall-item" v-for="item in list" :key="item.mediaId"> <div class="waterfall-item" v-for="item in list" :key="item.mediaId">
@ -13,8 +14,7 @@
<p class="item-name">{{ item.name }}</p> <p class="item-name">{{ item.name }}</p>
<el-row class="ope-row"> <el-row class="ope-row">
<el-button type="success" @click="selectMaterialFun(item)" <el-button type="success" @click="selectMaterialFun(item)"
>选择 >选择 <Icon icon="ep:circle-check" />
<i class="el-icon-circle-check el-icon--right"></i>
</el-button> </el-button>
</el-row> </el-row>
</div> </div>
@ -28,7 +28,7 @@
@pagination="getMaterialPageFun" @pagination="getMaterialPageFun"
/> />
</div> </div>
<!-- 类型语音 --> <!-- 类型voice -->
<div v-else-if="objData.type === 'voice'"> <div v-else-if="objData.type === 'voice'">
<!-- 列表 --> <!-- 列表 -->
<el-table v-loading="loading" :data="list"> <el-table v-loading="loading" :data="list">
@ -36,7 +36,7 @@
<el-table-column label="文件名" align="center" prop="name" /> <el-table-column label="文件名" align="center" prop="name" />
<el-table-column label="语音" align="center"> <el-table-column label="语音" align="center">
<template #default="scope"> <template #default="scope">
<wx-voice-player :url="scope.row.url" /> <WxVoicePlayer :url="scope.row.url" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="上传时间" align="center" prop="createTime" width="180"> <el-table-column label="上传时间" align="center" prop="createTime" width="180">
@ -51,8 +51,8 @@
class-name="small-padding fixed-width" class-name="small-padding fixed-width"
> >
<template #default="scope"> <template #default="scope">
<el-button type="text" icon="el-icon-circle-plus" @click="selectMaterialFun(scope.row)" <el-button type="text" @click="selectMaterialFun(scope.row)"
>选择 >选择<Icon icon="ep:plus" />
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
@ -66,6 +66,7 @@
@pagination="getPage" @pagination="getPage"
/> />
</div> </div>
<!-- 类型video -->
<div v-else-if="objData.type === 'video'"> <div v-else-if="objData.type === 'video'">
<!-- 列表 --> <!-- 列表 -->
<el-table v-loading="loading" :data="list"> <el-table v-loading="loading" :data="list">
@ -75,7 +76,7 @@
<el-table-column label="介绍" align="center" prop="introduction" /> <el-table-column label="介绍" align="center" prop="introduction" />
<el-table-column label="视频" align="center"> <el-table-column label="视频" align="center">
<template #default="scope"> <template #default="scope">
<wx-video-player :url="scope.row.url" /> <WxVideoPlayer :url="scope.row.url" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="上传时间" align="center" prop="createTime" width="180"> <el-table-column label="上传时间" align="center" prop="createTime" width="180">
@ -90,8 +91,8 @@
class-name="small-padding fixed-width" class-name="small-padding fixed-width"
> >
<template #default="scope"> <template #default="scope">
<el-button type="text" icon="el-icon-circle-plus" @click="selectMaterialFun(scope.row)" <el-button type="text" @click="selectMaterialFun(scope.row)"
>选择 >选择<Icon icon="ep:circle-plus" />
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
@ -105,14 +106,15 @@
@pagination="getMaterialPageFun" @pagination="getMaterialPageFun"
/> />
</div> </div>
<!-- 类型news -->
<div v-else-if="objData.type === 'news'"> <div v-else-if="objData.type === 'news'">
<div class="waterfall" v-loading="loading"> <div class="waterfall" v-loading="loading">
<div class="waterfall-item" v-for="item in list" :key="item.mediaId"> <div class="waterfall-item" v-for="item in list" :key="item.mediaId">
<div v-if="item.content && item.content.newsItem"> <div v-if="item.content && item.content.newsItem">
<wx-news :articles="item.content.newsItem" /> <WxNews :articles="item.content.newsItem" />
<el-row class="ope-row"> <el-row class="ope-row">
<el-button type="success" @click="selectMaterialFun(item)"> <el-button type="success" @click="selectMaterialFun(item)">
选择<i class="el-icon-circle-check el-icon--right"></i> 选择<Icon icon="ep:circle-check" />
</el-button> </el-button>
</el-row> </el-row>
</div> </div>
@ -127,6 +129,7 @@
@pagination="getMaterialPageFun" @pagination="getMaterialPageFun"
/> />
</div> </div>
</div>
</template> </template>
<script lang="ts" name="WxMaterialSelect"> <script lang="ts" name="WxMaterialSelect">
@ -173,7 +176,7 @@ export default defineComponent({
const newsTypeRef = ref(props.newsType) const newsTypeRef = ref(props.newsType)
const selectMaterialFun = (item) => { const selectMaterialFun = (item) => {
ctx.emit('selectMaterial', item) ctx.emit('select-material', item)
} }
/** 搜索按钮操作 */ /** 搜索按钮操作 */
const handleQuery = () => { const handleQuery = () => {
@ -203,9 +206,10 @@ export default defineComponent({
total.value = data.total total.value = data.total
loading.value = false loading.value = false
} }
const getFreePublishPageFun = async () => { const getFreePublishPageFun = async () => {
let data = await getFreePublishPage(queryParams) let data = await getFreePublishPage(queryParams)
data.list.foreach((item) => { data.list.forEach((item) => {
const newsItem = item.content.newsItem const newsItem = item.content.newsItem
newsItem.forEach((article) => { newsItem.forEach((article) => {
article.picUrl = article.thumbUrl article.picUrl = article.thumbUrl
@ -232,6 +236,7 @@ export default defineComponent({
onMounted(async () => { onMounted(async () => {
getPage() getPage()
}) })
return { return {
handleQuery, handleQuery,
dateFormatter, dateFormatter,