index-index.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <template>
  2. <view class="index-index" :style="{ display: SHOW ? 'flex' : 'none' }">
  3. <custom-nav :title="title" noback />
  4. <view v-if="logged" class="content">
  5. <view class="area manage">
  6. <navigator v-for="(item, index) in namageList" :url="item.url" :key="index">
  7. <image :src="item.image"></image>
  8. <text>{{ item.name }}</text>
  9. </navigator>
  10. </view>
  11. <view class="area swiper">
  12. <swiper :autoplay="true" :circular="true" :interval="3456" :duration="345">
  13. <swiper-item v-for="(item, index) in swiperList" :key="index">
  14. <navigator :url="item.url">
  15. <image :src="item.image"></image>
  16. </navigator>
  17. </swiper-item>
  18. </swiper>
  19. </view>
  20. <view class="area news">
  21. <image src="../../static/index/index/news.png"></image>
  22. <view class="hot">热点</view>
  23. <swiper :vertical="true" :autoplay="true" :circular="true" :interval="3456" :duration="345">
  24. <swiper-item v-for="(item, index) in newsList" :key="index">
  25. {{ item }}
  26. </swiper-item>
  27. </swiper>
  28. </view>
  29. <view class="area kingkong">
  30. <navigator v-for="(item, index) in kingkongList" :url="item.url" :key="index">
  31. <image :src="item.image"></image>
  32. <text>{{ item.name }}</text>
  33. </navigator>
  34. </view>
  35. <view class="area other">
  36. <navigator v-for="(item, index) in otherList" :url="item.url" :key="index">
  37. <image :src="item.image"></image>
  38. </navigator>
  39. </view>
  40. <view class="tabbar"></view>
  41. </view>
  42. <view v-else class="login-btn">
  43. <navigator url="../../pages/login-reg/login-reg">登录/注册</navigator>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. import { _API_IndexIndex } from '@/apis/index/index.js'
  49. export default {
  50. data() {
  51. return {
  52. title: '首页',
  53. namageList: [
  54. {
  55. name: '订单管理',
  56. url: '../../pages/manage-order/manage-order',
  57. image: '../../static/index/index/manage-order.png'
  58. },
  59. {
  60. name: '人员管理',
  61. url: '../../pages/manage-people/manage-people',
  62. image: '../../static/index/index/manage-poeple.png'
  63. },
  64. {
  65. name: '财富管理',
  66. url: '../../pages/manage-money/manage-money',
  67. image: '../../static/index/index/manage-money.png'
  68. }
  69. ],
  70. swiperList: [],
  71. newsList: [],
  72. kingkongList: [
  73. {
  74. name: '订货下单',
  75. url: '../../pages/place-order/place-order',
  76. image: '../../static/index/index/place-order.png'
  77. },
  78. {
  79. name: '我的订单',
  80. url: '../../pages/my-order/my-order',
  81. image: '../../static/index/index/my-order.png'
  82. },
  83. {
  84. name: '下级订单',
  85. url: '../../pages/down-order/down-order',
  86. image: '../../static/index/index/down-order.png'
  87. },
  88. {
  89. name: '我的库存',
  90. url: '../../pages/my-stock/my-stock',
  91. image: '../../static/index/index/my-stock.png'
  92. },
  93. {
  94. name: '邀请代理',
  95. url: '../../pages/invite-proxy/invite-proxy',
  96. image: '../../static/index/index/invite-proxy.png'
  97. },
  98. {
  99. name: '注册审核',
  100. url: '../../pages/register-examine/register-examine',
  101. image: '../../static/index/index/register-examine.png'
  102. },
  103. {
  104. name: '我的邀请',
  105. url: '../../pages/my-invite/my-invite',
  106. image: '../../static/index/index/my-invite.png'
  107. },
  108. {
  109. name: '团队管理',
  110. url: '../../pages/team-manage/team-manage',
  111. image: '../../static/index/index/team-manage.png'
  112. }
  113. ],
  114. otherList: [
  115. {
  116. url: '../../pages/test/test',
  117. image: '../../static/index/index/new-book.png'
  118. },
  119. {
  120. url: '../../pages/test/test',
  121. image: '../../static/index/index/how-order.png'
  122. },
  123. {
  124. url: '../../pages/test/test',
  125. image: '../../static/index/index/invite.png'
  126. },
  127. {
  128. url: '../../pages/test/test',
  129. image: '../../static/index/index/infobind.png'
  130. }
  131. ]
  132. }
  133. },
  134. computed: {
  135. SHOW() { return this.$store.state.app.index_tabbar_index === 0 },
  136. logged() { return this.$store.state.app.token.length === 0 ? false : true }
  137. },
  138. created() {
  139. uni.$on('INDEXPULLDOWNREFRESH0', () => {
  140. this.indexRequest()
  141. })
  142. },
  143. watch: {
  144. SHOW: {
  145. handler(val) {
  146. if (val) {
  147. if (!this.newsList.length || !this.newsList.length) {
  148. uni.startPullDownRefresh()
  149. }
  150. }
  151. },
  152. immediate: true
  153. }
  154. },
  155. methods: {
  156. indexRequest() {
  157. _API_IndexIndex().then(res => {
  158. uni.stopPullDownRefresh()
  159. this.newsList = res.data.newsList
  160. this.swiperList = res.data.swiperList
  161. })
  162. }
  163. }
  164. }
  165. </script>
  166. <style lang="scss" scoped>
  167. .index-index {
  168. @include page();
  169. .content {
  170. .area {
  171. background: #FFFFFF;
  172. &.manage {
  173. height: 170rpx;
  174. display: flex;
  175. navigator {
  176. flex: 1;
  177. height: 100%;
  178. display: flex;
  179. align-items: center;
  180. flex-direction: column;
  181. image {
  182. width: 94rpx;
  183. height: 94rpx;
  184. margin-top: 20rpx;
  185. }
  186. text {
  187. font-size:32rpx;
  188. margin-top: 10rpx;
  189. }
  190. }
  191. }
  192. &.swiper {
  193. height: 250rpx;
  194. margin-top: 12rpx;
  195. swiper {
  196. height: 100%;
  197. navigator {
  198. height: 100%;
  199. image {
  200. width: 100%;
  201. height: 100%;
  202. }
  203. }
  204. }
  205. }
  206. &.news {
  207. display: flex;
  208. height: 50rpx;
  209. padding: 10rpx 30rpx;
  210. box-sizing: border-box;
  211. image {
  212. height: 100%;
  213. width: 180rpx;
  214. }
  215. .hot {
  216. @include flex();
  217. width: 72rpx;
  218. height: 100%;
  219. font-size: 24rpx;
  220. margin-left: 10rpx;
  221. border-radius: 4rpx;
  222. color: $app-base-color;
  223. border:1px solid $app-base-color;
  224. }
  225. swiper {
  226. flex: 1;
  227. height: 100%;
  228. font-size: 26rpx;
  229. margin-left: 20rpx;
  230. }
  231. }
  232. &.other {
  233. @include flex();
  234. height: 200rpx;
  235. padding: 0 30rpx;
  236. margin-top: 10rpx;
  237. box-sizing: border-box;
  238. navigator {
  239. @include flex();
  240. flex: 1;
  241. image {
  242. width: 168rpx;
  243. height: 175rpx;
  244. }
  245. }
  246. }
  247. }
  248. .tabbar {
  249. height: $app-tabbar-height;
  250. }
  251. }
  252. }
  253. </style>