fugongshenqing.js 3.7 KB
// pages/ resumption/resumption.js
const app=getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    companyname:'',
    quname:'',
    product:'',
    shang:'',
    hou:'',
    lianxi:'',
    phone:'',
    plan:'',
    image:[],
    cimage:[],
    is_regulation:1,
    hang:''
  },


  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },
  sely(){
    this.setData({
      is_regulation:1
    })
  },
  seln(){
    this.setData({
      is_regulation:2
    })
  },

  chooseImage() {
    let that = this;
    wx.chooseImage({
      count: 1,
      sizeType: ['original', 'compressed'],
      success: function (res) {
        console.log(res.tempFilePaths[0])
        app.upload('image', res.tempFilePaths[0], "post").then((res) => {
          console.log('上传文件', res);
         
          let newimage=that.data.image;
          newimage.push(res.url);
          let newcimage=that.data.cimage;
          newcimage.push(res.kurl)
          that.setData({
            image:newimage,
            cimage:newcimage
          })
          

        }).catch((err) => {
          console.log(err)
        })
      },
      fail: function (res) { }
    })
  },
  delimg(e){

    let that=this;
    console.log(e)
    let index = e.currentTarget.dataset.index;
    let newimage=that.data.image;
    let newcimage=that.data.cimage;
    newimage.splice(index,1);
    newcimage.splice(index,1);
    that.setData({
      image:newimage,
      cimage:newcimage
    })

    console.log(that.data.image);
    console.log(that.data.cimage)
  },
  entercompany(e){
    this.setData({
      companyname:e.detail.value
    })
  },
  enterqu(e) {
    this.setData({
      quname: e.detail.value
    })
  },
  enthang(e){
    this.setData({
      hang: e.detail.value
    })
  },
  enterprodouct(e){
    this.setData({
      product: e.detail.value
    })
  },
  entershang(e){
    this.setData({
      shang: e.detail.value
    })
  },
  enterhou(e){
    this.setData({
      hou: e.detail.value
    })
  },
  enterlianxi(e) {
    this.setData({
      lianxi: e.detail.value
    })
  },
  enterphone(e) {
    this.setData({
      phone: e.detail.value
    })
  },
  enterkaigong(e) {
    this.setData({
      plan: e.detail.value
    })
  },
  finish(){
    let that = this;
    var url = '/api/user/company_return';
    var params = {
      company_name: that.data.companyname,
      belong:that.data.quname,
      industry:that.data.hang,
      products:that.data.product,
      is_regulation: that.data.is_regulation,
      year:that.data.shang,
      expect:that.data.hou,
      name:that.data.lianxi,
      mobile:that.data.phone,
      plan:that.data.plan,
      files:that.data.cimage.join(",")

    }
    app.post(url, params,"post").then((res) => {
      console.log(res);
      wx.showToast({
        title: '提交成功',
        icon:"none"
      })

      setTimeout(function(){
        wx.navigateTo({
          url: '/pages/start/start',
        })
      },1500)



    }).catch((err) => {
      wx.showToast({
        title: err.data.msg,
        icon:'none'
      })

    })

  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})