|
|
|
@ -43,6 +43,16 @@ |
|
|
|
|
|
|
|
|
|
<view v-if="!curTab" class="detail"> |
|
|
|
|
<mp-html :content="form.description"/> |
|
|
|
|
|
|
|
|
|
<template v-if="form.competitionAnnexList && form.competitionAnnexList.length"> |
|
|
|
|
<view class="file-title">附件</view> |
|
|
|
|
<view class="files"> |
|
|
|
|
<view class="file" v-for="(file, i) in form.competitionAnnexList" :key="i"> |
|
|
|
|
<text class="file-name">{{ file.fileName }}</text> |
|
|
|
|
<view class="download" @click="download(file)">下载</view> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
</template> |
|
|
|
|
</view> |
|
|
|
|
<view v-else-if="curTab === 2" class="list"> |
|
|
|
|
<view v-for="(item, i) in list" :key="i" class="item" @click="toDetail(item)"> |
|
|
|
@ -58,7 +68,7 @@ |
|
|
|
|
<view :class="['btn sign', {signed, disabled: comStatus !== 1}]" @click="presign">{{ stopSign ? (signed ? '已报名' : '已截止报名') : comStatus === 1 ? (signed ? '取消报名' : '立刻报名') : statusList[comStatus] }}</view> |
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
<uni-popup ref="popup" type="dialog"> |
|
|
|
|
<uni-popup v-if="popupShow" ref="popup" type="dialog"> |
|
|
|
|
<uni-popup-dialog mode="input" placeholder="请输入4位数邀请码" :duration="2000" :before-close="true" @close="closePopup" @confirm="codeSubmit"></uni-popup-dialog> |
|
|
|
|
</uni-popup> |
|
|
|
|
</view> |
|
|
|
@ -103,6 +113,7 @@ |
|
|
|
|
now: '', |
|
|
|
|
invitationCode: '', |
|
|
|
|
submiting: false, |
|
|
|
|
popupShow: false, |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 下拉刷新 |
|
|
|
@ -126,6 +137,10 @@ |
|
|
|
|
this.stopSign = 0 |
|
|
|
|
this.id = options.id |
|
|
|
|
this.getInfo() |
|
|
|
|
this.focus = false |
|
|
|
|
}, |
|
|
|
|
onLoad() { |
|
|
|
|
this.focus = false |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
// 获取详情 |
|
|
|
@ -223,7 +238,14 @@ |
|
|
|
|
} else { // 报名 |
|
|
|
|
this.invitationCode = '' |
|
|
|
|
// 需要输入验证码就弹出邀请码弹框,否则直接报名 |
|
|
|
|
this.form.isNeedCode ? this.$refs.popup.open() : this.sign() |
|
|
|
|
if (this.form.isNeedCode) { |
|
|
|
|
this.popupShow = true |
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
this.$refs.popup.open() |
|
|
|
|
}) |
|
|
|
|
} else { |
|
|
|
|
this.sign() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 取消报名 |
|
|
|
@ -267,6 +289,62 @@ |
|
|
|
|
this.invitationCode = value |
|
|
|
|
this.sign() |
|
|
|
|
}, |
|
|
|
|
download(item) { |
|
|
|
|
uni.showLoading({ |
|
|
|
|
title: '加载中', |
|
|
|
|
mask: true |
|
|
|
|
}) |
|
|
|
|
// 下载文件资源到本地 |
|
|
|
|
uni.downloadFile({ |
|
|
|
|
url: item.filePath, |
|
|
|
|
success: function(res) { |
|
|
|
|
console.log('result:', res) |
|
|
|
|
// uni.hideLoading(); |
|
|
|
|
|
|
|
|
|
if (res.statusCode === 200) { |
|
|
|
|
uni.getFileSystemManager().saveFile({ |
|
|
|
|
tempFilePath: res.tempFilePath, |
|
|
|
|
success(res) { |
|
|
|
|
console.log('saveFile:',res.savedFilePath) |
|
|
|
|
uni.openDocument({ |
|
|
|
|
filePath: res.savedFilePath, |
|
|
|
|
showMenu: true, //是否可以分享 |
|
|
|
|
success: (res) => { |
|
|
|
|
uni.hideLoading() |
|
|
|
|
console.log(res); |
|
|
|
|
}, |
|
|
|
|
fail: (e) => { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: '打开失败', |
|
|
|
|
icon: "error" |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
// uni.showLoading({ |
|
|
|
|
// title: '正在打开', |
|
|
|
|
// mask: true |
|
|
|
|
// }) |
|
|
|
|
// 新开页面打开文档,支持格式:doc, xls, ppt, pdf, docx, xlsx, pptx。 |
|
|
|
|
// uni.openDocument({ |
|
|
|
|
// filePath: res.tempFilePath, |
|
|
|
|
// fileType: 'docx', // 文件类型,指定文件类型打开文件,有效值 doc, xls, ppt, pdf, docx, xlsx, pptx |
|
|
|
|
// showMenu: true, // 允许出现分享功能 |
|
|
|
|
// success: res => { |
|
|
|
|
// uni.hideLoading() |
|
|
|
|
// }, |
|
|
|
|
// fail: openError => { |
|
|
|
|
// uni.hideLoading() |
|
|
|
|
// } |
|
|
|
|
// }) |
|
|
|
|
}, |
|
|
|
|
fail: function(err) { |
|
|
|
|
uni.hideLoading() |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
</script> |
|
|
|
@ -311,6 +389,24 @@ |
|
|
|
|
margin: 20rpx; |
|
|
|
|
border-radius: 20px; |
|
|
|
|
background-color: #fff; |
|
|
|
|
.file-title { |
|
|
|
|
margin: 40rpx 0 20rpx; |
|
|
|
|
font-size: 26rpx; |
|
|
|
|
color: $uni-primary; |
|
|
|
|
} |
|
|
|
|
.file { |
|
|
|
|
display: flex; |
|
|
|
|
justify-content: space-between; |
|
|
|
|
align-items: center; |
|
|
|
|
margin-bottom: 15rpx; |
|
|
|
|
font-size: 24rpx; |
|
|
|
|
} |
|
|
|
|
.file-name { |
|
|
|
|
color: #333; |
|
|
|
|
} |
|
|
|
|
.download { |
|
|
|
|
color: $uni-primary; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.list { |
|
|
|
|
margin: 0 30rpx; |
|
|
|
|