表单分为两个主要部分,一个是客户提交的信息,一个是主要内容(内含文字和上传图片),完整源码见上一篇
功能:点击文字则向上划出文本输入框(点击完成的时候做判断,内容不为空),点击图片则打开上传图片,
思路:
1.前端布局给两个按钮 添加文字 bindtap='addTextTap' 上传图片 bindtap='chooseImg'
一个隐藏的视窗 通过textreaHidden来控制是否显示视窗
<!--pages/activity/signup/signup.wxml-->
<!-- banner图 -->
<view class='bg_white' style='padding-bottom:30rpx;'>
<image src='/images/actbanner.jpg' style='width:100%;height:220rpx;'></image>
</view>
<!-- 表单主要内容 -->
<view class='p_b20' style='width:90%;margin:0 auto;'>
<form bindsubmit="formSubmit">
<view class='addview20' style='padding-bottom:90rpx;'>
<view class='bg_white font14 gray5 p_all10 p_b20'style='width:95%;margin 0 auto;padding-top:20rpx;'>
<view class='inputstyle'>
<picker bindchange="bindPickerzone" value="{
{index2}}" range="{
{userZoneList}}">
<input class='fl' type='text' placeholder='所在城市' placeholder-class='place' name="city" disabled='disabled' value='{
{userZoneList[index2]}}'></input>
<text class='fr m_t5 grayb'style='margin-right:20rpx;'>﹀</text>
<view class='cl'></view>
</picker>
</view>
<input type='number' class='inputstyle' placeholder-class='place' name="area" placeholder='房屋面积(㎡)'></input>
<input type='number' class='inputstyle' maxlength='11' placeholder-class='place' name="phoneNumber" placeholder='手机号'></input>
<input type='text' class='inputstyle' placeholder-class='place' name="userName" placeholder='姓名'></input>
</view>
<!-- 正文内容 -->
<view class='p_lr15' wx:if="{
{content.length > 0}}">
<view class='contentView' wx:for="{
{content}}">
<view class='m_t30 pr' wx:if="{
{item.name == 'img'}}">
<image src='{
{item.contents}}' mode='widthFix' style='width:100%;'></image>