ly-back.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <template xmlns="">
  2. <view class="">
  3. <view v-if="props.showBack" :class="{'action':select === 0}" class="p-f back-box" @click="clickHandle">
  4. <ly-icon :color="color" :size="60" name="icon-fanhui"/>
  5. </view>
  6. <view class="p-f bottom-right"></view>
  7. <view class="p-f mac-info" @click="toSetting">
  8. mac:{{ userStore.mac || '未登录' }}
  9. </view>
  10. </view>
  11. </template>
  12. <script setup>
  13. import {reactive} from "vue";
  14. import {navigateBack, navTo, showToast} from "@/utils/app";
  15. import {useUserStore} from "@/store/useUserStore";
  16. import debounce from "@/utils/debounce";
  17. const debounces = new debounce()
  18. const userStore = useUserStore()
  19. const pd = reactive({})
  20. const emits = defineEmits(['backClick'])
  21. const props = defineProps({
  22. showBack: {
  23. type: Boolean,
  24. default: true,
  25. },
  26. autoBack: {
  27. type: Boolean,
  28. default: true
  29. },
  30. color: {
  31. type: String,
  32. default: '#000'
  33. },
  34. select: {
  35. type: [String, Number],
  36. default: -1
  37. },
  38. })
  39. const clickHandle = () => {
  40. if (props.autoBack) {
  41. navigateBack()
  42. } else {
  43. emits('backClick')
  44. }
  45. }
  46. const toSetting = () => {
  47. debounces.secondCountDown('toSetting', {
  48. time: 5000,
  49. limit: 10,
  50. repetition_time: 0,
  51. run: (num, count, statue) => {
  52. if (count > 5) showToast(`再点击${10 - count}次`)
  53. },
  54. success: () => {
  55. console.log('success')
  56. navTo('pages/setting/index')
  57. },
  58. fail: () => {
  59. console.log('fail')
  60. },
  61. })
  62. }
  63. </script>
  64. <style lang="scss" scoped>
  65. .mac-info {
  66. bottom: 10rpx;
  67. right: 20rpx;
  68. font-size: 35rpx;
  69. color: #cccccc;
  70. }
  71. .back-box {
  72. //width: 30vw;
  73. height: 200px;
  74. z-index: 99;
  75. }
  76. </style>