Commit dfedd56d authored by verestrasz's avatar verestrasz

图片展示压缩

parent c0a81907
...@@ -231,7 +231,7 @@ export default { ...@@ -231,7 +231,7 @@ export default {
methods: { methods: {
getImgUrl (item) { getImgUrl (item) {
if (this.type === 'image') { if (this.type === 'image') {
return item.url return this.imgCompression(item.url,150)
} else if (this.type === 'video') { } else if (this.type === 'video') {
return getPosterFromVideoUrl(item.url) return getPosterFromVideoUrl(item.url)
} else if (this.type === 'apk') { } else if (this.type === 'apk') {
......
...@@ -30,7 +30,7 @@ import BaiduMap from 'vue-baidu-map' ...@@ -30,7 +30,7 @@ import BaiduMap from 'vue-baidu-map'
import ElementUI from 'element-ui' import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css' import 'element-ui/lib/theme-chalk/index.css'
import vueTencentCaptcha from '@carpenter/vue-tencent-captcha' import vueTencentCaptcha from '@carpenter/vue-tencent-captcha'
import "@/mixins/global.js"
// Vue.use(iView, { // Vue.use(iView, {
// i18n: (key, value) => i18n.t(key, value) // i18n: (key, value) => i18n.t(key, value)
// }) // })
...@@ -76,6 +76,7 @@ class VideoBlot extends BlockEmbed { ...@@ -76,6 +76,7 @@ class VideoBlot extends BlockEmbed {
node.setAttribute('webkit-playsinline', true) node.setAttribute('webkit-playsinline', true)
node.setAttribute('playsinline', true) node.setAttribute('playsinline', true)
node.setAttribute('x5-playsinline', true) node.setAttribute('x5-playsinline', true)
node.setAttribute('style', `margin-left:${value.marginLeft};transform:${value.transform}`)
return node return node
} }
static value (node) { static value (node) {
...@@ -84,7 +85,7 @@ class VideoBlot extends BlockEmbed { ...@@ -84,7 +85,7 @@ class VideoBlot extends BlockEmbed {
controls: node.getAttribute('controls'), controls: node.getAttribute('controls'),
width: node.getAttribute('width'), width: node.getAttribute('width'),
height: node.getAttribute('height'), height: node.getAttribute('height'),
poster: node.getAttribute('poster') poster: node.getAttribute('poster'),
} }
} }
} }
...@@ -98,7 +99,7 @@ class ImgBlot extends BlockEmbed { ...@@ -98,7 +99,7 @@ class ImgBlot extends BlockEmbed {
node.setAttribute('src', value.url) node.setAttribute('src', value.url)
node.setAttribute('height', value.height) node.setAttribute('height', value.height)
node.setAttribute('width', value.width) node.setAttribute('width', value.width)
node.setAttribute('style', 'object-fit: contain') node.setAttribute('style', `object-fit: contain;margin-left:${value.marginLeft};transform:${value.transform}`)
return node return node
} }
static value (node) { static value (node) {
......
import Vue from 'vue'
Vue.mixin({
methods: {
imgCompression(src, width) {
if (/\?x-oss-process=video/.test(src)) {
return src
}
if (src) {
return `${src}?x-oss-process=image/resize,w_${width},limit_0,m_mfit`
}
return src
}
},
})
\ No newline at end of file
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
<div class="item"> <div class="item">
<label class="label">商品通证:</label> <label class="label">商品通证:</label>
<!-- <RadioGroup v-model="data.useNft"> <!-- <RadioGroup v-model="data.useNft">
<Radio label="0" :disabled="isDetail || isEdit || isDraft|| isAgain" class="ivu-radio"></Radio> <Radio label="0" :disabled="isDetail || isEdit || isAgain" class="ivu-radio"></Radio>
<Radio label="1" :disabled="isDetail || isEdit || isDraft|| isAgain" class="ivu-radio"></Radio> <Radio label="1" :disabled="isDetail || isEdit || isAgain" class="ivu-radio"></Radio>
</RadioGroup> --> </RadioGroup> -->
<span>{{data.coinName}}</span> <span>{{data.coinName}}</span>
</div> </div>
...@@ -99,15 +99,15 @@ ...@@ -99,15 +99,15 @@
<!-- <div class="item"> <!-- <div class="item">
<label class="label">应用NFT:</label> <label class="label">应用NFT:</label>
<RadioGroup v-model="data.useNft"> <RadioGroup v-model="data.useNft">
<Radio label="0" :disabled="isDetail || isEdit || isDraft|| isAgain" class="ivu-radio"></Radio> <Radio label="0" :disabled="isDetail || isEdit || isAgain" class="ivu-radio"></Radio>
<Radio label="1" :disabled="isDetail || isEdit || isDraft|| isAgain" class="ivu-radio"></Radio> <Radio label="1" :disabled="isDetail || isEdit || isAgain" class="ivu-radio"></Radio>
</RadioGroup> </RadioGroup>
</div> --> </div> -->
<!-- <div class="item"> <!-- <div class="item">
<label class="label">正品认证:</label> <label class="label">正品认证:</label>
<RadioGroup v-model="data.type"> <RadioGroup v-model="data.type">
<Radio label="1" :disabled="isDetail || isEdit || isDraft|| isAgain" class="ivu-radio">申请</Radio> <Radio label="1" :disabled="isDetail || isEdit || isAgain" class="ivu-radio">申请</Radio>
<Radio label="2" :disabled="isDetail || isEdit || isDraft|| isAgain" class="ivu-radio">不申请</Radio> <Radio label="2" :disabled="isDetail || isEdit || isAgain" class="ivu-radio">不申请</Radio>
</RadioGroup> </RadioGroup>
</div> --> </div> -->
</info-con> </info-con>
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
:width="150" :width="150"
:iconSize="26" :iconSize="26"
:maxNum="5" :maxNum="5"
:maxSize="6"
v-model="data.detailPictures" v-model="data.detailPictures"
:defaultList="data.defaultDetailPicture" :defaultList="data.defaultDetailPicture"
:readonly="isDetail " :readonly="isDetail "
...@@ -39,6 +40,7 @@ ...@@ -39,6 +40,7 @@
:width="150" :width="150"
:iconSize="26" :iconSize="26"
:maxNum="1" :maxNum="1"
:maxSize="6"
v-model="data.thumbList" v-model="data.thumbList"
:defaultList="data.defaultThumbList" :defaultList="data.defaultThumbList"
:readonly="isDetail " :readonly="isDetail "
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
:width="150" :width="150"
:iconSize="26" :iconSize="26"
:maxNum="5" :maxNum="5"
:maxSize="6"
v-model="data.detailPictures" v-model="data.detailPictures"
:defaultList="data.defaultDetailPicture" :defaultList="data.defaultDetailPicture"
:readonly="isDetail" :readonly="isDetail"
...@@ -39,6 +40,7 @@ ...@@ -39,6 +40,7 @@
:width="150" :width="150"
:iconSize="26" :iconSize="26"
:maxNum="1" :maxNum="1"
:maxSize="6"
v-model="data.thumbList" v-model="data.thumbList"
:defaultList="data.defaultThumbList" :defaultList="data.defaultThumbList"
:readonly="isDetail" :readonly="isDetail"
......
...@@ -550,6 +550,7 @@ ...@@ -550,6 +550,7 @@
v-model="data.sku[index].upload.imageList" v-model="data.sku[index].upload.imageList"
@input="handleUploadInput($event, index)" @input="handleUploadInput($event, index)"
:maxNum="1" :maxNum="1"
:maxSize="6"
:defaultList="data.sku[index].upload.defaultImgList" :defaultList="data.sku[index].upload.defaultImgList"
:readonly="isDetail" :readonly="isDetail"
showWatch showWatch
...@@ -582,6 +583,7 @@ ...@@ -582,6 +583,7 @@
:ref="'fileUpload' + index" :ref="'fileUpload' + index"
:width="46" :width="46"
style="margin-top: 5px" style="margin-top: 5px"
:maxSize="6"
v-model="data.sku[index].upload.imageList" v-model="data.sku[index].upload.imageList"
@input="handleUploadInput($event, index)" @input="handleUploadInput($event, index)"
:maxNum="1" :maxNum="1"
...@@ -1441,75 +1443,6 @@ export default { ...@@ -1441,75 +1443,6 @@ export default {
align: "center", align: "center",
}); });
this.data.sku = resArr;
},
genSkuData(prop, resArr) {
let newArr = [];
let { name, valList } = prop;
if (resArr.length === 0) {
valList.forEach((item) => {
let propertyList = [{ propKey: name, propVal: item.val }];
newArr.push({
[name]: item.val,
originalPrice: 0,
stock: "",
coinName: "",
// coinNamePrefix: this.coinNamePrefix,
outToken: "",
republish: false,
// availableNumber: '',
image: "",
propertyList,
// rate: 0,
// typeCode: '',
hash: "",
weight: 0,
upload: {
imageList: [],
defaultImgList: [],
},
});
});
// console.log('newArr1', newArr)
} else {
resArr.forEach((rItem) => {
valList.forEach((vItem) => {
let newItem = { ...rItem, [name]: vItem.val };
newItem.propertyList = JSON.parse(
JSON.stringify(newItem.propertyList)
);
newItem.propertyList.push({
propKey: name,
propVal: vItem.val,
});
newItem.upload = {
imageList: [],
defaultImgList: [],
};
// console.log('newItem', newItem)
newArr.push(newItem);
});
});
}
// console.log('newArr', newArr)
return newArr;
},
genSkuTableBlindBox() {
if(this.columns.length===0){
this.genColumnBlindBox();
}
this.genSkuBlindBox();
},
genColumnBlindBox() {
let columns = [];
this.propList.forEach((pItem) => {
columns.push({
title: "规格名称",
minWidth: 120,
slot: "name",
align: "center",
});
});
columns.push({ columns.push({
title: "重量(KG)", title: "重量(KG)",
slot: "weight", slot: "weight",
......
...@@ -230,7 +230,7 @@ export default { ...@@ -230,7 +230,7 @@ export default {
[ [
h('img', { h('img', {
attrs: { attrs: {
src: params.row.thumb src: this.imgCompression(params.row.thumb,70)
}, },
style: { style: {
width: '70px', width: '70px',
......
...@@ -164,7 +164,7 @@ export default { ...@@ -164,7 +164,7 @@ export default {
[ [
h('img', { h('img', {
attrs: { attrs: {
src: params.row.thumb src: this.imgCompression(params.row.thumb,70)
}, },
style: { style: {
width: '70px', width: '70px',
......
...@@ -320,7 +320,7 @@ export default { ...@@ -320,7 +320,7 @@ export default {
[ [
h("img", { h("img", {
attrs: { attrs: {
src: params.row.thumb, src: this.imgCompression(params.row.thumb,70),
}, },
style: { style: {
width: "70px", width: "70px",
...@@ -417,39 +417,40 @@ export default { ...@@ -417,39 +417,40 @@ export default {
}, },
obj.label obj.label
) )
if(params.row.status===OffShelfType.ISSUE){
const slots=h(
"div",
{
slot:"content",
style:{
'textAlign':"left"
}
},
[
h(
"p",
'目标发行token:500个'
),
h(
"p",
'已发行token:500个'
),
]
)
return h(
'Poptip',
{
props:{
trigger:"hover",
title:'发行进度'
}
},
[statusObj,slots]
)
}else{
return statusObj return statusObj
} // if(params.row.status===OffShelfType.ISSUE){
// const slots=h(
// "div",
// {
// slot:"content",
// style:{
// 'textAlign':"left"
// }
// },
// [
// h(
// "p",
// '目标发行token:500个'
// ),
// h(
// "p",
// '已发行token:500个'
// ),
// ]
// )
// return h(
// 'Poptip',
// {
// props:{
// trigger:"hover",
// title:'发行进度'
// }
// },
// [statusObj,slots]
// )
// }else{
// return statusObj
// }
// //
// return h( // return h(
...@@ -463,7 +464,6 @@ export default { ...@@ -463,7 +464,6 @@ export default {
// ); // );
}, },
}, },
{ {
title: "失败理由", title: "失败理由",
width: 130, width: 130,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment