mini/pages/try/index/index.wxml

109 lines
5.2 KiB
Plaintext

<scroll-view class="try-container" scroll-y show-scrollbar="{{false}}" enhanced>
<view class="top">
<nav-bar/>
<view class="header">
<view>我的试衣间</view>
<button plain size="mini" class="button" bind:tap="chooseImg"
loading="{{personImage.uploading}}" disabled="{{personImage.uploading}}">
{{defaultPersonImage?'更换形象照':'添加形象照'}}
</button>
</view>
</view>
<view class="main" style="height:{{imgHeight}}px">
<block wx:if="{{defaultPersonImage}}">
<!--
isViewPersonImage:长按显示模特照片,松开显示生成的照片,如果生成失败,就还是显示模特照片
-->
<image class="person-image" mode="aspectFit"
src="{{isViewPersonImage?currentHistory.person_image.image_url:(currentHistory.completion_url||currentHistory.person_image.image_url)}}"
data-item="{{isViewPersonImage?currentHistory.person_image.image_url:(currentHistory.completion_url||currentHistory.person_image.image_url)}}"
wx:if="{{currentHistory.id}}" bind:longpress="viewPersonImage"
bind:tap="viewImageInView"
bind:touchcancel="viewCompleteImage" bind:touchend="viewCompleteImage"/>
<image class="person-image" src="{{defaultPersonImage}}" mode="aspectFit" wx:else/>
</block>
<block wx:else>
<!-- <button plain size="mini" class="top-btn" bind:tap="chooseImg">添加形象照</button> -->
<view class="upload-btn">
<view class="icon body"></view>
</view>
</block>
<view class="clothing" wx:if="{{defaultPersonImage}}">
<view class="item c-top" bind:tap="chooseTopClothing">
<image src="{{currentHistory.top_clothing_url}}" class="image" mode="aspectFit"
wx:if="{{currentHistory.id}}"/>
<block wx:elif="{{topClothing.tempFilePath}}">
<image src="{{topClothing.serverUrl||topClothing.tempFilePath}}" class="image"
mode="aspectFit"/>
<view class="loading-area" wx:if="{{topClothing.uploading}}">
<view class="icon loading"></view>
</view>
</block>
<view class="icon top-clothing" wx:else></view>
</view>
<view class="item c-bottom" bind:tap="chooseBottomClothing">
<image src="{{currentHistory.bottom_clothing_url}}" class="image" mode="aspectFit"
wx:if="{{currentHistory.id}}"/>
<block wx:elif="{{bottomClothing.tempFilePath}}">
<image src="{{bottomClothing.serverUrl||bottomClothing.tempFilePath}}"
class="image" mode="aspectFit"/>
<view class="loading-area" wx:if="{{bottomClothing.uploading}}">
<view class="icon loading"></view>
</view>
</block>
<view class="icon bottom-clothing" wx:else></view>
</view>
<!-- <view class="item share-area">
<view class="icon share"></view>
</view> -->
</view>
</view>
<view class="bottom" wx:if="{{defaultPersonImage}}">
<block wx:if="{{currentHistory.id}}">
<button type="primary" bind:tap="showComment" wx:if="{{currentHistory.completion_url}}"
loading="{{tryonCommentLoading}}">查看 AI 点评</button>
<button type="primary" wx:else disabled>生成失败</button>
</block>
<button type="primary" bind:tap="tryon"
loading="{{hasTryon||trying}}"
disabled="{{hasTryon||trying}}" wx:else>
{{hasTryon||trying?'请等待上一个试穿任务':'立刻试穿'}}
</button>
</view>
<scroll-view class="history" scroll-x="{{true}}" enable-flex show-scrollbar="{{false}}" enhanced>
<view class="item btn-new {{currentHistory.id?'':'current'}}" bind:tap="addNew">
<view class="icon plus"></view>
</view>
<view class="item {{currentHistory.id==item.id?'current':''}}" wx:for="{{history}}"
bind:tap="selectHistory" data-item="{{item}}" wx:key="index"
bind:longpress="deleteHistory">
<image wx:if="{{item.completion_url}}" src="{{item.completion_url}}" class="image"
mode="aspectFit"/>
<block wx:else>
<image src="{{item.top_clothing_url}}" class="top-img"/>
<image src="{{item.bottom_clothing_url}}" class="bottom-img"/>
<view class="error-area" wx:if="{{item.status==tryonStatus.error}}">
<view type="warn" size="60rpx" class="icon warn"><view class="dispatch"/></view>
<view class="tips">失败</view>
</view>
<view class="loading-area" wx:else>
<view class="icon loading"></view>
</view>
</block>
<!-- <view class="delete-area" capture-catch:tap="deleteHistory" data-item="{{item}}">
<view class="icon delete"></view>
</view> -->
</view>
</scroll-view>
</scroll-view>
<modal-view show="{{isShowComment}}" class="comment-modal-view" pageHeight="{{pageHeight}}"
isShowCancel="{{false}}" isShowOk="{{false}}" bind:afterLeave="commentViewLeave" showCloseButton>
<image src="{{tryonComment.completion_url}}" class="main-img" mode="aspectFill"/>
<view class="comment">
<view class="point">{{tryonComment.score}}</view>
<view class="cmt-title">AI 点评:</view>
<view class="cmt-content">{{tryonComment.comment}}</view>
<button class="button" type="primary" bind:tap="share" open-type="share">分享</button>
</view>
</modal-view>