Skip to content

Commit 541694c

Browse files
committed
fix:【商城】店铺装修-标题栏:之前 bgImgUrl 不对的问题(彻底修复)
1 parent 4532560 commit 541694c

File tree

3 files changed

+57
-49
lines changed

3 files changed

+57
-49
lines changed

src/components/DiyEditor/components/mobile/TitleBar/config.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import {ComponentStyle, DiyComponent} from '@/components/DiyEditor/util'
1+
import { ComponentStyle, DiyComponent } from '@/components/DiyEditor/util'
22

33
/** 标题栏属性 */
44
export interface TitleBarProperty {
5+
// 背景图
6+
bgImgUrl: string
57
// 偏移
68
marginLeft: number
7-
// 偏移量
8-
skew: number
99
// 显示位置
1010
textAlign: 'left' | 'center'
1111
// 主标题
@@ -24,6 +24,8 @@ export interface TitleBarProperty {
2424
titleColor: string
2525
// 描述颜色
2626
descriptionColor: string
27+
// 高度
28+
height: number
2729
// 查看更多
2830
more: {
2931
// 是否显示查看更多
@@ -54,7 +56,8 @@ export const component = {
5456
descriptionWeight: 200,
5557
titleColor: 'rgba(50, 50, 51, 10)',
5658
descriptionColor: 'rgba(150, 151, 153, 10)',
57-
skew: 0,
59+
marginLeft: 0,
60+
height: 40,
5861
more: {
5962
//查看更多
6063
show: false,

src/components/DiyEditor/components/mobile/TitleBar/index.vue

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,57 @@
11
<template>
2-
<div
3-
:style="{
4-
background:
5-
property.style.bgType === 'color' ? property.style.bgColor : `url(${property.style.bgImg})`,
6-
backgroundSize: '100% 100%',
7-
backgroundRepeat: 'no-repeat'
8-
}"
9-
class="title-bar"
10-
>
11-
<!-- 内容 -->
12-
<div>
2+
<div class="title-bar" :style="{ height: `${property.height}px` }">
3+
<el-image v-if="property.bgImgUrl" :src="property.bgImgUrl" fit="cover" class="w-full" />
4+
<div class="absolute left-0 top-0 w-full h-full flex flex-col justify-center">
135
<!-- 标题 -->
146
<div
15-
v-if="property.title"
167
:style="{
178
fontSize: `${property.titleSize}px`,
189
fontWeight: property.titleWeight,
1910
color: property.titleColor,
2011
textAlign: property.textAlign,
21-
marginLeft: property.skew + 'px'
12+
marginLeft: `${property.marginLeft}px`,
13+
marginBottom: '4px'
2214
}"
15+
v-if="property.title"
2316
>
2417
{{ property.title }}
2518
</div>
2619
<!-- 副标题 -->
2720
<div
28-
v-if="property.description"
2921
:style="{
3022
fontSize: `${property.descriptionSize}px`,
3123
fontWeight: property.descriptionWeight,
3224
color: property.descriptionColor,
3325
textAlign: property.textAlign,
34-
marginLeft: property.skew + 'px'
26+
marginLeft: `${property.marginLeft}px`
3527
}"
36-
class="m-t-8px"
28+
v-if="property.description"
3729
>
3830
{{ property.description }}
3931
</div>
4032
</div>
4133
<!-- 更多 -->
4234
<div
35+
class="more"
4336
v-show="property.more.show"
4437
:style="{
4538
color: property.descriptionColor
4639
}"
47-
class="more"
4840
>
4941
<span v-if="property.more.type !== 'icon'"> {{ property.more.text }} </span>
50-
<Icon v-if="property.more.type !== 'text'" icon="ep:arrow-right" />
42+
<Icon icon="ep:arrow-right" v-if="property.more.type !== 'text'" />
5143
</div>
5244
</div>
5345
</template>
54-
<script lang="ts" setup>
46+
<script setup lang="ts">
5547
import { TitleBarProperty } from './config'
5648
5749
/** 标题栏 */
5850
defineOptions({ name: 'TitleBar' })
5951
6052
defineProps<{ property: TitleBarProperty }>()
6153
</script>
62-
<style lang="scss" scoped>
54+
<style scoped lang="scss">
6355
.title-bar {
6456
position: relative;
6557
width: 100%;
Lines changed: 38 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
<template>
22
<ComponentContainerProperty v-model="formData.style">
3-
<el-form :model="formData" :rules="rules" label-width="85px">
4-
<el-card class="property-group" header="风格" shadow="never">
3+
<el-form label-width="85px" :model="formData" :rules="rules">
4+
<el-card header="风格" class="property-group" shadow="never">
5+
<el-form-item label="背景图片" prop="bgImgUrl">
6+
<UploadImg v-model="formData.bgImgUrl" width="100%" height="40px">
7+
<template #tip>建议尺寸 750*80</template>
8+
</UploadImg>
9+
</el-form-item>
510
<el-form-item label="标题位置" prop="textAlign">
611
<el-radio-group v-model="formData!.textAlign">
712
<el-tooltip content="居左" placement="top">
@@ -16,76 +21,84 @@
1621
</el-tooltip>
1722
</el-radio-group>
1823
</el-form-item>
19-
<el-form-item label="偏移量" prop="skew">
24+
<el-form-item label="偏移量" prop="marginLeft" label-width="70px">
2025
<el-slider
21-
v-model="formData.skew"
26+
v-model="formData.marginLeft"
2227
:max="100"
2328
:min="0"
24-
:step="1"
29+
show-input
2530
input-size="small"
31+
/>
32+
</el-form-item>
33+
<el-form-item label="高度" prop="height" label-width="70px">
34+
<el-slider
35+
v-model="formData.height"
36+
:max="200"
37+
:min="20"
2638
show-input
39+
input-size="small"
2740
/>
2841
</el-form-item>
2942
</el-card>
30-
<el-card class="property-group" header="主标题" shadow="never">
31-
<el-form-item label="文字" label-width="40px" prop="title">
43+
<el-card header="主标题" class="property-group" shadow="never">
44+
<el-form-item label="文字" prop="title" label-width="40px">
3245
<InputWithColor
3346
v-model="formData.title"
3447
v-model:color="formData.titleColor"
35-
maxlength="20"
3648
show-word-limit
49+
maxlength="20"
3750
/>
3851
</el-form-item>
39-
<el-form-item label="大小" label-width="40px" prop="titleSize">
52+
<el-form-item label="大小" prop="titleSize" label-width="40px">
4053
<el-slider
4154
v-model="formData.titleSize"
4255
:max="60"
4356
:min="10"
44-
input-size="small"
4557
show-input
58+
input-size="small"
4659
/>
4760
</el-form-item>
48-
<el-form-item label="粗细" label-width="40px" prop="titleWeight">
61+
<el-form-item label="粗细" prop="titleWeight" label-width="40px">
4962
<el-slider
5063
v-model="formData.titleWeight"
51-
:max="900"
5264
:min="100"
65+
:max="900"
5366
:step="100"
54-
input-size="small"
5567
show-input
68+
input-size="small"
5669
/>
5770
</el-form-item>
5871
</el-card>
59-
<el-card class="property-group" header="副标题" shadow="never">
60-
<el-form-item label="文字" label-width="40px" prop="description">
72+
<el-card header="副标题" class="property-group" shadow="never">
73+
<el-form-item label="文字" prop="description" label-width="40px">
6174
<InputWithColor
6275
v-model="formData.description"
6376
v-model:color="formData.descriptionColor"
64-
maxlength="50"
6577
show-word-limit
78+
maxlength="50"
6679
/>
6780
</el-form-item>
68-
<el-form-item label="大小" label-width="40px" prop="descriptionSize">
81+
<el-form-item label="大小" prop="descriptionSize" label-width="40px">
6982
<el-slider
7083
v-model="formData.descriptionSize"
7184
:max="60"
7285
:min="10"
73-
input-size="small"
7486
show-input
87+
input-size="small"
7588
/>
7689
</el-form-item>
77-
<el-form-item label="粗细" label-width="40px" prop="descriptionWeight">
90+
<el-form-item label="粗细" prop="descriptionWeight" label-width="40px">
7891
<el-slider
7992
v-model="formData.descriptionWeight"
80-
:max="900"
8193
:min="100"
94+
:max="900"
8295
:step="100"
83-
input-size="small"
8496
show-input
97+
input-size="small"
8598
/>
8699
</el-form-item>
87100
</el-card>
88-
<el-card class="property-group" header="查看更多" shadow="never">
101+
<el-card header="查看更多" class="property-group" shadow="never">
89102
<el-form-item label="是否显示" prop="more.show">
90103
<el-checkbox v-model="formData.more.show" />
91104
</el-form-item>
@@ -98,7 +111,7 @@
98111
<el-radio value="all">文字+图标</el-radio>
99112
</el-radio-group>
100113
</el-form-item>
101-
<el-form-item v-show="formData.more.type !== 'icon'" label="更多文字" prop="more.text">
114+
<el-form-item label="更多文字" prop="more.text" v-show="formData.more.type !== 'icon'">
102115
<el-input v-model="formData.more.text" />
103116
</el-form-item>
104117
<el-form-item label="跳转链接" prop="more.url">
@@ -109,7 +122,7 @@
109122
</el-form>
110123
</ComponentContainerProperty>
111124
</template>
112-
<script lang="ts" setup>
125+
<script setup lang="ts">
113126
import { TitleBarProperty } from './config'
114127
import { useVModel } from '@vueuse/core'
115128
// 导航栏属性面板
@@ -123,4 +136,4 @@ const formData = useVModel(props, 'modelValue', emit)
123136
const rules = {}
124137
</script>
125138

126-
<style lang="scss" scoped></style>
139+
<style scoped lang="scss"></style>

0 commit comments

Comments
 (0)