255 lines
16 KiB
JavaScript
255 lines
16 KiB
JavaScript
"use strict";
|
|
(wx["webpackJsonp"] = wx["webpackJsonp"] || []).push([["pages/index/index"],{
|
|
|
|
/***/ "./node_modules/@tarojs/taro-loader/lib/entry-cache.js?name=pages/index/index!./src/pages/index/index.tsx":
|
|
/*!****************************************************************************************************************!*\
|
|
!*** ./node_modules/@tarojs/taro-loader/lib/entry-cache.js?name=pages/index/index!./src/pages/index/index.tsx ***!
|
|
\****************************************************************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ "default": function() { return /* binding */ Index; }
|
|
/* harmony export */ });
|
|
/* harmony import */ var F_weixin_wordc_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js */ "./node_modules/@babel/runtime/helpers/esm/slicedToArray.js");
|
|
/* harmony import */ var _tarojs_components__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @tarojs/components */ "./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.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 react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "./node_modules/react/cjs/react.production.min.js");
|
|
/* harmony import */ var _utils_productConfig__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utils/productConfig */ "./src/utils/productConfig.ts");
|
|
/* harmony import */ var _components_ThemeToggle__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../components/ThemeToggle */ "./src/components/ThemeToggle/index.tsx");
|
|
/* harmony import */ var _context_ThemeContext__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../context/ThemeContext */ "./src/context/ThemeContext.tsx");
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/cjs/react-jsx-runtime.production.min.js");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 成品展示配图(从 img 里取对应实物图)
|
|
|
|
var SHOWCASE_LIST = [{
|
|
title: '毕业纪念笔记本',
|
|
desc: '全班名字组成校徽',
|
|
image: '/img/book_small/The1.jpg'
|
|
}, {
|
|
title: '铜质杯垫',
|
|
desc: '金属质感桌面艺术',
|
|
image: '/img/cup/The1.jpg'
|
|
}, {
|
|
title: '竹制笔盒',
|
|
desc: '自然竹纹文房雅器',
|
|
image: '/img/penbox/The1.jpg'
|
|
}, {
|
|
title: '书本型灯',
|
|
desc: '温暖光影点亮心意',
|
|
image: '/img/booklight/The1.jpg'
|
|
}, {
|
|
title: '情侣定制礼',
|
|
desc: '两个人的名字交织',
|
|
image: '/img/book_big/The1.jpg'
|
|
}, {
|
|
title: '企业年会礼',
|
|
desc: '员工名字组成Logo',
|
|
image: '/img/penbox/The2.jpg'
|
|
}];
|
|
|
|
// 品类对应的实物照片映射(首页卡片顶部大图)
|
|
var PRODUCT_IMG_MAP = {
|
|
'notebook-small': '/img/book_small/The1.jpg',
|
|
'notebook-large': '/img/book_big/The1.jpg',
|
|
'coaster': '/img/cup/The1.jpg',
|
|
'penbox': '/img/penbox/The1.jpg',
|
|
'booklamp': '/img/booklight/The1.jpg'
|
|
};
|
|
function Index() {
|
|
var _useThemeContext = (0,_context_ThemeContext__WEBPACK_IMPORTED_MODULE_4__.useThemeContext)(),
|
|
theme = _useThemeContext.theme;
|
|
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(''),
|
|
_useState2 = (0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_6__["default"])(_useState, 2),
|
|
searchKey = _useState2[0],
|
|
setSearchKey = _useState2[1];
|
|
var navigateToProduct = function navigateToProduct(categoryId) {
|
|
_tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().navigateTo({
|
|
url: "/pages/product/index?id=".concat(categoryId)
|
|
});
|
|
};
|
|
var filteredCategories = searchKey.trim() ? _utils_productConfig__WEBPACK_IMPORTED_MODULE_2__.CATEGORIES.filter(function (c) {
|
|
return c.name.includes(searchKey) || c.desc.includes(searchKey);
|
|
}) : _utils_productConfig__WEBPACK_IMPORTED_MODULE_2__.CATEGORIES;
|
|
var handleSearch = function handleSearch(e) {
|
|
setSearchKey(e.detail.value);
|
|
};
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
|
className: "theme-".concat(theme),
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
|
className: "index-page",
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_components_ThemeToggle__WEBPACK_IMPORTED_MODULE_3__["default"], {}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
|
className: "header-bar",
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
|
className: "header-title",
|
|
children: "\u667A\u7ED8\u5FAE\u523B"
|
|
})
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
|
className: "search-card dashed-card",
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
|
className: "star-badge"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
|
className: "search-inner",
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Image, {
|
|
className: "search-icon-img",
|
|
src: "/icon/\u641C\u7D22.png",
|
|
mode: "aspectFit"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Input, {
|
|
className: "search-input",
|
|
type: "text",
|
|
placeholder: "\u641C\u7D22\u5B9A\u5236\u54C1\u7C7B\uFF1A\u7B14\u8BB0\u672C\u3001\u676F\u57AB\u3001\u4E66\u706F...",
|
|
value: searchKey,
|
|
onInput: handleSearch,
|
|
confirmType: "search"
|
|
})]
|
|
}), searchKey.trim() && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
|
className: "search-result-hint",
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
|
className: "hint-text",
|
|
children: filteredCategories.length > 0 ? "\u627E\u5230 ".concat(filteredCategories.length, " \u4E2A\u76F8\u5173\u54C1\u7C7B") : '没有找到相关品类,试试看其他关键词'
|
|
})
|
|
})]
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
|
className: "showcase-section mt-20",
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
|
className: "section-title",
|
|
children: "\u5B9A\u5236\u6210\u54C1\u5C55\u793A"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Swiper, {
|
|
className: "showcase-swiper",
|
|
indicatorColor: "#e0e0e0",
|
|
indicatorActiveColor: "#ff9a9e",
|
|
circular: true,
|
|
autoplay: true,
|
|
interval: 3000,
|
|
duration: 500,
|
|
previousMargin: "40rpx",
|
|
nextMargin: "40rpx",
|
|
indicatorDots: true,
|
|
children: SHOWCASE_LIST.map(function (item, idx) {
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.SwiperItem, {
|
|
className: "showcase-swiper-item",
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
|
className: "showcase-swiper-card dashed-card",
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
|
className: "star-badge"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
|
className: "showcase-image-wrapper",
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Image, {
|
|
className: "showcase-real-img",
|
|
src: item.image,
|
|
mode: "aspectFill"
|
|
})
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
|
className: "showcase-text-area",
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
|
className: "showcase-info",
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
|
className: "showcase-title",
|
|
children: item.title
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
|
className: "showcase-desc",
|
|
children: item.desc
|
|
})]
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
|
className: "showcase-tag",
|
|
children: "\u6210\u54C1\u6848\u4F8B"
|
|
})]
|
|
})]
|
|
})
|
|
}, idx);
|
|
})
|
|
})]
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
|
className: "category-section mt-20",
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
|
className: "section-title",
|
|
children: "\u70ED\u95E8\u54C1\u7C7B"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
|
className: "category-grid",
|
|
children: filteredCategories.map(function (cat) {
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
|
className: "category-item dashed-card",
|
|
onTap: function onTap() {
|
|
return navigateToProduct(cat.id);
|
|
},
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
|
className: "star-badge"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
|
className: "category-img-wrapper",
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Image, {
|
|
className: "category-img-real",
|
|
src: PRODUCT_IMG_MAP[cat.id] || '/icon/四角星.png',
|
|
mode: "aspectFill"
|
|
})
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
|
className: "category-name",
|
|
children: cat.name
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
|
className: "category-desc",
|
|
children: cat.desc
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
|
className: "category-price",
|
|
children: ["\xA5", cat.price, " \u8D77"]
|
|
})]
|
|
}, cat.id);
|
|
})
|
|
}), filteredCategories.length === 0 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
|
className: "empty-category dashed-card",
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Image, {
|
|
className: "empty-icon-img",
|
|
src: "/icon/\u641C\u7D22.png",
|
|
mode: "aspectFit"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
|
className: "empty-text",
|
|
children: "\u672A\u627E\u5230\u5339\u914D\u7684\u54C1\u7C7B"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
|
className: "empty-sub",
|
|
children: "\u5C1D\u8BD5\u641C\u7D22\u201C\u7B14\u8BB0\u672C\u201D\u3001\u201C\u676F\u57AB\u201D\u7B49"
|
|
})]
|
|
})]
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
|
className: "safe-bottom-placeholder"
|
|
})]
|
|
})
|
|
});
|
|
}
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./src/pages/index/index.tsx":
|
|
/*!***********************************!*\
|
|
!*** ./src/pages/index/index.tsx ***!
|
|
\***********************************/
|
|
/***/ (function(__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) {
|
|
|
|
/* harmony import */ var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @tarojs/runtime */ "./node_modules/@tarojs/runtime/dist/runtime.esm.js");
|
|
/* harmony import */ var _node_modules_tarojs_taro_loader_lib_entry_cache_js_name_pages_index_index_index_tsx__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! !!../../../node_modules/@tarojs/taro-loader/lib/entry-cache.js?name=pages/index/index!./index.tsx */ "./node_modules/@tarojs/taro-loader/lib/entry-cache.js?name=pages/index/index!./src/pages/index/index.tsx");
|
|
|
|
|
|
var config = {};
|
|
|
|
|
|
var inst = Page((0,_tarojs_runtime__WEBPACK_IMPORTED_MODULE_1__.createPageConfig)(_node_modules_tarojs_taro_loader_lib_entry_cache_js_name_pages_index_index_index_tsx__WEBPACK_IMPORTED_MODULE_0__["default"], 'pages/index/index', {root:{cn:[]}}, config || {}))
|
|
|
|
|
|
/* unused harmony default export */ var __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_tarojs_taro_loader_lib_entry_cache_js_name_pages_index_index_index_tsx__WEBPACK_IMPORTED_MODULE_0__["default"]);
|
|
|
|
|
|
/***/ })
|
|
|
|
},
|
|
/******/ function(__webpack_require__) { // webpackRuntimeModules
|
|
/******/ var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); }
|
|
/******/ __webpack_require__.O(0, ["taro","vendors","common"], function() { return __webpack_exec__("./src/pages/index/index.tsx"); });
|
|
/******/ var __webpack_exports__ = __webpack_require__.O();
|
|
/******/ }
|
|
]);
|
|
//# sourceMappingURL=index.js.map
|