<cu-custom isBack="{{true}}">
    <view slot="content">内容发布</view>
</cu-custom>
<view wx:if="{{fieldList.length>0}}">
    <!-- 内容 1:文字,2:照片,3:音频,4:视频,5:链接,6:定位,7:文章 -->
    <view wx:for="{{fieldList}}" wx:key="index">
        <!-- 文本 -->
        <view class="flex  flex-direction" wx:if="{{item.dataType=='1'}}">
            <view class="hint-title">
                <image src="/images/title-bg.png" mode="scaleToFill"></image>
                <text>{{item.comment}}</text>
            </view>
            <view class="flex flex-direction align-center bg-white margin-sm radius padding-sm">
                <view wx:if="{{textList.length>0}}" class="flex flex-direction" style="width:100%;">
                    <!--输入的文本内容 -->
                    <view class="flex flex-nowrap align-center margin-top-xs" wx:for="{{textList}}" wx:key="index"
                        wx:for-item="txt" style="width:100%;">
                        <text class="flex-sub" style="word-break:break-all" decode="true" space="nbsp">{{txt}}</text>
                        <view class="cu-tag bg-gray margin-left-xs" catchtap="delText" data-index="{{index}}">
                            <text class="cuIcon-close"></text>
                        </view>
                    </view>
                </view>
                <view class="flex align-center flex-direction" wx:else>
                    <image src="/images/ic_empty_desc.png" mode="scaleToFill" style="width:200rpx;height:200rpx;">
                    </image>
                    <text class="text-gray">
                        用一段话,向名片访客介绍自己吧
                    </text>
                </view>

                <view wx:if="{{textList.length < item.maxCount}}" class="cu-btn bg-blue radius margin-top-sm"
                    style="width:60%;" bindtap="showDialog" data-type="TEXT" data-keyType="isShowText">点击添加</view>
            </view>
        </view>
        <!-- 文本域 -->
        <view class="flex  flex-direction" wx:elif="{{item.type=='7'}}">
            <view class="hint-title">
                <image src="/images/title-bg.png" mode="scaleToFill"></image>
                <text>{{item.comment}}</text>
            </view>
            <view class="flex flex-direction align-center bg-white margin-sm radius padding-sm">
                <view wx:if="{{textareaList.length>0}}" class="flex flex-direction" style="width:100%;">
                    <!--输入的文本内容 -->
                    <view class="flex flex-nowrap align-center margin-top-xs" wx:for="{{textareaList}}" wx:key="index"
                        wx:for-item="txt" style="width:100%;">
                        <text class="flex-sub" style="word-break:break-all" decode="true" space="nbsp">{{txt}}</text>
                        <view class="cu-tag bg-gray margin-left-xs" catchtap="delDesc" data-index="{{index}}">
                            <text class="cuIcon-close"></text>
                        </view>
                    </view>
                </view>
                <view class="flex align-center flex-direction" wx:else>
                    <image src="/images/ic_empty_desc.png" mode="scaleToFill" style="width:200rpx;height:200rpx;">
                    </image>
                    <text class="text-gray">
                        用一段话,向名片访客介绍自己吧
                    </text>
                </view>
                <view wx:if="{{textareaList.length < item.maxCount}}" class="cu-btn bg-blue radius margin-top-sm"
                    style="width:60%;" bindtap="showDialog" data-type="TEXTAREA" data-keyType="isShowDesc">点击添加</view>
            </view>
        </view>
        <!-- 图片 -->
        <view class="flex  flex-direction" wx:elif="{{item.type=='2'}}">
            <view class="hint-title">
                <image src="/images/title-bg.png" mode="scaleToFill"></image>
                <text>{{item.comment}}</text>
            </view>
            <view class="flex flex-direction bg-white margin-sm radius padding-sm">
                <view class="flex flex-direction self-end" style="width:100%;text-align:right;"
                    wx:if="{{photoList.length>0}}">
                    {{'数量'+'('+photoList.length+'/'+ currentItem.maxCount+')'}}
                </view>
                <view wx:if="{{photoList.length>0}}" class="cu-form-group">
                    <view class="grid col-4 grid-square flex-sub">
                        <view class="bg-img" wx:for="{{photoList}}" wx:key="index" wx:for-item="photo" bindtap="viewImg"
                            data-url="{{photo.path}}">
                            <image src='{{photo.path}}' mode='scaleToFill'></image>
                            <view class="cu-tag bg-red" catchtap="delImg" data-index="{{index}}">
                                <text class="cuIcon-close"></text>
                            </view>
                        </view>
                    </view>
                </view>
                <view class="flex align-center flex-direction" wx:else>
                    <image src="/images/ic_empty_desc.png" mode="scaleToFill" style="width:200rpx;height:200rpx;">
                    </image>
                    <text class="text-gray">
                        用一段话,向名片访客介绍自己吧
                    </text>
                </view>
                <view wx:if="{{photoList.length < item.maxCount}}"
                    class="cu-btn bg-blue radius margin-top-sm selfcenter" style="width:60%;" bindtap="showDialog"
                    data-type="PHOTO" data-keyType="isShowPhoto">点击添加</view>
            </view>
        </view>
        <!-- 音频 -->
        <view class="flex flex-direction" wx:elif="{{item.type=='3'}}">
            <view class="hint-title">
                <image src="/images/title-bg.png" mode="scaleToFill"></image>
                <text>{{item.comment}}</text>
            </view>
            <view class="flex flex-direction align-center bg-white margin-sm radius padding-sm">
                <view wx:if="{{audioList.length > 0}}" style="width:100%;">
                    <view class="flex align-center shadow-box margin-top-xs" style="width:100%;" wx:for="{{audioList}}"
                        wx:key="index" 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-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-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-item="{{audio}}">
                                </image>
                                <image src="/images/ic_audio_speed.png" mode="scaleToFill" bindtap="speed"
                                    data-index="{{index}}" data-item="{{audio}}"></image>
                            </view>
                        </view>
                        <view class="cu-tag bg-gray margin-left-xs" style="border-radius:50%;" catchtap="delAudio"
                            data-index="{{index}}">
                            <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="{{audioList.length<item.maxCount}}" class="cu-btn bg-blue radius margin-top-sm"
                    style="width:60%;" data-type="AUDIO" data-keyType="isShowAudio" bindtap="showDialog">点击添加</view>
            </view>
        </view>
        <!-- 视频 -->
        <view class="flex  flex-direction" wx:elif="{{item.type=='4'}}">
            <view class="hint-title">
                <image src="/images/title-bg.png" mode="scaleToFill"></image>
                <text>{{item.comment}}</text>
            </view>
            <view class="flex flex-direction bg-white margin-sm radius padding-sm">
                <view class="flex flex-direction self-end" style="width:100%;text-align:right;"
                    wx:if="{{videoList.length>0}}">
                    {{'数量'+'('+videoList.length+'/'+ currentItem.maxCount+')'}}
                </view>
                <view wx:if="{{videoList.length>0}}" class="cu-form-group">
                    <view class="grid col-1 grid-square flex-sub">
                        <view class="bg-img" wx:for="{{videoList}}" wx:key="index" wx:for-item="video"
                            bindtap="viewVideo" style="height:280rpx;padding-bottom:0rpx;" data-url="{{video.path}}">
                            <image src='{{video.imgPath}}' mode='scaleToFill'></image>
                            <view class="cu-tag bg-red" catchtap="delVideo" data-index="{{index}}">
                                <text class="cuIcon-close"></text>
                            </view>
                        </view>
                    </view>
                </view>
                <view class="flex align-center flex-direction" wx:else>
                    <image src="/images/ic_empty_desc.png" mode="scaleToFill" style="width:200rpx;height:200rpx;">
                    </image>
                    <text class="text-gray">
                        用一段话,向名片访客介绍自己吧
                    </text>
                </view>
                <view wx:if="{{videoList.length < item.maxCount}}"
                    class="cu-btn bg-blue radius margin-top-sm selfcenter" style="width:60%;" bindtap="showDialog"
                    data-type="VIDEO" data-keyType="isShowVideo">点击添加</view>
            </view>

        </view>
        <!-- 连接 -->
        <view class="flex  flex-direction" wx:elif="{{item.type=='5'}}">
            <view class="hint-title">
                <image src="/images/title-bg.png" mode="scaleToFill"></image>
                <text>{{item.comment}}</text>
            </view>
            <view class="flex flex-direction align-center bg-white margin-sm radius padding-sm">
                <view wx:if="{{linkList.length>0}}" class="flex flex-direction" style="width:100%;">
                    <!--输入的文本内容 -->
                    <view class="flex flex-nowrap align-center margin-top-xs" wx:for="{{linkList}}" wx:key="index"
                        wx:for-item="txt" style="width:100%;">
                        <text class="flex-sub" style="word-break:break-all" decode="true" space="nbsp">{{txt}}</text>
                        <view class="cu-tag bg-gray margin-left-xs" catchtap="delLink" data-index="{{index}}">
                            <text class="cuIcon-close"></text>
                        </view>
                    </view>
                </view>
                <view class="flex align-center flex-direction" wx:else>
                    <image src="/images/ic_empty_desc.png" mode="scaleToFill" style="width:200rpx;height:200rpx;">
                    </image>
                    <text class="text-gray">
                        用一段话,向名片访客介绍自己吧
                    </text>
                </view>

                <view wx:if="{{linkList.length < item.maxCount}}" class="cu-btn bg-blue radius margin-top-sm"
                    style="width:60%;" bindtap="showDialog" data-type="LINK" data-keyType="isShowLink">点击添加</view>
            </view>
        </view>
        <!-- 定位 -->
        <view class="flex  flex-direction" wx:elif="{{item.type=='6'}}">
            <view class="hint-title">
                <image src="/images/title-bg.png" mode="scaleToFill"></image>
                <text>{{item.comment}}</text>
            </view>
            <view class="flex flex-direction align-center bg-white margin-sm radius padding-sm">
                <view wx:if="{{locationList.length>0}}">
                    <view wx:for="{{locationList}}" wx:key="index" 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}}">
                                <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 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="{{locationList.length < item.maxCount}}" class="cu-btn bg-blue radius margin-top-sm"
                    style="width:60%;" bindtap="chooseLocation">点击添加</view>
            </view>
        </view>
    </view>

</view>
<view wx:else style="margin-top:200rpx;width:100%;">
    <van-empty description="暂无数据" image="../../../images/ic_empty_data.png" />
</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>