integralShow.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <!-- -->
  2. <template>
  3. <div class="statisticsBox d-flex">
  4. <div class="d-flex mt-2" style="flex: 1;">
  5. <div v-for="(val, i) in list" :key="i" :style="{'margin-left': val.showRules ? '0' : '200px'}">
  6. <div>
  7. <span class="ml-10 item-title">{{ val.title }}</span>
  8. <span v-if="val.showRules" class="ml-5 rules cursor-pointer" @click="integralRulesClick">
  9. <v-icon>mdi-help-circle-outline</v-icon>
  10. {{ $t('points.integralRules') }}
  11. </span>
  12. </div>
  13. <div>
  14. <span v-if="val.value === 'balance'" class="ml-10 item-value">{{ accountData[val.value] && accountData[val.value] > 0 ? (accountData[val.value]) : 0 }}</span>
  15. <span v-else class="ml-10 item-value">{{ accountData[val.value] || 0 }}</span>
  16. </div>
  17. </div>
  18. </div>
  19. <div class="d-flex align-end">
  20. <span style="font-size: 16px; color: #787d82; line-height: 24px;" class="mr-8">
  21. <template v-if="props.showMall">
  22. <span class="mall-text" @click="handleClickMall">{{ $t('points.handpickMall') }}</span>
  23. </template>
  24. <template v-if="props.taskCenter">
  25. <span class="septal-line"></span>
  26. <span class="mall-text" @click="router.push({ path: '/recruit/personal/TaskCenter' })">赚取积分</span>
  27. </template>
  28. </span>
  29. </div>
  30. </div>
  31. </template>
  32. <script setup>
  33. defineOptions({name: 'myRegistration-integralShow'})
  34. import { ref } from 'vue'
  35. import { useUserStore } from '@/store/user'
  36. import { useRouter } from 'vue-router'; const router = useRouter()
  37. const props = defineProps({
  38. showMall: {
  39. type: Boolean,
  40. default: true
  41. },
  42. taskCenter: {
  43. type: Boolean,
  44. default: false
  45. },
  46. // 招聘端
  47. isEnterprise: {
  48. type: Boolean,
  49. default: false
  50. }
  51. })
  52. const list = ref([
  53. { title: '您当前剩余积分', value: 'point', showRules: true },
  54. // { title: '您当前余额', value: 'balance', showRules: false },
  55. ])
  56. const userStore = useUserStore()
  57. const key = props.isEnterprise ? 'enterpriseUserAccount' : 'userAccount'
  58. let accountData = ref(JSON.parse(localStorage.getItem(key)) || {})
  59. userStore.$subscribe((mutation, state) => {
  60. if (Object.keys(state[key]).length) accountData.value = state[key]
  61. })
  62. // 积分规则
  63. const integralRulesClick = () => {
  64. window.open('/integral/personalIntegralRules')
  65. }
  66. // 跳转臻选商城
  67. const handleClickMall = () => {
  68. window.open('/mall')
  69. }
  70. </script>
  71. <style lang="scss" scoped>
  72. .statisticsBox {
  73. padding: 10px 0;
  74. border-radius: 10px;
  75. background-color: var(--default-bgc);
  76. // background-color: var(--color-f3);
  77. // font-family: 宋体, SimSun;
  78. }
  79. .mall-text {
  80. color: var(--color-666);
  81. cursor: pointer;
  82. &:hover {
  83. color: var(--v-primary-base);
  84. }
  85. }
  86. .item-title {
  87. font-size: 20px;
  88. color: var(--color-333);
  89. line-height: 28px;
  90. font-weight: bold;
  91. }
  92. .item-value {
  93. font-size: 42px;
  94. color: #10897bba;
  95. line-height: 50px;
  96. }
  97. .rules {
  98. font-size: 14px;
  99. color: var(--color-666);
  100. line-height: 24px;
  101. }
  102. </style>