123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281 |
- <!-- 商城宣传页,列表页 -->
- <template>
- <view class="page-body" style="background: #f6f6f6;">
-
- <!-- <video src="https://jvod.300hu.com/vod/product/4c17d312-2039-4668-8460-fd71540fb465/f0db5965187f4178bb7ed745bbff143c.mp4?info=50793-1054733-h264-aac" controls="true"></video>
- <video src="http://192.168.3.158:80/static/firstIndex/f0db5965187f4178bb7ed745bbff143c.mp4"></video>
- <video control s src="https://zxpt.newfeifan.cn/admin-api/infra/file/23/get/03488f68d9c9269a3eac373ab5309d574ffdd67e6882ec8a2f86f9b4766c91e7.mp4"></video>-->
- <s-empty v-if="state.pagination.total === 0" icon="/static/data-empty.png" :text="t('common.no_data')" />
- <view v-if="state.pagination.total > 0 && type == 'activityCard'">
- <view class="article ss-r-10" v-for="item in state.pagination.list" @click="sheep.$router.go('/pages/public/richtext', {title:item.title});">
- <view class="title" >
- {{item.title}}
- </view>
- <view class="content">
- <view class="image " v-if="item.picUrl.trim()">
- <image :src="item.picUrl" mode="aspectFit" class="image-content"></image>
- </view>
- <view class="desc" >
- {{item.introduction}}
- </view>
- </view>
- </view>
- </view>
- <view v-if="state.pagination.total > 0 && type == 'articleCard'">
- <view class="activity ss-r-10" v-for="item in state.pagination.list" :style="{ backgroundImage: `url(${item.picUrl})` }" @click="sheep.$router.go('/pages/public/richtext', {title:item.title});">
- <view class="activity-bottom">
- <text>{{item.title}}</text>
- <view class=""><image src="@/static/firstIndex/youjiantou.png" mode="aspectFit" /></view>
- </view>
-
- </view>
- </view>
- <uni-load-more v-if="state.pagination.total > 0" :status="state.loadStatus" :content-text="{ contentdown: '上拉加载更多'}" @tap="loadmore" />
-
- <s-tabbar path="/pages/index/FirstIndex" :tabbar="tabbar" />
- </view>
- </template>
- <script setup>
- import {
- computed,
- ref,
- reactive
- } from 'vue';
- import {
- onLoad,
- onShow,
- onReachBottom,
- onPullDownRefresh
- } from '@dcloudio/uni-app';
- import sheep from '@/sheep';
- import $share from '@/sheep/platform/share';
- import _ from 'lodash';
- import {
- isAndroid,
- getAndroidJiGuangId
- } from '@/sheep/hooks/useApp'
- import {
- showWalletModal,
- colseWalletModal
- } from '@/sheep/hooks/useModal';
- import { t } from '@/locale'
- import ArticleApi from '@/sheep/api/promotion/article';
- // 隐藏原生tabBar
- uni.hideTabBar();
- const appInfo = computed(() => sheep.$store('app').info);
- const {
- safeArea
- } = sheep.$platform.device;
- const pageHeight = computed(() => safeArea.height - 45);
- const props = defineProps({
- // 是否显示tabbar
- tabbar: {
- type: Boolean,
- default: true
- },
- // 是否显示tabbar
- categoryId: {
- type: Number,
- default: 0
- },
- type:{
- type:String,
- default:'articleCard'
- }
- });
-
- const tabbar = ref({
- "theme": "red",
- "style": {
- "bgType": "color",
- "bgColor": "#323b4e",
- "color": "#e6e6e5",
- "activeColor": "#1fa380"
- },
- "items": [{
- "text": t('common.home'),
- "url": "/pages/index/FirstIndex",
- "iconUrl": sheep.$url.static('/static/firstIndex/index.svg'),
- "activeIconUrl": sheep.$url.static('/static/firstIndex/index-active.svg')
- },
- {
- "text": t('common.activities'),
- "url": "/pages/index/FirstActivity",
- "iconUrl": sheep.$url.static('/static/firstIndex/activity.svg'),
- "activeIconUrl": sheep.$url.static('/static/firstIndex/activity-active.svg')
- },
- {
- "text": t('common.videos'),
- "url": "/pages/index/FirstVideo",
- "iconUrl": sheep.$url.static('/static/firstIndex/video.svg'),
- "activeIconUrl": sheep.$url.static('/static/firstIndex/video-active.svg')
- },
- {
- "text": t('common.mall'),
- "url": "/pages/index/index",
- "iconUrl": sheep.$url.static('/static/firstIndex/shop.svg'),
- "activeIconUrl": sheep.$url.static('/static/firstIndex/shop-active.svg')
- }
- ]
- });
-
- // 数据
- const state = reactive({
- categoryId: 0,
- pagination: {
- list: [],
- current_page: 1,
- total: 1,
- last_page: 1,
- },
- loadStatus: ''
- });
- async function getArticleList(page = 1, list_rows = 5) {
- state.loadStatus = 'loading';
- let { code, data } = await ArticleApi.getArticleByCategory({pageNo: page,pageSize: list_rows,categoryId: state.categoryId});
- if (code !== 0) {
- return;
- }
- let articleList = _.concat(state.pagination.list, data.list);
- state.pagination.list = articleList
- state.pagination.total = data.total;
- state.pagination.last_page = Math.ceil(data.total / 5)
- if (state.pagination.current_page < state.pagination.last_page) {
- state.loadStatus = 'more';
- } else {
- state.loadStatus = 'noMore';
- }
-
- }
- // 加载更多
- function loadMore() {
- if (state.loadStatus !== 'noMore') {
- state.pagination.current_page += 1
- getArticleList(state.pagination.current_page);
- }
- }
- onLoad(async (option) => {
- if(option && option.categoryId){
- state.categoryId = option.categoryId
- }else{
- state.categoryId = props.categoryId
- }
- await getArticleList();
- });
- // 上拉加载更多
- onReachBottom(() => {
- loadMore();
- });
- // 下拉刷新
- onPullDownRefresh(() => {
- state.pagination.list = []
- state.pagination.current_page = 1
- state.pagination.total = 1
- state.pagination.last_page = 1
- getArticleList();
- setTimeout(function() {
- uni.stopPullDownRefresh();
- }, 800);
- });
- </script>
- <style scoped>
- .page-body {
- width: 100%;
- position: relative;
- z-index: 1;
- flex: 1;
- padding-top:40rpx;
- box-sizing:border-box;
- .article {
- padding:16rpx;
- height: 230rpx;
- position: relative;
- width: 90%;
- margin: 0 auto;
- color:#000;
- margin-bottom: 40rpx;
- background-repeat: no-repeat;
- background-size: 100%;
- background-position: center;
- background-color: #fff;
- overflow: hidden;
- .title {
- font-size: 34rpx;
- /* font-weight: bold; */
- margin-bottom: 8px;
- }
- .content {
- display: flex;
- flex-direction: row;
- }
- .image {
- width: 300rpx;
- height: 169rpx;
- margin-right: 16rpx;
- background-color: #999;
- }
-
- .image-content {
- width: 100%;
- height: 100%;
- border-radius: 8rpx;
- }
-
- .desc {
- flex: 1;
- font-size: 32rpx;
- color: #333;
- line-height: 1.6;
- padding-top: 10rpx;
- overflow: hidden;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 3;
- text-overflow: ellipsis;
- }
- }
-
- .activity {
- height: 300rpx;
- position: relative;
- width: 90%;
- margin: 0 auto;
- color:#fff;
- margin-bottom: 40rpx;
- background-repeat: no-repeat;
- background-size: 100%;
- background-position: center;
- background-color: #fff;
- overflow: hidden;
- .activity-bottom{
- position: absolute;
- bottom: 0;
- left: 0;
- width: 100%;
- height: 50rpx;
- background: rgba(0,0,0,0.5);
- padding:10rpx;
- box-sizing: border-box;
- display: flex;
- align-items: center;
- justify-content: space-between;
-
- text{
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- };
- image{
- width: 20rpx;
- height: 20rpx;
- }
- }
- }
- }
-
- </style>
|