|
@@ -299,7 +299,7 @@
|
|
|
line-height:34px;">上传按钮样式</span>
|
|
|
|
|
|
<img src="../../assets/images/close-icon.png"
|
|
|
- style="width: 16px; height: 16px; margin-right: 10px; cursor: pointer;" @click="dialogVisible=false"></img>
|
|
|
+ style="width: 16px; height: 16px; margin-right: 10px; cursor: pointer;" @click="closeUploadButton"></img>
|
|
|
|
|
|
</div>
|
|
|
<div style="display: flex;flex-direction: row; justify-content: center;margin-top:42px;margin-bottom:40px;">
|
|
@@ -310,7 +310,10 @@
|
|
|
font-family:MicrosoftYaHei;display:block;
|
|
|
color:rgba(51,51,51,1); margin-bottom:14px;
|
|
|
line-height:19px;">默认状态</span>
|
|
|
- <label class="lable">
|
|
|
+ <div v-if="unSelectedButtom" :style="{ backgroundImage: 'url(' + buttonData.backgroundUnselectedImg + ')','width':'130px', 'height':'130px','background-repeat': 'no-repeat',
|
|
|
+ 'background-position': 'center',
|
|
|
+ 'background-size': 'contain'}"></div>
|
|
|
+ <label class="lable" v-else>
|
|
|
<div style="width:100%;
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
@@ -327,7 +330,7 @@
|
|
|
color:rgba(51,51,51,1);
|
|
|
line-height:17px;">上传素材</span>
|
|
|
</div>
|
|
|
- <input style="display: none;" type="file">
|
|
|
+ <input style="display: none;" type="file" @change="upload($event, false)">
|
|
|
</label>
|
|
|
</div>
|
|
|
|
|
@@ -338,7 +341,10 @@
|
|
|
font-family:MicrosoftYaHei;display:block;
|
|
|
color:rgba(51,51,51,1);margin-bottom:14px;
|
|
|
line-height:19px;">选中状态</span>
|
|
|
- <label class="lable">
|
|
|
+ <div v-if="selectedButtom" :style="{ backgroundImage: 'url(' + buttonData.backgroundSelectedImg + ')','width':'130px', 'height':'130px','background-repeat': 'no-repeat',
|
|
|
+ 'background-position': 'center',
|
|
|
+ 'background-size': 'contain'}"></div>
|
|
|
+ <label class="lable" v-else>
|
|
|
<div style="width:100%;
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
@@ -346,6 +352,7 @@
|
|
|
align-items: center;
|
|
|
height:100%;
|
|
|
border:1px dashed rgba(100,107,129,1);">
|
|
|
+
|
|
|
<img style="width:16px;
|
|
|
height:16px;" src="../../assets/images/add-ele.png" />
|
|
|
<span style="font-size:12px;
|
|
@@ -355,8 +362,9 @@
|
|
|
color:rgba(51,51,51,1);
|
|
|
line-height:17px;">上传素材</span>
|
|
|
</div>
|
|
|
- <input style="display: none;" type="file">
|
|
|
+ <input style="display: none;" type="file" @change="upload($event, true)">
|
|
|
</label>
|
|
|
+
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
@@ -367,7 +375,7 @@
|
|
|
font-family:PingFangSC;
|
|
|
font-weight:500; text-align: center;
|
|
|
color:rgba(255,255,255,1);
|
|
|
- line-height:34px;cursor: pointer;">确定</div>
|
|
|
+ line-height:34px;cursor: pointer;" @click="uploadButton">确定</div>
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
@@ -392,6 +400,7 @@
|
|
|
import elabBackgroundCanvas from "../../util/canvas/elabBackgroundCanvas";
|
|
|
import AudioPanel from "../../components/AudioPanel";
|
|
|
import HeaderMain from "../../components/HeaderMain";
|
|
|
+ import * as http from '../../util/http';
|
|
|
const $ = require("jquery");
|
|
|
|
|
|
export default {
|
|
@@ -442,7 +451,10 @@
|
|
|
animatedNameBackgroundGlobal: "",
|
|
|
animatedBackgroundCustom: false,
|
|
|
globalAnimatedBackgroundTag: false,
|
|
|
- dialogVisible: false
|
|
|
+ dialogVisible: false,
|
|
|
+ buttonData: {},
|
|
|
+ unSelectedButtom: false,
|
|
|
+ selectedButtom:false,
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
@@ -606,7 +618,8 @@
|
|
|
obj.left = 0;
|
|
|
obj.width = ele.width;
|
|
|
obj.height = ele.height;
|
|
|
- obj.imgSrc = ele.filePath;
|
|
|
+ obj.backgroundUnselectedImg = ele.backgroundUnselectedImg;
|
|
|
+ obj.backgroundSelectedImg = ele.backgroundSelectedImg;
|
|
|
obj.loop = ele.loop;
|
|
|
this.$store.dispatch("addElement", obj);
|
|
|
// } else {
|
|
@@ -888,7 +901,71 @@
|
|
|
},
|
|
|
uploadSelectedPicOrUnSelectedPic() {
|
|
|
this.dialogVisible = true
|
|
|
+ },
|
|
|
+ closeUploadButton(){
|
|
|
+ this.buttonData = {};
|
|
|
+ this.dialogVisible = false;
|
|
|
+ this.selectedButtom = false;
|
|
|
+ this.unSelectedButtom = false;
|
|
|
+ },
|
|
|
+ async upload(event, isSelected) {
|
|
|
+ var that = this;
|
|
|
+ let files = event.target.files
|
|
|
+ if (!files.length) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ const loading = this.$loading({
|
|
|
+ lock: true,
|
|
|
+ text: 'Loading',
|
|
|
+ spinner: 'el-icon-loading',
|
|
|
+ background: 'rgba(0, 0, 0, 0.7)'
|
|
|
+ });
|
|
|
+ for (var i = 0; i < files.length; i++) {
|
|
|
+ var file = files[i]
|
|
|
+ if (file) {
|
|
|
+ http.uploadMaterielFile(file, function (res) {
|
|
|
+ loading.close();
|
|
|
+ let img = document.createElement('img')
|
|
|
+
|
|
|
+ img.onload = () => {
|
|
|
+ if (isSelected) {
|
|
|
+ that.buttonData.backgroundSelectedImg = res;
|
|
|
+ that.selectedButtom = true;
|
|
|
+ } else {
|
|
|
+ that.buttonData.backgroundUnselectedImg = res;
|
|
|
+ that.unSelectedButtom = true;
|
|
|
+ }
|
|
|
+ that.buttonData.itemId = that.itemId;
|
|
|
+ that.buttonData.width = img.width;
|
|
|
+ that.buttonData.height = img.height;
|
|
|
+ that.buttonData.isButton = true;
|
|
|
+ }
|
|
|
+ img.src = res
|
|
|
+ }, function (res) {
|
|
|
+ if (res.total.percent == 100 && (files.length == i + 1)) {
|
|
|
+ loading.close();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ uploadButton() {
|
|
|
+ let that = this;
|
|
|
+ that.$store.dispatch('savePic', {
|
|
|
+ 'backgroundUnselectedImg': that.buttonData.backgroundUnselectedImg,
|
|
|
+ 'backgroundSelectedImg': that.buttonData.backgroundSelectedImg,
|
|
|
+ 'themeId': that.buttonData.itemId,
|
|
|
+ 'width': that.buttonData.width,
|
|
|
+ 'height': that.buttonData.height,
|
|
|
+ 'isButton': that.buttonData.isButton,
|
|
|
+ })
|
|
|
+ that.buttonData = {};
|
|
|
+ that.dialogVisible = false;
|
|
|
+ that.selectedButtom = false;
|
|
|
+ that.unSelectedButtom = false;
|
|
|
}
|
|
|
+
|
|
|
},
|
|
|
components: {
|
|
|
Overview,
|