mytuijian.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <template>
  2. <view class="main">
  3. <view class="" style="width: 100%;">
  4. <view class=" nav text-center">
  5. <view :class="index==TabCur?'cu-item text_style cur':'cu-item textstyle'" v-for="(item,index) in list" :key="index"
  6. @click="tabSelect" :data-id="index">
  7. {{item}}
  8. </view>
  9. </view>
  10. <view class="tabs margin-top-sm flex flex-wrap justify-between">
  11. <view class="tab margin-top-sm" @click="gotoinfo(item.id)" style="box-shadow: 0 0 50rpx 0 rgba(0, 0, 0, 0.1);"
  12. v-for="(item,index) in DynamicList" :key="index">
  13. <image :src="item.image" style="width: 320rpx;height: 212rpx;" ></image>
  14. <view class="padding-xs text-cut">
  15. {{item.title}}
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="flex justify-center" style="position: fixed;bottom: 145rpx;z-index: 9999;">
  21. <button class="cu-btn round lg" @click="jiameng" style="width: 600rpx;background-color:rgb(251, 198, 0);box-shadow: 0 0 50rpx 0 rgba(0, 0, 0, 0.1);">
  22. <text class="cuIcon-profilefill text-black margin-right-xs"></text>
  23. <text>我想合作</text>
  24. </button>
  25. </view>
  26. <view class="cu-tabbar-height"></view>
  27. <view class="cu-tabbar-height"></view>
  28. </view>
  29. </template>
  30. <script>
  31. import {
  32. envHost
  33. } from '@/common/env';
  34. var user = require('../../common/user.js');
  35. import {
  36. mapState,
  37. mapMutations,
  38. mapGetters,
  39. mapActions
  40. } from 'vuex';
  41. export default {
  42. computed: {
  43. ...mapGetters({
  44. hasLogin: 'verifyJwt'
  45. }),
  46. ...mapState(['user'])
  47. },
  48. data() {
  49. return {
  50. TabCur: 0,
  51. list: [
  52. "行业动态",
  53. "热门推广",
  54. "人才培训"
  55. ],
  56. DynamicList: [],
  57. index: 2,
  58. mineshow:false
  59. }
  60. },
  61. onLoad(option) {
  62. },
  63. mounted() {
  64. this.dynamicList(this.index)
  65. },
  66. methods: {
  67. ...mapActions({
  68. getUser: 'getUser' // 将 `this.getUser()` 映射为 `this.$store.dispatch('getUser')`
  69. }),
  70. ...mapMutations({
  71. setJwt: 'setJwt',
  72. login: 'login'
  73. }),
  74. jiameng() {
  75. if (this.mineshow) {
  76. uni.showModal({
  77. title: "提示",
  78. content: "系统维护请等待通知",
  79. showCancel: false,
  80. success: (res) => {}
  81. })
  82. return false
  83. }
  84. // 请求接口返回数据判断是否为推广人
  85. // 是推荐人直接跳转到pages/tuijian/tuijian 页面
  86. if (this.hasLogin) {
  87. uni.navigateTo({
  88. url: '/pages/index/joinInfo'
  89. });
  90. } else {
  91. this.toUrl = '/pages/index/joinInfo';
  92. uni.navigateTo({
  93. url: "../login/login",
  94. fail: (err) => {
  95. console.log(err)
  96. }
  97. })
  98. }
  99. },
  100. tabSelect(e) {
  101. this.TabCur = e.currentTarget.dataset.id
  102. this.dynamicList(this.index + parseInt(this.TabCur))
  103. console.log(this.index + parseInt(this.TabCur))
  104. },
  105. dynamicList: async function(cate_id) {
  106. let res = await this.$request.get('/api/Article/articleList?page=1&size=10&cate_id=' + cate_id);
  107. if (res.code == 200) {
  108. this.DynamicList = res.data.data;
  109. console.log(this.DynamicList);
  110. } else {
  111. uni.showToast({
  112. icon: 'none',
  113. title: res.message
  114. });
  115. }
  116. },
  117. gotoinfo(id) {
  118. if (this.mineshow) {
  119. uni.showModal({
  120. title: "提示",
  121. content: "系统维护请等待通知",
  122. showCancel: false,
  123. success: (res) => {}
  124. })
  125. return false
  126. }
  127. uni.navigateTo({
  128. url: '/pages/index/articleDetails?id=' + id
  129. });
  130. }
  131. }
  132. }
  133. </script>
  134. <style scoped>
  135. page {
  136. background-color: #fff;
  137. /* height: 100%; */
  138. }
  139. .main {
  140. margin: 10vw 5vw 0 5vw;
  141. display: flex;
  142. flex-direction: column;
  143. align-items: center;
  144. justify-content: space-between;
  145. height: 100%;
  146. }
  147. .text_style {
  148. color: rgb(251, 198, 0);
  149. }
  150. .textstyle {
  151. color: rgb(152, 152, 152);
  152. }
  153. .tab {
  154. width: 42.5vw;
  155. height: auto;
  156. border-radius: 10rpx;
  157. background: #fff;
  158. display: -webkit-box;
  159. -webkit-box-orient: vertical;
  160. -webkit-line-clamp: 2;
  161. overflow: hidden;
  162. }
  163. </style>