mirror of
				https://gitee.com/hhyykk/ipms-sjy-ui.git
				synced 2025-11-04 20:28:45 +08:00 
			
		
		
		
	【缺陷修复】商城装修: TitleBar 背景图设置统一为使用组件样式进行设置
This commit is contained in:
		@@ -1,9 +1,7 @@
 | 
				
			|||||||
import { ComponentStyle, DiyComponent } from '@/components/DiyEditor/util'
 | 
					import {ComponentStyle, DiyComponent} from '@/components/DiyEditor/util'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** 标题栏属性 */
 | 
					/** 标题栏属性 */
 | 
				
			||||||
export interface TitleBarProperty {
 | 
					export interface TitleBarProperty {
 | 
				
			||||||
  // 背景图
 | 
					 | 
				
			||||||
  bgImgUrl: string
 | 
					 | 
				
			||||||
  // 偏移
 | 
					  // 偏移
 | 
				
			||||||
  marginLeft: number
 | 
					  marginLeft: number
 | 
				
			||||||
  // 显示位置
 | 
					  // 显示位置
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,21 +1,30 @@
 | 
				
			|||||||
<template>
 | 
					<template>
 | 
				
			||||||
  <div class="title-bar">
 | 
					  <div
 | 
				
			||||||
    <el-image v-if="property.bgImgUrl" :src="property.bgImgUrl" fit="cover" class="w-full" />
 | 
					    :style="{
 | 
				
			||||||
    <div class="absolute left-0 top-0 w-full">
 | 
					      background:
 | 
				
			||||||
 | 
					        property.style.bgType === 'color' ? property.style.bgColor : `url(${property.style.bgImg})`,
 | 
				
			||||||
 | 
					      backgroundSize: '100% 100%',
 | 
				
			||||||
 | 
					      backgroundRepeat: 'no-repeat'
 | 
				
			||||||
 | 
					    }"
 | 
				
			||||||
 | 
					    class="title-bar"
 | 
				
			||||||
 | 
					  >
 | 
				
			||||||
 | 
					    <!-- 内容 -->
 | 
				
			||||||
 | 
					    <div>
 | 
				
			||||||
      <!-- 标题 -->
 | 
					      <!-- 标题 -->
 | 
				
			||||||
      <div
 | 
					      <div
 | 
				
			||||||
 | 
					        v-if="property.title"
 | 
				
			||||||
        :style="{
 | 
					        :style="{
 | 
				
			||||||
          fontSize: `${property.titleSize}px`,
 | 
					          fontSize: `${property.titleSize}px`,
 | 
				
			||||||
          fontWeight: property.titleWeight,
 | 
					          fontWeight: property.titleWeight,
 | 
				
			||||||
          color: property.titleColor,
 | 
					          color: property.titleColor,
 | 
				
			||||||
          textAlign: property.textAlign
 | 
					          textAlign: property.textAlign
 | 
				
			||||||
        }"
 | 
					        }"
 | 
				
			||||||
        v-if="property.title"
 | 
					 | 
				
			||||||
      >
 | 
					      >
 | 
				
			||||||
        {{ property.title }}
 | 
					        {{ property.title }}
 | 
				
			||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
      <!-- 副标题 -->
 | 
					      <!-- 副标题 -->
 | 
				
			||||||
      <div
 | 
					      <div
 | 
				
			||||||
 | 
					        v-if="property.description"
 | 
				
			||||||
        :style="{
 | 
					        :style="{
 | 
				
			||||||
          fontSize: `${property.descriptionSize}px`,
 | 
					          fontSize: `${property.descriptionSize}px`,
 | 
				
			||||||
          fontWeight: property.descriptionWeight,
 | 
					          fontWeight: property.descriptionWeight,
 | 
				
			||||||
@@ -23,25 +32,24 @@
 | 
				
			|||||||
          textAlign: property.textAlign
 | 
					          textAlign: property.textAlign
 | 
				
			||||||
        }"
 | 
					        }"
 | 
				
			||||||
        class="m-t-8px"
 | 
					        class="m-t-8px"
 | 
				
			||||||
        v-if="property.description"
 | 
					 | 
				
			||||||
      >
 | 
					      >
 | 
				
			||||||
        {{ property.description }}
 | 
					        {{ property.description }}
 | 
				
			||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
    <!-- 更多 -->
 | 
					    <!-- 更多 -->
 | 
				
			||||||
    <div
 | 
					    <div
 | 
				
			||||||
      class="more"
 | 
					 | 
				
			||||||
      v-show="property.more.show"
 | 
					      v-show="property.more.show"
 | 
				
			||||||
      :style="{
 | 
					      :style="{
 | 
				
			||||||
        color: property.descriptionColor
 | 
					        color: property.descriptionColor
 | 
				
			||||||
      }"
 | 
					      }"
 | 
				
			||||||
 | 
					      class="more"
 | 
				
			||||||
    >
 | 
					    >
 | 
				
			||||||
      <span v-if="property.more.type !== 'icon'"> {{ property.more.text }} </span>
 | 
					      <span v-if="property.more.type !== 'icon'"> {{ property.more.text }} </span>
 | 
				
			||||||
      <Icon icon="ep:arrow-right" v-if="property.more.type !== 'text'" />
 | 
					      <Icon v-if="property.more.type !== 'text'" icon="ep:arrow-right" />
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
  </div>
 | 
					  </div>
 | 
				
			||||||
</template>
 | 
					</template>
 | 
				
			||||||
<script setup lang="ts">
 | 
					<script lang="ts" setup>
 | 
				
			||||||
import { TitleBarProperty } from './config'
 | 
					import { TitleBarProperty } from './config'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** 标题栏 */
 | 
					/** 标题栏 */
 | 
				
			||||||
@@ -49,7 +57,7 @@ defineOptions({ name: 'TitleBar' })
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
defineProps<{ property: TitleBarProperty }>()
 | 
					defineProps<{ property: TitleBarProperty }>()
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
<style scoped lang="scss">
 | 
					<style lang="scss" scoped>
 | 
				
			||||||
.title-bar {
 | 
					.title-bar {
 | 
				
			||||||
  position: relative;
 | 
					  position: relative;
 | 
				
			||||||
  width: 100%;
 | 
					  width: 100%;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,12 +1,7 @@
 | 
				
			|||||||
<template>
 | 
					<template>
 | 
				
			||||||
  <ComponentContainerProperty v-model="formData.style">
 | 
					  <ComponentContainerProperty v-model="formData.style">
 | 
				
			||||||
    <el-form label-width="85px" :model="formData" :rules="rules">
 | 
					    <el-form :model="formData" :rules="rules" label-width="85px">
 | 
				
			||||||
      <el-card header="风格" class="property-group" shadow="never">
 | 
					      <el-card class="property-group" header="风格" shadow="never">
 | 
				
			||||||
        <el-form-item label="背景图片" prop="bgImgUrl">
 | 
					 | 
				
			||||||
          <UploadImg v-model="formData.bgImgUrl" width="100%" height="40px">
 | 
					 | 
				
			||||||
            <template #tip>建议尺寸 750*80</template>
 | 
					 | 
				
			||||||
          </UploadImg>
 | 
					 | 
				
			||||||
        </el-form-item>
 | 
					 | 
				
			||||||
        <el-form-item label="标题位置" prop="textAlign">
 | 
					        <el-form-item label="标题位置" prop="textAlign">
 | 
				
			||||||
          <el-radio-group v-model="formData!.textAlign">
 | 
					          <el-radio-group v-model="formData!.textAlign">
 | 
				
			||||||
            <el-tooltip content="居左" placement="top">
 | 
					            <el-tooltip content="居左" placement="top">
 | 
				
			||||||
@@ -22,65 +17,65 @@
 | 
				
			|||||||
          </el-radio-group>
 | 
					          </el-radio-group>
 | 
				
			||||||
        </el-form-item>
 | 
					        </el-form-item>
 | 
				
			||||||
      </el-card>
 | 
					      </el-card>
 | 
				
			||||||
      <el-card header="主标题" class="property-group" shadow="never">
 | 
					      <el-card class="property-group" header="主标题" shadow="never">
 | 
				
			||||||
        <el-form-item label="文字" prop="title" label-width="40px">
 | 
					        <el-form-item label="文字" label-width="40px" prop="title">
 | 
				
			||||||
          <InputWithColor
 | 
					          <InputWithColor
 | 
				
			||||||
            v-model="formData.title"
 | 
					            v-model="formData.title"
 | 
				
			||||||
            v-model:color="formData.titleColor"
 | 
					            v-model:color="formData.titleColor"
 | 
				
			||||||
            show-word-limit
 | 
					 | 
				
			||||||
            maxlength="20"
 | 
					            maxlength="20"
 | 
				
			||||||
 | 
					            show-word-limit
 | 
				
			||||||
          />
 | 
					          />
 | 
				
			||||||
        </el-form-item>
 | 
					        </el-form-item>
 | 
				
			||||||
        <el-form-item label="大小" prop="titleSize" label-width="40px">
 | 
					        <el-form-item label="大小" label-width="40px" prop="titleSize">
 | 
				
			||||||
          <el-slider
 | 
					          <el-slider
 | 
				
			||||||
            v-model="formData.titleSize"
 | 
					            v-model="formData.titleSize"
 | 
				
			||||||
            :max="60"
 | 
					            :max="60"
 | 
				
			||||||
            :min="10"
 | 
					            :min="10"
 | 
				
			||||||
            show-input
 | 
					 | 
				
			||||||
            input-size="small"
 | 
					            input-size="small"
 | 
				
			||||||
 | 
					            show-input
 | 
				
			||||||
          />
 | 
					          />
 | 
				
			||||||
        </el-form-item>
 | 
					        </el-form-item>
 | 
				
			||||||
        <el-form-item label="粗细" prop="titleWeight" label-width="40px">
 | 
					        <el-form-item label="粗细" label-width="40px" prop="titleWeight">
 | 
				
			||||||
          <el-slider
 | 
					          <el-slider
 | 
				
			||||||
            v-model="formData.titleWeight"
 | 
					            v-model="formData.titleWeight"
 | 
				
			||||||
            :min="100"
 | 
					 | 
				
			||||||
            :max="900"
 | 
					            :max="900"
 | 
				
			||||||
 | 
					            :min="100"
 | 
				
			||||||
            :step="100"
 | 
					            :step="100"
 | 
				
			||||||
            show-input
 | 
					 | 
				
			||||||
            input-size="small"
 | 
					            input-size="small"
 | 
				
			||||||
 | 
					            show-input
 | 
				
			||||||
          />
 | 
					          />
 | 
				
			||||||
        </el-form-item>
 | 
					        </el-form-item>
 | 
				
			||||||
      </el-card>
 | 
					      </el-card>
 | 
				
			||||||
      <el-card header="副标题" class="property-group" shadow="never">
 | 
					      <el-card class="property-group" header="副标题" shadow="never">
 | 
				
			||||||
        <el-form-item label="文字" prop="description" label-width="40px">
 | 
					        <el-form-item label="文字" label-width="40px" prop="description">
 | 
				
			||||||
          <InputWithColor
 | 
					          <InputWithColor
 | 
				
			||||||
            v-model="formData.description"
 | 
					            v-model="formData.description"
 | 
				
			||||||
            v-model:color="formData.descriptionColor"
 | 
					            v-model:color="formData.descriptionColor"
 | 
				
			||||||
            show-word-limit
 | 
					 | 
				
			||||||
            maxlength="50"
 | 
					            maxlength="50"
 | 
				
			||||||
 | 
					            show-word-limit
 | 
				
			||||||
          />
 | 
					          />
 | 
				
			||||||
        </el-form-item>
 | 
					        </el-form-item>
 | 
				
			||||||
        <el-form-item label="大小" prop="descriptionSize" label-width="40px">
 | 
					        <el-form-item label="大小" label-width="40px" prop="descriptionSize">
 | 
				
			||||||
          <el-slider
 | 
					          <el-slider
 | 
				
			||||||
            v-model="formData.descriptionSize"
 | 
					            v-model="formData.descriptionSize"
 | 
				
			||||||
            :max="60"
 | 
					            :max="60"
 | 
				
			||||||
            :min="10"
 | 
					            :min="10"
 | 
				
			||||||
            show-input
 | 
					 | 
				
			||||||
            input-size="small"
 | 
					            input-size="small"
 | 
				
			||||||
 | 
					            show-input
 | 
				
			||||||
          />
 | 
					          />
 | 
				
			||||||
        </el-form-item>
 | 
					        </el-form-item>
 | 
				
			||||||
        <el-form-item label="粗细" prop="descriptionWeight" label-width="40px">
 | 
					        <el-form-item label="粗细" label-width="40px" prop="descriptionWeight">
 | 
				
			||||||
          <el-slider
 | 
					          <el-slider
 | 
				
			||||||
            v-model="formData.descriptionWeight"
 | 
					            v-model="formData.descriptionWeight"
 | 
				
			||||||
            :min="100"
 | 
					 | 
				
			||||||
            :max="900"
 | 
					            :max="900"
 | 
				
			||||||
 | 
					            :min="100"
 | 
				
			||||||
            :step="100"
 | 
					            :step="100"
 | 
				
			||||||
            show-input
 | 
					 | 
				
			||||||
            input-size="small"
 | 
					            input-size="small"
 | 
				
			||||||
 | 
					            show-input
 | 
				
			||||||
          />
 | 
					          />
 | 
				
			||||||
        </el-form-item>
 | 
					        </el-form-item>
 | 
				
			||||||
      </el-card>
 | 
					      </el-card>
 | 
				
			||||||
      <el-card header="查看更多" class="property-group" shadow="never">
 | 
					      <el-card class="property-group" header="查看更多" shadow="never">
 | 
				
			||||||
        <el-form-item label="是否显示" prop="more.show">
 | 
					        <el-form-item label="是否显示" prop="more.show">
 | 
				
			||||||
          <el-checkbox v-model="formData.more.show" />
 | 
					          <el-checkbox v-model="formData.more.show" />
 | 
				
			||||||
        </el-form-item>
 | 
					        </el-form-item>
 | 
				
			||||||
@@ -93,7 +88,7 @@
 | 
				
			|||||||
              <el-radio value="all">文字+图标</el-radio>
 | 
					              <el-radio value="all">文字+图标</el-radio>
 | 
				
			||||||
            </el-radio-group>
 | 
					            </el-radio-group>
 | 
				
			||||||
          </el-form-item>
 | 
					          </el-form-item>
 | 
				
			||||||
          <el-form-item label="更多文字" prop="more.text" v-show="formData.more.type !== 'icon'">
 | 
					          <el-form-item v-show="formData.more.type !== 'icon'" label="更多文字" prop="more.text">
 | 
				
			||||||
            <el-input v-model="formData.more.text" />
 | 
					            <el-input v-model="formData.more.text" />
 | 
				
			||||||
          </el-form-item>
 | 
					          </el-form-item>
 | 
				
			||||||
          <el-form-item label="跳转链接" prop="more.url">
 | 
					          <el-form-item label="跳转链接" prop="more.url">
 | 
				
			||||||
@@ -104,7 +99,7 @@
 | 
				
			|||||||
    </el-form>
 | 
					    </el-form>
 | 
				
			||||||
  </ComponentContainerProperty>
 | 
					  </ComponentContainerProperty>
 | 
				
			||||||
</template>
 | 
					</template>
 | 
				
			||||||
<script setup lang="ts">
 | 
					<script lang="ts" setup>
 | 
				
			||||||
import { TitleBarProperty } from './config'
 | 
					import { TitleBarProperty } from './config'
 | 
				
			||||||
import { usePropertyForm } from '@/components/DiyEditor/util'
 | 
					import { usePropertyForm } from '@/components/DiyEditor/util'
 | 
				
			||||||
// 导航栏属性面板
 | 
					// 导航栏属性面板
 | 
				
			||||||
@@ -118,4 +113,4 @@ const { formData } = usePropertyForm(props.modelValue, emit)
 | 
				
			|||||||
const rules = {}
 | 
					const rules = {}
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<style scoped lang="scss"></style>
 | 
					<style lang="scss" scoped></style>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user