Commit 0dfa5478fe3c4c4c6816ae9a29098431f94cb7cb

Authored by zhangyan
1 parent 2dcea0a9

no message

  1 +import util from '../../../utils/util';
  2 +import App from '../../../utils/api';
  3 +Page({
  4 + data:{
  5 + alllabel:[
  6 +
  7 + ],
  8 + focus:true
  9 + },
  10 + onLoad:function(){
  11 + this.getlabellist();
  12 + },
  13 + onShow:function(){
  14 +
  15 + },
  16 + inputremark:function(e){
  17 + this.setData({
  18 + defineremark:util.trim(e.detail.value)
  19 + })
  20 + },
  21 + taplabel:function(e){
  22 + var _target=e.currentTarget.dataset;
  23 + var mylabel=this.data.mylabel;
  24 + console.log(_target.id,_target.type);
  25 + this.setlabel(_target.id,_target.type);
  26 + },
  27 + getlabellist:function(){
  28 + App.User.GetCustomRemark({
  29 + uid:util.cache('enter_params')['manager_id']
  30 + }).then(res=>{
  31 + console.log(res)
  32 + this.setData({
  33 + alllabel:res.data
  34 + })
  35 + })
  36 + },
  37 + setlabel:function(id,flag){
  38 + App.User.GetCustomRemark({
  39 + uid:util.cache('enter_params')['manager_id'],
  40 + kid:id,
  41 + flag:flag,
  42 + }).then(res=>{
  43 + console.log(res)
  44 + this.setData({
  45 + alllabel:res.data
  46 + })
  47 + })
  48 + },
  49 + addinputlabel:function(e){
  50 + this.setData({
  51 + focus:false
  52 + })
  53 + if(util.trim(e.detail.value)!=''){
  54 + this.addlabel(util.trim(e.detail.value))
  55 + }
  56 +
  57 + },
  58 + //添加自定义标签
  59 + addlabel:function(custom){
  60 + App.User.AddCustomRemark({
  61 + uid:util.cache('enter_params')['manager_id'],
  62 + custom:custom,
  63 + }).then(res=>{
  64 + console.log(res)
  65 + if(res.ret==200){
  66 + this.setData({
  67 + defineremark:'',
  68 + })
  69 + this.getlabellist();
  70 + }
  71 + })
  72 + },
  73 +})
  1 +{
  2 + "backgroundTextStyle":"light",
  3 + "navigationBarBackgroundColor": "#fff",
  4 + "navigationBarTextStyle":"white",
  5 + "usingComponents": {
  6 + "nav":"/components/nav/nav",
  7 + "tabBar":"/components/book/tabBar/tabBar",
  8 + "formids":"/components/formids/formids"
  9 + }
  10 +}
  1 +<nav id="nav">常用备注</nav>
  2 +<view class="cut"></view>
  3 +<view class="label">
  4 + <view class="label-title black-font font30r smooth" style="padding-bottom:40rpx;">我的常用备注</view>
  5 + <view class="label-list flex-rs me-label-list">
  6 + <block wx:for="{{alllabel}}">
  7 + <block wx:if="{{item.often_use!=''}}">
  8 + <view class="label-single-all flex-ll bg_green" data-id="{{item.id}}" data-type="often" bindtap="taplabel">
  9 + <view class="white-font label-single flex-cc font28r smooth">{{item.custom}}</view>
  10 + <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>
  11 + </view>
  12 + </block>
  13 + </block>
  14 + <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"/>
  15 + </view>
  16 + <view class="label-title black-font font30r smooth">所有备注</view>
  17 + <view class="label-list flex-rs">
  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>
  20 + </block>
  21 + </view>
  22 +</view>
  1 +.label{
  2 + width:100%;
  3 + padding:0 30rpx;
  4 + box-sizing: border-box;
  5 +}
  6 +.label-title{
  7 + width:100%;
  8 + padding:30rpx 0;
  9 +}
  10 +.me-label-list{
  11 + padding-bottom: 10rpx;
  12 + border-bottom:1px solid #eee;
  13 + margin-bottom:40rpx;
  14 +}
  15 +.label-single-all{
  16 + height:56rpx;
  17 + margin:0 16rpx 20rpx 0;
  18 + border-radius:8rpx;
  19 + overflow:hidden;
  20 +}
  21 +.label-single{
  22 + height:56rpx;
  23 + padding:0 24rpx;
  24 + border-radius:8rpx;
  25 +}
  26 +.label-input{
  27 + width:160rpx;
  28 + height:56rpx;
  29 + box-sizing: border-box;
  30 + border:1px solid #ccc;
  31 + max-width:400rpx;
  32 + min-width:140rpx;
  33 + margin:0 16rpx 20rpx 0;
  34 + border-radius:8rpx;
  35 + text-align:center;
  36 + padding:0 10rpx;
  37 +}
  38 +.all-label{
  39 + box-sizing: border-box;
  40 + border:1px solid rgba(25,144,149,.3);
  41 +}
  42 +.close{
  43 + width:18rpx;
  44 + height:18rpx;
  45 +}
  1 +<?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>