243 lines
6.7 KiB
Plaintext
243 lines
6.7 KiB
Plaintext
<!--pages/main/travel-location-editor/index.wxml-->
|
||
<t-navbar title="{{mode === 'create' ? '添加地点' : '编辑地点'}}">
|
||
<text slot="left" bindtap="cancel">取消</text>
|
||
</t-navbar>
|
||
|
||
<scroll-view class="container" type="custom" scroll-y show-scrollbar="{{false}}">
|
||
<view class="content">
|
||
<view wx:if="{{isLoading}}" class="loading">
|
||
<t-loading theme="dots" size="40rpx" />
|
||
<text class="loading-text">加载中...</text>
|
||
</view>
|
||
<block wx:else>
|
||
<t-cell-group class="section">
|
||
<t-cell title="地点类型">
|
||
<view slot="right-icon">
|
||
<picker
|
||
class="picker"
|
||
mode="selector"
|
||
range="{{locationTypes}}"
|
||
range-key="label"
|
||
value="{{locationTypeIndex}}"
|
||
bindchange="onChangeLocationType"
|
||
>
|
||
<view class="slot">
|
||
<text>{{locationTypes[locationTypeIndex].label}}</text>
|
||
<t-icon name="chevron-right" size="20px" class="icon" />
|
||
</view>
|
||
</picker>
|
||
</view>
|
||
</t-cell>
|
||
<t-cell title="位置" required bind:click="chooseLocation">
|
||
<view slot="right-icon">
|
||
<view class="location-slot">
|
||
<text wx:if="{{location}}" class="location-text">{{location}}</text>
|
||
<text wx:else class="location-placeholder">点击选择位置</text>
|
||
<t-icon name="chevron-right" size="20px" class="icon" />
|
||
</view>
|
||
</view>
|
||
</t-cell>
|
||
</t-cell-group>
|
||
<t-cell-group class="section">
|
||
<t-input
|
||
class="input"
|
||
placeholder="请输入地点名称"
|
||
model:value="{{title}}"
|
||
label="标题"
|
||
maxlength="50"
|
||
/>
|
||
<t-textarea
|
||
class="textarea"
|
||
placeholder="添加地点说明(选填)"
|
||
model:value="{{description}}"
|
||
maxlength="500"
|
||
indicator
|
||
>
|
||
<text slot="label">说明</text>
|
||
</t-textarea>
|
||
</t-cell-group>
|
||
<t-cell-group class="section">
|
||
<t-input
|
||
model:value="{{amount}}"
|
||
placeholder="0"
|
||
label="费用"
|
||
suffix="元"
|
||
align="right"
|
||
/>
|
||
<t-cell title="必要评分">
|
||
<view slot="right-icon">
|
||
<t-rate
|
||
value="{{score}}"
|
||
count="{{5}}"
|
||
size="24px"
|
||
bind:change="onChangeScore"
|
||
/>
|
||
</view>
|
||
</t-cell>
|
||
<t-cell title="需要身份证">
|
||
<view slot="right-icon">
|
||
<switch checked="{{requireIdCard}}" bindchange="onChangeRequireIdCard" />
|
||
</view>
|
||
</t-cell>
|
||
</t-cell-group>
|
||
<view class="section media">
|
||
<view class="gallery">
|
||
<!-- 创建模式:mediaList 显示新选择的媒体 -->
|
||
<block wx:if="{{mode === 'create'}}">
|
||
<block wx:for="{{mediaList}}" wx:key="index">
|
||
<view class="item">
|
||
<!-- 图片 -->
|
||
<image
|
||
wx:if="{{item.type === mediaItemTypeEnum.IMAGE}}"
|
||
src="{{item.path}}"
|
||
class="thumbnail"
|
||
mode="aspectFill"
|
||
bindtap="preview"
|
||
data-index="{{index}}"
|
||
data-new-media="{{true}}"
|
||
></image>
|
||
<!-- 视频 -->
|
||
<view wx:if="{{item.type === mediaItemTypeEnum.VIDEO}}" class="video-container">
|
||
<image
|
||
src="{{item.thumbPath}}"
|
||
class="thumbnail"
|
||
mode="aspectFill"
|
||
bindtap="preview"
|
||
data-index="{{index}}"
|
||
data-new-media="{{true}}"
|
||
></image>
|
||
<t-icon class="play-icon" name="play" />
|
||
</view>
|
||
<!-- 删除 -->
|
||
<t-icon
|
||
class="delete"
|
||
name="close"
|
||
bindtap="deleteMedia"
|
||
data-index="{{index}}"
|
||
data-new-media="{{true}}"
|
||
/>
|
||
</view>
|
||
</block>
|
||
</block>
|
||
<!-- 编辑模式:mediaList 显示现有附件,newMediaList 显示新添加的附件 -->
|
||
<block wx:else>
|
||
<!-- 现有附件 -->
|
||
<block wx:for="{{mediaList}}" wx:key="attachmentId">
|
||
<view class="item">
|
||
<!-- 图片 -->
|
||
<image
|
||
wx:if="{{item.type === mediaItemTypeEnum.IMAGE}}"
|
||
src="{{item.thumbURL}}"
|
||
class="thumbnail"
|
||
mode="aspectFill"
|
||
bindtap="preview"
|
||
data-index="{{index}}"
|
||
data-new-media="{{false}}"
|
||
></image>
|
||
<!-- 视频 -->
|
||
<view wx:if="{{item.type === mediaItemTypeEnum.VIDEO}}" class="video-container">
|
||
<image
|
||
src="{{item.thumbURL}}"
|
||
class="thumbnail"
|
||
mode="aspectFill"
|
||
bindtap="preview"
|
||
data-index="{{index}}"
|
||
data-new-media="{{false}}"
|
||
></image>
|
||
<t-icon class="play-icon" name="play" />
|
||
</view>
|
||
<!-- 删除 -->
|
||
<t-icon
|
||
class="delete"
|
||
name="close"
|
||
bindtap="deleteMedia"
|
||
data-index="{{index}}"
|
||
data-new-media="{{false}}"
|
||
/>
|
||
</view>
|
||
</block>
|
||
<!-- 新选择附件 -->
|
||
<block wx:for="{{newMediaList}}" wx:key="index">
|
||
<view class="item new-item">
|
||
<!-- 图片 -->
|
||
<image
|
||
wx:if="{{item.type === mediaItemTypeEnum.IMAGE}}"
|
||
src="{{item.path}}"
|
||
class="thumbnail"
|
||
mode="aspectFill"
|
||
bindtap="preview"
|
||
data-index="{{index}}"
|
||
data-new-media="{{true}}"
|
||
></image>
|
||
<!-- 视频 -->
|
||
<view wx:if="{{item.type === mediaItemTypeEnum.VIDEO}}" class="video-container">
|
||
<image
|
||
src="{{item.thumbPath}}"
|
||
class="thumbnail"
|
||
mode="aspectFill"
|
||
bindtap="preview"
|
||
data-index="{{index}}"
|
||
data-new-media="{{true}}"
|
||
></image>
|
||
<t-icon class="play-icon" name="play" />
|
||
</view>
|
||
<!-- 新增标识 -->
|
||
<t-icon class="new-badge" name="add" />
|
||
<!-- 删除 -->
|
||
<t-icon
|
||
class="delete"
|
||
name="close"
|
||
bindtap="deleteMedia"
|
||
data-index="{{index}}"
|
||
data-new-media="{{true}}"
|
||
/>
|
||
</view>
|
||
</block>
|
||
</block>
|
||
<!-- 添加按钮 -->
|
||
<t-button
|
||
class="item add"
|
||
theme="primary"
|
||
plain="true"
|
||
disabled="{{isSaving}}"
|
||
bind:tap="addMedia"
|
||
>
|
||
<t-icon name="add" />
|
||
</t-button>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 上传进度提示 -->
|
||
<view wx:if="{{isUploading}}" class="upload-info">
|
||
<t-loading theme="circular" size="32rpx" />
|
||
<text class="upload-text">{{uploadInfo}}</text>
|
||
</view>
|
||
|
||
<!-- 按钮 -->
|
||
<view class="submit-section">
|
||
<t-button
|
||
wx:if="{{mode === 'edit'}}"
|
||
class="delete-btn"
|
||
theme="danger"
|
||
variant="outline"
|
||
size="large"
|
||
bind:tap="deleteLocation"
|
||
disabled="{{isSaving || isUploading}}"
|
||
>
|
||
删除
|
||
</t-button>
|
||
<t-button
|
||
class="submit-btn"
|
||
theme="primary"
|
||
size="large"
|
||
bind:tap="submit"
|
||
loading="{{isSaving}}"
|
||
disabled="{{isSaving || isUploading}}"
|
||
>
|
||
{{mode === 'create' ? '创建地点' : '保存修改'}}
|
||
</t-button>
|
||
</view>
|
||
</block>
|
||
</view>
|
||
</scroll-view>
|