index.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <view class="ezy-zhuanti-page">
  3. <view class="zt-qipao-box">
  4. <!-- wgy看这↓ 如果是游客的话不显示text标签内容-->
  5. <view>寻觅者<text>"小小同学"</text></view>
  6. <view>形容一下你的心情吧?</view>
  7. </view>
  8. <view class="zt-biaoqing-box">
  9. <view v-for="(item,index) in biaoqingList" :key="index" @click="goZhuantiInfo(item)"
  10. class="biaoqing-item-box"></view>
  11. </view>
  12. <CustomTabBar :currentTabNumber="1" :cardId="cardId" :nianji="nianji" :zhangId="zhangId" :tipFlag='tipFlag' ></CustomTabBar>
  13. <tip-big-dialog ref="youkeDialogRef" @confirm-btn="ykConfirm" :imgShow="true"></tip-big-dialog>
  14. </view>
  15. </template>
  16. <script setup>
  17. import {
  18. toast,
  19. getUserIdentity
  20. } from "@/utils/common";
  21. import cacheManager from '@/utils/cacheManager.js';
  22. import tipBigDialog from '@/components/dialog/tipBigDialog.vue';
  23. import {
  24. } from '@/api/zhuanti.js'
  25. import CustomTabBar from '@/components/custom-tabbar/custom-tabbar.vue';
  26. import {
  27. reactive,
  28. ref
  29. } from "vue";
  30. import {
  31. onLoad
  32. } from '@dcloudio/uni-app';
  33. const youkeFlag = ref(null);
  34. const yhName = ref(null);
  35. const youkeDialogRef = ref(null);
  36. const zhangId = ref(null); //游客使用
  37. const nianji = ref(null); //游客使用
  38. const cardId = ref(null); //游客使用
  39. const tipFlag = ref(null); //游客使用
  40. let routerOpt = ref(false);
  41. const biaoqingList = ref(
  42. [{
  43. name: '开心',
  44. type: 1
  45. },
  46. {
  47. name: '愤怒',
  48. type: 2
  49. },
  50. {
  51. name: '悲伤',
  52. type: 3
  53. },
  54. {
  55. name: '害怕',
  56. type: 4
  57. },
  58. {
  59. name: '得意',
  60. type: 5
  61. },
  62. {
  63. name: '嫉妒',
  64. type: 6
  65. },
  66. {
  67. name: '压抑',
  68. type: 7
  69. },
  70. {
  71. name: '抱怨',
  72. type: 8
  73. }
  74. ]
  75. )
  76. onLoad((options) => {
  77. if (cacheManager.get('auth')) {
  78. youkeFlag.value = true
  79. yhName.value = cacheManager.get('auth').realName || ''
  80. } else {
  81. // 游客
  82. routerOpt = options;
  83. zhangId.value = routerOpt.zhangId
  84. nianji.value = routerOpt.nianji
  85. cardId.value = routerOpt.cardId
  86. tipFlag.value = routerOpt.tipFlag
  87. youkeFlag.value = false
  88. }
  89. })
  90. // 游客弹窗---确定
  91. function ykConfirm() {
  92. uni.redirectTo({
  93. url: '/pages/login/index'
  94. });
  95. }
  96. function goZhuantiInfo(data) {
  97. console.log('data', data);
  98. if (!youkeFlag.value) {
  99. youkeDialogRef.value.handleShow();
  100. return false
  101. }
  102. uni.redirectTo({
  103. url: '/pages/zhuanti/zhuantiInfo?type=' + data.type
  104. })
  105. }
  106. </script>