123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- var app = getApp()
- Page({
- data: {
- user: [],
- userId: '', //用户id
- isDisabled: false, //备注是否修改
- textVal: '', //输入框内容
- // firstBind: 0
- },
- onLoad: function (options) {
- wx.showLoading({
- title: '加载中...',
- })
- let that = this;
- that.setData({
- userId: options.id
- })
- app.request('user/detail?user_id=' + options.id, '', 'GET').then(res => {
- wx.hideLoading();
- console.log(res.data)
- that.setData({
- user: res.data
- })
- if (res.data.remark) {
- that.setData({
- isDisabled: true
- })
- }
- })
- },
- tap: function () {
- wx.navigateTo({
- url: '/pages/historicalOrder/historicalOrder?id=' + this.data.userId,
- })
- },
- operate() {
- wx.showLoading({
- title: '加载中...',
- })
- let that = this;
- let dis = that.data.isDisabled;
- if (dis) {
- that.setData({
- isDisabled: false
- })
- } else {
- let data = {
- remark: this.data.textVal
- }
- app.request('user/updateRemark/' + this.data.userId, data, 'PUT').then(res => {
- wx.hideLoading();
- wx.showToast({
- title: '提交成功~',
- icon: 'none'
- })
- that.setData({
- isDisabled: true
- })
- })
- }
- },
- getText(e) {
- this.setData({
- textVal: e.detail.value
- })
- },
- finish() {
- if (!this.data.textVal) {
- wx.showToast({
- title: '输入内容不能为空',
- icon: 'none'
- })
- } else {
- let data = {
- remark: this.data.textVal
- }
- app.request('user/updateRemark/' + this.data.userId, data, 'PUT').then(res => {
- console.log(res);
- })
- }
- },
- // doubleClick(e) {
- // console.log(e);
- // console.log(e.timeStamp)
- // let that = this;
- // if (this.data.firstBind == 0) {
- // this.setData({
- // firstBind: e.timeStamp
- // })
- // }
- // let curTime = e.timeStamp;
- // let lastTime = that.data.firstBind
- // console.log(curTime,'curTime')
- // console.log(lastTime,'lastTime')
- // if (curTime - lastTime < 300) {
- // console.log(11111)
- // this.setData({
- // isDisabled: false
- // })
- // }
- // }
- })
|