更改viewtype方式

This commit is contained in:
李志鹏
2025-12-29 14:48:54 +08:00
parent 59c864fef3
commit 8cb77593f8
15 changed files with 14 additions and 68 deletions

View File

@@ -1,6 +1,6 @@
<template>
<div class="routeCache" :view-type="viewType">
<router-view v-slot="{ Component, route }" @view-type="changeViewType">
<router-view v-slot="{ Component, route }">
<keep-alive :include="cachedViews">
<component :is="Component" :key="route.name" />
</keep-alive>
@@ -14,6 +14,13 @@ import { useRoute } from 'vue-router'
import { useRouter } from 'vue-router'
import MyEvent from '@/utils/myEvent'
const props = defineProps({
viewType: {
type: String,
default: ''
}
})
const route = useRoute()
// 缓存的组件名称列表
@@ -59,17 +66,6 @@ onMounted(() => {
MyEvent.add('clearAllCache', clearCache)
})
//根据viewType设置布局风格样式
const viewType = ref(0)
const changeViewType = (v: number) => {
viewType.value = v
}
const router = useRouter()
watch(
() => router.currentRoute.value,
() => (viewType.value = 0)
)
// 暴露方法供外部使用
defineExpose({
clearCache,

View File

@@ -12,7 +12,6 @@
import { useRouter } from 'vue-router'
import MyEvent from '@/utils/myEvent'
const router = useRouter()
const emit = defineEmits(['view-type'])
const query = computed(() => router.currentRoute.value.query)
const visitRecordId = computed(() => query.value.visitRecordId) // 访问记录ID
import { useGenerateStore, useHGenerateStore } from '@/stores'
@@ -22,9 +21,6 @@
// 是否单选模式
isChooseOne: { type: Boolean, default: false }
})
onMounted(() => {
emit('view-type', 1)
})
const list = reactive([])
const size = ref(10)
const page = computed(() => Math.ceil(list.length / size.value) + 1)

View File

@@ -7,16 +7,8 @@
const router = useRouter()
const route = useRoute()
const styleUrl = computed(() => router.currentRoute.value.query.styleUrl)
const emit = defineEmits(['view-type'])
watch(
() => router.currentRoute.value,
() => emit('view-type', 1)
)
const isChooseOne = computed(() => route.query.flowType === FlowType.HISTORY)
onMounted(() => {
emit('view-type', 1)
})
</script>
<template>

View File

@@ -2,10 +2,7 @@
import { ref, onMounted } from 'vue'
import { useRouter } from 'vue-router'
const router = useRouter()
const emit = defineEmits(['view-type'])
onMounted(() => {
emit('view-type', 1)
})
const onExit = () => {
console.log('exit')
}

View File

@@ -7,9 +7,6 @@ import { FlowType } from '@/types/enum'
//const props = defineProps({
//})
const emit = defineEmits([
'viewType'
])
// const data = reactive({
// })
@@ -22,9 +19,6 @@ const historicalReview = ()=>{
router.push(`/workshop/creation?flowType=${FlowType.HISTORY}`)
}
onMounted(()=>{
emit('viewType', 1)
})
onUnmounted(()=>{
})
defineExpose({})

View File

@@ -12,9 +12,6 @@ const hGenerateStore = useHGenerateStore()
//const props = defineProps({
//})
const emit = defineEmits([
'view-type'
])
const navList = ref([])
const navDisabledList = ref([])
@@ -50,7 +47,6 @@ const openFlow = (item: any)=>{
}
onMounted(()=>{
emit('view-type', 1)
let nav = [
{
path: 'selectStyle',

View File

@@ -19,7 +19,7 @@
<template>
<div class="workshop">
<header-title @clickProfile="handleClickProfile" />
<RouteCache />
<RouteCache view-type="1" />
<footer-navigation v-if="notShowFooter" />
</div>
<profile ref="profileRef" />

View File

@@ -4,14 +4,10 @@
import router from '@/router'
import { FormatDate } from '@/utils/tools'
import { getCustomerPhotos, deleteCustomerPhoto } from '@/api/workshop'
const emit = defineEmits(['view-type'])
import { showConfirmDialog } from 'vant'
import { useGenerateStore } from '@/stores'
const generateStore = useGenerateStore()
onMounted(() => {
emit('view-type', 1)
})
const loading = ref(false)
const finish = ref(false)
const list = reactive([])

View File

@@ -10,7 +10,6 @@ import gradientButton from '@/components/gradientButton.vue'
const router = useRouter()
//const props = defineProps({
//})
const emit = defineEmits(['view-type'])
let data = reactive({
modelList:
[
@@ -120,7 +119,6 @@ const handleSubmit = ()=>{
}
onMounted(() => {
emit('view-type', 1)
if (!generateStore.originalTryOn.id) {
startGenerate()
}

View File

@@ -15,7 +15,7 @@
const userInfoStore = useUserInfoStore()
const overallStore = useOverallStore()
const emit = defineEmits(['view-type', 'selected-customer'])
const emit = defineEmits(['selected-customer'])
const show = ref(false)
const isEdit = ref(false)
const form = reactive({

View File

@@ -3,10 +3,7 @@
import { useRouter } from 'vue-router'
import { useGenerateStore } from '@/stores'
const generateStore = useGenerateStore()
const emit = defineEmits(['view-type'])
onMounted(() => {
emit('view-type', 1)
})
const router = useRouter()
const clickNext = () => {
generateStore.updatePhotoInfo({})

View File

@@ -6,9 +6,7 @@ import { useGenerateStore } from '@/stores'
const router = useRouter()
//const props = defineProps({
//})
const emit = defineEmits([
'view-type'
])
const generateStore = useGenerateStore()
let data = reactive({
modelList:
@@ -45,9 +43,7 @@ let data = reactive({
const setSelectedModelId = (item)=>{
generateStore.selectModel(item)
}
onMounted(()=>{
emit('view-type', 1)
})
const toProduct = ()=>{
router.push({ path: 'product' })
}

View File

@@ -14,9 +14,6 @@ const router = useRouter()
const route = useRoute()
//const props = defineProps({
//})
const emit = defineEmits([
'view-type'
])
const generateStore = useGenerateStore()
const userInfoStore = useUserInfoStore()
const hGenerateStore = useHGenerateStore()
@@ -121,7 +118,6 @@ const getRequestOutfitList = (generateList)=>{
onMounted(()=>{
// generateStore.clearProductData()
emit('view-type', 1)
// if(!data.styleList[0]?.id)getRequestOutfitList(0)
if(getGenerateTime)clearTimeout(getGenerateTime)
if(data.select.status == 'SUCCEEDED'){

View File

@@ -4,10 +4,6 @@
import { useGenerateStore } from '@/stores'
import { IsHistoryFlow } from '@/types/enum'
const generateStore = useGenerateStore()
const emit = defineEmits(['view-type'])
onMounted(() => {
emit('view-type', 1)
})
const router = useRouter()
const route = useRoute()
const query = computed(() => route.query)

View File

@@ -7,10 +7,6 @@
const generateStore = useGenerateStore()
const hGenerateStore = useHGenerateStore()
const emit = defineEmits(['view-type'])
onMounted(() => {
emit('view-type', 1)
})
const router = useRouter()
const route = useRoute()
const query = computed(() => route.query)