From 328129d94edcc310bdc5bc1dd0986491d8b651a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BD=87?= Date: Mon, 14 Apr 2025 19:37:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=88=86=E4=BA=AB=EF=BC=8C?= =?UTF-8?q?=E9=95=BF=E6=8C=89=E6=93=8D=E4=BD=9C=EF=BC=8C=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E8=8B=A5=E5=B9=B2=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/user.js | 9 +++ app.js | 4 +- app.json | 6 ++ app.wxss | 107 +++++++++++++++++++++++++++++++- assets/icon.wxss | 7 ++- node_modules/.package-lock.json | 6 ++ package-lock.json | 7 +++ package.json | 1 + pages/my/index/index.wxml | 43 +++++-------- pages/my/index/index.wxss | 52 +--------------- pages/my/login/index.js | 14 +++++ pages/my/login/index.wxml | 7 ++- pages/my/login/index.wxss | 19 ++++++ pages/try/index/index.js | 103 ++++++++++++++++++++++++++---- pages/try/index/index.json | 3 +- pages/try/index/index.wxml | 37 ++++++++--- pages/try/index/index.wxss | 74 +++++++++++++++++++++- project.private.config.json | 13 ++++ 18 files changed, 412 insertions(+), 100 deletions(-) diff --git a/api/user.js b/api/user.js index 01059e7..50cf473 100644 --- a/api/user.js +++ b/api/user.js @@ -66,6 +66,9 @@ const userAPI = { getDefaultPersonImage(){ return request.get('/api/v1/person-images/default') }, + tryOnStatus:{ + trying:'生成中',error:'失败',success:'已生成' + }, /** * * @param {Object} data @@ -77,6 +80,9 @@ const userAPI = { tryon(data){ return request.post('/api/v1/tryon',data) }, + tryonDetail(history_id){ + return request.get(`/api/v1/tryon/history/${history_id}`) + }, checkTryon(history_id){ return request.get(`/api/v1/tryon/history/${history_id}/check`) }, @@ -85,6 +91,9 @@ const userAPI = { }, deleteTryon(history_id){ return request.delete(`/api/v1/tryon/history/${history_id}`) + }, + getTryonComment(history_id){ + return request.get('/api/v1/tryon/comment',{history_id}) } }; diff --git a/app.js b/app.js index 3eb1fc5..0611d61 100644 --- a/app.js +++ b/app.js @@ -1,6 +1,8 @@ App({ onLaunch() { -console.log(111); + }, + onShow(options){ + console.log(options); }, globalData: { userInfo: null diff --git a/app.json b/app.json index 6580265..f627044 100644 --- a/app.json +++ b/app.json @@ -24,6 +24,12 @@ "text": "试衣间", "iconPath": "/assets/tabbar/tab2.png", "selectedIconPath": "/assets/tabbar/tab2-active.png" + }, + { + "pagePath": "pages/my/index/index", + "text": "我的", + "iconPath": "/assets/tabbar/tab3.png", + "selectedIconPath": "/assets/tabbar/tab3-active.png" } ] }, diff --git a/app.wxss b/app.wxss index 86abc4b..65b9ea8 100644 --- a/app.wxss +++ b/app.wxss @@ -2,11 +2,12 @@ page{ --main-color:#FF2727; --main-bgclolor:#ffffff; + --main-font-color:#333; --safe-bottom:constant(safe-area-inset-bottom); --safe-bottom:env(safe-area-inset-bottom); background-color: var(--main-bgclolor); font-size: 30rpx; - color: #333333; + color: var(--main-font-color); line-height: 1; height: 100vw; overflow: hidden; @@ -46,4 +47,108 @@ button.icon-button{ .custom-scroll-view .main{ overflow: hidden; flex:1; +} + + +radio{ + width: 20px; + height: 20px; + position: relative; +} +radio .wx-radio-input{ + border-radius: 50%; + border-color:var(--main-color); + box-sizing: border-box; + width: 100%; + height: 100%; + position: absolute; + top: 0;left:0; +} +radio .wx-radio-input.wx-radio-input-checked{ + background-color:transparent; + border-color: var(--main-color); +} +radio .wx-radio-input.wx-radio-input-checked::before{ + content: ''; + position: absolute; + width: 14px; + height:14px; + left:2px;top:2px; + border-radius: 50%; + background: var(--main-color); + transform: none; + -webkit-transform:none +} + + +.cells{ + margin:20rpx; + border-radius: 24rpx; + background-color: #fff; + overflow: hidden; +} +.cells .cell{ + display: flex; + align-items: center; + padding:0 40rpx; + font-size: 30rpx; + position: relative; +} +.cells .cell.cell-active{ + background-color:rgba(0,0,0,.1); +} +.cells .cell::after{ + content: ''; + border-bottom: 1rpx solid rgba(153, 153, 153, 0.2); + position: absolute; + bottom:0; + left:40rpx; + right:40rpx; +} +.cells .cell:last-child::after{ + border:0; +} +.cells .cell-hd{ + margin-right:20rpx; +} +.cells .cell-hd .icon{ + width:40rpx;height:40rpx; + vertical-align: middle; +} +.cells .cell-bd{ + flex:1; + display: flex; + align-items: center; + position:relative; + min-height: 116rpx; +} +.cells .cell-bd .error{ + color:red; + position: absolute; + left:0;bottom:10rpx; + font-size: 24rpx; +} +.cells .cell-bd input{ + height:100rpx; + width: 100%; +} +.cells .cell-ft{ + position: relative; + color:#999; +} +.cells.cells-access .cell-ft{ + padding-right: 40rpx; +} +.cells.cells-access .cell-ft::after{ + content:" "; + width:24rpx;height:48rpx; + -webkit-mask-position:0 0; + mask-position:0 0; + -webkit-mask-repeat:no-repeat; + mask-repeat:no-repeat; + -webkit-mask-size:100%; + mask-size:100%; + background-color:currentColor; + color:var(--weui-FG-2); + -webkit-mask-image:url(data:image/svg+xml,%3Csvg%20width%3D%2212%22%20height%3D%2224%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M2.454%206.58l1.06-1.06%205.78%205.779a.996.996%200%20010%201.413l-5.78%205.779-1.06-1.061%205.425-5.425-5.425-5.424z%22%20fill%3D%22%23B2B2B2%22%20fill-rule%3D%22evenodd%22%2F%3E%3C%2Fsvg%3E);mask-image:url(data:image/svg+xml,%3Csvg%20width%3D%2212%22%20height%3D%2224%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M2.454%206.58l1.06-1.06%205.78%205.779a.996.996%200%20010%201.413l-5.78%205.779-1.06-1.061%205.425-5.425-5.425-5.424z%22%20fill%3D%22%23B2B2B2%22%20fill-rule%3D%22evenodd%22%2F%3E%3C%2Fsvg%3E);position:absolute;top:50%;right:0;margin-top:-24rpx } \ No newline at end of file diff --git a/assets/icon.wxss b/assets/icon.wxss index 47695cc..e3c888d 100644 --- a/assets/icon.wxss +++ b/assets/icon.wxss @@ -47,6 +47,10 @@ mask-image: var(--icon-delete); -webkit-mask-image: var(--icon-delete); } +.icon.history{ + mask-image: var(--icon-history); + -webkit-mask-image: var(--icon-history); +} .icon.warn{ position: relative; background-color: #fff; @@ -76,5 +80,6 @@ page{ --icon-plus:url(data:image/svg+xml,%3Csvg%20t%3D%221744381143353%22%20class%3D%22icon%22%20viewBox%3D%220%200%201024%201024%22%20version%3D%221.1%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20p-id%3D%2244078%22%20width%3D%22128%22%20height%3D%22128%22%3E%3Cpath%20d%3D%22M512%201024a58.336%2058.336%200%200%201-58.368-58.368V58.368a58.336%2058.336%200%201%201%20116.736%200v907.264c0%2031.744-25.6%2058.368-58.368%2058.368z%20m453.632-453.632H58.368a58.336%2058.336%200%201%201%200-116.736h907.264a58.336%2058.336%200%201%201%200%20116.736z%22%20p-id%3D%2244079%22%3E%3C/path%3E%3C/svg%3E); --icon-loading:url(data:image/svg+xml,%3C%3Fxml%20version%3D%271.0%27%20encoding%3D%27UTF-8%27%3F%3E%3Csvg%20width%3D%2780px%27%20height%3D%2780px%27%20viewBox%3D%270%200%2080%2080%27%20version%3D%271.1%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20xmlns%3Axlink%3D%27http%3A//www.w3.org/1999/xlink%27%3E%3Ctitle%3Eloading%3C/title%3E%3Cdefs%3E%3ClinearGradient%20x1%3D%2794.0869141%25%27%20y1%3D%270%25%27%20x2%3D%2794.0869141%25%27%20y2%3D%2790.559082%25%27%20id%3D%27linearGradient-1%27%3E%3Cstop%20stop-color%3D%27%23606060%27%20stop-opacity%3D%270%27%20offset%3D%270%25%27%3E%3C/stop%3E%3Cstop%20stop-color%3D%27%23606060%27%20stop-opacity%3D%270.3%27%20offset%3D%27100%25%27%3E%3C/stop%3E%3C/linearGradient%3E%3ClinearGradient%20x1%3D%27100%25%27%20y1%3D%278.67370605%25%27%20x2%3D%27100%25%27%20y2%3D%2790.6286621%25%27%20id%3D%27linearGradient-2%27%3E%3Cstop%20stop-color%3D%27%23606060%27%20offset%3D%270%25%27%3E%3C/stop%3E%3Cstop%20stop-color%3D%27%23606060%27%20stop-opacity%3D%270.3%27%20offset%3D%27100%25%27%3E%3C/stop%3E%3C/linearGradient%3E%3C/defs%3E%3Cg%20stroke%3D%27none%27%20stroke-width%3D%271%27%20fill%3D%27none%27%20fill-rule%3D%27evenodd%27%20opacity%3D%270.9%27%3E%3Cg%3E%3Cpath%20d%3D%27M40%2C0%20C62.09139%2C0%2080%2C17.90861%2080%2C40%20C80%2C62.09139%2062.09139%2C80%2040%2C80%20L40%2C73%20C58.2253967%2C73%2073%2C58.2253967%2073%2C40%20C73%2C21.7746033%2058.2253967%2C7%2040%2C7%20L40%2C0%20Z%27%20fill%3D%27url%28%23linearGradient-1%29%27%3E%3C/path%3E%3Cpath%20d%3D%27M40%2C0%20L40%2C7%20C21.7746033%2C7%207%2C21.7746033%207%2C40%20C7%2C58.2253967%2021.7746033%2C73%2040%2C73%20L40%2C80%20C17.90861%2C80%200%2C62.09139%200%2C40%20C0%2C17.90861%2017.90861%2C0%2040%2C0%20Z%27%20fill%3D%27url%28%23linearGradient-2%29%27%3E%3C/path%3E%3Ccircle%20id%3D%27Oval%27%20fill%3D%27%23606060%27%20cx%3D%2740.5%27%20cy%3D%273.5%27%20r%3D%273.5%27%3E%3C/circle%3E%3C/g%3E%3CanimateTransform%20attributeName%3D%27transform%27%20begin%3D%270s%27%20dur%3D%271s%27%20type%3D%27rotate%27%20values%3D%270%2040%2040%3B360%2040%2040%27%20repeatCount%3D%27indefinite%27/%3E%3C/g%3E%3C/svg%3E); --icon-warn:url(data:image/svg+xml,%3Csvg%20t%3D%221744472102058%22%20class%3D%22icon%22%20viewBox%3D%220%200%201024%201024%22%20version%3D%221.1%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20p-id%3D%2255997%22%20width%3D%22128%22%20height%3D%22128%22%3E%3Cpath%20d%3D%22M512%200C229.205333%200%200%20229.205333%200%20512s229.205333%20512%20512%20512%20512-229.205333%20512-512S794.794667%200%20512%200z%20m0%20796.458667A56.917333%2056.917333%200%201%201%20511.957333%20682.666667%2056.917333%2056.917333%200%200%201%20512%20796.458667z%20m54.186667-227.797334h0.128a60.501333%2060.501333%200%200%201-53.802667%2055.893334c2.048%200.256%203.882667%201.152%205.973333%201.152h-11.818666c2.048%200%203.84-0.981333%205.845333-1.109334a59.093333%2059.093333%200%200%201-53.162667-55.893333l-13.056-284.16a54.314667%2054.314667%200%200%201%2054.613334-57.045333h26.282666a52.992%2052.992%200%200%201%2054.186667%2057.002666l-15.146667%20284.16z%22%20fill%3D%22%23B94343%22%20p-id%3D%2255998%22%3E%3C/path%3E%3C/svg%3E); - --icon-delete:url(data:image/svg+xml,%3Csvg%20t%3D%221744473381401%22%20class%3D%22icon%22%20viewBox%3D%220%200%201024%201024%22%20version%3D%221.1%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20p-id%3D%2258654%22%20width%3D%22128%22%20height%3D%22128%22%3E%3Cpath%20d%3D%22M512%200C228.864%200%200%20228.864%200%20512%200%20795.136%20228.864%201024%20512%201024%20795.136%201024%201024%20795.136%201024%20512%201024%20228.864%20795.136%200%20512%200ZM768%20695.808%20695.808%20768%20512%20584.192%20328.192%20768%20256%20695.808%20439.808%20512%20256%20328.192%20328.192%20256%20512%20439.808%20695.808%20256%20768%20328.192%20584.192%20512%20768%20695.808Z%22%20fill%3D%22%23000000%22%20p-id%3D%2258655%22%20data-spm-anchor-id%3D%22a313x.search_index.0.i52.389b3a81KbR0ru%22%3E%3C/path%3E%3C/svg%3E) + --icon-delete:url(data:image/svg+xml,%3Csvg%20t%3D%221744473381401%22%20class%3D%22icon%22%20viewBox%3D%220%200%201024%201024%22%20version%3D%221.1%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20p-id%3D%2258654%22%20width%3D%22128%22%20height%3D%22128%22%3E%3Cpath%20d%3D%22M512%200C228.864%200%200%20228.864%200%20512%200%20795.136%20228.864%201024%20512%201024%20795.136%201024%201024%20795.136%201024%20512%201024%20228.864%20795.136%200%20512%200ZM768%20695.808%20695.808%20768%20512%20584.192%20328.192%20768%20256%20695.808%20439.808%20512%20256%20328.192%20328.192%20256%20512%20439.808%20695.808%20256%20768%20328.192%20584.192%20512%20768%20695.808Z%22%20fill%3D%22%23000000%22%20p-id%3D%2258655%22%20data-spm-anchor-id%3D%22a313x.search_index.0.i52.389b3a81KbR0ru%22%3E%3C/path%3E%3C/svg%3E); + --icon-history:url(data:image/svg+xml,%3Csvg%20t%3D%221744605585155%22%20class%3D%22icon%22%20viewBox%3D%220%200%201024%201024%22%20version%3D%221.1%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20p-id%3D%2259650%22%20width%3D%22128%22%20height%3D%22128%22%3E%3Cpath%20d%3D%22M512.00768%2015.15008a496.19456%20496.19456%200%200%201%20351.38944%20145.63328l1.92896%202.176a496.768%20496.768%200%200%201-1.92896%20700.52864l-2.15424%201.60256a496.77952%20496.77952%200%200%201-700.65024-1.60256%20496.78976%20496.78976%200%200%201%200-702.43456v-0.2752h0.2752A494.51904%20494.51904%200%200%201%20512.00768%2015.15008z%20m217.07008%20458.60224H550.27712V169.71904a38.40768%2038.40768%200%201%200-76.81536%200v342.25664a38.85824%2038.85824%200%200%200%2038.54592%2038.528h217.07008c20.88832%200%2037.99424-17.34656%2037.99424-38.528a38.15936%2038.15936%200%200%200-37.99424-38.22336z%20m80.04608-259.0016a419.48288%20419.48288%200%200%200-297.11616-123.136c-116.43776%200-221.42848%2046.63296-297.69216%20123.136a421.504%20421.504%200%200%200%200%20594.47424%20420.77568%20420.77568%200%200%200%20593.20448%201.62688l1.60384-1.62688c76.0128-75.92064%20123.7504-181.15328%20123.7504-297.24928a419.904%20419.904%200%200%200-121.57184-295.59808l-2.176-1.62688z%22%20fill%3D%22%233B3F51%22%20p-id%3D%2259651%22%3E%3C/path%3E%3C/svg%3E) } \ No newline at end of file diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json index eafb088..dc50c7e 100644 --- a/node_modules/.package-lock.json +++ b/node_modules/.package-lock.json @@ -16,6 +16,12 @@ "integrity": "sha512-XoTaXRqy8EuuHECGS2zFzAeDKoGDtC56VdahnVYTAcDLNo3fceQuXI2KhOSvjnn4Jbkt1UDch7IEuF9Eekf9eg==", "license": "ISC" }, + "node_modules/@beefast-wxmp/modal-view": { + "version": "0.1.9", + "resolved": "https://packages.aliyun.com/6486fc420ce788fc1c0798b3/npm/repo-glpby/@beefast-wxmp/modal-view/-/@beefast-wxmp/modal-view-0.1.9.tgz", + "integrity": "sha512-29qr37zPaW5BulJP34XIIDEd9TlI+2IfJp4KViTSfjLM+je4K0iLnrJQaQ5EBxrFP/IsLZdI0MwRRe+G1wbLaQ==", + "license": "ISC" + }, "node_modules/@beefast-wxmp/nav-bar": { "version": "0.0.3", "resolved": "https://packages.aliyun.com/6486fc420ce788fc1c0798b3/npm/repo-glpby/@beefast-wxmp/nav-bar/-/@beefast-wxmp/nav-bar-0.0.3.tgz", diff --git a/package-lock.json b/package-lock.json index edd566d..c691e05 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,7 @@ "dependencies": { "@beefast-wxmp/img-uploader": "^0.1.6", "@beefast-wxmp/list-view": "^0.0.1", + "@beefast-wxmp/modal-view": "^0.1.9", "@beefast-wxmp/nav-bar": "^0.0.3" } }, @@ -26,6 +27,12 @@ "integrity": "sha512-XoTaXRqy8EuuHECGS2zFzAeDKoGDtC56VdahnVYTAcDLNo3fceQuXI2KhOSvjnn4Jbkt1UDch7IEuF9Eekf9eg==", "license": "ISC" }, + "node_modules/@beefast-wxmp/modal-view": { + "version": "0.1.9", + "resolved": "https://packages.aliyun.com/6486fc420ce788fc1c0798b3/npm/repo-glpby/@beefast-wxmp/modal-view/-/@beefast-wxmp/modal-view-0.1.9.tgz", + "integrity": "sha512-29qr37zPaW5BulJP34XIIDEd9TlI+2IfJp4KViTSfjLM+je4K0iLnrJQaQ5EBxrFP/IsLZdI0MwRRe+G1wbLaQ==", + "license": "ISC" + }, "node_modules/@beefast-wxmp/nav-bar": { "version": "0.0.3", "resolved": "https://packages.aliyun.com/6486fc420ce788fc1c0798b3/npm/repo-glpby/@beefast-wxmp/nav-bar/-/@beefast-wxmp/nav-bar-0.0.3.tgz", diff --git a/package.json b/package.json index 689256f..b2f7e32 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "dependencies": { "@beefast-wxmp/img-uploader": "^0.1.6", "@beefast-wxmp/list-view": "^0.0.1", + "@beefast-wxmp/modal-view": "^0.1.9", "@beefast-wxmp/nav-bar": "^0.0.3" } } diff --git a/pages/my/index/index.wxml b/pages/my/index/index.wxml index ca07f53..0a65a24 100644 --- a/pages/my/index/index.wxml +++ b/pages/my/index/index.wxml @@ -5,42 +5,33 @@ 用户昵称 - 这是我的个性签名 - - - - - 我的收藏 + + + + - + 我的收藏 + - - - - 我的搭配 + + + - + 试穿历史 + - - - - - 历史记录 + + + + - - - - - - - 设置 - - + 我的收藏 + \ No newline at end of file diff --git a/pages/my/index/index.wxss b/pages/my/index/index.wxss index eb97611..ed0e428 100644 --- a/pages/my/index/index.wxss +++ b/pages/my/index/index.wxss @@ -1,7 +1,8 @@ /* pages/my/index/index.wxss */ .container { padding: 0; - background-color: #fff; + background-color: #f5f5f5; + min-height: 100vh; } /* 用户信息卡片 */ @@ -11,7 +12,6 @@ display: flex; align-items: center; margin-bottom: 20rpx; - border-bottom: 1rpx solid #f5f5f5; } .avatar { @@ -40,51 +40,3 @@ display: block; } -/* 功能列表 */ -.function-list { - margin-top: 20rpx; -} - -.list-item { - display: flex; - align-items: center; - justify-content: space-between; - padding: 30rpx; - background: #fff; - border-bottom: 1rpx solid #f5f5f5; - transition: background-color 0.3s; -} - -.list-item:active { - background-color: #f9f9f9; -} - -.item-left { - display: flex; - align-items: center; -} - -.item-icon { - width: 48rpx; - height: 48rpx; - margin-right: 20rpx; - color: #FF2727; -} - -.item-text { - font-size: 32rpx; - color: #333; - font-weight: 400; -} - -.arrow { - width: 16rpx; - height: 16rpx; - border-top: 3rpx solid #FF2727; - border-right: 3rpx solid #FF2727; - transform: rotate(45deg); -} - -.list-item:active { - background-color: rgba(255, 39, 39, 0.05); -} \ No newline at end of file diff --git a/pages/my/login/index.js b/pages/my/login/index.js index a9eff19..7af90d6 100644 --- a/pages/my/login/index.js +++ b/pages/my/login/index.js @@ -7,6 +7,8 @@ Page({ * 页面的初始数据 */ data: { + isAgree:false, + loging:false }, /** @@ -22,6 +24,9 @@ Page({ }, login(){ + this.setData({ + loging:true + }) wx.login({ success: (res) => { userAPI.login(res.code).then((data)=>{ @@ -38,10 +43,19 @@ Page({ if(prePage){ prePage.onLoad(prePage.options); } + }).finally(()=>{ + this.setData({ + loging:false + }) }) }, }) }, + radioChange(event){ + this.setData({ + isAgree:!!event.detail.value + }) + }, /** * 生命周期函数--监听页面显示 */ diff --git a/pages/my/login/index.wxml b/pages/my/login/index.wxml index 28cfca2..e470dba 100644 --- a/pages/my/login/index.wxml +++ b/pages/my/login/index.wxml @@ -4,5 +4,10 @@ - + + + + \ No newline at end of file diff --git a/pages/my/login/index.wxss b/pages/my/login/index.wxss index 1231f21..bfbffe9 100644 --- a/pages/my/login/index.wxss +++ b/pages/my/login/index.wxss @@ -16,5 +16,24 @@ width:100%; } .bottom .button{ + height: 120rpx; + border-radius: 60rpx; margin:0 40rpx!important; + line-height: 120rpx; + padding:0; + font-size: 40rpx; +} +.bottom .radio-group{ + margin-top:40rpx; +} +.bottom .radio-group .radio-item{ + display: flex; + align-items: center; + justify-content: center; +} +.bottom .radio-group .radio{ + margin-right: 10rpx; +} +.bottom .radio-group .red{ + color: var(--main-color); } \ No newline at end of file diff --git a/pages/try/index/index.js b/pages/try/index/index.js index 6be3959..3f410b6 100644 --- a/pages/try/index/index.js +++ b/pages/try/index/index.js @@ -20,20 +20,32 @@ Page({ currentHistory:{}, hasTryon:false, - personImageUploading:false + personImageUploading:false, + + isViewPersonImage:false, + + isShowComment:false, + tryonComment:{}, + tryonCommentLoading:false, + + pageHeight:0, + + tryonStatus:userAPI.tryOnStatus }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { + console.log(options); const windowInfo = wx.getWindowInfo(); console.log(windowInfo); const imgWidth = windowInfo.windowWidth - rpxToPx(80); const imgHeight = imgWidth*4/3; console.log(imgWidth,imgHeight); this.setData({ - imgHeight + imgHeight, + pageHeight:windowInfo.screenHeight }) this.getDefaultPersonImage(); this.getHistory(); @@ -42,7 +54,7 @@ Page({ userAPI.tryonHistory().then((data)=>{ let hasTryon = false; data.map((item)=>{ - if(!item.completion_url&&item.status!='失败'){ + if(!item.completion_url&&item.status!=userAPI.tryOnStatus.error){ hasTryon = true; this.checkResult(item.id) } @@ -90,16 +102,17 @@ Page({ chooseTopClothing(){ if(this.data.currentHistory&&this.data.currentHistory.id){ - return; + this.viewImage(this.data.currentHistory.top_clothing_url); + }else{ + this.chooseAndUpload('topClothing'); } - this.chooseAndUpload('topClothing'); }, chooseBottomClothing(){ if(this.data.currentHistory&&this.data.currentHistory.id){ - return; + this.viewImage(this.data.currentHistory.bottom_clothing_url); + }else{ + this.chooseAndUpload('bottomClothing'); } - this.chooseAndUpload('bottomClothing'); - }, chooseAndUpload(key){ @@ -138,6 +151,10 @@ Page({ top_clothing_url:this.data.topClothing.serverUrl, bottom_clothing_url:this.data.bottomClothing.serverUrl }).then((data)=>{ + this.setData({ + topClothing:{}, + bottomClothing:{} + }) this.getHistory(); }).finally(()=>{ this.setData({ @@ -152,7 +169,7 @@ Page({ }) setTimeout(()=>{ userAPI.checkTryon(id).then((data)=>{ - if(data.completion_url){ + if(data.completion_url||data.status==userAPI.tryOnStatus.error){ this.getHistory(); }else{ this.checkResult(id); @@ -191,6 +208,44 @@ Page({ } }) }, + viewPersonImage(){ + this.setData({ + isViewPersonImage:true + }) + }, + viewCompleteImage(){ + this.setData({ + isViewPersonImage:false + }) + }, + showComment(){ + if(this.data.tryonCommentLoading)return; + this.setData({ + tryonCommentLoading:true + }) + userAPI.getTryonComment(this.data.currentHistory.id).then((data)=>{ + wx.hideTabBar({ + success:()=>{ + this.setData({ + isShowComment:true, + tryonComment:data + }) + } + }); + }).finally(()=>{ + this.setData({ + tryonCommentLoading:false + }) + }) + }, + commentViewLeave(){ + wx.showTabBar(); + wx.rewriteRoute({ + url:'/pages/try/index/index', + preserveQuery:true + }); + this.options.shared_history_id = ''; + }, /** * 生命周期函数--监听页面初次渲染完成 @@ -202,7 +257,19 @@ Page({ /** * 生命周期函数--监听页面显示 */ - onShow(options) { + onShow() { + if(this.options&&this.options.shared_history_id){ + userAPI.tryonDetail(this.options.shared_history_id).then((data)=>{ + wx.hideTabBar({ + success:()=>{ + this.setData({ + isShowComment:true, + tryonComment:data + }) + } + }); + }) + } }, getDefaultPersonImage(){ userAPI.getDefaultPersonImage().then((data)=>{ @@ -229,6 +296,14 @@ Page({ currentHistory:{} }) }, + viewImageInView(event){ + this.viewImage(event.currentTarget.dataset.item); + }, + viewImage(url){ + wx.previewImage({ + urls: [url], + }) + }, /** * 生命周期函数--监听页面隐藏 */ @@ -261,6 +336,12 @@ Page({ * 用户点击右上角分享 */ onShareAppMessage() { - + if(this.data.currentHistory.id){ + return { + title:'美搭,美达,美美哒', + imageUrl:this.data.currentHistory.completion_url, + path:`/pages/try/index/index?shared_history_id=${this.data.currentHistory.id}` + } + } } }) \ No newline at end of file diff --git a/pages/try/index/index.json b/pages/try/index/index.json index d3ac607..5e4ec41 100644 --- a/pages/try/index/index.json +++ b/pages/try/index/index.json @@ -1,6 +1,7 @@ { "usingComponents": { - "nav-bar":"/miniprogram_npm/@beefast-wxmp/nav-bar" + "nav-bar":"/miniprogram_npm/@beefast-wxmp/nav-bar", + "modal-view":"/miniprogram_npm/@beefast-wxmp/modal-view" }, "navigationStyle": "custom" } \ No newline at end of file diff --git a/pages/try/index/index.wxml b/pages/try/index/index.wxml index d051a3b..0ad28cb 100644 --- a/pages/try/index/index.wxml +++ b/pages/try/index/index.wxml @@ -11,8 +11,15 @@ - + + @@ -52,9 +59,14 @@ + + + + @@ -70,7 +82,7 @@ - + 失败 @@ -78,9 +90,20 @@ - + - \ No newline at end of file + + + + + + {{tryonComment.score}} + AI 点评: + {{tryonComment.comment}} + + + \ No newline at end of file diff --git a/pages/try/index/index.wxss b/pages/try/index/index.wxss index b61afe4..22c5874 100644 --- a/pages/try/index/index.wxss +++ b/pages/try/index/index.wxss @@ -4,7 +4,7 @@ box-sizing: border-box; } .try-container .header{ - font-size: 40rpx; + font-size: 52rpx; font-weight: bold; display: flex; align-items: center; @@ -169,4 +169,76 @@ font-size: 40rpx; margin-left:-20rpx; margin-top:-20rpx; +} + +.comment-modal-view .modal-view-main{ + padding:0; + overflow: hidden; +} +.comment-modal-view .modal-view-main .close-btn-area{ + right:0;top:0; +} +.comment-modal-view .modal-view-main .close-btn-area .close-btn{ + content: ''; + top:0;left:0; + border-radius: 50%; + background-color: rgba(0, 0, 0, .2); +} +.comment-modal-view .modal-view-main .close-btn-area .close-btn::after{ + width:1em;height:1em; + -webkit-mask-position:0 0; + mask-position:0 0; + -webkit-mask-repeat:no-repeat; + mask-repeat:no-repeat; + -webkit-mask-size:100%; + mask-size:100%; + background-color:currentColor; + color: #ddd; + mask-image: var(--icon-plus); + -webkit-mask-image: var(--icon-plus); + font-size: 36rpx; + transform: rotate(45deg); + left:10rpx; + top:8rpx; +} +.comment-modal-view .modal-view-main .close-btn-area .close-btn::before{ + display: none; +} +.comment-modal-view .modal-view-main .main-img{ + width:100%; + /* 54是弹出框左右的宽度 */ + height:calc((100vw - 54px)*4/3); +} +.comment-modal-view .modal-view-main .comment{ + padding:40rpx; +} +.comment-modal-view .modal-view-main .point{ + display: flex; + justify-content: center; + align-items: baseline; + + color:var(--main-color); + font-size: 70rpx; + line-height: 70rpx; + font-weight: bold; +} +.comment-modal-view .modal-view-main .point::after{ + content:'分'; + line-height: 30rpx; + font-size: 30rpx; + font-weight: normal; + margin-left:10rpx; + color: var(--main-font-color); +} +.comment-modal-view .cmt-title{ + font-size: 36rpx; + font-weight: bold; + margin:20rpx 0; +} +.comment-modal-view .cmt-content{ + line-height: 40rpx; + text-indent: 2em; +} +.comment-modal-view .button{ + margin-top:40rpx; } \ No newline at end of file diff --git a/project.private.config.json b/project.private.config.json index 3ca0734..f602aa3 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -3,5 +3,18 @@ "projectname": "meida", "setting": { "compileHotReLoad": true + }, + "condition": { + "miniprogram": { + "list": [ + { + "name": "pages/try/index/index", + "pathName": "pages/try/index/index", + "query": "shared_history_id=33", + "launchMode": "default", + "scene": null + } + ] + } } } \ No newline at end of file