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`
host = 'http://121.37.12.51/'
// 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/'// 赓
} else if (isPro) {
jumpPath = 'https://www.huorantech.cn/judgmentPoint/'

@ -415,6 +415,8 @@ export default {
cCompetitionStageFileList: `competition/cCompetitionStageFile/listByEntity`,
derive: `${host}competition/cCompetitionStageFile/deriveAll`,
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`,
rankImportTeam: `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)
function fMoney (s, n) {
@ -205,7 +203,6 @@ function formatDate(fmt,date) {
// 传入文件名和路径,下载图片视频,支持跨域,a标签加download不支持跨域
function downloadFile(fileName, url) {
const loadIns = Loading.service()
var x = new XMLHttpRequest()
x.open("GET", url, true)
x.responseType = "blob"
@ -215,7 +212,6 @@ function downloadFile(fileName, url) {
a.href = url
a.download = fileName
a.click()
loadIns.close()
}
x.send()
}

@ -162,6 +162,7 @@
@submit.native.prevent>
<el-form-item label="资源添加">
<Upload :max-size="100000"
:file-list="uploadList"
:on-remove="handleRemove"
@beforeUpload="beforeUpload"
@onSuccess="uploadSuccess">
@ -192,6 +193,7 @@
@close="closeSwitch">
<div style="text-align: center">
<Upload :max-size="100000"
:file-list="uploadList"
:on-remove="handleRemove"
@beforeUpload="beforeUpload"
@onSuccess="uploadSuccess">
@ -528,34 +530,6 @@ export default {
this.fileUrl = file.url
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) {
this.$message({
message: "上传出错,请重试!",
@ -568,7 +542,8 @@ export default {
return this.$confirm(`确定移除 ${file.name}`);
}
},
handleRemove (file, fileList) {
handleRemove () {
Oss.del(this.fileUrl)
this.fileUrl = ''
},
uploadSure () {

@ -1,51 +1,74 @@
<template>
<div>
<el-card shadow="hover" class="m-b-20">
<el-card shadow="hover"
class="m-b-20">
<div class="flex-between">
<el-page-header @back="goBack" :content="'新增文章'"></el-page-header>
<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"
<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"
:on-success="uploadSuccess"
:before-remove="beforeRemove"
:limit="1"
:on-exceed="handleExceed"
:action="this.api.fileupload"
:headers="headers"
name="file"
>
<img v-if="form.coverUrl" :src="form.coverUrl" class="avatar">
<div class="uploader-default" v-else>
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>
</el-upload>
</el-form-item>
<el-form-item prop="author" label="作者">
<el-form-item prop="author"
label="作者">
<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>
</el-form-item>
<el-form-item prop="date" label="日期">
<el-form-item prop="date"
label="日期">
<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>
</el-form-item>
<el-form-item prop="title" label="文章标题">
<el-input placeholder="请输入文章标题" v-model="form.title" clearable></el-input>
<el-form-item prop="title"
label="文章标题">
<el-input placeholder="请输入文章标题"
v-model="form.title"
clearable></el-input>
</el-form-item>
<el-form-item prop="content" label="文章内容">
<quill :border="true" v-model="form.content" :uploading.sync="uploading" :height="400" />
<el-form-item prop="content"
label="文章内容">
<quill :border="true"
v-model="form.content"
:uploading.sync="uploading"
:height="400" />
</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>
</el-card>
@ -53,11 +76,12 @@
</template>
<script>
import Oss from '@/components/upload/upload.js'
import quill from "@/components/quill";
import util from "@/libs/util";
export default {
name: "addarticle",
data() {
data () {
return {
headers: {
token: sessionStorage.getItem('token')
@ -99,21 +123,21 @@ export default {
components: {
quill
},
mounted() {
mounted () {
this.id = this.$route.query.id;
this.id && this.getData();
},
methods: {
//
goBack() {
goBack () {
this.$router.back();
},
getData() {
getData () {
this.$get(`${this.api.getArticle}?articleId=${this.id}`).then(({ article }) => {
this.form = article
}).catch(err => {})
}).catch(err => { })
},
saveData() {
saveData () {
this.$refs.form.validate((valid) => {
if (valid) {
if (this.submiting) return false
@ -142,13 +166,19 @@ export default {
}
})
},
handleCurrentChange(val) {
handleCurrentChange (val) {
this.currPage = val;
},
handleExceed(files, fileList) {
handleExceed (files, fileList) {
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) {
let fileName = this.coverUrl.replace("https://liuwanr.oss-cn-shenzhen.aliyuncs.com/", "");
this.$del(`${this.api.fileDeletion}?keys=${fileName}`).then(res => {
@ -157,33 +187,30 @@ export default {
}
this.form.coverUrl = res.data.filesResult.fileUrl;
},
uploadError(err, file, fileList) {
uploadError (err, file, fileList) {
this.$message({
message: "上传出错,请重试!",
type: "error",
center: true
});
},
beforeRemove(file, fileList) {
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 => {
});
handleRemove (file, fileList) {
Oss.del(this.form.coverUrl)
this.form.coverUrl = ''
},
uploadSure() {
uploadSure () {
this.BatchUpload = false;
this.pageNo = 1;
this.keyword = "";
this.getData();
},
back() {
back () {
this.$router.back();
},
goback() {
goback () {
this.$confirm("确定返回?未更新的信息将不会保存。", "提示", {
type: "warning"
})
@ -193,16 +220,16 @@ export default {
.catch(() => {
});
},
addSponsor() {
addSponsor () {
this.sponsorList.push("");
},
delSponsor(index) {
delSponsor (index) {
this.sponsorList.splice(index, 1);
},
addOrganizer() {
addOrganizer () {
this.organzinerList.push("");
},
delOrganizer(index) {
delOrganizer (index) {
this.organzinerList.splice(index, 1);
}
}
@ -221,7 +248,7 @@ $avatar-width: 104px;
overflow: hidden;
&:hover {
border-color: #409EFF;
border-color: #409eff;
}
.uploader-default {
@ -272,7 +299,8 @@ $avatar-width: 104px;
/deep/ .d-inline-block {
width: 216px;
.el-select, .el-input {
.el-select,
.el-input {
width: 100%;
}
}

@ -36,7 +36,6 @@
accept=".jpg,.png,.jpeg,.gif"
:on-remove="handleLgRemove"
:on-error="uploadError"
:on-success="uploadLgSuccess"
:before-remove="beforeRemove"
:limit="1"
:on-exceed="handleExceed"
@ -598,16 +597,6 @@ export default {
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) {
const { id } = this.form

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

@ -190,7 +190,7 @@
align="center">
</el-table-column>
<el-table-column label="操作"
width="160">
width="200">
<template slot-scope="scope">
<el-button v-if="!isCompress(scope.row.fileFormat)"
type="text"
@ -324,6 +324,7 @@ export default {
keyWord: this.keyword,
}).then(({ data }) => {
data.records.forEach(e => {
e.loading = false
e.fileType = '其他'
if (util.isVideo(e.fileFormat)) {
e.fileType = '视频'
@ -557,8 +558,19 @@ export default {
//
exportFile (item) {
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
}
x.send()
},
}
};

@ -39,18 +39,28 @@
<el-button v-if="!published"
type="primary"
@click="cancelPublish(1)">发布排名</el-button>
<div v-else>
<template v-else>
<span style="margin-right: 10px">{{ publishTime }}发布排名</span>
<el-button type="primary"
@click="cancelPublish(0)">取消发布</el-button>
</div>
</template>
<el-button v-if="list.length"
type="primary"
:loading="loading"
@click="exportData">{{ loading ? '正在导出' : '批量导出' }}</el-button>
</div>
</div>
<el-table :data="list"
class="table"
ref="table"
stripe
row-key="scoreId"
@selection-change="handleSelectionChange"
header-align="center">
<el-table-column type="selection"
width="55"
align="center"
:reserve-selection="true"></el-table-column>
<el-table-column type="index"
width="60"
label="排名"
@ -312,7 +322,9 @@ export default {
return [`${hour}:${minute}:${second} - 23:59:59`]
})(),
},
uploaded: 0
uploaded: 0,
multipleSelection: [],
loading: false
};
},
mounted () {
@ -487,10 +499,32 @@ export default {
toReport (row) {
this.$router.push(`/matchReport?reportId=${row.reportId}`)
},
handleSelectionChange (val) { //
this.multipleSelection = val;
},
handleCurrentChange (val) { //
this.page = val;
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 () {
if (this.type) { //

@ -1,45 +1,43 @@
<template>
<!-- 大赛详情 -->
<div>
<el-card shadow="hover" style="margin-bottom: 20px">
<el-card shadow="hover"
style="margin-bottom: 20px">
<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>
</el-card>
<div class="page">
<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="公告标题">
<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>
</el-form-item>
<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 label="附件">
<el-upload
: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"
<Upload :limit="5"
:file-list="fileList"
name="file"
>
<el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">
<p>支持扩展名.rar .zip .doc .docx .pdf .jpg...</p>
</div>
</el-upload>
:on-remove="handleRemove"
@onSuccess="uploadSuccess" />
</el-form-item>
<el-form-item>
<el-button v-if="!form.id" @click="save(0)" v-auth="'/match:管理:公告通知:草稿'">草稿</el-button>
<el-button type="primary" @click="save(1)" v-auth="'/match:管理:公告通知:发布'">发布</el-button>
<el-button v-if="!form.id"
@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-form-item>
</el-form>
@ -51,9 +49,11 @@
<script>
import quill from "@/components/quill";
import util from "@/libs/util";
import Upload from '@/components/upload';
import Oss from '@/components/upload/upload.js'
export default {
name: "matchDetail",
data() {
data () {
return {
headers: {
token: sessionStorage.getItem('token')
@ -72,23 +72,24 @@ export default {
};
},
components: {
quill
quill,
Upload
},
watch: {
// ,
form: {
handler(){
handler () {
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()
},
methods: {
getData() {
getData () {
this.$post(`${this.api.queryAnnouncementDetails}?id=${this.form.id}`).then(({ data }) => {
this.form = data
//
@ -105,10 +106,10 @@ export default {
} else {
data.announcementAnnexList = []
}
}).catch(err => {})
}).catch(err => { })
},
//
save(status) {
save (status) {
const form = this.form
if (!form.announcementTitle) return util.warningMsg('请填写公告标题')
if (!form.announcementText) return util.warningMsg('请填写正文')
@ -119,53 +120,48 @@ export default {
this.$post(this.api.amendmentAnnouncement, form).then(res => {
util.successMsg("修改成功")
this.$router.back()
}).catch(err => {})
}).catch(err => { })
} else {
form.isOpen = status ? 0 : 1
this.$post(this.api.addAnnouncement, form).then(res => {
util.successMsg("创建成功")
this.$router.back()
}).catch(err => {})
}).catch(err => { })
}
},
handleExceed(files, fileList) {
handleExceed (files, fileList) {
util.warningMsg(`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`);
},
//
uploadSuccess(res) {
const file = res.data.filesResult
uploadSuccess (file) {
const { id } = this.form
const data = {
announcementId: id || '',
fileName: this.fileName,
filePath: file.fileUrl || file.fileId
fileName: file.name,
filePath: file.url
}
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 => { })
},
//
beforeUpload(file) {
this.fileName = file.name
},
uploadError(err, file, fileList) {
uploadError (err, file, fileList) {
this.$message({
message: "上传出错,请重试!",
type: "error",
center: true
});
},
beforeRemove(file, fileList) {
beforeRemove (file, fileList) {
return this.$confirm(`确定移除 ${file.name}`);
},
handleRemove(file, fileList) {
handleRemove (file, fileList) {
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
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()
}
}
@ -255,7 +251,8 @@ $upload-lg-height: 150px;
/deep/ .d-inline-block {
width: 216px;
.el-select, .el-input {
.el-select,
.el-input {
width: 100%;
}
}
@ -275,7 +272,7 @@ $upload-lg-height: 150px;
.remove {
width: 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;
}
}

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

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

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

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

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

@ -1,64 +1,88 @@
<template>
<div class="wrap">
<el-card shadow="hover" class="mgb20">
<el-card shadow="hover"
class="mgb20">
<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>
<span class="per_back">返回</span>
<span class="per_school" v-text="id ? '编辑更新日志' : '新增更新日志'"></span>
<span class="per_school"
v-text="id ? '编辑更新日志' : '新增更新日志'"></span>
</div>
<div>
<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>
<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-form class="form" 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-card class="page"
shadow="hover">
<el-form class="form"
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 label="封面图片">
<el-upload
class="avatar-uploader"
<el-upload class="avatar-uploader"
accept=".jpg,.png,.jpeg"
:on-remove="handleRemove"
:on-error="uploadError"
:on-success="uploadSuccess"
:before-remove="beforeRemove"
:limit="1"
:on-exceed="handleExceed"
:action="this.api.fileupload"
:headers="headers"
name="file"
>
<img v-if="form.coverUrl" :src="form.coverUrl" class="avatar">
<div class="uploader-default" v-else>
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>
</el-upload>
</el-form-item>
<el-form-item class="required" label="更新内容">
<el-form-item class="required"
label="更新内容">
<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">
<el-select v-model="item.type" size="small" placeholder="请选择">
<el-option
v-for="item in funcList"
<el-select v-model="item.type"
size="small"
placeholder="请选择">
<el-option v-for="item in funcList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
<div class="btns">
<i v-if="i === form.logContents.length - 1" class="el-icon-circle-plus-outline" @click="add"></i>
<i class="el-icon-delete" @click="del(i)"></i>
<i v-if="i === form.logContents.length - 1"
class="el-icon-circle-plus-outline"
@click="add"></i>
<i class="el-icon-delete"
@click="del(i)"></i>
</div>
</div>
<el-input
type="textarea"
<el-input type="textarea"
:rows="5"
placeholder="请输入"
v-model="item.content">
@ -73,12 +97,13 @@
<script>
import Setting from '@/setting'
import Oss from '@/components/upload/upload.js'
export default {
data() {
data () {
return {
id : this.$route.query.id,
id: this.$route.query.id,
platformId: this.$route.query.platformId,
draft : this.$route.query.draft === '1',
draft: this.$route.query.draft === '1',
headers: {
token: sessionStorage.getItem("token")
},
@ -110,12 +135,12 @@ export default {
submiting: false
};
},
mounted() {
mounted () {
this.id ? this.getData() : this.form.logContents.push(JSON.parse(JSON.stringify(this.originContent)))
},
methods: {
//
getData() {
getData () {
this.$get(`${this.api.logGet}?logId=${this.id}`).then(res => {
const { log } = res
this.form = {
@ -124,10 +149,10 @@ export default {
logContents: log.logContents.length ? log.logContents : [JSON.parse(JSON.stringify(this.originContent))]
}
this.originName = log.versionName
}).catch(res => {})
}).catch(res => { })
},
//
nameChange(val) {
nameChange (val) {
if (this.originName === val) {
this.nameRepeat = false
} else {
@ -139,37 +164,37 @@ export default {
}
},
//
add() {
add () {
this.form.logContents.push(JSON.parse(JSON.stringify(this.originContent)))
},
//
del(i) {
del (i) {
this.form.logContents.splice(i, 1)
},
handleExceed(files, fileList) { //
handleExceed (files, fileList) { //
util.warningMsg("当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!");
},
uploadSuccess(res, file, fileList) {
this.form.coverUrl = res.data.filesResult.fileUrl
handleRequest ({ file }) {
Oss.upload(file).then(res => {
this.form.coverUrl = res.url
})
},
uploadError(err, file, fileList) {
uploadError (err, file, fileList) {
this.$message({
message: "上传出错,请重试!",
type: "error",
center: true
});
},
beforeRemove(file, fileList) {
beforeRemove (file, fileList) {
return this.$confirm(`确定移除 ${file.name}`);
},
handleRemove(file, fileList) {
let fileName = this.coverUrl.replace("https://liuwanr.oss-cn-shenzhen.aliyuncs.com/", "");
this.$del(`${this.api.fileDeletion}?keys=${fileName}`).then(res => {
this.coverUrl = ''
}).catch(res => {});
handleRemove (file, fileList) {
Oss.del(this.form.coverUrl)
this.form.coverUrl = res.url
},
//
submit(draft){
submit (draft) {
if (this.submiting) return false
const { versionName, logContents } = this.form
const id = this.id
@ -233,7 +258,7 @@ $avatar-width: 104px;
overflow: hidden;
&:hover {
border-color: #409EFF;
border-color: #409eff;
}
.uploader-default {
@ -296,10 +321,10 @@ $avatar-width: 104px;
.btns {
i {
margin-left: 10px;
color: #9076FF;
color: #9076ff;
cursor: pointer;
&:hover {
opacity: .9;
opacity: 0.9;
}
}
}

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

@ -157,6 +157,7 @@
<el-form label-width="80px">
<el-form-item label="资源添加">
<Upload :max-size="100000"
:file-list="uploadList"
@beforeUpload="beforeUpload"
@onSuccess="uploadSuccess">
<template slot="tip">
@ -185,6 +186,7 @@
@close="closeSwitch">
<div style="text-align: center">
<Upload :max-size="100000"
:file-list="uploadList"
@beforeUpload="beforeUpload"
@onSuccess="uploadSuccess">
<template slot="tip">
@ -499,35 +501,6 @@ export default {
`当前限制选择 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) {
this.uploading = false;
this.fileId = ''

Loading…
Cancel
Save