<!--pages/welfareMall/personal/personal.wxml-->
<page-wrap id="Page" class="{{grayTheme?'page':''}}">
  <custom-page head-bg-image="{{personHeadList.length > 0 && personHeadList[0].figure?personHeadList[0].figure:'https://dy.shpr.top/welfareGo/personal-my.png'}}" bind:sizes="handlePageSizes">
    <view slot="body" class="sign-scroll-body">
    <view slot="body" class="personal flex-column">
      <!-- 首部个人信息 -->

      <view class="head flex-column" style="height: {{bodyImageHeight}}px;">
        <view class="head-personal flex-row" wx:if="{{hasUserInfo}}">
      
          <!-- 获取用户头像 -->
          <!-- <view class="hat"></view> -->
          <image class="head-personal-logo" src="{{userInfo.avatarUrl}}"> </image>
          <view class="head-personal-nl flex-column">
            <!-- 获取用户微信昵称 -->
            <view class="head-personal-name">{{userInfo.nickName}}</view>
            <view class="flex-row">
              <view class="head-personal-name" wx:if="{{isLogin}}">{{phone.toHide(mobileTop)}}</view>
              <button class="head-personal-login" style="background-color: transparent;" wx:if="{{!isLogin}}" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">授权手机号</button>
              <view class="logout" wx:if="{{isLogin}}" bindtap="logout" style="color: {{config.secColor?config.secColor:'#B01717'}};border: {{config.secColor?config.secColor:'#B01717'}} 2rpx solid;">重新授权</view>
            </view>
          </view>
      
        </view>
      
        <view class="head-personal flex-row" wx:else>
          <image class="head-personal-logo" src="/images/welfareMall/head-portrait.png"> </image>
          <view class="head-personal-nl flex-column">
            <!-- 获取用户微信昵称 -->
            <button class="personal-isLogin"  wx:if="{{isLogin}}" bindtap="getUserProfile">头像/昵称</button>
            <view class="flex-row">
              <view class="head-personal-name" wx:if="{{isLogin}}">{{phone.toHide(mobileTop)}}</view>
              <button class="personal-isLogin" wx:if="{{!isLogin}}" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">登录/注册</button>
              <view class="logout" wx:if="{{isLogin}}" bindtap="logout" style="color: {{config.secColor?config.secColor:'#B01717'}};border: {{config.secColor?config.secColor:'#B01717'}} 2rpx solid;">重新授权</view>
            </view>
          </view>
       
        </view>
        <view>
        
        <!-- <view class="head-card flex-row" catchtap="{{couponPath?'getCouponPath':''}}">
            <view class="head-card-coupon">我的优惠券</view>
            <view class="head-card-nt flex-row">
              <view class="head-card-num">{{countNum}}</view>
              <view class="head-card-text">张</view>
            </view>
          </view> -->
          <view class="head-card-no flex-row" catchtap="{{couponPath?'getCouponPath':''}}">
            <view class="head-card-coupon">我的优惠券</view>
            <view class="head-card-nt flex-row">
              <view class="head-card-num">{{countNum}}</view>
              <view class="head-card-text">张</view>
            </view>
          </view>
        </view>
      </view>
      <!-- 员工通道 -->
      <view><button class="wx-isLogin-broadcast" wx:if="{{!isLogin}}" open-type="getPhoneNumber" bindgetphonenumber="getStaff"></button>
        <image class="broadcast" catchtap="toStaff" src="{{staffImgList.length > 0 && staffImgList[0].figure?staffImgList[0].figure:'https://dy.shpr.top/welfareGo/broadcast1.png'}}"></image>
      </view>
      <!-- 内容 -->
      <view class="content flex-column">
        <!-- 导航栏遍历 -->
        <view class="sign-in content-style" wx:for="{{navigationList}}" data-appid="{{item.appId}}" wx:key="unique">
          <button class="wx-isLogin" wx:if="{{!isLogin}}" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNav" data-path="{{item.path}}"></button>
          <view class="grant flex-row" bindtap="goToCoupon" data-path="{{item.path}}">
            <view class="content-img-text flex-row">
              <image class="content-img" src="{{item.figure}}"></image>
              <view class="content-text">{{item.title}}</view>
            </view>
            <image class="content-jump" src="/images/welfareMall/jump.png" />
          </view>
          <view class="content-lower"></view>
        </view>
      </view>
    </view>

  </view>
  </custom-page>

  <view>
    <button open-type="contact" class="call" type="warn" size="mini">
      <image class="service-style" src="../../../images/welfareMall/service-img.png"></image>
    </button>
  </view>
</page-wrap>

<!-- 使用wxs 手机号码中间四位显示为*号 -->
<wxs module="phone">
  var toHide = function (array) {
    var mphone = array.substring(0, 3) + '****' + array.substring(7);
    return mphone;
  }
  module.exports.toHide = toHide;
</wxs>