oss全部替换完成

master
yujialong 1 year ago
parent 2cb471ec92
commit d9f2543d30
  1. 10
      src/api/index.js
  2. 57
      src/components/editor.js
  3. 71
      src/components/quill/index.vue
  4. 2
      src/components/upload/index.vue
  5. 2
      src/components/upload/upload.js
  6. 69
      src/pages/activity/manage/add/index.vue
  7. 36
      src/pages/activity/manage/manage/noticeDetail.vue
  8. 772
      src/pages/course/add/index.vue
  9. 169
      src/pages/course/contentSettings/index.vue
  10. 466
      src/pages/information/addarticle/index.vue
  11. 82
      src/pages/match/add/step1.vue
  12. 20
      src/pages/match/add/step3.vue
  13. 319
      src/pages/match/manage/noticeDetail.vue
  14. 320
      src/pages/system/list/logo.vue
  15. 2
      src/setting.js

@ -14,6 +14,8 @@ export default {
deleteProfile : `users/users/userInfo/deleteProfile`,
refreshPageNotification : `nakadai/message/refreshPageNotification`,
getPlayAuth: `${uploadURL}oss/manage/getPlayAuth`, // 获取播放凭证
platformLogList: `nakadai/nakadai/log/platformLogList`,
logNotification: `nakadai/nakadai/log/logNotification`,
//实验台
@ -304,14 +306,6 @@ export default {
editSubsection: `occupationlab/occupationlab/theoreticalCourseSubsection/editSubsection`, // 修改小节
getSubsection: `occupationlab/occupationlab/theoreticalCourseSubsection/getSubsection`, // 根据小节id获取预览文件地址
// 阿里云文件/视频管理
fileDeletion: `${uploadURL}oss/manage/fileDeletion`, // 删除OSS文件
fileupload: `${uploadURL}oss/manage/fileupload`, // 文件上传
getPlayAuth: `${uploadURL}oss/manage/getPlayAuth`, // 获取播放凭证
removeMoreVideo: `${uploadURL}oss/manage/removeMoreVideo`, // 批量删除视频文件
removeVideo: `${uploadURL}oss/manage/removeVideo`, // 删除视频文件
fileUploadNakadai: `${host}nakadai/nakadai/oss/fileUpload`,
queryProvince: `nakadai/nakadai/province/queryProvince`, //查询省份
queryCity: `nakadai/nakadai/city/queryCity`, //查询城市
querySchoolData: `nakadai/nakadai/school/querySchool`, //根据学校名称查询学校信息

@ -1,7 +1,4 @@
import Axios from 'axios'
import Api from '@/api'
import Setting from '@/setting'
import Util from '@/libs/util'
import Oss from '@/components/upload/upload.js'
import { Loading } from 'element-ui'
export default {
//skin:'oxide-dark',
@ -315,21 +312,25 @@ export default {
powerpaste_allow_local_images: true,
powerpaste_word_import: 'clean',
powerpaste_html_import: 'clean',
urlconverter_callback: (url, node, onSave, name) => {
if (node === 'img' && url.startsWith('blob:')) {
// Do some custom URL conversion
tinymce.activeEditor && tinymce.activeEditor.uploadImages()
}
// Return new URL
return url
},
// 自定义上传
images_upload_handler: function (blobInfo, succFun, failFun) {
const form = new FormData()
form.append('file', blobInfo.blob()),
Axios({
method: 'post',
url: Api.fileUploadNakadai,
data: form,
headers: {
'Content-Type': 'multipart/form-data',
token: Util.local.get(Setting.tokenKey)
},
}).then(({ data }) => {
succFun(data.filesResult.fileUrl)
}).catch(res => {})
const blob = blobInfo.blob()
// blob转换为file
const file = new File([blob], blobInfo.filename(), {
type: 'application/json',
lastModified: Date.now()
});
Oss.upload(file).then(res => {
succFun(res.url)
})
},
//自定义文件选择器的回调内容 此方法只有在点击上方图片按钮才会触发
file_picker_callback: function (callback, value, meta) {
@ -347,23 +348,13 @@ export default {
input.setAttribute("accept", ".mp4");
input.onchange = function(){
let file = this.files[0];
let fd = new FormData();
fd.append("file", file);
const load = Loading.service()
Axios({
method: 'post',
url: Api.fileUploadNakadai,
data: fd,
headers: {
'Content-Type': 'multipart/form-data',
token: Util.local.get(Setting.tokenKey)
},
}).then(({ data }) => {
load.close()
callback(data.filesResult.fileUrl)
}).catch(res => {
load.close()
})
Oss.upload(file).then(res => {
load.close()
callback(res.url)
}).catch(e => {
load.close()
})
}
//触发点击
input.click();

@ -15,14 +15,16 @@
:style="styles"
v-loading="loading"></div>
<el-upload :headers="headers"
:action="this.api.fileupload"
:before-upload="beforeUpload"
:on-success="editorUploadSuccess"
style="display: none">
<el-button :id="'editorUpload' + index"
type="primary">点击上传</el-button>
</el-upload>
<Upload :max-size="1000"
:limit="100"
@beforeUpload="beforeUpload"
@onSuccess="editorUploadSuccess"
style="display: none">
<div slot="trigger">
<el-button :id="'editorUpload' + index"
type="primary">点击上传</el-button>
</div>
</Upload>
</div>
<mavon-editor class="md"
v-model="mdVal"
@ -43,13 +45,15 @@ import "quill/dist/quill.core.css";
import "quill/dist/quill.snow.css";
import "quill/dist/quill.bubble.css";
import toolbarOptions from "./options";
import axios from 'axios'
import { mavonEditor } from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'
import Upload from '@/components/upload';
import Oss from '@/components/upload/upload.js'
export default {
name: "quill",
components: {
Upload,
mavonEditor
},
props: {
@ -242,20 +246,16 @@ export default {
if (!file.type.match(/^image\/(gif|jpe?g|a?png|bmp)/i)) {
return
}
const param = new FormData()
param.append('file', file)
// base64
this.$post(this.api.fileupload, param, {
headers: { "Content-Type": "multipart/form-data" }
}).then(res => {
// ossbase64
Oss.upload(file).then(res => {
var range = ins.getSelection()
if (range) {
//
ins.insertEmbed(range.index, 'image', res.data.filesResult.fileUrl)
ins.insertEmbed(range.index, 'image', res.url)
//
ins.setSelection(range.index + 1)
}
}).catch(res => { })
})
});
}
}, false)
@ -264,21 +264,26 @@ export default {
this.loading = true;
},
// quill
editorUploadSuccess (res) {
editorUploadSuccess (file) {
//
let quill = this.Quill;
let quill = this.Quill
//
if (res.data.filesResult.fileUrl) {
if (file.url) {
//
let length = quill.getSelection().index;
let lengths;
if (quill.getSelection() == null) {
lengths = 1
} else {
lengths = quill.getSelection().index;
}
// res
quill.insertEmbed(length, "image", res.data.filesResult.fileUrl);
quill.insertEmbed(lengths, 'image', file.url)
//
quill.setSelection(length + 1);
quill.setSelection(lengths + 1)
} else {
util.successMsg("图片插入失败");
this.$message.success('图片插入失败')
}
this.loading = false;
this.loading = false
},
//
@ -288,19 +293,9 @@ export default {
// markdown
imgAdd (pos, $file) {
let $vm = this.$refs.md
// ..
const formData = new FormData();
formData.append('file', $file);
axios({
url: this.api.fileupload,
method: 'post',
data: formData,
headers: {
token: this.token,
'Content-Type': 'multipart/form-data'
},
}).then((res) => {
$vm.$img2Url(pos, res.data.data.filesResult.fileUrl);
// oss
Oss.upload($file).then(res => {
$vm.$img2Url(pos, res.url);
})
},
}

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

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

@ -16,15 +16,13 @@
<el-form-item label="项目封面(选填)">
<el-upload class="avatar-uploader"
accept=".jpg,.png,.jpeg,.gif"
:on-success="uploadSuccess"
:action="this.api.fileupload"
:headers="headers"
:limit="1"
:on-exceed="handleExceed"
:before-remove="beforeRemove"
:on-remove="handleRemove"
:on-error="uploadError"
name="file">
action=""
:http-request="handleRequest">
<img v-if="form.coverUrl"
:src="form.coverUrl"
class="avatar">
@ -42,15 +40,13 @@
<el-form-item label="项目封面长图(选填)">
<el-upload class="avatar-uploader avatar-uploader-lg"
accept=".jpg,.png,.jpeg,.gif"
:on-success="uploadLgSuccess"
:action="this.api.fileupload"
:headers="headers"
:limit="1"
:on-exceed="handleExceed"
:before-remove="beforeRemove"
:on-remove="handleCarouselRemove"
:on-error="uploadError"
name="file">
action=""
:http-request="handleRequestLg">
<img v-if="form.carouselUrl"
:src="form.carouselUrl"
class="avatar-lg">
@ -154,23 +150,11 @@
:height="400" />
</el-form-item>
<el-form-item label="附件">
<el-upload :on-remove="handleAnnexRemove"
:on-error="uploadError"
:before-upload="beforeUpload"
:on-success="uploadAnnexSuccess"
:on-exceed="handleExceedAnnex"
:limit="5"
:action="this.api.fileupload"
:headers="headers"
:file-list="form.activityFileList"
name="file">
<el-button size="small"
type="primary">点击上传</el-button>
<div slot="tip"
class="el-upload__tip">
<p>支持扩展名.rar .zip .doc .docx .pdf .jpg...</p>
</div>
</el-upload>
<Upload :limit="5"
:file-list.sync="form.activityFileList"
:changeFileList="false"
:on-remove="handleAnnexRemove"
@onSuccess="uploadAnnexSuccess" />
</el-form-item>
</el-form>
@ -191,6 +175,8 @@
import util from "@/libs/util";
import quill from "@/components/quill";
import Setting from "@/setting";
import Upload from '@/components/upload';
import Oss from '@/components/upload/upload.js'
export default {
data () {
return {
@ -236,6 +222,7 @@ export default {
},
components: {
quill,
Upload
},
watch: {
// ,
@ -319,10 +306,12 @@ export default {
beforeRemove (file, fileList) {
return this.$confirm(`确定移除 ${file.name}`);
},
handleRemove (file, fileList) {
handleRemove () {
Oss.del(this.form.coverUrl)
this.form.coverUrl = ''
},
handleCarouselRemove (file, fileList) {
handleCarouselRemove () {
Oss.del(this.form.carouselUrl)
this.form.carouselUrl = ''
},
uploadError (err, file, fileList) {
@ -332,20 +321,27 @@ export default {
center: true
})
},
uploadSuccess (res) {
this.form.coverUrl = res.data.filesResult.fileUrl
//
async handleRequest ({ file }) {
this.form.coverUrl && Oss.del(this.form.coverUrl)
Oss.upload(file).then(res => {
this.form.coverUrl = res.url
})
},
uploadLgSuccess (res) {
this.form.carouselUrl = res.data.filesResult.fileUrl
//
async handleRequestLg ({ file }) {
this.form.carouselUrl && Oss.del(this.form.carouselUrl)
Oss.upload(file).then(res => {
this.form.carouselUrl = res.url
})
},
//
uploadAnnexSuccess (res) {
const file = res.data.filesResult
const url = file.fileUrl || file.fileId
uploadAnnexSuccess (file) {
const url = file.url
const data = {
activityId: this.form.id || '',
fileName: this.fileName,
name: this.fileName,
fileName: file.name,
name: file.name,
filePath: url,
url
}
@ -366,6 +362,7 @@ export default {
}
},
handleAnnexRemove (file, fileList) {
Oss.del(file.url)
this.form.activityFileList = fileList
},
//

@ -26,24 +26,10 @@
: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"
: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>
<Upload :limit="5"
:file-list="fileList"
:on-remove="handleRemove"
@onSuccess="uploadSuccess" />
</el-form-item>
<el-form-item>
<el-button v-if="!form.id"
@ -62,6 +48,8 @@
import quill from "@/components/quill";
import util from "@/libs/util";
import Setting from "@/setting";
import Upload from '@/components/upload';
import Oss from '@/components/upload/upload.js'
export default {
name: "matchDetail",
data () {
@ -83,7 +71,8 @@ export default {
};
},
components: {
quill
quill,
Upload
},
watch: {
// ,
@ -142,13 +131,12 @@ export default {
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)
//
@ -170,7 +158,7 @@ export default {
},
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.delActivityAnnouncementAnnex}?id=${id}`).then(res => { }).catch(res => { })
}

@ -1,385 +1,428 @@
<template>
<div>
<el-card shadow="hover" class="m-b-20">
<div class="flex-between">
<el-page-header @back="back" :content="form.id ? '编辑课程' : '新增课程'"></el-page-header>
</div>
</el-card>
<div>
<el-card shadow="hover"
class="m-b-20">
<div class="flex-between">
<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="120px" 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>
</div>
</el-form-item>
<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>
</div>
</el-form-item>
<el-form-item prop="visibleRange" label="可见范围">
<div>
<el-radio v-model="form.visibleRange" :label="0" @change="visibleChange">仅本校</el-radio>
</div>
<div>
<el-radio v-model="form.visibleRange" :label="1" @change="visibleChange">全平台</el-radio>
</div>
</el-form-item>
<el-form-item prop="schoolClassificationsIds" label="课程分类">
<div class="d-inline-block">
<el-select v-model="form.schoolClassificationsIds" 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 v-if="form.visibleRange == 1" prop="platformClassificationIds" label="平台课程分类">
<div class="d-inline-block">
<el-select v-model="form.platformClassificationIds" placeholder="请选择平台课程分类" multiple>
<el-option v-for="item in platformClassificationList" :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"
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>
<i class="el-icon-plus"></i>
<p>上传封面</p>
</div>
<el-card shadow="hover"
class="m-b-20">
<el-form :model="form"
:rules="rules"
ref="form"
:disabled="isDetail"
label-width="120px"
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>
</div>
</el-form-item>
<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>
</div>
</el-form-item>
<el-form-item prop="visibleRange"
label="可见范围">
<div>
<el-radio v-model="form.visibleRange"
:label="0"
@change="visibleChange">仅本校</el-radio>
</div>
<div>
<el-radio v-model="form.visibleRange"
:label="1"
@change="visibleChange">全平台</el-radio>
</div>
</el-form-item>
<el-form-item prop="schoolClassificationsIds"
label="课程分类">
<div class="d-inline-block">
<el-select v-model="form.schoolClassificationsIds"
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 v-if="form.visibleRange == 1"
prop="platformClassificationIds"
label="平台课程分类">
<div class="d-inline-block">
<el-select v-model="form.platformClassificationIds"
placeholder="请选择平台课程分类"
multiple>
<el-option v-for="item in platformClassificationList"
: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"
accept=".jpg,.png,.jpeg"
:on-remove="handleRemove"
:on-error="uploadError"
:before-remove="beforeRemove"
:limit="1"
:on-exceed="handleExceed"
action=""
:http-request="handleRequest">
<img v-if="form.coverUrl"
:src="form.coverUrl"
class="avatar">
<div class="uploader-default"
v-else>
<i class="el-icon-plus"></i>
<p>上传封面</p>
</div>
<div 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="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(0)" v-show="!isDetail">{{ form.id ? "更新" : "创建" }}</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
<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="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(0)"
v-show="!isDetail">{{ form.id ? "更新" : "创建" }}</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</template>
<script>
import util from "@/libs/util";
import Setting from "@/setting";
import quill from "@/components/quill";
import Oss from '@/components/upload/upload.js'
export default {
data() {
const that = this
return {
headers: {
token: util.local.get(Setting.tokenKey)
},
isDetail: Boolean(this.$route.query.show),
form: {
id: this.$route.query.id,
courseIntroduction: '',
courseName: '',
courseType: 0,
coverUrl: '',
platformSource: Setting.platformSource,
platformClassificationIds: [],
schoolClassificationsIds: [],
visibleRange: 0
},
rules: {
courseName: [
{ required: true, message: '请输入课程名称', trigger: 'blur' }
],
platformClassificationIds: [
{ required: true, message: '请选择平台课程分类', trigger: 'change' }
],
schoolClassificationsIds: [
{ required: true, message: '请选择课程分类', trigger: 'change' }
],
coverUrl: [
{ required: true, message: '请选择课程封面', trigger: 'change' }
],
courseType: [
{ required: true, message: '请选择课程类型', trigger: 'change' }
],
visibleRange: [
{ required: true, message: '请选择可见范围', trigger: 'change' }
],
courseIntroduction: [
{ required: true, message: '请输入课程介绍', trigger: 'blur' }
]
},
platformClassificationList: [],
classificationList: [],
uploadList: [],
submiting: false,
updateTime: 0,
data () {
const that = this
return {
headers: {
token: util.local.get(Setting.tokenKey)
},
isDetail: Boolean(this.$route.query.show),
form: {
id: this.$route.query.id,
courseIntroduction: '',
courseName: '',
courseType: 0,
coverUrl: '',
platformSource: Setting.platformSource,
platformClassificationIds: [],
schoolClassificationsIds: [],
visibleRange: 0
},
rules: {
courseName: [
{ required: true, message: '请输入课程名称', trigger: 'blur' }
],
platformClassificationIds: [
{ required: true, message: '请选择平台课程分类', trigger: 'change' }
],
schoolClassificationsIds: [
{ required: true, message: '请选择课程分类', trigger: 'change' }
],
coverUrl: [
{ required: true, message: '请选择课程封面', trigger: 'change' }
],
courseType: [
{ required: true, message: '请选择课程类型', trigger: 'change' }
],
visibleRange: [
{ required: true, message: '请选择可见范围', trigger: 'change' }
],
courseIntroduction: [
{ required: true, message: '请输入课程介绍', trigger: 'blur' }
]
},
platformClassificationList: [],
classificationList: [],
uploadList: [],
submiting: false,
updateTime: 0,
rangeVisible: false,
range: [],
rangeInit: [],
rangeChecked: [],
schools: [],
rangeList: [],
rangeTimer: null,
//
props: {
multiple: true,
checkStrictly: true,
lazy: true,
lazyLoad (node, resolve) {
//
const input = document.querySelector('.el-cascader__search-input')
const checked = that.rangeChecked
rangeVisible: false,
range: [],
rangeInit: [],
rangeChecked: [],
schools: [],
rangeList: [],
rangeTimer: null,
//
props: {
multiple: true,
checkStrictly: true,
lazy: true,
lazyLoad (node, resolve) {
//
const input = document.querySelector('.el-cascader__search-input')
const checked = that.rangeChecked
if (input && input.value.trim()) {
const val = input.value.trim()
return that.schools.filter(e => e.label.includes(val))
}
if (input && input.value.trim()) {
const val = input.value.trim()
return that.schools.filter(e => e.label.includes(val))
}
const { level, value } = node
//
if (!level) {
that.$get(that.api.queryProvince).then(({ list }) => {
const data = []
list.map(e => {
e.value = e.provinceId
e.label = e.provinceName
e.children = []
e.disabled = !!checked.find(n => n.provinceId == e.provinceId && !n.cityId)
data.push(e)
})
resolve(data)
}).catch(res => {})
} else if (level === 1) {
//
that.$get(that.api.queryCity, {
provinceId: value
}).then(({ list }) => {
const data = []
list.map(e => {
e.value = e.cityId
e.label = e.cityName
e.children = []
e.disabled = !!checked.find(n => n.cityId == e.cityId && n.provinceId == e.provinceId && !n.schoolId)
data.push(e)
})
resolve(data)
}).catch(res => {})
} else if (level === 2) {
//
that.$get(that.api.getSchoolsByProvince, {
provinceId: node.data.provinceId,
cityId: value,
schoolName: ''
}).then(({ list }) => {
const data = []
list.map(e => {
e.value = e.schoolId
e.label = e.schoolName
e.leaf = true
e.disabled = !!checked.find(n => n.schoolId == e.schoolId && n.cityId == e.cityId && n.provinceId == e.provinceId)
data.push(e)
})
resolve(data)
}).catch(res => {})
} else {
resolve([])
}
}
},
nameRepeat: false
};
},
watch: {
// ,
form: {
handler(val){
this.updateTime++
},
deep:true
}
const { level, value } = node
//
if (!level) {
that.$get(that.api.queryProvince).then(({ list }) => {
const data = []
list.map(e => {
e.value = e.provinceId
e.label = e.provinceName
e.children = []
e.disabled = !!checked.find(n => n.provinceId == e.provinceId && !n.cityId)
data.push(e)
})
resolve(data)
}).catch(res => { })
} else if (level === 1) {
//
that.$get(that.api.queryCity, {
provinceId: value
}).then(({ list }) => {
const data = []
list.map(e => {
e.value = e.cityId
e.label = e.cityName
e.children = []
e.disabled = !!checked.find(n => n.cityId == e.cityId && n.provinceId == e.provinceId && !n.schoolId)
data.push(e)
})
resolve(data)
}).catch(res => { })
} else if (level === 2) {
//
that.$get(that.api.getSchoolsByProvince, {
provinceId: node.data.provinceId,
cityId: value,
schoolName: ''
}).then(({ list }) => {
const data = []
list.map(e => {
e.value = e.schoolId
e.label = e.schoolName
e.leaf = true
e.disabled = !!checked.find(n => n.schoolId == e.schoolId && n.cityId == e.cityId && n.provinceId == e.provinceId)
data.push(e)
})
resolve(data)
}).catch(res => { })
} else {
resolve([])
}
}
},
nameRepeat: false
};
},
watch: {
// ,
form: {
handler (val) {
this.updateTime++
},
deep: true
}
},
// ,
beforeRouteLeave (to, from, next) {
if (this.updateTime) {
this.$confirm(`您所更改的内容未更新,是否更新?`, '提示', {
type: 'warning'
}).then(() => {
this.save(next)
}).catch(() => {
next()
})
} else {
next()
}
},
mounted () {
this.getClassification()
this.form.id && this.getData()
},
components: {
quill
},
methods: {
//
getClassification () {
//
this.$post(this.api.listClassification, {
pageNum: 1,
pageSize: 1000,
platformSource: 0
}).then(({ page }) => {
this.platformClassificationList = page.records
}).catch(res => { })
//
this.$post(this.api.listClassification, {
pageNum: 1,
pageSize: 1000,
platformSource: Setting.platformSource
}).then(({ page }) => {
this.classificationList = page.records
}).catch(res => { })
},
// ,
beforeRouteLeave(to, from, next) {
if(this.updateTime){
this.$confirm(`您所更改的内容未更新,是否更新?`, '提示', {
type: 'warning'
}).then(() => {
this.save(next)
}).catch(() => {
next()
})
}else{
next()
getData () {
this.$post(`${this.api.findTheoreticalCourse}?id=${this.form.id}`).then(({ data }) => {
// id
if (data.platformClassificationList) {
data.platformClassificationIds = data.platformClassificationList.map(e => e.classificationId)
delete data.platformClassificationList
}
if (data.schoolClassificationsList) {
data.schoolClassificationsIds = data.schoolClassificationsList.map(e => e.classificationId)
delete data.schoolClassificationsList
}
this.visibleChange(data.visibleRange)
this.form = data
this.$nextTick(() => {
this.updateTime = 0
})
this.uploadList.push({
name: "cover.jpg",
url: data.coverUrl
})
}).catch(err => { })
},
mounted() {
this.getClassification()
this.form.id && this.getData()
//
nameChange (val) {
this.$post(this.api.checkRepeatTheoreticalCourse, {
id: this.form.id,
courseName: val,
platformSource: Setting.platformSource
}).then(res => {
this.nameRepeat = false
}).catch(err => {
this.nameRepeat = true
})
},
components: {
quill
//
visibleChange (val) {
this.rules.platformClassificationIds[0].required = val == 1
},
methods: {
//
getClassification() {
//
this.$post(this.api.listClassification, {
pageNum: 1,
pageSize: 1000,
platformSource: 0
}).then(({ page }) => {
this.platformClassificationList = page.records
}).catch(res => {})
//
this.$post(this.api.listClassification, {
pageNum: 1,
pageSize: 1000,
platformSource: Setting.platformSource
}).then(({ page }) => {
this.classificationList = page.records
}).catch(res => {})
},
getData() {
this.$post(`${this.api.findTheoreticalCourse}?id=${this.form.id}`).then(({ data }) => {
// id
if (data.platformClassificationList) {
data.platformClassificationIds = data.platformClassificationList.map(e => e.classificationId)
delete data.platformClassificationList
}
if (data.schoolClassificationsList) {
data.schoolClassificationsIds = data.schoolClassificationsList.map(e => e.classificationId)
delete data.schoolClassificationsList
}
this.visibleChange(data.visibleRange)
this.form = data
this.$nextTick(() => {
handleExceed (files, fileList) { //
util.warningMsg("当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!");
},
handleRequest ({ file }) {
this.form.coverUrl && Oss.del(this.form.coverUrl)
Oss.upload(file).then(res => {
this.form.coverUrl = res.url
})
},
uploadError (err, file, fileList) {
this.$message({
message: "上传出错,请重试!",
type: "error",
center: true
});
},
beforeRemove (file, fileList) {
return this.$confirm(`确定移除 ${file.name}`);
},
handleRemove () {
Oss.del(this.form.coverUrl)
this.form.coverUrl = ''
},
save (cb) {
this.$refs.form.validate((valid) => {
if (valid) {
if (this.nameRepeat) return util.errorMsg('当前课程名已存在!')
if (this.submiting) return false
const { form } = this
this.submiting = true
if (form.id) {
form.courseId = form.id
form.platformSource = Setting.platformSource
this.$post(this.api.updateTheoreticalCourse, form).then(res => {
this.updateTime = 0
})
this.uploadList.push({
name: "cover.jpg",
url: data.coverUrl
})
}).catch(err => {})
},
//
nameChange(val) {
this.$post(this.api.checkRepeatTheoreticalCourse, {
id: this.form.id,
courseName: val,
platformSource: Setting.platformSource
}).then(res => {
this.nameRepeat = false
}).catch(err => {
this.nameRepeat = true
})
},
//
visibleChange(val) {
this.rules.platformClassificationIds[0].required = val == 1
},
handleExceed(files, fileList) { //
util.warningMsg("当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!");
},
uploadSuccess(res, file, fileList) {
this.form.coverUrl = res.data.filesResult.fileUrl
},
uploadError(err, file, fileList) {
this.$message({
message: "上传出错,请重试!",
type: "error",
center: true
});
},
beforeRemove(file, fileList) {
return this.$confirm(`确定移除 ${file.name}`);
},
handleRemove(file, fileList) {
let fileName = this.form.coverUrl.replace('https://huoran.oss-cn-shenzhen.aliyuncs.com/', "");
this.$del(`${this.api.fileDeletion}?keys=${fileName}`).then(res => {
this.form.coverUrl = ''
}).catch(res => {});
},
save(cb) {
this.$refs.form.validate((valid) => {
if (valid) {
if (this.nameRepeat) return util.errorMsg('当前课程名已存在!')
if (this.submiting) return false
const { form } = this
this.submiting = true
if (form.id) {
form.courseId = form.id
form.platformSource = Setting.platformSource
this.$post(this.api.updateTheoreticalCourse, form).then(res => {
this.updateTime = 0
this.submiting = false;
util.successMsg("修改成功");
cb ? cb() : this.$router.back()
}).catch(err => {
this.submiting = false;
});
} else {
this.$post(this.api.saveTheoreticalCourse, form).then(({ courseId }) => {
this.submiting = false;
this.updateTime = 0
this.$confirm("课程创建成功,是否马上进行课程内容设置?", "提示", {
type: "success",
confirmButtonText: "马上设置",
cancelButtonText: "稍后操作"
}).then(() => {
this.$router.replace(`/course/contentSettings?id=${courseId}`);
}).catch(() => {
cb ? cb() : this.$router.back()
});
}).catch(err => {
this.submiting = false;
});
}
this.submiting = false;
util.successMsg("修改成功");
cb ? cb() : this.$router.back()
}).catch(err => {
this.submiting = false;
});
} else {
this.$post(this.api.saveTheoreticalCourse, form).then(({ courseId }) => {
this.submiting = false;
this.updateTime = 0
this.$confirm("课程创建成功,是否马上进行课程内容设置?", "提示", {
type: "success",
confirmButtonText: "马上设置",
cancelButtonText: "稍后操作"
}).then(() => {
this.$router.replace(`/course/contentSettings?id=${courseId}`);
}).catch(() => {
cb ? cb() : this.$router.back()
});
}).catch(err => {
this.submiting = false;
});
}
})
},
//
backPage() {
this.$router.back()
},
back() {
const updateTime = this.updateTime
//
if (updateTime) {
this.$confirm(`编辑的内容未保存,是否保存?`, '提示', {
type: 'warning'
}).then(() => {
this.save()
}).catch(() => {
this.updateTime = 0
this.backPage()
})
} else {
}
})
},
//
backPage () {
this.$router.back()
},
back () {
const updateTime = this.updateTime
//
if (updateTime) {
this.$confirm(`编辑的内容未保存,是否保存?`, '提示', {
type: 'warning'
}).then(() => {
this.save()
}).catch(() => {
this.updateTime = 0
this.backPage()
}
})
} else {
this.updateTime = 0
this.backPage()
}
}
}
};
</script>
@ -395,7 +438,7 @@ $avatar-width: 104px;
overflow: hidden;
&:hover {
border-color: #409EFF;
border-color: #409eff;
}
.uploader-default {
@ -446,17 +489,18 @@ $avatar-width: 104px;
/deep/ .d-inline-block {
width: 216px;
.el-select, .el-input {
.el-select,
.el-input {
width: 100%;
}
}
.range-check {
display: inline-block;
margin: 0 0 10px 10px;
display: inline-block;
margin: 0 0 10px 10px;
}
/deep/.range-cas {
.el-tag {
display: none;
}
.el-tag {
display: none;
}
}
</style>

@ -165,26 +165,15 @@
:close-on-click-modal="false">
<el-form label-width="80px">
<el-form-item label="资源添加">
<el-upload :before-upload="beforeUpload"
:on-remove="handleRemove"
:on-error="uploadError"
:on-success="uploadSuccess"
:before-remove="beforeRemove"
:limit="1"
:on-exceed="handleExceed"
:action="this.api.fileupload"
:file-list="uploadList"
:headers="headers"
:http-request="handleRequest"
name="file">
<el-button size="small"><img src="@/assets/img/upload.png"
alt=""> 上传资源</el-button>
<div slot="tip"
class="el-upload__tip">视频请上传MP4格式大小不超过30Moffice文件大小不要超过10M</div>
</el-upload>
<el-progress v-if="showProgress"
:stroke-width="3"
:percentage="progressPercent"></el-progress>
<Upload :max-size="100000"
:file-list="uploadList"
:on-remove="handleRemove"
@beforeUpload="beforeUpload"
@onSuccess="uploadSuccess">
<template slot="tip">
<p>视频请上传MP4格式大小不超过30Moffice文件大小不要超过10M</p>
</template>
</Upload>
</el-form-item>
<el-form-item label="小节名称">
<el-input placeholder="请输入小节名称"
@ -206,24 +195,12 @@
:close-on-click-modal="false"
@close="closeSwitch">
<div style="text-align: center">
<el-upload :before-upload="beforeUpload"
:on-remove="handleRemove"
:on-error="uploadError"
:on-success="uploadSuccess"
:before-remove="beforeRemove"
:limit="1"
:on-exceed="handleExceed"
:action="this.api.fileupload"
:file-list="uploadList"
:headers="headers"
:http-request="handleRequest"
name="file">
<el-button size="small"><img src="@/assets/img/upload.png"
alt=""> 上传资源</el-button>
</el-upload>
<el-progress v-if="showProgress"
:stroke-width="3"
:percentage="progressPercent"></el-progress>
<Upload :file-list="uploadList"
:on-remove="handleRemove"
@beforeUpload="beforeUpload"
@onSuccess="uploadSuccess">
<div slot="tip"></div>
</Upload>
</div>
<span slot="footer"
class="dialog-footer">
@ -266,7 +243,7 @@
style="transform: scale(1) rotate(0deg);margin-top: -1px; max-height: 100%; max-width: 100%;">
</div>
</div>
<div v-show="iframeSrc"
<div v-show="iframeSrc || videoSrc"
class="el-image-viewer__wrapper"
:class="{active: iframeSrc}"
style="z-index: 2000">
@ -282,6 +259,16 @@
id="fileIframe"
:src="iframeSrc"
frameborder="0"></iframe>
<video v-if="videoSrc"
class="video"
width="1200"
height="600"
autoplay
controls>
<source :src="videoSrc"
type="video/mp4">
您的浏览器不支持 video 标签
</video>
<template v-if="showMask">
<div class="mask"
style="width: 200px;height: 30px;top: 53px;right: 320px"></div>
@ -360,7 +347,9 @@ import util from "@/libs/util";
import Setting from "@/setting";
import { Loading } from "element-ui";
import pdf from "@/components/pdf";
import axios from 'axios'
import Upload from '@/components/upload';
import Oss from '@/components/upload/upload.js'
import Util from '@/libs/util'
export default {
name: "contentSettings",
@ -388,6 +377,7 @@ export default {
fileUrl: "",
originalFileName: "",
fileType: "",
videoSrc: '',
playAuth: "",
player: null,
previewImg: "",
@ -425,7 +415,7 @@ export default {
moved: false //
};
},
components: { pdf },
components: { pdf, Upload },
mounted () {
this.insertScript();
this.id = this.$route.query.id;
@ -528,40 +518,12 @@ 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: util.local.get(Setting.tokenKey)
},
//
onUploadProgress: progressEvent => {
const per = Number((progressEvent.loaded / progressEvent.total * 100).toFixed(2))
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 (res, file, fileList) {
this.uploading = false;
this.fileId = res.data.filesResult.fileId;
this.fileType = res.data.filesResult.fileType;
this.fileUrl = res.data.filesResult.fileUrl;
this.fileName = res.data.filesResult.ossFileName;
uploadSuccess (file) {
this.uploading = false
this.fileId = ''
this.fileType = file.format
this.fileUrl = file.url
this.fileName = file.name
},
uploadError (err, file, fileList) {
this.$message({
@ -576,7 +538,8 @@ export default {
}
},
handleRemove (file, fileList) {
this.uploadList = fileList;
Oss.del(this.fileUrl)
this.fileUrl = ''
},
uploadSure () {
this.importVisible = false;
@ -788,22 +751,26 @@ export default {
},
preview (row) {
if (this.transferType(row.fileType) == "视频") {
this.$get(`${this.api.getPlayAuth}/${row.fileId}`).then(res => {
this.playAuth = res.data.playAuth;
if (this.player) {
this.player.replayByVidAndPlayAuth(row.fileId, this.playAuth);
} else {
this.player = new Aliplayer({
id: "player",
width: "100%",
autoplay: false,
vid: row.fileId,
playauth: this.playAuth,
encryptType: 1 //
});
}
}).catch(res => {
});
//
if (row.fileId) {
this.$get(`${this.api.getPlayAuth}/${row.fileId}`).then(res => {
this.playAuth = res.data.playAuth;
if (this.player) {
this.player.replayByVidAndPlayAuth(row.fileId, this.playAuth);
} else {
this.player = new Aliplayer({
id: "player",
width: "100%",
autoplay: false,
vid: row.fileId,
playauth: this.playAuth,
encryptType: 1 //
});
}
}).catch(res => { });
} else {
this.videoSrc = row.fileUrl
}
} else if (this.transferType(row.fileType) == "图片") {
this.previewImg = row.fileUrl;
} else if (row.fileType == "pdf") {
@ -880,23 +847,10 @@ export default {
.catch(err => {
});
},
switchSubmit () {
async switchSubmit () {
if (this.uploading) return util.warningMsg("资源正在上传中,请稍候");
if (!this.fileUrl && !this.fileId) return util.warningMsg("请上传资源");
if (this.transferType(this.curFile.fileType) == "视频") {
let data = {
videoIdList: [this.sectionId]
};
this.$del(`${this.api.removeVideo}/${this.curFile.fileId}`).then(res => {
this.switchSubmitFile();
}).catch(res => {
});
} else {
this.$del(`${this.api.fileDeletion}?keys=${this.curFile.fileName}`).then(res => {
this.switchSubmitFile();
}).catch(res => {
});
}
this.switchSubmitFile()
},
delSection (row) {
this.$confirm("此删除操作不可逆,是否确认删除选中项?", "提示", {
@ -960,6 +914,7 @@ export default {
},
closeIframe () {
this.iframeSrc = "";
this.videoSrc = ''
this.showMask = false;
this.showMask1 = false;
this.showMask2 = false;

@ -1,247 +1,266 @@
<template>
<div>
<el-card shadow="hover" class="m-b-20">
<div class="flex-between">
<el-page-header @back="back" :content="'新增文章'"></el-page-header>
<div>
<el-card shadow="hover"
class="m-b-20">
<div class="flex-between">
<el-page-header @back="back"
:content="'新增文章'"></el-page-header>
</div>
</el-card>
<el-card shadow="hover"
class="m-b-20">
<el-form :model="form"
:rules="rules"
ref="form"
label-width="90px"
label-suffix=":"
size="small">
<el-form-item prop="coverUrl"
label="封面图">
<el-upload class="avatar-uploader"
accept=".jpg,.png,.jpeg"
:on-remove="handleRemove"
:on-error="uploadError"
:before-remove="beforeRemove"
:limit="1"
:on-exceed="handleExceed"
action=""
:http-request="handleRequest">
<img v-if="form.coverUrl"
:src="form.coverUrl"
class="avatar">
<div class="uploader-default"
v-else>
<i class="el-icon-plus"></i>
<p>上传封面</p>
</div>
</el-card>
<el-card shadow="hover" class="m-b-20">
<el-form :model="form" :rules="rules" ref="form" label-width="90px" label-suffix=":" size="small">
<el-form-item prop="coverUrl" label="封面图">
<el-upload
class="avatar-uploader"
accept=".jpg,.png,.jpeg"
:on-remove="handleRemove"
:on-error="uploadError"
: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>
<i class="el-icon-plus"></i>
<p>上传封面</p>
</div>
</el-upload>
</el-form-item>
<el-form-item prop="author" label="作者">
<div class="d-inline-block">
<el-input placeholder="请输入作者" v-model="form.author" clearable></el-input>
</div>
</el-form-item>
<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>
</div>
</el-form-item>
<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>
<el-form-item>
<el-button type="primary" @click="save(0)">确定</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</el-upload>
</el-form-item>
<el-form-item prop="author"
label="作者">
<div class="d-inline-block">
<el-input placeholder="请输入作者"
v-model="form.author"
clearable></el-input>
</div>
</el-form-item>
<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>
</div>
</el-form-item>
<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>
<el-form-item>
<el-button type="primary"
@click="save(0)">确定</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</template>
<script>
import Oss from '@/components/upload/upload.js'
import { mapState } from "vuex";
import quill from "@/components/quill";
import util from "@/libs/util";
import Setting from '@/setting'
export default {
name: "addarticle",
data() {
return {
id: this.$route.query.id,
headers: {
token: util.local.get(Setting.tokenKey)
},
form: {
columnId: +this.$route.query.columnId,
sort: +this.$route.query.sort,
id: '',
coverUrl: '',
author: '',
date: '',
title: '',
content: '',
createUser: this.customerName || this.userName
},
rules: {
coverUrl: [
{ required: true, message: '请上传封面', trigger: 'change' }
],
author: [
{ required: true, message: '请输入作者', trigger: 'blur' }
],
date: [
{ required: true, message: '请选择日期', trigger: 'change' }
],
title: [
{ required: true, message: '请输入文章标题', trigger: 'blur' }
],
content: [
{ required: true, message: '请输入文章内容', trigger: 'blur' }
],
},
uploadList: [],
uploadDataList: [],
submiting: false,
uploading: false,
updateTime: 0,
};
name: "addarticle",
data () {
return {
id: this.$route.query.id,
headers: {
token: util.local.get(Setting.tokenKey)
},
form: {
columnId: +this.$route.query.columnId,
sort: +this.$route.query.sort,
id: '',
coverUrl: '',
author: '',
date: '',
title: '',
content: '',
createUser: this.customerName || this.userName
},
rules: {
coverUrl: [
{ required: true, message: '请上传封面', trigger: 'change' }
],
author: [
{ required: true, message: '请输入作者', trigger: 'blur' }
],
date: [
{ required: true, message: '请选择日期', trigger: 'change' }
],
title: [
{ required: true, message: '请输入文章标题', trigger: 'blur' }
],
content: [
{ required: true, message: '请输入文章内容', trigger: 'blur' }
],
},
uploadList: [],
uploadDataList: [],
submiting: false,
uploading: false,
updateTime: 0,
};
},
computed: {
...mapState("user", [
"userName", "customerName"
])
},
components: {
quill
},
watch: {
// ,
form: {
handler (val) {
this.updateTime++
},
deep: true
}
},
// ,
beforeRouteLeave (to, from, next) {
if (this.updateTime) {
this.$confirm(`您所更改的内容未更新,是否更新?`, '提示', {
type: 'warning'
}).then(() => {
this.save(next)
}).catch(() => {
next()
})
} else {
next()
}
},
mounted () {
this.id && this.getData();
},
methods: {
getData () {
this.$get(`${this.api.getArticle}?articleId=${this.id}`).then(({ article }) => {
this.form = article
this.$nextTick(() => {
this.updateTime = 0
})
}).catch(err => { })
},
computed: {
...mapState("user", [
"userName", "customerName"
])
handleCurrentChange (val) {
this.currPage = val;
},
components: {
quill
handleExceed (files, fileList) {
util.warningMsg(`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`);
},
watch: {
// ,
form: {
handler(val){
this.updateTime++
},
deep:true
}
//
async handleRequest ({ file }) {
this.form.coverUrl && Oss.del(this.form.coverUrl)
Oss.upload(file).then(res => {
this.form.coverUrl = res.url
})
},
// ,
beforeRouteLeave(to, from, next) {
if(this.updateTime){
this.$confirm(`您所更改的内容未更新,是否更新?`, '提示', {
type: 'warning'
}).then(() => {
this.save(next)
}).catch(() => {
next()
})
}else{
next()
}
uploadError (err, file, fileList) {
this.$message({
message: "上传出错,请重试!",
type: "error",
center: true
});
},
beforeRemove (file, fileList) {
return this.$confirm(`确定移除 ${file.name}`);
},
handleRemove (file, fileList) {
Oss.del(this.form.coverUrl)
this.form.coverUrl = ''
},
uploadSure () {
this.BatchUpload = false;
this.pageNo = 1;
this.keyword = "";
this.getData();
},
mounted() {
this.id && this.getData();
addSponsor () {
this.sponsorList.push("");
},
methods: {
getData() {
this.$get(`${this.api.getArticle}?articleId=${this.id}`).then(({ article }) => {
this.form = article
this.$nextTick(() => {
delSponsor (index) {
this.sponsorList.splice(index, 1);
},
addOrganizer () {
this.organzinerList.push("");
},
delOrganizer (index) {
this.organzinerList.splice(index, 1);
},
save (cb) {
this.$refs.form.validate((valid) => {
if (valid) {
if (this.submiting) return false
const { form } = this
if (this.uploading) return util.warningMsg("图片正在上传中,请稍等");
this.submiting = true
if (form.id) {
this.$put(this.api.editArticle, form).then(res => {
this.submiting = false;
util.successMsg("修改成功");
this.updateTime = 0
cb ? cb() : this.$router.back()
})
}).catch(err => {})
},
handleCurrentChange(val) {
this.currPage = val;
},
handleExceed(files, fileList) {
util.warningMsg(`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`);
},
uploadSuccess(res, file, fileList) {
if (this.form.coverUrl) {
let fileName = this.coverUrl.replace("https://liuwanr.oss-cn-shenzhen.aliyuncs.com/", "");
this.$del(`${this.api.fileDeletion}?keys=${fileName}`).then(res => {
}).catch(res => {
});
}
this.form.coverUrl = res.data.filesResult.fileUrl;
},
uploadError(err, file, fileList) {
this.$message({
message: "上传出错,请重试!",
type: "error",
center: true
});
},
beforeRemove(file, fileList) {
return this.$confirm(`确定移除 ${file.name}`);
},
handleRemove(file, fileList) {
let fileName = this.form.coverUrl.replace("https://liuwanr.oss-cn-shenzhen.aliyuncs.com/", "");
this.$del(`${this.api.fileDeletion}?keys=${fileName}`).then(res => {
this.form.coverUrl = "";
}).catch(res => {
});
},
uploadSure() {
this.BatchUpload = false;
this.pageNo = 1;
this.keyword = "";
this.getData();
},
addSponsor() {
this.sponsorList.push("");
},
delSponsor(index) {
this.sponsorList.splice(index, 1);
},
addOrganizer() {
this.organzinerList.push("");
},
delOrganizer(index) {
this.organzinerList.splice(index, 1);
},
save(cb) {
this.$refs.form.validate((valid) => {
if (valid) {
if (this.submiting) return false
const { form } = this
if (this.uploading) return util.warningMsg("图片正在上传中,请稍等");
this.submiting = true
if (form.id) {
this.$put(this.api.editArticle, form).then(res => {
this.submiting = false;
util.successMsg("修改成功");
this.updateTime = 0
cb ? cb() : this.$router.back()
})
.catch(err => {
this.submiting = false;
});
} else {
this.createUser = this.customerName || this.userName
this.$post(this.api.addArticle, form).then(res => {
this.submiting = false;
util.successMsg("创建成功");
this.updateTime = 0
cb ? cb() : this.$router.back()
})
.catch(err => {
this.submiting = false;
});
}
}
})
},
back() {
//
if (this.updateTime) {
this.$confirm(`编辑的内容未保存,是否保存?`, '提示', {
type: 'warning'
}).then(() => {
this.save()
}).catch(() => {
.catch(err => {
this.submiting = false;
});
} else {
this.createUser = this.customerName || this.userName
this.$post(this.api.addArticle, form).then(res => {
this.submiting = false;
util.successMsg("创建成功");
this.updateTime = 0
this.$router.back()
cb ? cb() : this.$router.back()
})
} else {
this.updateTime = 0
this.$router.back()
.catch(err => {
this.submiting = false;
});
}
}
})
},
back () {
//
if (this.updateTime) {
this.$confirm(`编辑的内容未保存,是否保存?`, '提示', {
type: 'warning'
}).then(() => {
this.save()
}).catch(() => {
this.updateTime = 0
this.$router.back()
})
} else {
this.updateTime = 0
this.$router.back()
}
}
}
};
</script>
@ -257,7 +276,7 @@ $avatar-width: 104px;
overflow: hidden;
&:hover {
border-color: #409EFF;
border-color: #409eff;
}
.uploader-default {
@ -308,7 +327,8 @@ $avatar-width: 104px;
/deep/ .d-inline-block {
width: 216px;
.el-select, .el-input {
.el-select,
.el-input {
width: 100%;
}
}

@ -12,13 +12,11 @@
accept=".jpg,.png,.jpeg,.gif"
: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">
action=""
:http-request="handleRequest">
<img v-if="form.coverUrl"
:src="form.coverUrl"
class="avatar">
@ -38,13 +36,11 @@
accept=".jpg,.png,.jpeg,.gif"
:on-remove="handleLgRemove"
:on-error="uploadError"
:on-success="uploadLgSuccess"
:before-remove="beforeRemove"
:limit="1"
:on-exceed="handleExceed"
:action="this.api.fileupload"
:headers="headers"
name="file">
action=""
:http-request="handleRequestLg">
<img v-if="form.carouselUrl"
:src="form.carouselUrl"
class="avatar-lg">
@ -220,23 +216,10 @@
:readonly="!editing && form.id !== ''" />
</el-form-item>
<el-form-item label="附件">
<el-upload :on-remove="handleAnnexRemove"
:on-error="uploadError"
:before-upload="beforeUpload"
:on-success="uploadAnnexSuccess"
:limit="5"
:on-exceed="handleExceedAnnex"
:action="this.api.fileupload"
:headers="headers"
: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>
<Upload :limit="5"
:file-list.sync="fileList"
:on-remove="handleAnnexRemove"
@onSuccess="uploadAnnexSuccess" />
</el-form-item>
</el-form>
</div>
@ -287,6 +270,8 @@
import util from "@/libs/util";
import quill from "@/components/quill";
import Setting from "@/setting";
import Upload from '@/components/upload';
import Oss from '@/components/upload/upload.js'
export default {
props: ['editing'],
data () {
@ -414,7 +399,8 @@ export default {
};
},
components: {
quill
quill,
Upload
},
watch: {
editing: function (val) {
@ -600,24 +586,25 @@ export default {
handleExceedAnnex (files, fileList) {
util.warningMsg(`当前限制选择 5 个文件,如需更换,请删除一个文件再重新选择!`);
},
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
//
async handleRequest ({ file }) {
Oss.upload(file).then(res => {
this.form.coverUrl = res.url
})
},
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
//
async handleRequestLg ({ file }) {
Oss.upload(file).then(res => {
this.form.carouselUrl = res.url
})
},
//
uploadAnnexSuccess (res) {
const file = res.data.filesResult
uploadAnnexSuccess (file) {
const { id } = this.form
const data = {
competitionId: id || '',
fileName: this.fileName,
filePath: file.fileUrl || file.fileId
fileName: file.name,
filePath: file.url
}
this.form.competitionAnnexList.push(data)
//
@ -644,20 +631,17 @@ export default {
beforeRemove (file, fileList) {
return this.$confirm(`确定移除 ${file.name}`);
},
handleRemove (file, fileList) {
this.$del(`${this.api.fileDeletion}?keys=${this.form.coverUrl}`).then(res => {
this.form.coverUrl = ''
}).catch(res => { })
handleRemove () {
Oss.del(this.form.coverUrl)
this.form.coverUrl = ''
},
handleLgRemove (file, fileList) {
this.$del(`${this.api.fileDeletion}?keys=${this.form.carouselUrl}`).then(res => {
this.form.carouselUrl = ''
}).catch(res => { })
handleLgRemove () {
Oss.del(this.form.carouselUrl)
this.form.carouselUrl = ''
},
handleAnnexRemove (file, fileList) {
const { url, name } = file
url && this.$del(`${this.api.fileDeletion}?keys=${url}`).then(res => { }).catch(res => { })
const id = this.form.competitionAnnexList.find(e => e.fileName === name).id
Oss.del(file.url)
const { id } = file
id && this.$post(`${this.api.delComAnnex}?id=${id}`).then(res => { }).catch(res => { })
},
//

@ -62,12 +62,10 @@
<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"
:headers="headers"
action=""
:file-list="item.competitionStageContentSetting.fileList"
name="file">
:http-request="res => handleRequest(res, item)">
<el-button size="small"
type="primary">上传文件</el-button>
</el-upload>
@ -137,6 +135,7 @@
</template>
<script>
import Oss from '@/components/upload/upload.js'
import util from "@/libs/util";
import Setting from "@/setting";
import set from './set'
@ -319,14 +318,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
item.competitionStageContentSetting.fileList.push({
name: originalFileName,
url: fileUrl
//
async handleRequest ({ file }, item) {
Oss.upload(file).then(res => {
item.competitionStageContentSetting.fileList.push({
name: res.name,
url: res.url
})
})
},

@ -1,175 +1,175 @@
<template>
<!-- 大赛详情 -->
<div>
<el-card shadow="hover" style="margin-bottom: 20px">
<div class="flex-between">
<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-item label="公告标题">
<div class="d-inline-block">
<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" />
</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"
: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>
</el-form-item>
<el-form-item>
<el-button v-if="!form.id" @click="save(0)" v-auth="'/match/list:管理:公告通知:草稿'">草稿</el-button>
<el-button type="primary" @click="save(1)" v-auth="'/match/list:管理:公告通知:发布'">发布</el-button>
<el-button @click="back">取消</el-button>
</el-form-item>
</el-form>
</div>
<!-- 大赛详情 -->
<div>
<el-card shadow="hover"
style="margin-bottom: 20px">
<div class="flex-between">
<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-item label="公告标题">
<div class="d-inline-block">
<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" />
</el-form-item>
<el-form-item label="附件">
<Upload :limit="5"
:file-list="fileList"
:on-remove="handleRemove"
@onSuccess="uploadSuccess" />
</el-form-item>
<el-form-item>
<el-button v-if="!form.id"
@click="save(0)"
v-auth="'/match/list:管理:公告通知:草稿'">草稿</el-button>
<el-button type="primary"
@click="save(1)"
v-auth="'/match/list:管理:公告通知:发布'">发布</el-button>
<el-button @click="back">取消</el-button>
</el-form-item>
</el-form>
</div>
</div>
</div>
</template>
<script>
import quill from "@/components/quill";
import util from "@/libs/util";
import Setting from "@/setting";
import Upload from '@/components/upload';
import Oss from '@/components/upload/upload.js'
export default {
name: "matchDetail",
data() {
return {
headers: {
token: util.local.get(Setting.tokenKey)
},
form: {
id: this.$route.query.id,
competitionId: this.$route.query.competitionId,
announcementText: '',
announcementTitle: '',
announcementAnnexList: [],
isOpen: 1
},
updateTime: 0,
fileName: '',
fileList: [],
};
name: "matchDetail",
data () {
return {
headers: {
token: util.local.get(Setting.tokenKey)
},
form: {
id: this.$route.query.id,
competitionId: this.$route.query.competitionId,
announcementText: '',
announcementTitle: '',
announcementAnnexList: [],
isOpen: 1
},
updateTime: 0,
fileName: '',
fileList: [],
};
},
components: {
quill,
Upload
},
watch: {
// ,
form: {
handler () {
this.updateTime++
if (this.updateTime > 1) this.$store.commit('match/setWait', 0)
},
deep: true
},
components: {
quill
},
mounted () {
this.form.id && this.getData()
},
methods: {
getData () {
this.$post(`${this.api.queryAnnouncementDetails}?id=${this.form.id}`).then(({ data }) => {
this.form = data
//
const fileList = data.announcementAnnexList
if (fileList) {
const files = []
fileList.map(e => {
files.push({
name: e.fileName,
url: e.filePath
})
})
this.fileList = files
} else {
data.announcementAnnexList = []
}
}).catch(err => { })
},
watch: {
// ,
form: {
handler(){
this.updateTime++
if(this.updateTime > 1) this.$store.commit('match/setWait', 0)
},
deep:true
},
//
save (status) {
const form = this.form
if (!form.announcementTitle) return util.warningMsg('请填写公告标题')
if (!form.announcementText) return util.warningMsg('请填写正文')
form.status = status
if (form.id) {
form.isOpen = 0
delete form.announcementAnnexList
this.$post(this.api.amendmentAnnouncement, form).then(res => {
util.successMsg("修改成功")
this.$router.back()
}).catch(err => { })
} else {
form.isOpen = status ? 0 : 1
this.$post(this.api.addAnnouncement, form).then(res => {
util.successMsg("创建成功")
this.$router.back()
}).catch(err => { })
}
},
mounted() {
this.form.id && this.getData()
handleExceed (files, fileList) {
util.warningMsg(`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`);
},
methods: {
getData() {
this.$post(`${this.api.queryAnnouncementDetails}?id=${this.form.id}`).then(({ data }) => {
this.form = data
//
const fileList = data.announcementAnnexList
if (fileList) {
const files = []
fileList.map(e => {
files.push({
name: e.fileName,
url: e.filePath
})
})
this.fileList = files
} else {
data.announcementAnnexList = []
}
}).catch(err => {})
},
//
save(status) {
const form = this.form
if (!form.announcementTitle) return util.warningMsg('请填写公告标题')
if (!form.announcementText) return util.warningMsg('请填写正文')
form.status = status
if (form.id) {
form.isOpen = 0
delete form.announcementAnnexList
this.$post(this.api.amendmentAnnouncement, form).then(res => {
util.successMsg("修改成功")
this.$router.back()
}).catch(err => {})
} else {
form.isOpen = status ? 0 : 1
this.$post(this.api.addAnnouncement, form).then(res => {
util.successMsg("创建成功")
this.$router.back()
}).catch(err => {})
}
},
handleExceed(files, fileList) {
util.warningMsg(`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`);
},
//
uploadSuccess(res) {
const file = res.data.filesResult
const { id } = this.form
const data = {
announcementId: id || '',
fileName: this.fileName,
filePath: file.fileUrl || file.fileId
}
this.form.announcementAnnexList.push(data)
//
id && this.$post(this.api.saveAnnouncementAnnex, data).then(res => {}).catch(res => {})
},
//
beforeUpload(file) {
this.fileName = file.name
},
uploadError(err, file, fileList) {
this.$message({
message: "上传出错,请重试!",
type: "error",
center: true
});
},
beforeRemove(file, fileList) {
return this.$confirm(`确定移除 ${file.name}`);
},
handleRemove(file, fileList) {
if (file.url) {
this.$del(`${this.api.fileDeletion}?keys=${file.url}`).then(res => {}).catch(res => {})
const id = this.form.announcementAnnexList.find(e => e.fileName === file.name).id
this.$post(`${this.api.delAnnex}?id=${id}`).then(res => {}).catch(res => {})
}
},
back() {
this.$router.back()
}
//
uploadSuccess (file) {
const { id } = this.form
const data = {
announcementId: id || '',
fileName: file.name,
filePath: file.url
}
this.form.announcementAnnexList.push(data)
//
id && this.$post(this.api.saveAnnouncementAnnex, data).then(res => { }).catch(res => { })
},
//
beforeUpload (file) {
this.fileName = file.name
},
uploadError (err, file, fileList) {
this.$message({
message: "上传出错,请重试!",
type: "error",
center: true
});
},
beforeRemove (file, fileList) {
return this.$confirm(`确定移除 ${file.name}`);
},
handleRemove (file, fileList) {
if (file.url) {
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 => { })
}
},
back () {
this.$router.back()
}
}
};
</script>
@ -256,7 +256,8 @@ $upload-lg-height: 150px;
/deep/ .d-inline-block {
width: 216px;
.el-select, .el-input {
.el-select,
.el-input {
width: 100%;
}
}
@ -276,7 +277,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;
}
}

@ -1,190 +1,198 @@
<template>
<div class="page">
<h6 class="p-title">系统logo设置</h6>
<el-form ref="form" label-width="100px">
<el-form-item label="标题">
<el-input v-model="form.title " ref="account" placeholder="请输入标题" style="width: 400px"></el-input>
</el-form-item>
<el-form-item 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="coverUrl" :src="coverUrl" class="avatar">
<div class="uploader-default" v-else>
<i class="el-icon-plus"></i>
<p>上传图标</p>
</div>
<div class="page">
<h6 class="p-title">系统logo设置</h6>
<el-form ref="form"
label-width="100px">
<el-form-item label="标题">
<el-input v-model="form.title "
ref="account"
placeholder="请输入标题"
style="width: 400px"></el-input>
</el-form-item>
<el-form-item label="图标">
<el-upload class="avatar-uploader"
accept=".jpg,.png,.jpeg"
:on-remove="handleRemove"
:on-error="uploadError"
:before-remove="beforeRemove"
:limit="1"
:on-exceed="handleExceed"
action=""
:http-request="handleRequest">
<img v-if="coverUrl"
:src="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">
<p>只能上传jpg/png文件</p>
<p>图标将按1:1显示最佳分辨率100*100</p>
</div>
</el-upload>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="save">{{ form.id ? "更新" : "创建" }}</el-button>
</el-form-item>
</el-form>
</div>
<div slot="tip"
class="el-upload__tip">
<p>只能上传jpg/png文件</p>
<p>图标将按1:1显示最佳分辨率100*100</p>
</div>
</el-upload>
</el-form-item>
<el-form-item>
<el-button type="primary"
@click="save">{{ form.id ? "更新" : "创建" }}</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import util from "@/libs/util";
import Setting from "@/setting";
import { mapActions, mapState } from "vuex";
import Oss from '@/components/upload/upload.js'
export default {
name: "logo",
data() {
return {
headers: {
token: util.local.get(Setting.tokenKey)
},
coverUrl: "",
uploadList: [],
form: {
id: "",
title: "",
logoUrl: ""
}
name: "logo",
data () {
return {
headers: {
token: util.local.get(Setting.tokenKey)
},
coverUrl: "",
uploadList: [],
form: {
id: "",
title: "",
logoUrl: ""
}
}
},
mounted () {
this.getSystemDetail();
},
methods: {
...mapActions("user", [
"setTitle", "setLogoUrl"
]),
getSystemDetail () {
this.$get(this.api.logoDetail).then(res => {
if (res.data) {
this.form = res.data;
this.coverUrl = res.data.logoUrl;
this.uploadList.push({
name: "logo.jpg",
url: this.coverUrl
});
this.setTitle(res.data.title);
this.setLogoUrl(res.data.logoUrl);
}
}).catch(res => { });
},
mounted() {
this.getSystemDetail();
handleExceed (files, fileList) { //
util.warningMsg("当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!");
},
methods: {
...mapActions("user", [
"setTitle", "setLogoUrl"
]),
getSystemDetail () {
this.$get(this.api.logoDetail).then(res => {
if (res.data) {
this.form = res.data;
this.coverUrl = res.data.logoUrl;
this.uploadList.push({
name: "logo.jpg",
url: this.coverUrl
});
this.setTitle(res.data.title);
this.setLogoUrl(res.data.logoUrl);
}
}).catch(res => {});
},
handleExceed(files, fileList) { //
util.warningMsg("当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!");
},
uploadSuccess(res, file, fileList) {
this.coverUrl = res.data.filesResult.fileUrl;
},
uploadError(err, file, fileList) {
this.$message({
message: "上传出错,请重试!",
type: "error",
center: true
});
},
beforeRemove(file, fileList) {
return this.$confirm(`确定移除 ${file.name}`);
},
handleRemove(file, fileList) {
let fileName = this.coverUrl.replace("https://liuwanr.oss-cn-shenzhen.aliyuncs.com/", "");
this.$del(`${this.api.fileDeletion}?keys=${fileName}`).then(res => {
this.coverUrl = "";
}).catch(res => {
});
},
save() {
this.form.logoUrl = this.coverUrl;
if (this.form.id) {
this.$post(this.api.logoUpdate, this.form).then(res => {
util.successMsg("更新成功");
this.getSystemDetail();
}).catch(res => {});
} else {
this.$post(this.api.logoSave, this.form).then(res => {
util.successMsg("新增成功");
this.getSystemDetail();
}).catch(res => {});
}
}
//
async handleRequest ({ file }) {
this.coverUrl && Oss.del(this.coverUrl)
Oss.upload(file).then(res => {
this.coverUrl = res.url
})
},
uploadError (err, file, fileList) {
this.$message({
message: "上传出错,请重试!",
type: "error",
center: true
});
},
beforeRemove (file, fileList) {
return this.$confirm(`确定移除 ${file.name}`);
},
handleRemove (file, fileList) {
Oss.del(this.coverUrl)
this.coverUrl = ''
},
save () {
this.form.logoUrl = this.coverUrl;
if (this.form.id) {
this.$post(this.api.logoUpdate, this.form).then(res => {
util.successMsg("更新成功");
this.getSystemDetail();
}).catch(res => { });
} else {
this.$post(this.api.logoSave, this.form).then(res => {
util.successMsg("新增成功");
this.getSystemDetail();
}).catch(res => { });
}
}
}
};
</script>
<style lang="scss" scoped>
$avatar-width: 104px;
/deep/ .avatar-uploader {
.el-upload {
position: relative;
width: $avatar-width;
border: 1px dashed #d9d9d9;
border-radius: 2px;
cursor: pointer;
overflow: hidden;
.el-upload {
position: relative;
width: $avatar-width;
border: 1px dashed #d9d9d9;
border-radius: 2px;
cursor: pointer;
overflow: hidden;
&:hover {
border-color: #409EFF;
}
&:hover {
border-color: #409eff;
}
.uploader-default {
display: flex;
flex-direction: column;
justify-content: center;
width: $avatar-width !important;
height: $avatar-width;
text-align: center;
background: rgba(0, 0, 0, 0.04);
.uploader-default {
display: flex;
flex-direction: column;
justify-content: center;
width: $avatar-width !important;
height: $avatar-width;
text-align: center;
background: rgba(0, 0, 0, 0.04);
i {
font-size: 20px;
font-weight: bold;
color: #8c939d;
}
i {
font-size: 20px;
font-weight: bold;
color: #8c939d;
}
p {
margin-top: 10px;
font-size: 14px;
color: rgba(0, 0, 0, 0.65);
line-height: 1;
}
}
p {
margin-top: 10px;
font-size: 14px;
color: rgba(0, 0, 0, 0.65);
line-height: 1;
}
}
.avatar {
width: $avatar-width;
height: $avatar-width;
display: block;
}
}
.avatar {
width: $avatar-width;
height: $avatar-width;
display: block;
}
}
.el-upload__tip {
margin-top: 0;
.el-upload__tip {
margin-top: 0;
p {
font-size: 14px;
color: rgba(0, 0, 0, 0.45);
line-height: 1;
p {
font-size: 14px;
color: rgba(0, 0, 0, 0.45);
line-height: 1;
&:first-child {
margin-bottom: 5px;
}
}
}
&:first-child {
margin-bottom: 5px;
}
}
}
}
/deep/ .d-inline-block {
width: 216px;
.el-select, .el-input {
width: 100%;
}
.el-select,
.el-input {
width: 100%;
}
}
</style>

@ -30,7 +30,7 @@ if (isPro) {
uploadURL = `http://121.37.12.51/`
host = "http://121.37.12.51/"; // 中台测试服
// host = 'https://www.occupationlab.com/' // 正式服
// host = "http://192.168.31.217:9000/"; // 榕
host = "http://192.168.31.217:9000/"; // 榕
// host = 'http://192.168.31.51:9000/'; // 赓
} else if (isSq) {
zcPath = `10.20.100.204:8883`

Loading…
Cancel
Save