<cu-custom isBack="{{true}}">
    <view slot="content">{{title}}</view>
</cu-custom>
<view wx:if="{{fieldList.length>0}}" class="flex flex-direction radius align-center">
    <view class="flex flex-direction self-center" style="width:95%;margin-bottom:100rpx;">
        <!-- 内容 1:文字,2:照片,3:音频,4:视频,5:链接,6:定位,7:文章 -->
        <view wx:for="{{fieldList}}" wx:key="index">
            <!-- 文本 -->
            <view wx:if="{{item.dataType == '1'}}" class="margin-top-xs">
                <view class="cu-form-group  padding-xs">
                    <view class="title margin-left-sm">{{item.comment}}</view>
                    <input placeholder="请输入内容" maxlength="{{item.maxLength}}" data-key="{{item.name}}"
                        data-value="{{item.value}}" bindinput="inputText" data-index="{{index}}"></input>
                </view>
            </view>
            <!-- 文本域 -->
            <view wx:if="{{item.dataType == '7'}}" class=" margin-top-xs">
                <view class="cu-bar bg-white margin-top-xs">
                    <view class="action">
                        <text>{{item.comment}}</text>
                    </view>
                </view>
                <view class="bg-white padding-xs">
                    <view class="cu-form-group">
                        <textarea class="border-line padding-left-xs padding-right-xs margin-left-xs margin-right-xs"
                            maxlength="{{item.maxLength}}" data-key="{{item.name}}" data-value="{{item.value}}"
                            bindinput="inputText" data-index="{{index}}" placeholder="请输入内容"></textarea>
                    </view>
                </view>
            </view>
            <!-- 图片 -->
            <view wx:elif="{{item.dataType == '2'}}" class=" margin-top-xs">
                <view class="cu-bar bg-white margin-top-xs">
                    <view class="action">
                        <text>{{item.comment}}</text>
                    </view>
                    <view class="action">
                        {{item.valueList.length}}/{{item.maxCount}}
                    </view>
                </view>
                <view class="cu-form-group  padding-xs">
                    <view class="grid col-4 grid-square flex-sub">
                        <view class="bg-img" wx:for="{{item.valueList}}" wx:for-index="idx" wx:key="idx"
                            bindtap="viewImg" wx:for-item="photo" data-url="{{photo.path}}">
                            <image src='{{photo.path}}' mode='aspectFill'></image>
                            <view class="cu-tag bg-red" catchtap="delImg" data-index="{{idx}}"
                                data-itemIndex="{{index}}">
                                <text class="cuIcon-close"></text>
                            </view>
                        </view>
                        <view class="solids" bindtap="choosePhoto" data-item="{{item}}" data-index="{{index}}"
                            wx:if="{{item.valueList.length<item.maxCount}}">
                            <text class="cuIcon-cameraadd"></text>
                        </view>
                    </view>
                </view>
            </view>
            <!-- 音频 -->
            <view wx:elif="{{item.dataType == '3'}}" class=" margin-top-xs">
                <view class="cu-bar bg-white margin-top-xs">
                    <view class="action">
                        <text>{{item.comment}}</text>
                    </view>
                    <view class="action">
                        {{item.valueList.length}}/{{item.maxCount}}
                    </view>
                </view>
                <view class="flex flex-direction align-center bg-white radius padding-sm">
                    <view wx:if="{{item.valueList.length > 0}}" style="width:100%;">
                        <view class="flex align-center shadow-box margin-top-xs" style="width:100%;"
                            wx:for="{{item.valueList}}" wx:for-index="idx" wx:key="idx" wx:for-item="audio">
                            <image src="/images/ic_user_default.png" mode="scaleToFill"
                                style="width:80rpx;height:80rpx;">
                            </image>
                            <view class="play-box">
                                <view class="flex justify-between align-center" style="width:80%;">
                                    <text>{{audio.curDurationStr}}</text>
                                    <slider class="flex-sub" bindchange="slider4change" min="{{0}}"
                                        max="{{audio.duration}}" value="{{audio.curDuration}}" backgroundColor="#cacaca"
                                        activeColor="#1296db" data-index="{{index}}" data-idx="{{idx}}"
                                        data-item="{{audio}}" block-size="14" block-color="#1296db" />
                                    <text>{{audio.totalDurationStr}}</text>
                                </view>
                                <view class="flex justify-between" style="width:80%;">
                                    <image src="/images/ic_audio_rewind.png" mode="scaleToFill" data-index="{{index}}"
                                        data-idx="{{idx}}" data-item="{{audio}}" bindtap="rewind"></image>
                                    <image
                                        src="{{audio.isPlay ? '/images/ic_audio_playing.png':'/images/ic_audio_play.png'}}"
                                        mode="scaleToFill" bindtap="play" data-index="{{index}}" data-idx="{{idx}}"
                                        data-item="{{audio}}">
                                    </image>
                                    <image src="/images/ic_audio_speed.png" mode="scaleToFill" bindtap="speed"
                                        data-index="{{index}}" data-idx="{{idx}}" data-item="{{audio}}"></image>
                                </view>
                            </view>
                            <view class="cu-tag bg-gray margin-left-xs" style="border-radius:50%;" catchtap="delAudio"
                                data-index="{{index}}" data-idx="{{idx}}">
                                <text class="cuIcon-close"></text>
                            </view>
                        </view>
                    </view>

                    <view class="flex align-center flex-direction" wx:else>
                        <image src="/images/ic_empty_voice.png" mode="scaleToFill" style="width:200rpx;height:200rpx;">
                        </image>
                        <text class="text-gray">
                            语音,可以给名片访客留下更深的印象
                        </text>
                    </view>
                    <view wx:if="{{item.valueList.length<item.maxCount}}" class="cu-btn bg-blue radius margin-top-sm"
                        style="width:60%;" data-index="{{index}}" data-item="{{item}}" bindtap="showDialog">点击添加
                    </view>
                </view>
            </view>
            <!-- 视频 -->
            <view wx:elif="{{item.dataType == '4'}}" class=" margin-top-xs">
                <view class="cu-bar bg-white margin-top-xs">
                    <view class="action">
                        {{item.comment}}
                    </view>
                    <view class="action">
                        {{item.valueList.length}}/{{item.maxCount}}
                    </view>
                </view>
                <view class="cu-form-group  padding-xs">
                    <view class="grid col-4 grid-square flex-sub">
                        <view class="bg-img" wx:for="{{item.valueList}}" wx:for-index="idx" wx:key="idx"
                            wx:for-item="video" bindtap="viewVideo" data-url="{{video.path}}">
                            <image src='{{video.imgPath}}' mode='aspectFill'></image>
                            <view class="cu-tag bg-red" catchtap="delVideo" data-index="{{index}}" data-idx="{{idx}}">
                                <text class="cuIcon-close"></text>
                            </view>
                        </view>
                        <view class="solids" bindtap="chooseVideo" wx:if="{{item.valueList.length<item.maxCount}}"
                            data-item="{{item}}" data-index="{{index}}">
                            <text class="cuIcon-cameraadd"></text>
                        </view>
                    </view>
                </view>
            </view>
            <!-- 链接 -->
            <view wx:if="{{item.dataType == '5'}}" class=" margin-top-xs">
                <view class="cu-form-group ">
                    <view class="title margin-left-sm padding-xs">{{item.comment}}</view>
                    <input placeholder="请输入内容" maxlength="{{item.maxLength}}" data-key="{{item.name}}"
                        data-value="{{item.value}}" bindinput="inputText" data-index="{{index}}"></input>
                </view>
            </view>
            <!-- 定位 -->
            <view wx:elif="{{item.dataType=='6'}}" class=" margin-top-xs">
                <view class="cu-bar bg-white">
                    <view class="action">
                        <text>{{item.comment}}</text>
                    </view>
                    <view class="action">
                    </view>
                </view>
                <view class="flex flex-direction align-center bg-white radius padding-sm">
                    <view wx:if="{{item.valueList.length>0}}">
                        <view wx:for="{{item.valueList}}" wx:for-index="idx" wx:key="idx" wx:for-item="m"
                            style="width:100%;" class="margin-top-xs">
                            <view class="flex justify-between">
                                <view>
                                    {{m.name}}-{{m.address}}
                                </view>
                                <view class="cu-tag bg-gray margin-left-xs" catchtap="delMap" data-index="{{index}}"
                                    data-idx="{{idx}}">
                                    <text class="cuIcon-close"></text>
                                </view>
                            </view>
                            <view style="border-radius:10rpx;overflow:hidden;margin-top:10rpx;">
                                <map style="width:100%;height:300rpx;" longitude="{{m.longitude}}"
                                    latitude="{{m.latitude}}" scale="12"
                                    markers="{{[{latitude:m.latitude,longitude:m.longitude}]}}"></map>
                            </view>
                        </view>
                    </view>
                    <view class="flex align-center bg-white flex-direction" wx:else>
                        <image src="/images/ic_empty_map.png" mode="scaleToFill" style="width:200rpx;height:200rpx;">
                        </image>
                        <text class="text-gray">
                            在地图上选取一个地点
                        </text>
                    </view>
                    <view wx:if="{{item.valueList.length < item.maxCount}}" class="cu-btn bg-blue radius margin-top-sm"
                        data-index="{{index}}" style="width:60%;" bindtap="chooseLocation">点击添加</view>
                </view>
            </view>
            <!-- 单选 -->
            <view wx:elif="{{item.dataType=='8'}}" class="margin-top-xs">
                <view class="cu-form-group  padding-xs">
                    <view class="title  margin-left-sm">{{item.comment}}</view>
                    <picker bindchange="pickerChange" data-index="{{index}}" value="{{item.index}}"
                        range="{{item.dictionariesList}}" range-key="dataName">
                        <view class="picker">
                            {{item.dictionariesList[item.index].dataName}}
                        </view>
                    </picker>
                </view>
            </view>
            <!-- 多选 -->
            <view wx:elif="{{item.dataType=='9'}}" class="margin-top-xs">
                <view class="cu-form-group  padding-xs" data-index="{{index}}" data-item="{{item}}"
                    catchtap="showMutliSel">
                    <view class="title margin-left-sm">{{item.comment}}</view>
                    <view class="flex align-center" style="flex-direction:row;">
                        <view class="margin-right-sm">
                            {{item.selValue}}
                        </view>
                        <text class="cuIcon-right"></text>
                    </view>
                </view>
            </view>
        </view>
    </view>
</view>
<view wx:else style="margin-top:200rpx;width:100%;">
    <van-empty description="暂无数据" image="../../../images/ic_empty_data.png" />
</view>

<view class="padding-xs foot bg-white" wx:if="{{fieldList.length > 0}}">
    <button class="cu-btn bg-blue" style="width:100%" bindtap="doPublish">保存</button>
</view>

<!-- 语音弹框 -->
<van-action-sheet show="{{ isShowAudio }}" title="语音介绍添加" bind:close="onHide" data-type="1"
    style="padding-bottom:180rpx;">
    <view class="flex flex-direction align-center" style="margin-top:10rpx;padding-bottom:80rpx;"
        wx:if="{{audioFile==null}}">
        <image src="{{isRecording? '/images/ic_voice_record.gif':'/images/ic_record_start.png'}}" mode="heightFix"
            style="width:300rpx;height:300rpx;"></image>
        <text>00:{{speck_time>9 ? speck_time : '0'+ speck_time}}</text>
        <view class="cu-btn bg-blue radius margin-top-sm" style="width:70%;" bindlongpress="startRecord"
            bindtouchend="doEndRecord">长按录音</view>
    </view>
    <!-- 存在录音文件 -->
    <view class="flex flex-direction align-center" style="margin-top:10rpx;padding-bottom:80rpx;" wx:else>
        <image src="{{audioFile.isPlay? '/images/ic_voice_record.gif':'/images/ic_record_start.png'}}" mode="heightFix"
            style="width:300rpx;height:300rpx;"></image>
        <text>{{audioFile.isPlay ? '播放中:'+speck_time+'秒' : '时长:'+audioFile.duration+'秒'}}</text>
        <view class="flex" style="width:80%;">
            <view class="cu-btn bg-blue radius margin-top-sm flex-sub" bindtap="playAudio">点击播放</view>
            <view class="cu-btn bg-red radius margin-top-sm flex-sub margin-left" bindtap="delAudio">删除</view>
        </view>
    </view>
</van-action-sheet>
<!-- 文本域弹框 -->
<van-action-sheet show="{{ isShowDesc }}" title="{{'文本内容'+'('+textareaList.length+'/'+ currentItem.count+')'}}"
    bind:close="onHide" data-type="2" style="padding-bottom:20rpx;">
    <view class="flex flex-direction align-center" style="margin-top:10rpx;padding-bottom:30rpx;">
        <textarea id="tempDesc" placeholder="请输入文本内容" style="width:90%;" value="{{tempDesc}}"
            bindinput="textInput"></textarea>
        <view class="cu-btn bg-blue radius margin-top-sm" bindtap="addDesc">点击添加</view>
    </view>
</van-action-sheet>
<!-- 文本内容弹框 -->
<van-action-sheet show="{{ isShowText }}" title="{{'文本内容'+'('+textList.length+'/'+ currentItem.count+')'}}"
    bind:close="onHide" data-type="3" style="padding-bottom:180rpx;">
    <view class="flex flex-direction align-center" style="margin-top:10rpx;padding-bottom:30rpx;">
        <input id="tempText" placeholder="请输入文本内容" style="width:90%;" value="{{tempText}}" bindinput="textInput" />
        <view class="cu-btn bg-blue radius margin-top-sm" bindtap="addStr">点击添加</view>
    </view>
</van-action-sheet>
<!-- 图片弹框 -->
<van-action-sheet show="{{ isShowPhoto }}" title="图片选取" bind:close="onHide" data-type="4" style="padding-bottom:20rpx;">
    <view class="flex flex-direction align-center" style="margin-top:10rpx;padding-bottom:30rpx;">
        <view class="text-lg line" catchtap="choosePhoto" data-type="album">
            相册
        </view>
        <view class="text-lg noline" catchtap="choosePhoto" data-type="camera">
            相机
        </view>
    </view>
</van-action-sheet>
<!-- 视频弹框 -->
<van-action-sheet show="{{ isShowVideo }}" title="视频选取" bind:close="onHide" data-type="6" style="padding-bottom:20rpx;">
    <view class="flex flex-direction align-center" style="margin-top:10rpx;padding-bottom:30rpx;">
        <view class="text-lg line" catchtap="chooseVideo" data-type="album">
            相册
        </view>
        <view class="text-lg noline" catchtap="chooseVideo" data-type="camera">
            相机
        </view>
    </view>
</van-action-sheet>

<!-- 文本内容弹框 -->
<van-action-sheet show="{{ isShowLink }}" title="{{'链接内容'+'('+linkList.length+'/'+ currentItem.count+')'}}"
    bind:close="onHide" data-type="5" style="padding-bottom:180rpx;">
    <view class="flex flex-direction align-center" style="margin-top:10rpx;padding-bottom:30rpx;">
        <input id="linkStr" placeholder="请输入链接地址(https://www.baidu.com)" style="width:90%;" value="{{linkStr}}"
            bindinput="textInput" />
        <view class="cu-btn bg-blue radius margin-top-sm" bindtap="addLink">点击添加</view>
    </view>
</van-action-sheet>

<!-- 多选 -->
<van-action-sheet show="{{ isShowTags }}" title="请选择" bind:close="onHide" data-type="8" style="padding-bottom:180rpx;">
    <view class="flex flex-direction align-center" style="margin-top:10rpx;padding-bottom:30rpx;">
        <scroll-view style="height:320rpx;max-height:320rpx;padding:0rpx 20rpx;" scroll-y>
            <view class="cu-capsule radius" wx:for="{{fieldList[currentIndex].dictionariesList}}" wx:key="index">
                <view class="cu-tag {{item.isSel ? 'bg-blue' : 'bg-gray' }}" catchtap="chooseTags" data-idx="{{index}}">
                    {{item.dataName}}
                </view>
            </view>
        </scroll-view>
    </view>
</van-action-sheet>