tabRight.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <template>
  2. <view class="right">
  3. <view v-for="(item, index) in rightList" :key="index" class="right-item">
  4. <image @click="goPath(item,index)" :src="item.img"></image>
  5. <text>{{ item.text }}</text>
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. import utils from "@/utils/index";
  11. export default {
  12. data() {
  13. return {};
  14. },
  15. computed: {
  16. isVip() {
  17. return this.$store.getters.isVip;
  18. },
  19. },
  20. methods: {
  21. goPath(item, index) {
  22. let query = Object.assign({}, this.query);
  23. query.title = item.text;
  24. if (this.needVipList.includes(index) && !this.isVip) {
  25. uni.showModal({
  26. title: "提示",
  27. content: "需要vip才能使用这个功能",
  28. confirmText: "购买vip",
  29. cancelText: "取消",
  30. success(res) {
  31. console.log(res);
  32. if (res.confirm) {
  33. uni.navigateTo({
  34. url: "/otherPages/buyVip/index",
  35. });
  36. }
  37. },
  38. });
  39. return;
  40. }
  41. if (item.path) {
  42. let str = utils.mapToUrlQuery(query);
  43. console.log(item.path + "?" + str, "str");
  44. uni.navigateTo({
  45. url: item.path + "?" + str,
  46. });
  47. }
  48. },
  49. },
  50. props: {
  51. needVipList: {
  52. type: Array,
  53. default: () => {
  54. return [];
  55. },
  56. },
  57. rightList: {
  58. type: Array,
  59. default: () => {
  60. return [];
  61. },
  62. },
  63. subject: {
  64. type: Number,
  65. default: 1,
  66. },
  67. query: {
  68. type: Object,
  69. default: () => {
  70. return {};
  71. },
  72. },
  73. },
  74. };
  75. </script>
  76. <style lang="scss" scoped>
  77. .right {
  78. width: 150rpx;
  79. margin-top: 50rpx;
  80. font-size: 26rpx;
  81. .right-item {
  82. width: 150rpx;
  83. display: flex;
  84. justify-content: center;
  85. flex-direction: column;
  86. align-content: center;
  87. align-items: center;
  88. margin-bottom: 36rpx;
  89. image {
  90. width: 100rpx;
  91. height: 100rpx;
  92. }
  93. }
  94. }
  95. </style>