const utils = require('../../utils/util') let http = require('../../utils/request') // pages/feedback.js Page({ /** * 页面的初始数据 */ data: { imageServerUrl: getApp().globalData.imageServerUrl, content:'', images:[], }, // 文本框事件 input_fn(e) { let content =e.detail.value this.setData({ content }) }, up_cntent(){ var that=this if(this.data.content==''){ wx.showToast({ title: '请输入反馈内容', icon:'none' }) return } var img=[] this.data.images.forEach(item=>{ img.push(item.replace( 'https://zhongnengyunche.com/recruitment/wx/upload/feedback/','')) }) http.xhr({ url: 'api/v1/feedback', method:'post', data:{content:this.data.content,feedbackPic:img} }).then(res => { if(res.code!=1){ wx.showToast({ title:res.msg, icon:'none' }) return } wx.showModal({ title: '提交成功', content:` 非常感谢您为云车招聘平台提出的宝贵意见,我们会努力做的更好的!`, success: function (res) { if (res.confirm) { // console.log('用户点击确定') wx.navigateBack() }else{ // console.log('用户点击取消') that.setData({ content:'', images:[] }) return } } }) }).catch(err => { console.log(err) }) }, check_head_img() { const that = this let arr=this.data.images console.log(arr) // uploadFile utils.upLoadFeedbackImageCos(((err, res) => { if (err) { wx.showToast({ title: message || '上传失败', icon: 'none' }) return } arr.push(res.headers.Location.replace('http://znyc-images-1304677865.cos.ap-guangzhou.myqcloud.com', 'https://zhongnengyunche.com')) // arr2.push(res.headers.Location.replace('http://znyc-images-1304677865.cos.ap-guangzhou.myqcloud.com', '')) console.log(arr) that.setData({ // [`user_info.avatarUrl`]: res.headers.Location.replace('http', 'https') images: arr }); })) }, // 删勒已上传图片 del_img(e){ console.log(e.currentTarget.dataset.index) var images=[] images=this.data.images images.splice(e.currentTarget.dataset.index,1) this.setData({ images }) }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ // onShareAppMessage: function () { // } })