裂变星小程序-25.03.04
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

154 lines
2.6 KiB

2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
  1. <template>
  2. <view class="page">
  3. <image src="../../static/image/home/bg.png" class="bg" mode="scaleToFill"></image>
  4. <view class="content">
  5. <navbar title="首页" bgColor="transparent" color="#FFFFFF" />
  6. <view class="btns">
  7. <button
  8. v-for="item in list"
  9. :key="item.title"
  10. class="btn"
  11. plain
  12. @click="onClick(item.path)"
  13. >
  14. {{ item.title }}
  15. </button>
  16. </view>
  17. </view>
  18. <tabber select="home"/>
  19. </view>
  20. </template>
  21. <script>
  22. import { mapState } from 'vuex'
  23. import tabber from '@/components/base/tabbar.vue'
  24. export default {
  25. components : {
  26. tabber,
  27. },
  28. data() {
  29. return {
  30. list: [
  31. {
  32. title: '个人分享',
  33. path: '/pages_order/record/personalSharing'
  34. },
  35. {
  36. title: '视频分享',
  37. path: '/pages_order/record/videoSharing'
  38. },
  39. {
  40. title: '群分享',
  41. path: '/pages_order/record/groupSharing'
  42. },
  43. {
  44. title: '文章分享',
  45. path: '/pages_order/record/articleSharing'
  46. },
  47. ],
  48. bgUrl: null,
  49. }
  50. },
  51. computed: {
  52. ...mapState(['userInfo']),
  53. },
  54. onShow() {
  55. this.fetchBg()
  56. },
  57. onLoad(option) {
  58. const { state, shareId } = option
  59. if (shareId) {
  60. uni.setStorageSync('shareId', shareId)
  61. }
  62. if (state) {
  63. uni.setStorageSync('state', state)
  64. }
  65. if (shareId && !uni.getStorageSync('token')) {
  66. uni.navigateTo({
  67. url: '/pages_order/auth/wxLogin'
  68. })
  69. return
  70. }
  71. if (uni.getStorageSync('token') && !this.userInfo?.id) {
  72. this.$store.commit('getUserInfo')
  73. }
  74. },
  75. methods: {
  76. async fetchBg() {
  77. try {
  78. // todo: check
  79. this.bgUrl = (await this.$fetch('getBanner'))?.[0]?.image
  80. } catch (err) {
  81. }
  82. },
  83. onClick(url) {
  84. if (!uni.getStorageSync('token')) {
  85. uni.navigateTo({
  86. url: '/pages_order/auth/wxLogin'
  87. })
  88. return
  89. }
  90. this.$utils.navigateTo(url)
  91. }
  92. },
  93. }
  94. </script>
  95. <style scoped lang="scss">
  96. .page{
  97. & /deep/ .uv-icon__icon{
  98. font-size: 30rpx !important;
  99. }
  100. position: relative;
  101. height: 100vh;
  102. overflow: hidden;
  103. .btns {
  104. display: grid;
  105. grid-column-gap: 34rpx;
  106. grid-row-gap: 34rpx;
  107. grid-template-columns: repeat(2, 1fr);
  108. position: absolute;
  109. bottom: 466rpx;
  110. width: 100%;
  111. padding: 0 58rpx;
  112. box-sizing: border-box;
  113. }
  114. .btn {
  115. color: $uni-text-color-highlight;
  116. border-color: #04D6A3;
  117. width: 100%;
  118. padding: 55rpx 0;
  119. }
  120. }
  121. .bg {
  122. width: 100vw;
  123. height: 100vh;
  124. }
  125. .content {
  126. position: absolute;
  127. width: 100vw;
  128. height: 100vh;
  129. top: 0;
  130. }
  131. </style>