remark.js 1.1 KB
import util from '../../utils/util';
import App from '../../utils/api';
Page({
	data:{
		remark:''
	},
	onLoad(opt){
		this.setData({
			remark:opt.remark
		})
		this.remark=opt.remark;
		this.getlabellist();
	},
	inputremark(e){
		this.remark=util.trim(e.detail.value)
		console.log(e)
	},
	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)
		this.setData({
			remark:this.remark
		})
	},
	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();
	},
	
})