chore:PDF名字可以自定义
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
<view class="article-wrap">
|
||||
<ns-adv keyword="NS_ARTICLE" class-name="adv-wrap"></ns-adv>
|
||||
<block v-for="(item, index) in list" :key="index">
|
||||
<view class="item" @tap="toDetail(item.$orig)">
|
||||
<view class="item" @tap="toDetail(item)">
|
||||
<view class="pdf-icon">
|
||||
<text class="pdf-icon-p">P</text>
|
||||
<view class="pdf-icon-fold"></view>
|
||||
@@ -24,7 +24,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="info-wrap">
|
||||
<view class="title">{{ item.$orig.files_title || '未命名文件' }}</view>
|
||||
<view class="title">{{ item.files_title }}</view>
|
||||
<view class="read-wrap">
|
||||
<text>{{ $lang('files.list.viewPdf') }}</text>
|
||||
</view>
|
||||
@@ -90,8 +90,10 @@ export default {
|
||||
if (res.code === 0 && res.data) {
|
||||
list = res.data.list
|
||||
if (!this.title && res.data.list.length > 0) {
|
||||
const first = res.data.list[0]
|
||||
const firstOrig = (first && first.$orig) ? first.$orig : first
|
||||
uni.setNavigationBarTitle({
|
||||
title: res.data.list[0].category_name
|
||||
title: firstOrig.category_name || ''
|
||||
})
|
||||
}
|
||||
} else {
|
||||
@@ -104,7 +106,18 @@ export default {
|
||||
this.list = []
|
||||
}
|
||||
this.list = this.list.concat(list.map(item => {
|
||||
return { $orig: item }
|
||||
// 兼容两种后端结构:自带 $orig(如 cases 接口)或扁平结构
|
||||
const src = (item && item.$orig) ? item.$orig : item
|
||||
return {
|
||||
files_id: src.files_id,
|
||||
files_title: src.files_title,
|
||||
files_url: src.files_url,
|
||||
files_desc: src.files_desc,
|
||||
category_id: src.category_id,
|
||||
category_name: src.category_name,
|
||||
// 保留完整原对象引用,避免后续扩展字段丢失
|
||||
$orig: src
|
||||
}
|
||||
}))
|
||||
if (this.$refs.loadingCover) {
|
||||
this.$refs.loadingCover.hide()
|
||||
|
||||
Reference in New Issue
Block a user