quanwei
18 hours ago c441dea81bd86bdfb12dff35821fed51f4cc91c2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<template>
<!--
        作者:luoyiming
        时间:2020-06-20
        描述:diy组件-参数设置-单图组
    -->
    <div>
        <div class="common-form">
            <span>{{ curItem.name }}</span>
        </div>
        <el-form size="small" :model="curItem" label-width="100px">
            <!--上下边距-->
            <el-form-item label="上下边距:">
                <el-slider v-model="curItem.style.paddingTop" show-input></el-slider>
            </el-form-item>
            <!--左右边距-->
            <el-form-item label="左右边距:">
                <el-slider v-model="curItem.style.paddingLeft" :min="0" :max="50" show-input></el-slider>
            </el-form-item>
            <!--背景颜色-->
            <el-form-item label="背景颜色:">
                <div class="d-s-c">
                    <el-color-picker v-model="curItem.style.background"></el-color-picker>
                    <el-button type="button" style="margin-left: 10px;"
                               @click.stop="$parent.onEditorResetColor(curItem.style, 'background', '#ffffff')">重置
                    </el-button>
                </div>
            </el-form-item>
            <el-form-item label="图片:">
                <div class="param-img-item" :key="index" v-for="(imageSingle, index) in curItem.data">
                    <div class="delete-box"><i class="el-icon-delete-solid"
                                               @click="$parent.onEditorDeleleData(index, selectedIndex)"></i></div>
                    <div class="pic"><img v-img-url="imageSingle.imgUrl" alt=""
                                          @click="$parent.onEditorSelectImage(imageSingle, 'imgUrl')"/></div>
                    <div class="d-s-c">
                      <div class="url-box flex-1">
                          <span class="key-name">链接地址:</span>
                          <el-input v-model="imageSingle.name"></el-input>
                      </div>
                      <div class="url-box ml10">
                          <el-button type="primary" @click="changeLink(index)">选择链接</el-button>
                      </div>
                    </div>
                </div>
                <div class="d-c-c">
                    <el-button @click="$parent.onEditorAddData">添加一个</el-button>
                </div>
            </el-form-item>
        </el-form>
        <Setlink v-if="is_linkset" :is_linkset="is_linkset" @closeDialog="closeLinkset">选择链接</Setlink>
    </div>
</template>
 
<script>
    import Setlink from '@/components/setlink/Setlink';
    export default {
        components: {
            Setlink,
        },
        data() {
            return {
                /*是否选择链接*/
                is_linkset: false,
                index: null,
            };
        },
        props: ['curItem', 'selectedIndex'],
        created() {
          this.curItem.style.paddingTop = parseInt(this.curItem.style.paddingTop);
          this.curItem.style.paddingLeft = parseInt(this.curItem.style.paddingLeft);
        },
        methods: {
            /*选择链接*/
            changeLink(index) {
                this.is_linkset = true;
                this.index = index;
            },
            /*获取链接并关闭弹窗*/
            closeLinkset(e) {
                this.is_linkset = false;
                this.curItem.data[this.index].type=e.type;
                this.curItem.data[this.index].inputname=e.name;
                this.curItem.data[this.index].linkUrl=e.url;
//                this.curItem.data[this.index].name = e.name;
                this.curItem.data[this.index].name = '链接到' + ' ' + e.type + ' ' + e.name;
            },
        }
    };
</script>
 
<style>
 
</style>