问答详情
源自:4-8 区域信息编辑页的开发

有没有编辑和添加的js代码啊?

有没有编辑和添加的js代码啊?

提问者:含泪韵心弦 2018-10-14 20:20

个回答

  • clements
    2018-12-10 20:48:34

    有呀,添加的事件和置空的事件

    formSubmit:function(e) {

    var that = this;

    var formData = e.detail.value;

    var url = that.data.addUrl;


    if(that.data.areaId!=undefined) {

    formData.areaId=that.data.areaId;

    url=that.data.modifyUrl;

    }


    wx.request({

    url: url,

    data:JSON.stringify(formData),

    method:'POST',

    header:{

    'Content-Type':'application/json'

    },

    success:function(res) {

    var result = res.data.success

    var toastText = "操作成功";

    if(result!=true) {

    toastText = "操作失败"+res.data.errMsg;

    }


    wx.showToast({

    title: toastText,

    icon:'',

    duration:2000

    });


    if(that.data.areaId == undefined) {

    wx.redirectTo({

    url: '../list/list',

    })

    }

    }

    });


    },

    reset:function(res) {

    that.setData({

    areaId:'',

    priority:''

    });

    }