master
lion 8 months ago
parent 71f6444a81
commit 12cfaf4604

@ -22,7 +22,38 @@
style="width: 100%;"></el-input>
</div>
</div>
</template> -->
</template> -->
<template v-slot:is_jump>
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>Direct jump or not
</div>
<div class="xy-table-item-content">
<el-select style="width:100%" v-model="form.is_jump"
placeholder="Please Select">
<el-option v-for="item in [{id:0,value:'no'},{id:1,value:'yes'}]" :key="item.id" :label="item.value"
:value="item.id">
</el-option>
</el-select>
</div>
</div>
</template>
<template v-slot:link_phase_id v-if="form.is_jump==1">
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>Link Phase
</div>
<div class="xy-table-item-content">
<el-select style="width:100%" filterable v-model="form.link_phase_id"
placeholder="Please Select">
<el-option v-for="item in phaseList" :key="item.id" :label="item.name"
:value="item.id">
</el-option>
</el-select>
</div>
</div>
</template>
<template v-slot:time>
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
@ -117,7 +148,8 @@
<script>
import {
save,
show
show,
index
} from "@/api/product/category.js"
import {
getToken
@ -141,7 +173,8 @@
showWang: false,
action: `${process.env.VUE_APP_UPLOAD_API}`,
pictureList: [],
selectList: [],
selectList: [],
phaseList:[],
detail_item: [{
type: 'index',
width: 50,
@ -158,7 +191,9 @@
}],
form: {
name: '',
sort: 0,
sort: 0,
is_jump:0,
link_phase_id:'',
time: '',
description: '',
picture_id: '',
@ -174,9 +209,20 @@
}
},
created() {
this.uploadOther.token = getToken();
this.uploadOther.token = getToken();
this.getList()
},
methods: {
methods: {
async getList() {
const res = await index({
page_size: 999,
page: 1,
type:2,
sort_type: 'desc',
sort_name: 'time',
})
this.phaseList = res.data
},
handleRemoveP(file, fileList) {
this.pictureList = fileList
},
@ -268,7 +314,8 @@
show_relation: ['picture'],
}).then(res => {
this.form = this.base.requestToForm(res, this.form)
this.description = res.description ? res.description : ''
this.description = res.description ? res.description : ''
this.form.is_jump = res.is_jump?res.is_jump:0
this.form.type = 1
this.form.time = res.time ? res.time : this.$moment().format('YYYY-MM-DD HH:mm:ss')
res.product_category_details.map(item => {
@ -318,6 +365,8 @@
this.form = {
name: '',
sort: 0,
is_jump:0,
link_phase_id:'',
time:'',
description: '',
picture_id: '',

@ -92,7 +92,7 @@
</div>
</div>
</template>
<template v-slot:picture_id_2>
<!-- <template v-slot:picture_id_2>
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>Second Poster
@ -140,7 +140,7 @@
<el-progress v-if="showProgress" :percentage="uploadProgress"></el-progress>
</div>
</div>
</template>
</template> -->
<template v-slot:description>
<div class="xy-table-item">

@ -124,19 +124,52 @@
</div>
</div>
</template>
<!-- <template v-slot:file_ids>
<template v-slot:file_ids>
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>Files
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>Pictures
</div>
<div class="xy-table-item-content">
<el-upload :action="action" class='upload-demo' multiple :file-list="filesList" ref="pictureUpload"
<el-upload :action="action" class='upload-demo' list-type="picture-card" multiple :file-list="filesList" ref="pictureUpload"
accept=".PNG,.jpg,.jpeg,.bmp,.svg"
:auto-upload="true" :data="uploadOther" :on-success="handlesuccess" :on-remove="handleRemove">
<el-button size="small" type="primary">upload</el-button>
<i class="el-icon-plus"></i>
</el-upload>
</div>
</div>
</template> -->
</template>
<template v-slot:video_image_id>
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>Video Poster
</div>
<div class="xy-table-item-content">
<el-upload :action="action" class='upload-demo' :limit="1" list-type="picture-card"
accept=".PNG,.jpg,.jpeg,.bmp,.svg" :file-list="videoPosterList" ref="pictureUpload" :auto-upload="true"
:on-success="(response, file, fileList)=>{return handlesuccessP(response, file, fileList,'video_image_id')}"
:on-remove="(file, fileList)=>{return handleRemoveP(file, fileList,'video_image_id')}">
<i class="el-icon-plus"></i>
</el-upload>
</div>
</div>
</template>
<template v-slot:video_id>
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>Video
</div>
<div class="xy-table-item-content">
<el-upload :action="action" :limit='1' class='upload-demo' :file-list="videoList"
accept=".mp4,.ogg,.flv,.avi,.wmv,.rmvb,.mov"
ref="pictureUpload" :auto-upload="true" :on-progress="handleProgress"
:on-success="(response, file, fileList)=>{return handlesuccessP(response, file, fileList,'video_id')}"
:on-remove="(file, fileList)=>{return handleRemoveP(file, fileList,'video_id')}">
<el-button size="small" type="primary">upload</el-button>
</el-upload>
<el-progress v-if="showProgress" :percentage="uploadProgress"></el-progress>
</div>
</div>
</template>
<template v-slot:product_details>
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
@ -221,8 +254,12 @@
uploadOther: {
token: ""
},
action: `${process.env.VUE_APP_UPLOAD_API}`,
filesList: [],
action: `${process.env.VUE_APP_UPLOAD_API}`,
showProgress:false,
uploadProgress:0,
filesList: [],
videoPosterList:[],
videoList:[],
categoryList: [],
showWang: false,
detail_item: [{
@ -247,7 +284,9 @@
is_visible: 1,
is_sell: 1,
show_price: 0,
// file_ids: '',
file_ids: '',
video_image_id:'',
video_id:'',
product_details: [],
// content: '',
},
@ -281,6 +320,39 @@
return
}
this.filesList = fileList
},
handleProgress(event, file, fileList) {
this.showProgress = true;
this.uploadProgress = event.percent;
},
handleRemoveP(file, fileList,type) {
if(type=='picture_id'){
this.pictureList = fileList
}else if(type=='picture_id_2'){
this.pictureList2 = fileList
}else if(type=='video_image_id'){
this.videoPosterList = fileList
}else if(type=='video_id'){
this.videoList = fileList
}
},
handlesuccessP(response, file, fileList,type) {
if (response && response.hasOwnProperty('errcode')) {
this.$Message.warning(response.errmsg || '')
if(type=='video_image_id'){
this.videoPosterList = []
}else if(type=='video_id'){
this.videoList = []
}
return
}
if(type=='video_image_id'){
this.videoPosterList = fileList
}else if(type=='video_id'){
this.videoList = fileList
}
},
changeEditor(e) {
this.form.content = e
@ -342,6 +414,33 @@
this.form.file_ids = _files
} else {
this.form.file_ids = []
}
let v_files = []
if (this.videoPosterList.length > 0) {
for (var h of this.videoPosterList) {
if (h.response) {
v_files.push(h.response.id)
} else {
v_files.push(h.id)
}
}
this.form.video_image_id = v_files[0]
} else {
this.form.video_image_id = ''
}
let v2_files = []
if (this.videoList.length > 0) {
for (var h of this.videoList) {
if (h.response) {
v2_files.push(h.response.id)
} else {
v2_files.push(h.id)
}
}
this.form.video_id = v2_files[0]
} else {
this.form.video_id = ''
}
console.log("this.form", this.form)
if (this.form.product_details.length > 0) {
@ -382,7 +481,7 @@
getDetail() {
show({
id: this.id,
show_relation: ['productDetails']
show_relation: ['productDetails','videoImage','video']
}).then(res => {
this.form = this.base.requestToForm(res, this.form)
// this.form.content = res.content ? res.content : ''
@ -410,16 +509,32 @@
this.form.product_details = res.product_details
// this.showWang = true
// if (res.files && res.files.length > 0) {
// this.filesList = []
// res.files.map(item => {
// this.filesList.push({
// name: item.original_name,
// id: item.id,
// url: item.url
// })
// })
// }
if (res.files && res.files.length > 0) {
this.filesList = []
res.files.map(item => {
this.filesList.push({
name: item.original_name,
id: item.id,
url: item.url
})
})
}
if (res.video_image) {
this.videoPosterList = []
this.videoPosterList.push({
name: res.video_image.original_name,
id: res.video_image.id,
url: res.video_image.url
})
}
if (res.video) {
this.videoList = []
this.videoList.push({
name: res.video.original_name,
id: res.video.id,
url: res.video.url
})
}
})
}
},
@ -445,9 +560,13 @@
this.showWang = true
} else {
this.id = ''
// this.filesList = []
this.filesList = []
this.showWang = false
this.subPhaseList = []
this.subPhaseList = []
this.videoPosterList = []
this.videoList = []
this.showProgress = false
this.uploadProgress = 0
this.form = {
name: "",
number: '',
@ -459,7 +578,9 @@
is_visible: 1,
is_sell: 1,
show_price: 0,
file_ids: '',
file_ids: [],
video_image_id:'',
video_id:'',
product_details: [],
content: '',
}

@ -10,7 +10,7 @@
>模板下载</el-button
> -->
<div style="color: red; margin-top: 10px">
Do not modify the title name of the template when importing
Do not modify the title name of the template when importing,unique index for part number.
</div>
<el-upload
@ -151,4 +151,7 @@ export default {
left: -8px;
}
}
::v-deep .el-upload-list{
display:none!important
}
</style>

Loading…
Cancel
Save