oss全部替换完成

dev_202412
yujialong 1 year ago
parent fcedab589f
commit ae39cf9b44
  1. 5
      package-lock.json
  2. 1
      package.json
  3. 11
      src/api/index.js
  4. 49
      src/components/quill/index.vue
  5. 2
      src/components/upload/index.vue
  6. 2
      src/components/upload/upload.js
  7. 2
      src/libs/util.js
  8. 205
      src/pages/activity/manage/add/index.vue
  9. 67
      src/pages/activity/manage/manage/noticeDetail.vue
  10. 136
      src/pages/match/details/index.vue
  11. 128
      src/pages/match/list/index.vue
  12. 31
      src/pages/touristMatch/list/index.vue
  13. 4
      src/setting.js

5
package-lock.json generated

@ -9436,6 +9436,11 @@
"minimist": "^1.2.5" "minimist": "^1.2.5"
} }
}, },
"moment": {
"version": "2.29.4",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
"integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w=="
},
"move-concurrently": { "move-concurrently": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz", "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz",

@ -20,6 +20,7 @@
"js-cookie": "^2.2.1", "js-cookie": "^2.2.1",
"jspdf": "^2.5.1", "jspdf": "^2.5.1",
"mavon-editor": "^2.10.4", "mavon-editor": "^2.10.4",
"moment": "^2.29.4",
"tinymce": "^6.7.3", "tinymce": "^6.7.3",
"vue": "^2.7.10", "vue": "^2.7.10",
"vue-cropperjs": "^3.0.0", "vue-cropperjs": "^3.0.0",

@ -19,6 +19,11 @@ export default {
fileUploadNakadai: `${host}nakadai/nakadai/oss/fileUpload`, fileUploadNakadai: `${host}nakadai/nakadai/oss/fileUpload`,
refreshPageNotification : `nakadai/message/refreshPageNotification`, refreshPageNotification : `nakadai/message/refreshPageNotification`,
getUserInfo : `users/users/userInfo/getUserInfo`, getUserInfo : `users/users/userInfo/getUserInfo`,
getCurrentTime : `competition/competition/management/getCurrentTime`,
// 阿里云文件/视频管理
getPlayAuth: `${uploadURL}oss/manage/getPlayAuth`, // 获取播放凭证
getPlayAuthNakadai: `nakadai/nakadai/oss/getPlayAuth`, // 获取播放凭证
platformLogList: `nakadai/nakadai/log/platformLogList`, platformLogList: `nakadai/nakadai/log/platformLogList`,
logNotification: `nakadai/nakadai/log/logNotification`, logNotification: `nakadai/nakadai/log/logNotification`,
@ -180,12 +185,6 @@ export default {
collectionActivity: `occupationlab/occupationlab/activity/collectionActivity`, collectionActivity: `occupationlab/occupationlab/activity/collectionActivity`,
concernedActivity: `occupationlab/occupationlab/activity/concernedActivity`, concernedActivity: `occupationlab/occupationlab/activity/concernedActivity`,
// 阿里云文件/视频管理
fileDeletion: `${uploadURL}oss/manage/fileDeletion`, // 删除OSS文件
fileupload: `${uploadURL}oss/manage/fileupload`, // 文件上传
getPlayAuth: `${uploadURL}oss/manage/getPlayAuth`, // 获取播放凭证
getPlayAuthNakadai: `nakadai/nakadai/oss/getPlayAuth`, // 获取播放凭证
queryProvince: `nakadai/nakadai/province/queryProvince`, //查询省份 queryProvince: `nakadai/nakadai/province/queryProvince`, //查询省份
queryCity: `nakadai/nakadai/city/queryCity`, //查询城市 queryCity: `nakadai/nakadai/city/queryCity`, //查询城市
querySchool: `nakadai/nakadai/school/querySchool`, //根据学校名称查询学校信息 querySchool: `nakadai/nakadai/school/querySchool`, //根据学校名称查询学校信息

@ -1,16 +1,21 @@
<template> <template>
<div class="quill" ref="quill" :class="classes"> <div class="quill"
<div ref="editor" :style="styles" v-loading="loading"></div> ref="quill"
:class="classes">
<div ref="editor"
:style="styles"
v-loading="loading"></div>
<el-upload <Upload :max-size="1000"
:headers="headers" :limit="100"
:action="this.api.fileupload" @beforeUpload="beforeUpload"
:before-upload="beforeUpload" @onSuccess="editorUploadSuccess"
:on-success="editorUploadSuccess" style="display: none">
style="display: none" <div slot="trigger">
> <el-button :id="'editorUpload' + index"
<el-button :id="'editorUpload' + index" type="primary">点击上传</el-button> type="primary">点击上传</el-button>
</el-upload> </div>
</Upload>
</div> </div>
</template> </template>
@ -22,9 +27,14 @@ import "quill/dist/quill.core.css";
import "quill/dist/quill.snow.css"; import "quill/dist/quill.snow.css";
import "quill/dist/quill.bubble.css"; import "quill/dist/quill.bubble.css";
import toolbarOptions from "./options"; import toolbarOptions from "./options";
import Upload from '@/components/upload';
import Oss from '@/components/upload/upload.js'
export default { export default {
name: "quill", name: "quill",
components: {
Upload,
},
props: { props: {
value: { value: {
type: String, type: String,
@ -188,20 +198,16 @@ export default {
if (!file.type.match(/^image\/(gif|jpe?g|a?png|bmp)/i)) { if (!file.type.match(/^image\/(gif|jpe?g|a?png|bmp)/i)) {
return return
} }
const param = new FormData()
param.append('file', file)
// base64 // base64
this.$post(this.api.fileupload, param, { Oss.upload(file).then(res => {
headers: { "Content-Type": "multipart/form-data" }
}).then(res => {
var range = ins.getSelection() var range = ins.getSelection()
if (range) { if (range) {
// //
ins.insertEmbed(range.index, 'image', res.data.filesResult.fileUrl) ins.insertEmbed(range.index, 'image', res.url)
// //
ins.setSelection(range.index + 1) ins.setSelection(range.index + 1)
} }
}).catch(res => {}) })
}); });
} }
}, false) }, false)
@ -209,15 +215,15 @@ export default {
beforeUpload (file) { beforeUpload (file) {
this.loading = true; this.loading = true;
}, },
editorUploadSuccess(res) { editorUploadSuccess (file) {
// //
let quill = this.Quill; let quill = this.Quill;
// //
if (res.data.filesResult.fileUrl) { if (file.url) {
// //
let length = quill.getSelection().index; let length = quill.getSelection().index;
// res // res
quill.insertEmbed(length, "image", res.data.filesResult.fileUrl); quill.insertEmbed(length, "image", file.url);
// //
quill.setSelection(length + 1); quill.setSelection(length + 1);
} else { } else {
@ -257,5 +263,4 @@ export default {
transform: translateY(10px); transform: translateY(10px);
} }
} }
</style> </style>

@ -102,7 +102,7 @@ export default {
this.uploading = true this.uploading = true
this.showFiles = false this.showFiles = false
// oss // oss
const { name } = await this.client.multipartUpload(file.name, file, { const { name } = await this.client.multipartUpload(Date.now() + '.' + Util.getFileExt(file.name), file, {
progress: this.handleProgress progress: this.handleProgress
}); });

@ -17,7 +17,7 @@ export default {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
try { try {
// 上传到阿里云oss // 上传到阿里云oss
const res = await client.multipartUpload(file.name, file); const res = await client.multipartUpload(Date.now() + '.' + Util.getFileExt(file.name), file);
resolve({ resolve({
format: Util.getFileExt(file.name), format: Util.getFileExt(file.name),
name: file.name, name: file.name,

@ -181,7 +181,7 @@ const util = {
}); });
} }
} }
} },
}; };
export default util; export default util;

@ -1,134 +1,169 @@
<template> <template>
<div> <div>
<el-card v-if="!id" shadow="hover" class="m-b-20"> <el-card v-if="!id"
shadow="hover"
class="m-b-20">
<div class="flex-between"> <div class="flex-between">
<el-page-header @back="back" :content="'创建项目'"></el-page-header> <el-page-header @back="back"
:content="'创建项目'"></el-page-header>
</div> </div>
</el-card> </el-card>
<div class="page"> <div class="page">
<div class="page-content"> <div class="page-content">
<el-form label-width="170px" label-suffix=":" size="small"> <el-form label-width="170px"
label-suffix=":"
size="small">
<el-form-item label="项目封面(选填)"> <el-form-item label="项目封面(选填)">
<el-upload <el-upload class="avatar-uploader"
class="avatar-uploader"
accept=".jpg,.png,.jpeg,.gif" accept=".jpg,.png,.jpeg,.gif"
:on-success="uploadSuccess"
:action="this.api.fileupload"
:headers="headers"
:limit="1" :limit="1"
:on-exceed="handleExceed" :on-exceed="handleExceed"
:before-remove="beforeRemove" :before-remove="beforeRemove"
:on-remove="handleRemove" :on-remove="handleRemove"
:on-error="uploadError" :on-error="uploadError"
name="file" action=""
> :http-request="handleRequest">
<img v-if="form.coverUrl" :src="form.coverUrl" class="avatar"> <img v-if="form.coverUrl"
<div class="uploader-default" v-else> :src="form.coverUrl"
class="avatar">
<div class="uploader-default"
v-else>
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
<p>上传封面</p> <p>上传封面</p>
</div> </div>
<div slot="tip" class="el-upload__tip"> <div slot="tip"
class="el-upload__tip">
<p>展示宽度为220高度140JPG/PNG/GIF3MB以内</p> <p>展示宽度为220高度140JPG/PNG/GIF3MB以内</p>
</div> </div>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
<el-form-item label="项目封面长图(选填)"> <el-form-item label="项目封面长图(选填)">
<el-upload <el-upload class="avatar-uploader avatar-uploader-lg"
class="avatar-uploader avatar-uploader-lg"
accept=".jpg,.png,.jpeg,.gif" accept=".jpg,.png,.jpeg,.gif"
:on-success="uploadLgSuccess"
:action="this.api.fileupload"
:headers="headers"
:limit="1" :limit="1"
:on-exceed="handleExceed" :on-exceed="handleExceed"
:before-remove="beforeRemove" :before-remove="beforeRemove"
:on-remove="handleCarouselRemove" :on-remove="handleCarouselRemove"
:on-error="uploadError" :on-error="uploadError"
name="file" action=""
> :http-request="handleRequestLg">
<img v-if="form.carouselUrl" :src="form.carouselUrl" class="avatar-lg"> <img v-if="form.carouselUrl"
<div class="uploader-default" v-else> :src="form.carouselUrl"
class="avatar-lg">
<div class="uploader-default"
v-else>
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
<p>上传封面</p> <p>上传封面</p>
</div> </div>
<div slot="tip" class="el-upload__tip"> <div slot="tip"
class="el-upload__tip">
<p>展示宽度为1920高度300JPG/PNG/GIF3MB以内</p> <p>展示宽度为1920高度300JPG/PNG/GIF3MB以内</p>
</div> </div>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
<el-form-item class="req" label="项目名称"> <el-form-item class="req"
label="项目名称">
<div class="d-inline-block"> <div class="d-inline-block">
<el-input placeholder="请输入项目名称" v-model="form.projectName" clearable></el-input> <el-input placeholder="请输入项目名称"
v-model="form.projectName"
clearable></el-input>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item class="req" label="发起方"> <el-form-item class="req"
label="发起方">
<div class="inline-input"> <div class="inline-input">
<div class="input-wrap" v-for="(item,index) in sponsorList" :key="index"> <div class="input-wrap"
<el-input placeholder="发起方名称" v-model="sponsorList[index]"></el-input> v-for="(item,index) in sponsorList"
<i v-if="sponsorList.length > 1" class="remove" @click="delSponsor(index)"></i> :key="index">
<button v-if="index == 0" class="add-btn" type="button" @click="addSponsor"> <el-input placeholder="发起方名称"
v-model="sponsorList[index]"></el-input>
<i v-if="sponsorList.length > 1"
class="remove"
@click="delSponsor(index)"></i>
<button v-if="index == 0"
class="add-btn"
type="button"
@click="addSponsor">
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
<span>添加</span> <span>添加</span>
</button> </button>
</div> </div>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item class="req" label="报名时间"> <el-form-item class="req"
<el-date-picker v-model="signupTime" value-format="yyyy-MM-dd HH:mm:ss" type="datetimerange" label="报名时间">
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" <el-date-picker v-model="signupTime"
value-format="yyyy-MM-dd HH:mm:ss"
type="datetimerange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
:picker-options="pickerOptions"></el-date-picker> :picker-options="pickerOptions"></el-date-picker>
</el-form-item> </el-form-item>
<el-form-item class="req" label="项目时间"> <el-form-item class="req"
<el-date-picker v-model="playTime" value-format="yyyy-MM-dd HH:mm:ss" type="datetimerange" label="项目时间">
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" <el-date-picker v-model="playTime"
value-format="yyyy-MM-dd HH:mm:ss"
type="datetimerange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
:picker-options="pickerOptions"></el-date-picker> :picker-options="pickerOptions"></el-date-picker>
</el-form-item> </el-form-item>
<el-form-item class="req" label="发布范围"> <el-form-item class="req"
label="发布范围">
<div> <div>
<el-radio v-model="scope" :label="0" disabled>本校内</el-radio> <el-radio v-model="scope"
:label="0"
disabled>本校内</el-radio>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item class="req" label="报名人数上限"> <el-form-item class="req"
label="报名人数上限">
<div class="input-center"> <div class="input-center">
<el-input placeholder="请输入人数" v-model.number="form.maximumNumber" type="number"></el-input> <el-input placeholder="请输入人数"
v-model.number="form.maximumNumber"
type="number"></el-input>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item class="req" label="报名邀请码"> <el-form-item class="req"
<div class="input-center" style="width: 550px;"> label="报名邀请码">
<el-radio v-model="form.isNeedCode" :label="0">不需要</el-radio> <div class="input-center"
<el-radio v-model="form.isNeedCode" :label="1">需要</el-radio> style="width: 550px;">
<el-input style="width: 250px" placeholder="请输入4位邀请码或点击随机生成" v-model="form.invitationCode" :disabled="form.isNeedCode === 0"></el-input> <el-radio v-model="form.isNeedCode"
<el-button v-if="form.isNeedCode === 1" @click="randomInv">随机</el-button> :label="0">不需要</el-radio>
<el-radio v-model="form.isNeedCode"
:label="1">需要</el-radio>
<el-input style="width: 250px"
placeholder="请输入4位邀请码或点击随机生成"
v-model="form.invitationCode"
:disabled="form.isNeedCode === 0"></el-input>
<el-button v-if="form.isNeedCode === 1"
@click="randomInv">随机</el-button>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item class="req" label="项目详情"> <el-form-item class="req"
<quill ref="quill" :border="true" v-model="form.projectDescribe" :height="400" /> label="项目详情">
<quill ref="quill"
:border="true"
v-model="form.projectDescribe"
:height="400" />
</el-form-item> </el-form-item>
<el-form-item label="附件"> <el-form-item label="附件">
<el-upload <Upload :limit="5"
:file-list.sync="form.activityFileList"
:changeFileList="false"
:on-remove="handleAnnexRemove" :on-remove="handleAnnexRemove"
:on-error="uploadError" @onSuccess="uploadAnnexSuccess" />
:before-upload="beforeUpload"
:on-success="uploadAnnexSuccess"
:on-exceed="handleExceedAnnex"
:limit="5"
:action="this.api.fileupload"
:headers="headers"
:file-list="form.activityFileList"
name="file"
>
<el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">
<p>支持扩展名.rar .zip .doc .docx .pdf .jpg...</p>
</div>
</el-upload>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div class="btns"> <div class="btns">
<el-button @click="save(0)">保存</el-button> <el-button @click="save(0)">保存</el-button>
<el-button type="primary" @click="save(1)">发布</el-button> <el-button type="primary"
<el-button type="danger" @click="preview">预览</el-button> @click="save(1)">发布</el-button>
<el-button type="danger"
@click="preview">预览</el-button>
<el-button @click="back">取消</el-button> <el-button @click="back">取消</el-button>
</div> </div>
</div> </div>
@ -140,6 +175,8 @@
import util from "@/libs/util"; import util from "@/libs/util";
import quill from "@/components/quill"; import quill from "@/components/quill";
import Setting from "@/setting"; import Setting from "@/setting";
import Upload from '@/components/upload';
import Oss from '@/components/upload/upload.js'
export default { export default {
data () { data () {
return { return {
@ -185,6 +222,7 @@ export default {
}, },
components: { components: {
quill, quill,
Upload
}, },
watch: { watch: {
// , // ,
@ -268,10 +306,12 @@ export default {
beforeRemove (file, fileList) { beforeRemove (file, fileList) {
return this.$confirm(`确定移除 ${file.name}`); return this.$confirm(`确定移除 ${file.name}`);
}, },
handleRemove(file, fileList) { handleRemove () {
Oss.del(this.form.coverUrl)
this.form.coverUrl = '' this.form.coverUrl = ''
}, },
handleCarouselRemove(file, fileList) { handleCarouselRemove () {
Oss.del(this.form.carouselUrl)
this.form.carouselUrl = '' this.form.carouselUrl = ''
}, },
uploadError (err, file, fileList) { uploadError (err, file, fileList) {
@ -281,20 +321,25 @@ export default {
center: true center: true
}) })
}, },
uploadSuccess(res) { //
this.form.coverUrl = res.data.filesResult.fileUrl async handleRequest ({ file }) {
Oss.upload(file).then(res => {
this.form.coverUrl = res.url
})
}, },
uploadLgSuccess(res) { //
this.form.carouselUrl = res.data.filesResult.fileUrl async handleRequestLg ({ file }) {
Oss.upload(file).then(res => {
this.form.carouselUrl = res.url
})
}, },
// //
uploadAnnexSuccess(res) { uploadAnnexSuccess (file) {
const file = res.data.filesResult const url = file.url
const url = file.fileUrl || file.fileId
const data = { const data = {
activityId: this.form.id || '', activityId: this.form.id || '',
fileName: this.fileName, fileName: file.name,
name: this.fileName, name: file.name,
filePath: url, filePath: url,
url url
} }
@ -315,6 +360,7 @@ export default {
} }
}, },
handleAnnexRemove (file, fileList) { handleAnnexRemove (file, fileList) {
Oss.del(file.url)
this.form.activityFileList = fileList this.form.activityFileList = fileList
}, },
// //
@ -482,7 +528,8 @@ $upload-lg-height: 150px;
/deep/ .d-inline-block { /deep/ .d-inline-block {
width: 216px; width: 216px;
.el-select, .el-input { .el-select,
.el-input {
width: 100%; width: 100%;
} }
} }
@ -501,7 +548,7 @@ $upload-lg-height: 150px;
.remove { .remove {
width: 16px; width: 16px;
height: 16px; height: 16px;
background: url("../../../../assets/img/close.png") 0 0/cover no-repeat; background: url('../../../../assets/img/close.png') 0 0 / cover no-repeat;
cursor: pointer; cursor: pointer;
} }
} }

@ -1,45 +1,41 @@
<template> <template>
<!-- 大赛详情 --> <!-- 大赛详情 -->
<div> <div>
<el-card shadow="hover" style="margin-bottom: 20px"> <el-card shadow="hover"
style="margin-bottom: 20px">
<div class="flex-between"> <div class="flex-between">
<el-page-header @back="back" :content="(form.id ? '编辑' : '创建') + '公告'"></el-page-header> <el-page-header @back="back"
:content="(form.id ? '编辑' : '创建') + '公告'"></el-page-header>
</div> </div>
</el-card> </el-card>
<div class="page"> <div class="page">
<div class="page-content"> <div class="page-content">
<el-form label-width="170px" label-suffix=":" size="small"> <el-form label-width="170px"
label-suffix=":"
size="small">
<el-form-item label="公告标题"> <el-form-item label="公告标题">
<div class="d-inline-block"> <div class="d-inline-block">
<el-input placeholder="请输入公告名称" v-model="form.announcementTitle" clearable></el-input> <el-input placeholder="请输入公告名称"
v-model="form.announcementTitle"
clearable></el-input>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="正文"> <el-form-item label="正文">
<quill :border="true" v-model="form.announcementText" :height="400" /> <quill :border="true"
v-model="form.announcementText"
:height="400" />
</el-form-item> </el-form-item>
<el-form-item label="附件"> <el-form-item label="附件">
<el-upload <Upload :limit="5"
:on-remove="handleRemove"
:on-error="uploadError"
:on-success="uploadSuccess"
:before-upload="beforeUpload"
:before-remove="beforeRemove"
:limit="5"
:on-exceed="handleExceed"
:action="this.api.fileupload"
:headers="headers"
:file-list="fileList" :file-list="fileList"
name="file" :on-remove="handleRemove"
> @onSuccess="uploadSuccess" />
<el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">
<p>支持扩展名.rar .zip .doc .docx .pdf .jpg...</p>
</div>
</el-upload>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button v-if="!form.id" @click="save(0)">草稿</el-button> <el-button v-if="!form.id"
<el-button type="primary" @click="save(1)">发布</el-button> @click="save(0)">草稿</el-button>
<el-button type="primary"
@click="save(1)">发布</el-button>
<el-button @click="back">取消</el-button> <el-button @click="back">取消</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -52,6 +48,8 @@
import quill from "@/components/quill"; import quill from "@/components/quill";
import util from "@/libs/util"; import util from "@/libs/util";
import Setting from "@/setting"; import Setting from "@/setting";
import Upload from '@/components/upload';
import Oss from '@/components/upload/upload.js'
export default { export default {
name: "matchDetail", name: "matchDetail",
data () { data () {
@ -73,7 +71,8 @@ export default {
}; };
}, },
components: { components: {
quill quill,
Upload
}, },
watch: { watch: {
// , // ,
@ -132,22 +131,17 @@ export default {
util.warningMsg(`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`); util.warningMsg(`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`);
}, },
// //
uploadSuccess(res) { uploadSuccess (file) {
const file = res.data.filesResult
const { id } = this.form const { id } = this.form
const data = { const data = {
announcementId: id || '', announcementId: id || '',
fileName: this.fileName, fileName: file.name,
filePath: file.fileUrl || file.fileId filePath: file.url
} }
this.form.announcementAnnexList.push(data) this.form.announcementAnnexList.push(data)
// //
id && this.$post(this.api.saveActivityAnnouncementAnnex, data).then(res => { }).catch(res => { }) id && this.$post(this.api.saveActivityAnnouncementAnnex, data).then(res => { }).catch(res => { })
}, },
//
beforeUpload(file) {
this.fileName = file.name
},
uploadError (err, file, fileList) { uploadError (err, file, fileList) {
this.$message({ this.$message({
message: "上传出错,请重试!", message: "上传出错,请重试!",
@ -160,7 +154,7 @@ export default {
}, },
handleRemove (file, fileList) { handleRemove (file, fileList) {
if (file.url) { if (file.url) {
this.$del(`${this.api.fileDeletion}?keys=${file.url}`).then(res => {}).catch(res => {}) Oss.del(file.url)
const id = this.form.announcementAnnexList.find(e => e.fileName === file.name).id const id = this.form.announcementAnnexList.find(e => e.fileName === file.name).id
this.$post(`${this.api.delActivityAnnouncementAnnex}?id=${id}`).then(res => { }).catch(res => { }) this.$post(`${this.api.delActivityAnnouncementAnnex}?id=${id}`).then(res => { }).catch(res => { })
} }
@ -255,7 +249,8 @@ $upload-lg-height: 150px;
/deep/ .d-inline-block { /deep/ .d-inline-block {
width: 216px; width: 216px;
.el-select, .el-input { .el-select,
.el-input {
width: 100%; width: 100%;
} }
} }
@ -275,7 +270,7 @@ $upload-lg-height: 150px;
.remove { .remove {
width: 16px; width: 16px;
height: 16px; height: 16px;
background: url("../../../../assets/img/close.png") 0 0/cover no-repeat; background: url('../../../../assets/img/close.png') 0 0 / cover no-repeat;
cursor: pointer; cursor: pointer;
} }
} }

@ -23,7 +23,7 @@
<em>{{ end }}</em> <em>{{ end }}</em>
</p> </p>
<div class="m-l-20"> <div class="m-l-20">
<p v-if="status && status !== 5" <p v-if="status"
:class="['sign-status', {signing: status == 2,signed: status == 1,playing: status == 4}]">{{ form.competitionRegistration ? '已报名' : '未报名' }}</p> :class="['sign-status', {signing: status == 2,signed: status == 1,playing: status == 4}]">{{ form.competitionRegistration ? '已报名' : '未报名' }}</p>
<el-dropdown v-if="playingStages.length > 1" <el-dropdown v-if="playingStages.length > 1"
@command="chooseStage"> @command="chooseStage">
@ -690,7 +690,7 @@
<script> <script>
import { mapState, mapMutations } from "vuex"; import { mapState, mapMutations } from "vuex";
import breadcrumb from '@/components/breadcrumb' import breadcrumb from '@/components/breadcrumb'
import util from '@/libs/util' import Util from '@/libs/util'
import Setting from "@/setting" import Setting from "@/setting"
import Const from '@/const/match' import Const from '@/const/match'
import OSS from 'ali-oss' import OSS from 'ali-oss'
@ -701,9 +701,9 @@ export default {
data () { data () {
return { return {
headers: { headers: {
token: util.local.get(Setting.tokenKey) token: Util.local.get(Setting.tokenKey)
}, },
token: util.local.get(Setting.tokenKey), token: Util.local.get(Setting.tokenKey),
id: +this.$route.query.id, id: +this.$route.query.id,
end: '', end: '',
status: '', status: '',
@ -819,6 +819,7 @@ export default {
client: null, client: null,
uploading: false, uploading: false,
uploadProgress: 0, uploadProgress: 0,
now: ''
}; };
}, },
computed: { computed: {
@ -851,13 +852,13 @@ export default {
]), ]),
getData () { // getData () { //
clearInterval(this.timer) clearInterval(this.timer)
this.$post(`${this.api.getCompetition}?competitionId=${this.id}`).then(({ competition }) => { this.$post(`${this.api.getCompetition}?competitionId=${this.id}`).then(async ({ competition }) => {
const list = competition.competitionAnnexList const list = competition.competitionAnnexList
// //
if (list) { if (list) {
list.map(e => { list.map(e => {
const { filePath } = e const { filePath } = e
e.canPreview = util.canPreview(filePath.substr(filePath.lastIndexOf('.') + 1)) e.canPreview = Util.canPreview(filePath.substr(filePath.lastIndexOf('.') + 1))
}) })
} }
@ -891,8 +892,13 @@ export default {
} }
this.$refs.breadcrumb.update('全部赛事/' + competition.name) this.$refs.breadcrumb.update('全部赛事/' + competition.name)
const res = await this.$get(this.api.getCurrentTime)
this.now = new Date(res.currentTime)
this.handleStatus() this.handleStatus()
this.timer = setInterval(this.handleStatus, 1000) this.timer = setInterval(() => {
this.now = new Date(this.now.setSeconds(this.now.getSeconds() + 1))
this.handleStatus()
}, 1000)
}).catch(err => { }) }).catch(err => { })
}, },
// //
@ -905,7 +911,7 @@ export default {
let signUpEndTime = new Date(this.core.dateCompatible(form.signUpEndTime)) // let signUpEndTime = new Date(this.core.dateCompatible(form.signUpEndTime)) //
let playStartTime = new Date(this.core.dateCompatible(form.playStartTime)) // let playStartTime = new Date(this.core.dateCompatible(form.playStartTime)) //
let playEndTime = new Date(this.core.dateCompatible(form.playEndTime)) // let playEndTime = new Date(this.core.dateCompatible(form.playEndTime)) //
const now = new Date() const { now } = this
if (now < signUpStartTime) { // if (now < signUpStartTime) { //
status = 0 status = 0
total = signUpStartTime - now total = signUpStartTime - now
@ -1061,7 +1067,7 @@ export default {
}).then(res => { }).then(res => {
this.editing = false this.editing = false
this.getInfo() this.getInfo()
showMsg && util.successMsg('保存成功') showMsg && Util.successMsg('保存成功')
}).catch(res => { }) }).catch(res => { })
} else { } else {
this.editing = !this.editing this.editing = !this.editing
@ -1088,11 +1094,11 @@ export default {
preview (item) { preview (item) {
const { filePath } = item const { filePath } = item
const suffix = filePath.substr(filePath.lastIndexOf('.') + 1) const suffix = filePath.substr(filePath.lastIndexOf('.') + 1)
window.open((util.isDoc(suffix) ? 'https://view.officeapps.live.com/op/view.aspx?src=' : '') + item.filePath) window.open((Util.isDoc(suffix) ? 'https://view.officeapps.live.com/op/view.aspx?src=' : '') + item.filePath)
}, },
// //
download (item) { download (item) {
util.downloadFile(item.fileName, item.filePath) Util.downloadFile(item.fileName, item.filePath)
}, },
// tab // tab
typeChange () { typeChange () {
@ -1169,7 +1175,7 @@ export default {
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.$post(`${this.api.deleteAnAdvisor}?id=${row.id}`).then(res => { this.$post(`${this.api.deleteAnAdvisor}?id=${row.id}`).then(res => {
util.successMsg('删除成功') Util.successMsg('删除成功')
this.getInfo() this.getInfo()
}).catch(res => { }) }).catch(res => { })
}).catch(() => { }) }).catch(() => { })
@ -1179,7 +1185,7 @@ export default {
}, },
// //
addAdvisor () { addAdvisor () {
if (this.info.teamInstructors.length > 4) return util.errorMsg('指导老师仅限添加5个!') if (this.info.teamInstructors.length > 4) return Util.errorMsg('指导老师仅限添加5个!')
this.info.teamInstructors.push(JSON.parse(JSON.stringify(this.originIns))) this.info.teamInstructors.push(JSON.parse(JSON.stringify(this.originIns)))
}, },
// //
@ -1188,9 +1194,9 @@ export default {
}, },
// //
submitAdvisor (row) { submitAdvisor (row) {
if (!row.name) return util.errorMsg('请输入姓名') if (!row.name) return Util.errorMsg('请输入姓名')
const { phone } = row const { phone } = row
if (phone && !/^1[3456789]\d{9}$/.test(phone)) return util.errorMsg('请输入正确手机号格式') if (phone && !/^1[3456789]\d{9}$/.test(phone)) return Util.errorMsg('请输入正确手机号格式')
this.$post(this.api.addAnAdvisor, { this.$post(this.api.addAnAdvisor, {
name: row.name, name: row.name,
competitionId: this.id, competitionId: this.id,
@ -1199,7 +1205,7 @@ export default {
phone: row.phone, phone: row.phone,
position: row.position, position: row.position,
}).then(res => { }).then(res => {
util.successMsg((row.id ? '修改' : '新增') + '成功') Util.successMsg((row.id ? '修改' : '新增') + '成功')
this.getInfo() this.getInfo()
}).catch(res => { }) }).catch(res => { })
}, },
@ -1210,7 +1216,7 @@ export default {
let start = 0 let start = 0
for (const e of this.form.competitionStage) { for (const e of this.form.competitionStage) {
if (now >= new Date(e.startTime) && now <= new Date(e.endTime)) { if (now >= new Date(e.startTime) && now <= new Date(e.endTime)) {
util.errorMsg('比赛已经开始,无法转让队长!') Util.errorMsg('比赛已经开始,无法转让队长!')
start = 1 start = 1
break break
} }
@ -1219,13 +1225,13 @@ export default {
}, },
// //
transferSubmit () { transferSubmit () {
if (!this.checkedPlayer) return util.errorMsg('请选择成员') if (!this.checkedPlayer) return Util.errorMsg('请选择成员')
this.$post(this.api.captainOfTransfer, { this.$post(this.api.captainOfTransfer, {
captainId: this.info.caption.teamId, captainId: this.info.caption.teamId,
playerId: this.checkedPlayer playerId: this.checkedPlayer
}).then(res => { }).then(res => {
this.checkedPlayer = '' this.checkedPlayer = ''
util.successMsg('转让成功') Util.successMsg('转让成功')
this.transferVisible = false this.transferVisible = false
this.getInfo() this.getInfo()
}).catch(res => { }) }).catch(res => { })
@ -1237,7 +1243,7 @@ export default {
let start = 0 let start = 0
for (const e of this.form.competitionStage) { for (const e of this.form.competitionStage) {
if (now >= new Date(e.startTime) && now <= new Date(e.endTime)) { if (now >= new Date(e.startTime) && now <= new Date(e.endTime)) {
util.errorMsg('比赛已经开始,无法踢出成员!') Util.errorMsg('比赛已经开始,无法踢出成员!')
start = 1 start = 1
break break
} }
@ -1257,7 +1263,7 @@ export default {
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.$post(`${this.api.removeTheLine}?teamId=${this.info.teamId}&competitionId=${this.id}&accountId=${row.accountId}`).then(res => { this.$post(`${this.api.removeTheLine}?teamId=${this.info.teamId}&competitionId=${this.id}&accountId=${row.accountId}`).then(res => {
util.successMsg('移除成功') Util.successMsg('移除成功')
this.getInfo() this.getInfo()
}).catch(res => { }) }).catch(res => { })
}).catch(() => { }) }).catch(() => { })
@ -1270,7 +1276,7 @@ export default {
// //
const now = new Date() const now = new Date()
if (now >= new Date(item.startTime) && now <= new Date(item.endTime)) { if (now >= new Date(item.startTime) && now <= new Date(item.endTime)) {
return util.errorMsg('该阶段比赛已经开始,无法修改允许参赛人员!') return Util.errorMsg('该阶段比赛已经开始,无法修改允许参赛人员!')
} else { } else {
this.$confirm('确定要移除该成员吗?', '提示', { this.$confirm('确定要移除该成员吗?', '提示', {
type: 'warning' type: 'warning'
@ -1281,7 +1287,7 @@ export default {
stageId: stage.stageId, stageId: stage.stageId,
teamId: this.info.teamId teamId: this.info.teamId
}).then(res => { }).then(res => {
util.successMsg('移除成功') Util.successMsg('移除成功')
this.getInfo() this.getInfo()
}).catch(res => { }) }).catch(res => { })
}).catch(() => { }) }).catch(() => { })
@ -1295,7 +1301,7 @@ export default {
// //
const now = new Date() const now = new Date()
if (now >= new Date(item.startTime) && now <= new Date(item.endTime)) { if (now >= new Date(item.startTime) && now <= new Date(item.endTime)) {
return util.errorMsg('该阶段比赛已经开始,无法修改允许参赛人员!') return Util.errorMsg('该阶段比赛已经开始,无法修改允许参赛人员!')
} else { } else {
const { teamLimit, stages, teamDetail } = this.info const { teamLimit, stages, teamDetail } = this.info
// teamLimit=truestagesparticipantAccountIdsaccountId // teamLimit=truestagesparticipantAccountIdsaccountId
@ -1324,9 +1330,9 @@ export default {
// //
chooseSubmit () { chooseSubmit () {
const accountIds = this.checkedMembers const accountIds = this.checkedMembers
if (!accountIds.length) return util.errorMsg('请选择参赛成员!') if (!accountIds.length) return Util.errorMsg('请选择参赛成员!')
const limit = this.curRow.teamNumLimit // const limit = this.curRow.teamNumLimit //
if (limit && accountIds.length > limit) return util.errorMsg(`请选择${limit}个以下参赛成员!`) // if (limit && accountIds.length > limit) return Util.errorMsg(`请选择${limit}个以下参赛成员!`) //
this.$post(this.api.stageSelectParticipants, { this.$post(this.api.stageSelectParticipants, {
accountIds, accountIds,
competitionId: this.id, competitionId: this.id,
@ -1334,7 +1340,7 @@ export default {
teamId: this.info.teamId teamId: this.info.teamId
}).then(res => { }).then(res => {
this.checkedMembers = [] this.checkedMembers = []
util.successMsg('修改成功') Util.successMsg('修改成功')
this.getInfo() this.getInfo()
this.chooseVisible = false this.chooseVisible = false
}).catch(res => { }) }).catch(res => { })
@ -1382,14 +1388,14 @@ export default {
// //
enterSubmit () { enterSubmit () {
const form = this.enterForm const form = this.enterForm
if (!form.teamId) return util.errorMsg('请选择团队') if (!form.teamId) return Util.errorMsg('请选择团队')
if (!form.invitationCode) return util.errorMsg('请输入团队邀请码') if (!form.invitationCode) return Util.errorMsg('请输入团队邀请码')
if (this.form.completeCompetitionSetup.isNeedCode && !form.registrationInvitationCode) return util.errorMsg('请输入大赛邀请码') if (this.form.completeCompetitionSetup.isNeedCode && !form.registrationInvitationCode) return Util.errorMsg('请输入大赛邀请码')
this.$post(this.api.joinCompetitionTeam, form).then(res => { this.$post(this.api.joinCompetitionTeam, form).then(res => {
this.status = 1 this.status = 1
this.enterVisible = false this.enterVisible = false
this.getData() this.getData()
util.successMsg('报名成功!') Util.successMsg('报名成功!')
}).catch(res => { }) }).catch(res => { })
}, },
// //
@ -1420,15 +1426,15 @@ export default {
// //
teamSubmit () { teamSubmit () {
const form = this.teamForm const form = this.teamForm
if (!form.teamName) return util.errorMsg('请输入团队名称') if (!form.teamName) return Util.errorMsg('请输入团队名称')
if (this.teamNameRepeat) return util.errorMsg('团队名称重复,请重新输入') if (this.teamNameRepeat) return Util.errorMsg('团队名称重复,请重新输入')
if (form.invitationCode.length !== 6) return util.errorMsg('请输入6位数团队邀请码') if (form.invitationCode.length !== 6) return Util.errorMsg('请输入6位数团队邀请码')
if (this.form.completeCompetitionSetup.isNeedCode && !form.registrationInvitationCode) return util.errorMsg('请输入大赛邀请码') if (this.form.completeCompetitionSetup.isNeedCode && !form.registrationInvitationCode) return Util.errorMsg('请输入大赛邀请码')
this.$post(this.api.addCompetitionTeam, form).then(({ status, data, message }) => { this.$post(this.api.addCompetitionTeam, form).then(({ status, data, message }) => {
this.teamVisible = false this.teamVisible = false
this.enterVisible = false this.enterVisible = false
this.getData() this.getData()
util.successMsg('报名成功!') Util.successMsg('报名成功!')
}).catch(res => { }) }).catch(res => { })
}, },
// //
@ -1448,7 +1454,7 @@ export default {
// //
beforeUpload (file) { beforeUpload (file) {
const oversize = file.size / 1024 / 1024 < 1000 const oversize = file.size / 1024 / 1024 < 1000
if (!oversize) util.warningMsg('请上传小于1GB的附件!') if (!oversize) Util.warningMsg('请上传小于1GB的附件!')
if (oversize) { if (oversize) {
return true return true
} else { } else {
@ -1466,7 +1472,7 @@ export default {
this.uploadProgress = 0 this.uploadProgress = 0
this.uploading = true this.uploading = true
// ossurl // ossurl
const { name } = await this.client.multipartUpload(file.name, file, { const { name } = await this.client.multipartUpload(Date.now() + '.' + Util.getFileExt(file.name), file, {
progress: this.handleProgress progress: this.handleProgress
}); });
@ -1480,7 +1486,7 @@ export default {
// url // url
const res = await this.$post(this.api.cCompetitionStageFileSave, { const res = await this.$post(this.api.cCompetitionStageFileSave, {
competitionId: this.id, competitionId: this.id,
fileFormat: util.getFileExt(file.name), fileFormat: Util.getFileExt(file.name),
fileName: file.name, fileName: file.name,
filePath: url, filePath: url,
fileSize: file.size, fileSize: file.size,
@ -1488,7 +1494,7 @@ export default {
teamId: this.form.competitionRegistration.teamId teamId: this.form.competitionRegistration.teamId
}) })
this.curFileId = res.message this.curFileId = res.message
util.successMsg(`上传成功!`); Util.successMsg(`上传成功!`);
} catch (error) { } } catch (error) { }
}, },
@ -1503,7 +1509,7 @@ export default {
return this.$confirm(`确定移除 ${file.name}`); return this.$confirm(`确定移除 ${file.name}`);
}, },
handleExceed (files, fileList) { handleExceed (files, fileList) {
util.warningMsg(`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`); Util.warningMsg(`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`);
}, },
// //
handleRemove (file) { handleRemove (file) {
@ -1552,7 +1558,7 @@ export default {
signup () { signup () {
const { status, form } = this const { status, form } = this
// //
if (util.local.get(Setting.tokenKey)) { if (Util.local.get(Setting.tokenKey)) {
const { competitionType } = form.completeCompetitionSetup const { competitionType } = form.completeCompetitionSetup
if (status == 4) { // if (status == 4) { //
// 线(handleStatus) // 线(handleStatus)
@ -1587,8 +1593,8 @@ export default {
} }
} else { } else {
// //
if (this.curStage && this.curStage.count) return util.errorMsg('您已经参加过该阶段竞赛!') if (this.curStage && this.curStage.count) return Util.errorMsg('您已经参加过该阶段竞赛!')
if (form.competitionRegistration.isDisable === 1) return util.errorMsg('当前用户已被禁赛,如有疑问,请联系平台管理员。') // if (form.competitionRegistration.isDisable === 1) return Util.errorMsg('当前用户已被禁赛,如有疑问,请联系平台管理员。') //
// //
if (competitionType) { if (competitionType) {
this.$post(this.api.isParticipant, { this.$post(this.api.isParticipant, {
@ -1647,26 +1653,26 @@ export default {
// python // python
toPython () { toPython () {
const form = this.curStage const form = this.curStage
let token = util.local.get(Setting.tokenKey); let token = Util.local.get(Setting.tokenKey);
util.cookies.set('assessmentId', '', -1) Util.cookies.set('assessmentId', '', -1)
util.cookies.set('startTime', '', -1) Util.cookies.set('startTime', '', -1)
util.cookies.set('stopTime', '', -1) Util.cookies.set('stopTime', '', -1)
util.cookies.set('projectId', form.projectId) Util.cookies.set('projectId', form.projectId)
util.cookies.set('token', token) Util.cookies.set('token', token)
util.cookies.set('courseId', form.cid) Util.cookies.set('courseId', form.cid)
util.cookies.set('curriculumName', encodeURIComponent(form.systemName)) Util.cookies.set('curriculumName', encodeURIComponent(form.systemName))
util.cookies.set('systemId', form.systemId) Util.cookies.set('systemId', form.systemId)
util.cookies.set('isSubmit', '', -1) Util.cookies.set('isSubmit', '', -1)
util.cookies.set('className', '', -1) Util.cookies.set('className', '', -1)
util.cookies.set('competitionId', this.form.id) Util.cookies.set('competitionId', this.form.id)
util.cookies.set('stageId', form.stageId) Util.cookies.set('stageId', form.stageId)
util.cookies.set('teamId', this.form.competitionRegistration.teamId) Util.cookies.set('teamId', this.form.competitionRegistration.teamId)
util.cookies.set('stopTime', form.endTime) Util.cookies.set('stopTime', form.endTime)
util.cookies.set('resultsDetails', form.resultsDetails) Util.cookies.set('resultsDetails', form.resultsDetails)
util.cookies.set('resultAnnouncementTime', form.resultAnnouncementTime) Util.cookies.set('resultAnnouncementTime', form.resultAnnouncementTime)
util.cookies.set('mallId', form.mallId) Util.cookies.set('mallId', form.mallId)
util.cookies.set('fromManager', '', -1) Util.cookies.set('fromManager', '', -1)
util.cookies.set('language', '', -1) Util.cookies.set('language', '', -1)
// 8pythoncookiesystemId // 8pythoncookiesystemId
location.href = process.env.NODE_ENV === 'development' ? location.href = process.env.NODE_ENV === 'development' ?
`http://${location.hostname}:8085/#/` : `http://${location.hostname}:8085/#/` :
@ -1680,7 +1686,7 @@ export default {
const { systemId, projectId, cid, stageId, startTime, endTime, mallId } = this.curStage const { systemId, projectId, cid, stageId, startTime, endTime, mallId } = this.curStage
const competitionId = form.id const competitionId = form.id
const teamId = form.competitionRegistration.teamId const teamId = form.competitionRegistration.teamId
let token = util.local.get(Setting.tokenKey); let token = Util.local.get(Setting.tokenKey);
if (systemId == 11) { if (systemId == 11) {
// //
location.href = `${Setting.systemPath}/#/index/list?curriculumName=${this.curriculumName}&token=${token}&cid=${cid}&systemId=${systemId}&projectId=${projectId}&competitionId=${competitionId}&stageId=${stageId}&teamId=${teamId}&assessmentId=&classId=&stopTime=&test=true` location.href = `${Setting.systemPath}/#/index/list?curriculumName=${this.curriculumName}&token=${token}&cid=${cid}&systemId=${systemId}&projectId=${projectId}&competitionId=${competitionId}&stageId=${stageId}&teamId=${teamId}&assessmentId=&classId=&stopTime=&test=true`

@ -109,8 +109,8 @@
<div> <div>
<span class="label">比赛时间</span><span class="val">{{ item.playStartTime}} ~ {{ item.playEndTime }}</span> <span class="label">比赛时间</span><span class="val">{{ item.playStartTime}} ~ {{ item.playEndTime }}</span>
</div> </div>
<div :title="item.locations"> <div :title="item.locations || item.range">
<span class="label">比赛范围</span><span class="val">{{ item.locations }}</span> <span class="label">比赛范围</span><span class="val">{{ item.locations || item.range }}</span>
</div> </div>
<div> <div>
<span class="label">比赛类型</span><span class="val">{{ item.competitionType ? '团体赛' : '个人赛' }}</span> <span class="label">比赛类型</span><span class="val">{{ item.competitionType ? '团体赛' : '个人赛' }}</span>
@ -122,7 +122,7 @@
</div> </div>
</div> </div>
<div class="right"> <div class="right">
<p v-if="item.status && item.status !== 5" <p v-if="item.status"
:class="['sign-status', {signing: item.status == 2, signed: item.status == 1, playing: item.status == 4 && item.curStage}]">{{ item.whetherToSignUp === 0 ? '已报名' : '未报名' }}</p> :class="['sign-status', {signing: item.status == 2, signed: item.status == 1, playing: item.status == 4 && item.curStage}]">{{ item.whetherToSignUp === 0 ? '已报名' : '未报名' }}</p>
<el-dropdown v-if="item.playingStages && item.playingStages.length > 1" <el-dropdown v-if="item.playingStages && item.playingStages.length > 1"
@click.stop="stageClick" @click.stop="stageClick"
@ -336,7 +336,7 @@
import { mapState, mapMutations } from "vuex"; import { mapState, mapMutations } from "vuex";
import { Loading } from "element-ui"; import { Loading } from "element-ui";
import Setting from "@/setting" import Setting from "@/setting"
import util from "@/libs/util" import Util from "@/libs/util"
import Bus from '@/libs/bus' import Bus from '@/libs/bus'
import OSS from 'ali-oss' import OSS from 'ali-oss'
import OssConfig from '@/components/upload/config.js' import OssConfig from '@/components/upload/config.js'
@ -346,10 +346,10 @@ export default {
data () { data () {
return { return {
headers: { headers: {
token: util.local.get(Setting.tokenKey) token: Util.local.get(Setting.tokenKey)
}, },
timer: null, timer: null,
token: util.local.get(Setting.tokenKey), token: Util.local.get(Setting.tokenKey),
statusList: ["待报名", "取消报名", "马上报名", "报名截止", "进入初赛", "已结束"], statusList: ["待报名", "取消报名", "马上报名", "报名截止", "进入初赛", "已结束"],
endList: ["报名开始", "报名截止", "报名截止", "竞赛开始", "竞赛结束", ""], endList: ["报名开始", "报名截止", "报名截止", "竞赛开始", "竞赛结束", ""],
typeList: [ typeList: [
@ -467,6 +467,8 @@ export default {
client: null, client: null,
uploading: false, uploading: false,
uploadProgress: 0, uploadProgress: 0,
now: '',
timer: null,
}; };
}, },
computed: { computed: {
@ -505,7 +507,7 @@ export default {
...mapMutations('match', [ ...mapMutations('match', [
'SET_TYPE' 'SET_TYPE'
]), ]),
getData () { async getData () {
this.clearTimer() this.clearTimer()
const { form } = this const { form } = this
const { eventType, competitionScope } = form const { eventType, competitionScope } = form
@ -521,23 +523,23 @@ export default {
} }
if (eventType === 2 && !competitionScope) form.competitionScope = 3 // 广competitionScope=03广 if (eventType === 2 && !competitionScope) form.competitionScope = 3 // 广competitionScope=03广
if (eventType !== 1) data.competitionScope = form.competitionScope // if (eventType !== 1) data.competitionScope = form.competitionScope //
this.$post(this.api.competitionAfterLogin, data).then(({ data }) => { this.$post(this.api.competitionAfterLogin, data).then(async ({ data }) => {
this.listData = data.records this.listData = data.records
this.totals = data.total this.totals = data.total
const res = await this.$get(this.api.getCurrentTime)
this.now = new Date(res.currentTime)
this.statusInterval() this.statusInterval()
// this.loadIns.close(); this.timer = setInterval(() => {
}).catch(res => { this.now = new Date(this.now.setSeconds(this.now.getSeconds() + 1))
// this.loadIns.close() this.statusInterval()
}) }, 1000)
}).catch(res => { })
}, },
statusInterval () { async statusInterval () {
this.listData.map(item => { this.listData.map(item => {
if (item.signUpStartTime && item.signUpEndTime && item.playStartTime && item.playEndTime) { if (item.signUpStartTime && item.signUpEndTime && item.playStartTime && item.playEndTime) {
this.handleStatus(item) this.handleStatus(item)
let timer = setInterval(() => {
this.handleStatus(item)
}, 1000)
this.timerList.push(timer)
} }
}) })
}, },
@ -550,7 +552,7 @@ export default {
let signUpEndTime = new Date(this.core.dateCompatible(item.signUpEndTime)) // let signUpEndTime = new Date(this.core.dateCompatible(item.signUpEndTime)) //
let playStartTime = new Date(this.core.dateCompatible(item.playStartTime)) // let playStartTime = new Date(this.core.dateCompatible(item.playStartTime)) //
let playEndTime = new Date(this.core.dateCompatible(item.playEndTime)) // let playEndTime = new Date(this.core.dateCompatible(item.playEndTime)) //
const now = new Date() const { now } = this
if (now < signUpStartTime) { // if (now < signUpStartTime) { //
status = 0 status = 0
total = signUpStartTime - now total = signUpStartTime - now
@ -613,6 +615,7 @@ export default {
this.$set(item, 'status', status) this.$set(item, 'status', status)
total = total / 1000 total = total / 1000
--total --total
console.log("🚀 ~ file: index.vue:621 ~ handleStatus ~ now.getSeconds():", now, now.getSeconds())
if (total > 86400) { // if (total > 86400) { //
this.$set(item, 'end', Math.floor(total / 86400) + '天') this.$set(item, 'end', Math.floor(total / 86400) + '天')
} else if (total > 0) { // } else if (total > 0) { //
@ -625,10 +628,7 @@ export default {
}, },
// //
clearTimer () { clearTimer () {
this.timerList.forEach(n => { clearInterval(this.timer)
clearInterval(n)
})
this.timerList = []
}, },
initData () { initData () {
this.page = 1 this.page = 1
@ -671,6 +671,10 @@ export default {
// //
changeScope (type) { changeScope (type) {
this.form.competitionScope = type this.form.competitionScope = type
if (type !== 2) {
this.form.provinceId = ''
this.form.cityId = ''
}
this.initData() this.initData()
}, },
// //
@ -701,13 +705,13 @@ export default {
// //
enterSubmit () { enterSubmit () {
const form = this.enterForm const form = this.enterForm
if (!form.teamId) return util.errorMsg('请选择团队') if (!form.teamId) return Util.errorMsg('请选择团队')
if (!form.invitationCode) return util.errorMsg('请输入团队邀请码') if (!form.invitationCode) return Util.errorMsg('请输入团队邀请码')
if (this.curItem.isNeedCode && !form.registrationInvitationCode) return util.errorMsg('请输入大赛邀请码') if (this.curItem.isNeedCode && !form.registrationInvitationCode) return Util.errorMsg('请输入大赛邀请码')
this.$post(this.api.joinCompetitionTeam, form).then(res => { this.$post(this.api.joinCompetitionTeam, form).then(res => {
this.enterVisible = false this.enterVisible = false
this.getData() this.getData()
util.successMsg('报名成功!') Util.successMsg('报名成功!')
}).catch(res => { }) }).catch(res => { })
}, },
@ -735,15 +739,15 @@ export default {
// //
teamSubmit () { teamSubmit () {
const form = this.teamForm const form = this.teamForm
if (!form.teamName) return util.errorMsg('请输入团队名称') if (!form.teamName) return Util.errorMsg('请输入团队名称')
if (this.teamNameRepeat) return util.errorMsg('团队名称重复,请重新输入') if (this.teamNameRepeat) return Util.errorMsg('团队名称重复,请重新输入')
if (form.invitationCode.length !== 6) return util.errorMsg('请输入6位数团队邀请码') if (form.invitationCode.length !== 6) return Util.errorMsg('请输入6位数团队邀请码')
if (this.curItem.isNeedCode && !form.registrationInvitationCode) return util.errorMsg('请输入大赛邀请码') if (this.curItem.isNeedCode && !form.registrationInvitationCode) return Util.errorMsg('请输入大赛邀请码')
this.$post(this.api.addCompetitionTeam, form).then(res => { this.$post(this.api.addCompetitionTeam, form).then(res => {
this.teamVisible = false this.teamVisible = false
this.enterVisible = false this.enterVisible = false
this.getData() this.getData()
util.successMsg('报名成功!') Util.successMsg('报名成功!')
}).catch(res => { }) }).catch(res => { })
}, },
// 线 // 线
@ -760,7 +764,7 @@ export default {
// //
beforeUpload (file) { beforeUpload (file) {
const oversize = file.size / 1024 / 1024 < 1000 const oversize = file.size / 1024 / 1024 < 1000
if (!oversize) util.warningMsg('请上传小于1GB的附件!') if (!oversize) Util.warningMsg('请上传小于1GB的附件!')
if (oversize) { if (oversize) {
return true return true
} else { } else {
@ -778,7 +782,7 @@ export default {
this.uploadProgress = 0 this.uploadProgress = 0
this.uploading = true this.uploading = true
// ossurl // ossurl
const { name } = await this.client.multipartUpload(file.name, file, { const { name } = await this.client.multipartUpload(Date.now() + '.' + Util.getFileExt(file.name), file, {
progress: this.handleProgress progress: this.handleProgress
}); });
@ -792,7 +796,7 @@ export default {
// url // url
const res = await this.$post(this.api.cCompetitionStageFileSave, { const res = await this.$post(this.api.cCompetitionStageFileSave, {
competitionId: this.curItem.id, competitionId: this.curItem.id,
fileFormat: util.getFileExt(file.name), fileFormat: Util.getFileExt(file.name),
fileName: file.name, fileName: file.name,
filePath: url, filePath: url,
fileSize: file.size, fileSize: file.size,
@ -800,7 +804,7 @@ export default {
teamId: this.curItem.teamId teamId: this.curItem.teamId
}) })
this.curFileId = res.message this.curFileId = res.message
util.successMsg(`上传成功!`); Util.successMsg(`上传成功!`);
} catch (error) { } } catch (error) { }
}, },
@ -815,7 +819,7 @@ export default {
return this.$confirm(`确定移除 ${file.name}`); return this.$confirm(`确定移除 ${file.name}`);
}, },
handleExceed (files, fileList) { handleExceed (files, fileList) {
util.warningMsg(`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`); Util.warningMsg(`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`);
}, },
// //
handleRemove (file) { handleRemove (file) {
@ -843,7 +847,7 @@ export default {
stageId: this.curStageItem.stageId, stageId: this.curStageItem.stageId,
teamId: this.curItem.teamId teamId: this.curItem.teamId
}).then(res => { }).then(res => {
util.successMsg('提交成功!') Util.successMsg('提交成功!')
}).catch(res => { }) }).catch(res => { })
}, },
@ -859,7 +863,7 @@ export default {
}, },
// //
download (item) { download (item) {
util.downloadFile(item.fileName, item.filePath) Util.downloadFile(item.fileName, item.filePath)
}, },
// 线<> // 线<>
toOffline () { toOffline () {
@ -893,7 +897,7 @@ export default {
const { status, id } = item const { status, id } = item
const { competitionType } = item const { competitionType } = item
// //
if (util.local.get(Setting.tokenKey)) { if (Util.local.get(Setting.tokenKey)) {
this.curItem = item this.curItem = item
if (status == 4) { // if (status == 4) { //
// 线(handleStatus) // 线(handleStatus)
@ -929,8 +933,8 @@ export default {
} }
} else { } else {
// //
if (item.curStage.count) return util.errorMsg('您已经参加过该阶段竞赛!') if (item.curStage.count) return Util.errorMsg('您已经参加过该阶段竞赛!')
if (item.isDisable === 1) return util.errorMsg('当前用户已被禁赛,如有疑问,请联系平台管理员。') // if (item.isDisable === 1) return Util.errorMsg('当前用户已被禁赛,如有疑问,请联系平台管理员。') //
// //
if (competitionType) { if (competitionType) {
this.$post(this.api.isParticipant, { this.$post(this.api.isParticipant, {
@ -992,26 +996,26 @@ export default {
// python // python
toPython () { toPython () {
const form = this.curItem.curStage const form = this.curItem.curStage
let token = util.local.get(Setting.tokenKey); let token = Util.local.get(Setting.tokenKey);
util.cookies.set('assessmentId', '', -1) Util.cookies.set('assessmentId', '', -1)
util.cookies.set('startTime', '', -1) Util.cookies.set('startTime', '', -1)
util.cookies.set('stopTime', '', -1) Util.cookies.set('stopTime', '', -1)
util.cookies.set('projectId', form.projectId) Util.cookies.set('projectId', form.projectId)
util.cookies.set('token', token) Util.cookies.set('token', token)
util.cookies.set('courseId', form.cid) Util.cookies.set('courseId', form.cid)
util.cookies.set('curriculumName', encodeURIComponent(form.systemName)) Util.cookies.set('curriculumName', encodeURIComponent(form.systemName))
util.cookies.set('systemId', form.systemId) Util.cookies.set('systemId', form.systemId)
util.cookies.set('competitionId', this.curItem.id) Util.cookies.set('competitionId', this.curItem.id)
util.cookies.set('stageId', form.stageId) Util.cookies.set('stageId', form.stageId)
util.cookies.set('teamId', this.curItem.teamId) Util.cookies.set('teamId', this.curItem.teamId)
util.cookies.set('stopTime', form.endTime) Util.cookies.set('stopTime', form.endTime)
util.cookies.set('resultsDetails', form.resultsDetails) Util.cookies.set('resultsDetails', form.resultsDetails)
util.cookies.set('resultAnnouncementTime', form.resultAnnouncementTime) Util.cookies.set('resultAnnouncementTime', form.resultAnnouncementTime)
util.cookies.set('mallId', form.mallId) Util.cookies.set('mallId', form.mallId)
util.cookies.set('fromManager', '', -1) Util.cookies.set('fromManager', '', -1)
util.cookies.set('isSubmit', '', -1) Util.cookies.set('isSubmit', '', -1)
util.cookies.set('language', '', -1) Util.cookies.set('language', '', -1)
util.cookies.set('className', '', -1) Util.cookies.set('className', '', -1)
// 8pythoncookiesystemId // 8pythoncookiesystemId
location.href = process.env.NODE_ENV === 'development' ? location.href = process.env.NODE_ENV === 'development' ?
`http://${location.hostname}:8085/#/` : `http://${location.hostname}:8085/#/` :
@ -1025,7 +1029,7 @@ export default {
const { systemId, projectId, cid, stageId, startTime, endTime, mallId } = form.curStage const { systemId, projectId, cid, stageId, startTime, endTime, mallId } = form.curStage
const competitionId = form.id const competitionId = form.id
const teamId = form.teamId const teamId = form.teamId
let token = util.local.get(Setting.tokenKey); let token = Util.local.get(Setting.tokenKey);
if (systemId == 11) { if (systemId == 11) {
// //
location.href = `${Setting.systemPath}/#/index/list?curriculumName=${this.curriculumName}&token=${token}&cid=${cid}&systemId=${systemId}&projectId=${projectId}&competitionId=${competitionId}&stageId=${stageId}&teamId=${teamId}&assessmentId=&classId=&stopTime=&test=true` location.href = `${Setting.systemPath}/#/index/list?curriculumName=${this.curriculumName}&token=${token}&cid=${cid}&systemId=${systemId}&projectId=${projectId}&competitionId=${competitionId}&stageId=${stageId}&teamId=${teamId}&assessmentId=&classId=&stopTime=&test=true`

@ -93,8 +93,8 @@
<div> <div>
<span class="label">比赛时间</span><span class="val">{{ item.playStartTime}} ~ {{ item.playEndTime }}</span> <span class="label">比赛时间</span><span class="val">{{ item.playStartTime}} ~ {{ item.playEndTime }}</span>
</div> </div>
<div :title="item.locations"> <div :title="item.locations || item.range">
<span class="label">比赛范围</span><span class="val">{{ item.locations }}</span> <span class="label">比赛范围</span><span class="val">{{ item.locations || item.range }}</span>
</div> </div>
<div> <div>
<span class="label">比赛类型</span><span class="val">{{ item.competitionType ? '团体赛' : '个人赛' }}</span> <span class="label">比赛类型</span><span class="val">{{ item.competitionType ? '团体赛' : '个人赛' }}</span>
@ -346,7 +346,9 @@ export default {
peopleSignupForm: { peopleSignupForm: {
registrationInvitationCode: '' registrationInvitationCode: ''
}, },
curRow: {} curRow: {},
now: '',
timer: null,
}; };
}, },
computed: { computed: {
@ -386,31 +388,33 @@ export default {
sequence: form.sequence || null, sequence: form.sequence || null,
keyWord: this.keyword keyWord: this.keyword
} }
this.$post(this.api[util.local.get(Setting.tokenKey) ? 'competitionAfterLogin' : 'notLoggedInBeforeStudentEvents'], data).then(({ data }) => { this.$post(this.api[util.local.get(Setting.tokenKey) ? 'competitionAfterLogin' : 'notLoggedInBeforeStudentEvents'], data).then(async ({ data }) => {
this.listData = data.records this.listData = data.records
this.totals = data.total this.totals = data.total
const res = await this.$get(this.api.getCurrentTime)
this.now = new Date(res.currentTime)
this.statusInterval() this.statusInterval()
this.timer = setInterval(() => {
this.now = new Date(this.now.setSeconds(this.now.getSeconds() + 1))
this.statusInterval()
}, 1000)
this.loadIns.close() this.loadIns.close()
}).catch(res => { }).catch(res => {
this.loadIns.close() this.loadIns.close()
}) })
}, },
// //
statusInterval () { async statusInterval () {
this.listData.map(item => { this.listData.map(item => {
if (item.signUpStartTime && item.signUpEndTime && item.playStartTime && item.playEndTime) { if (item.signUpStartTime && item.signUpEndTime && item.playStartTime && item.playEndTime) {
this.handleStatus(item) this.handleStatus(item)
let timer = setInterval(() => {
this.handleStatus(item)
}, 1000)
this.timerList.push(timer)
} }
}) })
}, },
// //
handleStatus (item) { handleStatus (item) {
console.log("🚀 ~ file: index.vue:413 ~ handleStatus ~ item:", item)
let total = '' let total = ''
let time = '' let time = ''
let status = '' let status = ''
@ -418,7 +422,7 @@ export default {
let signUpEndTime = new Date(this.core.dateCompatible(item.signUpEndTime)) // let signUpEndTime = new Date(this.core.dateCompatible(item.signUpEndTime)) //
let playStartTime = new Date(this.core.dateCompatible(item.playStartTime)) // let playStartTime = new Date(this.core.dateCompatible(item.playStartTime)) //
let playEndTime = new Date(this.core.dateCompatible(item.playEndTime)) // let playEndTime = new Date(this.core.dateCompatible(item.playEndTime)) //
const now = new Date() const { now } = this
if (now < signUpStartTime) { // if (now < signUpStartTime) { //
status = 0 status = 0
total = signUpStartTime - now total = signUpStartTime - now
@ -496,10 +500,7 @@ export default {
}, },
// //
clearTimer () { clearTimer () {
this.timerList.forEach(n => { clearInterval(this.timer)
clearInterval(n)
})
this.timerList = []
}, },
getData () { getData () {
this.loadIns = Loading.service() this.loadIns = Loading.service()

@ -31,9 +31,9 @@ if (isPro) {
sandPath = `http://${location.hostname}:9520` sandPath = `http://${location.hostname}:9520`
uploadURL = `http://121.37.12.51/` uploadURL = `http://121.37.12.51/`
host = "http://121.37.12.51/"; // 测试服 host = "http://121.37.12.51/"; // 测试服
// host = 'https://www.occupationlab.com/' // 正式服 host = 'https://www.occupationlab.com/' // 正式服
// host = "http://192.168.31.217:9000/"; // 榕 // host = "http://192.168.31.217:9000/"; // 榕
host = "http://192.168.31.51:9000/"; // 赓 // host = "http://192.168.31.51:9000/"; // 赓
} else if (isSq) { } else if (isSq) {
zcPath = `10.20.100.204:8883` zcPath = `10.20.100.204:8883`
} }

Loading…
Cancel
Save