diff --git a/.env b/.env index 2f7d214..6ebe883 100644 --- a/.env +++ b/.env @@ -18,8 +18,9 @@ VITE_OAUTH2_APP_CLIENT='mini:mini' # 是否开启websocket 消息接受, VITE_WEBSOCKET_ENABLE = true # --------------------------- start 开发环境 start ---------------------------------- -# VITE_APP_DEV_SERVICE = https://www.zianxin.com/api -VITE_APP_DEV_SERVICE = https://dzc-test-1.fy.takin.cc + VITE_APP_DEV_SERVICE = https://www.zianxin.com/api +#VITE_APP_DEV_SERVICE = https://dzc-test-1.fy.takin.cc +#VITE_APP_DEV_SERVICE = http://127.0.0.1:9999 VITE_IMAGE_DEV_PATH = https://www.zianxin.com/api # VITE_IMAGE_DEV_PATH = https://dzc-test-1.fy.takin.cc diff --git a/src/pages/canteen/detail.vue b/src/pages/canteen/detail.vue index 1c624f5..c2d3b31 100644 --- a/src/pages/canteen/detail.vue +++ b/src/pages/canteen/detail.vue @@ -130,6 +130,23 @@ const getHeight = () => { return `calc(100vh - ${uni.upx2px(rpx)}px)` } +/** functionScope 在部分接口/端上可能是 JSON 字符串 */ +const normalizeFunctionScope = (raw: unknown): Record => { + if (!raw) return {} + if (typeof raw === "string") { + try { + const parsed = JSON.parse(raw) + return parsed && typeof parsed === "object" ? parsed : {} + } catch { + return {} + } + } + if (typeof raw === "object") return { ...(raw as Record) } + return {} +} + +const isTruthyFlag = (v: unknown) => v === true || v === 1 || v === "1" || v === "true" + // 获取食堂详情信息 const getDetail = async () => { if (isEmpty(state.detailId)) { @@ -138,7 +155,12 @@ const getDetail = async () => { } uni.showLoading({ title: "加载中...", mask: true }) const { code, data } = await merchantApi.detail({ id: state.detailId }) - if (code == 0) state.canteenDetail = data + if (code == 0 && data) { + state.canteenDetail = { + ...data, + functionScope: normalizeFunctionScope(data.functionScope), + } + } await getTakeOutDetail() uni.hideLoading() } @@ -443,7 +465,7 @@ const doFood = () => { } const orderingFoodEnabled = computed(() => - Boolean(state.canteenDetail?.functionScope?.orderingFoodEnable), + isTruthyFlag(state.canteenDetail?.functionScope?.orderingFoodEnable), ) const doOrderingFood = () => { @@ -524,7 +546,7 @@ const doOrderingFood = () => { - + 报餐 @@ -689,6 +711,12 @@ const doOrderingFood = () => { flex-shrink: 0; } +.mch-actions__icon-img { + width: 28rpx; + height: 28rpx; + filter: brightness(0) invert(1); +} + .mch-actions__label { margin-top: 8rpx; font-size: 22rpx; diff --git a/src/sheep/scss/font/iconfont.scss b/src/sheep/scss/font/iconfont.scss index 7f428d6..5f50b74 100644 --- a/src/sheep/scss/font/iconfont.scss +++ b/src/sheep/scss/font/iconfont.scss @@ -118,7 +118,7 @@ content: "\e928"; } -/* 报餐登记 */ +/* 报餐登记(复用 jilu 字形;e631 在 CDN 字体中无对应图标) */ .icon-baocan:before { - content: "\e631"; + content: "\e664"; } \ No newline at end of file diff --git a/src/static/page/baocan.png b/src/static/page/baocan.png new file mode 100644 index 0000000..802f52c Binary files /dev/null and b/src/static/page/baocan.png differ