From 231423a03ba1ecbe3b15f02b44f6ea89374e1ed9 Mon Sep 17 00:00:00 2001 From: li tong bao <2903733959@qq.com> Date: Wed, 11 May 2022 14:16:24 +0800 Subject: [PATCH 1/3] =?UTF-8?q?--=E6=88=91=E7=9A=84=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=94=B9=E6=88=90=E6=96=B0=E8=AE=BE=E8=AE=A1=E5=9B=BE=E5=AE=8C?= =?UTF-8?q?=E6=88=90=20--=E5=9C=B0=E5=9D=80=E7=BB=84=E4=BB=B6=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E9=BB=98=E8=AE=A4=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/AddressList/index.scss | 2 +- src/components/AddressList/index.tsx | 8 +- src/pages/user/index.module.scss | 52 ++++++-- src/pages/user/index.tsx | 164 +++++++++++++------------- src/styles/iconfont.scss | 53 +++++++++ src/styles/iconfont.ttf | Bin 8892 -> 8892 bytes 6 files changed, 187 insertions(+), 92 deletions(-) diff --git a/src/components/AddressList/index.scss b/src/components/AddressList/index.scss index 78f6d40..6089a65 100644 --- a/src/components/AddressList/index.scss +++ b/src/components/AddressList/index.scss @@ -18,7 +18,7 @@ margin: 18px auto 0; border: 1px solid #ffffff; } - .address-list:hover{ + .address-active{ border: 1px solid #68b4ff; box-shadow: 0px 0px 10px 0px rgba(0,122,255,0.27); } diff --git a/src/components/AddressList/index.tsx b/src/components/AddressList/index.tsx index 1681fbc..c3524ee 100644 --- a/src/components/AddressList/index.tsx +++ b/src/components/AddressList/index.tsx @@ -28,11 +28,13 @@ const AddressList = memo((props:Params)=>{ data.length>0? data.map((item,index)=>{ return( - props.onSelect&&props.onSelect(item,index)} className="address-list"> + props.onSelect&&props.onSelect(item,index)} className={`address-list ${index==0&&'address-active'}`}> XL纺织 - 默认 - {/* 1656488999 */} + { + index==0?默认: + 1656488999 + } diff --git a/src/pages/user/index.module.scss b/src/pages/user/index.module.scss index 2f57bfe..ee56a5f 100644 --- a/src/pages/user/index.module.scss +++ b/src/pages/user/index.module.scss @@ -2,16 +2,16 @@ background-color: #F8F8F8; height: 100vh; .header{ - background-image: url(https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.jj20.com%2Fup%2Fallimg%2F1113%2F052420110515%2F200524110515-2-1200.jpg&refer=http%3A%2F%2Fimg.jj20.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1652840455&t=6d2fd53931578ef6e213a929a77d059c); + background: #68b4ff; background-size: cover; - height: 710px; + height: 560px; position: relative; .card-main{ margin-top: 33%; } } .header-card{ - position: absolute;left: 50%;bottom: 5%; + position: absolute;left: 50%;bottom: -18%; transform: translateX(-50%); } .crad{ @@ -100,14 +100,48 @@ color: #3c3c3c; text-align: center; margin-top: 30px; + position: relative; } - .card-main-title-content-item image{ - width: 68px; - height: 68px; - border: 2px solid #cccccc; - margin-bottom: 5px; + .card-main-title-content-item Text{ + font-size: 56px; + color: #3C3C3C; + } + .card-main-title-content-item-badge{ + padding: 0 10px; + height: 32px; + background: #007aff; + border: 2px solid #ffffff; + border-radius: 32px; + box-sizing: border-box; + overflow: hidden; + font-size: 18px; + font-weight: 700; + color: #ffffff; + display: flex;align-items: center;justify-content: center; + position: absolute;top: -10px;right: 0; } .main-card{ - margin: 34px auto 0; + margin: 131px auto 0; + } + + .card-main-list-content-item{ + display: flex;align-items: center; + justify-content: space-between; + height: 90px; + } + .card-main-list-content-item-left{ + font-size: 26px; + font-weight: 400; + text-align: left; + color: #707070; + display: flex;align-items: center; + } + .card-main-list-content-item-left text{ + margin-right: 35px; + font-size: 56px; + color: #707070; + } + .card-main-list-content-item-right text{ + font-size: 30px; } } \ No newline at end of file diff --git a/src/pages/user/index.tsx b/src/pages/user/index.tsx index 4683787..4ad2158 100644 --- a/src/pages/user/index.tsx +++ b/src/pages/user/index.tsx @@ -1,91 +1,97 @@ -import { View,Image,Text, Navigator } from "@tarojs/components" +import { View, Image, Text, Navigator } from "@tarojs/components" import { memo } from "react" -import styles from './index.module.scss' +import styles from './index.module.scss' import classnames from "classnames"; export default () => { - return ( - -
-
- - ) + return ( + +
+
+ + ) } // 头部 | 订单 -const Header = memo(()=>{ - let menu = [{text: "待配布"},{text: "待付款"},{text: "待发货"},{text: "已发货"},{text: "已发货"}] - return ( - - - - - - - - - 麦兜 - 131****1132 - - - - - - - - - - - - 订单 - 全部 - - - { - menu.map((item,index)=>{ - return ( - - - {item.text} - - ) - }) - } - - - - - - ) +const Header = memo(() => { + let menu = [{ text: "待配布", icon: "icon-daipeibu" }, { text: "待付款", icon: "icon-daifukuan" }, + { text: "待发货", icon: "icon-daifahuo" }, { text: "已发货", icon: "icon-yifahuo" }, + { text: "退款/售后", icon: "icon-a-tuikuanshouhou" }] + return ( + + + + + + + + + 麦兜 + 131****1132 + + + + + + + + + + + + 订单 + 全部 + + + { + menu.map((item, index) => { + return ( + + + {item.text} + 99+ + + ) + }) + } + + + + + + ) }) // 功能 -const Main = memo(()=>{ - let menu = [{text: "我的收藏"},{text: "颜色对比"},{text: "分享推广"},{text: "团队邀请"}] - return ( - - - - 功能 - - - { - menu.map((item,index)=>{ - return ( - - - {item.text} - - ) - }) - } - - - - ) +const Main = memo(() => { + let menu = [{ text: "我的收藏", icon: "icon-shoucang" }, { text: "颜色对比", icon: "icon-yanseduibi" }, + { text: "分享推广", icon: "icon-fenxiang" }, { text: "团队邀请", icon: "icon-yaoqingtuandui" }] + return ( + + + + { + menu.map((item, index) => { + return ( + + + + {item.text} + + + + + + ) + }) + } + + + + ) }) \ No newline at end of file diff --git a/src/styles/iconfont.scss b/src/styles/iconfont.scss index 868bd5f..c0db91d 100644 --- a/src/styles/iconfont.scss +++ b/src/styles/iconfont.scss @@ -76,6 +76,59 @@ content: "\e64a"; } +.icon-qingkong:before { + content: "\e64c"; +} + +.icon-jia:before { + content: "\e64d"; +} + +.icon-jian:before { + content: "\e64e"; +} + +.icon-shoucang-pressed:before { + content: "\e64f"; +} + +.icon-shoucang:before { + content: "\e650"; +} + +.icon-phone:before { + content: "\e651"; +} + +.icon-tick:before { + content: "\e653"; +} + +.icon-a-moreback:before { + content: "\e654"; +} + +.icon-fenlei:before { + content: "\e657"; +} + +.icon-bianji:before { + content: "\e658"; +} + +.icon-wode:before { + content: "\e659"; +} + +.icon-sort-up-full:before { + content: "\ea4c"; +} + +.icon-sort-down-full:before { + content: "\ea4d"; +} + + .icon-qingkong:before { content: "\e64c"; } diff --git a/src/styles/iconfont.ttf b/src/styles/iconfont.ttf index 02f040877815f27842f4a519d3447dbd2ca6abbe..0e1e50f4fdc6db874e3660f8719ac1dba6382150 100644 GIT binary patch delta 46 tcmdnvy2o`wAahtj>%@?$(yc6O;`wd9GH|mnfWW=k(_CQmW){XBiU4)y4&eX* delta 46 ucmdnvy2o`wAhXSk{S!l`O7GZW5zlY)m4Tau0R-;#txAN^n^_olC;|YH9uMFE From fcb9caa22101d5ec6adc0dbba1926a76ff92c586 Mon Sep 17 00:00:00 2001 From: li tong bao <2903733959@qq.com> Date: Thu, 12 May 2022 09:57:28 +0800 Subject: [PATCH 2/3] =?UTF-8?q?--=E5=AF=B9=E6=8E=A5=E5=9C=B0=E5=9D=80?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/addressManager.ts | 23 + src/app.config.ts | 6 + src/common/common.ts | 25 + src/components/AddressList/index.tsx | 38 +- src/components/FromList/index.scss | 6 + src/components/FromList/index.tsx | 10 +- src/pages/addressAdd/index.scss | 22 + src/pages/addressAdd/index.tsx | 63 +- src/pages/weightListAdd/index.scss | 4 + src/pages/weightListAdd/index.tsx | 4 +- .../font_2987621_ti92prbgh6/demo.css | 539 ----- .../font_2987621_ti92prbgh6/demo_index.html | 855 ------- .../font_2987621_ti92prbgh6/iconfont.css | 131 -- .../font_2987621_ti92prbgh6/iconfont.js | 1 - .../font_2987621_ti92prbgh6/iconfont.json | 212 -- .../font_2987621_ti92prbgh6/iconfont.ttf | Bin 8892 -> 0 bytes .../font_2987621_ti92prbgh6/iconfont.woff | Bin 5776 -> 0 bytes .../font_2987621_ti92prbgh6/iconfont.woff2 | Bin 4788 -> 0 bytes src/styles/iconfont.scss | 19 +- src/styles/iconfont.ttf | Bin 8892 -> 9236 bytes yarn.lock | 2075 +---------------- 21 files changed, 241 insertions(+), 3792 deletions(-) create mode 100644 src/api/addressManager.ts delete mode 100644 src/styles/download (2)/font_2987621_ti92prbgh6/demo.css delete mode 100644 src/styles/download (2)/font_2987621_ti92prbgh6/demo_index.html delete mode 100644 src/styles/download (2)/font_2987621_ti92prbgh6/iconfont.css delete mode 100644 src/styles/download (2)/font_2987621_ti92prbgh6/iconfont.js delete mode 100644 src/styles/download (2)/font_2987621_ti92prbgh6/iconfont.json delete mode 100644 src/styles/download (2)/font_2987621_ti92prbgh6/iconfont.ttf delete mode 100644 src/styles/download (2)/font_2987621_ti92prbgh6/iconfont.woff delete mode 100644 src/styles/download (2)/font_2987621_ti92prbgh6/iconfont.woff2 diff --git a/src/api/addressManager.ts b/src/api/addressManager.ts new file mode 100644 index 0000000..1d2f537 --- /dev/null +++ b/src/api/addressManager.ts @@ -0,0 +1,23 @@ +import { useRequest } from "@/use/useHttp" + +/** + * 获取地址列表 + * @returns + */ + export const addressListApi = () => { + return useRequest({ + url: `/v1/mall/address/list`, + method: "get", + }) +} + +/** + * 添加地址 + * @returns + */ + export const addressAddApi = () => { + return useRequest({ + url: `/lymarket/v1/mall/address`, + method: "post", + }) +} diff --git a/src/app.config.ts b/src/app.config.ts index 1f73284..c9abe95 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -86,6 +86,12 @@ export default { "index" ] }, + { + root: "pages/weightListAdd", + pages: [ + "index" + ] + }, { root: "pages/order", pages: [ diff --git a/src/common/common.ts b/src/common/common.ts index e2ba671..fe8f1cd 100644 --- a/src/common/common.ts +++ b/src/common/common.ts @@ -87,6 +87,31 @@ export const retrieval = (data: any, message: string="请填写完信息", rules resolve(null); }) } + /** + * toast提示 + */ + export const alert = { + success(title: string){ + Taro.showToast({ + title,icon: "success" + }) + }, + error(title: string){ + Taro.showToast({ + title,icon: "error" + }) + }, + loading(title: string){ + Taro.showToast({ + title,icon: "loading" + }) + }, + none(title: string){ + Taro.showToast({ + title,icon: "none" + }) + }, + } // 金额千位分割符 export const formatKbPrice = (number: string) => { diff --git a/src/components/AddressList/index.tsx b/src/components/AddressList/index.tsx index c3524ee..90806e1 100644 --- a/src/components/AddressList/index.tsx +++ b/src/components/AddressList/index.tsx @@ -1,7 +1,8 @@ import { Button, Navigator, ScrollView, Text, View } from "@tarojs/components" -import { memo, useState } from "react" +import { memo, useEffect, useState } from "react" import "./index.scss" +import {addressListApi} from "@/api/addressManager" interface Params{ refresherEnabled?: boolean,//是否开启刷新 @@ -11,13 +12,21 @@ interface Params{ // 地址列表 const AddressList = memo((props:Params)=>{ + const {fetchData, state} = addressListApi() + // 获取数据 + const getData = ()=>{ + fetchData(); + } + useEffect(()=>{ + getData(); + },[]) + // 处理刷新 const [refreshState, setRefreshState] = useState(false); - const handleRefresh = ()=>{ + const handleRefresh = async ()=>{ setRefreshState(true); - setTimeout(()=>{ - setRefreshState(false); - },500) + await fetchData(); + setRefreshState(false); } const data = Array.from({length:15}); @@ -25,21 +34,24 @@ const AddressList = memo((props:Params)=>{ { - data.length>0? - data.map((item,index)=>{ + state?.data?.list?.length>0? + state?.data?.list?.map((item,index)=>{ + // data.length>0? + // data.map((item,index)=>{ return( - props.onSelect&&props.onSelect(item,index)} className={`address-list ${index==0&&'address-active'}`}> + props.onSelect&&props.onSelect(item,index)} className={`address-list ${item.is_default&&'address-active'}`}> - XL纺织 + {item.name} { - index==0?默认: - 1656488999 + item.is_default?默认: + {item.phone} } - **省**市**区**街道****仓库 - 181****9790 + {/* **省**市**区**街道****仓库 */} + {item.province_name+item.city_name+item.district_name} {item.address_detail} + {item.phone} diff --git a/src/components/FromList/index.scss b/src/components/FromList/index.scss index 38257e1..e820f47 100644 --- a/src/components/FromList/index.scss +++ b/src/components/FromList/index.scss @@ -28,6 +28,11 @@ width: 100%; display: flex;align-items: center; } + .form-list-input view{ + height: 100%; + padding: 0 10px; + box-sizing: border-box; + } .form-list-input text{ width: 30px; min-width: 30px; @@ -38,6 +43,7 @@ display: flex;align-items: center; justify-content: center; flex: 1; + color: white; } .form-list-right input,.form-list-right textarea{ // flex: 0 0 auto; diff --git a/src/components/FromList/index.tsx b/src/components/FromList/index.tsx index 6635fec..8df1c6c 100644 --- a/src/components/FromList/index.tsx +++ b/src/components/FromList/index.tsx @@ -5,7 +5,7 @@ import "./index.scss" interface ListParams{ label: string, //左边label - onInput?: ()=>any, // 输入框输入 + onInput?: (ev:Object)=>void, // 输入框输入 onClick?:()=>any, //点击列表 placeholder?:string, // 提示文本 children?: any, // 插槽 @@ -28,7 +28,9 @@ const FromList = memo((props:ListParams)=>{ type=="input"? - {value&&} + {value&& + props.onInput&&props.onInput({detail: {value: ""}})} className="iconfont icon-qingkong"/> + } : type=="textarea"?