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. 126
      src/views/information/addArticle/index.vue
  6. 11
      src/views/match/add/step1.vue
  7. 26
      src/views/match/add/step3.vue
  8. 16
      src/views/match/manage/matchArchList.vue
  9. 40
      src/views/match/manage/matchRank.vue
  10. 103
      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. 125
      src/views/system/addLog.vue
  17. 198
      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,51 +1,74 @@
<template> <template>
<div> <div>
<el-card shadow="hover" class="m-b-20"> <el-card shadow="hover"
class="m-b-20">
<div class="flex-between"> <div class="flex-between">
<el-page-header @back="goBack" :content="'新增文章'"></el-page-header> <el-page-header @back="goBack"
:content="'新增文章'"></el-page-header>
</div> </div>
</el-card> </el-card>
<el-card shadow="hover" class="m-b-20"> <el-card shadow="hover"
<el-form :model="form" :rules="rules" ref="form" label-width="90px" label-suffix=":" size="small"> class="m-b-20">
<el-form-item prop="coverUrl" label="封面图"> <el-form :model="form"
<el-upload :rules="rules"
class="avatar-uploader" ref="form"
label-width="90px"
label-suffix=":"
size="small">
<el-form-item prop="coverUrl"
label="封面图">
<el-upload class="avatar-uploader"
accept=".jpg,.png,.jpeg" accept=".jpg,.png,.jpeg"
:on-remove="handleRemove" :on-remove="handleRemove"
:on-error="uploadError" :on-error="uploadError"
:on-success="uploadSuccess"
:before-remove="beforeRemove" :before-remove="beforeRemove"
:limit="1" :limit="1"
:on-exceed="handleExceed" :on-exceed="handleExceed"
:action="this.api.fileupload" action=""
:headers="headers" :http-request="handleRequest">
name="file" <img v-if="form.coverUrl"
> :src="form.coverUrl"
<img v-if="form.coverUrl" :src="form.coverUrl" class="avatar"> class="avatar">
<div class="uploader-default" v-else> <div class="uploader-default"
v-else>
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
<p>上传封面</p> <p>上传封面</p>
</div> </div>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
<el-form-item prop="author" label="作者"> <el-form-item prop="author"
label="作者">
<div class="d-inline-block"> <div class="d-inline-block">
<el-input placeholder="请输入作者" v-model="form.author" clearable></el-input> <el-input placeholder="请输入作者"
v-model="form.author"
clearable></el-input>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item prop="date" label="日期"> <el-form-item prop="date"
label="日期">
<div class="d-inline-block"> <div class="d-inline-block">
<el-date-picker v-model="form.date" type="date" value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择日期"></el-date-picker> <el-date-picker v-model="form.date"
type="date"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择日期"></el-date-picker>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item prop="title" label="文章标题"> <el-form-item prop="title"
<el-input placeholder="请输入文章标题" v-model="form.title" clearable></el-input> label="文章标题">
<el-input placeholder="请输入文章标题"
v-model="form.title"
clearable></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="content" label="文章内容"> <el-form-item prop="content"
<quill :border="true" v-model="form.content" :uploading.sync="uploading" :height="400" /> label="文章内容">
<quill :border="true"
v-model="form.content"
:uploading.sync="uploading"
:height="400" />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="saveData">确定</el-button> <el-button type="primary"
@click="saveData">确定</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-card> </el-card>
@ -53,11 +76,12 @@
</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')
@ -99,21 +123,21 @@ export default {
components: { components: {
quill quill
}, },
mounted() { mounted () {
this.id = this.$route.query.id; this.id = this.$route.query.id;
this.id && this.getData(); this.id && this.getData();
}, },
methods: { methods: {
// //
goBack() { goBack () {
this.$router.back(); this.$router.back();
}, },
getData() { getData () {
this.$get(`${this.api.getArticle}?articleId=${this.id}`).then(({ article }) => { this.$get(`${this.api.getArticle}?articleId=${this.id}`).then(({ article }) => {
this.form = article this.form = article
}).catch(err => {}) }).catch(err => { })
}, },
saveData() { saveData () {
this.$refs.form.validate((valid) => { this.$refs.form.validate((valid) => {
if (valid) { if (valid) {
if (this.submiting) return false if (this.submiting) return false
@ -142,13 +166,19 @@ export default {
} }
}) })
}, },
handleCurrentChange(val) { handleCurrentChange (val) {
this.currPage = val; this.currPage = val;
}, },
handleExceed(files, fileList) { handleExceed (files, fileList) {
util.warningMsg(`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`); util.warningMsg(`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`);
}, },
uploadSuccess(res, file, fileList) { //
async handleRequest ({ file }) {
Oss.upload(file).then(res => {
this.form.coverUrl = res.url
})
},
uploadSuccess (res, file, fileList) {
if (this.form.coverUrl) { if (this.form.coverUrl) {
let fileName = this.coverUrl.replace("https://liuwanr.oss-cn-shenzhen.aliyuncs.com/", ""); let fileName = this.coverUrl.replace("https://liuwanr.oss-cn-shenzhen.aliyuncs.com/", "");
this.$del(`${this.api.fileDeletion}?keys=${fileName}`).then(res => { this.$del(`${this.api.fileDeletion}?keys=${fileName}`).then(res => {
@ -157,33 +187,30 @@ export default {
} }
this.form.coverUrl = res.data.filesResult.fileUrl; this.form.coverUrl = res.data.filesResult.fileUrl;
}, },
uploadError(err, file, fileList) { uploadError (err, file, fileList) {
this.$message({ this.$message({
message: "上传出错,请重试!", message: "上传出错,请重试!",
type: "error", type: "error",
center: true center: true
}); });
}, },
beforeRemove(file, fileList) { beforeRemove (file, fileList) {
return this.$confirm(`确定移除 ${file.name}`); return this.$confirm(`确定移除 ${file.name}`);
}, },
handleRemove(file, fileList) { handleRemove (file, fileList) {
let fileName = this.form.coverUrl.replace("https://liuwanr.oss-cn-shenzhen.aliyuncs.com/", ""); Oss.del(this.form.coverUrl)
this.$del(`${this.api.fileDeletion}?keys=${fileName}`).then(res => { this.form.coverUrl = ''
this.form.coverUrl = "";
}).catch(res => {
});
}, },
uploadSure() { uploadSure () {
this.BatchUpload = false; this.BatchUpload = false;
this.pageNo = 1; this.pageNo = 1;
this.keyword = ""; this.keyword = "";
this.getData(); this.getData();
}, },
back() { back () {
this.$router.back(); this.$router.back();
}, },
goback() { goback () {
this.$confirm("确定返回?未更新的信息将不会保存。", "提示", { this.$confirm("确定返回?未更新的信息将不会保存。", "提示", {
type: "warning" type: "warning"
}) })
@ -193,16 +220,16 @@ export default {
.catch(() => { .catch(() => {
}); });
}, },
addSponsor() { addSponsor () {
this.sponsorList.push(""); this.sponsorList.push("");
}, },
delSponsor(index) { delSponsor (index) {
this.sponsorList.splice(index, 1); this.sponsorList.splice(index, 1);
}, },
addOrganizer() { addOrganizer () {
this.organzinerList.push(""); this.organzinerList.push("");
}, },
delOrganizer(index) { delOrganizer (index) {
this.organzinerList.splice(index, 1); this.organzinerList.splice(index, 1);
} }
} }
@ -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) {
Oss.upload(file).then(res => {
item.competitionStageContentSetting.fileList.push({ item.competitionStageContentSetting.fileList.push({
name: originalFileName, name: res.name,
url: fileUrl 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) {
if (e.competitionStageContentSetting.fileList && e.competitionStageContentSetting.fileList.length) {
e.competitionStageContentSetting.fileName = e.competitionStageContentSetting.fileList.map(n => n.name).join('|') e.competitionStageContentSetting.fileName = e.competitionStageContentSetting.fileList.map(n => n.name).join('|')
e.competitionStageContentSetting.fileUrl = e.competitionStageContentSetting.fileList.map(n => n.url).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
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 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,45 +1,43 @@
<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)" v-auth="'/match:管理:公告通知:草稿'">草稿</el-button> <el-button v-if="!form.id"
<el-button type="primary" @click="save(1)" v-auth="'/match:管理:公告通知:发布'">发布</el-button> @click="save(0)"
v-auth="'/match:管理:公告通知:草稿'">草稿</el-button>
<el-button type="primary"
@click="save(1)"
v-auth="'/match:管理:公告通知:发布'">发布</el-button>
<el-button @click="back">取消</el-button> <el-button @click="back">取消</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -51,9 +49,11 @@
<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')
@ -72,23 +72,24 @@ export default {
}; };
}, },
components: { components: {
quill quill,
Upload
}, },
watch: { watch: {
// , // ,
form: { form: {
handler(){ handler () {
this.updateTime++ this.updateTime++
if(this.updateTime > 1) this.$store.commit('match/setWait', 0) if (this.updateTime > 1) this.$store.commit('match/setWait', 0)
}, },
deep:true deep: true
}, },
}, },
mounted() { mounted () {
this.form.id && this.getData() this.form.id && this.getData()
}, },
methods: { methods: {
getData() { getData () {
this.$post(`${this.api.queryAnnouncementDetails}?id=${this.form.id}`).then(({ data }) => { this.$post(`${this.api.queryAnnouncementDetails}?id=${this.form.id}`).then(({ data }) => {
this.form = data this.form = data
// //
@ -105,10 +106,10 @@ export default {
} else { } else {
data.announcementAnnexList = [] data.announcementAnnexList = []
} }
}).catch(err => {}) }).catch(err => { })
}, },
// //
save(status) { save (status) {
const form = this.form const form = this.form
if (!form.announcementTitle) return util.warningMsg('请填写公告标题') if (!form.announcementTitle) return util.warningMsg('请填写公告标题')
if (!form.announcementText) return util.warningMsg('请填写正文') if (!form.announcementText) return util.warningMsg('请填写正文')
@ -119,53 +120,48 @@ export default {
this.$post(this.api.amendmentAnnouncement, form).then(res => { this.$post(this.api.amendmentAnnouncement, form).then(res => {
util.successMsg("修改成功") util.successMsg("修改成功")
this.$router.back() this.$router.back()
}).catch(err => {}) }).catch(err => { })
} else { } else {
form.isOpen = status ? 0 : 1 form.isOpen = status ? 0 : 1
this.$post(this.api.addAnnouncement, form).then(res => { this.$post(this.api.addAnnouncement, form).then(res => {
util.successMsg("创建成功") util.successMsg("创建成功")
this.$router.back() this.$router.back()
}).catch(err => {}) }).catch(err => { })
} }
}, },
handleExceed(files, fileList) { handleExceed (files, fileList) {
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.saveAnnouncementAnnex, data).then(res => {}).catch(res => {}) id && this.$post(this.api.saveAnnouncementAnnex, data).then(res => { }).catch(res => { })
}, },
// uploadError (err, file, fileList) {
beforeUpload(file) {
this.fileName = file.name
},
uploadError(err, file, fileList) {
this.$message({ this.$message({
message: "上传出错,请重试!", message: "上传出错,请重试!",
type: "error", type: "error",
center: true center: true
}); });
}, },
beforeRemove(file, fileList) { beforeRemove (file, fileList) {
return this.$confirm(`确定移除 ${file.name}`); return this.$confirm(`确定移除 ${file.name}`);
}, },
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.delAnnex}?id=${id}`).then(res => {}).catch(res => {}) this.$post(`${this.api.delAnnex}?id=${id}`).then(res => { }).catch(res => { })
} }
}, },
back() { back () {
this.$router.back() this.$router.back()
} }
} }
@ -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,64 +1,88 @@
<template> <template>
<div class="wrap"> <div class="wrap">
<el-card shadow="hover" class="mgb20"> <el-card shadow="hover"
class="mgb20">
<div class="flex-between"> <div class="flex-between">
<div class="per_title" v-preventReClick @click="$router.back()"> <div class="per_title"
v-preventReClick
@click="$router.back()">
<i class="el-icon-arrow-left"></i> <i class="el-icon-arrow-left"></i>
<span class="per_back">返回</span> <span class="per_back">返回</span>
<span class="per_school" v-text="id ? '编辑更新日志' : '新增更新日志'"></span> <span class="per_school"
v-text="id ? '编辑更新日志' : '新增更新日志'"></span>
</div> </div>
<div> <div>
<el-button type="primary" round v-preventReClick @click="submit(0)">发布</el-button> <el-button type="primary"
<el-button v-if="draft || !id" type="primary" round v-preventReClick @click="submit(1)">草稿</el-button> 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>
</div> </div>
</el-card> </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"
label-width="120px"
center>
<el-form-item class="required"
label="版本标题">
<el-input placeholder="请输入版本标题"
v-model="form.versionName"
maxlength="30"
style="width: 400px"
@change="nameChange"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="封面图片"> <el-form-item label="封面图片">
<el-upload <el-upload class="avatar-uploader"
class="avatar-uploader"
accept=".jpg,.png,.jpeg" accept=".jpg,.png,.jpeg"
:on-remove="handleRemove" :on-remove="handleRemove"
:on-error="uploadError" :on-error="uploadError"
:on-success="uploadSuccess"
:before-remove="beforeRemove" :before-remove="beforeRemove"
:limit="1" :limit="1"
:on-exceed="handleExceed" :on-exceed="handleExceed"
:action="this.api.fileupload" action=""
:headers="headers" :http-request="handleRequest">
name="file" <img v-if="form.coverUrl"
> :src="form.coverUrl"
<img v-if="form.coverUrl" :src="form.coverUrl" class="avatar"> class="avatar">
<div class="uploader-default" v-else> <div class="uploader-default"
v-else>
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
<p>上传封面</p> <p>上传封面</p>
</div> </div>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
<el-form-item class="required" label="更新内容"> <el-form-item class="required"
label="更新内容">
<ul class="contents"> <ul class="contents">
<li v-for="(item, i) in form.logContents" :key="i"> <li v-for="(item, i) in form.logContents"
:key="i">
<div class="action"> <div class="action">
<el-select v-model="item.type" size="small" placeholder="请选择"> <el-select v-model="item.type"
<el-option size="small"
v-for="item in funcList" placeholder="请选择">
<el-option v-for="item in funcList"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item.id"> :value="item.id">
</el-option> </el-option>
</el-select> </el-select>
<div class="btns"> <div class="btns">
<i v-if="i === form.logContents.length - 1" class="el-icon-circle-plus-outline" @click="add"></i> <i v-if="i === form.logContents.length - 1"
<i class="el-icon-delete" @click="del(i)"></i> class="el-icon-circle-plus-outline"
@click="add"></i>
<i class="el-icon-delete"
@click="del(i)"></i>
</div> </div>
</div> </div>
<el-input <el-input type="textarea"
type="textarea"
:rows="5" :rows="5"
placeholder="请输入" placeholder="请输入"
v-model="item.content"> v-model="item.content">
@ -73,12 +97,13 @@
<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")
}, },
@ -110,12 +135,12 @@ export default {
submiting: false submiting: false
}; };
}, },
mounted() { mounted () {
this.id ? this.getData() : this.form.logContents.push(JSON.parse(JSON.stringify(this.originContent))) this.id ? this.getData() : this.form.logContents.push(JSON.parse(JSON.stringify(this.originContent)))
}, },
methods: { methods: {
// //
getData() { getData () {
this.$get(`${this.api.logGet}?logId=${this.id}`).then(res => { this.$get(`${this.api.logGet}?logId=${this.id}`).then(res => {
const { log } = res const { log } = res
this.form = { this.form = {
@ -124,10 +149,10 @@ export default {
logContents: log.logContents.length ? log.logContents : [JSON.parse(JSON.stringify(this.originContent))] logContents: log.logContents.length ? log.logContents : [JSON.parse(JSON.stringify(this.originContent))]
} }
this.originName = log.versionName this.originName = log.versionName
}).catch(res => {}) }).catch(res => { })
}, },
// //
nameChange(val) { nameChange (val) {
if (this.originName === val) { if (this.originName === val) {
this.nameRepeat = false this.nameRepeat = false
} else { } else {
@ -139,37 +164,37 @@ export default {
} }
}, },
// //
add() { add () {
this.form.logContents.push(JSON.parse(JSON.stringify(this.originContent))) this.form.logContents.push(JSON.parse(JSON.stringify(this.originContent)))
}, },
// //
del(i) { del (i) {
this.form.logContents.splice(i, 1) this.form.logContents.splice(i, 1)
}, },
handleExceed(files, fileList) { // handleExceed (files, fileList) { //
util.warningMsg("当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!"); util.warningMsg("当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!");
}, },
uploadSuccess(res, file, fileList) { handleRequest ({ file }) {
this.form.coverUrl = res.data.filesResult.fileUrl Oss.upload(file).then(res => {
this.form.coverUrl = res.url
})
}, },
uploadError(err, file, fileList) { uploadError (err, file, fileList) {
this.$message({ this.$message({
message: "上传出错,请重试!", message: "上传出错,请重试!",
type: "error", type: "error",
center: true center: true
}); });
}, },
beforeRemove(file, fileList) { beforeRemove (file, fileList) {
return this.$confirm(`确定移除 ${file.name}`); return this.$confirm(`确定移除 ${file.name}`);
}, },
handleRemove(file, fileList) { handleRemove (file, fileList) {
let fileName = this.coverUrl.replace("https://liuwanr.oss-cn-shenzhen.aliyuncs.com/", ""); Oss.del(this.form.coverUrl)
this.$del(`${this.api.fileDeletion}?keys=${fileName}`).then(res => { this.form.coverUrl = res.url
this.coverUrl = ''
}).catch(res => {});
}, },
// //
submit(draft){ submit (draft) {
if (this.submiting) return false if (this.submiting) return false
const { versionName, logContents } = this.form const { versionName, logContents } = this.form
const id = this.id const id = this.id
@ -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;
} }
} }
} }

@ -1,85 +1,126 @@
<template> <template>
<div> <div>
<el-card shadow="hover" class="m-b-20"> <el-card shadow="hover"
class="m-b-20">
<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>
<el-card shadow="hover" class="m-b-20"> <el-card shadow="hover"
<el-form :model="form" :rules="rules" ref="form" :disabled="isDetail" label-width="100px" label-suffix=":"> class="m-b-20">
<el-form-item prop="courseName" label="课程名称"> <el-form :model="form"
:rules="rules"
ref="form"
:disabled="isDetail"
label-width="100px"
label-suffix=":">
<el-form-item prop="courseName"
label="课程名称">
<div class="d-inline-block"> <div class="d-inline-block">
<el-input placeholder="请输入课程名称" v-model="form.courseName" clearable maxlength="25" @change="nameChange"></el-input> <el-input placeholder="请输入课程名称"
v-model="form.courseName"
clearable
maxlength="25"
@change="nameChange"></el-input>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item prop="platformClassificationIds" label="课程分类"> <el-form-item prop="platformClassificationIds"
label="课程分类">
<div class="d-inline-block"> <div class="d-inline-block">
<el-select v-model="form.platformClassificationIds" placeholder="请选择课程分类" multiple> <el-select v-model="form.platformClassificationIds"
<el-option v-for="item in classificationList" :key="item.id" :label="item.classificationName" :value="item.id"></el-option> placeholder="请选择课程分类"
multiple>
<el-option v-for="item in classificationList"
:key="item.id"
:label="item.classificationName"
:value="item.id"></el-option>
</el-select> </el-select>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item prop="coverUrl" label="课程封面"> <el-form-item prop="coverUrl"
<el-upload label="课程封面">
class="avatar-uploader" <el-upload class="avatar-uploader"
accept=".jpg,.png,.jpeg" accept=".jpg,.png,.jpeg"
:on-remove="handleRemove" :on-remove="handleRemove"
:on-error="uploadError" :on-error="uploadError"
:on-success="uploadSuccess"
:before-remove="beforeRemove" :before-remove="beforeRemove"
:limit="1" :limit="1"
:on-exceed="handleExceed" :on-exceed="handleExceed"
:action="this.api.fileupload" action=""
:headers="headers" :http-request="handleRequest">
name="file" <img v-if="form.coverUrl"
> :src="form.coverUrl"
<img v-if="form.coverUrl" :src="form.coverUrl" class="avatar"> class="avatar">
<div class="uploader-default" v-else> <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>只能上传jpg/png文件</p> <p>只能上传jpg/png文件</p>
<p>课程封面图将按2:1显示最佳分辨率1400*700</p> <p>课程封面图将按2:1显示最佳分辨率1400*700</p>
</div> </div>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
<el-form-item prop="courseType" label="课程类型"> <el-form-item prop="courseType"
label="课程类型">
<div class="d-inline-block"> <div class="d-inline-block">
<el-select v-model="form.courseType" placeholder="请选择课程类型"> <el-select v-model="form.courseType"
<el-option label="免费" :value="0"></el-option> placeholder="请选择课程类型">
<el-option label="付费" :value="1"></el-option> <el-option label="免费"
:value="0"></el-option>
<el-option label="付费"
:value="1"></el-option>
</el-select> </el-select>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item prop="visibleRange" label="可见范围"> <el-form-item prop="visibleRange"
label="可见范围">
<div> <div>
<el-radio v-model="form.visibleRange" :label="0" disabled>仅本校</el-radio> <el-radio v-model="form.visibleRange"
:label="0"
disabled>仅本校</el-radio>
</div> </div>
<div> <div>
<el-radio v-model="form.visibleRange" :label="1">全平台</el-radio> <el-radio v-model="form.visibleRange"
:label="1">全平台</el-radio>
</div> </div>
<div> <div>
<el-radio v-model="form.visibleRange" :label="2">指定区域院校</el-radio> <el-radio v-model="form.visibleRange"
<el-button v-if="form.visibleRange === 2" type="primary" size="mini" @click="showRange">选择院校</el-button> :label="2">指定区域院校</el-radio>
<el-button v-if="form.visibleRange === 2"
type="primary"
size="mini"
@click="showRange">选择院校</el-button>
<span style="margin-left: 20px">{{ rangeName }}</span> <span style="margin-left: 20px">{{ rangeName }}</span>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item prop="courseIntroduction" label="课程介绍"> <el-form-item prop="courseIntroduction"
<quill :border="true" :readonly="isDetail" v-model="form.courseIntroduction" :height="400" /> label="课程介绍">
<quill :border="true"
:readonly="isDetail"
v-model="form.courseIntroduction"
:height="400" />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="save" v-show="!isDetail">{{ form.id ? "更新" : "创建" }}</el-button> <el-button type="primary"
@click="save"
v-show="!isDetail">{{ form.id ? "更新" : "创建" }}</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-card> </el-card>
<el-dialog title="请勾选院校" :visible.sync="rangeVisible" width="580px" custom-class="range-dia" :close-on-click-modal="false"> <el-dialog title="请勾选院校"
:visible.sync="rangeVisible"
width="580px"
custom-class="range-dia"
:close-on-click-modal="false">
<div class="range-wrap"> <div class="range-wrap">
<el-cascader <el-cascader ref="range"
ref="range"
class="range-cas" class="range-cas"
key="range" key="range"
v-model="range" v-model="range"
@ -92,8 +133,7 @@
@change="rangeChange" @change="rangeChange"
@visible-change="rangeViChange" @visible-change="rangeViChange"
@input.native="rangeSearch"></el-cascader> @input.native="rangeSearch"></el-cascader>
<el-tag <el-tag v-for="(tag, i) in rangeChecked"
v-for="(tag, i) in rangeChecked"
:key="tag.value" :key="tag.value"
class="range-check" class="range-check"
closable closable
@ -103,9 +143,13 @@
</el-tag> </el-tag>
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer"
<el-button size="small" @click="rangeVisible = false"> </el-button> class="dialog-footer">
<el-button size="small" type="primary" @click="rangeSubmit"> </el-button> <el-button size="small"
@click="rangeVisible = false"> </el-button>
<el-button size="small"
type="primary"
@click="rangeSubmit"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
</div> </div>
@ -115,10 +159,11 @@
import util from "@/libs/util"; import util from "@/libs/util";
import Setting from "@/setting"; import Setting from "@/setting";
import quill from "@/components/quill"; import quill from "@/components/quill";
import Oss from '@/components/upload/upload.js'
export default { export default {
name: "courseAddEdit", name: "courseAddEdit",
data() { data () {
const that = this const that = this
return { return {
headers: { headers: {
@ -197,7 +242,7 @@ export default {
data.push(e) data.push(e)
}) })
resolve(data) resolve(data)
}).catch(res => {}) }).catch(res => { })
} else if (level === 1) { } else if (level === 1) {
// //
that.$get(that.api.queryCity, { that.$get(that.api.queryCity, {
@ -212,7 +257,7 @@ export default {
data.push(e) data.push(e)
}) })
resolve(data) resolve(data)
}).catch(res => {}) }).catch(res => { })
} else if (level === 2) { } else if (level === 2) {
// //
that.$get(that.api.getSchoolsByProvince, { that.$get(that.api.getSchoolsByProvince, {
@ -229,7 +274,7 @@ export default {
data.push(e) data.push(e)
}) })
resolve(data) resolve(data)
}).catch(res => {}) }).catch(res => { })
} else { } else {
resolve([]) resolve([])
} }
@ -241,13 +286,13 @@ export default {
watch: { watch: {
// , // ,
form: { form: {
handler(val){ handler (val) {
this.updateTime++ this.updateTime++
}, },
deep:true deep: true
} }
}, },
mounted() { mounted () {
this.getClassification(); this.getClassification();
this.form.id && this.getData(); this.form.id && this.getData();
this.getSchool() this.getSchool()
@ -256,16 +301,16 @@ export default {
quill quill
}, },
methods: { methods: {
getClassification() { getClassification () {
this.$post(this.api.listClassification, { this.$post(this.api.listClassification, {
pageNum: 1, pageNum: 1,
pageSize: 1000, pageSize: 1000,
platformSource: Setting.platformSource platformSource: Setting.platformSource
}).then(({ page }) => { }).then(({ page }) => {
this.classificationList = page.records this.classificationList = page.records
}).catch(res => {}) }).catch(res => { })
}, },
getData() { getData () {
this.$post(`${this.api.findTheoreticalCourse}?id=${this.form.id}`).then(({ data }) => { this.$post(`${this.api.findTheoreticalCourse}?id=${this.form.id}`).then(({ data }) => {
// id // id
if (data.platformClassificationList) { if (data.platformClassificationList) {
@ -299,14 +344,14 @@ export default {
name: "cover.jpg", name: "cover.jpg",
url: data.coverUrl url: data.coverUrl
}) })
}).catch(err => {}) }).catch(err => { })
}, },
// //
showRange() { showRange () {
this.rangeVisible = true this.rangeVisible = true
}, },
// //
rangeChange(val, e) { rangeChange (val, e) {
const checked = this.$refs.range.getCheckedNodes() const checked = this.$refs.range.getCheckedNodes()
const name = [] const name = []
const { rangeChecked } = this const { rangeChecked } = this
@ -317,14 +362,14 @@ export default {
console.log("🚀 ~ file: index.vue:306 ~ rangeChange ~ this.rangeChecked", this.rangeChecked) console.log("🚀 ~ file: index.vue:306 ~ rangeChange ~ this.rangeChecked", this.rangeChecked)
}, },
// //
rangeViChange(e) { rangeViChange (e) {
// //
if (e) { if (e) {
this.rangeList = [] this.rangeList = []
} }
}, },
// //
getSchool() { getSchool () {
this.$get(this.api.querySchoolData).then(({ list }) => { this.$get(this.api.querySchoolData).then(({ list }) => {
const result = [] const result = []
list.map(e => { list.map(e => {
@ -334,14 +379,14 @@ export default {
result.push(e) result.push(e)
}) })
this.schools = result this.schools = result
}).catch(res => {}) }).catch(res => { })
}, },
// //
beforeFilter() { beforeFilter () {
return false return false
}, },
// //
rangeSearch(el) { rangeSearch (el) {
const val = el.target.value.trim() const val = el.target.value.trim()
const checked = this.rangeChecked const checked = this.rangeChecked
if (!val) { if (!val) {
@ -359,11 +404,11 @@ export default {
this.rangeList = result this.rangeList = result
}, 100) }, 100)
}, },
closeRange(i) { closeRange (i) {
this.rangeChecked.splice(i, 1) this.rangeChecked.splice(i, 1)
}, },
// //
rangeSubmit() { rangeSubmit () {
// id // id
const data = [] const data = []
const checked = this.rangeChecked const checked = this.rangeChecked
@ -385,7 +430,7 @@ export default {
}) })
}) })
resolve() resolve()
}).catch(res => {}) }).catch(res => { })
})) }))
} else { } else {
data.push({ data.push({
@ -410,7 +455,7 @@ export default {
}) })
}, },
// //
nameChange(val) { nameChange (val) {
this.$post(this.api.checkRepeatTheoreticalCourse, { this.$post(this.api.checkRepeatTheoreticalCourse, {
id: this.form.id, id: this.form.id,
courseName: val, courseName: val,
@ -421,29 +466,29 @@ export default {
this.nameRepeat = true this.nameRepeat = true
}) })
}, },
handleExceed(files, fileList) { // handleExceed (files, fileList) { //
util.warningMsg("当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!"); util.warningMsg("当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!");
}, },
uploadSuccess(res, file, fileList) { handleRequest ({ file }) {
this.form.coverUrl = res.data.filesResult.fileUrl Oss.upload(file).then(res => {
this.form.coverUrl = res.url
})
}, },
uploadError(err, file, fileList) { uploadError (err, file, fileList) {
this.$message({ this.$message({
message: "上传出错,请重试!", message: "上传出错,请重试!",
type: "error", type: "error",
center: true center: true
}); });
}, },
beforeRemove(file, fileList) { beforeRemove (file, fileList) {
return this.$confirm(`确定移除 ${file.name}`); return this.$confirm(`确定移除 ${file.name}`);
}, },
handleRemove(file, fileList) { handleRemove () {
let fileName = this.form.coverUrl.replace('https://huoran.oss-cn-shenzhen.aliyuncs.com/', ""); Oss.del(this.form.coverUrl)
this.$del(`${this.api.fileDeletion}?keys=${fileName}`).then(res => {
this.form.coverUrl = '' this.form.coverUrl = ''
}).catch(res => {});
}, },
save() { save () {
this.$refs.form.validate((valid) => { this.$refs.form.validate((valid) => {
if (valid) { if (valid) {
if (this.nameRepeat) return util.errorMsg('当前课程名已存在!') if (this.nameRepeat) return util.errorMsg('当前课程名已存在!')
@ -479,10 +524,10 @@ export default {
}) })
}, },
// //
backPage() { backPage () {
this.$router.back() this.$router.back()
}, },
back() { back () {
const { id } = this.form const { id } = this.form
const updateTime = this.updateTime const updateTime = this.updateTime
// //
@ -514,7 +559,7 @@ $avatar-width: 104px;
overflow: hidden; overflow: hidden;
&:hover { &:hover {
border-color: #409EFF; border-color: #409eff;
} }
.uploader-default { .uploader-default {
@ -565,7 +610,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%;
} }
} }

@ -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