提交 95cb09aa authored 作者: 王鹏飞's avatar 王鹏飞

chore: update

上级 f690956f
...@@ -8,6 +8,11 @@ ...@@ -8,6 +8,11 @@
name="viewport" name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover" /> content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover" />
<title>清控紫荆金保</title> <title>清控紫荆金保</title>
<script type="module">
;(async () => {
window.SHOP = await import('https://webapp-pub.ezijing.com/project_online/fi/shop.js')
})()
</script>
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>
......
<script setup lang="ts"> <script setup lang="ts">
import { ref, watch, computed } from 'vue'
import { useWindowScroll } from '@vueuse/core' import { useWindowScroll } from '@vueuse/core'
import { useUserStore } from '@/stores/user' import { useUserStore } from '@/stores/user'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import AppNav from './Nav.vue' import AppNav from './Nav.vue'
interface Props {
fixed?: boolean
}
const props = defineProps<Props>()
const route = useRoute() const route = useRoute()
const user = useUserStore() const user = useUserStore()
const LOGIN_URL = `${import.meta.env.VITE_LOGIN_URL}?rd=${encodeURIComponent(location.href)}` const LOGIN_URL = `${import.meta.env.VITE_LOGIN_URL}?rd=${encodeURIComponent(location.href)}`
...@@ -22,6 +26,7 @@ watch(route, () => { ...@@ -22,6 +26,7 @@ watch(route, () => {
const classNames = computed(() => { const classNames = computed(() => {
return { return {
'has-menu': menuVisible.value, 'has-menu': menuVisible.value,
'is-fixed': props.fixed,
'is-scrolled': isScrolled.value 'is-scrolled': isScrolled.value
} }
}) })
...@@ -45,7 +50,7 @@ const isScrolled = computed(() => { ...@@ -45,7 +50,7 @@ const isScrolled = computed(() => {
<div class="app-header-left"> <div class="app-header-left">
<div class="logo"> <div class="logo">
<router-link to="/"> <router-link to="/">
<img src="@/assets/images/logo.png" v-if="isScrolled" /> <img src="@/assets/images/logo.png" v-if="isScrolled || !fixed" />
<img src="@/assets/images/logo_white.png" v-else /> <img src="@/assets/images/logo_white.png" v-else />
</router-link> </router-link>
</div> </div>
...@@ -74,22 +79,22 @@ const isScrolled = computed(() => { ...@@ -74,22 +79,22 @@ const isScrolled = computed(() => {
<style lang="scss"> <style lang="scss">
.app-header { .app-header {
position: fixed; position: sticky;
top: 0;
left: 0; left: 0;
right: 0; right: 0;
color: #aa1941;
background: linear-gradient(0deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.5) 100%);
z-index: 1000; z-index: 1000;
.cell { &.is-fixed {
color: #fff !important; position: fixed;
left: 0;
right: 0;
color: #fff;
background: linear-gradient(0deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.5) 100%);
} }
&.is-scrolled { &.is-scrolled {
color: #fff; color: #333;
background: #fff; background: #fff;
box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.1); box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.1);
.cell {
color: #333 !important;
}
.button-default { .button-default {
color: #333; color: #333;
} }
...@@ -115,7 +120,6 @@ const isScrolled = computed(() => { ...@@ -115,7 +120,6 @@ const isScrolled = computed(() => {
} }
.app-header-right { .app-header-right {
display: flex; display: flex;
color: #333;
.app-header-logout { .app-header-logout {
// background: url('https://webapp-pub.ezijing.com/project/saas/logout.png') no-repeat left center; // background: url('https://webapp-pub.ezijing.com/project/saas/logout.png') no-repeat left center;
......
<script setup lang="ts">
import AppHeader from './Header.vue'
import AppFooter from './Footer.vue'
const attrs = useAttrs()
</script>
<template> <template>
<div class="app-layout"> <div class="app-layout">
<AppHeader></AppHeader> <AppHeader v-bind="attrs"></AppHeader>
<section class="app-layout-container"> <section class="app-layout-container">
<router-view></router-view> <router-view></router-view>
</section> </section>
<AppFooter></AppFooter> <AppFooter></AppFooter>
</div> </div>
</template> </template>
<script setup lang="ts">
import AppHeader from './Header.vue'
import AppFooter from './Footer.vue'
</script>
...@@ -32,7 +32,7 @@ const navList = [ ...@@ -32,7 +32,7 @@ const navList = [
> .cell { > .cell {
font-size: 18px; font-size: 18px;
line-height: 50px; line-height: 50px;
color: #333; // color: #333;
} }
> .tree-item-group { > .tree-item-group {
margin-top: -4px; margin-top: -4px;
......
...@@ -5,6 +5,7 @@ export const routes: Array<RouteRecordRaw> = [ ...@@ -5,6 +5,7 @@ export const routes: Array<RouteRecordRaw> = [
{ {
path: '/', path: '/',
component: AppLayout, component: AppLayout,
props: { fixed: true },
children: [{ path: '', component: () => import('./views/Index.vue') }] children: [{ path: '', component: () => import('./views/Index.vue') }]
} }
] ]
import type { RouteRecordRaw } from 'vue-router'
import AppLayout from '@/components/layout/Index.vue'
export const routes: Array<RouteRecordRaw> = [
{
path: '/shop',
component: AppLayout,
children: [
{ path: '', component: () => import('./views/Index.vue') },
{ path: ':id', component: () => import('./views/View.vue'), props: true }
]
}
]
<script setup>
import { useShopStore } from '@/stores/shop'
const { filters, list } = useShopStore()
console.log(filters, list)
</script>
<template>
<div></div>
</template>
<script setup>
import { useShopStore } from '@/stores/shop'
const { shopItem } = useShopStore()
console.log(shopItem)
</script>
<template>
<div></div>
</template>
import { defineStore } from 'pinia'
interface ShopFilter {
label: string
value: string
}
type ShopListItem = Record<string, any>
interface State {
filters: ShopFilter[]
list: ShopListItem[]
}
export const useShopStore = defineStore({
id: 'shop',
state: (): State => ({
filters: (window as any).SHOP.SHOP_FILTERS, // 筛选列表
list: (window as any).SHOP.SHOP_LIST // 商品列表
}),
getters: {
shopItem: ({ list }) => {
const route = useRoute()
console.log(list)
return list.find(item => item.id === route.params.id)
}
},
actions: {
// async getShopList() {
// const shop = await import('https://webapp-pub.ezijing.com/project_online/fi/shop.js')
// console.log(shop)
// }
}
})
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论