12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <template>
- <view class="container" :style="{ backgroundImage: `url(${hgjbj})` }">
- <uni-section v-for="item in dataList" titleFontSize="16px" class="sectionBox" :title="item.name" type="line">
- <view class="box">
- <view class="imgBox" v-for="(i, index) in item.data" :key="index" @click="btn(i)">
- <image class="imgs" mode="scaleToFill" :src="filesUrl + i.blogPic"></image>
- <text class="name">{{ i.title }}</text>
- <text class="name">{{ i.blogDesc }}</text>
- </view>
- </view>
- </uni-section>
- </view>
- </template>
- <script>
- import request from '../../api/cms.js';
- import { BASE_URL } from '../../env.js';
- import requestLogin from '../../api/login.js';
- export default {
- data() {
- return {
- filesUrl: BASE_URL.fileUrl,
- dataList: [],
- hgjbj: ''
- }
- },
- onShow: function() {},
- async mounted() {
- const config = await requestLogin.getJson();
- const { hgjbj } = config.data;
- this.hgjbj = hgjbj;
- const res = await request.getsublist({ alias: 'hgjfc' });
- this.dataList = await Promise.all(res.data.map(async e => {
- const aliasData = await request.getArticleList({ pageNum: 1, pageSize: 100, typeName: e.alias });
- return { name: e.typeName, alias: e.alias, data: aliasData.rows };
- }))
- },
- methods: {
- btn(e) {
- // uni.navigateTo({ url: `/pages/details/index?id=${e.id}` })
- }
- }
- }
- </script>
- <style>
- .container {
- width: 100%;
- height: 100vh;
- overflow-y: auto;
- background-size: 100% 100%;
- }
- .box {
- display: flex;
- flex-wrap: wrap;
- }
- .imgBox {
- width: 30%;
- height: 36vw;
- margin-left: 2.5%;
- margin-top: 5px;
- }
- .imgs {
- display: block;
- width: 100%;
- height: 90%;
- border: 2px solid #CD7F32;
- }
- .name {
- width: 100%;
- display: block;
- text-align: center;
- color: #fff;
- }
- .uni-section {
- background-color: transparent !important;
- margin-top: 20px;
- }
- .uni-section-header {
- padding: 0 10px !important;
- }
- .uni-section__content-title {
- color: #fff !important;
- }
- </style>
|