butler.vue 1.7 KB

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