diff --git a/public/img/icon-hot.png b/public/img/icon-hot.png
index 702a80c..1691775 100644
Binary files a/public/img/icon-hot.png and b/public/img/icon-hot.png differ
diff --git a/src/components/BaseList.vue b/src/components/BaseList.vue
index 5b2282e..4912404 100644
--- a/src/components/BaseList.vue
+++ b/src/components/BaseList.vue
@@ -99,7 +99,8 @@ export default {
this._skipWatch = true
this.loadMore()
this.$emit('refresh', this.list)
- this._skipWatch = false
+ // 等 params 的 deep watcher 排队回调跑完再解锁,避免同一轮 tick 里被再触发一次
+ this.$nextTick(() => { this._skipWatch = false })
},
},
}
diff --git a/src/main.js b/src/main.js
index e3cfa16..7fba203 100644
--- a/src/main.js
+++ b/src/main.js
@@ -68,12 +68,11 @@ window.__currentPath = () => currentPath;
app.use(router);
import pinia from './stores';
-import { useDatadicStore, dictCache } from './stores/datadic';
+import { useDatadicStore } from './stores/datadic';
import { useUserStore } from './stores/user';
app.use(pinia);
const datadicStore = useDatadicStore()
-datadicStore.init()
const userStore = useUserStore()
@@ -90,8 +89,11 @@ const userStore = useUserStore()
// });
app.config.globalProperties.$datadic = {
- get: (code) => dictCache[code] || null,
- getContent: (code) => dictCache[code] ? dictCache[code].contents : '',
+ get: (code) => datadicStore.fetch(code),
+ getContent: async (code) => {
+ const item = await datadicStore.fetch(code)
+ return item ? item.contents : ''
+ },
}
app.config.globalProperties.$userInfo = userStore.getUserInfo;
diff --git a/src/stores/datadic.js b/src/stores/datadic.js
index ee3677a..5a76933 100644
--- a/src/stores/datadic.js
+++ b/src/stores/datadic.js
@@ -1,53 +1,17 @@
import { defineStore } from 'pinia'
import { get } from '@/api/http'
-export let dictCache = {}
-
-const SESSION_KEY = 'dict_cache'
-
+// 按需请求:调用时才拉,不做本地缓存
export const useDatadicStore = defineStore('datadic', {
- state: () => ({
- dicts: {},
- loaded: false
- }),
- getters: {
- getByCode: (state) => (code) => {
- return dictCache[code] || null
- },
- getContent: (code) => {
- const item = dictCache[code]
- return item ? item.contents : ''
- }
- },
actions: {
- async init() {
- // 优先从 sessionStorage 读取缓存
- const cached = sessionStorage.getItem(SESSION_KEY)
- if (cached) {
- try {
- dictCache = JSON.parse(cached)
- this.dicts = dictCache
- this.loaded = true
- return
- } catch (e) {
- sessionStorage.removeItem(SESSION_KEY)
- }
- }
- if (this.loaded) return
+ async fetch(code) {
try {
- // 使用持久请求,防止被路由切换时的 abortAll() 取消
- const res = await get('/v1/client/CDatadicsClient', undefined, undefined, undefined, true)
- if (res.status === 200 && res.data) {
- res.data.forEach(item => {
- dictCache[item.code] = item
- })
- this.dicts = dictCache
- this.loaded = true
- sessionStorage.setItem(SESSION_KEY, JSON.stringify(dictCache))
- }
+ const res = await get(`/v1/client/CDatadicsClient/${code}`)
+ return res?.data || null
} catch (e) {
- console.error('数据字典加载失败', e)
+ console.error('数据字典加载失败', code, e)
+ return null
}
}
}
-})
\ No newline at end of file
+})
diff --git a/src/styles/ch.less b/src/styles/ch.less
index e6d1116..bfcd61d 100644
--- a/src/styles/ch.less
+++ b/src/styles/ch.less
@@ -1134,53 +1134,74 @@
}
.mall_page__hot {
- background: #fff;
border-radius: 2vw;
overflow: hidden;
margin-top: 4vw;
margin-bottom: 4vw;
+ background-image: linear-gradient(0deg,
+ #ffffff 0%,
+ #d5ecd6 100%);
+ border-radius: 2.67vw;
.mall_page__hot_header {
.box;
.box-align-center;
- height: 10vw;
- padding: 0vw 2.8vw;
- background-color: #ffb43d;
- color: #a86906;
+ height: 12.53vw;
+ padding: 2.93vw;
+
+ color: #2e5d31;
img {
- width: 4.27vw;
+ width: 4.8vw;
}
b {
font-size: 4.8vw;
- color: #ffffff;
+ color: #000000;
margin: 0 3.6vw 0 1.47vw;
}
p {
- color: #a86906;
+ color: #2e5d31;
}
}
+ .van-swipe {
+ width: calc(100% - 5.86vw);
+ }
+
+
.mall_page__hot_list {
- .box;
- // margin-bottom: 3vw;
- padding: 4vw 3.33vw;
- overflow-x: auto
+ background-color: #ffffff;
+ border-radius: 2.67vw;
+ // padding: 4vw 3.73vw;
+ padding: 4vw 0;
+ margin: 0 2.93vw;
+
+ .van-swipe-item {
+ display: grid;
+ grid-template-columns: repeat(3, 1fr);
+ row-gap: 3.2vw;
+ column-gap: 4vw;
+ box-sizing: border-box;
+ padding: 0 3.73vw;
+ }
+
+ .van-swipe__indicators {
+ bottom: 1.6vw;
+ }
}
.mall_page__hot_item {
.box;
.box-tb;
- margin-right: 2.67vw;
- width: 34.67vw;
+ .box-align-start;
+ width: max-content;
img {
object-fit: contain;
- width: 34.67vw;
- height: 34.67vw;
- background-color: #e5e5e5;
+ width: 24vw;
+ height: 24vw;
border-radius: 1.33vw;
}
@@ -1188,23 +1209,17 @@
font-size: 3.2vw;
font-weight: bold;
line-height: 4vw;
+ min-height: 4vw;
+ max-width: 24.27vw;
color: #333333;
- min-height: 8vw;
- .text-hide(2);
- margin-top: 2.8vw;
- }
-
- .mall_page__hot_price--original {
- font-size: 3.2vw;
- text-decoration: line-through;
- // line-height: 4.8vw;
- color: #b1b1b1;
- margin-top: 1.67vw;
+ .text-hide(1);
+ margin-top: 1.6vw;
}
.mall_page__hot_price {
- font-size: 4vw;
+ font-size: 3.47vw;
font-weight: bold;
+ line-height: 4.8vw;
color: #ea3e23;
}
}
diff --git a/src/views/Account/Login.vue b/src/views/Account/Login.vue
index 6859b84..c390e4a 100644
--- a/src/views/Account/Login.vue
+++ b/src/views/Account/Login.vue
@@ -84,7 +84,7 @@
超多会员已购买
- + 茶品飘香 +精选茶叶礼盒
+ 查看更多