123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253 |
- <template>
- <view>
-
- <view class="lz-status_bar">
- <view class="lz-top_view"></view>
- </view>
-
-
- <view class="kaoshi-head" v-if="auth != 1">
- <view class="kaoshi-head-top">
- <view class="kaoshi-head-left"></view>
- <view class="kaoshi-head-m">新闻资讯</view>
- <view class="kaoshi-head-right"></view>
- </view>
- </view>
-
- <mescroll-body height="auto" ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback"
- :down="downOption" :up="upOption">
- <view class="news-content" v-if="auth != 1">
- <view class="news-list" v-for="(item,index) in list" :key="index" @tap="gotoDetail(item)">
- <view class="news-flex">
- <image :src="item.image == '' ? '../../static/img/pic.jpg' : item.image" class="news-list-img">
- </image>
- <view class="news-list-r">
- <view class="news-list-title">{{item.title}}</view>
- <view class="news-list-time">{{item.noticetime}}</view>
- </view>
- </view>
- </view>
- </view>
- </mescroll-body>
- </view>
- </template>
- <script>
- import {
- mapState
- } from 'vuex';
- import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js"
- export default {
- mixins: [MescrollMixin],
- data() {
- return {
-
- auth: 1,
-
- mescroll: null,
-
- downOption: {
- use: true,
- auto: false,
- native: false
- },
-
- upOption: {
- page: {
- num: 0,
- size: 20
- },
- noMoreSize: 5,
- empty: {
- tip: '暂无相关数据'
- }
- },
-
- list: [],
- }
- },
- onShow() {
- this.canReset && this.mescroll.resetUpScroll()
- this.canReset = true
- },
- computed: {
- ...mapState(['subject', 'userinfo']),
- },
- onLoad() {
-
- this.getSh()
- wx.showShareMenu({
- withShareTicket: true,
- menus: ["shareAppMessage", "shareTimeline"]
- })
-
- },
- methods: {
- async getSh() {
- let res = await this.$myHttp.get({
- url: this.$myHttp.urlMap.sh,
- data: {},
- needLogin: false,
- })
- if (res.code == 1) {
-
- console.log(res)
- this.auth = res.data.auth
-
- if(this.auth == 1) {
- uni.setNavigationBarTitle({
- title: ''
- })
- }
-
-
- this.auth = 0
-
- }
- },
- gotoDetail(item) {
- if (item.url == '') {
- uni.navigateTo({
- url: '/pages/article/detail?id=' + item.id + '&type=1'
- })
- } else {
- uni.navigateTo({
- url: '/pages/webview/webview?url=' + item.url + '&title=' + item.title
- })
- }
- },
-
- async upCallback(page) {
- let pageNum = page.num;
- let pageSize = page.size;
- let res = await this.$myHttp.post({
- url: this.$myHttp.urlMap.noticeList,
- data: {
-
- subject_id: this.subject.id || this.subList[0].id,
- page: pageNum,
- limit: pageSize,
- cate_id: 2
- },
- needLogin: false
- })
- if (res.code == 1) {
-
- let curPageData = res.data.data;
-
- let curPageLen = curPageData.length;
-
-
-
- let totalSize = res.data.total;
- this.mescroll.endBySize(curPageLen, totalSize);
- if (page.num == 1) this.list = [];
- this.list = this.list.concat(curPageData);
- } else {
- this.mescroll.endErr()
- }
-
-
- },
- }
- }
- </script>
- <style>
- page {
- background-color: #f6f6f6;
- }
- .news-content {
- width: 98%;
- margin: 0 auto 25px;
- }
- .news-title {
- display: flex;
- align-items: center;
- margin: 15px 0 13px;
- font-size: 18px;
- font-weight: bold;
- justify-content: space-between;
- }
- .news-title .iconfont {
- font-size: 15px;
- margin-left: 8px;
- color: #bbb;
- }
- .news-flex {
- display: flex;
- align-items: flex-start;
- }
- .news-list-img {
- width: 66px;
- height: 66px;
- border: solid 1px #f1f1f1;
- border-radius: 6px;
- }
- .news-list-r {
- margin-left: 10px;
- flex: 1;
- height: 66px;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- }
- .news-list-title {
- font-size: 16px;
- line-height: 21px;
- padding-top: 4px;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 2;
- -webkit-box-orient: vertical;
- display: -moz-box;
- -moz-line-clamp: 2;
- -moz-box-orient: vertical;
- overflow-wrap: break-word;
- word-break: break-all;
- white-space: normal;
- overflow: hidden;
- }
- .news-list-time {
- display: flex;
- flex-direction: column;
- align-items: flex-start;
- color: #999;
- font-size: 13px;
- }
- .news-list-flex {
- display: flex;
- align-items: center;
- margin-top: 3px;
- }
- .swiper {
- height: 160px !important;
- }
- .news-list {
- background: #fff;
- padding: 11px 13px;
- margin: 14px 8px;
- border-radius: 10px;
- box-shadow: 2px 4px 10px rgb(0 0 0 / 8%);
- }
- .news-content .news-list:last-child {
- margin-bottom: 0;
- border-bottom: none
- }
- </style>
|