Commit b83dd441 by 杨明

fixed

1 parent bcbc2f1a
......@@ -1969,44 +1969,6 @@
"integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==",
"dev": true
},
"ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmmirror.com/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"optional": true,
"requires": {
"color-convert": "^2.0.1"
}
},
"chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmmirror.com/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dev": true,
"optional": true,
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
}
},
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmmirror.com/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"optional": true,
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmmirror.com/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true,
"optional": true
},
"debug": {
"version": "4.3.4",
"resolved": "https://registry.npmmirror.com/debug/-/debug-4.3.4.tgz",
......@@ -2016,13 +1978,6 @@
"ms": "2.1.2"
}
},
"has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmmirror.com/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true,
"optional": true
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmmirror.com/ms/-/ms-2.1.2.tgz",
......@@ -2037,28 +1992,6 @@
"requires": {
"minipass": "^3.1.1"
}
},
"supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmmirror.com/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
"optional": true,
"requires": {
"has-flag": "^4.0.0"
}
},
"vue-loader-v16": {
"version": "npm:vue-loader@16.8.3",
"resolved": "https://registry.npmmirror.com/vue-loader/-/vue-loader-16.8.3.tgz",
"integrity": "sha512-7vKN45IxsKxe5GcVCbc2qFU5aWzyiLrYJyUuMz4BQLKctCj/fmCa0w6fGiiQ2cLFetNcek1ppGJQDCup0c1hpA==",
"dev": true,
"optional": true,
"requires": {
"chalk": "^4.1.0",
"hash-sum": "^2.0.0",
"loader-utils": "^2.0.0"
}
}
}
},
......@@ -2715,8 +2648,7 @@
"asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmmirror.com/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
"dev": true
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
},
"atob": {
"version": "2.1.2",
......@@ -2776,12 +2708,30 @@
"dev": true
},
"axios": {
"version": "0.18.1",
"resolved": "https://registry.npmmirror.com/axios/-/axios-0.18.1.tgz",
"integrity": "sha512-0BfJq4NSfQXd+SkFdrvFbG7addhYSBA2mQwISr46pD6E5iqkWg02RAs8vyTT/j0RTnoYmeXauBuSv1qKwR179g==",
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.4.0.tgz",
"integrity": "sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA==",
"requires": {
"follow-redirects": "1.5.10",
"is-buffer": "^2.0.2"
"follow-redirects": "^1.15.0",
"form-data": "^4.0.0",
"proxy-from-env": "^1.1.0"
},
"dependencies": {
"follow-redirects": {
"version": "1.15.2",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
"integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA=="
},
"form-data": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
"requires": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
}
}
}
},
"babel-eslint": {
......@@ -3848,7 +3798,6 @@
"version": "1.0.8",
"resolved": "https://registry.npmmirror.com/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"dev": true,
"requires": {
"delayed-stream": "~1.0.0"
}
......@@ -4688,6 +4637,7 @@
"version": "3.1.0",
"resolved": "https://registry.npmmirror.com/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"dev": true,
"requires": {
"ms": "2.0.0"
}
......@@ -4945,8 +4895,7 @@
"delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmmirror.com/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
"dev": true
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="
},
"delegates": {
"version": "1.0.0",
......@@ -6238,6 +6187,7 @@
"version": "1.5.10",
"resolved": "https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.5.10.tgz",
"integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==",
"dev": true,
"requires": {
"debug": "=3.1.0"
}
......@@ -7613,11 +7563,6 @@
"has-tostringtag": "^1.0.0"
}
},
"is-buffer": {
"version": "2.0.5",
"resolved": "https://registry.npmmirror.com/is-buffer/-/is-buffer-2.0.5.tgz",
"integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ=="
},
"is-callable": {
"version": "1.2.7",
"resolved": "https://registry.npmmirror.com/is-callable/-/is-callable-1.2.7.tgz",
......@@ -8494,14 +8439,12 @@
"mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmmirror.com/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
"dev": true
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="
},
"mime-types": {
"version": "2.1.35",
"resolved": "https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"dev": true,
"requires": {
"mime-db": "1.52.0"
}
......@@ -8678,7 +8621,8 @@
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmmirror.com/ms/-/ms-2.0.0.tgz",
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
"dev": true
},
"multicast-dns": {
"version": "6.2.3",
......@@ -10815,6 +10759,11 @@
"ipaddr.js": "1.9.1"
}
},
"proxy-from-env": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
},
"prr": {
"version": "1.0.1",
"resolved": "https://registry.npmmirror.com/prr/-/prr-1.0.1.tgz",
......@@ -13685,6 +13634,75 @@
}
}
},
"vue-loader-v16": {
"version": "npm:vue-loader@16.8.3",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.8.3.tgz",
"integrity": "sha512-7vKN45IxsKxe5GcVCbc2qFU5aWzyiLrYJyUuMz4BQLKctCj/fmCa0w6fGiiQ2cLFetNcek1ppGJQDCup0c1hpA==",
"dev": true,
"optional": true,
"requires": {
"chalk": "^4.1.0",
"hash-sum": "^2.0.0",
"loader-utils": "^2.0.0"
},
"dependencies": {
"ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"optional": true,
"requires": {
"color-convert": "^2.0.1"
}
},
"chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dev": true,
"optional": true,
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
}
},
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"optional": true,
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true,
"optional": true
},
"has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true,
"optional": true
},
"supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
"optional": true,
"requires": {
"has-flag": "^4.0.0"
}
}
}
},
"vue-router": {
"version": "3.6.5",
"resolved": "https://registry.npmmirror.com/vue-router/-/vue-router-3.6.5.tgz",
......
......@@ -9,7 +9,7 @@
"lint": "vue-cli-service lint"
},
"dependencies": {
"axios": "^0.18.0",
"axios": "^1.4.0",
"core-js": "^3.4.4",
"dayjs": "^1.10.7",
"el-tree-transfer": "^2.2.6",
......
<template>
<div class="container content " v-loading="loading">
<el-form ref="materialAddForm" :model="materialAddForm" :label-width="defaultLabelWidth"
:rules="materialAddFormRules">
<el-form ref="materialAddForm" :model="materialAddForm" :label-width="defaultLabelWidth" :rules="materialAddFormRules">
<div class="creat-material">
<h4>{{ title }}</h4>
<el-divider></el-divider>
<div class="m-l-20">
<el-form-item label="选择门店:" prop="targetMerchantId">
<el-select remote :remote-method="remoteMethod" v-el-select-loadmore="loadmore"
v-model="materialAddForm.targetMerchantId" :disabled="notDisplayProperties" ref="selectLabel"
clearable filterable :size="size"
placeholder="请选择门店" @change="selectChange" @clear="clearDrop">
<el-option v-for="(item, i) in dataItems" :key="i" :label="item.merchantName"
:value="item.merchantNo + ''"></el-option>
</el-select>
</el-form-item>
<el-form-item v-if="!notDisplayProperties" label="选择素材组:" prop="groupId">
<el-select v-model="materialAddForm.groupId" placeholder="全部" :size="size">
<el-option v-for="item in groupCounter" :key="item.id" :label="item.materialGroupName"
:value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item v-else label="选择素材组:" prop="selectMaterialGroupName">
<el-select v-model="materialAddForm.groupName" placeholder="全部" :size="size" disabled>
<el-option v-for="item in groupCounter" :key="item.id" :label="item.materialGroupName"
:value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="素材名称:" prop="materialName">
<el-input :disabled="notDisplayProperties" v-model="materialAddForm.materialName" :size="size"
placeholder="请输入素材名称"
maxlength="30"></el-input>
</el-form-item>
<el-form-item label="素材类型:" prop="materialType" class="materialType">
<el-radio-group v-model="materialAddForm.materialType" @change="radioChange"
:disabled="routeInfo.addOrEdit != 1">
<el-radio :label="1">PDF文件</el-radio>
<!-- <el-radio :label="2">自定义链接</el-radio> -->
<el-radio :label="3">图文</el-radio>
</el-radio-group>
<!-- 选择PDF -->
<div v-show="materialAddForm.materialType == 1">
<div class="pdf-show">
<input type="file" style="opacity: 0" accept=".pdf"
:disabled="notDisplayProperties" @change="e => handlePdfChange(e)"/>
<el-button icon="el-icon-plus" :size="size"
:disabled="notDisplayProperties">选择文件
</el-button>
<div class="material-form">
<div class="m-l-20">
<el-form-item label="选择门店:" prop="targetMerchantId">
<el-select remote :remote-method="remoteMethod" v-el-select-loadmore="loadmore" v-model="materialAddForm.targetMerchantId" :disabled="notDisplayProperties" ref="selectLabel" clearable filterable :size="size" placeholder="请选择门店" @change="selectChange" @clear="clearDrop">
<el-option v-for="(item, i) in dataItems" :key="i" :label="item.merchantName" :value="item.merchantNo + ''"></el-option>
</el-select>
</el-form-item>
<el-form-item v-if="!notDisplayProperties" label="选择素材组:" prop="groupId">
<el-select v-model="materialAddForm.groupId" placeholder="全部" :size="size">
<el-option v-for="item in groupCounter" :key="item.id" :label="item.materialGroupName" :value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item v-else label="选择素材组:" prop="selectMaterialGroupName">
<el-select v-model="materialAddForm.groupName" placeholder="全部" :size="size" disabled>
<el-option v-for="item in groupCounter" :key="item.id" :label="item.materialGroupName" :value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="素材名称:" prop="materialName">
<el-input :disabled="notDisplayProperties" v-model="materialAddForm.materialName" :size="size" placeholder="请输入素材名称" maxlength="30"></el-input>
</el-form-item>
<el-form-item label="素材类型:" prop="materialType" class="materialType">
<el-radio-group v-model="materialAddForm.materialType" @change="radioChange" :disabled="routeInfo.addOrEdit != 1">
<el-radio :label="1">PDF文件</el-radio>
<!-- <el-radio :label="2">自定义链接</el-radio> -->
<el-radio :label="3">图文</el-radio>
</el-radio-group>
<!-- 选择PDF -->
<div v-show="materialAddForm.materialType == 1">
<div class="pdf-show">
<input type="file" style="opacity: 0" accept=".pdf" :disabled="notDisplayProperties" @change="e => handlePdfChange(e)" />
<el-button icon="el-icon-plus" :size="size" :disabled="notDisplayProperties">选择文件</el-button>
</div>
<ul v-if="pdfName || materialAddForm.materialUrl">
<li class="pdf-show">
<span class="pdf-name" @click="openPdfDia">{{ pdfName || materialAddForm.materialUrl }}</span>
<i v-if="routeInfo.addOrEdit == 1" class="el-icon-close" @click="delPdf"></i>
</li>
</ul>
</div>
<ul v-if="pdfName || materialAddForm.materialUrl">
<li class="pdf-show">
<span class="pdf-name" @click="openPdfDia">{{ pdfName || materialAddForm.materialUrl }}</span>
<i v-if="routeInfo.addOrEdit == 1" class="el-icon-close" @click="delPdf"></i>
</li>
</ul>
</div>
<!-- 选择图文 -->
<div v-show="materialAddForm.materialType == 3">
<textBox @change="writeChange" ref="textBox" @forbid="forbidEdit"></textBox>
<el-form-item label="图片:" class="photoWrap">
<div class="img-div">
<div class="put-img" v-for="(item,index) in materialAddForm.imageUrlList" :key="item"
v-show="materialAddForm.imageUrlList[index]">
<img :src="item" alt=""/>
<div class="mask" v-if="item">
<h3>
<el-popover placement="top" trigger="click">
<div>
<img class="img-plus" :src="item" alt=""/>
</div>
<img slot="reference" src="@/assets/material/view.png" alt=""/>
</el-popover>
<img v-if="!notDisplayProperties" class="del-img" src="@/assets/material/dele.png" alt=""
@click="deleteImg('imageUrlList',item)"/>
</h3>
<!-- 选择图文 -->
<div v-show="materialAddForm.materialType == 3">
<textBox @change="writeChange" ref="textBox" @forbid="forbidEdit"></textBox>
<el-form-item label="图片:" class="photoWrap">
<div class="img-div">
<div class="put-img" v-for="(item, index) in materialAddForm.imageUrlList" :key="item" v-show="materialAddForm.imageUrlList[index]">
<img :src="item" alt="" />
<div class="mask" v-if="item">
<h3>
<el-popover placement="top" trigger="click">
<div>
<img class="img-plus" :src="item" alt="" />
</div>
<img slot="reference" src="@/assets/material/view.png" alt="" />
</el-popover>
<img v-if="!notDisplayProperties" class="del-img" src="@/assets/material/dele.png" alt="" @click="deleteImg('imageUrlList', item)" />
</h3>
</div>
</div>
</div>
<div class="avatar-uploader-desc">
<i class="el-icon-plus avatar-uploader-desc-icon"></i>
<div class="avatar-uploader-desc-word">上传照片</div>
<input :class="{disableUpload:notDisplayProperties}" :disabled="notDisplayProperties" type="file"
style="opacity: 0" accept=".jpg, .jpeg, .png"
@change="e => handleImgChange(e,'imageUrlList')"/>
</div>
<!-- <div @click="phoneVisible = !phoneVisible" class="view-phone">查看效果></div> -->
</div>
</el-form-item>
<el-form-item label="视频:" class="photoWrap">
<div class="img-div">
<div class="put-img" v-if="materialAddForm.videoUrl">
<video :src="materialAddForm.videoUrl" id="video" width="100%" height="100%" preload loop muted>
<!-- <source type="video/mp4"/>-->
</video>
<div class="mask">
<h3>
<img slot="reference" src="@/assets/material/view.png" alt="" @click="viewVideo"/>
<img v-if="!notDisplayProperties" class="del-img"
src="@/assets/material/dele.png" alt="" @click="deleteImg('videoUrl')"/>
</h3>
<div class="avatar-uploader-desc">
<i class="el-icon-plus avatar-uploader-desc-icon"></i>
<div class="avatar-uploader-desc-word">上传照片</div>
<input :class="{ disableUpload: notDisplayProperties }" :disabled="notDisplayProperties" type="file" style="opacity: 0" accept=".jpg, .jpeg, .png" @change="e => handleImgChange(e, 'imageUrlList')" />
</div>
<!-- <div @click="phoneVisible = !phoneVisible" class="view-phone">查看效果></div> -->
</div>
<div class="avatar-uploader-desc">
<i class="el-icon-plus avatar-uploader-desc-icon"></i>
<div class="avatar-uploader-desc-word">上传视频</div>
<input :class="{disableUpload:notDisplayProperties}"
:disabled="notDisplayProperties" type="file" style="opacity: 0"
accept="video/*"
@change="e =>handleVideoChange(e,'videoUrl')"/>
</el-form-item>
<el-form-item label="视频:" class="photoWrap">
<div class="img-div">
<div class="put-img" v-if="materialAddForm.videoUrl">
<video :src="materialAddForm.videoUrl" id="video" width="100%" height="100%" preload loop muted>
<!-- <source type="video/mp4"/>-->
</video>
<div class="mask">
<h3>
<img slot="reference" src="@/assets/material/view.png" alt="" @click="viewVideo" />
<img v-if="!notDisplayProperties" class="del-img" src="@/assets/material/dele.png" alt="" @click="deleteImg(['videoUrl', 'coverUrl'])" />
</h3>
</div>
</div>
<div class="avatar-uploader-desc">
<i class="el-icon-plus avatar-uploader-desc-icon"></i>
<div class="avatar-uploader-desc-word">上传视频</div>
<input :class="{ disableUpload: notDisplayProperties }" :disabled="notDisplayProperties" type="file" style="opacity: 0" accept="video/*" @change="e => handleVideoChange(e, 'videoUrl')" />
</div>
<!-- <div @click="phoneVisible = !phoneVisible" class="view-phone">查看效果></div> -->
</div>
<!-- <div @click="phoneVisible = !phoneVisible" class="view-phone">查看效果></div> -->
</div>
</el-form-item>
</div>
<div class="space"></div>
</el-form-item>
</el-form-item>
</div>
<div class="space"></div>
</el-form-item>
</div>
<!-- <div class="material-view"> -->
<material-view v-if="materialAddForm.materialType == 3" :materialAddForm="materialAddForm" :textBoxContent="textBoxContent"></material-view>
<!-- </div> -->
</div>
</div>
<div class="track">
......@@ -124,16 +108,14 @@
<span slot="label">
<span class="label-word">
业务类型
<el-popover placement="top-start" width="200" trigger="hover"
content="给素材添加业务类型,客户可根据业务类型筛选,也可在客户浏览了该素材时能及时提醒跟进员工,以提高客户成单率。">
<img slot="reference" src="@/assets/question.png" alt=""/>
<el-popover placement="top-start" width="200" trigger="hover" content="给素材添加业务类型,客户可根据业务类型筛选,也可在客户浏览了该素材时能及时提醒跟进员工,以提高客户成单率。">
<img slot="reference" src="@/assets/question.png" alt="" />
</el-popover>
:
</span>
</span>
<el-checkbox-group v-model="materialAddForm.businessType">
<el-checkbox :disabled="notDisplayProperties" v-for="value in businessTypes" :key="value.businessName"
:label="value.id">
<el-checkbox :disabled="notDisplayProperties" v-for="value in businessTypes" :key="value.businessName" :label="value.id">
{{ value.businessName }}
</el-checkbox>
</el-checkbox-group>
......@@ -161,38 +143,31 @@
<div class="share-desc" v-show="descVisible">
<div class="share-desc-left m-l-20">
<el-form-item label="分享标题:">
<el-input :disabled="notDisplayProperties" v-model="materialAddForm.materialTitle" :size="size"
maxlength="30" show-word-limit
placeholder="请输入自定义标题"></el-input>
<el-input :disabled="notDisplayProperties" v-model="materialAddForm.materialTitle" :size="size" maxlength="30" show-word-limit placeholder="请输入自定义标题"></el-input>
</el-form-item>
<el-form-item label="描述:">
<el-input :disabled="notDisplayProperties" type="textarea" v-model="materialAddForm.description"
:size="size" maxlength="30"
show-word-limit placeholder="请输入自定义描述"></el-input>
<el-input :disabled="notDisplayProperties" type="textarea" v-model="materialAddForm.description" :size="size" maxlength="30" show-word-limit placeholder="请输入自定义描述"></el-input>
</el-form-item>
<el-form-item label="封面:">
<div class="img-div">
<div class="put-img" v-show="materialAddForm.titleUrl">
<img :src="materialAddForm.titleUrl" alt=""/>
<img :src="materialAddForm.titleUrl" alt="" />
<div class="mask" v-if="materialAddForm.titleUrl">
<h3>
<el-popover placement="top" trigger="click">
<div>
<img class="img-plus" :src="materialAddForm.titleUrl" alt=""/>
<img class="img-plus" :src="materialAddForm.titleUrl" alt="" />
</div>
<img slot="reference" src="@/assets/material/view.png" alt=""/>
<img slot="reference" src="@/assets/material/view.png" alt="" />
</el-popover>
<img v-if="!notDisplayProperties" class="del-img" src="@/assets/material/dele.png" alt=""
@click="deleteImg('titleUrl')"/>
<img v-if="!notDisplayProperties" class="del-img" src="@/assets/material/dele.png" alt="" @click="deleteImg('titleUrl')" />
</h3>
</div>
</div>
<div class="avatar-uploader-desc">
<i class="el-icon-plus avatar-uploader-desc-icon"></i>
<div class="avatar-uploader-desc-word">上传照片</div>
<input :class="{disableUpload:notDisplayProperties}" :disabled="notDisplayProperties" type="file"
style="opacity: 0" accept=".jpg, .jpeg, .png"
@change="e => handleImgChange(e,'titleUrl')"/>
<input :class="{ disableUpload: notDisplayProperties }" :disabled="notDisplayProperties" type="file" style="opacity: 0" accept=".jpg, .jpeg, .png" @change="e => handleImgChange(e, 'titleUrl')" />
</div>
<!-- <div @click="phoneVisible = !phoneVisible" class="view-phone">查看效果></div> -->
</div>
......@@ -200,14 +175,14 @@
</div>
<div class="share-desc-right">
<div class="share-desc-right-box">
<img class="share-desc-right-box-phone" src="@/assets/material/phone.png" alt=""/>
<img class="share-desc-right-box-phone" src="@/assets/material/phone.png" alt="" />
<div class="content-show">
<div>
<div class="content-title">{{ materialAddForm.materialTitle }}</div>
<div class="content-word">{{ materialAddForm.description }}</div>
</div>
<div class="content-show-img" v-show="materialAddForm.titleUrl">
<img :src="materialAddForm.titleUrl" alt=""/>
<img :src="materialAddForm.titleUrl" alt="" />
</div>
</div>
</div>
......@@ -229,6 +204,7 @@
</template>
<script>
import textBox from '@/views/material/components/textBox'
import materialView from './components/MaterialView'
import SelectLabel from '@/views/material/components/selectLable'
import bigView from '@/components/big-view'
import upload from '@/api/uploadApi'
......@@ -240,11 +216,13 @@ export default {
components: {
textBox,
SelectLabel,
materialView,
bigView
// pdfReviewDia
},
data() {
return {
limitSize: 50,
title: '创建营销素材',
titleObj: {
1: '创建营销素材',
......@@ -270,7 +248,7 @@ export default {
channelType: 1,
merchantAccountLevel: [4]
},
searchContentStorage:'',
searchContentStorage: '',
materialAddForm: {
groupId: '', // 素材组id
groupName: '',
......@@ -294,19 +272,19 @@ export default {
// phoneVisible: false,
businessTypes: [],
materialAddFormRules: {
targetMerchantId: [{required: true, message: '请选择门店', trigger: 'change'}],
groupId: [{required: true, message: '请选择素材组', trigger: 'change'}],
targetMerchantId: [{ required: true, message: '请选择门店', trigger: 'change' }],
groupId: [{ required: true, message: '请选择素材组', trigger: 'change' }],
materialName: [
{required: true, message: '请输入素材名称', trigger: 'change'},
{max: 30, message: '素材名称长度不能超过30', trigger: 'blur'}
{ required: true, message: '请输入素材名称', trigger: 'change' },
{ max: 30, message: '素材名称长度不能超过30', trigger: 'blur' }
],
materialType: [{required: true, message: '请选择素材类型', trigger: 'change'}],
businessType: [{required: true, message: '请选择业务类型', trigger: 'change'}]
materialType: [{ required: true, message: '请选择素材类型', trigger: 'change' }],
businessType: [{ required: true, message: '请选择业务类型', trigger: 'change' }]
},
linkRules: {
link: [
{required: true, message: '请输入链接地址', trigger: 'change'},
{max: 150, message: '链接地址长度不能超过30', trigger: 'blur'}
{ required: true, message: '请输入链接地址', trigger: 'change' },
{ max: 150, message: '链接地址长度不能超过30', trigger: 'blur' }
]
}
}
......@@ -326,7 +304,7 @@ export default {
'el-select-loadmore': {
bind(el, binding) {
const SELECTWRAP_DOM = el.querySelector('.el-select-dropdown .el-select-dropdown__wrap')
SELECTWRAP_DOM.addEventListener('scroll', function () {
SELECTWRAP_DOM.addEventListener('scroll', function() {
const condition = this.scrollHeight - this.scrollTop <= this.clientHeight
if (condition) {
binding.value()
......@@ -343,7 +321,7 @@ export default {
})
},
selectChange(val) {
let params = {merchant: val}
let params = { merchant: val }
this.materialAddForm.groupId = ''
this.getMaterialList(params)
},
......@@ -390,42 +368,74 @@ export default {
channelType: 1,
merchantAccountLevel: [4]
}),
(this.dataItems = [])
(this.dataItems = [])
this.timer = setTimeout(() => {
this.loadUpData(this.pageData, searchValue)
}, 300)
} else {
this.dataItems = []
this.loadUpData(
this.pageData,
''
)
this.loadUpData(this.pageData, '')
}
},
viewVideo() {
this.dialogVisibleImg = true
this.dialogSrc = this.materialAddForm.videoUrl
},
// handleVideoChange(e) {
// let file = e.srcElement.files[0]
// let reader = new FileReader()
// // // 默认1MB
// const limitSize = 20
// const isLt = file.size / 1024 / 1024 < limitSize
// if (!isLt) {
// this.$message.error('上传视频大小不能超过' + limitSize + 'MB!')
// return true
// }
// reader.readAsDataURL(file)
// reader.onload = e => {
// const imgFile = e.target.result
// const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
// this.$apis.common.uploadVideoApi({file: base64}).then(res => {
// if (res) {
// this.materialAddForm.videoUrl = res
// }
// })
// }
// },
handleVideoChange(e) {
let file = e.srcElement.files[0]
let reader = new FileReader()
// // 默认1MB
const limitSize = 20
const isLt = file.size / 1024 / 1024 < limitSize
const self = this
let file = e.target.files[0]
const isLt = file.size / 1024 / 1024 < this.limitSize
if (!isLt) {
this.$message.error('上传视频大小不能超过' + limitSize + 'MB!')
this.$message.error('上传视频大小不能超过' + this.limitSize + 'MB!')
return true
}
reader.readAsDataURL(file)
reader.onload = e => {
const imgFile = e.target.result
const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
this.$apis.common.uploadVideoApi({file: base64}).then(res => {
if (res) {
this.materialAddForm.videoUrl = res
}
})
}
self.loading = true
upload.init().then(res => {
if (res.status == 0) {
upload
.uploaded(file)
.then(res => {
const videoUrl = res.video.url
self.$set(self.materialAddForm, 'videoUrl', videoUrl)
self.$nextTick(() => {
self.getImgUrl(videoUrl).then(res => {
self.$set(self.materialAddForm, 'coverUrl', res)
})
})
self.loading = false
})
.finally(end => {
console.log(end)
})
upload.uploadEvent('', res => {
console.log(res, '视频上传完成')
})
upload.uploadEvent('media_progress', res => {
console.log(res)
})
}
})
},
getParams() {
let params = JSON.parse(JSON.stringify(this.materialAddForm))
......@@ -470,7 +480,7 @@ export default {
if (!imgHtml && !videoHtml) params.materialType = 5
if (imgHtml && imgHtml.length && !videoHtml && !html.length) params.materialType = 6
if (this.materialAddForm.vedioUrl && !this.materialAddForm.imageUrlList.length) params.materialType = 4
if (this.materialAddForm.imageUrlList && this.materialAddForm.imageUrlList.length ) params.materialType = 3
if (this.materialAddForm.imageUrlList && this.materialAddForm.imageUrlList.length) params.materialType = 3
this.textBoxContent = encodeURIComponent(this.textBoxContent)
params.materialUrl = this.textBoxContent
}
......@@ -487,7 +497,7 @@ export default {
await this.$apis.material.materialDetail(params).then(res => {
this.materialAddForm = res
this.materialAddForm.targetMerchantId = res.merchantId + '' || ''
this.getMaterialList({merchant: res.merchantId})
this.getMaterialList({ merchant: res.merchantId })
if (res.businessType) {
const businessTypeArr = this.materialAddForm.businessType.split(',')
this.materialAddForm.businessType = businessTypeArr.map(item => parseInt(item))
......@@ -571,7 +581,7 @@ export default {
reader.onload = e => {
const imgFile = e.target.result
const base64 = file.name.slice(-3) + '@' + imgFile.split(',')[1]
this.$apis.common.pictureUpload({file: base64}).then(res => {
this.$apis.common.pictureUpload({ file: base64 }).then(res => {
if (res) {
this.pdfUrl = res
this.pdfName = file.name
......@@ -599,7 +609,7 @@ export default {
reader.onload = e => {
const imgFile = e.target.result
const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
this.$apis.common.pictureUpload({file: base64}).then(res => {
this.$apis.common.pictureUpload({ file: base64 }).then(res => {
if (res) {
if (Array.isArray(this.materialAddForm[params]) || this.materialAddForm[params] == null) {
if (this.materialAddForm[params] && this.materialAddForm[params].length > 8) {
......@@ -632,7 +642,7 @@ export default {
reader.onload = e => {
const imgFile = e.target.result
const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
this.$apis.common.pictureUpload({file: base64}).then(res => {
this.$apis.common.pictureUpload({ file: base64 }).then(res => {
if (res) {
if (Array.isArray(this.materialAddForm[params]) || this.materialAddForm[params] == null) {
if (this.materialAddForm[params] && this.materialAddForm[params].length > 8) {
......@@ -761,8 +771,13 @@ export default {
},
// 删除上传图片
deleteImg(params, content) {
if (Array.isArray(params)) {
params.forEach(val => {
this.materialAddForm[val] = ''
})
}
if (Array.isArray(this.materialAddForm[params])) {
this.materialAddForm[params] = this.materialAddForm[params].filter((item) => item !== content);
this.materialAddForm[params] = this.materialAddForm[params].filter(item => item !== content)
} else {
this.materialAddForm[params] = ''
}
......@@ -780,8 +795,8 @@ export default {
}
</script>
<style lang="scss" scoped>
.materialType{
/deep/.el-form-item__content{
.materialType {
/deep/.el-form-item__content {
max-width: 85%;
}
}
......@@ -832,7 +847,10 @@ export default {
padding-left: 0;
width: 100px;
}
.material-form {
display: flex;
justify-content: space-between;
}
.creat-material,
.track,
.share,
......
<template>
<div class="material-view">
<div class="material-view-container">
<el-carousel :height="height + 'px'" interval="100000" @change="handleChange" v-if="fileList.length">
<el-carousel-item v-for="item in fileList" :key="item">
<div class="carousel-item">
<img :src="item.url" class="carousel-img" />
<img src="@/assets/material/videoIcon.png" class="play" v-if="item.type == 'video'" />
</div>
</el-carousel-item>
</el-carousel>
<div class="material-text" v-html="textBoxContent"></div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
height: 200,
fileList: []
}
},
watch: {
materialAddForm: {
async handler(val) {
const fileList = val.imageUrlList.map(item => {
return {
type: 'img',
url: item
}
})
this.fileList = val.videoUrl ? fileList.concat({ url: val.coverUrl, type: 'video' }) : fileList
if (this.fileList.length) {
for (let i in this.fileList) {
this.$set(this.fileList[i], 'height', await this.getHeight(this.fileList[i].url))
}
this.height = this.fileList[0].height
}
},
deep: true,
immediate: true
}
},
props: {
materialAddForm: {
type: Object,
default: () => {}
},
textBoxContent: {
type: String
}
},
methods: {
getHeight(url) {
return new Promise(resolve => {
const img = new Image()
img.src = url
img.onload = res => {
console.log(img.width, img.height)
resolve((img.width / img.height) * 250)
}
})
},
handleChange(e) {
this.height = this.fileList[e].height
}
}
}
</script>
<style lang="scss" scoped>
.material-view {
width: 289.47px;
height: 566px;
background: url('../../../assets/phone.png');
background-size: 100% 100%;
position: relative;
overflow: hidden;
.material-view-container {
position: absolute;
top: 56px;
left: 20px;
width: calc(100% - 40px);
height: calc(100% - 112px);
overflow-y: auto;
/deep/ .el-carousel__button {
width: 8px;
}
.carousel-item {
position: relative;
height: 100%;
width: 100%;
.carousel-img {
width: 100%;
height: 100%;
}
.play {
position: absolute;
width: 30px;
height: 30px;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
}
.material-text {
word-wrap: break-word;
img {
width: 100% !important;
}
}
}
}
</style>
<style>
.material-text img {
width: 100% !important;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!