|
@@ -0,0 +1,710 @@
|
|
|
+<!-- -->
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <main-top :crumb="crumbData" :status="form.status">
|
|
|
+ <div slot="con" class="con-btn">
|
|
|
+ <el-button type="primary" @click="back">返回</el-button>
|
|
|
+ </div>
|
|
|
+ </main-top>
|
|
|
+ <div class="reason" v-if="form.status===3">
|
|
|
+ 审核不通过原因:{{form.reason}}
|
|
|
+ </div>
|
|
|
+ <div class="edit-body">
|
|
|
+ <div class="edit-arch" :style="{height: form.status === 3?`calc(100% - 11.5rem - 20px)`:`calc(100% - 8.5rem - 20px)`}">
|
|
|
+ <div class="title">基本信息:</div>
|
|
|
+ <el-form ref="partform" :rules="rules" :model="form" label-width="120px" :disabled="form.status===2||(!($role=='sys_admin'||$role=='sys_high')&&(form.status===4))">
|
|
|
+ <el-form-item label="标题" prop="title">
|
|
|
+ <el-input
|
|
|
+ placeholder="请输入标题"
|
|
|
+ :maxlength="FONTLENGTH"
|
|
|
+ show-word-limit
|
|
|
+ v-model="form.title"
|
|
|
+ :disabled="form.status===2||(!($role=='sys_admin'||$role=='sys_high')&&(form.status===4))"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="精品类型" prop="type">
|
|
|
+ <el-radio-group :disabled="$route.params.type==1" v-model="form.type">
|
|
|
+ <el-radio :label="3">实物模型</el-radio>
|
|
|
+ <el-radio :label="1">专题图库</el-radio>
|
|
|
+ <el-radio :label="2">视频档案</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <template v-if="form.type === 3">
|
|
|
+ <el-form-item label="封面图片" prop="thumb">
|
|
|
+ <el-upload
|
|
|
+ :disabled="form.status===2||(!($role=='sys_admin'||$role=='sys_high')&&(form.status===4))"
|
|
|
+ class="avatar-uploader"
|
|
|
+ :action="uploadUrl"
|
|
|
+ :headers="{token}"
|
|
|
+ :class="{'noCursor':(($role=='sys_admin'||$role=='sys_high')&&(form.status===2))}"
|
|
|
+ :show-file-list="false"
|
|
|
+ :on-success="handleThumbSuccess"
|
|
|
+ :on-error="handleError"
|
|
|
+ :before-upload="beforeAvatarUpload"
|
|
|
+ >
|
|
|
+ <img v-if="form.thumb" :src="form.thumb" class="avatar" />
|
|
|
+ <i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
|
|
+ </el-upload>
|
|
|
+ <span style="color:#999"
|
|
|
+ v-if="!(($role=='sys_admin'||$role=='sys_high')&&(form.status===2))"
|
|
|
+ >支持png、jpg、gif和jpeg的图片格式;最大支持20M。</span>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+
|
|
|
+ <el-form-item label="模型文件" required :key="'moxing'">
|
|
|
+ <el-upload
|
|
|
+ class="upload-demo"
|
|
|
+ drag
|
|
|
+ :disabled="form.status===2||(!($role=='sys_admin'||$role=='sys_high')&&(form.status===4))"
|
|
|
+ :action="uploadModelUrl"
|
|
|
+ :headers="{token}"
|
|
|
+ :show-file-list="false"
|
|
|
+ :before-upload="beforeMultipleUpload"
|
|
|
+ :on-error="handleError"
|
|
|
+ :on-success="handleSuccess"
|
|
|
+ >
|
|
|
+ <i class="el-icon-upload"></i>
|
|
|
+ <div class="el-upload__text">
|
|
|
+ 将文件拖到此处,或
|
|
|
+ <em>点击上传</em>
|
|
|
+ <p>仅支持.4dage格式的模型文件,大小不得超过500m</p>
|
|
|
+ </div>
|
|
|
+ </el-upload>
|
|
|
+ <p v-if="filesIds[0]" style="color:#999">{{filesIds[0].fileName}}</p>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="模型介绍">
|
|
|
+ <el-input
|
|
|
+ placeholder="请输入模型介绍"
|
|
|
+ :maxlength="250"
|
|
|
+ show-word-limit
|
|
|
+ type="textarea"
|
|
|
+ v-model="form.description"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template v-else-if="form.type === 1">
|
|
|
+ <el-form-item label="年份" required :key="'tukuyear'">
|
|
|
+ <el-select v-model="form.year" placeholder="请选择">
|
|
|
+ <el-option v-for="(item,i) in yearStr" :key="i" :label="item.name" :value="item.id"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="专题图库" required :key="'tuku'">
|
|
|
+ <el-upload
|
|
|
+ :action="uploadUrl"
|
|
|
+ :disabled="form.status===2||(!($role=='sys_admin'||$role=='sys_high')&&(form.status===4))"
|
|
|
+ :headers="{token}"
|
|
|
+ list-type="picture-card"
|
|
|
+ :file-list="fileList"
|
|
|
+ :before-upload="beforeAvatarUpload"
|
|
|
+ multiple
|
|
|
+ :on-error="handleError"
|
|
|
+ :on-success="handlePictureCardSuccess"
|
|
|
+ >
|
|
|
+
|
|
|
+ <i class="el-icon-plus"></i>
|
|
|
+ <div class="card-con" slot="file" slot-scope="{file}">
|
|
|
+ <img
|
|
|
+ class="el-upload-list__item-thumbnail"
|
|
|
+ :src="file.url" alt=""
|
|
|
+ >
|
|
|
+ <span class="el-upload-list__item-actions">
|
|
|
+ <span
|
|
|
+ class="el-upload-list__item-delete"
|
|
|
+ >
|
|
|
+ <i v-if="form.status!==2" class="el-icon-delete" @click="del(file)"></i>
|
|
|
+ </span>
|
|
|
+ </span>
|
|
|
+ <div class="cover" v-if="file.cover">封面图片</div>
|
|
|
+ <div class="btn-con">
|
|
|
+
|
|
|
+ <el-button class="queren" :disabled="form.status===2||(!($role=='sys_admin'||$role=='sys_high')&&(form.status===4))" v-if="!file.cover" @click="setCover(file)" size="mini" type="primary">设为封面</el-button>
|
|
|
+ <!-- <el-upload
|
|
|
+ :action="uploadUrl"
|
|
|
+ :headers="{token}"
|
|
|
+ :on-success="handleReloadSuccess"
|
|
|
+ :before-upload="showLoading"
|
|
|
+ :disabled="form.status===2"
|
|
|
+ :show-file-list="false">
|
|
|
+ <el-button @click="reupload(file)" size="mini">重新上传</el-button>
|
|
|
+ </el-upload> -->
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </el-upload>
|
|
|
+ <div style="color:#999;margin-top:40px" >格式要求:支持png、jpg、gif和jpeg的图片格式;最大支持20M;最多可以上传18张图片</div>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template v-else>
|
|
|
+ <el-form-item label="年份" required :key="'shipinyear'">
|
|
|
+ <el-select v-model="form.year" placeholder="请选择">
|
|
|
+ <el-option v-for="(item,i) in yearStr" :key="i" :label="item.name" :value="item.id"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="封面图片" prop="thumb" >
|
|
|
+ <el-upload
|
|
|
+ class="avatar-uploader"
|
|
|
+ :action="uploadUrl"
|
|
|
+ :headers="{token}"
|
|
|
+ :class="{'noCursor':(($role=='sys_admin'||$role=='sys_high')&&(form.status===2))}"
|
|
|
+ :disabled="form.status===2||(!($role=='sys_admin'||$role=='sys_high')&&(form.status===4))"
|
|
|
+ :show-file-list="false"
|
|
|
+ :on-success="handleThumbSuccess"
|
|
|
+ :on-error="handleError"
|
|
|
+ :before-upload="beforeAvatarUpload"
|
|
|
+ >
|
|
|
+ <img v-if="form.thumb" :src="form.thumb" class="avatar" />
|
|
|
+ <i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
|
|
+ </el-upload>
|
|
|
+ <span style="color:#999"
|
|
|
+ v-if="!(($role=='sys_admin'||$role=='sys_high')&&(form.status===2))"
|
|
|
+ >支持png、jpg、gif和jpeg的图片格式;最大支持20M。</span>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="视频文件" required :key="'shipin'">
|
|
|
+ <el-upload
|
|
|
+ class="upload-demo"
|
|
|
+ drag
|
|
|
+ :action="uploadUrl"
|
|
|
+ :disabled="form.status===2||(!($role=='sys_admin'||$role=='sys_high')&&(form.status===4))"
|
|
|
+ :headers="{token}"
|
|
|
+ :show-file-list="false"
|
|
|
+ :before-upload="beforeMultipleUpload"
|
|
|
+ :on-error="handleError"
|
|
|
+ :on-success="handleSuccess"
|
|
|
+ >
|
|
|
+ <i class="el-icon-upload"></i>
|
|
|
+ <div class="el-upload__text">
|
|
|
+ 将文件拖到此处,或
|
|
|
+ <em>点击上传</em>
|
|
|
+ <p style="padding:0 10px;">支持AVI、mov、rmvb、rm、FLV、mp4、3GP等格式的视频文件,大小不得超过2GB</p>
|
|
|
+ </div>
|
|
|
+ </el-upload>
|
|
|
+ <p v-if="filesIds[0]" style="color:#999">{{filesIds[0].fileName}}</p>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-form>
|
|
|
+ <el-form
|
|
|
+ label-width="120px"
|
|
|
+ v-if="$role=='sys_admin'||$role=='sys_high'"
|
|
|
+ >
|
|
|
+ <el-form-item v-if="($role=='sys_admin'||$role=='sys_high')&&(form.status===2)" label="显示设置">
|
|
|
+ <el-switch v-model="display" inactive-color="#ccc" @change="changeState({id:form.id,display:display})">
|
|
|
+ </el-switch>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ <template v-if="form.status !== 4">
|
|
|
+ <div class="btnclass" v-if="form.status!==2">
|
|
|
+ <el-button @click="save(1)">保存</el-button>
|
|
|
+ <el-button type="primary" @click="save(2)">提交</el-button>
|
|
|
+ </div>
|
|
|
+ <template v-else>
|
|
|
+ <div class="btnclass" v-if="$role=='sys_admin'||$role=='sys_high'">
|
|
|
+ <el-button @click="dialogFormVisible = true">审核不通过</el-button>
|
|
|
+ <el-button type="primary" @click="()=>{reason='',examine(4)}">审核通过</el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ <template v-if="form.status === 4 && $role=='sys_admin'||$role=='sys_high'">
|
|
|
+ <div class="btnclass">
|
|
|
+ <el-button @click="save(1)">保存</el-button>
|
|
|
+ <el-button type="primary" @click="save(2)">提交</el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
+ <el-dialog title="审核不通过" :visible.sync="dialogFormVisible">
|
|
|
+ <el-form :model="form" >
|
|
|
+ <el-form-item label="选择原因" :rules="[
|
|
|
+ { required: true, message: '选择原因不能为空'},
|
|
|
+ ]" >
|
|
|
+ <el-radio-group v-model="reason">
|
|
|
+ <el-radio :label="'信息内容待调整'">信息内容待调整</el-radio>
|
|
|
+ <el-radio :label="'标题需进行修改'">标题需进行修改</el-radio>
|
|
|
+ <el-radio :label="2">自定义</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ <el-input v-model="zidingyi" v-if="reason===2" type="textarea" :autosize="{ minRows: 2, maxRows: 4}"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="dialogFormVisible = false">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="examine(3)">确 定</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+// 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
|
|
|
+// 例如:import 《组件名称》 from '《组件路径》';
|
|
|
+
|
|
|
+import MainTop from "@/components/main-top";
|
|
|
+import {changeState} from '@/util/commonfn.js'
|
|
|
+export default {
|
|
|
+ // import引入的组件需要注入到对象中才能使用
|
|
|
+ components: {
|
|
|
+ MainTop
|
|
|
+ },
|
|
|
+ watch:{
|
|
|
+ 'form.type':function (newVal) {
|
|
|
+ if (this.type==0) {
|
|
|
+ this.form={
|
|
|
+ fileIds: "",
|
|
|
+ description:"",
|
|
|
+ id: '',
|
|
|
+ thumb: "",
|
|
|
+ thumbFileId:'',
|
|
|
+ title: "",
|
|
|
+ type: newVal,
|
|
|
+ year: 2020
|
|
|
+ }
|
|
|
+ this.filesIds=[]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ const crumbData = [
|
|
|
+ {
|
|
|
+ name: "精品典藏信息",
|
|
|
+ id: 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: this.$route.params.type ? "编辑精品典藏" : "新增精品典藏",
|
|
|
+ id: 1
|
|
|
+ }
|
|
|
+ ];
|
|
|
+
|
|
|
+ return {
|
|
|
+ crumbData,
|
|
|
+ reason:'信息内容待调整',
|
|
|
+ zidingyi:'',
|
|
|
+ dialogFormVisible:false,
|
|
|
+ currentIdx:1,
|
|
|
+ form: {
|
|
|
+ fileIds: "",
|
|
|
+ description:"",
|
|
|
+ id: '',
|
|
|
+ thumb: "",
|
|
|
+ thumbFileId:'',
|
|
|
+ title: "",
|
|
|
+ year:2020,
|
|
|
+ type: parseInt(this.$route.query.type)
|
|
|
+ },
|
|
|
+ display: true,
|
|
|
+ filesIds:[],
|
|
|
+ fileList: [],
|
|
|
+ type: this.$route.params.type,
|
|
|
+ id: this.$route.params.id,
|
|
|
+ token: window.localStorage.getItem("token"),
|
|
|
+ uploadUrl: `${this.$serverName}manage/file/upload?compress=1`,
|
|
|
+ uploadModelUrl: `${this.$serverName}manage/goods/upload`,
|
|
|
+ rules: {
|
|
|
+ title: [{ required: true, message: "请输入标题", trigger: "blur" }],
|
|
|
+ type: [{ required: true, message: "请选择精品类型", trigger: "blur" }],
|
|
|
+ thumb: [{ required: true, message: "请上传封面图片", trigger: "blur" }],
|
|
|
+ }
|
|
|
+ };
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ showLoading(){
|
|
|
+ this.loading = this.$loading(this.loadOption)
|
|
|
+ },
|
|
|
+ back() {
|
|
|
+ if(this.form.status===2){
|
|
|
+ this.$router.back();
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ this.$confirm("点击返回后, 编辑的信息将无法保存,是否继续?", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ }).then(() => {
|
|
|
+ this.$router.back();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ changeState(item) {
|
|
|
+ changeState(item,'goods')
|
|
|
+ },
|
|
|
+ del (item) {
|
|
|
+ this.$confirm('删除后,信息将无法恢复,是否继续?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ this.$http.get(`/manage/file/remove/${item.id}`,{headers: {
|
|
|
+ token: window.localStorage.getItem('token')
|
|
|
+ }}).then(res => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ this.$alert('删除成功', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ callback: () => {
|
|
|
+ let tmp = []
|
|
|
+ this.fileList.forEach(sub => {
|
|
|
+ if (sub.id === item.id) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ tmp.push(sub)
|
|
|
+ });
|
|
|
+ this.fileList = tmp
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$notify.error({
|
|
|
+ title: '错误',
|
|
|
+ message: res.msg
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '已取消删除'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ async setCover(item){
|
|
|
+ let {id} = item
|
|
|
+ this.fileList.forEach((sub) => {
|
|
|
+ if (sub.id == id) {
|
|
|
+ sub.cover = true
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ sub.cover = false
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ async examine(status) {
|
|
|
+ this.$confirm("请再次确认是否进行此审核操作?", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ })
|
|
|
+ .then(async () => {
|
|
|
+ let result = await this.$http({
|
|
|
+ method: "post",
|
|
|
+ data: {
|
|
|
+ id: this.form.id,
|
|
|
+ reason: this.reason === 2 ? this.zidingyi : this.reason,
|
|
|
+ status,
|
|
|
+ },
|
|
|
+ headers: {
|
|
|
+ token: window.localStorage.getItem("token"),
|
|
|
+ },
|
|
|
+ url: `/manage/goods/audit`,
|
|
|
+ });
|
|
|
+
|
|
|
+ if (result.code === 0) {
|
|
|
+ this.$alert("审核成功", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ callback: () => {
|
|
|
+ this.$router.back();
|
|
|
+ },
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$notify.error({
|
|
|
+ title: "错误",
|
|
|
+ message: result.msg,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: "info",
|
|
|
+ message: "已取消",
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // reupload(item){
|
|
|
+ // this.activeFlie = item
|
|
|
+ // },
|
|
|
+ // handleReloadSuccess(res){
|
|
|
+ // this.loading.close()
|
|
|
+ // let { data } = res;
|
|
|
+ // let activeIdx = ''
|
|
|
+ // this.fileList.forEach((sub,i) => {
|
|
|
+ // if (sub.id == this.activeFlie.id) {
|
|
|
+ // activeIdx = i
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+
|
|
|
+ // this.fileList.splice(activeIdx,1,{
|
|
|
+ // url: data.urlPath,
|
|
|
+ // name: data.fileName,
|
|
|
+ // id: data.id,
|
|
|
+ // cover:data.cover
|
|
|
+ // });
|
|
|
+ // },
|
|
|
+ handlePictureCardSuccess(res){
|
|
|
+ this.currentIdx += 1
|
|
|
+ let cuidx = this.currentIdx
|
|
|
+ this.loading.close()
|
|
|
+ let { data } = res;
|
|
|
+ setTimeout(() => {
|
|
|
+ this.fileList.push({
|
|
|
+ url: data.urlPath,
|
|
|
+ name: data.fileName,
|
|
|
+ id: data.id,
|
|
|
+ cover:data.cover
|
|
|
+ });
|
|
|
+ }, 1000 + 100 * cuidx);
|
|
|
+ },
|
|
|
+ handleThumbSuccess(res) {
|
|
|
+ this.loading.close()
|
|
|
+ let { data } = res;
|
|
|
+ this.form.thumb = data.thumb;
|
|
|
+ },
|
|
|
+ handleError(){
|
|
|
+ this.$alert("上传失败,请稍后再试", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ callback: () => {
|
|
|
+ this.loading.close()
|
|
|
+ },
|
|
|
+ });
|
|
|
+ },
|
|
|
+ beforeAvatarUpload(file) {
|
|
|
+ this.currentIdx = 0
|
|
|
+ let type = this.isImage(file.name);
|
|
|
+ if (!type) {
|
|
|
+ this.$message.error('只允许上传图片');
|
|
|
+ return type
|
|
|
+ }
|
|
|
+ const isLt2M = file.size / 1024 / 1024 < 20;
|
|
|
+ if (!isLt2M) {
|
|
|
+ this.$message.error("上传头像图片大小不能超过 20MB!");
|
|
|
+ return isLt2M;
|
|
|
+ }
|
|
|
+ this.showLoading()
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ handleSuccess(res) {
|
|
|
+ this.loading.close()
|
|
|
+ let { data } = res;
|
|
|
+ if (this.form.type !== 1) {
|
|
|
+ this.filesIds = []
|
|
|
+ }
|
|
|
+ this.filesIds.push(data)
|
|
|
+ },
|
|
|
+
|
|
|
+ beforeMultipleUpload(file){
|
|
|
+ let typeArr = this.form.type !== 2 ? ['.4dage'] : ['avi','mov','rmvb','rm','flv','mp4','3gp']
|
|
|
+ let type = this.isTypeBySend(file.name,typeArr);
|
|
|
+ if (!type) {
|
|
|
+ this.$message.error('只允许指定文件格式的文件');
|
|
|
+ return type
|
|
|
+ }
|
|
|
+
|
|
|
+ let size = this.form.type === 2 ? 2000 : 500
|
|
|
+ const isLt500M = file.size / 1024 / 1024 < size;
|
|
|
+
|
|
|
+ if (!isLt500M) {
|
|
|
+ this.$message.error(`上传文件大小不能超过 ${size}MB!`);
|
|
|
+ return isLt500M;
|
|
|
+ }
|
|
|
+ this.showLoading()
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ async postStatus(status){
|
|
|
+ let { id = "", thumb, title, fileUrl,year,description, type } = this.form;
|
|
|
+ let ids = type === 1 ? this.fileList : this.filesIds;
|
|
|
+ let thumbFileId = this.fileList.filter((item) => item.cover);
|
|
|
+ if(type === 1){
|
|
|
+ if(thumbFileId.length<=0){
|
|
|
+ return this.$notify.error({
|
|
|
+ title: "错误",
|
|
|
+ message: '请设置封面图片',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(ids.length <= 0){
|
|
|
+ return this.$notify.error({
|
|
|
+ title: "错误",
|
|
|
+ message: `${this.collectType[type]}不能为空`,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ let params = {
|
|
|
+ fileIds: ids.map((item) => item.id).join(","),
|
|
|
+ id,
|
|
|
+ description,
|
|
|
+ thumb,
|
|
|
+ title,
|
|
|
+ thumbFileId: thumbFileId.length > 0 ? thumbFileId[0].id : "",
|
|
|
+ type,
|
|
|
+ fileUrl,
|
|
|
+ status,
|
|
|
+ year
|
|
|
+ };
|
|
|
+ let result = await this.$http({
|
|
|
+ method: "post",
|
|
|
+ data: params,
|
|
|
+ headers: {
|
|
|
+ token: window.localStorage.getItem("token"),
|
|
|
+ },
|
|
|
+ url: `/manage/goods/save`,
|
|
|
+ });
|
|
|
+
|
|
|
+ if (result.code === 0) {
|
|
|
+ this.$alert("操作成功", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ callback: () => {
|
|
|
+ this.$router.back();
|
|
|
+ },
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$notify.error({
|
|
|
+ title: "错误",
|
|
|
+ message: result.msg,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ save(status) {
|
|
|
+ this.$refs["partform"].validate(async (valid) => {
|
|
|
+ if (valid) {
|
|
|
+ if(status == 2){
|
|
|
+ this.$confirm("请再次确认是否进行此审核操作?", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ }).then(async () => {
|
|
|
+ this.postStatus(status)
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: "info",
|
|
|
+ message: "已取消",
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ this.postStatus(status)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ async getDetail() {
|
|
|
+ let result = await this.$http({
|
|
|
+ method: "get",
|
|
|
+ headers: {
|
|
|
+ token: window.localStorage.getItem("token")
|
|
|
+ },
|
|
|
+ url: `/manage/goods/detail/${this.id}`
|
|
|
+ });
|
|
|
+
|
|
|
+ this.form = result.data.entity;
|
|
|
+
|
|
|
+ this.form.year = this.form.year || 2020
|
|
|
+ this.display = Boolean(this.form.display)
|
|
|
+ this.filesIds = result.data.file;
|
|
|
+ this.fileList = result.data.file.map((item) => {
|
|
|
+ return {
|
|
|
+ name: item.fileName,
|
|
|
+ url: item.urlPath,
|
|
|
+ id: item.id,
|
|
|
+ cover: item.cover
|
|
|
+ };
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ if (this.id && this.id !== "none") {
|
|
|
+ this.getDetail();
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ setTimeout(() => {
|
|
|
+ this.fileList = []
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less" scoped>
|
|
|
+.edit-body {
|
|
|
+ background: #fff;
|
|
|
+ height: 100%;
|
|
|
+ .edit-arch {
|
|
|
+ overflow-y: auto;
|
|
|
+ overflow-x: hidden;
|
|
|
+ height: calc(100% - 8.5rem - 20px);
|
|
|
+ background-color: #fff;
|
|
|
+ padding: 20px 40px 20px 20px;
|
|
|
+ }
|
|
|
+ .btnclass {
|
|
|
+ text-align: center;
|
|
|
+ border: 1px solid #ccc;
|
|
|
+ padding: 10px 0;
|
|
|
+ width: calc(100% - 80px);
|
|
|
+ margin: 0 auto;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|
|
|
+<style lang="less">
|
|
|
+.avatar-uploader .el-upload {
|
|
|
+ border: 1px dashed #d9d9d9;
|
|
|
+ border-radius: 6px;
|
|
|
+ cursor: pointer;
|
|
|
+ position: relative;
|
|
|
+ overflow: hidden;
|
|
|
+}
|
|
|
+.avatar-uploader .el-upload:hover {
|
|
|
+ border-color: #409eff;
|
|
|
+}
|
|
|
+.avatar-uploader-icon {
|
|
|
+ font-size: 28px;
|
|
|
+ color: #8c939d;
|
|
|
+ width: 178px;
|
|
|
+ height: 178px;
|
|
|
+ line-height: 178px;
|
|
|
+ text-align: center;
|
|
|
+}
|
|
|
+.avatar {
|
|
|
+ width: 178px;
|
|
|
+ /* height: 178px; */
|
|
|
+ display: block;
|
|
|
+}
|
|
|
+.el-upload-list--picture-card .el-upload-list__item{
|
|
|
+ overflow: visible!important;
|
|
|
+ margin-top: 40px;
|
|
|
+}
|
|
|
+
|
|
|
+.el-upload--picture-card{
|
|
|
+ margin-top: 40px;
|
|
|
+}
|
|
|
+
|
|
|
+.card-con{
|
|
|
+ height: 100%;
|
|
|
+ position: relative;
|
|
|
+ .btn-con{
|
|
|
+ position: absolute;
|
|
|
+ justify-content: center;
|
|
|
+ bottom: -40px;
|
|
|
+ display: flex;
|
|
|
+ width: 100%;
|
|
|
+ .queren{
|
|
|
+ margin-right: 4px!important;
|
|
|
+ }
|
|
|
+ .el-button--mini, .el-button--mini.is-round{
|
|
|
+ padding: 7px 10px!important;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .cover{
|
|
|
+ position: absolute;
|
|
|
+ bottom: 0;
|
|
|
+ left: 0;
|
|
|
+ background-color: rgba(0, 0, 0, 0.4);
|
|
|
+ width: 100%;
|
|
|
+ padding: 4px 0;
|
|
|
+ color: #fff;
|
|
|
+ text-align: center;
|
|
|
+ pointer-events: none;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|