This commit is contained in:
2025-09-18 18:48:55 +08:00
parent 3d7f8c3a75
commit 5665fcf44a
23 changed files with 1091 additions and 96 deletions
@@ -67,6 +67,7 @@ layout("/layouts/platform.html"){
<span>{{$moment(scope.row.createdAt).format( 'YYYY-MM-DD')}}</span>
</template>
</el-table-column>
<el-table-column label="点赞数量" prop="num"></el-table-column>
<el-table-column label="操作" width="200">
<template slot-scope="scope">
<el-button size="mini" type="primary" @click="$refs.auInfoRef.onOpen(scope.row.id)">查看</el-button>
@@ -39,7 +39,6 @@ layout("/layouts/platform.html"){
<el-table :data="tableData" @sort-change="pageOrder" style="width: 100%" row-key="id">
<el-table-column label="序号" type="index" width="60px" :index="indexMethod"></el-table-column>
<el-table-column label="活动主题" prop="name" show-overflow-tooltip></el-table-column>
<el-table-column label="作品名称" prop="name" show-overflow-tooltip></el-table-column>
<el-table-column label="主题类型" prop="subjectName" show-overflow-tooltip></el-table-column>
<el-table-column label="作品类型" prop="worksName" show-overflow-tooltip></el-table-column>
@@ -8,8 +8,8 @@ layout("/layouts/platform_h5.html"){
}
.list-card-body {
/* width: calc(100% - 140px);
display: flex;*/
width: calc(100% - 140px);
display: flex;
flex-direction: column;
justify-content: space-between;
}
@@ -35,9 +35,6 @@ layout("/layouts/platform_h5.html"){
padding: 5px;
border-radius: 5px;
}
.list-card-img img{
width: 100%;
}
</style>
<div id="app" v-cloak>
@@ -47,7 +44,6 @@ layout("/layouts/platform_h5.html"){
<year-van-dropdown-item :num="5" @change="doSearch" v-model="pageForm.year"></year-van-dropdown-item>
<van-dropdown-item :options="stateList" @change="doSearch" v-model="pageForm.state"></van-dropdown-item>
<van-dropdown-item :options="isEnrolledOptions" @change="doSearch" v-model="pageForm.isEnrolledText"></van-dropdown-item>
<van-dropdown-item :options="activityTypeOptions" @change="doSearch" v-model="pageForm.activity_type"></van-dropdown-item>
</van-dropdown-menu>
</van-sticky>
@@ -119,13 +115,12 @@ layout("/layouts/platform_h5.html"){
loading: false,
refreshing: false,
pageForm: {
state: 1,
state: 2,
isEnrolledText: 0,
year: new Date().getFullYear(),
pageNumber: 1,
pageSize: 5,
totalCount: 0,
activity_type: 40001
totalCount: 0
},
yearList: [],
isEnrolledOptions: [
@@ -139,12 +134,7 @@ layout("/layouts/platform_h5.html"){
],
subLoading: false,
viewShow: false,
viewData: {},
activityTypeOptions: [
{ value: 40001, text: "校文化活动" },
{ value: 40002, text: "分工会文化活动" },
{ value: 40003, text: "协会文化活动" },
]
viewData: {}
}
},
components: {
@@ -279,7 +279,7 @@ layout("/layouts/platform_h5.html"){
<!-- 分工会报名-->
<div v-else-if="viewData.signUpMethod===3" class="block">
<div class="notice-title left-tag-title">选择报名人员
<div class="notice-title left-tag-title">选择报名人员
<span v-if="viewData.userNumberLimit===2">
,报名人数 <span style="color: red">
{{viewData.unionTeamNum}}</span>
@@ -1,7 +0,0 @@
<!--#
layout("/layouts/platform_h5.html"){
#-->
<!--#
}
#-->
@@ -0,0 +1,112 @@
<!--#
layout("/layouts/platform_h5.html"){
#-->
<div id="app">
<!-- 导航栏 -->
<van-nav-bar title="作品上传" left-text="返回" left-arrow placeholder
@click-left="historyBack" fixed></van-nav-bar>
<van-sticky offset-top="46px">
<van-dropdown-menu :close-on-click-outside="false" :close-on-click-overlay="false">
<year-van-dropdown-item :num="5" @change="doSearch" v-model="pageForm.year"></year-van-dropdown-item>
</van-dropdown-menu>
</van-sticky>
<table-list api="/platform/activity/worksCollection/upload/pageData"
:page_form.sync="pageForm"
ref="tableListRef"
title="name"
@ready="onReady"
>
<template v-slot="{index,row}">
<table-column label="主题类型">{{row.subjectName}}</table-column>
<table-column label="作品类型">{{row.worksName}}</table-column>
<table-column label="姓名">{{row.userName}}</table-column>
<table-column label="上传时间">{{$moment(row.createdAt).format('YYYY-MM-DD')}}</table-column>
</template>
<template #actions="{index,row}">
<div class="action-btn" @click="onView(row)">
<i class="fa fa-eye"></i>
<span>查看</span>
</div>
<div class="action-btn" @click="onEdit(row)">
<i class="fa fa-edit"></i>
<span>编辑</span>
</div>
<div class="action-btn delete" @click="onDelete(row)">
<i class="fa fa-trash"></i>
<span>删除</span>
</div>
</template>
</table-list>
<apply-form ref="applyFormRef"></apply-form>
<info ref="infoRef"></info>
</div>
<script>
<!--#include('../upload/applyForm.js'){}#-->
<!--#include('info.js'){}#-->
new Vue({
el: "#app",
store,
data() {
return {
pageForm: {
pageNumber: 1,
pageSize: 10,
totalCount: 0,
searchKeyword: '',
year: new Date().getFullYear(),
},
}
},
components: {
'apply-form': applyForm,
'info': INFO,
},
methods: {
onView(row) {
this.$refs.infoRef.onOpen(row)
},
onEdit(row) {
if (this.$moment().isAfter(this.$moment(row.activityEndDateTime))) {
this.$toast.fail("活动已结束,无法修改!")
return
}
this.$refs.applyFormRef.onOpenEdit(row)
},
onDelete(row) {
this.$dialog.confirm({
title: '温馨提示',
message: '您确定要删除吗?',
}).then(() => {
this.$axios.post("/platform/activity/worksCollection/upload/delete", {id:row.id}).then((res) => {
if (res.code === 0) {
this.$toast.success(res.msg)
this.doSearch()
}
})
}).catch(() => {
// on cancel
});
},
onReady() {
this.doSearch()
},
doSearch() {
this.$nextTick(() => {
this.pageForm.pageNumber = 1
this.pageForm.totalCount = 0
this.$refs.tableListRef.doSearch()
})
},
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,67 @@
const INFO = {
template: /*language=HTML*/
`
<div>
<van-action-sheet v-model="visible" :style="{ 'background-color': '#F7F8FA' }" title="报名信息">
<div class="detail-container">
<van-cell-group>
<van-cell title="姓名">
{{ viewData.userName }}
</van-cell>
<van-cell title="工号">
{{ viewData.loginName }}
</van-cell>
<van-cell title="单位">
{{ viewData.unitName }}
</van-cell>
<van-cell title="分工会">
{{ viewData.unionName }}
</van-cell>
<van-cell title="分工会">
{{ viewData.unionName }}
</van-cell>
<van-cell title="作品名称">
{{ viewData.name }}
</van-cell>
<van-cell title="活动主题">
{{ viewData.activityName }}
</van-cell>
<van-cell title="主题类型">
{{ viewData.subjectName }}
</van-cell>
<van-cell title="作品类型">
{{ viewData.worksName }}
</van-cell>
<van-cell title="作品描述" class="direction-column-cell">
{{ viewData.description }}
</van-cell>
<van-cell title="作品附件" class="direction-column-cell">
<file-preview :files="viewData.files" complete_result></file-preview>
</van-cell>
</van-cell-group>
</div>
</van-action-sheet>
</div>
`,
data() {
return {
viewData: {},
visible: false,
}
},
methods: {
onOpen(row) {
this.$axios.post("/platform/activity/worksCollection/common/findOne", {id: row.id}).then((res) => {
if (res.code === 0) {
this.viewData = res.data
try {
this.viewData.files = JSON.parse(this.viewData.files)
} catch (err) {
}
}
})
this.visible = true
},
}
}
@@ -0,0 +1,159 @@
<!--#
layout("/layouts/platform_h5.html"){
#-->
<div id="app">
<!-- 导航栏 -->
<van-nav-bar title="作品阅览" left-text="返回" left-arrow placeholder
@click-left="historyBack" fixed></van-nav-bar>
<van-sticky offset-top="46px">
<van-search
:reverse-color="false"
:show-action="false"
@search="doSearch"
input-align="left"
placeholder="请输入姓名/工号搜索"
v-model="pageForm.searchKeyword"
></van-search>
<van-dropdown-menu :close-on-click-outside="false" :close-on-click-overlay="false">
<van-dropdown-item v-model="pageForm.activityId" :options="activityOptions"
@change="doSearch"></van-dropdown-item>
</van-dropdown-menu>
<van-tabs v-model="pageForm.pageOrderName"
@change="doSearch">
<van-tab title="按上传时间正序排序" name="createdAt"></van-tab>
<van-tab title="按点赞多少倒序排序" name="num"></van-tab>
</van-tabs>
</van-sticky>
<table-list api="/platform/activity/worksCollection/read/h5/pageData"
:page_form.sync="pageForm"
ref="tableListRef"
title="name"
@ready="onReady"
>
<template v-slot="{index,row}">
<table-column label="主题类型">{{row.subjectName}}</table-column>
<table-column label="作品类型">{{row.worksName}}</table-column>
<table-column label="姓名">{{row.userName}}</table-column>
<table-column label="上传时间">{{$moment(row.createdAt).format('YYYY-MM-DD')}}</table-column>
<table-column label="点赞数">{{row.num}}</table-column>
<table-column label="附件">
<template v-if="row.files">
<file-preview :files="JSON.parse(row.files)" complete_result></file-preview>
</template>
</table-column>
</template>
<template #actions="{index,row}">
<div class="action-btn" @click="onView(row)">
<i class="fa fa-eye"></i>
<span>查看</span>
</div>
<template v-if="row.nbCount>0">
<div class="action-btn" @click="onLike(row)" v-if="!row.isThisLike">
<i class="fa fa-thumbs-o-up"></i>
<span>点赞</span>
</div>
<div class="action-btn" @click="onDeleteLike(row)" v-if="row.isThisLike">
<i class="fa fa-thumbs-up"></i>
<span>取消点赞</span>
</div>
</template>
</template>
</table-list>
<info ref="infoRef"></info>
</div>
<script>
<!--#include('../mine/info.js'){}#-->
new Vue({
el: "#app",
store,
data() {
return {
pageForm: {
pageNumber: 1,
pageSize: 10,
totalCount: 0,
searchKeyword: '',
pageOrderName: 'createdAt',
pageOrderNameText: '',
activityId: '',
year: new Date().getFullYear(),
},
activityOptions: []
}
},
components: {
'info': INFO,
},
methods: {
onLike(row) {
this.$dialog.confirm({
title: '温馨提示',
message: '您确定要点赞吗?',
}).then(() => {
this.$axios.post("/platform/activity/worksCollection/read/h5/doLike", {uploadId: row.id}).then((res) => {
if (res.code === 0) {
row.num = row.num + 1
row.isThisLike = true
this.$toast.success(res.msg)
}
})
}).catch(() => {
// on cancel
});
},
onDeleteLike(row) {
this.$dialog.confirm({
title: '温馨提示',
message: '您确定要取消点赞吗?',
}).then(() => {
this.$axios.post("/platform/activity/worksCollection/read/h5/doDeleteLike", {uploadId: row.id}).then((res) => {
if (res.code === 0) {
row.num = row.num - 1
row.isThisLike = false
this.$toast.success(res.msg)
}
})
}).catch(() => {
// on cancel
});
},
onView(row) {
this.$refs.infoRef.onOpen(row)
},
async listActivity() {
const res = await this.$axios.post("/platform/activity/worksCollection/common/listActivity")
if (res.code === 0) {
res.data.forEach(v => {
v.text = v.name
v.value = v.id
})
this.activityOptions = res.data
if (this.activityOptions.length > 0) {
this.pageForm.activityId = this.activityOptions[0].id
}
}
},
async onReady() {
await this.listActivity()
this.doSearch()
},
doSearch() {
this.$nextTick(() => {
this.pageForm.pageNumber = 1
this.pageForm.totalCount = 0
this.$refs.tableListRef.doSearch()
})
},
},
created() {
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,191 @@
const applyForm = {
template:
/*language=HTML*/
`
<div>
<van-action-sheet v-model="visible" :style="{ 'background-color': '#F7F8FA' }" title="报名信息">
<van-form ref="formRef" class="form-container">
<van-cell-group title="基础信息" class="form-section">
<van-field label="姓名" readonly v-model="formData.username"></van-field>
<van-field label="工号" readonly v-model="formData.loginname"></van-field>
<van-field label="所在单位" readonly v-model="formData.unitName"></van-field>
<van-field label="所属工会" readonly v-model="formData.unionName"></van-field>
<van-field label="性别" readonly v-model="formData.sex"></van-field>
</van-cell-group>
<van-cell-group title="报名信息" class="form-section">
<van-field label="主题类型"
required
:rules="[{ required: true, message: '请选择主题类型' }]"
readonly
is-link
@click="showSubjectPicker = true"
placeholder="请选择主题类型"
name="subjectName"
v-model="formData.subjectName">
</van-field>
<van-popup v-model="showSubjectPicker" position="bottom">
<van-picker
show-toolbar
:columns="subjectTypesOptions.map(v=>v.typeName)"
@confirm="onSubjectConfirm"
@cancel="showSubjectPicker=false"
></van-picker>
</van-popup>
<van-field label="作品类型"
required
:rules="[{ required: true, message: '请选择作品类型' }]"
readonly
is-link
@click="showWorksPicker = true"
placeholder="请选择作品类型"
name="worksName"
v-model="formData.worksName">
</van-field>
<van-popup v-model="showWorksPicker" position="bottom">
<van-picker
show-toolbar
:columns="worksTypeOptions.map(v=>v.worksTypeName)"
@confirm="onWorksConfirm"
@cancel="showWorksPicker=false"
></van-picker>
</van-popup>
<van-field label="作品名称"
required
v-model="formData.name"
name="name"
placeholder="请填写作品名称"
:rules="[{ required: true, message: '请填写作品名称' }]"></van-field>
<van-field label="作品描述"
v-model="formData.description"
type="textarea"
name="description"
rows="4"
autosize
maxlength="150"
:rules="[{ required: true, message: '请填写作品描述' }]"
class="more-text"
placeholder="请填写作品描述"></van-field>
</van-cell-group>
<van-cell-group title="附件">
<van-field class="more-text"
name="files"
:rules="[{ required: true,message:'请上传附件' }]"
label=""
required>
<template #input>
<h5-file-upload
slot="input"
:value.sync="formData.files"
:upload_number="chooseWorksType && chooseWorksType.allowFileNum"
upload_mode="file"
upload_result_category="array"
upload_result_type="url"
complete_result
:accept="fileAccept"
></h5-file-upload>
</template>
</van-field>
</van-cell-group>
<div class="form-actions">
<van-button @click="onSubmit" round type="info">提交</van-button>
</div>
</van-form>
</van-action-sheet>
</div>
`,
data() {
return {
row: {},
visible: false,
formData: {},
subjectTypesOptions: [],
showSubjectPicker: false,
worksTypeOptions: [],
showWorksPicker: false,
fileAccept: null,
chooseWorksType: {}
}
},
methods: {
async onOpen(row) {
this.$set(this.formData, 'username', this.$store.state.user.username)
this.$set(this.formData, 'loginname', this.$store.state.user.loginname)
this.$set(this.formData, 'unionName', this.$store.state.user.union.name)
this.$set(this.formData, 'unitName', this.$store.state.user.unit.name)
this.$set(this.formData, 'sex', this.$store.state.user.sex)
this.$set(this.formData, 'activityId', row.id)
await this.activityChange(row.id)
this.row = row
this.visible = true
},
async onOpenEdit(row) {
const formData = clone(row)
formData.files = JSON.parse(formData.files)
await this.activityChange(formData.activityId)
await this.subjectChange(formData.subjectId)
this.row = formData
this.formData = formData
this.$set(this.formData, 'username', this.$store.state.user.username)
this.$set(this.formData, 'loginname', this.$store.state.user.loginname)
this.$set(this.formData, 'sex', this.$store.state.user.sex)
this.chooseWorksType = this.worksTypeOptions.find((o) => o.id === formData.worksId)
if (this.chooseWorksType.allowFileTypes && this.chooseWorksType.allowFileTypes.length > 0) {
this.fileAccept = this.chooseWorksType.allowFileTypes.map((item) => "." + item).join(",")
}
this.visible = true
},
onWorksConfirm(value, index) {
this.$set(this.formData, 'worksName', value)
this.$set(this.formData, 'worksId', this.worksTypeOptions[index].id)
this.showWorksPicker = false
this.chooseWorksType = this.worksTypeOptions.find((o) => o.id === this.worksTypeOptions[index].id)
if (this.chooseWorksType.allowFileTypes && this.chooseWorksType.allowFileTypes.length > 0) {
this.fileAccept = this.chooseWorksType.allowFileTypes.map((item) => "." + item).join(",")
}
},
async onSubjectConfirm(value, index) {
this.$set(this.formData, 'subjectName', value)
this.$set(this.formData, 'subjectId', this.subjectTypesOptions[index].id)
await this.subjectChange(this.subjectTypesOptions[index].id)
this.showSubjectPicker = false
},
onSubmit() {
this.$refs.formRef.validate().then(() => {
this.$dialog.confirm({
title: "提示",
message: "您确定要提交吗?"
}).then(() => {
this.$toast.loading({
message: '提交中...',
forbidClick: true,
});
this.$axios.post("/platform/activity/worksCollection/upload" + (this.formData.id ? "/update" : "/insert"), {data: JSON.stringify(this.formData)}).then((res) => {
if (res.code === 0) {
this.$toast.clear();
this.$toast.success("提交成功")
pjaxReplace("/platform/activity/worksCollection/mine/h5")
}
})
})
}).catch();
},
async activityChange(value) {
const resp = await this.$axios.post("/platform/activity/worksCollection/common/getSubjectTypes", {activityId: value})
if (resp.code === 0) {
this.subjectTypesOptions = resp.data
}
},
async subjectChange(value) {
const resp = await this.$axios.post("/platform/activity/worksCollection/common/getWorksTypes", {subjectId: value})
if (resp.code === 0) {
this.worksTypeOptions = resp.data
}
}
}
}
@@ -1,7 +1,166 @@
<!--#
layout("/layouts/platform_h5.html"){
#-->
22222222222
<style scoped>
.info-title {
font-weight: bold;
background-color: white;
padding: 13px;
box-shadow: 0 8px 12px #ebedf0;
text-align: center !important;
}
.info-container {
height: calc(100vh - 46px - 44px);
min-height: calc(100vh - 46px - 44px);
overflow-y: auto;
}
.info-img {
display: block;
}
.van-count-down {
color: #fff;
}
</style>
<div id="app">
<!-- 导航栏 -->
<van-nav-bar title="作品上传" left-text="返回" left-arrow placeholder
@click-left="historyBack" fixed></van-nav-bar>
<van-sticky offset-top="46px">
<van-dropdown-menu :close-on-click-outside="false" :close-on-click-overlay="false">
<year-van-dropdown-item :num="5" @change="doSearch" v-model="pageForm.year"></year-van-dropdown-item>
<van-dropdown-item v-model="pageForm.activityType" :options="typeOptions" :multiple="false"
@change="doSearch"></van-dropdown-item>
</van-dropdown-menu>
</van-sticky>
<table-list api="/platform/activity/worksCollection/upload/h5/activityPageData"
:page_form.sync="pageForm"
ref="tableListRef"
title="name"
img="cover"
@ready="onReady"
>
<template v-slot="{index,row}">
<table-column label="面向对象">{{row.activityGroupName}}</table-column>
<table-column label="报名时间">
{{$moment(row.startDateTime).format('MM/DD HH:mm')
+ '~' + $moment(row.endDateTime).format('MM/DD HH:mm')}}
</table-column>
</template>
<template #actions="{index,row}">
<div class="action-btn" @click="onView(row)">
<i class="fa fa-eye"></i>
<span>查看介绍</span>
</div>
<div class="action-btn" @click="onApply(row)">
<i class="fa fa-edit"></i>
<span>去报名</span>
</div>
</template>
</table-list>
<van-action-sheet v-model="infoVisible" title="详细信息">
<div class="info-container">
<van-image class="info-img" height="186" width="100%" :src="infoRow.cover"></van-image>
<div class="info-title">{{infoRow.name}}</div>
<pdf-preview style="height: calc(100vh - 46px - 44px - 186px - 57px)"
:content="infoRow.content"></pdf-preview>
</div>
<div class="form-container">
<div class="form-actions">
<van-button @click="onApply(infoRow)" type="primary" block>
<span v-if="time >= 0">
去报名
</span>
<template v-else>
距离开始
<van-count-down :time="Math.abs(time)" class="count-down" format="DD 天 HH 时 mm 分 ss 秒"
@finish="time = 0"></van-count-down>
</template>
</van-button>
</div>
</div>
</van-action-sheet>
<apply-form ref="applyFormRef"></apply-form>
</div>
<script>
<!--#include('applyForm.js'){}#-->
new Vue({
el: "#app",
store,
data() {
return {
time: 0,
pageForm: {
pageNumber: 1,
pageSize: 10,
totalCount: 0,
searchKeyword: '',
year: new Date().getFullYear(),
activityType: 2,
},
typeOptions: [
{text: '全部', value: 1},
{text: '即将开始', value: 4},
{text: '报名中', value: 2},
{text: '已结束', value: 3},
],
infoVisible: false,
infoRow: {},
}
},
components: {
'apply-form': applyForm,
"pdf-preview": httpVueLoader("/components/plugins/sysFilePreview/PdfIndex.vue?v=" + new Date().getTime())
},
methods: {
onApply(row) {
if (this.$moment().isBefore(this.$moment(row.startDateTime))) {
this.onView(row)
return
}
if (this.$moment().isAfter(this.$moment(row.endDateTime))) {
this.$toast.fail("活动已结束")
return
}
this.$refs.applyFormRef.onOpen(row)
},
onView(row) {
this.infoRow = row
this.time = this.$moment().diff(this.$moment(row.startDateTime), 'milliseconds')
this.infoVisible = true
},
onReady() {
this.doSearch()
},
doSearch() {
this.$nextTick(() => {
this.pageForm.pageNumber = 1
this.pageForm.totalCount = 0
this.$refs.tableListRef.doSearch()
})
},
},
created() {
},
})
</script>
<!--#
}
#-->
@@ -1,8 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Title</title>
</head>
<body></body>
</html>
@@ -84,7 +84,7 @@ const H5_ASSET_INFO = {
<div style="white-space: pre">{{item.oldAssetNotes}}</div>
</van-cell>
<van-cell title="旧资产图片" class="direction-column-cell">
{{item.oldAssetFiles}}
<file-preview :files="item.oldAssetFiles" complete_result></file-preview>
</van-cell>
</van-cell-group>
</template>