mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-uniapp.git
synced 2026-08-06 10:57:25 +08:00
refactor: 重构多个组件以支持 Vue 3 语法和功能
- 将多个组件转换为 `<script setup>` 语法,提升可读性和性能 - 优化状态管理和事件处理逻辑,简化代码结构 - 更新样式和布局以适应新组件结构 - 添加新功能和修复已知问题,提升用户体验
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="seller-control" :style="themeStyle">
|
||||
<u-navbar
|
||||
:border="false"
|
||||
:fixed="true"
|
||||
@@ -18,56 +18,71 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getCompanyDetail } from "@/api/entry";
|
||||
import step1 from "./step1";
|
||||
import step2 from "./step2";
|
||||
import step3 from "./step3";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
companyData: "",
|
||||
current: 1,
|
||||
};
|
||||
},
|
||||
components: {
|
||||
step1,
|
||||
step2,
|
||||
step3,
|
||||
},
|
||||
mounted() {
|
||||
this.init();
|
||||
},
|
||||
methods: {
|
||||
back() {
|
||||
if (this.current > 1) {
|
||||
this.current--;
|
||||
return;
|
||||
}
|
||||
uni.navigateBack({
|
||||
delta: 1,
|
||||
fail: () => {
|
||||
uni.switchTab({ url: "/pages/tabbar/home/index" });
|
||||
},
|
||||
});
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { useStore } from '@/store'
|
||||
import { getCompanyDetail } from '@/api/entry'
|
||||
import step1 from './step1.vue'
|
||||
import step2 from './step2.vue'
|
||||
import step3 from './step3.vue'
|
||||
import { getThemeStyle } from '@/utils/theme'
|
||||
|
||||
const store = useStore()
|
||||
|
||||
const themeStyle = computed(() => getThemeStyle(store.state.theme))
|
||||
|
||||
const companyData = ref<any>('')
|
||||
const current = ref(1)
|
||||
|
||||
onMounted(() => {
|
||||
init()
|
||||
})
|
||||
|
||||
function back() {
|
||||
if (current.value > 1) {
|
||||
current.value--
|
||||
return
|
||||
}
|
||||
uni.navigateBack({
|
||||
delta: 1,
|
||||
fail: () => {
|
||||
uni.switchTab({ url: '/pages/tabbar/home/index' })
|
||||
},
|
||||
async init(next) {
|
||||
const res = await getCompanyDetail();
|
||||
if (res.data.success) {
|
||||
this.companyData = res.data.result;
|
||||
next ? this.current++ : "";
|
||||
}
|
||||
},
|
||||
next() {
|
||||
this.init("next");
|
||||
},
|
||||
finished() {
|
||||
uni.navigateTo({
|
||||
url: "/pages/passport/entry/seller/index",
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
})
|
||||
}
|
||||
|
||||
async function init(next?: string) {
|
||||
const res = await getCompanyDetail()
|
||||
if (res.data.success) {
|
||||
companyData.value = res.data.result
|
||||
if (next) {
|
||||
current.value++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function next() {
|
||||
init('next')
|
||||
}
|
||||
|
||||
function finished() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/passport/entry/seller/index',
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style lang="scss">
|
||||
page {
|
||||
background: #f7f7f7;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import "./entry.scss";
|
||||
|
||||
.seller-control {
|
||||
min-height: 100vh;
|
||||
background: #f7f7f7;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user