如何解决重新编译后,后台数据消失的问题?
发布于 8 年前 作者 kliao 11581 次浏览 来自 官方Issues

表单数据可以成功上传后台,并且后台也返回了成功,但是,只要重新编译代码,后台的数据就会消失,请问是后台接口的问题?

3 回复

重新编译代码,后台的数据就会消失是什么意思?

<form bindsubmit="formdata">
<!-- 遗嘱接收人 -->
  <view class="js_men">
    <view class="left">
      <text class="must">*</text>
      <text style="color:#62666c">遗嘱接收人</text>
    </view>
    <view class="right">
      <input name="js_name"></input>
    </view>
  </view>
  <!-- 接收人手机号 -->
  <view class="js_men">
    <view class="left">
      <text class="must">*</text>
      <text style="color:#62666c">接收人手机号</text>
    </view>
    <view class="right">
      <input name="js_phone"></input>
    </view>
  </view>
  <!-- 接收人祭思宝号 -->
  <view class="js_men">
    <view class="left">
      <text class="must">*</text>
      <text style="color:#62666c">接收人祭思宝号</text>
    </view>
    <view class="right">
      <input name="js_id"></input>
    </view>
  </view>
  <!-- 与遗嘱接收人关系 -->
  <view class="js_men">
    <view class="left">
      <text class="must">*</text>
      <text style="color:#62666c">与遗嘱接收人关系</text>
    </view>
    <view class="right">
      <input name="js_relation"></input>
    </view>
  </view>
  <!-- 遗嘱说明 -->
    <view class="js_men2">
    <view class="left">
      <text class="must">*</text>
      <text style="color:#62666c">遗嘱说明</text>
    </view>
    <view class="right2">
      <textarea name="js_explain" placeholder="请输入"></textarea>
    </view>
  </view>
  <!-- 遗嘱内容拍照 -->
    <view class="js_men2">
    <view class="left">
      <text class="must">*</text>
      <text style="color:#62666c">遗嘱内容拍照</text>
    </view>
    <view class="right2">
      <block wx:for="{{imgArr}}">
        <image src="{{item}}"></image>
      </block>
      <image src="../../../../public/images/addicon_03.png" bindtap="upload_img"></image>
    </view>
  </view>
  <!-- 遗嘱内容录像 -->
    <view class="js_men2">
    <view class="left">
      <text class="must">*</text>
      <text style="color:#62666c">遗嘱内容录像</text>
    </view>
    <view class="right2">
    <block wx:for="{{video}}">
      <video src="{{item}}"></video>
    </block>
      <image src="../../../../public/images/addicon_03.png" bindtap="upload_video"></image>
    </view>
  </view>
  <button class="submit" form-type="submit">提交</button>
</form>

js代码:

formdata(e) {
    var a = this.data.imgArr.toString()
    var b = this.data.video.toString()
//封装的api请求
    https(domain.getAPI("yizhu"), {
      rev_name: e.detail.value.js_name,
      rev_phone: e.detail.value.js_phone,
      rev_vip_num: e.detail.value.js_id,
      rev_rel: e.detail.value.js_relation,
      content: e.detail.value.js_explain,
      album: a,
      videos: b
    }).then(res => {
        wx.showModal({
          title: '成功',
          content:res.msg,
          success(res){
            if(res.cancel||res.confirm){
              wx.navigateTo({
                url: '../afterdie',
              })
            }
          }
        })
       
    }).catch(res2 => {
      wx.showModal({
        title: '错误',
        content: res2.error.msg,
      })
    })
    console.log(e)
  },

重新编译缓存不会发送变化,如果有些需要缓存的数据你可以考虑下,页面临时数据内存编译会被重新赋值初始化,要么你用k-v 传进去

回到顶部