dev_review
yujialong 1 year ago
parent 7b11aa9960
commit 4036589adb
  1. 2
      src/setting.js
  2. 2
      src/utils/api.js
  3. 4
      src/utils/core.js
  4. 33
      src/views/course/contentSettings.vue
  5. 422
      src/views/information/addArticle/index.vue
  6. 11
      src/views/match/add/step1.vue
  7. 32
      src/views/match/add/step3.vue
  8. 18
      src/views/match/manage/matchArchList.vue
  9. 40
      src/views/match/manage/matchRank.vue
  10. 315
      src/views/match/manage/noticeDetail.vue
  11. 34
      src/views/order/AddOrder.vue
  12. 29
      src/views/parnerOperation/learnMg.vue
  13. 31
      src/views/parnerOperation/schemeSet.vue
  14. 37
      src/views/shop/addProduct/index.vue
  15. 23
      src/views/shop/list/market/index.vue
  16. 437
      src/views/system/addLog.vue
  17. 988
      src/views/theoreticalCourse/add/index.vue
  18. 31
      src/views/theoreticalCourse/contentSettings/index.vue

@ -13,7 +13,7 @@ if (isDev) {
sandPath = `http://${location.hostname}:9520` sandPath = `http://${location.hostname}:9520`
host = 'http://121.37.12.51/' host = 'http://121.37.12.51/'
// host = 'https://huorantech.cn/' // host = 'https://huorantech.cn/'
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 (isPro) { } else if (isPro) {
jumpPath = 'https://www.huorantech.cn/judgmentPoint/' jumpPath = 'https://www.huorantech.cn/judgmentPoint/'

@ -415,6 +415,8 @@ export default {
cCompetitionStageFileList: `competition/cCompetitionStageFile/listByEntity`, cCompetitionStageFileList: `competition/cCompetitionStageFile/listByEntity`,
derive: `${host}competition/cCompetitionStageFile/deriveAll`, derive: `${host}competition/cCompetitionStageFile/deriveAll`,
allExperimentalResultsAreDerived: `${host}competition/competition/performance/allExperimentalResultsAreDerived`, allExperimentalResultsAreDerived: `${host}competition/competition/performance/allExperimentalResultsAreDerived`,
derivedRanking: `${host}competition/competition/rank/derivedRanking`,
individualDerivedRanking: `${host}competition/competition/rank/individualDerivedRanking`,
gradeImport: `https://www.occupationlab.com/template/赛事成绩导入模板.xlsx`, gradeImport: `https://www.occupationlab.com/template/赛事成绩导入模板.xlsx`,
rankImportTeam: `https://www.occupationlab.com/template/赛事排名导入模板(团队赛).xlsx`, rankImportTeam: `https://www.occupationlab.com/template/赛事排名导入模板(团队赛).xlsx`,
rankImportPerson: `https://www.occupationlab.com/template/赛事排名导入模板(个人赛).xlsx`, rankImportPerson: `https://www.occupationlab.com/template/赛事排名导入模板(个人赛).xlsx`,

@ -1,5 +1,3 @@
import { Loading } from 'element-ui'
const pad2 = str => ('0' + str).substr(-2) const pad2 = str => ('0' + str).substr(-2)
function fMoney (s, n) { function fMoney (s, n) {
@ -205,7 +203,6 @@ function formatDate(fmt,date) {
// 传入文件名和路径,下载图片视频,支持跨域,a标签加download不支持跨域 // 传入文件名和路径,下载图片视频,支持跨域,a标签加download不支持跨域
function downloadFile(fileName, url) { function downloadFile(fileName, url) {
const loadIns = Loading.service()
var x = new XMLHttpRequest() var x = new XMLHttpRequest()
x.open("GET", url, true) x.open("GET", url, true)
x.responseType = "blob" x.responseType = "blob"
@ -215,7 +212,6 @@ function downloadFile(fileName, url) {
a.href = url a.href = url
a.download = fileName a.download = fileName
a.click() a.click()
loadIns.close()
} }
x.send() x.send()
} }

@ -162,6 +162,7 @@
@submit.native.prevent> @submit.native.prevent>
<el-form-item label="资源添加"> <el-form-item label="资源添加">
<Upload :max-size="100000" <Upload :max-size="100000"
:file-list="uploadList"
:on-remove="handleRemove" :on-remove="handleRemove"
@beforeUpload="beforeUpload" @beforeUpload="beforeUpload"
@onSuccess="uploadSuccess"> @onSuccess="uploadSuccess">
@ -192,6 +193,7 @@
@close="closeSwitch"> @close="closeSwitch">
<div style="text-align: center"> <div style="text-align: center">
<Upload :max-size="100000" <Upload :max-size="100000"
:file-list="uploadList"
:on-remove="handleRemove" :on-remove="handleRemove"
@beforeUpload="beforeUpload" @beforeUpload="beforeUpload"
@onSuccess="uploadSuccess"> @onSuccess="uploadSuccess">
@ -528,34 +530,6 @@ export default {
this.fileUrl = file.url this.fileUrl = file.url
this.fileName = file.name this.fileName = file.name
}, },
//
handleRequest (data) {
const param = new FormData()
param.append('file', data.file)
const config = {
timeout: 10000000000,
headers: {
'Accept': '*/*',
'Content-Type': 'multipart/form-data'
},
//
onUploadProgress: progressEvent => {
const per = Number((progressEvent.loaded / progressEvent.total * 100).toFixed(2))
console.log("🚀 ~ file: contentSettings.vue ~ line 329 ~ handleRequest ~ per", per, this.progressPercent)
if (this.progressPercent <= 80) this.progressPercent = (per > 80) ? (Math.random() * 10 + 80).toFixed(2) : per
}
}
axios.post(this.api.fileupload, param, config).then(res => {
this.progressPercent = 100
this.showProgress = false
const { fileId, fileType, fileUrl, ossFileName } = res.data.data.filesResult
this.uploading = false
this.fileId = fileId
this.fileType = fileType
this.fileUrl = fileUrl
this.fileName = ossFileName
})
},
uploadError (err, file, fileList) { uploadError (err, file, fileList) {
this.$message({ this.$message({
message: "上传出错,请重试!", message: "上传出错,请重试!",
@ -568,7 +542,8 @@ export default {
return this.$confirm(`确定移除 ${file.name}`); return this.$confirm(`确定移除 ${file.name}`);
} }
}, },
handleRemove (file, fileList) { handleRemove () {
Oss.del(this.fileUrl)
this.fileUrl = '' this.fileUrl = ''
}, },
uploadSure () { uploadSure () {

@ -1,211 +1,238 @@
<template> <template>
<div> <div>
<el-card shadow="hover" class="m-b-20"> <el-card shadow="hover"
<div class="flex-between"> class="m-b-20">
<el-page-header @back="goBack" :content="'新增文章'"></el-page-header> <div class="flex-between">
<el-page-header @back="goBack"
:content="'新增文章'"></el-page-header>
</div>
</el-card>
<el-card shadow="hover"
class="m-b-20">
<el-form :model="form"
:rules="rules"
ref="form"
label-width="90px"
label-suffix=":"
size="small">
<el-form-item prop="coverUrl"
label="封面图">
<el-upload class="avatar-uploader"
accept=".jpg,.png,.jpeg"
:on-remove="handleRemove"
:on-error="uploadError"
:before-remove="beforeRemove"
:limit="1"
:on-exceed="handleExceed"
action=""
:http-request="handleRequest">
<img v-if="form.coverUrl"
:src="form.coverUrl"
class="avatar">
<div class="uploader-default"
v-else>
<i class="el-icon-plus"></i>
<p>上传封面</p>
</div> </div>
</el-card> </el-upload>
<el-card shadow="hover" class="m-b-20"> </el-form-item>
<el-form :model="form" :rules="rules" ref="form" label-width="90px" label-suffix=":" size="small"> <el-form-item prop="author"
<el-form-item prop="coverUrl" label="封面图"> label="作者">
<el-upload <div class="d-inline-block">
class="avatar-uploader" <el-input placeholder="请输入作者"
accept=".jpg,.png,.jpeg" v-model="form.author"
:on-remove="handleRemove" clearable></el-input>
:on-error="uploadError" </div>
:on-success="uploadSuccess" </el-form-item>
:before-remove="beforeRemove" <el-form-item prop="date"
:limit="1" label="日期">
:on-exceed="handleExceed" <div class="d-inline-block">
:action="this.api.fileupload" <el-date-picker v-model="form.date"
:headers="headers" type="date"
name="file" value-format="yyyy-MM-dd HH:mm:ss"
> placeholder="选择日期"></el-date-picker>
<img v-if="form.coverUrl" :src="form.coverUrl" class="avatar"> </div>
<div class="uploader-default" v-else> </el-form-item>
<i class="el-icon-plus"></i> <el-form-item prop="title"
<p>上传封面</p> label="文章标题">
</div> <el-input placeholder="请输入文章标题"
</el-upload> v-model="form.title"
</el-form-item> clearable></el-input>
<el-form-item prop="author" label="作者"> </el-form-item>
<div class="d-inline-block"> <el-form-item prop="content"
<el-input placeholder="请输入作者" v-model="form.author" clearable></el-input> label="文章内容">
</div> <quill :border="true"
</el-form-item> v-model="form.content"
<el-form-item prop="date" label="日期"> :uploading.sync="uploading"
<div class="d-inline-block"> :height="400" />
<el-date-picker v-model="form.date" type="date" value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择日期"></el-date-picker> </el-form-item>
</div> <el-form-item>
</el-form-item> <el-button type="primary"
<el-form-item prop="title" label="文章标题"> @click="saveData">确定</el-button>
<el-input placeholder="请输入文章标题" v-model="form.title" clearable></el-input> </el-form-item>
</el-form-item> </el-form>
<el-form-item prop="content" label="文章内容"> </el-card>
<quill :border="true" v-model="form.content" :uploading.sync="uploading" :height="400" /> </div>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="saveData">确定</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</template> </template>
<script> <script>
import Oss from '@/components/upload/upload.js'
import quill from "@/components/quill"; import quill from "@/components/quill";
import util from "@/libs/util"; import util from "@/libs/util";
export default { export default {
name: "addarticle", name: "addarticle",
data() { data () {
return { return {
headers: { headers: {
token: sessionStorage.getItem('token') token: sessionStorage.getItem('token')
}, },
form: { form: {
columnId: +this.$route.query.columnId, columnId: +this.$route.query.columnId,
sort: +this.$route.query.sort, sort: +this.$route.query.sort,
id: '', id: '',
coverUrl: '', coverUrl: '',
author: '', author: '',
date: '', date: '',
title: '', title: '',
content: '', content: '',
createUser: this.$store.state.userName createUser: this.$store.state.userName
}, },
rules: { rules: {
coverUrl: [ coverUrl: [
{ required: true, message: '请上传封面', trigger: 'change' } { required: true, message: '请上传封面', trigger: 'change' }
], ],
author: [ author: [
{ required: true, message: '请输入作者', trigger: 'blur' } { required: true, message: '请输入作者', trigger: 'blur' }
], ],
date: [ date: [
{ required: true, message: '请选择日期', trigger: 'change' } { required: true, message: '请选择日期', trigger: 'change' }
], ],
title: [ title: [
{ required: true, message: '请输入文章标题', trigger: 'blur' } { required: true, message: '请输入文章标题', trigger: 'blur' }
], ],
content: [ content: [
{ required: true, message: '请输入文章内容', trigger: 'blur' } { required: true, message: '请输入文章内容', trigger: 'blur' }
], ],
}, },
uploadList: [], uploadList: [],
uploadDataList: [], uploadDataList: [],
submiting: false, submiting: false,
uploading: false uploading: false
}; };
},
components: {
quill
},
mounted () {
this.id = this.$route.query.id;
this.id && this.getData();
},
methods: {
//
goBack () {
this.$router.back();
}, },
components: { getData () {
quill this.$get(`${this.api.getArticle}?articleId=${this.id}`).then(({ article }) => {
this.form = article
}).catch(err => { })
}, },
mounted() { saveData () {
this.id = this.$route.query.id; this.$refs.form.validate((valid) => {
this.id && this.getData(); if (valid) {
}, if (this.submiting) return false
methods: { const { form } = this
// if (this.uploading) return util.warningMsg("图片正在上传中,请稍等");
goBack() { this.submiting = true
this.$router.back(); if (form.id) {
}, this.$put(this.api.editArticle, form).then(res => {
getData() { this.submiting = false;
this.$get(`${this.api.getArticle}?articleId=${this.id}`).then(({ article }) => { util.successMsg("修改成功");
this.form = article this.back();
}).catch(err => {})
},
saveData() {
this.$refs.form.validate((valid) => {
if (valid) {
if (this.submiting) return false
const { form } = this
if (this.uploading) return util.warningMsg("图片正在上传中,请稍等");
this.submiting = true
if (form.id) {
this.$put(this.api.editArticle, form).then(res => {
this.submiting = false;
util.successMsg("修改成功");
this.back();
})
.catch(err => {
this.submiting = false;
});
} else {
this.$post(this.api.addArticle, form).then(res => {
this.submiting = false;
util.successMsg("创建成功");
this.back();
})
.catch(err => {
this.submiting = false;
});
}
}
})
},
handleCurrentChange(val) {
this.currPage = val;
},
handleExceed(files, fileList) {
util.warningMsg(`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`);
},
uploadSuccess(res, file, fileList) {
if (this.form.coverUrl) {
let fileName = this.coverUrl.replace("https://liuwanr.oss-cn-shenzhen.aliyuncs.com/", "");
this.$del(`${this.api.fileDeletion}?keys=${fileName}`).then(res => {
}).catch(res => {
});
}
this.form.coverUrl = res.data.filesResult.fileUrl;
},
uploadError(err, file, fileList) {
this.$message({
message: "上传出错,请重试!",
type: "error",
center: true
});
},
beforeRemove(file, fileList) {
return this.$confirm(`确定移除 ${file.name}`);
},
handleRemove(file, fileList) {
let fileName = this.form.coverUrl.replace("https://liuwanr.oss-cn-shenzhen.aliyuncs.com/", "");
this.$del(`${this.api.fileDeletion}?keys=${fileName}`).then(res => {
this.form.coverUrl = "";
}).catch(res => {
});
},
uploadSure() {
this.BatchUpload = false;
this.pageNo = 1;
this.keyword = "";
this.getData();
},
back() {
this.$router.back();
},
goback() {
this.$confirm("确定返回?未更新的信息将不会保存。", "提示", {
type: "warning"
}) })
.then(() => { .catch(err => {
this.back(); this.submiting = false;
}) });
.catch(() => { } else {
}); this.$post(this.api.addArticle, form).then(res => {
}, this.submiting = false;
addSponsor() { util.successMsg("创建成功");
this.sponsorList.push(""); this.back();
}, })
delSponsor(index) { .catch(err => {
this.sponsorList.splice(index, 1); this.submiting = false;
}, });
addOrganizer() { }
this.organzinerList.push("");
},
delOrganizer(index) {
this.organzinerList.splice(index, 1);
} }
})
},
handleCurrentChange (val) {
this.currPage = val;
},
handleExceed (files, fileList) {
util.warningMsg(`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`);
},
//
async handleRequest ({ file }) {
Oss.upload(file).then(res => {
this.form.coverUrl = res.url
})
},
uploadSuccess (res, file, fileList) {
if (this.form.coverUrl) {
let fileName = this.coverUrl.replace("https://liuwanr.oss-cn-shenzhen.aliyuncs.com/", "");
this.$del(`${this.api.fileDeletion}?keys=${fileName}`).then(res => {
}).catch(res => {
});
}
this.form.coverUrl = res.data.filesResult.fileUrl;
},
uploadError (err, file, fileList) {
this.$message({
message: "上传出错,请重试!",
type: "error",
center: true
});
},
beforeRemove (file, fileList) {
return this.$confirm(`确定移除 ${file.name}`);
},
handleRemove (file, fileList) {
Oss.del(this.form.coverUrl)
this.form.coverUrl = ''
},
uploadSure () {
this.BatchUpload = false;
this.pageNo = 1;
this.keyword = "";
this.getData();
},
back () {
this.$router.back();
},
goback () {
this.$confirm("确定返回?未更新的信息将不会保存。", "提示", {
type: "warning"
})
.then(() => {
this.back();
})
.catch(() => {
});
},
addSponsor () {
this.sponsorList.push("");
},
delSponsor (index) {
this.sponsorList.splice(index, 1);
},
addOrganizer () {
this.organzinerList.push("");
},
delOrganizer (index) {
this.organzinerList.splice(index, 1);
} }
}
}; };
</script> </script>
@ -221,7 +248,7 @@ $avatar-width: 104px;
overflow: hidden; overflow: hidden;
&:hover { &:hover {
border-color: #409EFF; border-color: #409eff;
} }
.uploader-default { .uploader-default {
@ -272,7 +299,8 @@ $avatar-width: 104px;
/deep/ .d-inline-block { /deep/ .d-inline-block {
width: 216px; width: 216px;
.el-select, .el-input { .el-select,
.el-input {
width: 100%; width: 100%;
} }
} }

@ -36,7 +36,6 @@
accept=".jpg,.png,.jpeg,.gif" accept=".jpg,.png,.jpeg,.gif"
:on-remove="handleLgRemove" :on-remove="handleLgRemove"
:on-error="uploadError" :on-error="uploadError"
:on-success="uploadLgSuccess"
:before-remove="beforeRemove" :before-remove="beforeRemove"
:limit="1" :limit="1"
:on-exceed="handleExceed" :on-exceed="handleExceed"
@ -598,16 +597,6 @@ export default {
this.form.carouselUrl = res.url this.form.carouselUrl = res.url
}) })
}, },
uploadSuccess (res) {
const { coverUrl } = this.form
coverUrl && this.$del(`${this.api.fileDeletion}?keys=${coverUrl}`).then(res => { }).catch(res => { })
this.form.coverUrl = res.data.filesResult.fileUrl
},
uploadLgSuccess (res) {
const { carouselUrl } = this.form
carouselUrl && this.$del(`${this.api.fileDeletion}?keys=${carouselUrl}`).then(res => { }).catch(res => { })
this.form.carouselUrl = res.data.filesResult.fileUrl
},
// //
uploadAnnexSuccess (file) { uploadAnnexSuccess (file) {
const { id } = this.form const { id } = this.form

@ -62,11 +62,11 @@
<template v-if="item.competitionStageContentSetting.whetherToUploadFiles"> <template v-if="item.competitionStageContentSetting.whetherToUploadFiles">
<el-upload :on-remove="(file, fileList) => handleRemove(file, fileList, item)" <el-upload :on-remove="(file, fileList) => handleRemove(file, fileList, item)"
:on-error="uploadError" :on-error="uploadError"
:on-success="res => uploadSuccess(res, item)"
:before-remove="beforeRemove" :before-remove="beforeRemove"
:action="api.fileUploadNakadai" action=""
:headers="headers" :headers="headers"
:file-list="item.competitionStageContentSetting.fileList" :file-list="item.competitionStageContentSetting.fileList"
:http-request="res => handleRequest(res, item)"
name="file"> name="file">
<el-button size="small" <el-button size="small"
type="primary">上传文件</el-button> type="primary">上传文件</el-button>
@ -140,6 +140,7 @@
</template> </template>
<script> <script>
import Oss from '@/components/upload/upload.js'
import util from "@/libs/util"; import util from "@/libs/util";
import set from './set' import set from './set'
export default { export default {
@ -235,11 +236,12 @@ export default {
fileList: [] fileList: []
} }
} }
form.competitionStageContentSetting.fileList = []
// //
if (form.competitionStageContentSetting.fileUrl) { if (form.competitionStageContentSetting.fileUrl) {
const urls = form.competitionStageContentSetting.fileUrl.split('|') const urls = form.competitionStageContentSetting.fileUrl.split('|')
const names = form.competitionStageContentSetting.fileName.split('|') const names = form.competitionStageContentSetting.fileName.split('|')
form.competitionStageContentSetting.fileList = []
urls.map((n, i) => { urls.map((n, i) => {
form.competitionStageContentSetting.fileList.push({ form.competitionStageContentSetting.fileList.push({
name: names[i], name: names[i],
@ -320,14 +322,17 @@ export default {
return this.$confirm(`确定移除 ${file.name}`); return this.$confirm(`确定移除 ${file.name}`);
}, },
handleRemove (file, fileList, item) { handleRemove (file, fileList, item) {
Oss.del(file.url)
const i = item.competitionStageContentSetting.fileList.findIndex(e => e.url === file.url) const i = item.competitionStageContentSetting.fileList.findIndex(e => e.url === file.url)
item.competitionStageContentSetting.fileList.splice(i, 1) item.competitionStageContentSetting.fileList.splice(i, 1)
}, },
uploadSuccess (res, item) { //
const { originalFileName, fileUrl } = res.filesResult async handleRequest ({ file }, item) {
item.competitionStageContentSetting.fileList.push({ Oss.upload(file).then(res => {
name: originalFileName, item.competitionStageContentSetting.fileList.push({
url: fileUrl name: res.name,
url: res.url
})
}) })
}, },
// //
@ -410,9 +415,14 @@ export default {
for (const e of form) { for (const e of form) {
e.offlineButton = e.offlineButton ? 1 : 0 e.offlineButton = e.offlineButton ? 1 : 0
e.onlineButton = e.onlineButton ? 1 : 0 e.onlineButton = e.onlineButton ? 1 : 0
if (e.competitionStageContentSetting && e.competitionStageContentSetting.fileList && e.competitionStageContentSetting.fileList.length) { if (e.competitionStageContentSetting) {
e.competitionStageContentSetting.fileName = e.competitionStageContentSetting.fileList.map(n => n.name).join('|') if (e.competitionStageContentSetting.fileList && e.competitionStageContentSetting.fileList.length) {
e.competitionStageContentSetting.fileUrl = e.competitionStageContentSetting.fileList.map(n => n.url).join('|') e.competitionStageContentSetting.fileName = e.competitionStageContentSetting.fileList.map(n => n.name).join('|')
e.competitionStageContentSetting.fileUrl = e.competitionStageContentSetting.fileList.map(n => n.url).join('|')
} else {
e.competitionStageContentSetting.fileName = ''
e.competitionStageContentSetting.fileUrl = ''
}
} }
} }
this.$parent.showLoad() this.$parent.showLoad()

@ -190,7 +190,7 @@
align="center"> align="center">
</el-table-column> </el-table-column>
<el-table-column label="操作" <el-table-column label="操作"
width="160"> width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button v-if="!isCompress(scope.row.fileFormat)" <el-button v-if="!isCompress(scope.row.fileFormat)"
type="text" type="text"
@ -324,6 +324,7 @@ export default {
keyWord: this.keyword, keyWord: this.keyword,
}).then(({ data }) => { }).then(({ data }) => {
data.records.forEach(e => { data.records.forEach(e => {
e.loading = false
e.fileType = '其他' e.fileType = '其他'
if (util.isVideo(e.fileFormat)) { if (util.isVideo(e.fileFormat)) {
e.fileType = '视频' e.fileType = '视频'
@ -557,8 +558,19 @@ export default {
// //
exportFile (item) { exportFile (item) {
item.loading = true item.loading = true
util.downloadFile(item.userName + '-' + item.fileName, item.filePath) const url = item.filePath
item.loading = false var x = new XMLHttpRequest()
x.open("GET", url, true)
x.responseType = "blob"
x.onload = function (e) {
var url = window.URL.createObjectURL(x.response)
var a = document.createElement("a")
a.href = url
a.download = item.userName + '-' + item.fileName
a.click()
item.loading = false
}
x.send()
}, },
} }
}; };

@ -39,18 +39,28 @@
<el-button v-if="!published" <el-button v-if="!published"
type="primary" type="primary"
@click="cancelPublish(1)">发布排名</el-button> @click="cancelPublish(1)">发布排名</el-button>
<div v-else> <template v-else>
<span style="margin-right: 10px">{{ publishTime }}发布排名</span> <span style="margin-right: 10px">{{ publishTime }}发布排名</span>
<el-button type="primary" <el-button type="primary"
@click="cancelPublish(0)">取消发布</el-button> @click="cancelPublish(0)">取消发布</el-button>
</div> </template>
<el-button v-if="list.length"
type="primary"
:loading="loading"
@click="exportData">{{ loading ? '正在导出' : '批量导出' }}</el-button>
</div> </div>
</div> </div>
<el-table :data="list" <el-table :data="list"
class="table" class="table"
ref="table" ref="table"
stripe stripe
row-key="scoreId"
@selection-change="handleSelectionChange"
header-align="center"> header-align="center">
<el-table-column type="selection"
width="55"
align="center"
:reserve-selection="true"></el-table-column>
<el-table-column type="index" <el-table-column type="index"
width="60" width="60"
label="排名" label="排名"
@ -312,7 +322,9 @@ export default {
return [`${hour}:${minute}:${second} - 23:59:59`] return [`${hour}:${minute}:${second} - 23:59:59`]
})(), })(),
}, },
uploaded: 0 uploaded: 0,
multipleSelection: [],
loading: false
}; };
}, },
mounted () { mounted () {
@ -487,10 +499,32 @@ export default {
toReport (row) { toReport (row) {
this.$router.push(`/matchReport?reportId=${row.reportId}`) this.$router.push(`/matchReport?reportId=${row.reportId}`)
}, },
handleSelectionChange (val) { //
this.multipleSelection = val;
},
handleCurrentChange (val) { // handleCurrentChange (val) { //
this.page = val; this.page = val;
this.getData(); this.getData();
}, },
// ()
exportData () {
let { list } = this
if (this.multipleSelection.length) {
list = this.multipleSelection
}
this.loading = true
list.forEach((e, i) => {
e.serialNumber = i + 1
if (e.leaderName) e.userName = e.leaderName
})
axios.post(this.api[this.competitionType ? 'derivedRanking' : 'individualDerivedRanking'], list, {
headers: this.headers,
responseType: 'blob'
}).then((res) => {
util.downloadFileDirect(`${this.grades.find(e => e.stageId == this.active).stageName}排名.xls`, new Blob([res.data]))
this.loading = false
}).catch(res => { })
},
// //
publishSubmit () { publishSubmit () {
if (this.type) { // if (this.type) { //

@ -1,174 +1,170 @@
<template> <template>
<!-- 大赛详情 --> <!-- 大赛详情 -->
<div> <div>
<el-card shadow="hover" style="margin-bottom: 20px"> <el-card shadow="hover"
<div class="flex-between"> style="margin-bottom: 20px">
<el-page-header @back="back" :content="(form.id ? '编辑' : '创建') + '公告'"></el-page-header> <div class="flex-between">
</div> <el-page-header @back="back"
</el-card> :content="(form.id ? '编辑' : '创建') + '公告'"></el-page-header>
<div class="page"> </div>
<div class="page-content"> </el-card>
<el-form label-width="170px" label-suffix=":" size="small"> <div class="page">
<el-form-item label="公告标题"> <div class="page-content">
<div class="d-inline-block"> <el-form label-width="170px"
<el-input placeholder="请输入公告名称" v-model="form.announcementTitle" clearable></el-input> label-suffix=":"
</div> size="small">
</el-form-item> <el-form-item label="公告标题">
<el-form-item label="正文"> <div class="d-inline-block">
<quill :border="true" v-model="form.announcementText" :height="400" /> <el-input placeholder="请输入公告名称"
</el-form-item> v-model="form.announcementTitle"
<el-form-item label="附件"> clearable></el-input>
<el-upload </div>
:on-remove="handleRemove" </el-form-item>
:on-error="uploadError" <el-form-item label="正文">
:on-success="uploadSuccess" <quill :border="true"
:before-upload="beforeUpload" v-model="form.announcementText"
:before-remove="beforeRemove" :height="400" />
:limit="5" </el-form-item>
:on-exceed="handleExceed" <el-form-item label="附件">
:action="this.api.fileupload" <Upload :limit="5"
:headers="headers" :file-list="fileList"
:file-list="fileList" :on-remove="handleRemove"
name="file" @onSuccess="uploadSuccess" />
> </el-form-item>
<el-button size="small" type="primary">点击上传</el-button> <el-form-item>
<div slot="tip" class="el-upload__tip"> <el-button v-if="!form.id"
<p>支持扩展名.rar .zip .doc .docx .pdf .jpg...</p> @click="save(0)"
</div> v-auth="'/match:管理:公告通知:草稿'">草稿</el-button>
</el-upload> <el-button type="primary"
</el-form-item> @click="save(1)"
<el-form-item> v-auth="'/match:管理:公告通知:发布'">发布</el-button>
<el-button v-if="!form.id" @click="save(0)" v-auth="'/match:管理:公告通知:草稿'">草稿</el-button> <el-button @click="back">取消</el-button>
<el-button type="primary" @click="save(1)" v-auth="'/match:管理:公告通知:发布'">发布</el-button> </el-form-item>
<el-button @click="back">取消</el-button> </el-form>
</el-form-item>
</el-form>
</div>
</div> </div>
</div> </div>
</div>
</template> </template>
<script> <script>
import quill from "@/components/quill"; import quill from "@/components/quill";
import util from "@/libs/util"; import util from "@/libs/util";
import Upload from '@/components/upload';
import Oss from '@/components/upload/upload.js'
export default { export default {
name: "matchDetail", name: "matchDetail",
data() { data () {
return { return {
headers: { headers: {
token: sessionStorage.getItem('token') token: sessionStorage.getItem('token')
}, },
form: { form: {
id: this.$route.query.id, id: this.$route.query.id,
competitionId: this.$route.query.competitionId, competitionId: this.$route.query.competitionId,
announcementText: '', announcementText: '',
announcementTitle: '', announcementTitle: '',
announcementAnnexList: [], announcementAnnexList: [],
isOpen: 1 isOpen: 1
}, },
updateTime: 0, updateTime: 0,
fileName: '', fileName: '',
fileList: [], fileList: [],
}; };
},
components: {
quill,
Upload
},
watch: {
// ,
form: {
handler () {
this.updateTime++
if (this.updateTime > 1) this.$store.commit('match/setWait', 0)
},
deep: true
}, },
components: { },
quill mounted () {
this.form.id && this.getData()
},
methods: {
getData () {
this.$post(`${this.api.queryAnnouncementDetails}?id=${this.form.id}`).then(({ data }) => {
this.form = data
//
const fileList = data.announcementAnnexList
if (fileList) {
const files = []
fileList.map(e => {
files.push({
name: e.fileName,
url: e.filePath
})
})
this.fileList = files
} else {
data.announcementAnnexList = []
}
}).catch(err => { })
}, },
watch: { //
// , save (status) {
form: { const form = this.form
handler(){ if (!form.announcementTitle) return util.warningMsg('请填写公告标题')
this.updateTime++ if (!form.announcementText) return util.warningMsg('请填写正文')
if(this.updateTime > 1) this.$store.commit('match/setWait', 0) form.status = status
}, if (form.id) {
deep:true form.isOpen = 0
}, delete form.announcementAnnexList
this.$post(this.api.amendmentAnnouncement, form).then(res => {
util.successMsg("修改成功")
this.$router.back()
}).catch(err => { })
} else {
form.isOpen = status ? 0 : 1
this.$post(this.api.addAnnouncement, form).then(res => {
util.successMsg("创建成功")
this.$router.back()
}).catch(err => { })
}
}, },
mounted() { handleExceed (files, fileList) {
this.form.id && this.getData() util.warningMsg(`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`);
}, },
methods: { //
getData() { uploadSuccess (file) {
this.$post(`${this.api.queryAnnouncementDetails}?id=${this.form.id}`).then(({ data }) => { const { id } = this.form
this.form = data const data = {
// announcementId: id || '',
const fileList = data.announcementAnnexList fileName: file.name,
if (fileList) { filePath: file.url
const files = [] }
fileList.map(e => { this.form.announcementAnnexList.push(data)
files.push({ //
name: e.fileName, id && this.$post(this.api.saveAnnouncementAnnex, data).then(res => { }).catch(res => { })
url: e.filePath },
}) uploadError (err, file, fileList) {
}) this.$message({
this.fileList = files message: "上传出错,请重试!",
} else { type: "error",
data.announcementAnnexList = [] center: true
} });
}).catch(err => {}) },
}, beforeRemove (file, fileList) {
// return this.$confirm(`确定移除 ${file.name}`);
save(status) { },
const form = this.form handleRemove (file, fileList) {
if (!form.announcementTitle) return util.warningMsg('请填写公告标题') if (file.url) {
if (!form.announcementText) return util.warningMsg('请填写正文') Oss.del(file.url)
form.status = status const id = this.form.announcementAnnexList.find(e => e.fileName === file.name).id
if (form.id) { this.$post(`${this.api.delAnnex}?id=${id}`).then(res => { }).catch(res => { })
form.isOpen = 0 }
delete form.announcementAnnexList },
this.$post(this.api.amendmentAnnouncement, form).then(res => { back () {
util.successMsg("修改成功") this.$router.back()
this.$router.back()
}).catch(err => {})
} else {
form.isOpen = status ? 0 : 1
this.$post(this.api.addAnnouncement, form).then(res => {
util.successMsg("创建成功")
this.$router.back()
}).catch(err => {})
}
},
handleExceed(files, fileList) {
util.warningMsg(`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`);
},
//
uploadSuccess(res) {
const file = res.data.filesResult
const { id } = this.form
const data = {
announcementId: id || '',
fileName: this.fileName,
filePath: file.fileUrl || file.fileId
}
this.form.announcementAnnexList.push(data)
//
id && this.$post(this.api.saveAnnouncementAnnex, data).then(res => {}).catch(res => {})
},
//
beforeUpload(file) {
this.fileName = file.name
},
uploadError(err, file, fileList) {
this.$message({
message: "上传出错,请重试!",
type: "error",
center: true
});
},
beforeRemove(file, fileList) {
return this.$confirm(`确定移除 ${file.name}`);
},
handleRemove(file, fileList) {
if (file.url) {
this.$del(`${this.api.fileDeletion}?keys=${file.url}`).then(res => {}).catch(res => {})
const id = this.form.announcementAnnexList.find(e => e.fileName === file.name).id
this.$post(`${this.api.delAnnex}?id=${id}`).then(res => {}).catch(res => {})
}
},
back() {
this.$router.back()
}
} }
}
}; };
</script> </script>
@ -255,7 +251,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 +272,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;
} }
} }

@ -1498,21 +1498,11 @@
:offset="4" :offset="4"
class="flex-start"> class="flex-start">
<el-form-item label="上传合同"> <el-form-item label="上传合同">
<el-upload class="contract" <Upload :on-remove="handleRemove"
:headers="{token}" :file-list="uploadList"
:on-remove="handleRemove" @onSuccess="uploadSuccess">
:on-error="uploadError" <div slot="tip"></div>
:on-success="uploadSuccess" </Upload>
:before-upload="beforeAvatarUpload"
:before-remove="beforeRemove"
:limit="1"
:on-exceed="handleExceed"
:action="api.fileupload"
:file-list="uploadList">
<el-button size="medium"
type="plain"
class="uploadTitle">上传</el-button>
</el-upload>
</el-form-item> </el-form-item>
<!-- <el-form-item> <!-- <el-form-item>
<el-button size="medium" type="plain" style="height:40px">重新上传</el-button> <el-button size="medium" type="plain" style="height:40px">重新上传</el-button>
@ -1702,10 +1692,13 @@
<script> <script>
import selectClient from "./selectClient.vue"; import selectClient from "./selectClient.vue";
import Upload from '@/components/upload';
import Oss from '@/components/upload/upload.js'
export default { export default {
components: { components: {
selectClient selectClient,
Upload
}, },
data () { data () {
return { return {
@ -2979,8 +2972,8 @@ export default {
return str && size; return str && size;
}, },
// //
uploadSuccess (res, file, fileList) { uploadSuccess (file) {
this.contract.contractFile = res.data.filesResult.fileUrl; this.contract.contractFile = file.url
}, },
// //
uploadError (err, file, fileList) { uploadError (err, file, fileList) {
@ -3002,8 +2995,9 @@ export default {
} }
}, },
// //
handleRemove (file, fileList) { handleRemove () {
this.contract.contractFile = ""; Oss.del(this.contract.contractFile)
this.contract.contractFile = ''
}, },
configure () { configure () {
this.ipVisible = true; this.ipVisible = true;

@ -125,7 +125,7 @@
accept=".jpg,.png,.jpeg,.gif" accept=".jpg,.png,.jpeg,.gif"
:on-change="changeFile" :on-change="changeFile"
:show-file-list="false" :show-file-list="false"
:action="this.api.fileupload" action=""
:auto-upload="false"> :auto-upload="false">
<img v-if="form.bannerImg" <img v-if="form.bannerImg"
:src="form.bannerImg" :src="form.bannerImg"
@ -581,24 +581,17 @@ export default {
}, },
// //
customUpload (data) { customUpload (data) {
const formData = new FormData() data.name = this.file.name
formData.append('file', data, this.file.name) this.imgUpload(data)
this.imgUpload(formData)
}, },
// //
imgUpload (formData) { imgUpload (formData) {
this.isUpload = true this.isUpload = true
Axios({ Oss.upload(formData).then(res => {
method: 'post', this.form.bannerImg && Oss.del(this.form.bannerImg)
url: this.api.fileUploadNakadai, this.form.bannerImg = res.url
data: formData, })
headers: {
'Content-Type': 'multipart/form-data',
...this.headers
},
}).then(({ data }) => {
this.form.bannerImg = data.filesResult.fileUrl
}).catch(res => { })
this.$refs.cropper.isDisabled = false this.$refs.cropper.isDisabled = false
this.isUpload = false this.isUpload = false
this.cropperModel = false this.cropperModel = false
@ -631,12 +624,6 @@ export default {
this.form.fileList = fileList this.form.fileList = fileList
}).catch(res => { }) : (this.form.fileList = fileList) }).catch(res => { }) : (this.form.fileList = fileList)
}, },
// banner
uploadSuccessBanner (res) {
let url = this.form.bannerImg
url && this.$del(this.api.delFile, [url.split('/').pop()]).then(res => { }).catch(e => { })
this.form.bannerImg = res.url
},
// //
fileBeforeUpload (file) { fileBeforeUpload (file) {
this.uploading++ this.uploading++

@ -77,15 +77,10 @@
</el-form-item> </el-form-item>
<el-form-item prop="schemeFile" <el-form-item prop="schemeFile"
label="方案文件"> label="方案文件">
<el-upload :before-upload="fileBeforeUpload" <Upload :max-size="100000"
:on-success="uploadSuccessFile" :file-list.sync="fileList"
:action="this.api.fileUploadNakadai" :on-remove="handleRemove"
:file-list="fileList" @onSuccess="uploadSuccessFile" />
:limit="1"
:on-exceed="handleExceed"
:headers="headers">
<el-button>上传</el-button>
</el-upload>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div class="btns"> <div class="btns">
@ -264,6 +259,8 @@ import Util from '@/libs/util'
import Editor from '@tinymce/tinymce-vue' import Editor from '@tinymce/tinymce-vue'
import editorConfig from '@/utils/editor' import editorConfig from '@/utils/editor'
import Cropper from '@/components/img-upload/Cropper' import Cropper from '@/components/img-upload/Cropper'
import Upload from '@/components/upload';
import Oss from '@/components/upload/upload.js'
import Axios from 'axios' import Axios from 'axios'
export default { export default {
data () { data () {
@ -332,7 +329,8 @@ export default {
}, },
components: { components: {
Editor, Editor,
Cropper Cropper,
Upload
}, },
watch: { watch: {
// , // ,
@ -556,10 +554,17 @@ export default {
fileBeforeUpload (file) { fileBeforeUpload (file) {
this.uploading++ this.uploading++
}, },
//
handleRemove () {
Oss.del(this.form.schemeFile)
this.fileList = []
this.form.fileName = ''
this.form.schemeFile = ''
},
// //
uploadSuccessFile ({ filesResult }) { uploadSuccessFile (file) {
this.form.fileName = filesResult.originalFileName this.form.fileName = file.name
this.form.schemeFile = filesResult.fileUrl this.form.schemeFile = file.url
}, },
// //
handleExceed (files, fileList) { handleExceed (files, fileList) {

@ -245,10 +245,9 @@
label="封面图"> label="封面图">
<el-upload class="avatar-uploader" <el-upload class="avatar-uploader"
accept=".jpg,.png,.jpeg" accept=".jpg,.png,.jpeg"
:before-remove="beforeCoverRemove"
:on-change="file => changeFile(file, 1)" :on-change="file => changeFile(file, 1)"
:auto-upload="false" :auto-upload="false"
:action="api.fileupload" action=""
:show-file-list="false" :show-file-list="false"
:headers="headers" :headers="headers"
name="file"> name="file">
@ -274,7 +273,7 @@
:before-upload="beforeUpload" :before-upload="beforeUpload"
:on-change="file => changeFile(file, 2)" :on-change="file => changeFile(file, 2)"
:auto-upload="false" :auto-upload="false"
:action="api.fileupload" action=""
:headers="headers" :headers="headers"
:show-file-list="false" :show-file-list="false"
name="file"> name="file">
@ -294,7 +293,7 @@
class="pic"> class="pic">
<img :src="item"> <img :src="item">
<i class="el-icon-close close" <i class="el-icon-close close"
@click="form.mall.interfaceDiagrams.splice(i, 1)"></i> @click="delInterface(item, i)"></i>
</div> </div>
</div> </div>
</el-form-item> </el-form-item>
@ -307,7 +306,7 @@
:auto-upload="false" :auto-upload="false"
:limit="1" :limit="1"
:on-exceed="handleExceed" :on-exceed="handleExceed"
:action="api.fileupload" action=""
:headers="headers" :headers="headers"
:file-list="appletList" :file-list="appletList"
name="file"> name="file">
@ -1433,29 +1432,20 @@ export default {
// //
customUpload (data) { customUpload (data) {
const formData = new FormData() data.name = this.file.name
formData.append('file', data, this.file.name) this.imgUpload(data)
this.imgUpload(formData)
}, },
// //
imgUpload (formData) { imgUpload (formData) {
this.isUpload = true this.isUpload = true
Axios({ Oss.upload(formData).then(({ url }) => {
method: 'post',
url: this.api.fileUploadNakadai,
data: formData,
headers: {
'Content-Type': 'multipart/form-data',
...this.headers
},
}).then(({ data }) => {
const url = data.filesResult.fileUrl
if (this.picType == 2) { if (this.picType == 2) {
this.form.mall.interfaceDiagrams.push(url) this.form.mall.interfaceDiagrams.push(url)
} else { } else {
this.form.mall[this.picType == 1 ? 'coverDrawing' : 'appletIcon'] = url this.form.mall[this.picType == 1 ? 'coverDrawing' : 'appletIcon'] = url
} }
}).catch(res => { }) })
this.$refs.cropper.isDisabled = false this.$refs.cropper.isDisabled = false
this.isUpload = false this.isUpload = false
this.cropperModel = false this.cropperModel = false
@ -1491,18 +1481,17 @@ export default {
Util.warningMsg(`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`); Util.warningMsg(`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`);
}, },
beforeCoverRemove () { delInterface (item, i) {
this.form.mall.coverDrawing = '' Oss.del(item)
this.form.mall.interfaceDiagrams.splice(i, 1)
}, },
uploadSuccessMini (res) { uploadSuccessMini (res) {
this.form.mall.appletIcon = res.data.filesResult.fileUrl; this.form.mall.appletIcon = res.data.filesResult.fileUrl;
}, },
handleMiniRemove () { handleMiniRemove () {
Oss.del(this.form.mall.appletIcon)
this.form.mall.appletIcon = '' this.form.mall.appletIcon = ''
}, },
uploadSuccessInterface (res) { //
this.form.mall.interfaceDiagrams.push(res.data.filesResult.fileUrl)
},
uploadSuccessFile (file) { // uploadSuccessFile (file) { //
this.form.mallAnnex.push({ this.form.mallAnnex.push({
mallId: this.id, mallId: this.id,

@ -72,7 +72,7 @@
accept=".jpg,.png,.jpeg,.gif" accept=".jpg,.png,.jpeg,.gif"
:on-change="changeFile" :on-change="changeFile"
:show-file-list="false" :show-file-list="false"
:action="this.api.fileupload" action=""
:auto-upload="false"> :auto-upload="false">
<img v-if="form.banner" <img v-if="form.banner"
:src="form.banner" :src="form.banner"
@ -131,6 +131,7 @@ import Util from "@/libs/util";
import Setting from '@/setting' import Setting from '@/setting'
import Cropper from '@/components/img-upload/Cropper' import Cropper from '@/components/img-upload/Cropper'
import Axios from 'axios' import Axios from 'axios'
import Oss from '@/components/upload/upload.js'
export default { export default {
data () { data () {
return { return {
@ -171,24 +172,16 @@ export default {
}, },
// //
customUpload (data) { customUpload (data) {
const formData = new FormData() data.name = this.file.name
formData.append('file', data, this.file.name) this.imgUpload(data)
this.imgUpload(formData)
}, },
// //
imgUpload (formData) { imgUpload (formData) {
this.isUpload = true this.isUpload = true
Axios({ Oss.upload(formData).then(res => {
method: 'post', this.form.banner && Oss.del(this.form.banner)
url: this.api.fileUploadNakadai, this.form.banner = res.url
data: formData, })
headers: {
'Content-Type': 'multipart/form-data',
...this.headers
},
}).then(({ data }) => {
this.form.banner = data.filesResult.fileUrl
}).catch(res => { })
this.$refs.cropper.isDisabled = false this.$refs.cropper.isDisabled = false
this.isUpload = false this.isUpload = false
this.cropperModel = false this.cropperModel = false

@ -1,209 +1,234 @@
<template> <template>
<div class="wrap"> <div class="wrap">
<el-card shadow="hover" class="mgb20"> <el-card shadow="hover"
<div class="flex-between"> class="mgb20">
<div class="per_title" v-preventReClick @click="$router.back()"> <div class="flex-between">
<i class="el-icon-arrow-left"></i> <div class="per_title"
<span class="per_back">返回</span> v-preventReClick
<span class="per_school" v-text="id ? '编辑更新日志' : '新增更新日志'"></span> @click="$router.back()">
</div> <i class="el-icon-arrow-left"></i>
<div> <span class="per_back">返回</span>
<el-button type="primary" round v-preventReClick @click="submit(0)">发布</el-button> <span class="per_school"
<el-button v-if="draft || !id" type="primary" round v-preventReClick @click="submit(1)">草稿</el-button> v-text="id ? '编辑更新日志' : '新增更新日志'"></span>
</div> </div>
</div> <div>
</el-card> <el-button type="primary"
round
v-preventReClick
@click="submit(0)">发布</el-button>
<el-button v-if="draft || !id"
type="primary"
round
v-preventReClick
@click="submit(1)">草稿</el-button>
</div>
</div>
</el-card>
<el-card class="page" shadow="hover"> <el-card class="page"
<el-form class="form" ref="form" label-width="120px" center> shadow="hover">
<el-form-item class="required" label="版本标题"> <el-form class="form"
<el-input placeholder="请输入版本标题" v-model="form.versionName" maxlength="30" style="width: 400px" @change="nameChange"></el-input> ref="form"
</el-form-item> label-width="120px"
<el-form-item label="封面图片"> center>
<el-upload <el-form-item class="required"
class="avatar-uploader" label="版本标题">
accept=".jpg,.png,.jpeg" <el-input placeholder="请输入版本标题"
:on-remove="handleRemove" v-model="form.versionName"
:on-error="uploadError" maxlength="30"
:on-success="uploadSuccess" style="width: 400px"
:before-remove="beforeRemove" @change="nameChange"></el-input>
:limit="1" </el-form-item>
:on-exceed="handleExceed" <el-form-item label="封面图片">
:action="this.api.fileupload" <el-upload class="avatar-uploader"
:headers="headers" accept=".jpg,.png,.jpeg"
name="file" :on-remove="handleRemove"
> :on-error="uploadError"
<img v-if="form.coverUrl" :src="form.coverUrl" class="avatar"> :before-remove="beforeRemove"
<div class="uploader-default" v-else> :limit="1"
<i class="el-icon-plus"></i> :on-exceed="handleExceed"
<p>上传封面</p> action=""
</div> :http-request="handleRequest">
</el-upload> <img v-if="form.coverUrl"
</el-form-item> :src="form.coverUrl"
<el-form-item class="required" label="更新内容"> class="avatar">
<ul class="contents"> <div class="uploader-default"
<li v-for="(item, i) in form.logContents" :key="i"> v-else>
<div class="action"> <i class="el-icon-plus"></i>
<el-select v-model="item.type" size="small" placeholder="请选择"> <p>上传封面</p>
<el-option </div>
v-for="item in funcList" </el-upload>
:key="item.id" </el-form-item>
:label="item.name" <el-form-item class="required"
:value="item.id"> label="更新内容">
</el-option> <ul class="contents">
</el-select> <li v-for="(item, i) in form.logContents"
<div class="btns"> :key="i">
<i v-if="i === form.logContents.length - 1" class="el-icon-circle-plus-outline" @click="add"></i> <div class="action">
<i class="el-icon-delete" @click="del(i)"></i> <el-select v-model="item.type"
</div> size="small"
</div> placeholder="请选择">
<el-input <el-option v-for="item in funcList"
type="textarea" :key="item.id"
:rows="5" :label="item.name"
placeholder="请输入" :value="item.id">
v-model="item.content"> </el-option>
</el-input> </el-select>
</li> <div class="btns">
</ul> <i v-if="i === form.logContents.length - 1"
</el-form-item> class="el-icon-circle-plus-outline"
</el-form> @click="add"></i>
</el-card> <i class="el-icon-delete"
</div> @click="del(i)"></i>
</div>
</div>
<el-input type="textarea"
:rows="5"
placeholder="请输入"
v-model="item.content">
</el-input>
</li>
</ul>
</el-form-item>
</el-form>
</el-card>
</div>
</template> </template>
<script> <script>
import Setting from '@/setting' import Setting from '@/setting'
import Oss from '@/components/upload/upload.js'
export default { export default {
data() { data () {
return { return {
id : this.$route.query.id, id: this.$route.query.id,
platformId: this.$route.query.platformId, platformId: this.$route.query.platformId,
draft : this.$route.query.draft === '1', draft: this.$route.query.draft === '1',
headers: { headers: {
token: sessionStorage.getItem("token") token: sessionStorage.getItem("token")
}, },
funcList: [ funcList: [
{ {
id: 0, id: 0,
name: '新功能' name: '新功能'
},
{
id: 1,
name: '修复'
},
{
id: 2,
name: '优化'
}
],
nameRepeat: false,
originName: '',
form: {
versionName: '',
coverUrl: '',
logContents: []
},
originContent: {
type: '',
content: ''
},
submiting: false
};
},
mounted() {
this.id ? this.getData() : this.form.logContents.push(JSON.parse(JSON.stringify(this.originContent)))
},
methods: {
//
getData() {
this.$get(`${this.api.logGet}?logId=${this.id}`).then(res => {
const { log } = res
this.form = {
versionName: log.versionName,
coverUrl: log.coverUrl,
logContents: log.logContents.length ? log.logContents : [JSON.parse(JSON.stringify(this.originContent))]
}
this.originName = log.versionName
}).catch(res => {})
},
//
nameChange(val) {
if (this.originName === val) {
this.nameRepeat = false
} else {
this.$get(`${this.api.checkRepeat}?platformId=${this.platformId}&versionName=${val}`).then(res => {
this.nameRepeat = false
}).catch(res => {
this.nameRepeat = true
})
}
},
//
add() {
this.form.logContents.push(JSON.parse(JSON.stringify(this.originContent)))
}, },
// {
del(i) { id: 1,
this.form.logContents.splice(i, 1) name: '修复'
}, },
handleExceed(files, fileList) { // {
util.warningMsg("当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!"); id: 2,
}, name: '优化'
uploadSuccess(res, file, fileList) { }
this.form.coverUrl = res.data.filesResult.fileUrl ],
}, nameRepeat: false,
uploadError(err, file, fileList) { originName: '',
this.$message({ form: {
message: "上传出错,请重试!", versionName: '',
type: "error", coverUrl: '',
center: true logContents: []
}); },
}, originContent: {
beforeRemove(file, fileList) { type: '',
return this.$confirm(`确定移除 ${file.name}`); content: ''
}, },
handleRemove(file, fileList) { submiting: false
let fileName = this.coverUrl.replace("https://liuwanr.oss-cn-shenzhen.aliyuncs.com/", ""); };
this.$del(`${this.api.fileDeletion}?keys=${fileName}`).then(res => { },
this.coverUrl = '' mounted () {
}).catch(res => {}); this.id ? this.getData() : this.form.logContents.push(JSON.parse(JSON.stringify(this.originContent)))
}, },
// methods: {
submit(draft){ //
if (this.submiting) return false getData () {
const { versionName, logContents } = this.form this.$get(`${this.api.logGet}?logId=${this.id}`).then(res => {
const id = this.id const { log } = res
if (!versionName) return this.$message.error('请输入版本标题') this.form = {
if (this.nameRepeat) return this.$message.error('版本名称已存在!') versionName: log.versionName,
if (!logContents.length || !logContents.find(e => e.type !== '' && e.content)) return this.$message.error('请输入更新内容') coverUrl: log.coverUrl,
this.submiting = true logContents: log.logContents.length ? log.logContents : [JSON.parse(JSON.stringify(this.originContent))]
const data = { }
platformId: this.platformId, this.originName = log.versionName
versionName, }).catch(res => { })
coverUrl: this.form.coverUrl, },
logContents, //
withdraw: 0, nameChange (val) {
open: draft, // 0:1: if (this.originName === val) {
draft // 0:1:稿 this.nameRepeat = false
} } else {
if (id) { this.$get(`${this.api.checkRepeat}?platformId=${this.platformId}&versionName=${val}`).then(res => {
data.logId = id this.nameRepeat = false
this.$post(this.api.listUpdate, data).then(res => { }).catch(res => {
this.$message.success('编辑成功') this.nameRepeat = true
this.$router.back() })
}).catch(res => { }
this.submiting = false },
}) //
} else { add () {
this.$post(this.api.logAdd, data).then(res => { this.form.logContents.push(JSON.parse(JSON.stringify(this.originContent)))
this.$message.success('新增成功') },
this.$router.back() //
}).catch(res => { del (i) {
this.submiting = false this.form.logContents.splice(i, 1)
}) },
} handleExceed (files, fileList) { //
}, util.warningMsg("当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!");
} },
handleRequest ({ file }) {
Oss.upload(file).then(res => {
this.form.coverUrl = res.url
})
},
uploadError (err, file, fileList) {
this.$message({
message: "上传出错,请重试!",
type: "error",
center: true
});
},
beforeRemove (file, fileList) {
return this.$confirm(`确定移除 ${file.name}`);
},
handleRemove (file, fileList) {
Oss.del(this.form.coverUrl)
this.form.coverUrl = res.url
},
//
submit (draft) {
if (this.submiting) return false
const { versionName, logContents } = this.form
const id = this.id
if (!versionName) return this.$message.error('请输入版本标题')
if (this.nameRepeat) return this.$message.error('版本名称已存在!')
if (!logContents.length || !logContents.find(e => e.type !== '' && e.content)) return this.$message.error('请输入更新内容')
this.submiting = true
const data = {
platformId: this.platformId,
versionName,
coverUrl: this.form.coverUrl,
logContents,
withdraw: 0,
open: draft, // 0:1:
draft // 0:1:稿
}
if (id) {
data.logId = id
this.$post(this.api.listUpdate, data).then(res => {
this.$message.success('编辑成功')
this.$router.back()
}).catch(res => {
this.submiting = false
})
} else {
this.$post(this.api.logAdd, data).then(res => {
this.$message.success('新增成功')
this.$router.back()
}).catch(res => {
this.submiting = false
})
}
},
}
}; };
</script> </script>
@ -213,12 +238,12 @@ export default {
justify-content: center; justify-content: center;
min-height: calc(100vh - 310px); min-height: calc(100vh - 310px);
/deep/.required { /deep/.required {
label:before { label:before {
content: '*'; content: '*';
margin-right: 5px; margin-right: 5px;
vertical-align: middle; vertical-align: middle;
color: #f00; color: #f00;
} }
} }
} }
$avatar-width: 104px; $avatar-width: 104px;
@ -233,7 +258,7 @@ $avatar-width: 104px;
overflow: hidden; overflow: hidden;
&:hover { &:hover {
border-color: #409EFF; border-color: #409eff;
} }
.uploader-default { .uploader-default {
@ -296,10 +321,10 @@ $avatar-width: 104px;
.btns { .btns {
i { i {
margin-left: 10px; margin-left: 10px;
color: #9076FF; color: #9076ff;
cursor: pointer; cursor: pointer;
&:hover { &:hover {
opacity: .9; opacity: 0.9;
} }
} }
} }

File diff suppressed because it is too large Load Diff

@ -157,6 +157,7 @@
<el-form label-width="80px"> <el-form label-width="80px">
<el-form-item label="资源添加"> <el-form-item label="资源添加">
<Upload :max-size="100000" <Upload :max-size="100000"
:file-list="uploadList"
@beforeUpload="beforeUpload" @beforeUpload="beforeUpload"
@onSuccess="uploadSuccess"> @onSuccess="uploadSuccess">
<template slot="tip"> <template slot="tip">
@ -185,6 +186,7 @@
@close="closeSwitch"> @close="closeSwitch">
<div style="text-align: center"> <div style="text-align: center">
<Upload :max-size="100000" <Upload :max-size="100000"
:file-list="uploadList"
@beforeUpload="beforeUpload" @beforeUpload="beforeUpload"
@onSuccess="uploadSuccess"> @onSuccess="uploadSuccess">
<template slot="tip"> <template slot="tip">
@ -499,35 +501,6 @@ export default {
`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!` `当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`
); );
}, },
//
handleRequest (data) {
const param = new FormData()
param.append('file', data.file)
const config = {
timeout: 10000000000,
headers: {
'Accept': '*/*',
'Content-Type': 'multipart/form-data',
token: sessionStorage.getItem("token")
},
//
onUploadProgress: progressEvent => {
const per = Number((progressEvent.loaded / progressEvent.total * 100).toFixed(2))
console.log("🚀 ~ file: contentSettings.vue ~ line 329 ~ handleRequest ~ per", per, this.progressPercent)
if (this.progressPercent <= 80) this.progressPercent = (per > 80) ? (Math.random() * 10 + 80).toFixed(2) : per
}
}
axios.post(this.api.fileupload, param, config).then(res => {
this.progressPercent = 100
this.showProgress = false
const { fileId, fileType, fileUrl, ossFileName } = res.data.data.filesResult
this.uploading = false
this.fileId = fileId
this.fileType = fileType
this.fileUrl = fileUrl
this.fileName = ossFileName
})
},
uploadSuccess (file) { uploadSuccess (file) {
this.uploading = false; this.uploading = false;
this.fileId = '' this.fileId = ''

Loading…
Cancel
Save