收藏
回答

在一个页面使用了3个textarea,要插入到数据库中,只成功插人了最后一个?

在个页面使用了3个textarea,在插入到数据库中,只显示最后一个,后来就把3个name的名字改成3个不一样的名字,同样也只是显示一条数据。这个要怎么解决?如图:

wxml代码:
<view class="resume-group">
  <form bindsubmit="onSubmitEvent">
  <view class="resume-top">
    <view class="input">
      <import src="../../input/input.wxml" />
      <view class="medata">
        <block wx:for="{{ress}}" wx:key="res">
          <view data-index="{{index}}">
            <template is="medata" data="{{...item}}"></template>
          </view>
        </block>
      </view>
    </view>
  </view>
  <import src="../../input/input.wxml" />
  <view class="medata">
    <block wx:for="{{sumes}}" wx:key="sume">
      <view data-index="{{index}}">
        <template is="medata" data="{{...item}}"></template>
      </view>
    </block>
  </view>
  <view class="introduce-group">
    <view class="introduce">自我介绍</view>
    <textarea class="introduce-centent" name="content" placeholder="请输入您的自我介绍"></textarea>
  </view>
  <view class="experience-group">
    <text class="item">工作经历</text>
    <import src="../../input/input.wxml" />
    <view class="medata">
      <block wx:for="{{expers}}" wx:key="exper">
        <view data-index="{{index}}">
          <template is="medata" data="{{...item}}"></template>
        </view>
      </block>
    </view>
    <view class="position-group">
      <text>起始时间</text>
      <view class="section">
        <picker name="starttime" mode="date" value="{{date}}" fields="month" start="1985-09" bindchange="bindDateChange">
          <view class="picker">
            {{date}}
            <view class="icon"></view>
          </view>
        </picker>
      </view>
      <view>-</view>
      <view class="section">
        <picker name="endtime" mode="date" value="{{date}}" fields="month" end="2021-12" bindchange="bindDateChangEvent">
          <view class="picker">
            {{Data}}
            <view class="icon"></view>
          </view>
        </picker>
      </view>
    </view>
    <view class="introduce-group">
      <textarea class="introduce-centent" name="contentone" placeholder="请输入您的工作内容"></textarea>
    </view>
  </view>
  <view  class="experience-group">
    <text class="item">教育经历</text>
    <import src="../../input/input.wxml" />
    <view class="medata">
      <block wx:for="{{ences}}" wx:key="key">
        <view data-index="{{index}}">
          <template is="medata" data="{{...item}}"></template>
        </view>
      </block>
    </view>
    <view class="position-group">
      <text>起始时间</text>
      <view class="section">
        <picker name="starttime" mode="date" value="{{date}}" fields="month" start="1985-09" bindchange="bindChange">
          <view class="picker">
            {{datae}}
            <view class="icon"></view>
          </view>
        </picker>
      </view>
      <view>-</view>
      <view class="section">
        <picker name="endtime" mode="date" value="{{date}}" fields="month" end="2021-12" bindchange="bindChangEvent">
          <view class="picker">
            {{Datae}}
            <view class="icon"></view>
          </view>
        </picker>
      </view>
    </view>
    <view class="introduce-group">
      <textarea class="introduce-centent" name="contenttwo" placeholder="请输入您的学习内容"></textarea>
    </view>
  </view>
  
  <button formType="submit">提交</button> 
  </form>
</view>

js代码
 onSubmitEvent:function(event){
    console.log(event);
    const content = event.detail.value.content;
    const author=app.globalData.userInfo;
    wx.showLoading({
      title:"正在发表中..."
    })
    // // 特3456书yuuo莞6543李zxcz蒜7782法fgnv级
    wx.cloud.callFunction({
      name:"resume",
      data:{
        content:content,
        author:author,
        // contentone:event.detail.value.contentone,
        // contenttwo:event.detail.value.contenttwo,
        full_Name:event.detail.value.full_Name,
        Gender:event.detail.value.Gender,
        Age:event.detail.value.Age,
        native_place:event.detail.value.native_place,
        working_years:event.detail.value.working_years,
        education:event.detail.value.education,
        intention:event.detail.value.intention,
        Company_name:event.detail.value.Company_name,
        position:event.detail.value.position,
        school:event.detail.value.school,
        specialty:event.detail.value.specialty,
        starttime:event.detail.value.starttime,
        endtime:event.detail.value.endtime
      },
      success:res => {
        console.log(res);
        const _id = res.result._id;
        if(_id){
          wx.hideLoading();
          wx.showToast({
            title:"恭喜!发送成功!"
          });
          // setTimeout(function(){
          //   wx.navigateBack({})
          // },800)
        }else{
          wx.showToast({
            title:res.result.errMsg,
          })
        }
      }
    })
  },
回答关注问题邀请回答
收藏
登录 后发表内容