|
|
@@ -1,11 +1,11 @@
|
|
|
<template>
|
|
|
<uv-cell-group :border="false">
|
|
|
- <uv-cell v-for="(b,i) in list" :key="i" cell-style="padding: 10px 0" @click="handlePreview(null, b)">
|
|
|
+ <uv-cell v-for="item in list" :key="item.id" cell-style="padding: 10px 0" @click="handlePreview(item)">
|
|
|
<template #title>
|
|
|
- <view class="text-28 text-fore-title mb-20">{{ b.title }}</view>
|
|
|
+ <view class="text-28 text-fore-title mb-20">{{ item.title }}</view>
|
|
|
</template>
|
|
|
<template #label>
|
|
|
- <view class="text-24 text-fore-light">{{ b.createTime }}</view>
|
|
|
+ <view class="text-24 text-fore-light">{{ item.createTime }}</view>
|
|
|
</template>
|
|
|
</uv-cell>
|
|
|
</uv-cell-group>
|
|
|
@@ -18,23 +18,32 @@ import {useTransferPage} from "@/hooks/useTransferPage";
|
|
|
import {EnumBrochureType} from "@/common/enum";
|
|
|
import {routes} from "@/common/routes";
|
|
|
|
|
|
-defineProps<{
|
|
|
+withDefaults(defineProps<{
|
|
|
list: UniversityBrochure[]
|
|
|
-}>()
|
|
|
+}>(), {
|
|
|
+ list: () => []
|
|
|
+})
|
|
|
|
|
|
-const detail = inject(UNIVERSITY_DETAIL)
|
|
|
-const brochures = computed(() => detail.value.enrollBrochures || [])
|
|
|
+const detail = inject(UNIVERSITY_DETAIL, ref({} as UniversityDetail))
|
|
|
const baseInfo = computed(() => detail.value.baseInfo || {})
|
|
|
const {transferTo} = useTransferPage()
|
|
|
|
|
|
-const handlePreview = function (type: EnumBrochureType | null, item: UniversityBrochure | null = null) {
|
|
|
- const brochure = item || brochures.value.find(b => b.type == type)
|
|
|
- if (!brochure) return
|
|
|
+const handlePreview = function (brochure: UniversityBrochure) {
|
|
|
if (brochure.url) {
|
|
|
uni.openDocument({
|
|
|
filePath: brochure.url,
|
|
|
fail: result => {
|
|
|
- console.log('open failed', result)
|
|
|
+ uni.setClipboardData({
|
|
|
+ data: brochure.url,
|
|
|
+ showToast: false,
|
|
|
+ success: () => {
|
|
|
+ uni.$ie.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '已将文件地址复制到粘贴板',
|
|
|
+ showCancel: false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
} else {
|