Skip to content

Commit 7846237

Browse files
committed
营销:完善装修编辑器预览功能
1 parent eec3a21 commit 7846237

File tree

4 files changed

+34
-15
lines changed

4 files changed

+34
-15
lines changed

.env.base

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ VITE_API_URL=/admin-api
1717

1818
# 打包路径
1919
VITE_BASE_PATH=/
20+
21+
# 商城H5会员端域名
22+
VITE_MALL_H5_DOMAIN=http://localhost:3000

.env.dev

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,6 @@ VITE_SOURCEMAP=false
2929

3030
# 输出路径
3131
VITE_OUT_DIR=dist
32+
33+
# 商城H5会员端域名
34+
VITE_MALL_H5_DOMAIN=http://localhost:3000

src/components/DiyEditor/index.vue

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<Icon icon="system-uicons:reset-alt" :size="24" />
1616
</el-button>
1717
</el-tooltip>
18-
<el-tooltip content="预览">
18+
<el-tooltip content="预览" v-if="previewUrl">
1919
<el-button @click="handlePreview">
2020
<Icon icon="ep:view" :size="24" />
2121
</el-button>
@@ -119,6 +119,19 @@
119119
</el-aside>
120120
</el-container>
121121
</el-container>
122+
<!-- 预览弹框 -->
123+
<Dialog v-model="previewDialogVisible" title="预览" width="700">
124+
<div class="flex justify-around">
125+
<IFrame
126+
class="w-375px border-4px border-rounded-8px border-solid p-2px h-667px!"
127+
:src="previewUrl"
128+
/>
129+
<div class="flex flex-col">
130+
<el-text>手机扫码预览</el-text>
131+
<Qrcode :text="previewUrl" logo="/logo.gif" />
132+
</div>
133+
</div>
134+
</Dialog>
122135
</template>
123136
<script lang="ts">
124137
// 注册所有的组件
@@ -137,12 +150,12 @@ import { component as TAB_BAR_COMPONENT } from './components/mobile/TabBar/confi
137150
import { isString } from '@/utils/is'
138151
import { DiyComponent, DiyComponentLibrary, PageConfig } from '@/components/DiyEditor/util'
139152
import { componentConfigs } from '@/components/DiyEditor/components/mobile'
153+
import { array, oneOfType } from 'vue-types'
154+
import { propTypes } from '@/utils/propTypes'
140155
141156
/** 页面装修详情页 */
142157
defineOptions({ name: 'DiyPageDetail' })
143158
144-
// 消息弹窗
145-
const message = useMessage()
146159
// 左侧组件库
147160
const componentLibrary = ref()
148161
// 页面设置组件
@@ -159,20 +172,22 @@ const selectedComponentIndex = ref<number>(-1)
159172
// 组件列表
160173
const pageComponents = ref<DiyComponent<any>[]>([])
161174
// 定义属性
162-
const props = defineProps<{
175+
const props = defineProps({
163176
// 页面配置,支持Json字符串
164-
modelValue: string | PageConfig
177+
modelValue: oneOfType<string | PageConfig>([String, Object]).isRequired,
165178
// 标题
166-
title: string
179+
title: propTypes.string.def(''),
167180
// 组件库
168-
libs: DiyComponentLibrary[]
181+
libs: array<DiyComponentLibrary>(),
169182
// 是否显示顶部导航栏
170-
showNavigationBar: boolean
183+
showNavigationBar: propTypes.bool.def(true),
171184
// 是否显示底部导航菜单
172-
showTabBar: boolean
185+
showTabBar: propTypes.bool.def(false),
173186
// 是否显示页面配置
174-
showPageConfig: boolean
175-
}>()
187+
showPageConfig: propTypes.bool.def(true),
188+
// 预览地址:提供了预览地址,才会显示预览按钮
189+
previewUrl: propTypes.string.def('')
190+
})
176191
177192
// 监听传入的页面配置
178193
watch(
@@ -315,8 +330,9 @@ const handleReset = () => {
315330
emits('reset')
316331
}
317332
// 预览
333+
const previewDialogVisible = ref(false)
318334
const handlePreview = () => {
319-
message.warning('开发中~')
335+
previewDialogVisible.value = true
320336
emits('preview')
321337
}
322338

src/views/mall/promotion/diy/page/decorate.vue

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
v-model="formData.property"
55
:title="formData.name"
66
:libs="PAGE_LIBS"
7-
:show-page-config="true"
8-
:show-navigation-bar="true"
9-
:show-tab-bar="false"
107
@save="submitForm"
118
/>
129
</template>

0 commit comments

Comments
 (0)