butler.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <view class="container" :style="{ backgroundImage: `url(${hgjbj})` }">
  3. <uni-section v-for="item in dataList" titleFontSize="16px" class="sectionBox" :title="item.name" type="line">
  4. <view class="box">
  5. <view class="imgBox" v-for="(i, index) in item.data" :key="index" @click="btn(i)">
  6. <image class="imgs" mode="scaleToFill" :src="filesUrl + i.blogPic"></image>
  7. <text class="name">{{ i.title }}</text>
  8. <text class="name">{{ i.blogDesc }}</text>
  9. </view>
  10. </view>
  11. </uni-section>
  12. </view>
  13. </template>
  14. <script>
  15. import request from '../../api/cms.js';
  16. import { BASE_URL } from '../../env.js';
  17. import requestLogin from '../../api/login.js';
  18. export default {
  19. data() {
  20. return {
  21. filesUrl: BASE_URL.fileUrl,
  22. dataList: [],
  23. hgjbj: ''
  24. }
  25. },
  26. onShow: function() {},
  27. async mounted() {
  28. const config = await requestLogin.getJson();
  29. const { hgjbj } = config.data;
  30. this.hgjbj = hgjbj;
  31. const res = await request.getsublist({ alias: 'hgjfc' });
  32. this.dataList = await Promise.all(res.data.map(async e => {
  33. const aliasData = await request.getArticleList({ pageNum: 1, pageSize: 100, typeName: e.alias });
  34. return { name: e.typeName, alias: e.alias, data: aliasData.rows };
  35. }))
  36. },
  37. methods: {
  38. btn(e) {
  39. // uni.navigateTo({ url: `/pages/details/index?id=${e.id}` })
  40. }
  41. }
  42. }
  43. </script>
  44. <style>
  45. .container {
  46. width: 100%;
  47. height: 100vh;
  48. overflow-y: auto;
  49. background-size: 100% 100%;
  50. }
  51. .box {
  52. display: flex;
  53. flex-wrap: wrap;
  54. }
  55. .imgBox {
  56. width: 30%;
  57. height: 36vw;
  58. margin-left: 2.5%;
  59. margin-top: 5px;
  60. }
  61. .imgs {
  62. display: block;
  63. width: 100%;
  64. height: 90%;
  65. border: 2px solid #CD7F32;
  66. }
  67. .name {
  68. width: 100%;
  69. display: block;
  70. text-align: center;
  71. color: #fff;
  72. }
  73. .uni-section {
  74. background-color: transparent !important;
  75. margin-top: 20px;
  76. }
  77. .uni-section-header {
  78. padding: 0 10px !important;
  79. }
  80. .uni-section__content-title {
  81. color: #fff !important;
  82. }
  83. </style>