<!--pages/project/index.wxml-->
<view class="sg-container">
  <view class="sg-user-box sg-pad sg-flex sg-align-center">
    <view class="sg-big-avatar" wx:if="{{userInfo.avatar==''}}">
        <open-data type="userAvatarUrl"></open-data>
      </view>
    <image wx:else class="sg-big-avatar" src="{{userInfo.avatar ? userInfo.avatar : userInfo.avatarUrl}}" mode="widthFix"></image>
    <view class="sg-right sg-flex-grow">
      <view class="sg-name">{{userInfo.name}}</view>
      <view
        class="sg-project-role sg-gray-color sg-font-small sg-flex sg-align-center sg-space-between sg-margin-tb-sm">
        <view class="sg-project">中铁二局项目部</view>
        <view class="sg-role">{{ project.role ? project.role.name : '' }}</view>
      </view>
      <view class="sg-phone-user sg-flex sg-align-center sg-space-between">
        <view class="sg-phone sg-gray-color sg-font-small">{{ userInfo.phone }}</view>
        <block wx:if="{{ role && role.rights && role.rights.memberManage }}">
          <view class="sg-user sg-font-small sg-index-color sg-flex sg-align-center" bindtap="navigate"
          data-url="/pages/project-user/index?id={{id}}">
          <van-icon name="user-o" /><text>人员管理</text></view>
        </block>
      </view>
    </view>
  </view>
  <view class="sg-menu-box sg-pad">
    <view class="sg-menu-header">
      <text class="sg-title sg-bold">设备租赁</text>
      <text class="sg-sub-title sg-gray-color">外部设备租赁</text>
    </view>
    <view class="sg-menu-list">
      <block wx:for="{{device_rent_menus}}" wx:key="index">
        <view class="sg-item sg-flex sg-align-center sg-pad" bindtap="navigate" data-url="{{item.url}}" wx:if="{{!item.hidden}}">
          <image class="sg-img" src="{{item.img}}" mode="widthFix"></image>
          <view class="sg-name sg-margin-top-sm">{{item.title}}</view>
          <view class="sg-desp sg-margin-top-sm sg-gray-color sg-font-xs">{{item.desc}}</view>
        </view>
      </block>
    </view>
  </view>
  <view class="sg-menu-box sg-pad" wx:if="{{ role && role.rights && role.rights.applyHandle }}">
    <view class="sg-menu-header">
      <text class="sg-title sg-bold">设备调用</text>
      <text class="sg-sub-title sg-gray-color">内部设备调用</text>
    </view>
    <view class="sg-menu-list">
      <view class="sg-item sg-flex sg-align-center sg-pad" wx:for="{{device_use_menus}}" wx:key="index" bindtap="navigate" data-url="{{item.url}}" wx:if="{{!item.hidden}}">
        <image class="sg-img" src="{{item.img}}" mode="widthFix"></image>
        <view class="sg-name sg-margin-top-sm">{{item.title}}</view>
        <view class="sg-desp sg-margin-top-sm sg-gray-color sg-font-xs">{{item.desc}}</view>
      </view>
    </view>
  </view>
  <van-popup show="{{ showAuth }}" bind:close="onClose" custom-style="width: 80%;">
    <view class="sg-flex sg-flex-column sg-align-center sg-pad sg-text-center">
      <view class="sg-title sg-pad-tb">应用需要获取您的订阅消息权限为您发送订单信息</view>
      <view class="sg-btns">
        <van-button type="primary" class="sg-btn" block bind:click="requestAuth">确认</van-button>
        <view class="sg-margin-top">
          <van-button type="default" class="sg-btn" block bind:click="switchShow" data-name="showAuth">取消</van-button>
        </view>
      </view>
    </view>
  </van-popup>
  <view class="sg-menu-box sg-pad">
    <view class="sg-menu-header">
      <text class="sg-title sg-bold">设备仓库</text>
      <text class="sg-sub-title sg-gray-color">内部设备管理</text>
    </view>
    <view class="sg-menu-list">
      <view class="sg-item sg-flex sg-align-center sg-pad" wx:for="{{device_depot_menus}}" wx:key="index" bindtap="navigate" data-url="{{item.url}}" data-title="{{item.title}}">
        <image class="sg-img" src="{{item.img}}" mode="widthFix"></image>
        <view class="sg-name sg-margin-top-sm">{{item.title}}</view>
        <view class="sg-desp sg-margin-top-sm sg-gray-color sg-font-xs">{{item.desc}}</view>
      </view>
    </view>
  </view>
</view>