Commit 9181a05b5b14dbb40d1ddaf2c1e3a63baab70311

Authored by yvan.ni
1 parent 37120a27

呢称在输入的优化

packageE/pages/user/nick_avatar/nick_avatar.js
... ... @@ -56,57 +56,60 @@ Page({
56 56 save_data() {
57 57  
58 58 var that=this;
  59 + setTimeout(()=>{
  60 + if (!this.data.ob.head_pic) {
  61 + wx.showToast({
  62 + title: '请选择头像',
  63 + icon: 'none',
  64 + duration: 2000
  65 + });
  66 + return false;
  67 + }
59 68  
60   - if (!this.data.ob.head_pic) {
61   - wx.showToast({
62   - title: '请选择头像',
63   - icon: 'none',
64   - duration: 2000
65   - });
66   - return false;
67   - }
68   -
69   - if (!this.data.ob.nickname) {
70   - wx.showToast({
71   - title: '请输入昵称',
72   - icon: 'none',
73   - duration: 2000
  69 + if (!this.data.ob.nickname) {
  70 + wx.showToast({
  71 + title: '请输入昵称',
  72 + icon: 'none',
  73 + duration: 2000
  74 + });
  75 + return false;
  76 + }
  77 +
  78 + if (this.data.load) return false;
  79 + this.setData({load: 1})
  80 +
  81 + wx.showLoading();
  82 +
  83 + getApp().request.put("/api/weshop/users/update", {
  84 + data: {
  85 + store_id: os.stoid,
  86 + user_id: getApp().globalData.user_id,
  87 + nickname: this.data.ob.nickname,
  88 + head_pic: this.data.ob.head_pic
  89 +
  90 + },
  91 + success: function (su) {
  92 +
  93 + setTimeout(()=>{
  94 + wx.hideLoading();
  95 + if (su.data.code == 0) {
  96 + wx.navigateBack({delta: 1})
  97 + }else{
  98 + that.setData({load: 0})
  99 + wx.showToast({
  100 + title: su.data.msg,
  101 + icon: 'none',
  102 + duration: 2000
  103 + });
  104 + }
  105 + },1000)
  106 +
  107 +
  108 + }
74 109 });
75   - return false;
76   - }
77   -
78   - if (this.data.load) return false;
79   - this.setData({load: 1})
80   -
81   -
82   - wx.showLoading();
83   - getApp().request.put("/api/weshop/users/update", {
84   - data: {
85   - store_id: os.stoid,
86   - user_id: getApp().globalData.user_id,
87   - nickname: this.data.ob.nickname,
88   - head_pic: this.data.ob.head_pic
89   -
90   - },
91   - success: function (su) {
92   -
93   - setTimeout(()=>{
94   - wx.hideLoading();
95   - if (su.data.code == 0) {
96   - wx.navigateBack({delta: 1})
97   - }else{
98   - that.setData({load: 0})
99   - wx.showToast({
100   - title: su.data.msg,
101   - icon: 'none',
102   - duration: 2000
103   - });
104   - }
105   - },1000)
  110 + },500)
106 111  
107 112  
108   - }
109   - });
110 113 }
111 114  
112 115  
... ...