| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462 |
- <template>
- <div class="mobile-page">
- <div
- class="advert"
- :class="{ pageOn: bgStyle === 1 }"
- :style="{
- marginLeft: prConfig + 'px',
- marginRight: prConfig + 'px',
- marginTop: slider + 'px',
- background: bgColor,
- }"
- >
- <div class="advertItem01 acea-row" v-if="style === 0" v-for="(item, index) in picList" :key="index">
- <img :src="item.image" v-if="item.image" />
- <div class="empty-box" v-else>
- <span class="iconfont-diy icontupian"></span>
- </div>
- </div>
- <div class="advertItem02 acea-row" v-if="style === 1">
- <div class="item" v-for="(item, index) in picList" :key="index">
- <img :src="item.image" v-if="item.image" />
- <div class="empty-box" v-else>
- <span class="iconfont-diy icontupian"></span>
- </div>
- </div>
- </div>
- <div class="advertItem02 advertItem03 acea-row" v-if="style === 2">
- <div class="item" v-for="(item, index) in picList" :key="index">
- <img :src="item.image" v-if="item.image" />
- <div class="empty-box" v-else>
- <span class="iconfont-diy icontupian"></span>
- </div>
- </div>
- </div>
- <div class="advertItem04 acea-row" v-if="style === 3">
- <div class="item">
- <img :src="picList[0].image" v-if="picList[0].image" />
- <div class="empty-box" v-else>
- <span class="iconfont-diy icontupian"></span>
- </div>
- </div>
- <div class="item">
- <div class="pic">
- <img :src="picList[1].image" v-if="picList[1].image" />
- <div class="empty-box" v-else>
- <span class="iconfont-diy icontupian"></span>
- </div>
- </div>
- <div class="pic">
- <img :src="picList[2].image" v-if="picList[2].image" />
- <div class="empty-box" v-else>
- <span class="iconfont-diy icontupian"></span>
- </div>
- </div>
- </div>
- </div>
- <div class="advertItem02 advertItem05 acea-row" v-if="style === 4">
- <div class="item" v-for="(item, index) in picList" :key="index">
- <img :src="item.image" v-if="item.image" />
- <div class="empty-box" v-else>
- <span class="iconfont-diy icontupian"></span>
- </div>
- </div>
- </div>
- <div class="advertItem06 acea-row" v-if="style === 5">
- <div class="item" v-for="(item, index) in picList" :key="index">
- <img :src="item.image" v-if="item.image" />
- <div class="empty-box" v-else>
- <span class="iconfont-diy icontupian"></span>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import { mapState } from 'vuex';
- export default {
- name: 'picture_cube',
- cname: '图片魔方',
- configName: 'c_picture_cube',
- icon: 'iconshangpinfenlei1',
- type: 0, // 0 基础组件 1 营销组件 2工具组件
- defaultName: 'pictureCube', // 外面匹配名称
- props: {
- index: {
- type: null,
- },
- num: {
- type: null,
- },
- },
- computed: {
- ...mapState('mobildConfig', ['defaultArray']),
- },
- watch: {
- pageData: {
- handler(nVal, oVal) {
- this.setConfig(nVal);
- },
- deep: true,
- },
- num: {
- handler(nVal, oVal) {
- let data = this.$store.state.mobildConfig.defaultArray[nVal];
- this.setConfig(data);
- },
- deep: true,
- },
- defaultArray: {
- handler(nVal, oVal) {
- let data = this.$store.state.mobildConfig.defaultArray[this.num];
- this.setConfig(data);
- },
- deep: true,
- },
- },
- data() {
- return {
- // 默认初始化数据禁止修改
- defaultConfig: {
- name: 'pictureCube',
- timestamp: this.num,
- tabConfig: {
- title: '选择样式',
- tabVal: 0,
- type: 1,
- tabList: [
- {
- name: '样式一',
- icon: 'iconyangshi1',
- count: 1,
- },
- {
- name: '样式二',
- icon: 'iconyangshi2',
- count: 2,
- },
- {
- name: '样式三',
- icon: 'iconyangshi3',
- count: 3,
- },
- {
- name: '样式四',
- icon: 'iconyangshi9',
- count: 3,
- },
- {
- name: '样式五',
- icon: 'iconyangshi8',
- count: 4,
- },
- {
- name: '样式六',
- icon: 'iconyangshi4',
- count: 4,
- },
- ],
- },
- picStyle: {
- tabVal: 0,
- picList: [],
- },
- menuConfig: {
- title: '',
- maxList: 1,
- isCube: 1,
- list: [
- {
- img: '',
- info: [
- {
- title: '链接',
- tips: '请输入链接',
- value: '',
- max: 100,
- },
- ],
- },
- ],
- },
- bgColor: {
- title: '背景颜色',
- default: [
- {
- item: '#fff',
- },
- ],
- color: [
- {
- item: '#fff',
- },
- ],
- },
- bgStyle: {
- title: '背景样式',
- name: 'bgStyle',
- type: 0,
- list: [
- {
- val: '直角',
- icon: 'iconPic_square',
- },
- {
- val: '圆角',
- icon: 'iconPic_fillet',
- },
- ],
- },
- prConfig: {
- title: '背景边距',
- val: 0,
- min: 0,
- },
- // 页面间距
- mbConfig: {
- title: '页面间距',
- val: 0,
- min: 0,
- },
- },
- pageData: {},
- style: 0,
- picList: [],
- bgColor: [],
- slider: 0,
- bgStyle: 0,
- prConfig: 0,
- };
- },
- mounted() {
- this.$nextTick(() => {
- this.pageData = this.$store.state.mobildConfig.defaultArray[this.num];
- this.setConfig(this.pageData);
- });
- },
- methods: {
- setConfig(data) {
- if (!data) return;
- if (data.tabConfig) {
- this.style = data.tabConfig.tabVal;
- this.bgStyle = data.bgStyle.type;
- this.prConfig = data.prConfig.val;
- this.slider = data.mbConfig.val;
- this.bgColor = data.bgColor.color[0].item;
- if (!data.picStyle.picList.length) {
- this.picList = [
- {
- image: '',
- link: '',
- },
- ];
- } else {
- this.picList = data.picStyle.picList;
- }
- }
- },
- },
- };
- </script>
- <style scoped lang="stylus">
- .pageOn{
- border-radius 12px!important
- .advertItem01{
- img{
- border-radius 10px
- }
- }
- .advertItem02{
- .item{
- &:nth-child(1){
- img{
- border-radius 10px 0 0 10px
- }
- }
- &:nth-child(2){
- img{
- border-radius 0 10px 10px 0
- }
- }
- }
- }
- .advertItem03{
- .item{
- &:nth-child(1){
- img{
- border-radius 10px 0 0 10px
- }
- }
- &:nth-child(2){
- img{
- border-radius 0
- }
- }
- &:nth-child(3){
- img{
- border-radius 0 10px 10px 0
- }
- }
- }
- }
- .advertItem04{
- .item{
- &:nth-child(1){
- img{
- border-radius 10px 0 0 10px
- }
- }
- &:nth-child(2){
- .pic{
- &:nth-child(1){
- img{
- border-radius 0 10px 0 0
- }
- }
- &:nth-child(2){
- img{
- border-radius 0 0 10px 0
- }
- }
- }
- }
- }
- }
- .advertItem05{
- .item{
- &:nth-child(1){
- img{
- border-radius 10px 0 0 10px
- }
- }
- &:nth-child(2){
- img{
- border-radius 0
- }
- }
- &:nth-child(4){
- img{
- border-radius 0 10px 10px 0
- }
- }
- }
- }
- .advertItem06{
- .item{
- &:nth-child(1){
- img{
- border-radius 10px 0 0 0
- }
- }
- &:nth-child(2){
- img{
- border-radius 0 10px 0 0
- }
- }
- &:nth-child(3){
- img{
- border-radius 0 0 0 10px
- }
- }
- &:nth-child(4){
- img{
- border-radius 0 0 10px 0
- }
- }
- }
- }
- }
- .mobile-page{
- .advert{
- .advertItem01{
- width 100%;
- height 100%;
- .empty-box{
- width 100%;
- height 379px;
- border-radius 0;
- .icontupian{
- font-size 50px;
- color #999;
- }
- }
- img{
- width 100%;
- height 100%
- }
- }
- .advertItem02{
- width 100%
- .item{
- width 50%;
- height auto;
- img{
- width 100%;
- height 100%;
- }
- .empty-box{
- width 100%;
- height 189.5px;
- border-radius 0;
- }
- }
- }
- .advertItem03{
- .item{
- width 33.3333%;
- .empty-box{
- width 100%;
- height 126.4px;
- border-radius 0;
- }
- }
- }
- .advertItem04{
- .item{
- width 50%;
- height 189.5px;
- .empty-box{
- width 100%;
- height 100%;
- border-radius 0;
- }
- img{
- width 100%;
- height 100%;
- }
- .pic{
- width 100%;
- height 94.75px;
- }
- }
- }
- .advertItem05{
- .item{
- width 25%;
- .empty-box{
- width 100%;
- height 94.75px;
- border-radius 0;
- }
- }
- }
- .advertItem06{
- .item{
- width 50%;
- height 95px;
- img{
- width 100%;
- height 100%;
- }
- .empty-box{
- width 100%;
- height 100%;
- border-radius 0;
- }
- }
- }
- }
- }
- </style>
|