slider.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <template>
  2. <div class="slider-box" :style="{'height': getToken() ? '180px' : '92px'}">
  3. <div v-for="(item, index) in list" :key="index" class="slider-box-item" @click="handleClick(item, index)">
  4. <v-btn size="30" class="icons" icon variant="text">
  5. <v-icon class="icons" size="30">{{ item.mdi }}</v-icon>
  6. <v-tooltip :text="item.tips" location="start" activator="parent">
  7. <div v-if="item.showImg" class="ma-3" style="text-align: center">
  8. <v-img cover aspect-ratio="1/1" src="https://minio.citupro.com/dev/menduner/official-account-code4.jpg" :width="170" style="height: 170px;"></v-img>
  9. <span class="tips-text">关注menduner公众号</span>
  10. </div>
  11. <span v-else>{{ item.tips }}</span>
  12. </v-tooltip>
  13. </v-btn>
  14. </div>
  15. </div>
  16. </template>
  17. <script setup>
  18. defineOptions({ name: 'personalSlider' })
  19. import { useRouter } from 'vue-router'
  20. import { getToken } from '@/utils/auth'
  21. const router = useRouter()
  22. const defaultList = [
  23. { mdi: 'mdi-arrow-up-bold', tips: '返回顶部' },
  24. { mdi: 'mdi-qrcode', tips: '微信公众号', showImg: 'https://minio.citupro.com/dev/menduner/official-account-code4.jpg' }
  25. ]
  26. const hasTokenList = [
  27. { mdi: 'mdi-arrow-up-bold', tips: '返回顶部' },
  28. { mdi: 'mdi-qrcode', tips: '微信公众号', showImg: 'https://minio.citupro.com/dev/menduner/official-account-code4.jpg' },
  29. { mdi: 'mdi-bell-outline', tips: '通知', path: '/recruit/personal/message' },
  30. { mdi: 'mdi-list-box-outline', tips: '在线简历', path: '/recruit/personal/personalCenter/resume/online' }
  31. ]
  32. const list = getToken() ? hasTokenList : defaultList
  33. const handleClick = (item, index) => {
  34. // 回到顶部
  35. if (index === 0) window.scrollTo({ top: 0, behavior: 'smooth' })
  36. if (item.path) router.push(item.path)
  37. }
  38. </script>
  39. <style lang="scss" scoped>
  40. .slider-box {
  41. width: 44px;
  42. // height: 180px;
  43. background-color: #fff;
  44. border-radius: 22px;
  45. box-shadow: 0 4px 20px 0 rgba(0,0,0,.06);
  46. }
  47. .slider-box-item {
  48. width: 44px;
  49. height: 44px;
  50. padding: 6px 0;
  51. text-align: center;
  52. }
  53. .icons {
  54. color: var(--color-ccc);
  55. &:hover {
  56. color: var(--v-primary-base);
  57. }
  58. }
  59. .tip-text {
  60. font-size: 14px;
  61. color: var(--color-222);
  62. }
  63. </style>