<!--
 * @Descripttion: 应用授权
 * @version: 1.0.0
 * @Author: 无尘
 * @Date: 2020-10-16 10:18:02
 * @LastEditors: 无尘
 * @LastEditTime: 2020-10-16 11:44:00
-->
<template>
  <div class="app-auth-body">
    <div class="app-auth-head">
      <img src="../../assets/logo.png" alt="logo" /><span class="web-name">好办管理平台</span>
    </div>
    <div class="app-auth-info">
      <div class="app-info-body">
        <div class="app-info-title">应用授权</div>
        <div class="app-info-detail">
          <div class="flex app-top">
            <div class="app-img">
              <img :src="appInfo.iconUrl" alt="app" />
            </div>
            <div class="flex flex-column p-l-12 flex-space-between">
              <div class="font-14 color-303133 line-h-22">{{appInfo.applicationName}}</div>
              <div class="font-12 color-606266 line-h-20">{{appInfo.introduction}}</div>
            </div>
          </div>
          <div class="auth-rights">
            <div class="auth-rights-title font-14 color-909399">授权后将允许{{appInfo.applicationName || ''}}应用进行以下权限操作</div>
            <div>
              <ul>
                <li v-for="(item, index) in rightsList" class="font-14 color-303133" :key="index + 'right'">{{item.rightsName}}</li>
              </ul>
            </div>
          </div>
        </div>
        <div class="app-info-btn">
          <el-checkbox v-model="checkAuth" class="p-r-10" /><el-button type="text" @click="toProtocol">授权同意《达摩授权服务协议》</el-button><el-button :disabled="checkAuth? false : true" type="primary" @click.stop="toAuthRights">授权</el-button>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'AppAuth',
  components: {},
  data() {
    return {
      appInfo: {
        appId: '',
        applicationName: '',
        introduction: '',
        iconUrl: 'https://pic01-10001430.image.myqcloud.com/69918371857506304/1594638566081_O1zMw.jpg',
        rights: ''
      },
      checkAuth: false,
      rightsList: []
    };
  },
  // 生命周期 - 挂载完成（访问DOM元素）
  mounted() {
    const that = this;
    that.getAppData();
  },
  // methods
  methods: {
    /**
     * @description: 跳转协议
     * @author: 无尘
     */
    toProtocol() {
      window.open('/app-center/protocol', '_blank', 'noopener');
    },
    toAuthRights() {
      const that = this;
      that.$router.push('/');
    },
    getAppData() {
      const that = this;
      that.appInfo = {};
    }
  },
  watch: {}
};
</script>
<style lang='less' scoped>
  .line-h-22 {
    line-height: 22px;
  }
  .line-h-20 {
    line-height: 20px;
  }
  .app-auth-body {
    width: 100%;
    .app-auth-head {
      display: flex;
      align-items: center;
      justify-content: flex-start;
      text-align: left;
      padding: 0 20px;
      height: 46px;
      color: #fff;
      background-color: #fff;
      -webkit-box-shadow: 0 4px 6px 0 rgba(221,227,237,.29);
      box-shadow: 0 4px 6px 0 rgba(221,227,237,.29);
      img {
        width: 22px;
      }
      .web-name {
        padding-left: 10px;
        font-size: 16px;
        font-weight: 600;
        color: #303133;
        line-height: 22px;
        background: -webkit-gradient(linear,right top,left top,from(#5b4adb),to(#2da8ff));
        background: linear-gradient(270deg,#5b4adb,#2da8ff);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
      }
    }
    .app-auth-info {
      width: 100%;
      .app-info-body {
        width: 498px;
        min-height: 374px;
        margin: 50px auto;
        padding: 20px 30px;
        background: #FFFFFF;
        box-shadow: 0px 5px 9px 0px rgba(222, 222, 222, 0.28);
        box-sizing: border-box;
        .app-info-title {
          font-size: 16px;
          font-weight: 600;
          color: #303133;
          line-height: 22px;
        }
        .app-info-detail {
          min-height: 227px;
          margin-top: 25px;
          padding: 15px 20px;
          box-sizing: border-box;
          border: 1px solid #E4E7ED;
          .app-top {
            border-bottom: 1px solid #EBECF0;
            padding-bottom: 15px;
          }
          .app-img {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 42px;
            height: 42px;
            max-width: 42px;
            max-height: 42px;
            border-radius: 6px;
            img {
              max-width: 42px;
              max-height: 42px;
              border-radius: 6px;
            }
          }
          .app-name {
            font-weight: 600;
          }
          .auth-rights {
            .auth-rights-title {
              padding: 10px 0;
            }
            ul {
              li {
                line-height: 20px;
                margin-bottom: 5px;
              }
            }
          }
        }
      }
    }
    .app-info-btn {
      margin-top: 30px;
      text-align: right;
    }
  }

</style>
