针对个人主页与照片显示做了修改
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
20260727 1:47 问题优化:
|
<!-- 20260727 1:47 问题优化:
|
||||||
1.有做到主题黑板更换,但我想要的效果是不管在哪个页面点击交换的图标,整个小程序的所有画面主题都会改变,而不是只有当前页改变主题,关于主题的切换,背景不保留条纹,更改为纯色背景
|
1.有做到主题黑板更换,但我想要的效果是不管在哪个页面点击交换的图标,整个小程序的所有画面主题都会改变,而不是只有当前页改变主题,关于主题的切换,背景不保留条纹,更改为纯色背景
|
||||||
|
|
||||||
2.加入设计清单中有看到相关条例,不过内容无法及时更新,必须要重新编译代码才可以同步刚刚下单的信息
|
2.加入设计清单中有看到相关条例,不过内容无法及时更新,必须要重新编译代码才可以同步刚刚下单的信息
|
||||||
@@ -40,4 +40,18 @@
|
|||||||
五个状态
|
五个状态
|
||||||
待设计就是设计清单中,未设计和设计中的状态条目
|
待设计就是设计清单中,未设计和设计中的状态条目
|
||||||
待付款就是订单中,未付款的条目
|
待付款就是订单中,未付款的条目
|
||||||
后面三者意思不变
|
后面三者意思不变 -->
|
||||||
|
|
||||||
|
|
||||||
|
20260727 16:15 优化问题
|
||||||
|
|
||||||
|
1.完善个人主页的每个功能,我的设计点击后进入设计清单;收货地址,可以参考京东的地址页面,可以新增收获地址,每个收获地址条目可以执行删除复制和修改的操作,条目内容包括收货人姓名,手机号,地址和门牌号;设置页提供用户修改用户信息,退出登录,定制协议查看等入口和功能
|
||||||
|
|
||||||
|
2.个人首页现在无法切换白天黑夜的主题
|
||||||
|
|
||||||
|
3.照片依旧无法显示
|
||||||
|
|
||||||
|
4.个人主页中点击待设计,待付款等各个条目时没有跳转到对应页面
|
||||||
|
|
||||||
|
重要提醒:设计清单和订单以及我的个人主页页面,在未登录前应该全为空并提醒用户登录,因为未绑定私有账号信息,你暂时帮我实现一下用户数据库,让我可以看到每个用户的操作会有不同的账号信息和界面显示才对。
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ const config = {
|
|||||||
},
|
},
|
||||||
copy: {
|
copy: {
|
||||||
patterns: [
|
patterns: [
|
||||||
{ from: 'src/img', to: 'img' }
|
{ from: 'src/img', to: 'dist/img' }
|
||||||
],
|
],
|
||||||
options: {
|
options: {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ var react__WEBPACK_IMPORTED_MODULE_3___namespace_cache;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
var config = {"pages":["pages/index/index","pages/product/index","pages/diy/index","pages/checkout/index","pages/designList/index","pages/orders/index","pages/profile/index","pages/service/index","pages/wordcloud/index","pages/orderDetail/index"],"window":{"backgroundTextStyle":"light","navigationStyle":"custom","backgroundColor":"#ffffff"},"tabBar":{"custom":true,"list":[{"pagePath":"pages/index/index","text":"首页"},{"pagePath":"pages/designList/index","text":"设计清单"},{"pagePath":"pages/orders/index","text":"订单"},{"pagePath":"pages/profile/index","text":"我的"}]},"permission":{"scope.writePhotosAlbum":{"desc":"保存词云图片到相册"}}};
|
var config = {"pages":["pages/index/index","pages/product/index","pages/diy/index","pages/checkout/index","pages/designList/index","pages/orders/index","pages/profile/index","pages/service/index","pages/wordcloud/index","pages/orderDetail/index","pages/address/index","pages/settings/index","pages/agreement/index"],"window":{"backgroundTextStyle":"light","navigationStyle":"custom","backgroundColor":"#ffffff"},"tabBar":{"custom":true,"list":[{"pagePath":"pages/index/index","text":"首页"},{"pagePath":"pages/designList/index","text":"设计清单"},{"pagePath":"pages/orders/index","text":"订单"},{"pagePath":"pages/profile/index","text":"我的"}]},"permission":{"scope.writePhotosAlbum":{"desc":"保存词云图片到相册"}}};
|
||||||
_tarojs_runtime__WEBPACK_IMPORTED_MODULE_5__.window.__taroAppConfig = config
|
_tarojs_runtime__WEBPACK_IMPORTED_MODULE_5__.window.__taroAppConfig = config
|
||||||
var inst = App((0,_tarojs_plugin_framework_react_dist_runtime__WEBPACK_IMPORTED_MODULE_6__.createReactApp)(_node_modules_tarojs_taro_loader_lib_entry_cache_js_name_app_app_tsx__WEBPACK_IMPORTED_MODULE_2__["default"], /*#__PURE__*/ (react__WEBPACK_IMPORTED_MODULE_3___namespace_cache || (react__WEBPACK_IMPORTED_MODULE_3___namespace_cache = __webpack_require__.t(react__WEBPACK_IMPORTED_MODULE_3__, 2))), react_dom__WEBPACK_IMPORTED_MODULE_4__["default"], config))
|
var inst = App((0,_tarojs_plugin_framework_react_dist_runtime__WEBPACK_IMPORTED_MODULE_6__.createReactApp)(_node_modules_tarojs_taro_loader_lib_entry_cache_js_name_app_app_tsx__WEBPACK_IMPORTED_MODULE_2__["default"], /*#__PURE__*/ (react__WEBPACK_IMPORTED_MODULE_3___namespace_cache || (react__WEBPACK_IMPORTED_MODULE_3___namespace_cache = __webpack_require__.t(react__WEBPACK_IMPORTED_MODULE_3__, 2))), react_dom__WEBPACK_IMPORTED_MODULE_4__["default"], config))
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"pages":["pages/index/index","pages/product/index","pages/diy/index","pages/checkout/index","pages/designList/index","pages/orders/index","pages/profile/index","pages/service/index","pages/wordcloud/index","pages/orderDetail/index"],"window":{"backgroundTextStyle":"light","navigationStyle":"custom","backgroundColor":"#ffffff"},"tabBar":{"custom":true,"list":[{"pagePath":"pages/index/index","text":"首页"},{"pagePath":"pages/designList/index","text":"设计清单"},{"pagePath":"pages/orders/index","text":"订单"},{"pagePath":"pages/profile/index","text":"我的"}]},"permission":{"scope.writePhotosAlbum":{"desc":"保存词云图片到相册"}}}
|
{"pages":["pages/index/index","pages/product/index","pages/diy/index","pages/checkout/index","pages/designList/index","pages/orders/index","pages/profile/index","pages/service/index","pages/wordcloud/index","pages/orderDetail/index","pages/address/index","pages/settings/index","pages/agreement/index"],"window":{"backgroundTextStyle":"light","navigationStyle":"custom","backgroundColor":"#ffffff"},"tabBar":{"custom":true,"list":[{"pagePath":"pages/index/index","text":"首页"},{"pagePath":"pages/designList/index","text":"设计清单"},{"pagePath":"pages/orders/index","text":"订单"},{"pagePath":"pages/profile/index","text":"我的"}]},"permission":{"scope.writePhotosAlbum":{"desc":"保存词云图片到相册"}}}
|
||||||
@@ -73,6 +73,14 @@
|
|||||||
<input value="{{i.p24}}" type="{{xs.b(i.p23,'')}}" password="{{xs.b(i.p11,!1)}}" placeholder="{{i.p12}}" placeholder-style="{{i.p14}}" placeholder-class="{{xs.b(i.p13,'input-placeholder')}}" disabled="{{i.p7}}" maxlength="{{xs.b(i.p9,140)}}" cursor-spacing="{{xs.b(i.p6,0)}}" confirm-type="{{xs.b(i.p4,'done')}}" confirm-hold="{{xs.b(i.p3,!1)}}" cursor="{{xs.b(i.p5,i.p24?i.p24.length:-1)}}" selection-start="{{xs.b(i.p22,-1)}}" selection-end="{{xs.b(i.p21,-1)}}" bindinput="eh" bindfocus="eh" bindblur="eh" bindconfirm="eh" name="{{i.p10}}" always-embed="{{xs.b(i.p1,false)}}" adjust-position="{{xs.b(i.p0,true)}}" hold-keyboard="{{xs.b(i.p8,false)}}" safe-password-cert-path="{{i.p15}}" safe-password-length="{{i.p17}}" safe-password-time-stamp="{{i.p20}}" safe-password-nonce="{{i.p18}}" safe-password-salt="{{i.p19}}" safe-password-custom-hash="{{i.p16}}" auto-fill="{{i.p2}}" bindkeyboardheightchange="eh" bindnicknamereview="eh" style="{{i.st}}" class="{{i.cl}}" bindtap="eh" id="{{i.uid||i.sid}}" data-sid="{{i.sid}}"></input>
|
<input value="{{i.p24}}" type="{{xs.b(i.p23,'')}}" password="{{xs.b(i.p11,!1)}}" placeholder="{{i.p12}}" placeholder-style="{{i.p14}}" placeholder-class="{{xs.b(i.p13,'input-placeholder')}}" disabled="{{i.p7}}" maxlength="{{xs.b(i.p9,140)}}" cursor-spacing="{{xs.b(i.p6,0)}}" confirm-type="{{xs.b(i.p4,'done')}}" confirm-hold="{{xs.b(i.p3,!1)}}" cursor="{{xs.b(i.p5,i.p24?i.p24.length:-1)}}" selection-start="{{xs.b(i.p22,-1)}}" selection-end="{{xs.b(i.p21,-1)}}" bindinput="eh" bindfocus="eh" bindblur="eh" bindconfirm="eh" name="{{i.p10}}" always-embed="{{xs.b(i.p1,false)}}" adjust-position="{{xs.b(i.p0,true)}}" hold-keyboard="{{xs.b(i.p8,false)}}" safe-password-cert-path="{{i.p15}}" safe-password-length="{{i.p17}}" safe-password-time-stamp="{{i.p20}}" safe-password-nonce="{{i.p18}}" safe-password-salt="{{i.p19}}" safe-password-custom-hash="{{i.p16}}" auto-fill="{{i.p2}}" bindkeyboardheightchange="eh" bindnicknamereview="eh" style="{{i.st}}" class="{{i.cl}}" bindtap="eh" id="{{i.uid||i.sid}}" data-sid="{{i.sid}}"></input>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<template name="tmpl_0_50">
|
||||||
|
<picker mode="{{xs.b(i.p6,'selector')}}" disabled="{{i.p1}}" range="{{i.p8}}" range-key="{{i.p9}}" value="{{i.p11}}" start="{{i.p10}}" end="{{i.p2}}" fields="{{xs.b(i.p3,'day')}}" custom-item="{{i.p0}}" name="{{i.p7}}" bindcancel="eh" bindchange="eh" bindcolumnchange="eh" header-text="{{i.p4}}" level="{{xs.b(i.p5,region)}}" style="{{i.st}}" class="{{i.cl}}" bindtap="eh" id="{{i.uid||i.sid}}" data-sid="{{i.sid}}">
|
||||||
|
<block wx:for="{{i.cn}}" wx:key="sid">
|
||||||
|
<template is="{{xs.a(c, item.nn, l)}}" data="{{i:item,c:c+1,l:xs.f(l,item.nn)}}" />
|
||||||
|
</block>
|
||||||
|
</picker>
|
||||||
|
</template>
|
||||||
|
|
||||||
<template name="tmpl_0_71">
|
<template name="tmpl_0_71">
|
||||||
<template is="{{xs.c(i, 'tmpl_0_')}}" data="{{i:i,c:c}}" />
|
<template is="{{xs.c(i, 'tmpl_0_')}}" data="{{i:i,c:c}}" />
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,6 +1,54 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
(wx["webpackJsonp"] = wx["webpackJsonp"] || []).push([["common"],{
|
(wx["webpackJsonp"] = wx["webpackJsonp"] || []).push([["common"],{
|
||||||
|
|
||||||
|
/***/ "./src/components/LoginGuard/index.tsx":
|
||||||
|
/*!*********************************************!*\
|
||||||
|
!*** ./src/components/LoginGuard/index.tsx ***!
|
||||||
|
\*********************************************/
|
||||||
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
||||||
|
|
||||||
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
|
/* harmony export */ "default": function() { return /* binding */ LoginGuard; }
|
||||||
|
/* harmony export */ });
|
||||||
|
/* 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 _tarojs_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @tarojs/components */ "./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js");
|
||||||
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/cjs/react-jsx-runtime.production.min.js");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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, {
|
||||||
|
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"
|
||||||
|
})
|
||||||
|
})]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return props.children;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
/***/ "./src/components/ThemeToggle/index.tsx":
|
/***/ "./src/components/ThemeToggle/index.tsx":
|
||||||
/*!**********************************************!*\
|
/*!**********************************************!*\
|
||||||
!*** ./src/components/ThemeToggle/index.tsx ***!
|
!*** ./src/components/ThemeToggle/index.tsx ***!
|
||||||
@@ -10,30 +58,31 @@
|
|||||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
/* harmony export */ "default": function() { return /* binding */ ThemeToggle; }
|
/* harmony export */ "default": function() { return /* binding */ ThemeToggle; }
|
||||||
/* harmony export */ });
|
/* harmony export */ });
|
||||||
/* harmony import */ var _tarojs_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @tarojs/components */ "./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js");
|
/* harmony import */ var _tarojs_components__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @tarojs/components */ "./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js");
|
||||||
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/cjs/react.production.min.js");
|
/* harmony import */ var _tarojs_taro__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tarojs/taro */ "./node_modules/@tarojs/taro/index.js");
|
||||||
/* harmony import */ var _context_ThemeContext__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../context/ThemeContext */ "./src/context/ThemeContext.tsx");
|
/* harmony import */ var _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tarojs_taro__WEBPACK_IMPORTED_MODULE_0__);
|
||||||
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/cjs/react-jsx-runtime.production.min.js");
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "./node_modules/react/cjs/react.production.min.js");
|
||||||
|
/* harmony import */ var _context_ThemeContext__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../context/ThemeContext */ "./src/context/ThemeContext.tsx");
|
||||||
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/cjs/react-jsx-runtime.production.min.js");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function ThemeToggle() {
|
function ThemeToggle() {
|
||||||
var _useThemeContext = (0,_context_ThemeContext__WEBPACK_IMPORTED_MODULE_1__.useThemeContext)(),
|
var _useThemeContext = (0,_context_ThemeContext__WEBPACK_IMPORTED_MODULE_2__.useThemeContext)(),
|
||||||
theme = _useThemeContext.theme,
|
theme = _useThemeContext.theme,
|
||||||
toggleTheme = _useThemeContext.toggleTheme;
|
toggleTheme = _useThemeContext.toggleTheme;
|
||||||
var handleToggle = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function () {
|
var handleToggle = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(function () {
|
||||||
toggleTheme();
|
toggleTheme();
|
||||||
// 触发全局事件,让其他已挂载页面也能感知
|
// 触发全局事件,让其他页面也能感知(切换tab后回来的页面会重新读取storage)
|
||||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
_tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().eventCenter.trigger('theme:change');
|
||||||
var Taro = (__webpack_require__(/*! @tarojs/taro */ "./node_modules/@tarojs/taro/index.js")["default"]);
|
|
||||||
Taro.eventCenter.trigger('theme:storageChanged');
|
|
||||||
}, [toggleTheme]);
|
}, [toggleTheme]);
|
||||||
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_3__.View, {
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_4__.View, {
|
||||||
className: "theme-toggle",
|
className: "theme-toggle",
|
||||||
onClick: handleToggle,
|
onClick: handleToggle,
|
||||||
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_3__.Text, {
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_4__.Text, {
|
||||||
className: "theme-icon",
|
className: "theme-icon",
|
||||||
children: theme === 'light' ? '🌙' : '☀️'
|
children: theme === 'light' ? '🌙' : '☀️'
|
||||||
})
|
})
|
||||||
@@ -225,8 +274,12 @@ var getProductById = function getProductById(id) {
|
|||||||
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
||||||
|
|
||||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
|
/* harmony export */ addAddress: function() { return /* binding */ addAddress; },
|
||||||
/* harmony export */ addDesign: function() { return /* binding */ addDesign; },
|
/* harmony export */ addDesign: function() { return /* binding */ addDesign; },
|
||||||
|
/* harmony export */ clearUserInfo: function() { return /* binding */ clearUserInfo; },
|
||||||
|
/* harmony export */ deleteAddress: function() { return /* binding */ deleteAddress; },
|
||||||
/* harmony export */ designToOrder: function() { return /* binding */ designToOrder; },
|
/* harmony export */ designToOrder: function() { return /* binding */ designToOrder; },
|
||||||
|
/* harmony export */ getAddressList: function() { return /* binding */ getAddressList; },
|
||||||
/* harmony export */ getDesignList: function() { return /* binding */ getDesignList; },
|
/* harmony export */ getDesignList: function() { return /* binding */ getDesignList; },
|
||||||
/* harmony export */ getOrderList: function() { return /* binding */ getOrderList; },
|
/* harmony export */ getOrderList: function() { return /* binding */ getOrderList; },
|
||||||
/* harmony export */ getTheme: function() { return /* binding */ getTheme; },
|
/* harmony export */ getTheme: function() { return /* binding */ getTheme; },
|
||||||
@@ -234,9 +287,10 @@ var getProductById = function getProductById(id) {
|
|||||||
/* harmony export */ setDesignList: function() { return /* binding */ setDesignList; },
|
/* harmony export */ setDesignList: function() { return /* binding */ setDesignList; },
|
||||||
/* harmony export */ setTheme: function() { return /* binding */ setTheme; },
|
/* harmony export */ setTheme: function() { return /* binding */ setTheme; },
|
||||||
/* harmony export */ setUserInfo: function() { return /* binding */ setUserInfo; },
|
/* harmony export */ setUserInfo: function() { return /* binding */ setUserInfo; },
|
||||||
|
/* harmony export */ updateAddress: function() { return /* binding */ updateAddress; },
|
||||||
/* harmony export */ updateDesign: function() { return /* binding */ updateDesign; }
|
/* harmony export */ updateDesign: function() { return /* binding */ updateDesign; }
|
||||||
/* harmony export */ });
|
/* harmony export */ });
|
||||||
/* unused harmony export setOrderList */
|
/* unused harmony exports getUserInfoRaw, setUserInfoRaw, 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_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");
|
/* 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");
|
||||||
/* 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__ = __webpack_require__(/*! @tarojs/taro */ "./node_modules/@tarojs/taro/index.js");
|
||||||
@@ -244,41 +298,62 @@ var getProductById = function getProductById(id) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
var DESIGN_KEY = 'smart_design_list';
|
|
||||||
var ORDER_KEY = 'smart_order_list';
|
|
||||||
var USER_KEY = 'smart_user_info';
|
|
||||||
var THEME_KEY = 'smart_theme';
|
var THEME_KEY = 'smart_theme';
|
||||||
|
var USER_KEY = 'smart_user_info';
|
||||||
|
var ACTIVE_USER_KEY = 'smart_active_openid';
|
||||||
|
|
||||||
/** 获取设计清单 */
|
// ---------- 当前用户 openid 管理 ----------
|
||||||
var getDesignList = function getDesignList() {
|
|
||||||
|
function getActiveOpenid() {
|
||||||
|
var user = getUserInfoRaw();
|
||||||
|
var openid = (user === null || user === void 0 ? void 0 : user.openid) || _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().getStorageSync(ACTIVE_USER_KEY) || '_guest_';
|
||||||
|
_tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().setStorageSync(ACTIVE_USER_KEY, openid);
|
||||||
|
return openid;
|
||||||
|
}
|
||||||
|
function key(scope) {
|
||||||
|
var prefix = getActiveOpenid();
|
||||||
|
return "".concat(scope, "_").concat(prefix);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------- 用户数据 ----------
|
||||||
|
|
||||||
|
function getUserInfoRaw() {
|
||||||
try {
|
try {
|
||||||
return _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().getStorageSync(DESIGN_KEY) || [];
|
return _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().getStorageSync(USER_KEY);
|
||||||
} catch (_unused) {
|
} catch (_unused) {
|
||||||
return [];
|
return null;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
function setUserInfoRaw(info) {
|
||||||
|
_tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().setStorageSync(USER_KEY, info);
|
||||||
|
if (info !== null && info !== void 0 && info.openid) {
|
||||||
|
_tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().setStorageSync(ACTIVE_USER_KEY, info.openid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function clearUserInfo() {
|
||||||
|
_tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().removeStorageSync(USER_KEY);
|
||||||
|
_tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().removeStorageSync(ACTIVE_USER_KEY);
|
||||||
|
}
|
||||||
|
function setUserInfo(info) {
|
||||||
|
setUserInfoRaw(info);
|
||||||
|
}
|
||||||
|
function getUserInfo() {
|
||||||
|
return getUserInfoRaw();
|
||||||
|
}
|
||||||
|
|
||||||
/** 保存设计清单 */
|
// ---------- 设计清单 ----------
|
||||||
var setDesignList = function setDesignList(list) {
|
|
||||||
_tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().setStorageSync(DESIGN_KEY, list);
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 获取订单列表 */
|
function getDesignList() {
|
||||||
var getOrderList = function getOrderList() {
|
|
||||||
try {
|
try {
|
||||||
return _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().getStorageSync(ORDER_KEY) || [];
|
return _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().getStorageSync(key('design_list')) || [];
|
||||||
} catch (_unused2) {
|
} catch (_unused2) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
function setDesignList(list) {
|
||||||
/** 保存订单列表 */
|
_tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().setStorageSync(key('design_list'), list);
|
||||||
var setOrderList = function setOrderList(list) {
|
}
|
||||||
_tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().setStorageSync(ORDER_KEY, list);
|
function addDesign(product, count) {
|
||||||
};
|
|
||||||
|
|
||||||
/** 添加设计清单条目 */
|
|
||||||
var addDesign = function addDesign(product, count) {
|
|
||||||
var list = getDesignList();
|
var list = getDesignList();
|
||||||
var item = {
|
var item = {
|
||||||
id: 'DSG' + Date.now(),
|
id: 'DSG' + Date.now(),
|
||||||
@@ -292,10 +367,8 @@ var addDesign = function addDesign(product, count) {
|
|||||||
};
|
};
|
||||||
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_1__["default"])(list), [item]));
|
||||||
return item;
|
return item;
|
||||||
};
|
}
|
||||||
|
function updateDesign(id, patch) {
|
||||||
/** 更新设计清单条目 */
|
|
||||||
var updateDesign = function updateDesign(id, patch) {
|
|
||||||
var list = getDesignList();
|
var list = getDesignList();
|
||||||
var idx = list.findIndex(function (d) {
|
var idx = list.findIndex(function (d) {
|
||||||
return d.id === id;
|
return d.id === id;
|
||||||
@@ -303,10 +376,21 @@ var updateDesign = function updateDesign(id, patch) {
|
|||||||
if (idx === -1) return;
|
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_2__["default"])((0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2__["default"])({}, list[idx]), patch);
|
||||||
setDesignList(list);
|
setDesignList(list);
|
||||||
};
|
}
|
||||||
|
|
||||||
/** 设计转订单 */
|
// ---------- 订单 ----------
|
||||||
var designToOrder = function designToOrder(designId) {
|
|
||||||
|
function getOrderList() {
|
||||||
|
try {
|
||||||
|
return _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().getStorageSync(key('order_list')) || [];
|
||||||
|
} catch (_unused3) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function setOrderList(list) {
|
||||||
|
_tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().setStorageSync(key('order_list'), list);
|
||||||
|
}
|
||||||
|
function designToOrder(designId) {
|
||||||
var dList = getDesignList();
|
var dList = getDesignList();
|
||||||
var oList = getOrderList();
|
var oList = getOrderList();
|
||||||
var design = dList.find(function (d) {
|
var design = dList.find(function (d) {
|
||||||
@@ -328,8 +412,6 @@ var designToOrder = function designToOrder(designId) {
|
|||||||
count: design.count,
|
count: design.count,
|
||||||
sku: "".concat(design.productName, " \xD7 ").concat(design.count)
|
sku: "".concat(design.productName, " \xD7 ").concat(design.count)
|
||||||
};
|
};
|
||||||
|
|
||||||
// 更新 design 状态
|
|
||||||
var dIdx = dList.findIndex(function (d) {
|
var dIdx = dList.findIndex(function (d) {
|
||||||
return d.id === designId;
|
return d.id === designId;
|
||||||
});
|
});
|
||||||
@@ -340,32 +422,70 @@ var designToOrder = function designToOrder(designId) {
|
|||||||
setDesignList(dList);
|
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_1__["default"])(oList)));
|
||||||
return order;
|
return order;
|
||||||
};
|
}
|
||||||
|
|
||||||
/** 用户数据 */
|
// ---------- 主题 ----------
|
||||||
var getUserInfo = function getUserInfo() {
|
|
||||||
try {
|
|
||||||
return _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().getStorageSync(USER_KEY);
|
|
||||||
} catch (_unused3) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var setUserInfo = function setUserInfo(info) {
|
|
||||||
_tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().setStorageSync(USER_KEY, info);
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 主题 */
|
function getTheme() {
|
||||||
|
|
||||||
var getTheme = function getTheme() {
|
|
||||||
try {
|
try {
|
||||||
return _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().getStorageSync(THEME_KEY) || 'light';
|
return _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().getStorageSync(THEME_KEY) || 'light';
|
||||||
} catch (_unused4) {
|
} catch (_unused4) {
|
||||||
return 'light';
|
return 'light';
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
var setTheme = function setTheme(theme) {
|
function setTheme(theme) {
|
||||||
_tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().setStorageSync(THEME_KEY, theme);
|
_tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().setStorageSync(THEME_KEY, theme);
|
||||||
};
|
}
|
||||||
|
|
||||||
|
// ---------- 收货地址 ----------
|
||||||
|
|
||||||
|
function getAddressList() {
|
||||||
|
try {
|
||||||
|
return _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().getStorageSync(key('address_list')) || [];
|
||||||
|
} catch (_unused5) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function setAddressList(list) {
|
||||||
|
_tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().setStorageSync(key('address_list'), 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), {}, {
|
||||||
|
id: 'ADR' + Date.now()
|
||||||
|
});
|
||||||
|
// 若设为默认,取消其他默认
|
||||||
|
if (item.isDefault) {
|
||||||
|
list.forEach(function (a) {
|
||||||
|
a.isDefault = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
setAddressList([item].concat((0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_1__["default"])(list)));
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
function updateAddress(id, patch) {
|
||||||
|
var list = getAddressList();
|
||||||
|
var idx = list.findIndex(function (a) {
|
||||||
|
return a.id === id;
|
||||||
|
});
|
||||||
|
if (idx === -1) return;
|
||||||
|
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);
|
||||||
|
setAddressList(list);
|
||||||
|
}
|
||||||
|
function deleteAddress(id) {
|
||||||
|
var list = getAddressList().filter(function (a) {
|
||||||
|
return a.id !== id;
|
||||||
|
});
|
||||||
|
setAddressList(list);
|
||||||
|
}
|
||||||
|
function getDefaultAddress() {
|
||||||
|
return getAddressList().find(function (a) {
|
||||||
|
return a.isDefault;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/***/ })
|
/***/ })
|
||||||
|
|
||||||
|
|||||||
|
After Width: | Height: | Size: 8.7 MiB |
|
After Width: | Height: | Size: 10 MiB |
|
After Width: | Height: | Size: 2.4 MiB |
|
After Width: | Height: | Size: 161 KiB |
|
After Width: | Height: | Size: 524 KiB |
|
After Width: | Height: | Size: 274 KiB |
|
After Width: | Height: | Size: 12 MiB |
|
After Width: | Height: | Size: 12 MiB |
|
After Width: | Height: | Size: 199 KiB |
@@ -0,0 +1,350 @@
|
|||||||
|
"use strict";
|
||||||
|
(wx["webpackJsonp"] = wx["webpackJsonp"] || []).push([["pages/address/index"],{
|
||||||
|
|
||||||
|
/***/ "./node_modules/@tarojs/taro-loader/lib/entry-cache.js?name=pages/address/index!./src/pages/address/index.tsx":
|
||||||
|
/*!********************************************************************************************************************!*\
|
||||||
|
!*** ./node_modules/@tarojs/taro-loader/lib/entry-cache.js?name=pages/address/index!./src/pages/address/index.tsx ***!
|
||||||
|
\********************************************************************************************************************/
|
||||||
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
||||||
|
|
||||||
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
|
/* harmony export */ "default": function() { return /* binding */ AddressPage; }
|
||||||
|
/* 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_store__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utils/store */ "./src/utils/store.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");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function AddressPage() {
|
||||||
|
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),
|
||||||
|
list = _useState2[0],
|
||||||
|
setList = _useState2[1];
|
||||||
|
var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(null),
|
||||||
|
_useState4 = (0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_6__["default"])(_useState3, 2),
|
||||||
|
editing = _useState4[0],
|
||||||
|
setEditing = _useState4[1];
|
||||||
|
var _useState5 = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(false),
|
||||||
|
_useState6 = (0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_6__["default"])(_useState5, 2),
|
||||||
|
showForm = _useState6[0],
|
||||||
|
setShowForm = _useState6[1];
|
||||||
|
var _useState7 = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(''),
|
||||||
|
_useState8 = (0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_6__["default"])(_useState7, 2),
|
||||||
|
name = _useState8[0],
|
||||||
|
setName = _useState8[1];
|
||||||
|
var _useState9 = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(''),
|
||||||
|
_useState0 = (0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_6__["default"])(_useState9, 2),
|
||||||
|
phone = _useState0[0],
|
||||||
|
setPhone = _useState0[1];
|
||||||
|
var _useState1 = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)([]),
|
||||||
|
_useState10 = (0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_6__["default"])(_useState1, 2),
|
||||||
|
region = _useState10[0],
|
||||||
|
setRegion = _useState10[1];
|
||||||
|
var _useState11 = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(''),
|
||||||
|
_useState12 = (0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_6__["default"])(_useState11, 2),
|
||||||
|
detail = _useState12[0],
|
||||||
|
setDetail = _useState12[1];
|
||||||
|
var _useState13 = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(false),
|
||||||
|
_useState14 = (0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_6__["default"])(_useState13, 2),
|
||||||
|
isDefault = _useState14[0],
|
||||||
|
setIsDefault = _useState14[1];
|
||||||
|
var load = function load() {
|
||||||
|
return setList((0,_utils_store__WEBPACK_IMPORTED_MODULE_2__.getAddressList)());
|
||||||
|
};
|
||||||
|
(0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(function () {
|
||||||
|
load();
|
||||||
|
}, []);
|
||||||
|
var resetForm = function resetForm() {
|
||||||
|
setName('');
|
||||||
|
setPhone('');
|
||||||
|
setRegion([]);
|
||||||
|
setDetail('');
|
||||||
|
setIsDefault(false);
|
||||||
|
setEditing(null);
|
||||||
|
};
|
||||||
|
var openAdd = function openAdd() {
|
||||||
|
resetForm();
|
||||||
|
setShowForm(true);
|
||||||
|
};
|
||||||
|
var openEdit = function openEdit(item) {
|
||||||
|
setEditing(item);
|
||||||
|
setName(item.name);
|
||||||
|
setPhone(item.phone);
|
||||||
|
setRegion(item.region);
|
||||||
|
setDetail(item.detail);
|
||||||
|
setIsDefault(item.isDefault);
|
||||||
|
setShowForm(true);
|
||||||
|
};
|
||||||
|
var handleDelete = function handleDelete(id) {
|
||||||
|
_tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().showModal({
|
||||||
|
title: '确认删除',
|
||||||
|
content: '删除后将无法恢复该地址',
|
||||||
|
success: function success(res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
(0,_utils_store__WEBPACK_IMPORTED_MODULE_2__.deleteAddress)(id);
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
var handleCopy = function handleCopy(item) {
|
||||||
|
var text = "".concat(item.name, " ").concat(item.phone, "\n").concat(item.region.join(' '), " ").concat(item.detail);
|
||||||
|
_tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().setClipboardData({
|
||||||
|
data: text
|
||||||
|
});
|
||||||
|
};
|
||||||
|
var handleSave = function handleSave() {
|
||||||
|
if (!name.trim() || !phone.trim() || region.length === 0 || !detail.trim()) {
|
||||||
|
_tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().showToast({
|
||||||
|
title: '请填写完整信息',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var payload = {
|
||||||
|
name: name,
|
||||||
|
phone: phone,
|
||||||
|
region: region,
|
||||||
|
detail: detail,
|
||||||
|
isDefault: isDefault
|
||||||
|
};
|
||||||
|
if (editing) {
|
||||||
|
(0,_utils_store__WEBPACK_IMPORTED_MODULE_2__.updateAddress)(editing.id, payload);
|
||||||
|
} else {
|
||||||
|
(0,_utils_store__WEBPACK_IMPORTED_MODULE_2__.addAddress)(payload);
|
||||||
|
}
|
||||||
|
_tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().showToast({
|
||||||
|
title: '保存成功',
|
||||||
|
icon: 'success'
|
||||||
|
});
|
||||||
|
setShowForm(false);
|
||||||
|
resetForm();
|
||||||
|
load();
|
||||||
|
};
|
||||||
|
var onRegionChange = function onRegionChange(e) {
|
||||||
|
setRegion(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: "address-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__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
||||||
|
className: "page-header dashed-card mt-20",
|
||||||
|
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: "flex-between",
|
||||||
|
style: {
|
||||||
|
width: '100%'
|
||||||
|
},
|
||||||
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
||||||
|
className: "back-btn",
|
||||||
|
onClick: function onClick() {
|
||||||
|
return _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().navigateBack();
|
||||||
|
},
|
||||||
|
children: "\u2190"
|
||||||
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
||||||
|
className: "page-title",
|
||||||
|
children: "\u6536\u8D27\u5730\u5740"
|
||||||
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
||||||
|
style: {
|
||||||
|
width: '60px'
|
||||||
|
}
|
||||||
|
})]
|
||||||
|
})]
|
||||||
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
||||||
|
className: "address-list",
|
||||||
|
children: [list.map(function (item) {
|
||||||
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
||||||
|
className: "address-card dashed-card",
|
||||||
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
||||||
|
className: "address-header",
|
||||||
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
||||||
|
className: "address-user",
|
||||||
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
||||||
|
className: "address-name",
|
||||||
|
children: item.name
|
||||||
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
||||||
|
className: "address-phone",
|
||||||
|
children: item.phone
|
||||||
|
}), item.isDefault && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
||||||
|
className: "default-tag",
|
||||||
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
||||||
|
children: "\u9ED8\u8BA4"
|
||||||
|
})
|
||||||
|
})]
|
||||||
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
||||||
|
className: "address-full",
|
||||||
|
children: [item.region.join(' '), " ", item.detail]
|
||||||
|
})]
|
||||||
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
||||||
|
className: "address-actions",
|
||||||
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
||||||
|
className: "address-act",
|
||||||
|
onClick: function onClick() {
|
||||||
|
return openEdit(item);
|
||||||
|
},
|
||||||
|
children: "\u270F\uFE0F \u7F16\u8F91"
|
||||||
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
||||||
|
className: "address-act",
|
||||||
|
onClick: function onClick() {
|
||||||
|
return handleCopy(item);
|
||||||
|
},
|
||||||
|
children: "\uD83D\uDCCB \u590D\u5236"
|
||||||
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
||||||
|
className: "address-act delete",
|
||||||
|
onClick: function onClick() {
|
||||||
|
return handleDelete(item.id);
|
||||||
|
},
|
||||||
|
children: "\uD83D\uDDD1\uFE0F \u5220\u9664"
|
||||||
|
})]
|
||||||
|
})]
|
||||||
|
}, item.id);
|
||||||
|
}), list.length === 0 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
||||||
|
className: "empty-state",
|
||||||
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
||||||
|
className: "empty-icon",
|
||||||
|
children: "\uD83D\uDCCD"
|
||||||
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
||||||
|
className: "empty-text",
|
||||||
|
children: "\u8FD8\u6CA1\u6709\u6536\u8D27\u5730\u5740"
|
||||||
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
||||||
|
className: "empty-sub",
|
||||||
|
children: "\u70B9\u51FB\u4E0B\u65B9\u6309\u94AE\u6DFB\u52A0\u65B0\u5730\u5740"
|
||||||
|
})]
|
||||||
|
})]
|
||||||
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
||||||
|
className: "safe-bottom-placeholder"
|
||||||
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
||||||
|
className: "action-bar",
|
||||||
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
||||||
|
className: "btn-gradient",
|
||||||
|
onClick: openAdd,
|
||||||
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
||||||
|
children: "\u65B0\u589E\u6536\u8D27\u5730\u5740"
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}), showForm && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
||||||
|
className: "modal-overlay",
|
||||||
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
||||||
|
className: "modal-card dashed-card address-form",
|
||||||
|
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__.Text, {
|
||||||
|
className: "modal-title",
|
||||||
|
children: editing ? '编辑地址' : '新增地址'
|
||||||
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Input, {
|
||||||
|
className: "form-input",
|
||||||
|
placeholder: "\u6536\u8D27\u4EBA\u59D3\u540D",
|
||||||
|
value: name,
|
||||||
|
onInput: function onInput(e) {
|
||||||
|
return setName(e.detail.value);
|
||||||
|
}
|
||||||
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Input, {
|
||||||
|
className: "form-input",
|
||||||
|
placeholder: "\u624B\u673A\u53F7\u7801",
|
||||||
|
type: "number",
|
||||||
|
value: phone,
|
||||||
|
onInput: function onInput(e) {
|
||||||
|
return setPhone(e.detail.value);
|
||||||
|
}
|
||||||
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Picker, {
|
||||||
|
mode: "region",
|
||||||
|
value: region,
|
||||||
|
onChange: onRegionChange,
|
||||||
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
||||||
|
className: "form-picker",
|
||||||
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
||||||
|
className: region.length ? 'form-picker-val' : 'form-picker-ph',
|
||||||
|
children: region.length ? region.join(' / ') : '选择省 / 市 / 区'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Input, {
|
||||||
|
className: "form-input",
|
||||||
|
placeholder: "\u8BE6\u7EC6\u5730\u5740\uFF1A\u8857\u9053\u3001\u95E8\u724C\u53F7",
|
||||||
|
value: detail,
|
||||||
|
onInput: function onInput(e) {
|
||||||
|
return setDetail(e.detail.value);
|
||||||
|
}
|
||||||
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
||||||
|
className: "form-row",
|
||||||
|
onClick: function onClick() {
|
||||||
|
return setIsDefault(!isDefault);
|
||||||
|
},
|
||||||
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
||||||
|
className: "form-label",
|
||||||
|
children: "\u8BBE\u4E3A\u9ED8\u8BA4\u5730\u5740"
|
||||||
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
||||||
|
className: "checkbox ".concat(isDefault ? 'checked' : '')
|
||||||
|
})]
|
||||||
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
||||||
|
className: "form-actions",
|
||||||
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
||||||
|
className: "btn-outline",
|
||||||
|
onClick: function onClick() {
|
||||||
|
setShowForm(false);
|
||||||
|
resetForm();
|
||||||
|
},
|
||||||
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
||||||
|
children: "\u53D6\u6D88"
|
||||||
|
})
|
||||||
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
||||||
|
className: "btn-gradient",
|
||||||
|
onClick: handleSave,
|
||||||
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
||||||
|
children: "\u4FDD\u5B58"
|
||||||
|
})
|
||||||
|
})]
|
||||||
|
})]
|
||||||
|
})
|
||||||
|
})]
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ "./src/pages/address/index.tsx":
|
||||||
|
/*!*************************************!*\
|
||||||
|
!*** ./src/pages/address/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_address_index_index_tsx__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! !!../../../node_modules/@tarojs/taro-loader/lib/entry-cache.js?name=pages/address/index!./index.tsx */ "./node_modules/@tarojs/taro-loader/lib/entry-cache.js?name=pages/address/index!./src/pages/address/index.tsx");
|
||||||
|
|
||||||
|
|
||||||
|
var config = {"navigationBarTitleText":"收货地址"};
|
||||||
|
|
||||||
|
|
||||||
|
var inst = Page((0,_tarojs_runtime__WEBPACK_IMPORTED_MODULE_1__.createPageConfig)(_node_modules_tarojs_taro_loader_lib_entry_cache_js_name_pages_address_index_index_tsx__WEBPACK_IMPORTED_MODULE_0__["default"], 'pages/address/index', {root:{cn:[]}}, config || {}))
|
||||||
|
|
||||||
|
|
||||||
|
/* unused harmony default export */ var __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_tarojs_taro_loader_lib_entry_cache_js_name_pages_address_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/address/index.tsx"); });
|
||||||
|
/******/ var __webpack_exports__ = __webpack_require__.O();
|
||||||
|
/******/ }
|
||||||
|
]);
|
||||||
|
//# sourceMappingURL=index.js.map
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"navigationBarTitleText":"收货地址","usingComponents":{"comp":"../../comp"}}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
<import src="../../base.wxml"/>
|
||||||
|
<template is="taro_tmpl" data="{{root:root}}" />
|
||||||
@@ -0,0 +1,217 @@
|
|||||||
|
/*!****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
|
||||||
|
!*** css ./node_modules/@tarojs/webpack5-runner/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[0].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[0].use[2]!./node_modules/resolve-url-loader/index.js!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[0].use[4]!./src/pages/address/index.scss ***!
|
||||||
|
\****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/
|
||||||
|
@charset "UTF-8";
|
||||||
|
.address-page {
|
||||||
|
padding: 0 24rpx 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.back-btn {
|
||||||
|
font-size: 40rpx;
|
||||||
|
padding: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.address-list {
|
||||||
|
margin-top: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.address-card {
|
||||||
|
padding: 24rpx;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.address-header {
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.address-user {
|
||||||
|
display: -webkit-flex;
|
||||||
|
display: -ms-flexbox;
|
||||||
|
display: flex;
|
||||||
|
-webkit-align-items: center;
|
||||||
|
-ms-flex-align: center;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.address-name {
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--text-primary);
|
||||||
|
margin-right: 16rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.address-phone {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.default-tag {
|
||||||
|
margin-left: 12rpx;
|
||||||
|
background: var(--accent-pink);
|
||||||
|
color: #fff;
|
||||||
|
font-size: 20rpx;
|
||||||
|
padding: 2rpx 10rpx;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.address-full {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.address-actions {
|
||||||
|
display: -webkit-flex;
|
||||||
|
display: -ms-flexbox;
|
||||||
|
display: flex;
|
||||||
|
-webkit-justify-content: flex-end;
|
||||||
|
-ms-flex-pack: end;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 24rpx;
|
||||||
|
padding-top: 16rpx;
|
||||||
|
border-top: 1rpx dashed rgba(0, 0, 0, 0.06);
|
||||||
|
}
|
||||||
|
|
||||||
|
.address-act {
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: var(--accent-blue);
|
||||||
|
}
|
||||||
|
|
||||||
|
.address-act.delete {
|
||||||
|
color: #ff6b6b;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 表单弹窗 */
|
||||||
|
.address-form {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 600rpx;
|
||||||
|
padding: 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-input {
|
||||||
|
width: 100%;
|
||||||
|
height: 80rpx;
|
||||||
|
background: var(--bg-input);
|
||||||
|
border: 3rpx dashed var(--line-star);
|
||||||
|
border-radius: 16rpx;
|
||||||
|
padding: 0 24rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: var(--text-primary);
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-picker {
|
||||||
|
width: 100%;
|
||||||
|
height: 80rpx;
|
||||||
|
background: var(--bg-input);
|
||||||
|
border: 3rpx dashed var(--line-star);
|
||||||
|
border-radius: 16rpx;
|
||||||
|
display: -webkit-flex;
|
||||||
|
display: -ms-flexbox;
|
||||||
|
display: flex;
|
||||||
|
-webkit-align-items: center;
|
||||||
|
-ms-flex-align: center;
|
||||||
|
align-items: center;
|
||||||
|
padding: 0 24rpx;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-picker-val {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: var(--text-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-picker-ph {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-row {
|
||||||
|
display: -webkit-flex;
|
||||||
|
display: -ms-flexbox;
|
||||||
|
display: flex;
|
||||||
|
-webkit-align-items: center;
|
||||||
|
-ms-flex-align: center;
|
||||||
|
align-items: center;
|
||||||
|
-webkit-justify-content: space-between;
|
||||||
|
-ms-flex-pack: justify;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-bottom: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-label {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: var(--text-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkbox {
|
||||||
|
width: 44rpx;
|
||||||
|
height: 44rpx;
|
||||||
|
border: 3rpx dashed var(--line-star);
|
||||||
|
border-radius: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkbox.checked {
|
||||||
|
background: var(--accent-pink);
|
||||||
|
border-color: var(--accent-pink);
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-actions {
|
||||||
|
display: -webkit-flex;
|
||||||
|
display: -ms-flexbox;
|
||||||
|
display: flex;
|
||||||
|
gap: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-actions .btn-outline,
|
||||||
|
.form-actions .btn-gradient {
|
||||||
|
-webkit-flex: 1;
|
||||||
|
-ms-flex: 1;
|
||||||
|
flex: 1;
|
||||||
|
padding: 20rpx 0;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 空状态统一的在 app.scss */
|
||||||
|
.login-guard {
|
||||||
|
display: -webkit-flex;
|
||||||
|
display: -ms-flexbox;
|
||||||
|
display: flex;
|
||||||
|
-webkit-flex-direction: column;
|
||||||
|
-ms-flex-direction: column;
|
||||||
|
flex-direction: column;
|
||||||
|
-webkit-align-items: center;
|
||||||
|
-ms-flex-align: center;
|
||||||
|
align-items: center;
|
||||||
|
-webkit-justify-content: center;
|
||||||
|
-ms-flex-pack: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 120rpx 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-guard-icon {
|
||||||
|
font-size: 80rpx;
|
||||||
|
margin-bottom: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-guard-title {
|
||||||
|
font-size: 36rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--text-primary);
|
||||||
|
margin-bottom: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-guard-desc {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
margin-bottom: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-guard-btn {
|
||||||
|
padding: 20rpx 48rpx;
|
||||||
|
}
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
"use strict";
|
||||||
|
(wx["webpackJsonp"] = wx["webpackJsonp"] || []).push([["pages/agreement/index"],{
|
||||||
|
|
||||||
|
/***/ "./node_modules/@tarojs/taro-loader/lib/entry-cache.js?name=pages/agreement/index!./src/pages/agreement/index.tsx":
|
||||||
|
/*!************************************************************************************************************************!*\
|
||||||
|
!*** ./node_modules/@tarojs/taro-loader/lib/entry-cache.js?name=pages/agreement/index!./src/pages/agreement/index.tsx ***!
|
||||||
|
\************************************************************************************************************************/
|
||||||
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
||||||
|
|
||||||
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
|
/* harmony export */ "default": function() { return /* binding */ AgreementPage; }
|
||||||
|
/* harmony export */ });
|
||||||
|
/* harmony import */ var _tarojs_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @tarojs/components */ "./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js");
|
||||||
|
/* harmony import */ var _components_ThemeToggle__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../components/ThemeToggle */ "./src/components/ThemeToggle/index.tsx");
|
||||||
|
/* harmony import */ var _context_ThemeContext__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../context/ThemeContext */ "./src/context/ThemeContext.tsx");
|
||||||
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/cjs/react-jsx-runtime.production.min.js");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function AgreementPage() {
|
||||||
|
var _useThemeContext = (0,_context_ThemeContext__WEBPACK_IMPORTED_MODULE_1__.useThemeContext)(),
|
||||||
|
theme = _useThemeContext.theme;
|
||||||
|
var SECTIONS = [{
|
||||||
|
title: '一、用户权责',
|
||||||
|
content: '用户确认提交的设计内容不侵犯第三方知识产权,定制商品一经确认下单即进入生产流程,非质量问题不支持退换。'
|
||||||
|
}, {
|
||||||
|
title: '二、隐私保护',
|
||||||
|
content: '我们严格保护用户个人信息,头像与昵称仅用于提升服务体验,不与第三方分享。'
|
||||||
|
}, {
|
||||||
|
title: '三、售后说明',
|
||||||
|
content: '收到商品后如有质量问题,请在7天内联系客服,我们将为您免费重做或退款。'
|
||||||
|
}, {
|
||||||
|
title: '四、定制流程',
|
||||||
|
content: "1. \u9009\u62E9\u5546\u54C1\u54C1\u7C7B\u5E76\u52A0\u5165\u8BBE\u8BA1\u6E05\u5355\n2. \u5728DIY\u5DE5\u4F5C\u53F0\u4E0A\u4F20\u56FE\u7247\u6216\u8F93\u5165\u6587\u5B57\n3. \u786E\u8BA4\u8BBE\u8BA1\u6548\u679C\u5E76\u63D0\u4EA4\u8BA2\u5355\n4. \u652F\u4ED8\u540E\u8FDB\u5165\u751F\u4EA7\uFF0C\u7EA63-7\u4E2A\u5DE5\u4F5C\u65E5\u53D1\u8D27\n5. \u7269\u6D41\u8DDF\u8E2A\u81F3\u786E\u8BA4\u6536\u8D27"
|
||||||
|
}];
|
||||||
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_3__.View, {
|
||||||
|
className: "theme-".concat(theme),
|
||||||
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_3__.View, {
|
||||||
|
className: "agreement-page",
|
||||||
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_components_ThemeToggle__WEBPACK_IMPORTED_MODULE_0__["default"], {}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_3__.View, {
|
||||||
|
className: "agreement-content",
|
||||||
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_3__.Text, {
|
||||||
|
className: "agreement-title",
|
||||||
|
children: "\u5B9A\u5236\u534F\u8BAE"
|
||||||
|
}), SECTIONS.map(function (sec, idx) {
|
||||||
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_3__.View, {
|
||||||
|
className: "agreement-section",
|
||||||
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_3__.Text, {
|
||||||
|
className: "agreement-h3",
|
||||||
|
children: sec.title
|
||||||
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_3__.Text, {
|
||||||
|
className: "agreement-p",
|
||||||
|
children: sec.content
|
||||||
|
})]
|
||||||
|
}, idx);
|
||||||
|
})]
|
||||||
|
})]
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ "./src/pages/agreement/index.tsx":
|
||||||
|
/*!***************************************!*\
|
||||||
|
!*** ./src/pages/agreement/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_agreement_index_index_tsx__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! !!../../../node_modules/@tarojs/taro-loader/lib/entry-cache.js?name=pages/agreement/index!./index.tsx */ "./node_modules/@tarojs/taro-loader/lib/entry-cache.js?name=pages/agreement/index!./src/pages/agreement/index.tsx");
|
||||||
|
|
||||||
|
|
||||||
|
var config = {"navigationBarTitleText":"定制协议"};
|
||||||
|
|
||||||
|
|
||||||
|
var inst = Page((0,_tarojs_runtime__WEBPACK_IMPORTED_MODULE_1__.createPageConfig)(_node_modules_tarojs_taro_loader_lib_entry_cache_js_name_pages_agreement_index_index_tsx__WEBPACK_IMPORTED_MODULE_0__["default"], 'pages/agreement/index', {root:{cn:[]}}, config || {}))
|
||||||
|
|
||||||
|
|
||||||
|
/* unused harmony default export */ var __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_tarojs_taro_loader_lib_entry_cache_js_name_pages_agreement_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/agreement/index.tsx"); });
|
||||||
|
/******/ var __webpack_exports__ = __webpack_require__.O();
|
||||||
|
/******/ }
|
||||||
|
]);
|
||||||
|
//# sourceMappingURL=index.js.map
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"pages/agreement/index.js","mappings":";;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;AC7CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","sources":["webpack://smart-engraving-miniapp/./src/pages/agreement/index.tsx?6fa1","webpack://smart-engraving-miniapp/._src_pages_agreement_index.tsx"],"sourcesContent":["import { View, Text } from '@tarojs/components';\nimport './index.scss';\nimport ThemeToggle from '../../components/ThemeToggle';\nimport { useThemeContext } from '../../context/ThemeContext';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport default function AgreementPage() {\n var _useThemeContext = useThemeContext(),\n theme = _useThemeContext.theme;\n var SECTIONS = [{\n title: '一、用户权责',\n content: '用户确认提交的设计内容不侵犯第三方知识产权,定制商品一经确认下单即进入生产流程,非质量问题不支持退换。'\n }, {\n title: '二、隐私保护',\n content: '我们严格保护用户个人信息,头像与昵称仅用于提升服务体验,不与第三方分享。'\n }, {\n title: '三、售后说明',\n content: '收到商品后如有质量问题,请在7天内联系客服,我们将为您免费重做或退款。'\n }, {\n title: '四、定制流程',\n content: \"1. \\u9009\\u62E9\\u5546\\u54C1\\u54C1\\u7C7B\\u5E76\\u52A0\\u5165\\u8BBE\\u8BA1\\u6E05\\u5355\\n2. \\u5728DIY\\u5DE5\\u4F5C\\u53F0\\u4E0A\\u4F20\\u56FE\\u7247\\u6216\\u8F93\\u5165\\u6587\\u5B57\\n3. \\u786E\\u8BA4\\u8BBE\\u8BA1\\u6548\\u679C\\u5E76\\u63D0\\u4EA4\\u8BA2\\u5355\\n4. \\u652F\\u4ED8\\u540E\\u8FDB\\u5165\\u751F\\u4EA7\\uFF0C\\u7EA63-7\\u4E2A\\u5DE5\\u4F5C\\u65E5\\u53D1\\u8D27\\n5. \\u7269\\u6D41\\u8DDF\\u8E2A\\u81F3\\u786E\\u8BA4\\u6536\\u8D27\"\n }];\n return /*#__PURE__*/_jsx(View, {\n className: \"theme-\".concat(theme),\n children: /*#__PURE__*/_jsxs(View, {\n className: \"agreement-page\",\n children: [/*#__PURE__*/_jsx(ThemeToggle, {}), /*#__PURE__*/_jsxs(View, {\n className: \"agreement-content\",\n children: [/*#__PURE__*/_jsx(Text, {\n className: \"agreement-title\",\n children: \"\\u5B9A\\u5236\\u534F\\u8BAE\"\n }), SECTIONS.map(function (sec, idx) {\n return /*#__PURE__*/_jsxs(View, {\n className: \"agreement-section\",\n children: [/*#__PURE__*/_jsx(Text, {\n className: \"agreement-h3\",\n children: sec.title\n }), /*#__PURE__*/_jsx(Text, {\n className: \"agreement-p\",\n children: sec.content\n })]\n }, idx);\n })]\n })]\n })\n });\n}","import { createPageConfig } from '@tarojs/runtime'\nimport component from \"!!../../../node_modules/@tarojs/taro-loader/lib/entry-cache.js?name=pages/agreement/index!./index.tsx\"\nvar config = {\"navigationBarTitleText\":\"定制协议\"};\n\n\nvar inst = Page(createPageConfig(component, 'pages/agreement/index', {root:{cn:[]}}, config || {}))\n\n\nexport default component\n"],"names":[],"sourceRoot":""}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"navigationBarTitleText":"定制协议","usingComponents":{"comp":"../../comp"}}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
<import src="../../base.wxml"/>
|
||||||
|
<template is="taro_tmpl" data="{{root:root}}" />
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
/*!******************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
|
||||||
|
!*** css ./node_modules/@tarojs/webpack5-runner/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[0].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[0].use[2]!./node_modules/resolve-url-loader/index.js!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[0].use[4]!./src/pages/agreement/index.scss ***!
|
||||||
|
\******************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/
|
||||||
|
.agreement-page {
|
||||||
|
padding: 0 24rpx 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.agreement-title {
|
||||||
|
font-size: 40rpx;
|
||||||
|
font-weight: 800;
|
||||||
|
color: var(--text-primary);
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 32rpx;
|
||||||
|
padding-top: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.agreement-content {
|
||||||
|
padding: 40rpx 32rpx;
|
||||||
|
line-height: 1.8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.agreement-section {
|
||||||
|
margin-bottom: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.agreement-h3 {
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--text-primary);
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 16rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.agreement-p {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
line-height: 1.8;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
@@ -10,15 +10,17 @@
|
|||||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
/* harmony export */ "default": function() { return /* binding */ DesignListPage; }
|
/* harmony export */ "default": function() { return /* binding */ DesignListPage; }
|
||||||
/* harmony export */ });
|
/* 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 F_weixin_wordc_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_7__ = __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_components__WEBPACK_IMPORTED_MODULE_8__ = __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__ = __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 _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 react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "./node_modules/react/cjs/react.production.min.js");
|
||||||
/* harmony import */ var _utils_store__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utils/store */ "./src/utils/store.ts");
|
/* harmony import */ var _utils_store__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utils/store */ "./src/utils/store.ts");
|
||||||
/* harmony import */ var _components_ThemeToggle__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../components/ThemeToggle */ "./src/components/ThemeToggle/index.tsx");
|
/* 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 _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");
|
/* harmony import */ var _components_LoginGuard__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../components/LoginGuard */ "./src/components/LoginGuard/index.tsx");
|
||||||
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/cjs/react-jsx-runtime.production.min.js");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -31,6 +33,9 @@
|
|||||||
var STATUS_TABS = [{
|
var STATUS_TABS = [{
|
||||||
code: 'all',
|
code: 'all',
|
||||||
label: '全部'
|
label: '全部'
|
||||||
|
}, {
|
||||||
|
code: 'toDesign',
|
||||||
|
label: '待设计'
|
||||||
}, {
|
}, {
|
||||||
code: 'undesigned',
|
code: 'undesigned',
|
||||||
label: '未设计'
|
label: '未设计'
|
||||||
@@ -59,33 +64,44 @@ function DesignListPage() {
|
|||||||
var _useThemeContext = (0,_context_ThemeContext__WEBPACK_IMPORTED_MODULE_4__.useThemeContext)(),
|
var _useThemeContext = (0,_context_ThemeContext__WEBPACK_IMPORTED_MODULE_4__.useThemeContext)(),
|
||||||
theme = _useThemeContext.theme;
|
theme = _useThemeContext.theme;
|
||||||
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)('all'),
|
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)('all'),
|
||||||
_useState2 = (0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_6__["default"])(_useState, 2),
|
_useState2 = (0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_7__["default"])(_useState, 2),
|
||||||
activeTab = _useState2[0],
|
activeTab = _useState2[0],
|
||||||
setActiveTab = _useState2[1];
|
setActiveTab = _useState2[1];
|
||||||
var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)([]),
|
var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)([]),
|
||||||
_useState4 = (0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_6__["default"])(_useState3, 2),
|
_useState4 = (0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_7__["default"])(_useState3, 2),
|
||||||
list = _useState4[0],
|
list = _useState4[0],
|
||||||
setList = _useState4[1];
|
setList = _useState4[1];
|
||||||
var load = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(function () {
|
var load = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(function () {
|
||||||
setList((0,_utils_store__WEBPACK_IMPORTED_MODULE_2__.getDesignList)());
|
setList((0,_utils_store__WEBPACK_IMPORTED_MODULE_2__.getDesignList)());
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// 页面每次显示时刷新(保证加入清单后切回能看到最新数据)
|
// 自动读取外部传入的筛选状态
|
||||||
|
var init = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(function () {
|
||||||
|
var filter = _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().getStorageSync('designList:filter');
|
||||||
|
if (filter && STATUS_TABS.some(function (t) {
|
||||||
|
return t.code === filter;
|
||||||
|
})) {
|
||||||
|
setActiveTab(filter);
|
||||||
|
_tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().removeStorageSync('designList:filter');
|
||||||
|
}
|
||||||
|
load();
|
||||||
|
}, [load]);
|
||||||
|
|
||||||
|
// 页面每次显示时刷新
|
||||||
(0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(function () {
|
(0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(function () {
|
||||||
var onShow = function onShow() {
|
|
||||||
return load();
|
|
||||||
};
|
|
||||||
var page = _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().getCurrentInstance().page;
|
var page = _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().getCurrentInstance().page;
|
||||||
if (page) {
|
if (page) {
|
||||||
var orig = page.onShow;
|
var orig = page.onShow;
|
||||||
page.onShow = function () {
|
page.onShow = function () {
|
||||||
onShow();
|
init();
|
||||||
if (orig) orig.apply(this);
|
if (orig) orig.apply(this);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
load();
|
init();
|
||||||
}, [load]);
|
}, [init]);
|
||||||
var filtered = activeTab === 'all' ? list : list.filter(function (d) {
|
var filtered = activeTab === 'all' ? list : activeTab === 'toDesign' ? list.filter(function (d) {
|
||||||
|
return d.status === 'undesigned' || d.status === 'designing';
|
||||||
|
}) : list.filter(function (d) {
|
||||||
return d.status === activeTab;
|
return d.status === activeTab;
|
||||||
});
|
});
|
||||||
var goDesign = function goDesign(item) {
|
var goDesign = function goDesign(item) {
|
||||||
@@ -100,123 +116,125 @@ function DesignListPage() {
|
|||||||
url: "/pages/diy/index?source=designList&designId=".concat(item.id)
|
url: "/pages/diy/index?source=designList&designId=".concat(item.id)
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "theme-".concat(theme),
|
className: "theme-".concat(theme),
|
||||||
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_components_LoginGuard__WEBPACK_IMPORTED_MODULE_5__["default"], {
|
||||||
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "design-page",
|
className: "design-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__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_components_ThemeToggle__WEBPACK_IMPORTED_MODULE_3__["default"], {}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "page-header dashed-card mt-20",
|
className: "page-header dashed-card mt-20",
|
||||||
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "star-badge"
|
className: "star-badge"
|
||||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
className: "page-title",
|
className: "page-title",
|
||||||
children: "\u6211\u7684\u8BBE\u8BA1\u6E05\u5355"
|
children: "\u6211\u7684\u8BBE\u8BA1\u6E05\u5355"
|
||||||
})]
|
})]
|
||||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "status-tabs",
|
className: "status-tabs",
|
||||||
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.ScrollView, {
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.ScrollView, {
|
||||||
className: "tabs-scroll",
|
className: "tabs-scroll",
|
||||||
scrollX: true,
|
scrollX: true,
|
||||||
children: STATUS_TABS.map(function (tab) {
|
children: STATUS_TABS.map(function (tab) {
|
||||||
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "tab-item ".concat(activeTab === tab.code ? 'active' : ''),
|
className: "tab-item ".concat(activeTab === tab.code ? 'active' : ''),
|
||||||
onClick: function onClick() {
|
onClick: function onClick() {
|
||||||
return setActiveTab(tab.code);
|
return setActiveTab(tab.code);
|
||||||
},
|
},
|
||||||
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
className: "tab-label",
|
className: "tab-label",
|
||||||
children: tab.label
|
children: tab.label
|
||||||
}), activeTab === tab.code && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
}), activeTab === tab.code && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "tab-underline"
|
className: "tab-underline"
|
||||||
})]
|
})]
|
||||||
}, tab.code);
|
}, tab.code);
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.ScrollView, {
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.ScrollView, {
|
||||||
className: "design-list",
|
className: "design-list",
|
||||||
scrollY: true,
|
scrollY: true,
|
||||||
children: [filtered.map(function (item) {
|
children: [filtered.map(function (item) {
|
||||||
var style = STATUS_STYLE[item.status];
|
var style = STATUS_STYLE[item.status];
|
||||||
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "design-card dashed-card",
|
className: "design-card dashed-card",
|
||||||
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "star-badge"
|
className: "star-badge"
|
||||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "design-body",
|
className: "design-body",
|
||||||
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
className: "design-icon",
|
className: "design-icon",
|
||||||
children: item.productIcon
|
children: item.productIcon
|
||||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "design-info",
|
className: "design-info",
|
||||||
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "design-title-row",
|
className: "design-title-row",
|
||||||
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
className: "design-name",
|
className: "design-name",
|
||||||
children: item.productName
|
children: item.productName
|
||||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
className: "badge ".concat(style.cls),
|
className: "badge ".concat(style.cls),
|
||||||
children: style.label
|
children: style.label
|
||||||
})]
|
})]
|
||||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
className: "design-meta",
|
className: "design-meta",
|
||||||
children: ["\u6570\u91CF: ", item.count, " \u4EF6 | \u5355\u4EF7: \xA5", item.unitPrice]
|
children: ["\u6570\u91CF: ", item.count, " \u4EF6 | \u5355\u4EF7: \xA5", item.unitPrice]
|
||||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
className: "design-total",
|
className: "design-total",
|
||||||
children: ["\u5C0F\u8BA1: \xA5", (item.unitPrice * item.count).toFixed(2)]
|
children: ["\u5C0F\u8BA1: \xA5", (item.unitPrice * item.count).toFixed(2)]
|
||||||
})]
|
})]
|
||||||
})]
|
})]
|
||||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "design-actions",
|
className: "design-actions",
|
||||||
children: [item.status !== 'ordered' && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
children: [item.status !== 'ordered' && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "btn-gradient design-btn",
|
className: "btn-gradient design-btn",
|
||||||
onClick: function onClick() {
|
onClick: function onClick() {
|
||||||
return goDesign(item);
|
return goDesign(item);
|
||||||
},
|
},
|
||||||
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
children: item.status === 'undesigned' ? '开始设计' : '继续设计'
|
children: item.status === 'undesigned' ? '开始设计' : '继续设计'
|
||||||
})
|
})
|
||||||
}), item.status === 'ordered' && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
}), item.status === 'ordered' && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "btn-outline design-btn",
|
className: "btn-outline design-btn",
|
||||||
onClick: function onClick() {
|
onClick: function onClick() {
|
||||||
return _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().switchTab({
|
return _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().switchTab({
|
||||||
url: '/pages/orders/index'
|
url: '/pages/orders/index'
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
children: "\u67E5\u770B\u8BA2\u5355"
|
children: "\u67E5\u770B\u8BA2\u5355"
|
||||||
})
|
})
|
||||||
})]
|
})]
|
||||||
})]
|
})]
|
||||||
}, item.id);
|
}, item.id);
|
||||||
}), filtered.length === 0 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
}), filtered.length === 0 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "empty-state",
|
className: "empty-state",
|
||||||
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
className: "empty-icon",
|
className: "empty-icon",
|
||||||
children: "\uD83D\uDCD0"
|
children: "\uD83D\uDCD0"
|
||||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
className: "empty-text",
|
className: "empty-text",
|
||||||
children: "\u8FD8\u6CA1\u6709\u8BBE\u8BA1\u6E05\u5355"
|
children: "\u8FD8\u6CA1\u6709\u8BBE\u8BA1\u6E05\u5355"
|
||||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
className: "empty-sub",
|
className: "empty-sub",
|
||||||
children: "\u53BB\u9996\u9875\u901B\u901B\uFF0C\u627E\u5230\u559C\u6B22\u7684\u5B9A\u5236\u54C1"
|
children: "\u53BB\u9996\u9875\u901B\u901B\uFF0C\u627E\u5230\u559C\u6B22\u7684\u5B9A\u5236\u54C1"
|
||||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "btn-gradient",
|
className: "btn-gradient",
|
||||||
onClick: function onClick() {
|
onClick: function onClick() {
|
||||||
return _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().switchTab({
|
return _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().switchTab({
|
||||||
url: '/pages/index/index'
|
url: '/pages/index/index'
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
children: "\u53BB\u901B\u901B"
|
children: "\u53BB\u901B\u901B"
|
||||||
})
|
})
|
||||||
})]
|
})]
|
||||||
})]
|
})]
|
||||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
style: {
|
style: {
|
||||||
height: '40px'
|
height: '40px'
|
||||||
}
|
}
|
||||||
})]
|
})]
|
||||||
})
|
})
|
||||||
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,15 +10,17 @@
|
|||||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
/* harmony export */ "default": function() { return /* binding */ OrdersPage; }
|
/* harmony export */ "default": function() { return /* binding */ OrdersPage; }
|
||||||
/* harmony export */ });
|
/* 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 F_weixin_wordc_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_7__ = __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_components__WEBPACK_IMPORTED_MODULE_8__ = __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__ = __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 _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 react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "./node_modules/react/cjs/react.production.min.js");
|
||||||
/* harmony import */ var _utils_store__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utils/store */ "./src/utils/store.ts");
|
/* harmony import */ var _utils_store__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utils/store */ "./src/utils/store.ts");
|
||||||
/* harmony import */ var _components_ThemeToggle__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../components/ThemeToggle */ "./src/components/ThemeToggle/index.tsx");
|
/* 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 _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");
|
/* harmony import */ var _components_LoginGuard__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../components/LoginGuard */ "./src/components/LoginGuard/index.tsx");
|
||||||
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/cjs/react-jsx-runtime.production.min.js");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -70,11 +72,11 @@ function OrdersPage() {
|
|||||||
var _useThemeContext = (0,_context_ThemeContext__WEBPACK_IMPORTED_MODULE_4__.useThemeContext)(),
|
var _useThemeContext = (0,_context_ThemeContext__WEBPACK_IMPORTED_MODULE_4__.useThemeContext)(),
|
||||||
theme = _useThemeContext.theme;
|
theme = _useThemeContext.theme;
|
||||||
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)('all'),
|
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)('all'),
|
||||||
_useState2 = (0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_6__["default"])(_useState, 2),
|
_useState2 = (0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_7__["default"])(_useState, 2),
|
||||||
activeTab = _useState2[0],
|
activeTab = _useState2[0],
|
||||||
setActiveTab = _useState2[1];
|
setActiveTab = _useState2[1];
|
||||||
var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)([]),
|
var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)([]),
|
||||||
_useState4 = (0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_6__["default"])(_useState3, 2),
|
_useState4 = (0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_7__["default"])(_useState3, 2),
|
||||||
orders = _useState4[0],
|
orders = _useState4[0],
|
||||||
setOrders = _useState4[1];
|
setOrders = _useState4[1];
|
||||||
var load = function load() {
|
var load = function load() {
|
||||||
@@ -124,105 +126,106 @@ function OrdersPage() {
|
|||||||
url: "/pages/orderDetail/index?orderId=".concat(order.id)
|
url: "/pages/orderDetail/index?orderId=".concat(order.id)
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "theme-".concat(theme),
|
className: "theme-".concat(theme),
|
||||||
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_components_LoginGuard__WEBPACK_IMPORTED_MODULE_5__["default"], {
|
||||||
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "orders-page",
|
className: "orders-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__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_components_ThemeToggle__WEBPACK_IMPORTED_MODULE_3__["default"], {}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "page-header dashed-card mt-20",
|
className: "page-header dashed-card mt-20",
|
||||||
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "star-badge"
|
className: "star-badge"
|
||||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
className: "page-title",
|
className: "page-title",
|
||||||
children: "\u6211\u7684\u8BA2\u5355"
|
children: "\u6211\u7684\u8BA2\u5355"
|
||||||
})]
|
})]
|
||||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "status-tabs",
|
className: "status-tabs",
|
||||||
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.ScrollView, {
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.ScrollView, {
|
||||||
className: "tabs-scroll",
|
className: "tabs-scroll",
|
||||||
scrollX: true,
|
scrollX: true,
|
||||||
children: STATUS_TABS.map(function (tab) {
|
children: STATUS_TABS.map(function (tab) {
|
||||||
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "tab-item ".concat(activeTab === tab.code ? 'active' : ''),
|
className: "tab-item ".concat(activeTab === tab.code ? 'active' : ''),
|
||||||
onClick: function onClick() {
|
onClick: function onClick() {
|
||||||
return setActiveTab(tab.code);
|
return setActiveTab(tab.code);
|
||||||
},
|
},
|
||||||
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
className: "tab-label",
|
className: "tab-label",
|
||||||
children: tab.label
|
children: tab.label
|
||||||
}), activeTab === tab.code && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
}), activeTab === tab.code && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "tab-underline"
|
className: "tab-underline"
|
||||||
})]
|
})]
|
||||||
}, tab.code);
|
}, tab.code);
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.ScrollView, {
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.ScrollView, {
|
||||||
className: "orders-list",
|
className: "orders-list",
|
||||||
scrollY: true,
|
scrollY: true,
|
||||||
children: [filteredOrders.map(function (order) {
|
children: [filteredOrders.map(function (order) {
|
||||||
var status = STATUS_MAP[order.statusCode] || STATUS_MAP.pending;
|
var status = STATUS_MAP[order.statusCode] || STATUS_MAP.pending;
|
||||||
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "order-card dashed-card",
|
className: "order-card dashed-card",
|
||||||
onClick: function onClick() {
|
onClick: function onClick() {
|
||||||
return goDetail(order);
|
return goDetail(order);
|
||||||
},
|
},
|
||||||
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "star-badge"
|
className: "star-badge"
|
||||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "order-header",
|
className: "order-header",
|
||||||
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
className: "order-date",
|
className: "order-date",
|
||||||
children: order.date
|
children: order.date
|
||||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
className: "badge ".concat(status.badge),
|
className: "badge ".concat(status.badge),
|
||||||
children: status.label
|
children: status.label
|
||||||
})]
|
})]
|
||||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "order-body",
|
className: "order-body",
|
||||||
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "order-icon-wrapper",
|
className: "order-icon-wrapper",
|
||||||
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
className: "order-icon",
|
className: "order-icon",
|
||||||
children: order.productIcon
|
children: order.productIcon
|
||||||
})
|
})
|
||||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "order-info",
|
className: "order-info",
|
||||||
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
className: "order-product",
|
className: "order-product",
|
||||||
children: order.productName
|
children: order.productName
|
||||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
className: "order-sku",
|
className: "order-sku",
|
||||||
children: order.sku
|
children: order.sku
|
||||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
className: "order-meta",
|
className: "order-meta",
|
||||||
children: ["\u6570\u91CF: ", order.count, " \u4EF6 | ", order.id]
|
children: ["\u6570\u91CF: ", order.count, " \u4EF6 | ", order.id]
|
||||||
})]
|
})]
|
||||||
})]
|
})]
|
||||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "order-footer",
|
className: "order-footer",
|
||||||
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "order-price-bar",
|
className: "order-price-bar",
|
||||||
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
className: "price-label",
|
className: "price-label",
|
||||||
children: "\u5B9E\u4ED8\u6B3E"
|
children: "\u5B9E\u4ED8\u6B3E"
|
||||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
className: "price-value",
|
className: "price-value",
|
||||||
children: order.price
|
children: order.price
|
||||||
})]
|
})]
|
||||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "order-actions",
|
className: "order-actions",
|
||||||
children: [order.statusCode === 'pending' && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
children: [order.statusCode === 'pending' && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "btn-gradient order-btn",
|
className: "btn-gradient order-btn",
|
||||||
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
children: "\u7ACB\u5373\u4ED8\u6B3E"
|
children: "\u7ACB\u5373\u4ED8\u6B3E"
|
||||||
})
|
})
|
||||||
}), order.statusCode === 'paid' && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
}), order.statusCode === 'paid' && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "btn-outline order-btn",
|
className: "btn-outline order-btn",
|
||||||
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
children: "\u50AC\u53D1\u8D27"
|
children: "\u50AC\u53D1\u8D27"
|
||||||
})
|
})
|
||||||
}), order.statusCode === 'shipping' && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.Fragment, {
|
}), order.statusCode === 'shipping' && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.Fragment, {
|
||||||
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "btn-outline order-btn",
|
className: "btn-outline order-btn",
|
||||||
onClick: function onClick(e) {
|
onClick: function onClick(e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
@@ -231,10 +234,10 @@ function OrdersPage() {
|
|||||||
icon: 'none'
|
icon: 'none'
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
children: "\u67E5\u770B\u7269\u6D41"
|
children: "\u67E5\u770B\u7269\u6D41"
|
||||||
})
|
})
|
||||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "btn-gradient order-btn",
|
className: "btn-gradient order-btn",
|
||||||
onClick: function onClick(e) {
|
onClick: function onClick(e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
@@ -243,12 +246,12 @@ function OrdersPage() {
|
|||||||
icon: 'none'
|
icon: 'none'
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
children: "\u786E\u8BA4\u6536\u8D27"
|
children: "\u786E\u8BA4\u6536\u8D27"
|
||||||
})
|
})
|
||||||
})]
|
})]
|
||||||
}), order.statusCode === 'done' && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.Fragment, {
|
}), order.statusCode === 'done' && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.Fragment, {
|
||||||
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "btn-outline order-btn",
|
className: "btn-outline order-btn",
|
||||||
onClick: function onClick(e) {
|
onClick: function onClick(e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
@@ -257,10 +260,10 @@ function OrdersPage() {
|
|||||||
icon: 'none'
|
icon: 'none'
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
children: "\u7533\u8BF7\u552E\u540E"
|
children: "\u7533\u8BF7\u552E\u540E"
|
||||||
})
|
})
|
||||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "btn-gradient order-btn",
|
className: "btn-gradient order-btn",
|
||||||
onClick: function onClick(e) {
|
onClick: function onClick(e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
@@ -269,52 +272,53 @@ function OrdersPage() {
|
|||||||
icon: 'none'
|
icon: 'none'
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
children: "\u518D\u6765\u4E00\u5355"
|
children: "\u518D\u6765\u4E00\u5355"
|
||||||
})
|
})
|
||||||
})]
|
})]
|
||||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "btn-outline order-btn",
|
className: "btn-outline order-btn",
|
||||||
onClick: function onClick(e) {
|
onClick: function onClick(e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
goDetail(order);
|
goDetail(order);
|
||||||
},
|
},
|
||||||
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
children: "\u8BE6\u60C5"
|
children: "\u8BE6\u60C5"
|
||||||
})
|
})
|
||||||
})]
|
})]
|
||||||
})]
|
})]
|
||||||
})]
|
})]
|
||||||
}, order.id);
|
}, order.id);
|
||||||
}), filteredOrders.length === 0 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
}), filteredOrders.length === 0 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "empty-state",
|
className: "empty-state",
|
||||||
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
className: "empty-icon",
|
className: "empty-icon",
|
||||||
children: "\uD83D\uDCE6"
|
children: "\uD83D\uDCE6"
|
||||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
className: "empty-text",
|
className: "empty-text",
|
||||||
children: "\u6682\u65E0\u8BA2\u5355"
|
children: "\u6682\u65E0\u8BA2\u5355"
|
||||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
className: "empty-sub",
|
className: "empty-sub",
|
||||||
children: "\u53BB\u9996\u9875\u5F00\u59CB\u5B9A\u5236\u5427"
|
children: "\u53BB\u9996\u9875\u5F00\u59CB\u5B9A\u5236\u5427"
|
||||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
className: "btn-gradient",
|
className: "btn-gradient",
|
||||||
onClick: function onClick() {
|
onClick: function onClick() {
|
||||||
return _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().switchTab({
|
return _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().switchTab({
|
||||||
url: '/pages/index/index'
|
url: '/pages/index/index'
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
children: "\u53BB\u5B9A\u5236"
|
children: "\u53BB\u5B9A\u5236"
|
||||||
})
|
})
|
||||||
})]
|
})]
|
||||||
})]
|
})]
|
||||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
style: {
|
style: {
|
||||||
height: '40px'
|
height: '40px'
|
||||||
}
|
}
|
||||||
})]
|
})]
|
||||||
})
|
})
|
||||||
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ var MENU_ITEMS = [{
|
|||||||
}, {
|
}, {
|
||||||
icon: '📍',
|
icon: '📍',
|
||||||
label: '收货地址',
|
label: '收货地址',
|
||||||
path: ''
|
path: '/pages/address/index'
|
||||||
}, {
|
}, {
|
||||||
icon: '📞',
|
icon: '📞',
|
||||||
label: '联系客服',
|
label: '联系客服',
|
||||||
@@ -47,11 +47,11 @@ var MENU_ITEMS = [{
|
|||||||
}, {
|
}, {
|
||||||
icon: '📋',
|
icon: '📋',
|
||||||
label: '使用帮助',
|
label: '使用帮助',
|
||||||
path: ''
|
path: '/pages/agreement/index'
|
||||||
}, {
|
}, {
|
||||||
icon: '⚙️',
|
icon: '⚙️',
|
||||||
label: '设置',
|
label: '设置',
|
||||||
path: ''
|
path: '/pages/settings/index'
|
||||||
}];
|
}];
|
||||||
function ProfilePage() {
|
function ProfilePage() {
|
||||||
var _useThemeContext = (0,_context_ThemeContext__WEBPACK_IMPORTED_MODULE_4__.useThemeContext)(),
|
var _useThemeContext = (0,_context_ThemeContext__WEBPACK_IMPORTED_MODULE_4__.useThemeContext)(),
|
||||||
@@ -171,6 +171,7 @@ function ProfilePage() {
|
|||||||
}
|
}
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'toDesign':
|
case 'toDesign':
|
||||||
|
_tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().setStorageSync('designList:filter', 'toDesign');
|
||||||
_tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().switchTab({
|
_tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().switchTab({
|
||||||
url: '/pages/designList/index'
|
url: '/pages/designList/index'
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,290 @@
|
|||||||
|
"use strict";
|
||||||
|
(wx["webpackJsonp"] = wx["webpackJsonp"] || []).push([["pages/settings/index"],{
|
||||||
|
|
||||||
|
/***/ "./node_modules/@tarojs/taro-loader/lib/entry-cache.js?name=pages/settings/index!./src/pages/settings/index.tsx":
|
||||||
|
/*!**********************************************************************************************************************!*\
|
||||||
|
!*** ./node_modules/@tarojs/taro-loader/lib/entry-cache.js?name=pages/settings/index!./src/pages/settings/index.tsx ***!
|
||||||
|
\**********************************************************************************************************************/
|
||||||
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
||||||
|
|
||||||
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
|
/* harmony export */ "default": function() { return /* binding */ SettingsPage; }
|
||||||
|
/* harmony export */ });
|
||||||
|
/* harmony import */ var F_weixin_wordc_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_7__ = __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_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_8__ = __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 _components_ThemeToggle__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../components/ThemeToggle */ "./src/components/ThemeToggle/index.tsx");
|
||||||
|
/* harmony import */ var _context_ThemeContext__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../context/ThemeContext */ "./src/context/ThemeContext.tsx");
|
||||||
|
/* harmony import */ var _utils_store__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils/store */ "./src/utils/store.ts");
|
||||||
|
/* 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");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function SettingsPage() {
|
||||||
|
var _useThemeContext = (0,_context_ThemeContext__WEBPACK_IMPORTED_MODULE_3__.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),
|
||||||
|
user = _useState2[0],
|
||||||
|
setUser = _useState2[1];
|
||||||
|
var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(''),
|
||||||
|
_useState4 = (0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_6__["default"])(_useState3, 2),
|
||||||
|
editName = _useState4[0],
|
||||||
|
setEditName = _useState4[1];
|
||||||
|
var _useState5 = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(''),
|
||||||
|
_useState6 = (0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_6__["default"])(_useState5, 2),
|
||||||
|
editAvatar = _useState6[0],
|
||||||
|
setEditAvatar = _useState6[1];
|
||||||
|
var _useState7 = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(false),
|
||||||
|
_useState8 = (0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_6__["default"])(_useState7, 2),
|
||||||
|
showEdit = _useState8[0],
|
||||||
|
setShowEdit = _useState8[1];
|
||||||
|
var loadUser = function loadUser() {
|
||||||
|
var u = (0,_utils_store__WEBPACK_IMPORTED_MODULE_4__.getUserInfo)() || {};
|
||||||
|
setUser(u);
|
||||||
|
setEditName(u.nickName || '');
|
||||||
|
setEditAvatar(u.avatarUrl || '');
|
||||||
|
};
|
||||||
|
(0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(function () {
|
||||||
|
loadUser();
|
||||||
|
}, []);
|
||||||
|
var handleSaveInfo = function handleSaveInfo() {
|
||||||
|
(0,_utils_store__WEBPACK_IMPORTED_MODULE_4__.setUserInfo)((0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_7__["default"])((0,F_weixin_wordc_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_7__["default"])({}, user), {}, {
|
||||||
|
nickName: editName,
|
||||||
|
avatarUrl: editAvatar
|
||||||
|
}));
|
||||||
|
_tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().showToast({
|
||||||
|
title: '修改成功',
|
||||||
|
icon: 'success'
|
||||||
|
});
|
||||||
|
setShowEdit(false);
|
||||||
|
loadUser();
|
||||||
|
};
|
||||||
|
var handleLogout = function handleLogout() {
|
||||||
|
_tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().showModal({
|
||||||
|
title: '确认退出',
|
||||||
|
content: '退出后将清空当前登录状态,确定吗?',
|
||||||
|
success: function success(res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
(0,_utils_store__WEBPACK_IMPORTED_MODULE_4__.clearUserInfo)();
|
||||||
|
_tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().switchTab({
|
||||||
|
url: '/pages/index/index'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
var onChooseAvatar = function onChooseAvatar(e) {
|
||||||
|
setEditAvatar(e.detail.avatarUrl || '');
|
||||||
|
};
|
||||||
|
var MENU = [{
|
||||||
|
label: '个人信息',
|
||||||
|
icon: '👤',
|
||||||
|
action: function action() {
|
||||||
|
return setShowEdit(true);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
label: '定制协议',
|
||||||
|
icon: '📋',
|
||||||
|
action: function action() {
|
||||||
|
return _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().navigateTo({
|
||||||
|
url: '/pages/agreement/index'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
label: '关于我们',
|
||||||
|
icon: 'ℹ️',
|
||||||
|
action: function action() {
|
||||||
|
return _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().showToast({
|
||||||
|
title: '智绘微刻 v1.0',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
|
className: "theme-".concat(theme),
|
||||||
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
|
className: "settings-page",
|
||||||
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_components_ThemeToggle__WEBPACK_IMPORTED_MODULE_2__["default"], {}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
|
className: "page-header dashed-card mt-20",
|
||||||
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
|
className: "star-badge"
|
||||||
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
|
className: "flex-between",
|
||||||
|
style: {
|
||||||
|
width: '100%'
|
||||||
|
},
|
||||||
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
|
className: "back-btn",
|
||||||
|
onClick: function onClick() {
|
||||||
|
return _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().navigateBack();
|
||||||
|
},
|
||||||
|
children: "\u2190"
|
||||||
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
|
className: "page-title",
|
||||||
|
children: "\u8BBE\u7F6E"
|
||||||
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
|
style: {
|
||||||
|
width: '60px'
|
||||||
|
}
|
||||||
|
})]
|
||||||
|
})]
|
||||||
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
|
className: "settings-user dashed-card mt-20",
|
||||||
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
|
className: "flex-between",
|
||||||
|
onClick: function onClick() {
|
||||||
|
return setShowEdit(true);
|
||||||
|
},
|
||||||
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
|
className: "flex-center",
|
||||||
|
children: [user.avatarUrl ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Image, {
|
||||||
|
className: "settings-avatar",
|
||||||
|
src: user.avatarUrl,
|
||||||
|
mode: "aspectFill"
|
||||||
|
}) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
|
className: "settings-avatar-placeholder",
|
||||||
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
|
children: "\uD83D\uDC64"
|
||||||
|
})
|
||||||
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
|
style: {
|
||||||
|
marginLeft: '20px'
|
||||||
|
},
|
||||||
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
|
className: "settings-name",
|
||||||
|
children: user.nickName || '未登录'
|
||||||
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
|
className: "settings-id",
|
||||||
|
children: ["ID: ", user.openid ? user.openid.slice(-8) : '---']
|
||||||
|
})]
|
||||||
|
})]
|
||||||
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
|
className: "arrow",
|
||||||
|
children: "\u203A"
|
||||||
|
})]
|
||||||
|
})
|
||||||
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
|
className: "settings-list dashed-card mt-20",
|
||||||
|
children: MENU.map(function (item, idx) {
|
||||||
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
|
className: "settings-item ".concat(idx < MENU.length - 1 ? 'bordered' : ''),
|
||||||
|
onClick: item.action,
|
||||||
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
|
className: "settings-item-icon",
|
||||||
|
children: item.icon
|
||||||
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
|
className: "settings-item-label",
|
||||||
|
children: item.label
|
||||||
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
|
className: "arrow",
|
||||||
|
children: "\u203A"
|
||||||
|
})]
|
||||||
|
}, idx);
|
||||||
|
})
|
||||||
|
}), (user === null || user === void 0 ? void 0 : user.openid) && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
|
className: "mt-20",
|
||||||
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
|
className: "btn-outline logout-btn",
|
||||||
|
onClick: handleLogout,
|
||||||
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
|
children: "\u9000\u51FA\u767B\u5F55"
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
|
style: {
|
||||||
|
height: '40px'
|
||||||
|
}
|
||||||
|
}), showEdit && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
|
className: "modal-overlay",
|
||||||
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
|
className: "modal-card dashed-card",
|
||||||
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
|
className: "star-badge"
|
||||||
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
|
className: "modal-title",
|
||||||
|
children: "\u4FEE\u6539\u4FE1\u606F"
|
||||||
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Button, {
|
||||||
|
className: "avatar-btn",
|
||||||
|
openType: "chooseAvatar",
|
||||||
|
onChooseAvatar: onChooseAvatar,
|
||||||
|
children: editAvatar ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Image, {
|
||||||
|
className: "avatar-img",
|
||||||
|
src: editAvatar,
|
||||||
|
mode: "aspectFill"
|
||||||
|
}) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
|
className: "avatar-placeholder",
|
||||||
|
children: "\u70B9\u51FB\u9009\u62E9\u5934\u50CF"
|
||||||
|
})
|
||||||
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Input, {
|
||||||
|
className: "nickname-input",
|
||||||
|
placeholder: "\u8BF7\u8F93\u5165\u6635\u79F0",
|
||||||
|
value: editName,
|
||||||
|
onInput: function onInput(e) {
|
||||||
|
return setEditName(e.detail.value);
|
||||||
|
}
|
||||||
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
|
className: "form-actions",
|
||||||
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
|
className: "btn-outline",
|
||||||
|
onClick: function onClick() {
|
||||||
|
return setShowEdit(false);
|
||||||
|
},
|
||||||
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
|
children: "\u53D6\u6D88"
|
||||||
|
})
|
||||||
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.View, {
|
||||||
|
className: "btn-gradient",
|
||||||
|
onClick: handleSaveInfo,
|
||||||
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
|
||||||
|
children: "\u4FDD\u5B58"
|
||||||
|
})
|
||||||
|
})]
|
||||||
|
})]
|
||||||
|
})
|
||||||
|
})]
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ "./src/pages/settings/index.tsx":
|
||||||
|
/*!**************************************!*\
|
||||||
|
!*** ./src/pages/settings/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_settings_index_index_tsx__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! !!../../../node_modules/@tarojs/taro-loader/lib/entry-cache.js?name=pages/settings/index!./index.tsx */ "./node_modules/@tarojs/taro-loader/lib/entry-cache.js?name=pages/settings/index!./src/pages/settings/index.tsx");
|
||||||
|
|
||||||
|
|
||||||
|
var config = {"navigationBarTitleText":"设置"};
|
||||||
|
|
||||||
|
|
||||||
|
var inst = Page((0,_tarojs_runtime__WEBPACK_IMPORTED_MODULE_1__.createPageConfig)(_node_modules_tarojs_taro_loader_lib_entry_cache_js_name_pages_settings_index_index_tsx__WEBPACK_IMPORTED_MODULE_0__["default"], 'pages/settings/index', {root:{cn:[]}}, config || {}))
|
||||||
|
|
||||||
|
|
||||||
|
/* unused harmony default export */ var __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_tarojs_taro_loader_lib_entry_cache_js_name_pages_settings_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/settings/index.tsx"); });
|
||||||
|
/******/ var __webpack_exports__ = __webpack_require__.O();
|
||||||
|
/******/ }
|
||||||
|
]);
|
||||||
|
//# sourceMappingURL=index.js.map
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"navigationBarTitleText":"设置","usingComponents":{"comp":"../../comp"}}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
<import src="../../base.wxml"/>
|
||||||
|
<template is="taro_tmpl" data="{{root:root}}" />
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
/*!*****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
|
||||||
|
!*** css ./node_modules/@tarojs/webpack5-runner/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[0].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[0].use[2]!./node_modules/resolve-url-loader/index.js!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[0].use[4]!./src/pages/settings/index.scss ***!
|
||||||
|
\*****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/
|
||||||
|
@charset "UTF-8";
|
||||||
|
.settings-page {
|
||||||
|
padding: 0 24rpx 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings-user {
|
||||||
|
padding: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings-avatar {
|
||||||
|
width: 100rpx;
|
||||||
|
height: 100rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
border: 3rpx dashed var(--line-star);
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings-avatar-placeholder {
|
||||||
|
width: 100rpx;
|
||||||
|
height: 100rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: var(--bg-input);
|
||||||
|
border: 3rpx dashed var(--line-star);
|
||||||
|
display: -webkit-flex;
|
||||||
|
display: -ms-flexbox;
|
||||||
|
display: flex;
|
||||||
|
-webkit-align-items: center;
|
||||||
|
-ms-flex-align: center;
|
||||||
|
align-items: center;
|
||||||
|
-webkit-justify-content: center;
|
||||||
|
-ms-flex-pack: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 48rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings-name {
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--text-primary);
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings-id {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.arrow {
|
||||||
|
font-size: 36rpx;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings-list {
|
||||||
|
padding: 0 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings-item {
|
||||||
|
display: -webkit-flex;
|
||||||
|
display: -ms-flexbox;
|
||||||
|
display: flex;
|
||||||
|
-webkit-align-items: center;
|
||||||
|
-ms-flex-align: center;
|
||||||
|
align-items: center;
|
||||||
|
padding: 28rpx 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings-item.bordered {
|
||||||
|
border-bottom: 1rpx dashed rgba(0, 0, 0, 0.06);
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings-item-icon {
|
||||||
|
font-size: 32rpx;
|
||||||
|
margin-right: 16rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings-item-label {
|
||||||
|
-webkit-flex: 1;
|
||||||
|
-ms-flex: 1;
|
||||||
|
flex: 1;
|
||||||
|
font-size: 30rpx;
|
||||||
|
color: var(--text-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.logout-btn {
|
||||||
|
text-align: center;
|
||||||
|
padding: 24rpx 0;
|
||||||
|
color: #ff6b6b;
|
||||||
|
border: 3rpx dashed #ff6b6b;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 弹窗复用 address 弹窗和 profile 弹窗样式 */
|
||||||
@@ -1340,6 +1340,7 @@ if (false) { var oldDiffedHook, oldVNodeHook, options; }
|
|||||||
/* harmony export */ Button: function() { return /* binding */ Button; },
|
/* harmony export */ Button: function() { return /* binding */ Button; },
|
||||||
/* harmony export */ Image: function() { return /* binding */ Image; },
|
/* harmony export */ Image: function() { return /* binding */ Image; },
|
||||||
/* harmony export */ Input: function() { return /* binding */ Input; },
|
/* harmony export */ Input: function() { return /* binding */ Input; },
|
||||||
|
/* harmony export */ Picker: function() { return /* binding */ Picker; },
|
||||||
/* harmony export */ ScrollView: function() { return /* binding */ ScrollView; },
|
/* harmony export */ ScrollView: function() { return /* binding */ ScrollView; },
|
||||||
/* harmony export */ Swiper: function() { return /* binding */ Swiper; },
|
/* harmony export */ Swiper: function() { return /* binding */ Swiper; },
|
||||||
/* harmony export */ SwiperItem: function() { return /* binding */ SwiperItem; },
|
/* harmony export */ SwiperItem: function() { return /* binding */ SwiperItem; },
|
||||||
@@ -1347,7 +1348,7 @@ if (false) { var oldDiffedHook, oldVNodeHook, options; }
|
|||||||
/* harmony export */ Textarea: function() { return /* binding */ Textarea; },
|
/* harmony export */ Textarea: function() { return /* binding */ Textarea; },
|
||||||
/* harmony export */ View: function() { return /* binding */ View; }
|
/* harmony export */ View: function() { return /* binding */ View; }
|
||||||
/* harmony export */ });
|
/* harmony export */ });
|
||||||
/* unused harmony exports Ad, AdCustom, Audio, Block, Camera, Canvas, ChannelLive, ChannelVideo, Checkbox, CheckboxGroup, CoverImage, CoverView, CustomWrapper, DraggableSheet, Editor, Form, FunctionalPageNavigator, GridBuilder, GridView, Icon, KeyboardAccessory, Label, ListBuilder, ListView, LivePlayer, LivePusher, Map, MatchMedia, MovableArea, MovableView, NativeSlot, NavigationBar, Navigator, NestedScrollBody, NestedScrollHeader, OfficialAccount, OpenContainer, OpenData, PageContainer, PageMeta, Picker, PickerView, PickerViewColumn, Progress, Radio, RadioGroup, RichText, RootPortal, ShareElement, Slider, Slot, Snapshot, Span, StickyHeader, StickySection, Switch, Video, VoipRoom, WebView */
|
/* unused harmony exports Ad, AdCustom, Audio, Block, Camera, Canvas, ChannelLive, ChannelVideo, Checkbox, CheckboxGroup, CoverImage, CoverView, CustomWrapper, DraggableSheet, Editor, Form, FunctionalPageNavigator, GridBuilder, GridView, Icon, KeyboardAccessory, Label, ListBuilder, ListView, LivePlayer, LivePusher, Map, MatchMedia, MovableArea, MovableView, NativeSlot, NavigationBar, Navigator, NestedScrollBody, NestedScrollHeader, OfficialAccount, OpenContainer, OpenData, PageContainer, PageMeta, PickerView, PickerViewColumn, Progress, Radio, RadioGroup, RichText, RootPortal, ShareElement, Slider, Slot, Snapshot, Span, StickyHeader, StickySection, Switch, Video, VoipRoom, WebView */
|
||||||
var View = 'view';
|
var View = 'view';
|
||||||
var Icon = 'icon';
|
var Icon = 'icon';
|
||||||
var Progress = 'progress';
|
var Progress = 'progress';
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# 智绘微刻小程序 — 交付总结 v2
|
# 智绘微刻小程序 — 交付总结 v3
|
||||||
|
|
||||||
> 本文档供**完全无上下文的新会话**阅读,记录本轮重构的完整交付成果。
|
> 本文档供**完全无上下文的新会话**阅读,记录各轮重构的完整交付成果。
|
||||||
> **日期**:2026-07-27(第二次修改)
|
> **日期**:2026-07-27(第三次修改,16:15 批次)
|
||||||
> **项目目录**:`F:\weixin_wordc\`
|
> **项目目录**:`F:\weixin_wordc\`
|
||||||
> **技术栈**:Taro 3.6.31 + React 18 + TypeScript + SCSS
|
> **技术栈**:Taro 3.6.31 + React 18 + TypeScript + SCSS
|
||||||
|
|
||||||
@@ -10,62 +10,50 @@
|
|||||||
## 一、历史修改回顾
|
## 一、历史修改回顾
|
||||||
|
|
||||||
### Batch 1(已完成)
|
### Batch 1(已完成)
|
||||||
见 review1.md 历史版本。核心完成:全局主题切换、字体系统、tabBar重组、商品详情页、设计清单、效果确认页、后端技术栈文档。
|
全局主题切换、字体系统、tabBar重组、商品详情页、设计清单、效果确认页、后端技术栈文档。
|
||||||
|
|
||||||
|
### Batch 2(已完成,见下方二~七)
|
||||||
|
全局Context主题同步、登录系统、贴纸DIY、订单详情、Profile 5状态、自动筛选、图片路径修复。
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 二、本轮修改任务 — 全部完成 ✅
|
## 二、本轮(Batch 3)修改任务 — 全部完成 ✅
|
||||||
|
|
||||||
| 序号 | 任务 | 状态 |
|
| 序号 | 任务 | 状态 |
|
||||||
|------|------|------|
|
|------|------|------|
|
||||||
| 1 | 全局主题系统升级为 Context 模式(点击即所有页面同步)+ 纯色背景去掉条纹 | ✅ 完成 |
|
| 1 | 完善个人主页功能:我的设计→设计清单;收货地址(京东风格+增删改复+默认地址+省市区选择器);设置页(修改信息/退出登录/协议占位) | ✅ 完成 |
|
||||||
| 2 | 设计清单页面实时刷新(`onShow` 钩子保证切页即刷新) | ✅ 完成 |
|
| 2 | 修复个人首页 ThemeToggle 点击无反应、主题不切换 | ✅ 完成 |
|
||||||
| 3 | 微信登录系统(`wx.login` + `chooseAvatar` + `nickname` input) | ✅ 完成 |
|
| 3 | 修复商品列表/详情页图片纯空白 | ✅ 完成 |
|
||||||
| 4 | 修复商品图片路径(相对路径改为根路径 `/img/xxx` + copy 配置) | ✅ 完成 |
|
| 4 | 修复 Profile 状态条目点击无跳转 / 待设计未自动筛选 | ✅ 完成 |
|
||||||
| 5 | 删除 DIY 页品种选择卡片,直接进入工作台 | ✅ 完成 |
|
| 5 | 未登录时空状态+登录按钮:设计清单/订单页包裹 `LoginGuard` | ✅ 完成 |
|
||||||
| 6 | 词云生成不再跳转 DIY,仅保存图片 | ✅ 完成 |
|
| 6 | 用户数据按 `openid` 隔离:store.ts 重构为 DA 层,支持多账号本地切换 | ✅ 完成 |
|
||||||
| 7 | DIY 贴纸系统(上传多张图/删除/拖动/缩放/碰撞检测) | ✅ 完成 |
|
|
||||||
| 8 | 订单详情页(淘宝风格:物流时间轴+地址+订单信息+设计预览) | ✅ 完成 |
|
|
||||||
| 9 | Profile 页 5 状态 2+3 布局(待设计/待付款/待发货/待收货/已完成) | ✅ 完成 |
|
|
||||||
| 10 | 登录拦截(需登录才能访问设计清单、订单等敏感页面) | ✅ 完成 |
|
|
||||||
| 11 | 订单列表页接收 profile 跳转的参数自动筛选 | ✅ 完成 |
|
|
||||||
| 12 | 所有 11 个页面接入 ThemeContext | ✅ 完成 |
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 三、文件变更清单
|
## 三、文件变更清单
|
||||||
|
|
||||||
### 新建文件
|
### 本轮新建文件(Batch 3)
|
||||||
| 文件 | 作用 |
|
| 文件 | 作用 |
|
||||||
|---|---|
|
|---|---|
|
||||||
| `src/context/ThemeContext.tsx` | 全局主题 Context + Provider + useThemeContext hook |
|
| `src/components/LoginGuard/index.tsx` + `.scss` | 登录守卫组件:未登录时显示空状态+去登录按钮 |
|
||||||
| `src/components/LoginModal/index.tsx` + `.scss` | 登录弹窗组件(含头像选择和昵称输入) |
|
| `src/pages/address/index.tsx` + `.scss` + `index.config.ts` | 收货地址页(京东风格卡片、省市区Picker、增删改复、默认地址) |
|
||||||
| `src/pages/orderDetail/index.tsx` + `index.scss` + `index.json` + `index.config.ts` | 订单详情页(淘宝风格) |
|
| `src/pages/settings/index.tsx` + `.scss` + `index.config.ts` | 设置页(修改头像昵称、退出登录、定制协议入口、关于我们) |
|
||||||
|
| `src/pages/agreement/index.tsx` + `.scss` + `index.config.ts` | 定制协议页(权责/隐私/售后/流程占位文本) |
|
||||||
|
|
||||||
### 修改的现有文件
|
### 本轮修改的现有文件
|
||||||
| 文件 | 核心改动 |
|
| 文件 | 核心改动 |
|
||||||
|---|---|
|
|---|---|
|
||||||
| `src/app.tsx` | 根组件包裹 `<ThemeProvider>` |
|
| `config/index.js` | `copy.to` 从 `'img'` 修正为 `'dist/img'`,确保图片正确输出到小程序根目录 |
|
||||||
| `src/app.scss` | 移除 `background-image` 条纹,改为纯色背景 |
|
| `src/components/ThemeToggle/index.tsx` | 移除 `require('@tarojs/taro').default` 动态加载,改为顶层 `import Taro`,修复点击无反应;事件名统一为 `theme:change` |
|
||||||
| `src/app.config.ts` | 新增 `pages/orderDetail/index` 路由 |
|
| `src/utils/store.ts` | **重构为 DA 层**:所有 design/order/address 的 Storage key 增加 `openid` 前缀隔离,后端替换时只需改此文件 |
|
||||||
| `src/hooks/useTheme.ts` | 改为基于 `useContext(ThemeContext)` 实现 |
|
| `src/types/index.ts` | 新增 `AddressItem` 接口(name/phone/region/detail/isDefault) |
|
||||||
| `src/components/ThemeToggle/index.tsx` | 接入 Context,触发 `theme:storageChanged` 全局事件 |
|
| `src/app.config.ts` | 注册新页面 `address`、`settings`、`agreement` |
|
||||||
| `src/custom-tab-bar/index.tsx` | 移除 fixed 白色背景,支持跟随主题变量 |
|
| `src/pages/profile/index.tsx` | 补全 6 个菜单入口路径(收货地址→address、使用帮助→agreement、设置→settings) |
|
||||||
| `src/utils/productConfig.ts` | 图片路径改为 `/img/xxx` 绝对根路径 |
|
| `src/pages/designList/index.tsx` | 新增 `toDesign` Tab(聚合"未设计+设计中");支持读取 `designList:filter` 参数自动筛选;外层包裹 `LoginGuard` |
|
||||||
| `src/types/index.ts` | 添加 `StickerItem` 接口,更新 `DesignItem` 的 `designData` 字段 |
|
| `src/pages/orders/index.tsx` | 外层包裹 `LoginGuard` |
|
||||||
| `config/index.js` | `copy` 规则增加 `{ from: 'src/img', to: 'img' }` |
|
|
||||||
| `src/pages/index/index.tsx` | 接入 `useThemeContext()` |
|
### Batch 2 已完成的文件(供追溯,不再重复)
|
||||||
| `src/pages/product/index.tsx` | 接入 `useThemeContext()` |
|
`ThemeContext.tsx`、`LoginModal`、`orderDetail`、全局主题同步、贴纸系统、`profile` 2+3 布局等。
|
||||||
| `src/pages/diy/index.tsx` | 重写:删除步骤1选品,改为贴纸系统(上传/删除/拖动/缩放/碰撞检测) |
|
|
||||||
| `src/pages/diy/index.scss` | 重写:支持贴纸列表、碰撞红色标注、控制栏 |
|
|
||||||
| `src/pages/checkout/index.tsx` | 支持展示贴纸列表的预览 |
|
|
||||||
| `src/pages/designList/index.tsx` | `onShow` 自动刷新,接入 Context |
|
|
||||||
| `src/pages/orders/index.tsx` | 读取 `orders:filter` 参数自动切换 Tab |
|
|
||||||
| `src/pages/profile/index.tsx` | 重写:5 状态 2+3 布局 + 登录弹窗 + 登录拦截 + Context |
|
|
||||||
| `src/pages/profile/index.scss` | 重写:支持 2+3 网格、登录弹窗样式 |
|
|
||||||
| `src/pages/service/index.tsx` | 接入 `useThemeContext()` |
|
|
||||||
| `src/pages/wordcloud/index.tsx` | 移除「前往个性化定制」按钮,仅保存图片 |
|
|
||||||
| `src/utils/store.ts` | 新增 `setUserInfo`/`getUserInfo` 暴露接口(mock openid) |
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -75,7 +63,7 @@
|
|||||||
npx taro build --type weapp
|
npx taro build --type weapp
|
||||||
```
|
```
|
||||||
|
|
||||||
- ✅ **Compiled successfully in 15.49s**
|
- ✅ **webpack 5.91.0 compiled with 2 warnings in ~20s**
|
||||||
- ✅ 0 报错,0 ERROR
|
- ✅ 0 报错,0 ERROR
|
||||||
- ⚠️ 2 个 Warning(均为正常提示):
|
- ⚠️ 2 个 Warning(均为正常提示):
|
||||||
1. `AssetsOverSizeLimitWarning` — 实物照片体积较大(2~12MB PNG),不影响运行,上线前可压缩优化。
|
1. `AssetsOverSizeLimitWarning` — 实物照片体积较大(2~12MB PNG),不影响运行,上线前可压缩优化。
|
||||||
@@ -83,17 +71,17 @@ npx taro build --type weapp
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 五、关键踩坑记录
|
## 五、关键踩坑记录(含本轮新增)
|
||||||
|
|
||||||
| 坑 | 现象 | 解法 |
|
| 坑 | 现象 | 解法 |
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
| **全局主题不同步** | 切换后已打开页面不刷新 | 引入 `React.createContext`,`ThemeToggle` 切换时写入 Storage + `eventCenter.trigger('theme:storageChanged')`,各页面 `onShow` 时重新读取 |
|
| **全局主题不同步** | 切换后已打开页面不刷新 | `React.createContext` + `eventCenter`,各页面 `onShow` 时重新读取 Storage |
|
||||||
| **设计清单切页不刷新** | 加入清单后切换页面看不到新条目 | 用 `Taro.getCurrentInstance().page.onShow` 代替 `eventCenter`,保证每次页面展现必触发 |
|
| **设计清单切页不刷新** | 加入清单后切换页面看不到新条目 | 用 `Taro.getCurrentInstance().page.onShow` 重写,保证每次页面展现必触发 |
|
||||||
| **图片显示纯空白** | 微信小程序编译后资源路径错乱 | `productConfig.ts` 的图片路径改为 `/img/xxx` 绝对路径,并在 `config/index.js` copy 到 `dist/img` |
|
| **图片显示纯空白** | 微信小程序编译后资源路径错乱 | `productConfig.ts` 的图片路径改为 `/img/xxx` 绝对路径;`config/index.js` copy 规则写为 `to: 'dist/img'` |
|
||||||
| **DIY 贴纸碰撞检测** | 两张贴纸贴在一起时无法阻止进入下一步 | 矩形边界框(AABB)碰撞检测,只要两个贴纸矩形相交即标红 `isOverlapping=true`,预览/完成时若存在 `hasOverlap=true` 则禁用提交 |
|
| **ThemeToggle 点击无反应** | 在个人页点击主题按钮没有任何效果 | `require('@tarojs/taro').default` 在某些构建下不返回真实 Taro 对象,改为顶层 `import Taro from '@tarojs/taro'` |
|
||||||
| **Profile 5 状态空间不够** | 单行 5 个状态拥挤 | 采用 2+3 两排布局:第一排 2 个(待设计/待付款),第二排 3 个(待发货/待收货/已完成),用虚线分隔+细线水平分隔 |
|
| **Profile 待设计未筛选** | 点击”待设计“跳到设计清单但显示全部条目 | 增加 `designList:filter` Storage 参数,设计清单 `onShow` 时读取并切换到 `toDesign` Tab(聚合未设计+设计中) |
|
||||||
| **微信登录获取真实头像** | `wx.getUserInfo` 已不再返回真实头像和昵称 | 使用微信标准 `open-type="chooseAvatar"` + `input type="nickname"` 组件,让用户手动选择和填写 |
|
| **用户数据未隔离** | 换账号登录后还能看到上一个用户的设计清单 | store.ts 重构为 DA 层,Storage key 按 `openid` 前缀隔离:`design_list_${openid}` |
|
||||||
| **订单页自动筛选** | Profile 点击状态跳转后订单列表未自动切换 Tab | 跳转前 `Taro.setStorageSync('orders:filter', 'pending')`,订单页 `onShow` 时读取并应用 |
|
| **收货地址省市区** | 不知如何实现三级联动 | 直接用微信原生组件 `<Picker mode='region'>`,无需自建数据 |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -101,24 +89,49 @@ npx taro build --type weapp
|
|||||||
|
|
||||||
```
|
```
|
||||||
首页浏览品类 → 商品详情页(轮播图+价格+介绍)
|
首页浏览品类 → 商品详情页(轮播图+价格+介绍)
|
||||||
→ 加入设计清单(弹窗选数量)→ 设计清单页(随时切页刷新)
|
→ 加入设计清单(弹窗选数量)→ 设计清单页(需登录,支持自动筛选)
|
||||||
→ 立即下单 → DIY 工作台(直接进入,无需选品)
|
→ 立即下单 → DIY 工作台(直接进入,无需选品)
|
||||||
→ 添加贴纸(相册/相机)→ 拖动调整位置 → 碰撞检测
|
→ 添加贴纸(相册/相机)→ 拖动调整位置 → 碰撞检测
|
||||||
→ 预览效果 → 确认完成 → 设计效果确认页
|
→ 预览效果 → 确认完成 → 设计效果确认页
|
||||||
→ 弹窗确认下单 → 订单生成 → 订单列表/订单详情
|
→ 弹窗确认下单 → 订单生成(需登录)→ 订单列表/订单详情
|
||||||
→ 物流时间轴追踪 → 确认收货 → 完成
|
→ 物流时间轴追踪 → 确认收货 → 完成
|
||||||
|
|
||||||
|
个人主页
|
||||||
|
→ 待设计 / 待付款 / 待发货 / 待收货 / 已完成 → 自动跳转对应页面并筛选
|
||||||
|
→ 收货地址 → 增删改复 + 省市区选择 + 默认地址
|
||||||
|
→ 设置 → 修改信息 / 退出登录 / 定制协议
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 七、下一步建议(可选)
|
## 七、架构说明:前端 DA 层设计
|
||||||
|
|
||||||
1. **后端接入**:当前 `openid` 为 mock 值,接入真实后端后替换 `wx.login` 的 `code` 换取真实 `openid`。
|
为了方便后续接入后端,所有数据操作已通过 `src/utils/store.ts` 抽象为 **Data Access 层**:
|
||||||
|
|
||||||
|
```
|
||||||
|
pages/
|
||||||
|
└─ 调用 store.getDesignList() / addDesign() / designToOrder() 等业务接口
|
||||||
|
└─ store.ts 内封装 Taro.getStorageSync / setStorageSync
|
||||||
|
└─ key = `${scope}_${openid}` 实现多用户隔离
|
||||||
|
```
|
||||||
|
|
||||||
|
**后端替换方案**:上线时只需重写 `store.ts` 中的以下函数为 `wx.request` HTTP 调用,页面层零改动:
|
||||||
|
- `getDesignList()` / `setDesignList()`
|
||||||
|
- `getOrderList()` / `setOrderList()`
|
||||||
|
- `getAddressList()` / `addAddress()` / `updateAddress()` / `deleteAddress()`
|
||||||
|
- `getUserInfo()` / `setUserInfo()` / `clearUserInfo()`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 八、下一步建议(可选)
|
||||||
|
|
||||||
|
1. **后端接入**:当前 `openid` 为 mock 值,接入真实后端后替换 `wx.login` 的 `code` 换取真实 `openid`,再将 `store.ts` 切换为 HTTP 请求。
|
||||||
2. **图片压缩**:上线前将 `src/img` 下的实物照片压缩到 500KB 以内,避免微信包体积超限。
|
2. **图片压缩**:上线前将 `src/img` 下的实物照片压缩到 500KB 以内,避免微信包体积超限。
|
||||||
3. **真机测试图片**:在微信开发者工具中预览,确认图片是否正常加载(路径已改为绝对路径+copy)。
|
3. **真机测试**:在微信开发者工具中预览,确认 `/img/xxx` 绝对路径图片是否正常加载。
|
||||||
4. **订单物流接口**:当前物流为静态 mock,接入后端后可实现真实物流轨迹查询。
|
4. **订单物流接口**:当前物流为静态 mock,接入 backend 后可实现真实物流轨迹查询。
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
*文档更新时间:2026-07-27*
|
*文档更新时间:2026-07-27*
|
||||||
*本轮重构 12 项核心目标全部完成,编译通过。*
|
*Batch 3(16:15 批次)6 项优化目标全部完成,编译通过。*
|
||||||
|
*累计完成:Batch 1 + Batch 2(12 项)+ Batch 3(6 项)= 18 项核心目标全部 ✅*
|
||||||
|
|||||||
@@ -9,7 +9,10 @@ export default defineAppConfig({
|
|||||||
'pages/profile/index',
|
'pages/profile/index',
|
||||||
'pages/service/index',
|
'pages/service/index',
|
||||||
'pages/wordcloud/index',
|
'pages/wordcloud/index',
|
||||||
'pages/orderDetail/index'
|
'pages/orderDetail/index',
|
||||||
|
'pages/address/index',
|
||||||
|
'pages/settings/index',
|
||||||
|
'pages/agreement/index'
|
||||||
],
|
],
|
||||||
window: {
|
window: {
|
||||||
backgroundTextStyle: 'light',
|
backgroundTextStyle: 'light',
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
.login-guard {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 120px 40px;
|
||||||
|
min-height: 50vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-guard-icon {
|
||||||
|
font-size: 80px;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-guard-title {
|
||||||
|
font-size: 36px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--text-primary);
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-guard-desc {
|
||||||
|
font-size: 28px;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
margin-bottom: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-guard-btn {
|
||||||
|
padding: 20px 48px;
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import Taro from '@tarojs/taro'
|
||||||
|
import { View, Text } from '@tarojs/components'
|
||||||
|
|
||||||
|
export default function LoginGuard(
|
||||||
|
props: {
|
||||||
|
children: React.ReactNode
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
const user = Taro.getStorageSync('smart_user_info')
|
||||||
|
if (!user?.openid) {
|
||||||
|
return (
|
||||||
|
<View className='login-guard'>
|
||||||
|
<Text className='login-guard-icon'>🔒</Text>
|
||||||
|
<Text className='login-guard-title'>请先登录</Text>
|
||||||
|
<Text className='login-guard-desc'>登录后查看您的专属内容</Text>
|
||||||
|
<View className='btn-gradient login-guard-btn' onClick={() => Taro.switchTab({ url: '/pages/profile/index' })}>
|
||||||
|
<Text>去登录</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return props.children as any
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import { View, Text } from '@tarojs/components'
|
import { View, Text } from '@tarojs/components'
|
||||||
|
import Taro from '@tarojs/taro'
|
||||||
import { useCallback } from 'react'
|
import { useCallback } from 'react'
|
||||||
import { useThemeContext } from '../../context/ThemeContext'
|
import { useThemeContext } from '../../context/ThemeContext'
|
||||||
import './index.scss'
|
import './index.scss'
|
||||||
@@ -8,10 +9,8 @@ export default function ThemeToggle() {
|
|||||||
|
|
||||||
const handleToggle = useCallback(() => {
|
const handleToggle = useCallback(() => {
|
||||||
toggleTheme()
|
toggleTheme()
|
||||||
// 触发全局事件,让其他已挂载页面也能感知
|
// 触发全局事件,让其他页面也能感知(切换tab后回来的页面会重新读取storage)
|
||||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
Taro.eventCenter.trigger('theme:change')
|
||||||
const Taro = require('@tarojs/taro').default
|
|
||||||
Taro.eventCenter.trigger('theme:storageChanged')
|
|
||||||
}, [toggleTheme])
|
}, [toggleTheme])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
export default definePageConfig({
|
||||||
|
navigationBarTitleText: '收货地址'
|
||||||
|
})
|
||||||
@@ -0,0 +1,181 @@
|
|||||||
|
.address-page {
|
||||||
|
padding: 0 24px 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.back-btn {
|
||||||
|
font-size: 40px;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.address-list {
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.address-card {
|
||||||
|
padding: 24px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.address-header {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.address-user {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.address-name {
|
||||||
|
font-size: 32px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--text-primary);
|
||||||
|
margin-right: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.address-phone {
|
||||||
|
font-size: 28px;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.default-tag {
|
||||||
|
margin-left: 12px;
|
||||||
|
background: var(--accent-pink);
|
||||||
|
color: #fff;
|
||||||
|
font-size: 20px;
|
||||||
|
padding: 2px 10px;
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.address-full {
|
||||||
|
font-size: 28px;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.address-actions {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 24px;
|
||||||
|
padding-top: 16px;
|
||||||
|
border-top: 1px dashed rgba(0,0,0,0.06);
|
||||||
|
}
|
||||||
|
|
||||||
|
.address-act {
|
||||||
|
font-size: 26px;
|
||||||
|
color: var(--accent-blue);
|
||||||
|
}
|
||||||
|
|
||||||
|
.address-act.delete {
|
||||||
|
color: #ff6b6b;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 表单弹窗 */
|
||||||
|
.address-form {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 600px;
|
||||||
|
padding: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-input {
|
||||||
|
width: 100%;
|
||||||
|
height: 80px;
|
||||||
|
background: var(--bg-input);
|
||||||
|
border: 3px dashed var(--line-star);
|
||||||
|
border-radius: 16px;
|
||||||
|
padding: 0 24px;
|
||||||
|
font-size: 28px;
|
||||||
|
color: var(--text-primary);
|
||||||
|
margin-bottom: 20px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-picker {
|
||||||
|
width: 100%;
|
||||||
|
height: 80px;
|
||||||
|
background: var(--bg-input);
|
||||||
|
border: 3px dashed var(--line-star);
|
||||||
|
border-radius: 16px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 0 24px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-picker-val {
|
||||||
|
font-size: 28px;
|
||||||
|
color: var(--text-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-picker-ph {
|
||||||
|
font-size: 28px;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-bottom: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-label {
|
||||||
|
font-size: 28px;
|
||||||
|
color: var(--text-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkbox {
|
||||||
|
width: 44px;
|
||||||
|
height: 44px;
|
||||||
|
border: 3px dashed var(--line-star);
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkbox.checked {
|
||||||
|
background: var(--accent-pink);
|
||||||
|
border-color: var(--accent-pink);
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-actions .btn-outline,
|
||||||
|
.form-actions .btn-gradient {
|
||||||
|
flex: 1;
|
||||||
|
padding: 20px 0;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 空状态统一的在 app.scss */
|
||||||
|
.login-guard {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 120px 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-guard-icon {
|
||||||
|
font-size: 80px;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-guard-title {
|
||||||
|
font-size: 36px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--text-primary);
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-guard-desc {
|
||||||
|
font-size: 28px;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
margin-bottom: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-guard-btn {
|
||||||
|
padding: 20px 48px;
|
||||||
|
}
|
||||||
@@ -0,0 +1,189 @@
|
|||||||
|
import { View, Text, Input, Picker } from '@tarojs/components'
|
||||||
|
import Taro from '@tarojs/taro'
|
||||||
|
import { useState, useEffect } from 'react'
|
||||||
|
import './index.scss'
|
||||||
|
import { getAddressList, addAddress, updateAddress, deleteAddress } from '../../utils/store'
|
||||||
|
import type { AddressItem } from '../../types'
|
||||||
|
import ThemeToggle from '../../components/ThemeToggle'
|
||||||
|
import { useThemeContext } from '../../context/ThemeContext'
|
||||||
|
|
||||||
|
export default function AddressPage() {
|
||||||
|
const { theme } = useThemeContext()
|
||||||
|
const [list, setList] = useState<AddressItem[]>([])
|
||||||
|
const [editing, setEditing] = useState<AddressItem | null>(null)
|
||||||
|
const [showForm, setShowForm] = useState(false)
|
||||||
|
|
||||||
|
const [name, setName] = useState('')
|
||||||
|
const [phone, setPhone] = useState('')
|
||||||
|
const [region, setRegion] = useState<string[]>([])
|
||||||
|
const [detail, setDetail] = useState('')
|
||||||
|
const [isDefault, setIsDefault] = useState(false)
|
||||||
|
|
||||||
|
const load = () => setList(getAddressList())
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
load()
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
const resetForm = () => {
|
||||||
|
setName('')
|
||||||
|
setPhone('')
|
||||||
|
setRegion([])
|
||||||
|
setDetail('')
|
||||||
|
setIsDefault(false)
|
||||||
|
setEditing(null)
|
||||||
|
}
|
||||||
|
|
||||||
|
const openAdd = () => {
|
||||||
|
resetForm()
|
||||||
|
setShowForm(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
const openEdit = (item: AddressItem) => {
|
||||||
|
setEditing(item)
|
||||||
|
setName(item.name)
|
||||||
|
setPhone(item.phone)
|
||||||
|
setRegion(item.region)
|
||||||
|
setDetail(item.detail)
|
||||||
|
setIsDefault(item.isDefault)
|
||||||
|
setShowForm(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleDelete = (id: string) => {
|
||||||
|
Taro.showModal({
|
||||||
|
title: '确认删除',
|
||||||
|
content: '删除后将无法恢复该地址',
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
deleteAddress(id)
|
||||||
|
load()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleCopy = (item: AddressItem) => {
|
||||||
|
const text = `${item.name} ${item.phone}\n${item.region.join(' ')} ${item.detail}`
|
||||||
|
Taro.setClipboardData({ data: text })
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleSave = () => {
|
||||||
|
if (!name.trim() || !phone.trim() || region.length === 0 || !detail.trim()) {
|
||||||
|
Taro.showToast({ title: '请填写完整信息', icon: 'none' })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const payload = { name, phone, region, detail, isDefault }
|
||||||
|
if (editing) {
|
||||||
|
updateAddress(editing.id, payload)
|
||||||
|
} else {
|
||||||
|
addAddress(payload)
|
||||||
|
}
|
||||||
|
Taro.showToast({ title: '保存成功', icon: 'success' })
|
||||||
|
setShowForm(false)
|
||||||
|
resetForm()
|
||||||
|
load()
|
||||||
|
}
|
||||||
|
|
||||||
|
const onRegionChange = (e: any) => {
|
||||||
|
setRegion(e.detail.value || [])
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View className={`theme-${theme}`}>
|
||||||
|
<View className='address-page'>
|
||||||
|
<ThemeToggle />
|
||||||
|
|
||||||
|
<View className='page-header dashed-card mt-20'>
|
||||||
|
<View className='star-badge' />
|
||||||
|
<View className='flex-between' style={{ width: '100%' }}>
|
||||||
|
<Text className='back-btn' onClick={() => Taro.navigateBack()}>←</Text>
|
||||||
|
<Text className='page-title'>收货地址</Text>
|
||||||
|
<View style={{ width: '60px' }} />
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
{/* 地址列表 */}
|
||||||
|
<View className='address-list'>
|
||||||
|
{list.map(item => (
|
||||||
|
<View key={item.id} className='address-card dashed-card'>
|
||||||
|
<View className='address-header'>
|
||||||
|
<View className='address-user'>
|
||||||
|
<Text className='address-name'>{item.name}</Text>
|
||||||
|
<Text className='address-phone'>{item.phone}</Text>
|
||||||
|
{item.isDefault && (
|
||||||
|
<View className='default-tag'><Text>默认</Text></View>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
<Text className='address-full'>
|
||||||
|
{item.region.join(' ')} {item.detail}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
<View className='address-actions'>
|
||||||
|
<Text className='address-act' onClick={() => openEdit(item)}>✏️ 编辑</Text>
|
||||||
|
<Text className='address-act' onClick={() => handleCopy(item)}>📋 复制</Text>
|
||||||
|
<Text className='address-act delete' onClick={() => handleDelete(item.id)}>🗑️ 删除</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
))}
|
||||||
|
|
||||||
|
{list.length === 0 && (
|
||||||
|
<View className='empty-state'>
|
||||||
|
<Text className='empty-icon'>📍</Text>
|
||||||
|
<Text className='empty-text'>还没有收货地址</Text>
|
||||||
|
<Text className='empty-sub'>点击下方按钮添加新地址</Text>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<View className='safe-bottom-placeholder' />
|
||||||
|
|
||||||
|
{/* 底部添加按钮 */}
|
||||||
|
<View className='action-bar'>
|
||||||
|
<View className='btn-gradient' onClick={openAdd}>
|
||||||
|
<Text>新增收货地址</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
{/* 新增/编辑弹窗 */}
|
||||||
|
{showForm && (
|
||||||
|
<View className='modal-overlay'>
|
||||||
|
<View className='modal-card dashed-card address-form'>
|
||||||
|
<View className='star-badge' />
|
||||||
|
<Text className='modal-title'>{editing ? '编辑地址' : '新增地址'}</Text>
|
||||||
|
|
||||||
|
<Input className='form-input' placeholder='收货人姓名'
|
||||||
|
value={name} onInput={(e: any) => setName(e.detail.value)} />
|
||||||
|
<Input className='form-input' placeholder='手机号码' type='number'
|
||||||
|
value={phone} onInput={(e: any) => setPhone(e.detail.value)} />
|
||||||
|
|
||||||
|
<Picker mode='region' value={region} onChange={onRegionChange}>
|
||||||
|
<View className='form-picker'>
|
||||||
|
<Text className={region.length ? 'form-picker-val' : 'form-picker-ph'}>
|
||||||
|
{region.length ? region.join(' / ') : '选择省 / 市 / 区'}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
</Picker>
|
||||||
|
|
||||||
|
<Input className='form-input' placeholder='详细地址:街道、门牌号'
|
||||||
|
value={detail} onInput={(e: any) => setDetail(e.detail.value)} />
|
||||||
|
|
||||||
|
<View className='form-row' onClick={() => setIsDefault(!isDefault)}>
|
||||||
|
<Text className='form-label'>设为默认地址</Text>
|
||||||
|
<View className={`checkbox ${isDefault ? 'checked' : ''}`} />
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<View className='form-actions'>
|
||||||
|
<View className='btn-outline' onClick={() => { setShowForm(false); resetForm() }}>
|
||||||
|
<Text>取消</Text>
|
||||||
|
</View>
|
||||||
|
<View className='btn-gradient' onClick={handleSave}>
|
||||||
|
<Text>保存</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
export default definePageConfig({
|
||||||
|
navigationBarTitleText: '定制协议'
|
||||||
|
})
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
.agreement-page {
|
||||||
|
padding: 0 24px 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.agreement-title {
|
||||||
|
font-size: 40px;
|
||||||
|
font-weight: 800;
|
||||||
|
color: var(--text-primary);
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 32px;
|
||||||
|
padding-top: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.agreement-content {
|
||||||
|
padding: 40px 32px;
|
||||||
|
line-height: 1.8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.agreement-section {
|
||||||
|
margin-bottom: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.agreement-h3 {
|
||||||
|
font-size: 32px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--text-primary);
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.agreement-p {
|
||||||
|
font-size: 28px;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
line-height: 1.8;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
import { View, Text } from '@tarojs/components'
|
||||||
|
import './index.scss'
|
||||||
|
import ThemeToggle from '../../components/ThemeToggle'
|
||||||
|
import { useThemeContext } from '../../context/ThemeContext'
|
||||||
|
|
||||||
|
export default function AgreementPage() {
|
||||||
|
const { theme } = useThemeContext()
|
||||||
|
|
||||||
|
const SECTIONS = [
|
||||||
|
{
|
||||||
|
title: '一、用户权责',
|
||||||
|
content: '用户确认提交的设计内容不侵犯第三方知识产权,定制商品一经确认下单即进入生产流程,非质量问题不支持退换。'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '二、隐私保护',
|
||||||
|
content: '我们严格保护用户个人信息,头像与昵称仅用于提升服务体验,不与第三方分享。'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '三、售后说明',
|
||||||
|
content: '收到商品后如有质量问题,请在7天内联系客服,我们将为您免费重做或退款。'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '四、定制流程',
|
||||||
|
content: `1. 选择商品品类并加入设计清单
|
||||||
|
2. 在DIY工作台上传图片或输入文字
|
||||||
|
3. 确认设计效果并提交订单
|
||||||
|
4. 支付后进入生产,约3-7个工作日发货
|
||||||
|
5. 物流跟踪至确认收货`
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View className={`theme-${theme}`}>
|
||||||
|
<View className='agreement-page'>
|
||||||
|
<ThemeToggle />
|
||||||
|
<View className='agreement-content'>
|
||||||
|
<Text className='agreement-title'>定制协议</Text>
|
||||||
|
{SECTIONS.map((sec, idx) => (
|
||||||
|
<View key={idx} className='agreement-section'>
|
||||||
|
<Text className='agreement-h3'>{sec.title}</Text>
|
||||||
|
<Text className='agreement-p'>{sec.content}</Text>
|
||||||
|
</View>
|
||||||
|
))}
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -2,12 +2,14 @@ import { View, Text, ScrollView } from '@tarojs/components'
|
|||||||
import Taro from '@tarojs/taro'
|
import Taro from '@tarojs/taro'
|
||||||
import { useState, useEffect, useCallback } from 'react'
|
import { useState, useEffect, useCallback } from 'react'
|
||||||
import './index.scss'
|
import './index.scss'
|
||||||
import { getDesignList, getTheme, type DesignItem } from '../../utils/store'
|
import { getDesignList, getUserInfo, type DesignItem } from '../../utils/store'
|
||||||
import ThemeToggle from '../../components/ThemeToggle'
|
import ThemeToggle from '../../components/ThemeToggle'
|
||||||
import { useThemeContext } from '../../context/ThemeContext'
|
import { useThemeContext } from '../../context/ThemeContext'
|
||||||
|
import LoginGuard from '../../components/LoginGuard'
|
||||||
|
|
||||||
const STATUS_TABS = [
|
const STATUS_TABS = [
|
||||||
{ code: 'all', label: '全部' },
|
{ code: 'all', label: '全部' },
|
||||||
|
{ code: 'toDesign', label: '待设计' },
|
||||||
{ code: 'undesigned', label: '未设计' },
|
{ code: 'undesigned', label: '未设计' },
|
||||||
{ code: 'designing', label: '设计中' },
|
{ code: 'designing', label: '设计中' },
|
||||||
{ code: 'ordered', label: '已下单' }
|
{ code: 'ordered', label: '已下单' }
|
||||||
@@ -28,22 +30,33 @@ export default function DesignListPage() {
|
|||||||
setList(getDesignList())
|
setList(getDesignList())
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
// 页面每次显示时刷新(保证加入清单后切回能看到最新数据)
|
// 自动读取外部传入的筛选状态
|
||||||
useEffect(() => {
|
const init = useCallback(() => {
|
||||||
const onShow = () => load()
|
const filter = Taro.getStorageSync('designList:filter')
|
||||||
const page = Taro.getCurrentInstance().page
|
if (filter && STATUS_TABS.some(t => t.code === filter)) {
|
||||||
if (page) {
|
setActiveTab(filter)
|
||||||
const orig = page.onShow
|
Taro.removeStorageSync('designList:filter')
|
||||||
page.onShow = function () {
|
|
||||||
onShow()
|
|
||||||
if (orig) orig.apply(this)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
load()
|
load()
|
||||||
}, [load])
|
}, [load])
|
||||||
|
|
||||||
|
// 页面每次显示时刷新
|
||||||
|
useEffect(() => {
|
||||||
|
const page = Taro.getCurrentInstance().page
|
||||||
|
if (page) {
|
||||||
|
const orig = page.onShow
|
||||||
|
page.onShow = function () {
|
||||||
|
init()
|
||||||
|
if (orig) orig.apply(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
init()
|
||||||
|
}, [init])
|
||||||
|
|
||||||
const filtered = activeTab === 'all'
|
const filtered = activeTab === 'all'
|
||||||
? list
|
? list
|
||||||
|
: activeTab === 'toDesign'
|
||||||
|
? list.filter(d => d.status === 'undesigned' || d.status === 'designing')
|
||||||
: list.filter(d => d.status === activeTab)
|
: list.filter(d => d.status === activeTab)
|
||||||
|
|
||||||
const goDesign = (item: DesignItem) => {
|
const goDesign = (item: DesignItem) => {
|
||||||
@@ -58,6 +71,7 @@ export default function DesignListPage() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<View className={`theme-${theme}`}>
|
<View className={`theme-${theme}`}>
|
||||||
|
<LoginGuard>
|
||||||
<View className='design-page'>
|
<View className='design-page'>
|
||||||
<ThemeToggle />
|
<ThemeToggle />
|
||||||
|
|
||||||
@@ -130,6 +144,7 @@ export default function DesignListPage() {
|
|||||||
|
|
||||||
<View style={{ height: '40px' }} />
|
<View style={{ height: '40px' }} />
|
||||||
</View>
|
</View>
|
||||||
|
</LoginGuard>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import './index.scss'
|
|||||||
import { getOrderList, type OrderItem } from '../../utils/store'
|
import { getOrderList, type OrderItem } from '../../utils/store'
|
||||||
import ThemeToggle from '../../components/ThemeToggle'
|
import ThemeToggle from '../../components/ThemeToggle'
|
||||||
import { useThemeContext } from '../../context/ThemeContext'
|
import { useThemeContext } from '../../context/ThemeContext'
|
||||||
|
import LoginGuard from '../../components/LoginGuard'
|
||||||
|
|
||||||
const STATUS_TABS = [
|
const STATUS_TABS = [
|
||||||
{ code: 'all', label: '全部' },
|
{ code: 'all', label: '全部' },
|
||||||
@@ -70,6 +71,7 @@ export default function OrdersPage() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<View className={`theme-${theme}`}>
|
<View className={`theme-${theme}`}>
|
||||||
|
<LoginGuard>
|
||||||
<View className='orders-page'>
|
<View className='orders-page'>
|
||||||
<ThemeToggle />
|
<ThemeToggle />
|
||||||
|
|
||||||
@@ -174,6 +176,7 @@ export default function OrdersPage() {
|
|||||||
|
|
||||||
<View style={{ height: '40px' }} />
|
<View style={{ height: '40px' }} />
|
||||||
</View>
|
</View>
|
||||||
|
</LoginGuard>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ import { useThemeContext } from '../../context/ThemeContext'
|
|||||||
const MENU_ITEMS = [
|
const MENU_ITEMS = [
|
||||||
{ icon: '🎨', label: '我的设计', path: '/pages/designList/index' },
|
{ icon: '🎨', label: '我的设计', path: '/pages/designList/index' },
|
||||||
{ icon: '✨', label: '词云生成', path: '/pages/wordcloud/index' },
|
{ icon: '✨', label: '词云生成', path: '/pages/wordcloud/index' },
|
||||||
{ icon: '📍', label: '收货地址', path: '' },
|
{ icon: '📍', label: '收货地址', path: '/pages/address/index' },
|
||||||
{ icon: '📞', label: '联系客服', path: '/pages/service/index' },
|
{ icon: '📞', label: '联系客服', path: '/pages/service/index' },
|
||||||
{ icon: '📋', label: '使用帮助', path: '' },
|
{ icon: '📋', label: '使用帮助', path: '/pages/agreement/index' },
|
||||||
{ icon: '⚙️', label: '设置', path: '' }
|
{ icon: '⚙️', label: '设置', path: '/pages/settings/index' }
|
||||||
]
|
]
|
||||||
|
|
||||||
export default function ProfilePage() {
|
export default function ProfilePage() {
|
||||||
@@ -84,6 +84,7 @@ export default function ProfilePage() {
|
|||||||
}
|
}
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'toDesign':
|
case 'toDesign':
|
||||||
|
Taro.setStorageSync('designList:filter', 'toDesign')
|
||||||
Taro.switchTab({ url: '/pages/designList/index' })
|
Taro.switchTab({ url: '/pages/designList/index' })
|
||||||
break
|
break
|
||||||
case 'pending':
|
case 'pending':
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
export default definePageConfig({
|
||||||
|
navigationBarTitleText: '设置'
|
||||||
|
})
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
.settings-page {
|
||||||
|
padding: 0 24px 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings-user {
|
||||||
|
padding: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings-avatar {
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
border-radius: 50%;
|
||||||
|
border: 3px dashed var(--line-star);
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings-avatar-placeholder {
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: var(--bg-input);
|
||||||
|
border: 3px dashed var(--line-star);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 48px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings-name {
|
||||||
|
font-size: 32px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--text-primary);
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings-id {
|
||||||
|
font-size: 24px;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.arrow {
|
||||||
|
font-size: 36px;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings-list {
|
||||||
|
padding: 0 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 28px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings-item.bordered {
|
||||||
|
border-bottom: 1px dashed rgba(0,0,0,0.06);
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings-item-icon {
|
||||||
|
font-size: 32px;
|
||||||
|
margin-right: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings-item-label {
|
||||||
|
flex: 1;
|
||||||
|
font-size: 30px;
|
||||||
|
color: var(--text-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.logout-btn {
|
||||||
|
text-align: center;
|
||||||
|
padding: 24px 0;
|
||||||
|
color: #ff6b6b;
|
||||||
|
border: 3px dashed #ff6b6b;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 弹窗复用 address 弹窗和 profile 弹窗样式 */
|
||||||
@@ -0,0 +1,144 @@
|
|||||||
|
import { View, Text, Image, Input, Button } from '@tarojs/components'
|
||||||
|
import Taro from '@tarojs/taro'
|
||||||
|
import { useState, useEffect } from 'react'
|
||||||
|
import './index.scss'
|
||||||
|
import ThemeToggle from '../../components/ThemeToggle'
|
||||||
|
import { useThemeContext } from '../../context/ThemeContext'
|
||||||
|
import { getUserInfo, setUserInfo, clearUserInfo } from '../../utils/store'
|
||||||
|
|
||||||
|
export default function SettingsPage() {
|
||||||
|
const { theme } = useThemeContext()
|
||||||
|
const [user, setUser] = useState<any>({})
|
||||||
|
const [editName, setEditName] = useState('')
|
||||||
|
const [editAvatar, setEditAvatar] = useState('')
|
||||||
|
const [showEdit, setShowEdit] = useState(false)
|
||||||
|
|
||||||
|
const loadUser = () => {
|
||||||
|
const u = getUserInfo() || {}
|
||||||
|
setUser(u)
|
||||||
|
setEditName(u.nickName || '')
|
||||||
|
setEditAvatar(u.avatarUrl || '')
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
loadUser()
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
const handleSaveInfo = () => {
|
||||||
|
setUserInfo({ ...user, nickName: editName, avatarUrl: editAvatar })
|
||||||
|
Taro.showToast({ title: '修改成功', icon: 'success' })
|
||||||
|
setShowEdit(false)
|
||||||
|
loadUser()
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleLogout = () => {
|
||||||
|
Taro.showModal({
|
||||||
|
title: '确认退出',
|
||||||
|
content: '退出后将清空当前登录状态,确定吗?',
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
clearUserInfo()
|
||||||
|
Taro.switchTab({ url: '/pages/index/index' })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const onChooseAvatar = (e: any) => {
|
||||||
|
setEditAvatar(e.detail.avatarUrl || '')
|
||||||
|
}
|
||||||
|
|
||||||
|
const MENU = [
|
||||||
|
{ label: '个人信息', icon: '👤', action: () => setShowEdit(true) },
|
||||||
|
{ label: '定制协议', icon: '📋', action: () => Taro.navigateTo({ url: '/pages/agreement/index' }) },
|
||||||
|
{ label: '关于我们', icon: 'ℹ️', action: () => Taro.showToast({ title: '智绘微刻 v1.0', icon: 'none' }) }
|
||||||
|
]
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View className={`theme-${theme}`}>
|
||||||
|
<View className='settings-page'>
|
||||||
|
<ThemeToggle />
|
||||||
|
|
||||||
|
<View className='page-header dashed-card mt-20'>
|
||||||
|
<View className='star-badge' />
|
||||||
|
<View className='flex-between' style={{ width: '100%' }}>
|
||||||
|
<Text className='back-btn' onClick={() => Taro.navigateBack()}>←</Text>
|
||||||
|
<Text className='page-title'>设置</Text>
|
||||||
|
<View style={{ width: '60px' }} />
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
{/* 用户卡片 */}
|
||||||
|
<View className='settings-user dashed-card mt-20'>
|
||||||
|
<View className='flex-between' onClick={() => setShowEdit(true)}>
|
||||||
|
<View className='flex-center'>
|
||||||
|
{user.avatarUrl ? (
|
||||||
|
<Image className='settings-avatar' src={user.avatarUrl} mode='aspectFill' />
|
||||||
|
) : (
|
||||||
|
<View className='settings-avatar-placeholder'><Text>👤</Text></View>
|
||||||
|
)}
|
||||||
|
<View style={{ marginLeft: '20px' }}>
|
||||||
|
<Text className='settings-name'>{user.nickName || '未登录'}</Text>
|
||||||
|
<Text className='settings-id'>ID: {user.openid ? user.openid.slice(-8) : '---'}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<Text className='arrow'>›</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
{/* 菜单列表 */}
|
||||||
|
<View className='settings-list dashed-card mt-20'>
|
||||||
|
{MENU.map((item, idx) => (
|
||||||
|
<View key={idx} className={`settings-item ${idx < MENU.length - 1 ? 'bordered' : ''}`} onClick={item.action}>
|
||||||
|
<Text className='settings-item-icon'>{item.icon}</Text>
|
||||||
|
<Text className='settings-item-label'>{item.label}</Text>
|
||||||
|
<Text className='arrow'>›</Text>
|
||||||
|
</View>
|
||||||
|
))}
|
||||||
|
</View>
|
||||||
|
|
||||||
|
{/* 退出登录 */}
|
||||||
|
{user?.openid && (
|
||||||
|
<View className='mt-20'>
|
||||||
|
<View className='btn-outline logout-btn' onClick={handleLogout}>
|
||||||
|
<Text>退出登录</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<View style={{ height: '40px' }} />
|
||||||
|
|
||||||
|
{/* 编辑弹窗 */}
|
||||||
|
{showEdit && (
|
||||||
|
<View className='modal-overlay'>
|
||||||
|
<View className='modal-card dashed-card'>
|
||||||
|
<View className='star-badge' />
|
||||||
|
<Text className='modal-title'>修改信息</Text>
|
||||||
|
<Button className='avatar-btn' openType='chooseAvatar' onChooseAvatar={onChooseAvatar}>
|
||||||
|
{editAvatar ? (
|
||||||
|
<Image className='avatar-img' src={editAvatar} mode='aspectFill' />
|
||||||
|
) : (
|
||||||
|
<Text className='avatar-placeholder'>点击选择头像</Text>
|
||||||
|
)}
|
||||||
|
</Button>
|
||||||
|
<Input
|
||||||
|
className='nickname-input'
|
||||||
|
placeholder='请输入昵称'
|
||||||
|
value={editName}
|
||||||
|
onInput={(e: any) => setEditName(e.detail.value)}
|
||||||
|
/>
|
||||||
|
<View className='form-actions'>
|
||||||
|
<View className='btn-outline' onClick={() => setShowEdit(false)}>
|
||||||
|
<Text>取消</Text>
|
||||||
|
</View>
|
||||||
|
<View className='btn-gradient' onClick={handleSaveInfo}>
|
||||||
|
<Text>保存</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -83,6 +83,16 @@ export interface OrderItem {
|
|||||||
sku: string
|
sku: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 收货地址 */
|
||||||
|
export interface AddressItem {
|
||||||
|
id: string
|
||||||
|
name: string
|
||||||
|
phone: string
|
||||||
|
region: string[] // [province, city, district]
|
||||||
|
detail: string // 门牌号/详细地址
|
||||||
|
isDefault: boolean
|
||||||
|
}
|
||||||
|
|
||||||
/** 编辑器中的图片状态(向后兼容) */
|
/** 编辑器中的图片状态(向后兼容) */
|
||||||
export interface ImageState {
|
export interface ImageState {
|
||||||
id: string
|
id: string
|
||||||
|
|||||||
@@ -1,41 +1,61 @@
|
|||||||
import Taro from '@tarojs/taro'
|
import Taro from '@tarojs/taro'
|
||||||
import type { DesignItem, OrderItem } from '../types'
|
import type { DesignItem, OrderItem, AddressItem } from '../types'
|
||||||
|
|
||||||
const DESIGN_KEY = 'smart_design_list'
|
|
||||||
const ORDER_KEY = 'smart_order_list'
|
|
||||||
const USER_KEY = 'smart_user_info'
|
|
||||||
const THEME_KEY = 'smart_theme'
|
const THEME_KEY = 'smart_theme'
|
||||||
|
const USER_KEY = 'smart_user_info'
|
||||||
|
const ACTIVE_USER_KEY = 'smart_active_openid'
|
||||||
|
|
||||||
/** 获取设计清单 */
|
// ---------- 当前用户 openid 管理 ----------
|
||||||
export const getDesignList = (): DesignItem[] => {
|
|
||||||
try {
|
function getActiveOpenid(): string {
|
||||||
return Taro.getStorageSync(DESIGN_KEY) || []
|
const user = getUserInfoRaw()
|
||||||
} catch {
|
const openid = user?.openid || Taro.getStorageSync(ACTIVE_USER_KEY) || '_guest_'
|
||||||
return []
|
Taro.setStorageSync(ACTIVE_USER_KEY, openid)
|
||||||
|
return openid
|
||||||
|
}
|
||||||
|
|
||||||
|
function key(scope: string): string {
|
||||||
|
const prefix = getActiveOpenid()
|
||||||
|
return `${scope}_${prefix}`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------- 用户数据 ----------
|
||||||
|
|
||||||
|
export function getUserInfoRaw(): any {
|
||||||
|
try { return Taro.getStorageSync(USER_KEY) } catch { return null }
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setUserInfoRaw(info: any) {
|
||||||
|
Taro.setStorageSync(USER_KEY, info)
|
||||||
|
if (info?.openid) {
|
||||||
|
Taro.setStorageSync(ACTIVE_USER_KEY, info.openid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 保存设计清单 */
|
export function clearUserInfo() {
|
||||||
export const setDesignList = (list: DesignItem[]) => {
|
Taro.removeStorageSync(USER_KEY)
|
||||||
Taro.setStorageSync(DESIGN_KEY, list)
|
Taro.removeStorageSync(ACTIVE_USER_KEY)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 获取订单列表 */
|
export function setUserInfo(info: any) {
|
||||||
export const getOrderList = (): OrderItem[] => {
|
setUserInfoRaw(info)
|
||||||
try {
|
|
||||||
return Taro.getStorageSync(ORDER_KEY) || []
|
|
||||||
} catch {
|
|
||||||
return []
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 保存订单列表 */
|
export function getUserInfo() {
|
||||||
export const setOrderList = (list: OrderItem[]) => {
|
return getUserInfoRaw()
|
||||||
Taro.setStorageSync(ORDER_KEY, list)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 添加设计清单条目 */
|
// ---------- 设计清单 ----------
|
||||||
export const addDesign = (product: any, count: number): DesignItem => {
|
|
||||||
|
export function getDesignList(): DesignItem[] {
|
||||||
|
try { return Taro.getStorageSync(key('design_list')) || [] } catch { return [] }
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setDesignList(list: DesignItem[]) {
|
||||||
|
Taro.setStorageSync(key('design_list'), list)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function addDesign(product: any, count: number): DesignItem {
|
||||||
const list = getDesignList()
|
const list = getDesignList()
|
||||||
const item: DesignItem = {
|
const item: DesignItem = {
|
||||||
id: 'DSG' + Date.now(),
|
id: 'DSG' + Date.now(),
|
||||||
@@ -51,8 +71,7 @@ export const addDesign = (product: any, count: number): DesignItem => {
|
|||||||
return item
|
return item
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 更新设计清单条目 */
|
export function updateDesign(id: string, patch: Partial<DesignItem>) {
|
||||||
export const updateDesign = (id: string, patch: Partial<DesignItem>) => {
|
|
||||||
const list = getDesignList()
|
const list = getDesignList()
|
||||||
const idx = list.findIndex(d => d.id === id)
|
const idx = list.findIndex(d => d.id === id)
|
||||||
if (idx === -1) return
|
if (idx === -1) return
|
||||||
@@ -60,8 +79,17 @@ export const updateDesign = (id: string, patch: Partial<DesignItem>) => {
|
|||||||
setDesignList(list)
|
setDesignList(list)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 设计转订单 */
|
// ---------- 订单 ----------
|
||||||
export const designToOrder = (designId: string): OrderItem | null => {
|
|
||||||
|
export function getOrderList(): OrderItem[] {
|
||||||
|
try { return Taro.getStorageSync(key('order_list')) || [] } catch { return [] }
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setOrderList(list: OrderItem[]) {
|
||||||
|
Taro.setStorageSync(key('order_list'), list)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function designToOrder(designId: string): OrderItem | null {
|
||||||
const dList = getDesignList()
|
const dList = getDesignList()
|
||||||
const oList = getOrderList()
|
const oList = getOrderList()
|
||||||
const design = dList.find(d => d.id === designId)
|
const design = dList.find(d => d.id === designId)
|
||||||
@@ -78,7 +106,6 @@ export const designToOrder = (designId: string): OrderItem | null => {
|
|||||||
sku: `${design.productName} × ${design.count}`
|
sku: `${design.productName} × ${design.count}`
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新 design 状态
|
|
||||||
const dIdx = dList.findIndex(d => d.id === designId)
|
const dIdx = dList.findIndex(d => d.id === designId)
|
||||||
if (dIdx !== -1) {
|
if (dIdx !== -1) {
|
||||||
dList[dIdx].status = 'ordered'
|
dList[dIdx].status = 'ordered'
|
||||||
@@ -90,30 +117,53 @@ export const designToOrder = (designId: string): OrderItem | null => {
|
|||||||
return order
|
return order
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 用户数据 */
|
// ---------- 主题 ----------
|
||||||
export const getUserInfo = () => {
|
|
||||||
try {
|
|
||||||
return Taro.getStorageSync(USER_KEY)
|
|
||||||
} catch {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const setUserInfo = (info: any) => {
|
|
||||||
Taro.setStorageSync(USER_KEY, info)
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 主题 */
|
|
||||||
export type ThemeMode = 'light' | 'dark'
|
export type ThemeMode = 'light' | 'dark'
|
||||||
|
|
||||||
export const getTheme = (): ThemeMode => {
|
export function getTheme(): ThemeMode {
|
||||||
try {
|
try { return Taro.getStorageSync(THEME_KEY) || 'light' } catch { return 'light' }
|
||||||
return Taro.getStorageSync(THEME_KEY) || 'light'
|
|
||||||
} catch {
|
|
||||||
return 'light'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const setTheme = (theme: ThemeMode) => {
|
export function setTheme(theme: ThemeMode) {
|
||||||
Taro.setStorageSync(THEME_KEY, theme)
|
Taro.setStorageSync(THEME_KEY, theme)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------- 收货地址 ----------
|
||||||
|
|
||||||
|
export function getAddressList(): AddressItem[] {
|
||||||
|
try { return Taro.getStorageSync(key('address_list')) || [] } catch { return [] }
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setAddressList(list: AddressItem[]) {
|
||||||
|
Taro.setStorageSync(key('address_list'), list)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function addAddress(addr: Omit<AddressItem, 'id'>): AddressItem {
|
||||||
|
const list = getAddressList()
|
||||||
|
const item: AddressItem = { ...addr, id: 'ADR' + Date.now() }
|
||||||
|
// 若设为默认,取消其他默认
|
||||||
|
if (item.isDefault) {
|
||||||
|
list.forEach(a => { a.isDefault = false })
|
||||||
|
}
|
||||||
|
setAddressList([item, ...list])
|
||||||
|
return item
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updateAddress(id: string, patch: Partial<AddressItem>) {
|
||||||
|
const list = getAddressList()
|
||||||
|
const idx = list.findIndex(a => a.id === id)
|
||||||
|
if (idx === -1) return
|
||||||
|
if (patch.isDefault) list.forEach(a => { a.isDefault = false })
|
||||||
|
list[idx] = { ...list[idx], ...patch }
|
||||||
|
setAddressList(list)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function deleteAddress(id: string) {
|
||||||
|
const list = getAddressList().filter(a => a.id !== id)
|
||||||
|
setAddressList(list)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getDefaultAddress(): AddressItem | undefined {
|
||||||
|
return getAddressList().find(a => a.isDefault)
|
||||||
|
}
|
||||||
|
|||||||