Showing
2 changed files
with
34 additions
and
8 deletions
| @@ -17,15 +17,32 @@ Page({ | @@ -17,15 +17,32 @@ Page({ | ||
| 17 | defineremark:util.trim(e.detail.value) | 17 | defineremark:util.trim(e.detail.value) |
| 18 | }) | 18 | }) |
| 19 | }, | 19 | }, |
| 20 | + //选择常用备注 | ||
| 20 | taplabel:function(e){ | 21 | taplabel:function(e){ |
| 21 | var _target=e.currentTarget.dataset; | 22 | var _target=e.currentTarget.dataset; |
| 22 | - var mylabel=this.data.mylabel; | ||
| 23 | - console.log(_target.id,_target.type); | ||
| 24 | - this.setlabel(_target.id,_target.type); | 23 | + var oftenlabel=0,alllabel=this.data.alllabel; |
| 24 | + alllabel.forEach(function(v,i){ | ||
| 25 | + if(v.often_use!=''){ | ||
| 26 | + oftenlabel++; | ||
| 27 | + } | ||
| 28 | + }) | ||
| 29 | + if(_target.type=='often'){ | ||
| 30 | + this.setlabel(_target.id,_target.type); | ||
| 31 | + }else{ | ||
| 32 | + if(oftenlabel<10){ | ||
| 33 | + this.setlabel(_target.id,_target.type); | ||
| 34 | + }else{ | ||
| 35 | + wx.showToast({ | ||
| 36 | + title:'最多可添加10个', | ||
| 37 | + icon:'none', | ||
| 38 | + duration:2000 | ||
| 39 | + }) | ||
| 40 | + } | ||
| 41 | + } | ||
| 25 | }, | 42 | }, |
| 26 | getlabellist:function(){ | 43 | getlabellist:function(){ |
| 27 | App.User.GetCustomRemark({ | 44 | App.User.GetCustomRemark({ |
| 28 | - uid:util.cache('enter_params')['manager_id'] | 45 | + uid:util.cache('enter_params')['manage_id'] |
| 29 | }).then(res=>{ | 46 | }).then(res=>{ |
| 30 | console.log(res) | 47 | console.log(res) |
| 31 | this.setData({ | 48 | this.setData({ |
| @@ -38,7 +55,7 @@ Page({ | @@ -38,7 +55,7 @@ Page({ | ||
| 38 | }, | 55 | }, |
| 39 | setlabel:function(id,flag){ | 56 | setlabel:function(id,flag){ |
| 40 | App.User.GetCustomRemark({ | 57 | App.User.GetCustomRemark({ |
| 41 | - uid:util.cache('enter_params')['manager_id'], | 58 | + uid:util.cache('enter_params')['manage_id'], |
| 42 | kid:id, | 59 | kid:id, |
| 43 | flag:flag, | 60 | flag:flag, |
| 44 | }).then(res=>{ | 61 | }).then(res=>{ |
| @@ -60,7 +77,7 @@ Page({ | @@ -60,7 +77,7 @@ Page({ | ||
| 60 | //添加自定义标签 | 77 | //添加自定义标签 |
| 61 | addlabel:function(custom){ | 78 | addlabel:function(custom){ |
| 62 | App.User.AddCustomRemark({ | 79 | App.User.AddCustomRemark({ |
| 63 | - uid:util.cache('enter_params')['manager_id'], | 80 | + uid:util.cache('enter_params')['manage_id'], |
| 64 | custom:custom, | 81 | custom:custom, |
| 65 | }).then(res=>{ | 82 | }).then(res=>{ |
| 66 | console.log(res) | 83 | console.log(res) |
| @@ -69,6 +86,15 @@ Page({ | @@ -69,6 +86,15 @@ Page({ | ||
| 69 | defineremark:null, | 86 | defineremark:null, |
| 70 | }) | 87 | }) |
| 71 | this.getlabellist(); | 88 | this.getlabellist(); |
| 89 | + }else{ | ||
| 90 | + this.setData({ | ||
| 91 | + defineremark:null, | ||
| 92 | + }) | ||
| 93 | + wx.showToast({ | ||
| 94 | + title:'最多可添加20个备注', | ||
| 95 | + icon:'none', | ||
| 96 | + duration:2000 | ||
| 97 | + }) | ||
| 72 | } | 98 | } |
| 73 | }) | 99 | }) |
| 74 | }, | 100 | }, |
| 1 | <nav id="nav">常用备注</nav> | 1 | <nav id="nav">常用备注</nav> |
| 2 | <view class="cut"></view> | 2 | <view class="cut"></view> |
| 3 | <view class="label"> | 3 | <view class="label"> |
| 4 | - <view class="label-title black-font font30r smooth" style="padding-bottom:40rpx;">我的常用备注</view> | 4 | + <view class="label-title black-font font30r smooth" style="padding-bottom:40rpx;">我的常用备注<text class="font24r smooth gray-deep-font">(最多添加10个)</text></view> |
| 5 | <view class="label-list flex-rs me-label-list"> | 5 | <view class="label-list flex-rs me-label-list"> |
| 6 | <block wx:for="{{alllabel}}"> | 6 | <block wx:for="{{alllabel}}"> |
| 7 | <block wx:if="{{item.often_use!=''}}"> | 7 | <block wx:if="{{item.often_use!=''}}"> |
| @@ -13,7 +13,7 @@ | @@ -13,7 +13,7 @@ | ||
| 13 | </block> | 13 | </block> |
| 14 | <view style="min-width:176rpx;"><input class="black-font flex-cc font28r smooth label-input flex-cc" placeholder="添加备注" maxlength="10" style="width:{{defineremark && defineremark.length>4 ? (defineremark.length-4)*28+160 : 160}}rpx;" value="{{defineremark}}" bindinput="inputremark" focus="{{focus}}" cursor-spacing="160" bindblur="addinputlabel" placeholder-style="color:#999;font-size:28rpx;text-align:center;"/></view> | 14 | <view style="min-width:176rpx;"><input class="black-font flex-cc font28r smooth label-input flex-cc" placeholder="添加备注" maxlength="10" style="width:{{defineremark && defineremark.length>4 ? (defineremark.length-4)*28+160 : 160}}rpx;" value="{{defineremark}}" bindinput="inputremark" focus="{{focus}}" cursor-spacing="160" bindblur="addinputlabel" placeholder-style="color:#999;font-size:28rpx;text-align:center;"/></view> |
| 15 | </view> | 15 | </view> |
| 16 | - <view class="label-title black-font font30r smooth">所有备注</view> | 16 | + <view class="label-title black-font font30r smooth">所有备注<text class="font24r smooth gray-deep-font">(最多添加20个)</text></view> |
| 17 | <view class="label-list flex-rs"> | 17 | <view class="label-list flex-rs"> |
| 18 | <block wx:for="{{alllabel}}"> | 18 | <block wx:for="{{alllabel}}"> |
| 19 | <view class="label-single flex-cc font28r smooth {{item.often_use!='' ? 'bg_green white-font' : 'all-label green-font'}}" data-id="{{item.id}}" data-type="{{item.often_use!='' ? 'often' : 'custom'}}" bindtap="taplabel" style="margin:0 16rpx 20rpx 0;">{{item.custom}}</view> | 19 | <view class="label-single flex-cc font28r smooth {{item.often_use!='' ? 'bg_green white-font' : 'all-label green-font'}}" data-id="{{item.id}}" data-type="{{item.often_use!='' ? 'often' : 'custom'}}" bindtap="taplabel" style="margin:0 16rpx 20rpx 0;">{{item.custom}}</view> |
-
Please register or login to post a comment