Commit 1f68bc9c by hank

bug

parent 2518cd19
......@@ -11,6 +11,7 @@
</edit-menu>-->
<div>
<!-- <div>{{schemaData[item.dataKey]}} {{item.dataKey}}</div> -->
<img
v-if="item.type === 'image'"
class="image"
......@@ -36,7 +37,6 @@
<span class="del-btn" @click="deleteItem(index2, schemaData[item.dataKey])">删除</span>
</div>
<div class="list-item-list" v-for="(item3, index3) in item2" :key="index3">
<div v-if="(index3 != 'schemaIndex' && index3 != 'index')">
<input
v-if="item.modelSchema[isSchemaIndex(item2)][index3].type === 'text'"
......@@ -46,8 +46,21 @@
v-model="item2[index3]"
@keyup="valueChange2()"
/>
<div>
<img
v-if="item.modelSchema[isSchemaIndex(item2)][index3].type === 'image'"
:src="item2[index3]"
class="edit-input"
/>
<van-uploader
result-type="dataUrl"
@click.native="uploadListItem(item.dataKey,index2, index3)"
:after-read="uploadAfter"
>
<van-button icon="photo" type="info">上传图片</van-button>
</van-uploader>
</div>
</div>
</div>
</div>
<div class="create-btn-container">
......@@ -83,11 +96,15 @@ export default {
default: () => {}
}
},
created() {},
created() {
console.log(this.schemaData);
},
data() {
return {
activeName: "",
dataKey: ""
dataKey: "",
listIndex: "",
itemKey: ""
};
},
methods: {
......@@ -97,13 +114,20 @@ export default {
},
uploadItem(key) {
// alert(key);
this.itemKey = '',
this.dataKey = key;
},
uploadListItem(key, index, itemKey) {
this.dataKey = key;
this.listIndex = index;
this.itemKey = itemKey;
console.log(key, index, itemKey, "dsadadsa");
},
isSchemaIndex(item) {
return item["schemaIndex"] ? item["schemaIndex"] : 0;
},
toObj(obj) {
console.log(obj)
console.log(obj);
return JSON.parse(JSON.stringify(obj));
},
addItem(item) {
......@@ -115,22 +139,34 @@ export default {
});
this.schemaData[item.dataKey].push(obj);
} else {
alert('选择类型添加,敬请期待!')
alert("选择类型添加,敬请期待!");
}
console.log(item);
},
uploadAfter(file) {
upload(file.file)
.then(res => {
this.schemaData[this.dataKey].value = res.data.data;
this.valueChange2();
// this.schemaData[this.dataKey].value = res.data.data;
if (this.itemKey) {
this.setSchemaListData(res.data.data);
} else {
this.setSchemaData(res.data.data);
}
})
.catch(e => {
console.log(e);
alert(JSON.stringify(e))
this.$toast("上传失败");
});
},
setSchemaData(value) {
this.schemaData[this.dataKey].value = value;
this.valueChange2();
},
setSchemaListData(value) {
this.schemaData[this.dataKey][this.listIndex][this.itemKey] = value;
this.valueChange2();
this.itemKey = ''
},
deleteItem(index, arr) {
arr.splice(index, 1);
this.$emit("setList", this.schemaData);
......
......@@ -64,15 +64,6 @@
<div class="content-right">
<div class="title">编辑栏</div>
<div class="edit-area">
<!-- <div class="btn-container " v-if="!templateData.listData.length">
<span
class="editbtn"
v-for="(item, index) in templateData.listData[currentPage]['itemList']"
:key="index"
@dblclick="goEdit(index, item)"
@click="goEdit(index, item)"
>{{item.name}}</span>
</div>-->
<div v-if="false">
<van-collapse v-model="activeName" accordion>
<van-collapse-item
......
......@@ -14,7 +14,7 @@
</template>
<script>
// import "swiper/dist/css/swiper.css";
import "swiper/dist/css/swiper.css";
import { swiper, swiperSlide } from "vue-awesome-swiper";
export default {
name: 'mySlider',
......
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 sign in to comment