index.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <view class="main">
  3. <view class="one">
  4. <swiper :img-list="imgList" url-key="url" @selected="selectedBanner"></swiper>
  5. </view>
  6. <view class="two">
  7. <view class="list" v-for="(item,index) in moduleList" :key="index" @tap="toChange(item)">
  8. <image class="image" :src="item.url&&item.url.length>0?item.url[0].url:''" mode="aspectFill">
  9. </image>
  10. <text class="text">{{ item.name }}</text>
  11. </view>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. import swiper from '../../components/swiper/index.vue';
  17. export default {
  18. components: {
  19. swiper
  20. },
  21. data() {
  22. return {
  23. // 轮播图
  24. imgList: [],
  25. // 模块
  26. moduleList: []
  27. }
  28. },
  29. onLoad: async function() {
  30. const that = this;
  31. await that.searchConfig();
  32. await that.search();
  33. },
  34. methods: {
  35. // 查询基本设置
  36. async searchConfig() {
  37. const that = this;
  38. let res = await that.$api(`/config`, 'GET', {});
  39. if (res.errcode == '0') {
  40. that.$set(that, `imgList`, res.data.file);
  41. }
  42. },
  43. // 查询
  44. async search() {
  45. const that = this;
  46. let res = await that.$api(`/module`, 'GET', {
  47. is_use: '0'
  48. });
  49. if (res.errcode == '0') {
  50. that.$set(that, `moduleList`, res.data);
  51. }
  52. },
  53. // 点击轮播图图片
  54. selectedBanner(item, index) {
  55. console.log(item, index)
  56. },
  57. // 点击模块
  58. toChange(item) {
  59. console.log(item, )
  60. },
  61. },
  62. }
  63. </script>
  64. <style lang="scss">
  65. .main {
  66. .two {
  67. display: flex;
  68. flex-wrap: wrap;
  69. padding: 8vw 0 2vw 0;
  70. .list {
  71. display: flex;
  72. flex-direction: column;
  73. justify-content: space-between;
  74. align-items: center;
  75. width: 20vw;
  76. padding: 1vw 0 0 0;
  77. .image {
  78. width: 15vw;
  79. height: 15vw;
  80. border-radius: 15vw;
  81. box-shadow: 0 0 5px var(--f1Color);
  82. }
  83. .text{
  84. font-size: var(--font14Size);
  85. margin-top: 5px;
  86. color: var(--f85Color);
  87. }
  88. }
  89. }
  90. }
  91. </style>