商品浏览页构建前最后一次更新

This commit is contained in:
2026-08-02 00:21:54 +08:00
parent d37a93ab9e
commit e423ab2d73
146 changed files with 3449 additions and 1342 deletions
+74 -34
View File
@@ -20,28 +20,31 @@
function LoginGuard(props) {
var user = _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().getStorageSync('smart_user_info');
if (!(user !== null && user !== void 0 && user.openid)) {
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_2__.View, {
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_2__.View, {
className: "login-guard",
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_2__.Text, {
className: "login-guard-icon",
children: "\uD83D\uDD12"
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_2__.Text, {
className: "login-guard-title",
children: "\u8BF7\u5148\u767B\u5F55"
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_2__.Text, {
className: "login-guard-desc",
children: "\u767B\u5F55\u540E\u67E5\u770B\u60A8\u7684\u4E13\u5C5E\u5185\u5BB9"
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_2__.View, {
className: "btn-gradient login-guard-btn",
onClick: function onClick() {
return _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().switchTab({
url: '/pages/profile/index'
});
},
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_2__.Text, {
children: "\u53BB\u767B\u5F55"
})
})]
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_2__.View, {
className: "login-guard-inner",
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_2__.Text, {
className: "login-guard-icon",
children: "\uD83D\uDD12"
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_2__.Text, {
className: "login-guard-title",
children: "\u8BF7\u5148\u767B\u5F55"
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_2__.Text, {
className: "login-guard-desc",
children: "\u767B\u5F55\u540E\u67E5\u770B\u60A8\u7684\u4E13\u5C5E\u5185\u5BB9"
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_2__.View, {
className: "btn-gradient login-guard-btn",
onTap: function onTap() {
return _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().switchTab({
url: '/pages/profile/index'
});
},
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_2__.Text, {
children: "\u53BB\u767B\u5F55"
})
})]
})
});
}
return props.children;
@@ -78,7 +81,7 @@ function ThemeToggle() {
}, [toggleTheme]);
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_3__.View, {
className: "theme-toggle",
onClick: handleToggle,
onTap: handleToggle,
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_3__.Text, {
className: "theme-icon",
children: theme === 'light' ? '🌙' : '☀️'
@@ -155,7 +158,9 @@ function useThemeContext() {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ CATEGORIES: function() { return /* binding */ CATEGORIES; },
/* harmony export */ getProductById: function() { return /* binding */ getProductById; }
/* harmony export */ PRODUCT_ICON_MAP: function() { return /* binding */ PRODUCT_ICON_MAP; },
/* harmony export */ getProductById: function() { return /* binding */ getProductById; },
/* harmony export */ getProductIconImg: function() { return /* binding */ getProductIconImg; }
/* harmony export */ });
/* unused harmony export PRODUCTS */
/**
@@ -170,6 +175,7 @@ var PRODUCTS = [{
name: '微雕笔记本(小)',
desc: '便携随行,记录点滴',
icon: '📓',
iconImg: '/icon/书本.png',
price: 12,
leadTime: '3-5个工作日',
description: '精选优质纸张,封面采用高档PU材质,手感细腻。内页可定制横线、方格或空白三种版式。激光微雕工艺将名字或图案精准刻印在封面,永不褪色。小巧轻便,适合随身携带,无论是课堂笔记还是日常备忘,都是你的专属伴侣。',
@@ -185,6 +191,7 @@ var PRODUCTS = [{
name: '微雕笔记本(大)',
desc: '大开本,更多创作空间',
icon: '📔',
iconImg: '/icon/书本_大.png',
price: 45,
leadTime: '3-5个工作日',
description: 'A4尺寸大开本,180°平摊设计,书写更自由。封面可选真皮、仿布纹或磨砂材质,激光微雕区域更大,适合呈现全班名字、团队口号或公司Logo等大篇幅内容。是毕业纪念、企业年会礼品的首选。',
@@ -200,6 +207,7 @@ var PRODUCTS = [{
name: '铜质杯垫',
desc: '金属质感,桌面艺术',
icon: '☕',
iconImg: '/icon/杯子.png',
price: 25,
leadTime: '5-7个工作日',
description: '采用优质黄铜材质,表面经拉丝工艺处理,呈现哑光金属质感。背面配有防滑软木垫,保护桌面同时防止滑动。激光微雕可在表面刻印名字、日期或祝福语,是乔迁新居、新婚贺礼的精致之选。',
@@ -214,6 +222,7 @@ var PRODUCTS = [{
name: '竹制笔盒',
desc: '自然竹纹,文房雅器',
icon: '✏️',
iconImg: '/icon/笔盒.png',
price: 75,
leadTime: '7-10个工作日',
description: '精选天然楠竹,经多道工序打磨抛光,保留天然竹纹肌理。盒盖采用磁吸开合,内部设有分层隔板。激光微雕在竹面上呈现深浅不一的雕刻效果,融入墨香气质。适合书房案头、书法爱好者的文房伴侣。',
@@ -229,6 +238,7 @@ var PRODUCTS = [{
name: '书本型灯',
desc: '温暖光影,点亮心意',
icon: '💡',
iconImg: '/icon/书灯.png',
price: 45,
leadTime: '5-7个工作日',
description: '开合式设计,打开即亮,合拢即灭,如魔法书般充满惊喜。采用LED暖光灯源,光线柔和不刺眼,可持续点亮6-8小时。封面激光微雕可定制文字、图案或照片,让温暖的灯光承载专属记忆。是情侣礼物、毕业礼物的创意之选。',
@@ -253,6 +263,30 @@ var getProductById = function getProductById(id) {
});
};
/**
* 产品 ID 到 icon 图片路径的映射
* 用于兼容旧数据(旧数据 productIcon 存的是 emoji
*/
var PRODUCT_ICON_MAP = {
'notebook-small': '/icon/书本.png',
'notebook-large': '/icon/书本_大.png',
'coaster': '/icon/杯子.png',
'penbox': '/icon/笔盒.png',
'booklamp': '/icon/书灯.png'
};
/**
* 获取商品对应的 icon 图片路径
* - 新数据:直接返回 product.iconImg
* - 旧数据:通过 productId 查映射表
* - 兜底:返回四角星
*/
function getProductIconImg(product) {
if (product !== null && product !== void 0 && product.iconImg) return product.iconImg;
if (product !== null && product !== void 0 && product.id) return PRODUCT_ICON_MAP[product.id] || '/icon/四角星.png';
return '/icon/四角星.png';
}
/***/ }),
/***/ "./src/utils/store.ts":
@@ -270,6 +304,7 @@ var getProductById = function getProductById(id) {
/* harmony export */ deleteUser: function() { return /* binding */ deleteUser; },
/* harmony export */ designToOrder: function() { return /* binding */ designToOrder; },
/* harmony export */ getAddressList: function() { return /* binding */ getAddressList; },
/* harmony export */ getDefaultAddress: function() { return /* binding */ getDefaultAddress; },
/* harmony export */ getDesignList: function() { return /* binding */ getDesignList; },
/* harmony export */ getOrderList: function() { return /* binding */ getOrderList; },
/* harmony export */ getTheme: function() { return /* binding */ getTheme; },
@@ -283,11 +318,13 @@ var getProductById = function getProductById(id) {
/* harmony export */ updateDesign: function() { return /* binding */ updateDesign; },
/* harmony export */ verifyAdminPassword: function() { return /* binding */ verifyAdminPassword; }
/* harmony export */ });
/* unused harmony exports getUserInfoRaw, setUserInfoRaw, getUserInfoByOpenid, setOrderList, setAddressList, getDefaultAddress */
/* harmony import */ var F_weixin_wordc_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js */ "./node_modules/@babel/runtime/helpers/esm/objectSpread2.js");
/* harmony import */ var F_weixin_wordc_node_modules_babel_runtime_helpers_esm_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js */ "./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js");
/* unused harmony exports getUserInfoRaw, setUserInfoRaw, getUserInfoByOpenid, setOrderList, setAddressList */
/* harmony import */ var F_weixin_wordc_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js */ "./node_modules/@babel/runtime/helpers/esm/objectSpread2.js");
/* harmony import */ var F_weixin_wordc_node_modules_babel_runtime_helpers_esm_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js */ "./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js");
/* harmony import */ var _tarojs_taro__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tarojs/taro */ "./node_modules/@tarojs/taro/index.js");
/* harmony import */ var _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tarojs_taro__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _productConfig__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./productConfig */ "./src/utils/productConfig.ts");
@@ -462,17 +499,18 @@ function setDesignList(list) {
}
function addDesign(product, count) {
var list = getDesignList();
var iconImg = (product === null || product === void 0 ? void 0 : product.iconImg) || _productConfig__WEBPACK_IMPORTED_MODULE_1__.PRODUCT_ICON_MAP[product === null || product === void 0 ? void 0 : product.id] || '/icon/四角星.png';
var item = {
id: 'DSG' + Date.now(),
productId: product.id,
productName: product.name,
productIcon: product.icon,
productIcon: iconImg,
unitPrice: product.price,
count: count,
status: 'undesigned',
createdAt: new Date().toISOString().slice(0, 10)
};
setDesignList([].concat((0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_1__["default"])(list), [item]));
setDesignList([].concat((0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_2__["default"])(list), [item]));
return item;
}
function updateDesign(id, patch) {
@@ -481,7 +519,7 @@ function updateDesign(id, patch) {
return d.id === id;
});
if (idx === -1) return;
list[idx] = (0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2__["default"])((0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2__["default"])({}, list[idx]), patch);
list[idx] = (0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3__["default"])((0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3__["default"])({}, list[idx]), patch);
setDesignList(list);
}
@@ -498,16 +536,18 @@ function setOrderList(list) {
_tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().setStorageSync(key('order_list'), list);
}
function designToOrder(designId) {
var _design$productIcon;
var dList = getDesignList();
var oList = getOrderList();
var design = dList.find(function (d) {
return d.id === designId;
});
if (!design) return null;
var iconImg = (_design$productIcon = design.productIcon) !== null && _design$productIcon !== void 0 && _design$productIcon.startsWith('/icon/') ? design.productIcon : _productConfig__WEBPACK_IMPORTED_MODULE_1__.PRODUCT_ICON_MAP[design.productId] || '/icon/四角星.png';
var order = {
id: 'ORD' + Date.now().toString().slice(-9),
productName: design.productName,
productIcon: design.productIcon,
productIcon: iconImg,
statusCode: 'pending',
date: new Date().toLocaleString('zh-CN', {
month: '2-digit',
@@ -527,7 +567,7 @@ function designToOrder(designId) {
dList[dIdx].orderId = order.id;
}
setDesignList(dList);
setOrderList([order].concat((0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_1__["default"])(oList)));
setOrderList([order].concat((0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_2__["default"])(oList)));
return order;
}
@@ -558,7 +598,7 @@ function setAddressList(list) {
}
function addAddress(addr) {
var list = getAddressList();
var item = (0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2__["default"])((0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2__["default"])({}, addr), {}, {
var item = (0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3__["default"])((0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3__["default"])({}, addr), {}, {
id: 'ADR' + Date.now()
});
// 若设为默认,取消其他默认
@@ -567,7 +607,7 @@ function addAddress(addr) {
a.isDefault = false;
});
}
setAddressList([item].concat((0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_1__["default"])(list)));
setAddressList([item].concat((0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_2__["default"])(list)));
return item;
}
function updateAddress(id, patch) {
@@ -579,7 +619,7 @@ function updateAddress(id, patch) {
if (patch.isDefault) list.forEach(function (a) {
a.isDefault = false;
});
list[idx] = (0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2__["default"])((0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2__["default"])({}, list[idx]), patch);
list[idx] = (0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3__["default"])((0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3__["default"])({}, list[idx]), patch);
setAddressList(list);
}
function deleteAddress(id) {