<import src="../../../common/head.wxml" />
<import src="../../../common/foot.wxml" />

<view class="container page" data-weui-theme="{{theme}}">
  <template is="head" data="{{title: 'User Authentication'}}"/>

  <view class="page-body">
    <view class="page-section">
      <view class="page-body-info">
        <view class="page-body-title">OpenID</view>
        <block wx:if="{{!openid}}">
          <text class="page-body-text">点击绿色按钮可通过云开发获取用户 OpenID</text>
          <text class="page-body-text">使用云开发，无需自己部署服务端并维护复杂的鉴权机制，在小程序端简单调用即可通过云端获取天然可信任的用户登录态</text>
        </block>
        <block wx:else>
          <text class="openid">{{openid}}</text>
        </block>
      </view>
      <view class="btn-area">
        <button type="primary" bindtap="onGetOpenid" loading="{{loading}}">获取 OpenID</button>
        <button bindtap="clear">清空</button>
      </view>
    </view>
  </view>

  <template is="foot" />
</view>
