This commit is contained in:
server
2026-03-13 11:28:08 +08:00
4 changed files with 295 additions and 1 deletions
@@ -0,0 +1,201 @@
<template>
<div>
<div class="file-preview-container" v-if="fileList && fileList.length > 0">
<div class="file-item" v-for="item in fileList" :key="item.id">
<img
v-if="item.suffix === 'jpg' || item.suffix === 'png' || item.suffix === 'jpeg' || item.suffix === 'gif'"
:src="item.thumbnail"
@click.stop="$commonUtil.previewFile(item)"
class="file-image"
/>
<img
v-else
:src="$commonUtil.getFileItemShowIcon(item.suffix)"
@click.stop="$commonUtil.previewFile(item)"
class="file-image"
/>
<div class="file-download" @click="$downLoad(item.downloadPath)">
<i class="el-icon-download"></i>
{{ item.name }}
</div>
</div>
</div>
<div v-else class="empty-container">
<div class="empty-text">暂无</div>
</div>
</div>
</template>
<script>
module.exports = {
name: "H5Index",
props: {
files: {
type: [String, Array],
default: undefined,
required: false
},
complete_result: {
type: Boolean,
default: false,
required: false
}
},
watch: {
files: {
handler(val) {
if (val) {
this.buildEchoFileObject(val)
} else {
this.fileList = []
}
},
immediate: true
}
},
data() {
return {
fileList: []
}
},
methods: {
buildEchoFileObject(val) {
let ids = []
if (this.complete_result) {
if (Array.isArray(val)) {
ids = val.map((item) => {
if (item.response.data.includes("=")) {
return item?.response?.data.substring(item?.response?.data.lastIndexOf("=") + 1)
} else {
return item?.response?.data
}
})
} else {
try {
ids = JSON.parse(val).map((item) => {
if (item.response.data.includes("=")) {
return item?.response?.data.substring(item?.response?.data.lastIndexOf("=") + 1)
} else {
return item?.response?.data
}
})
} catch (err) {
this.fileList = []
}
}
} else {
//那就是链接 没有直接存id的吧。。
if (Array.isArray(val)) {
ids = val.map((item) => {
return item.substring(item.lastIndexOf("=") + 1)
})
} else {
ids = val.split(",").map((item) => {
return item.substring(item.lastIndexOf("=") + 1)
})
}
}
this.requestFullFile(ids)
},
requestFullFile(ids) {
this.$axios.post("/platform/sys/file/previewFileData", {ids: JSON.stringify(ids)}).then((res) => {
if (res.code === 0) {
this.fileList = res.data
}
})
}
}
}
</script>
<style scoped>
.file-preview-container {
position: relative;
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 8px;
width: 100%;
box-sizing: border-box;
}
.file-preview-container .file-item {
aspect-ratio: 1;
position: relative;
transition: all 300ms;
border-radius: 8px;
cursor: pointer;
text-align: center;
overflow: hidden;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background: #f8f9fa;
border: 1px solid #e9ecef;
}
.file-preview-container .file-item:active {
background: #e9ecef;
transform: scale(0.98);
}
.file-preview-container .file-item .file-image {
width: 60px;
height: 60px;
object-fit: cover;
border-radius: 4px;
margin-bottom: 8px;
}
.file-preview-container .file-item .file-download {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 28px;
line-height: 28px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: white;
background-color: rgba(0, 0, 0, 0.7);
border-radius: 0 0 8px 8px;
font-size: 12px;
padding: 0 8px;
box-sizing: border-box;
}
.empty-container {
display: flex;
justify-content: center;
align-items: center;
height: 120px;
color: #999;
}
.empty-text {
font-size: 14px;
}
/* 响应式设计 */
@media (max-width: 480px) {
.file-preview-container {
gap: 4px;
padding: 4px;
}
.file-preview-container .file-item .file-image {
width: 40px;
height: 40px;
}
.file-preview-container .file-item .file-download {
height: 20px;
line-height: 20px;
font-size: 10px;
}
}
</style>
@@ -258,6 +258,7 @@
//挂载
Vue.prototype.$moment = moment
Vue.prototype.$businessTool = businessTool
Vue.prototype.$commonUtil = commonUtil
Vue.prototype.$auth = commonUtil.authService()
Vue.prototype.$axios = commonUtil.axiosService()
Vue.prototype.$downLoad = commonUtil.downLoadService.bind(commonUtil)
@@ -277,6 +278,7 @@
Vue.component("enum-tag", httpVueLoader("/components/plugins/sysEnum/EnumTag.vue?v=" + new Date().getTime()))
Vue.component("table-list", httpVueLoader("/components/plugins/h5/TableList.vue?v=" + new Date().getTime()))
Vue.component("table-column", httpVueLoader("/components/plugins/h5/TableColumn.vue?v=" + new Date().getTime()))
Vue.component("file-preview", httpVueLoader("/components/plugins/sysFilePreview/H5Index.vue?v=" + new Date().getTime()))
</script>
</head>
<body>
@@ -113,6 +113,17 @@ layout("/layouts/platform_h5.html"){
class="picker-style"
></van-picker>
</van-popup>
<van-cell class="table-card-footer">
<div style="display: flex; justify-content: flex-end; width: 100%;">
<van-button
type="info"
size="small"
@click.prevent="onOpen(formData.clubId)"
:disabled="!formData.clubId"
>查看
</van-button>
</div>
</van-cell>
</van-cell-group>
<!-- 基本信息 -->
@@ -195,15 +206,27 @@ layout("/layouts/platform_h5.html"){
<van-button round block type="info">提交申请</van-button>
</div>
</van-form>
<van-popup :style="{ height: '100%',width: '100%'}" position="right" safe-area-inset-bottom v-model="viewShow">
<van-sticky>
<van-nav-bar @click-left="viewShow = false" left-arrow left-text="返回" title="详细信息"></van-nav-bar>
</van-sticky>
<div style="height: calc(100vh - 44px); overflow-y: auto">
<info ref="infoRef"></info>
</div>
</van-popup>
</div>
<script>
<!--#include('../common/clubInfo.js'){}#-->
const vue = new Vue({
el: "#app",
store,
components: {},
components: {
info: clubInfo
},
data() {
return {
viewShow: false,
formData: {
clubId: "",
clubName: "",
@@ -230,6 +253,12 @@ layout("/layouts/platform_h5.html"){
}
},
methods: {
onOpen(clubId) {
this.viewShow = true
this.$nextTick(() => {
this.$refs.infoRef.onOpen(clubId)
})
},
onClubConfirm(value, index) {
this.formData.clubId = this.clubOptions[index].id;
this.formData.clubName = value;
@@ -0,0 +1,62 @@
const clubInfo = {
template:
/*language=HTML*/
`
<div>
<van-cell-group>
<!-- <van-cell>-->
<!-- <div slot="title" class="font-size4 bold">-->
<!-- 协会信息-->
<!-- </div>-->
<!-- </van-cell>-->
<van-cell title="协会名称">{{ viewData.clubName }}</van-cell>
<van-cell title="成立时间">{{ viewData.foundTime }}</van-cell>
<van-cell title="协会编码">{{ viewData.clubCode }}</van-cell>
<van-cell title="协会类型">{{ viewData.typeName }}</van-cell>
<van-cell title="发起人">{{ viewData.sponsorName }}</van-cell>
<van-cell title="会费标准">{{ viewData.due }}</van-cell>
<van-cell title="当前人数">{{ viewData.currentPeopleNum }}</van-cell>
<van-cell class="more-text" title="协会介绍">
<div v-html="viewData.introduce"></div>
</van-cell>
<van-cell class="more-text" title="协会宗旨">
<div v-html="viewData.purpose"></div>
</van-cell>
<van-cell class="more-text" title="协会章程" v-if="viewData.rulesFile">
<file-preview :files="viewData.rulesFile" complete_result></file-preview>
</van-cell>
<van-cell class="more-text" title="年度活动计划" v-if="viewData.yearPlanFile">
<file-preview :files="viewData.yearPlanFile" complete_result></file-preview>
</van-cell>
</van-cell-group>
</div>
`,
data() {
return {
viewData: {},
activeName: "first",
isScrollNow: "0"
}
},
methods: {
onOpen(id) {
this.$axios.post("/platform/club/applyJoin/apply/findOne", { id }).then((res) => {
if (res.code === 0) {
this.viewData = res.data
}
})
}
},
style: /*language=CSS*/ `
.more-text .van-field__label{
width: 100%;
}
.more-text {
display: inline-block;
}
.more-text .van-cell__value{
text-align: left;
}
`
}