index.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <view class="main">
  3. <view class="one">
  4. <swiper class="swiper" circular :indicator-dots="true" indicator-color="#F5F5F5"
  5. indicator-active-color="#ffffff" :autoplay="false" :interval="3000" :duration="1000">
  6. <swiper-item class="list" v-for="(item,index) in advertList" :key="index">
  7. <image class="image" :src="item.image&&item.image.length>0?item.image[0].url:''" mode=""></image>
  8. </swiper-item>
  9. </swiper>
  10. </view>
  11. <view class="two">
  12. <uni-collapse>
  13. <uni-collapse-item title="群组" thumb="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/unicloudlogo.png">
  14. <view class="content">
  15. <text class="text">群组</text>
  16. </view>
  17. </uni-collapse-item>
  18. <uni-collapse-item title="好友" thumb="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/unicloudlogo.png">
  19. <view class="content">
  20. <text class="text">群组</text>
  21. </view>
  22. </uni-collapse-item>
  23. </uni-collapse>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. export default {
  29. data() {
  30. return {
  31. user: {},
  32. // 广告
  33. advertList: []
  34. }
  35. },
  36. onLoad: async function(e) {
  37. const that = this;
  38. that.searchToken();
  39. await that.searchOther();
  40. await that.search();
  41. },
  42. methods: {
  43. // 用户信息
  44. searchToken() {
  45. const that = this;
  46. try {
  47. const res = uni.getStorageSync('token');
  48. if (res) that.$set(that, `user`, res);
  49. } catch (e) {
  50. uni.showToast({
  51. title: err.errmsg,
  52. icon: 'error',
  53. duration: 2000
  54. });
  55. }
  56. },
  57. // 查询
  58. async search() {
  59. const that = this;
  60. let res;
  61. },
  62. // 查询其他信息
  63. async searchOther() {
  64. const that = this;
  65. let res;
  66. // // 查询类型
  67. // res = await that.$api(`/dictData`, 'GET', {
  68. // type: 'home_tabs',
  69. // is_use: '0',
  70. // })
  71. // if (res.errcode == '0') that.$set(that, `typeList`, res.data);
  72. },
  73. }
  74. }
  75. </script>
  76. <style lang="scss" scoped>
  77. .main {
  78. .one {
  79. padding: 0 0 2vw 0;
  80. .swiper {
  81. height: 60vw;
  82. .list {
  83. .image {
  84. width: 100%;
  85. height: 100%;
  86. }
  87. }
  88. }
  89. }
  90. }
  91. </style>