<template>
  <div class="main">
    <div class="top">
      <img src="../../assets/images/ksrm.png" alt="" class="rmTP">
      <div>
        <div class="title">快速入门</div>
        <div>您可在此处学习相关操作步骤</div>
      </div>
    </div>
    <div class="main">
      <div
        v-if="isPublic || isPrivate || isHeadOps || isBranchAdmin"
        class="item"
        @click="handleWg"
      >
        <div><i class="el-icon-question quesiton" />如何创建网格并分配?</div>
        <div class="czyd">操作引导</div>
      </div>
      <div class="item" @click="handleRw">
        <div>
          <i class="el-icon-question quesiton" />如何创建任务并自动化分配?
        </div>
        <div class="czyd">操作引导</div>
      </div>
      <div class="item" @click="handleDownloadOperation">
        <div><i class="el-icon-question quesiton" />操作手册</div>
        <div class="czyd">下载</div>
      </div>
    </div>
  </div>
</template>
<script>
import { mapGetters } from 'vuex'
import {downloadFile} from '@/api/login.js'
import { downloadFiles } from '@/utils'
export default {
  data() {
    return {}
  },
  computed: {
    ...mapGetters(['roles', 'userName']),
    // 总行
    isHeadAdmin() {
      return this.roles.includes('headAdmin')
    },
    // 对公
    isPublic() {
      return this.roles.includes('headPublic')
    },
    // 对私
    isPrivate() {
      return this.roles.includes('headPrivate')
    },
    // 运管部
    isHeadOps() {
      return this.roles.includes('headOps')
    },
    // 支行
    isBranchAdmin() {
      return this.roles.includes('branchAdmin')
    },
    // 客户经理
    isCommonManager() {
      return this.roles.includes('commonManager')
    },
    // 网点主任
    isOutletAdmin() {
      return this.roles.includes('outletAdmin')
    }
  },
  methods: {
    handleWg() {
      this.$router.push({ path: '/grid/create/create' })
      sessionStorage.setItem('isTour', 0)
    },
    handleRw() {
      this.$router.push({ path: '/grid/create/segmentation' })
      sessionStorage.setItem('isSegTour', 0)
    },
    handleDownloadOperation() {
      downloadFile().then((res) => {
        downloadFiles(res, '操作手册.docx')
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.main {
  background-color: #fff;
  overflow: hidden;
  box-shadow: 0 3px 8px 0 #00000017;
  border-radius: 16px 16px 0 0;
  height: calc(100vh - 135px);
  overflow-y: auto;
  padding: 10px;
}

.top {
  background-color: #f1fbff;
  display: flex;
  justify-content: center;
  align-items: center;
}

.title {
  font-size: 25px;
  font-weight: 700;
  line-height: 65px;
}

.rmTP {
  width: 240px;
}

.item {
  padding: 20px;
  border: 1px solid rgb(187, 187, 187);
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
  cursor: pointer;
}

.czyd {
  color: rgb(25, 144, 255);
}

.quesiton {
  color: rgb(25, 144, 255);
}
</style>
