<template>
  <div title="下载">
    <el-dropdown style="margin: 0 10px" trigger="click" @command="downloadReadCard">
      <el-icon style="font-size: 18px">
        <Download/>
      </el-icon>
      <template #dropdown>
        <el-dropdown-menu>
          <el-dropdown-item command="thcardreader">读卡插件安装包</el-dropdown-item>
          <el-dropdown-item command="framework" divided>.Net Framework</el-dropdown-item>
          <el-dropdown-item command="chrome90" divided>高版本Chrome浏览器</el-dropdown-item>
          <el-dropdown-item command="google" divided>Chrome浏览器免安装</el-dropdown-item>
          <el-dropdown-item command="lodop" divided>LODOP打印插件</el-dropdown-item>
          <el-dropdown-item command="7z32" divided>7zip解压缩32位</el-dropdown-item>
          <el-dropdown-item command="7z64" divided>7zip解压缩64位</el-dropdown-item>
        </el-dropdown-menu>
      </template>
    </el-dropdown>
  </div>
</template>

<script>
import {defineComponent} from 'vue'

export default defineComponent({
  name: 'download',
  setup() {
    return {
      downloadReadCard,
    }
  },
})

function downloadReadCard(command) {
  let filename
  switch (command) {
    case 'thcardreader':
      filename = 'readcard/读卡插件.msi'
      break
    case 'framework':
      filename = 'readcard/.NET Framework 4.6.1.exe'
      break
    case 'chrome90':
      filename = 'chrome90.exe'
      break
    case 'google':
      filename = 'google.rar'
      break
    case 'lodop':
      filename = 'LODOP/CLodop_Setup_for_Win32NT.exe'
      break
    case '7z32':
      filename = '7zip/7z2201-x32.exe'
      break
    case '7z64':
      filename = '7zip/7z2201-x64.exe'
      break
  }
  window.open(`http://webhis.thyy.cn:8080/download/${filename}`, '_blank')
}
</script>
