Commit 0dfa5478fe3c4c4c6816ae9a29098431f94cb7cb

Authored by zhangyan
1 parent 2dcea0a9

no message

import util from '../../../utils/util';
import App from '../../../utils/api';
Page({
data:{
alllabel:[
],
focus:true
},
onLoad:function(){
this.getlabellist();
},
onShow:function(){
},
inputremark:function(e){
this.setData({
defineremark:util.trim(e.detail.value)
})
},
taplabel:function(e){
var _target=e.currentTarget.dataset;
var mylabel=this.data.mylabel;
console.log(_target.id,_target.type);
this.setlabel(_target.id,_target.type);
},
getlabellist:function(){
App.User.GetCustomRemark({
uid:util.cache('enter_params')['manager_id']
}).then(res=>{
console.log(res)
this.setData({
alllabel:res.data
})
})
},
setlabel:function(id,flag){
App.User.GetCustomRemark({
uid:util.cache('enter_params')['manager_id'],
kid:id,
flag:flag,
}).then(res=>{
console.log(res)
this.setData({
alllabel:res.data
})
})
},
addinputlabel:function(e){
this.setData({
focus:false
})
if(util.trim(e.detail.value)!=''){
this.addlabel(util.trim(e.detail.value))
}
},
//添加自定义标签
addlabel:function(custom){
App.User.AddCustomRemark({
uid:util.cache('enter_params')['manager_id'],
custom:custom,
}).then(res=>{
console.log(res)
if(res.ret==200){
this.setData({
defineremark:'',
})
this.getlabellist();
}
})
},
})
\ No newline at end of file
... ...
{
"backgroundTextStyle":"light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTextStyle":"white",
"usingComponents": {
"nav":"/components/nav/nav",
"tabBar":"/components/book/tabBar/tabBar",
"formids":"/components/formids/formids"
}
}
\ No newline at end of file
... ...
<nav id="nav">常用备注</nav>
<view class="cut"></view>
<view class="label">
<view class="label-title black-font font30r smooth" style="padding-bottom:40rpx;">我的常用备注</view>
<view class="label-list flex-rs me-label-list">
<block wx:for="{{alllabel}}">
<block wx:if="{{item.often_use!=''}}">
<view class="label-single-all flex-ll bg_green" data-id="{{item.id}}" data-type="often" bindtap="taplabel">
<view class="white-font label-single flex-cc font28r smooth">{{item.custom}}</view>
<view style="height:40rpx;border-left:1px solid rgba(255,255,255,.3);padding:0 8rpx;" class="flex-cc"><image src="../../image/close.svg" class="close"></image></view>
</view>
</block>
</block>
<input class="black-font flex-cc font28r smooth label-input flex-cc" placeholder="添加备注" placeholder-class="gray-font font28r smooth flex-cc" maxlength="10" style="width:{{defineremark.length>4 ? (defineremark.length-4)*28+160 : 160}}rpx;" value="{{defineremark}}" bindinput="inputremark" focus="{{focus}}" cursor-spacing="160" bindblur="addinputlabel"/>
</view>
<view class="label-title black-font font30r smooth">所有备注</view>
<view class="label-list flex-rs">
<block wx:for="{{alllabel}}">
<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>
</block>
</view>
</view>
\ No newline at end of file
... ...
.label{
width:100%;
padding:0 30rpx;
box-sizing: border-box;
}
.label-title{
width:100%;
padding:30rpx 0;
}
.me-label-list{
padding-bottom: 10rpx;
border-bottom:1px solid #eee;
margin-bottom:40rpx;
}
.label-single-all{
height:56rpx;
margin:0 16rpx 20rpx 0;
border-radius:8rpx;
overflow:hidden;
}
.label-single{
height:56rpx;
padding:0 24rpx;
border-radius:8rpx;
}
.label-input{
width:160rpx;
height:56rpx;
box-sizing: border-box;
border:1px solid #ccc;
max-width:400rpx;
min-width:140rpx;
margin:0 16rpx 20rpx 0;
border-radius:8rpx;
text-align:center;
padding:0 10rpx;
}
.all-label{
box-sizing: border-box;
border:1px solid rgba(25,144,149,.3);
}
.close{
width:18rpx;
height:18rpx;
}
\ No newline at end of file
... ...
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1550046540077" class="icon" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2883" xmlns:xlink="http://www.w3.org/1999/xlink" width="64" height="64"><defs><style type="text/css"></style></defs><path d="M510.37 584.01L189.495 906.512c-19.945 20.045-52.362 20.126-72.407 0.182-20.045-19.944-20.126-52.362-0.182-72.408l322.281-323.914-322.098-320.478c-20.045-19.944-20.127-52.362-0.184-72.407 19.944-20.045 52.362-20.128 72.407-0.183L513.629 439.99l320.877-322.504c19.945-20.045 52.362-20.126 72.407-0.182 20.045 19.944 20.126 52.362 0.182 72.408L584.814 513.627l322.098 320.478c20.045 19.944 20.127 52.362 0.184 72.407-19.944 20.045-52.362 20.128-72.407 0.183L510.371 584.01z" fill="#ffffff" p-id="2884"></path></svg>
\ No newline at end of file
... ...