Files
oa_app/pages/preview/file.vue
T
2026-09-24 14:31:24 +08:00

49 lines
1.5 KiB
Vue

<template>
<view class="page">
<fy-header title="附件预览" back />
<view class="body">
<view class="card sheet">
<view class="mark"></view>
<text class="name">{{ name || '附件' }}</text>
<text class="hint">系统会用本机应用打开这个附件</text>
</view>
<wd-button type="primary" block size="large" @click="open">打开 / 预览</wd-button>
</view>
</view>
</template>
<script>
import FyHeader from '../../components/fy-header.vue'
import { store } from '../../utils/store.js'
import { openFile } from '../../utils/files.js'
export default {
components: { FyHeader },
data() { return { id: '', name: '' } },
onLoad(q) {
this.id = decodeURIComponent(q.id || '')
this.name = decodeURIComponent(q.name || '附件')
this.open()
},
methods: {
open() {
if (!this.id) return
openFile({ id: this.id, name: this.name }, store.token)
}
}
}
</script>
<style scoped>
.body { padding: 32rpx 24rpx; }
.sheet { padding: 48rpx 32rpx; margin-bottom: 32rpx; display: flex; flex-direction: column; align-items: center; }
.mark {
width: 112rpx; height: 112rpx; border-radius: 28rpx;
background: #E8F1FF; color: #1677FF;
display: flex; align-items: center; justify-content: center;
font-size: 44rpx; font-weight: 650;
}
.name { display: block; margin-top: 24rpx; font-size: 30rpx; font-weight: 650; color: #111827; text-align: center; word-break: break-all; }
.hint { display: block; margin-top: 12rpx; font-size: 24rpx; color: #6B7280; text-align: center; }
</style>