remark.js 1.34 KB
import util from '../../utils/util';
import App from '../../utils/api';
Page({
	data:{
		remark:'',
		buttonbottom:20
	},
	onLoad(opt){
		this.setData({
			remark:opt.remark,
		})
		this.remark=opt.remark;
		this.getlabellist();
	},
	inputremark(e){
		this.remark=util.trim(e.detail.value)
		this.setData({
      remark:this.remark,
		})
	},
	selectlabel(e){
		let name=e.currentTarget.dataset.name;
		if(this.remark!=''){
			let str=this.remark+','+name
			if(str.length>25){
				console.log('rrrrrr')
				return wx.showToast({
					icon:'none',
					title:'最多输入25个字符',
					mask:true,
					duration:1500
				})
			}
			
		}
		this.setData({
			remark:this.remark=='' ? name : this.remark+','+name
		})
		this.remark=this.remark=='' ? name : this.remark+','+name
		console.log(this.remark,this.remark.length)
	},
	inputblur(e){
		console.log(e,'blur')
		this.setData({
			remark:this.remark,
			buttonbottom:20
		})
	},
	getlabellist(){
		App.Customer.GetUserRemarkes().then((json)=>{
			console.log('eeeee',json)
			if(json.ret==200){
				this.setData({
					labellist:json.data
				})
			}
		})
	},
	save(){
		wx.setStorageSync('remark',this.remark);
		wx.navigateBack();
	},
	getboardheight(e){
		if(e.detail.height==0){
			this.setData({
				buttonbottom:20
			})
		}else{
			this.setData({
				buttonbottom:e.detail.height+20
			})
		}
		
	}
})