123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435 |
- <template>
- <view class="active">
- <view class="top">
- <u-swiper :list="list1"></u-swiper>
- </view>
- <view class="tab">
- <view v-for="(item,index) in tab_list" :key='index' :class="current_tab==item.id ? 'active-item' : 'item'"
- @click="changTab(item.id)">
- <view class="week">
- {{item.name}}
- </view>
- <text class="line" v-if="current_tab==item.id">
- </text>
- </view>
- </view>
- <view class="search">
- <view class="u-demo-block__content">
- <view class="u-page__tag-item">
- <u-search placeholder="请输入搜索内容" v-model="searchValue" @search="searchActive()"
- @clear="clearActive()" :show-action="false" shape='square'>
- </u-search>
- </view>
- </view>
- <view class="search-button" @click="searchActive()">搜索</view>
- </view>
- <view class="list" v-if="list.length>0">
- <view class="list-item" @click="detail(item.id)" v-for="(item,index) in list" :key='index'>
- <view class="tips" v-if="item.category_id==2">
- <text>已报名人数:</text> <text class="sign-num">{{item.sign_up_count}}/{{item.max_sign_up_count}}</text>
- </view>
- <image :src="item.cover_resource ? item.cover_resource.url : '../../static/images/avator.png'" mode="">
- </image>
- <view class="right">
- <view class="title">
- {{item.title? item.title :'--'}}
- </view>
- <view class="text">
- <text v-if="item.category_id==2"> 活动时间:{{getTime(item.published_at)}}</text>
- </view>
- <view class="time">
- <view class="">
- <u-icon name="clock-fill"></u-icon>{{getTime(item.published_at)}}
- </view>
- <view class="">
- <u-icon name="eye-fill"></u-icon>{{item.view_count? item.view_count :'--'}}
- </view>
- <view class="">
- <u-icon name="account-fill"></u-icon>{{item.admin_name? item.admin_name :'--'}}
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="empty" v-else>
- <image src="../../static/empty.png" mode="widthFix"></image>
- <view class="empty-text">
- 暂无内容
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- list1: [
- 'https://cdn.uviewui.com/uview/swiper/swiper1.png',
- 'https://cdn.uviewui.com/uview/swiper/swiper2.png',
- 'https://cdn.uviewui.com/uview/swiper/swiper3.png',
- ],
- // 轮播图
- // list1: [{
- // image: '../../static/images/stu_nan.png',
- // },
- // {
- // image: '../../static/images/stu_nv.png',
- // },
- // ],
- current_tab: 0,
- tab_list: ['学术前沿', '自主活动'],
- list: [],
- page: 1,
- last: false,
- value5: '',
- searchValue: '', //搜索
- }
- },
- onShow() {
- // this.getList()
- },
- async onLoad() {
- if (this.is_weixin()) {
- this.navTitle()
- }
- await this.getTabList()
- this.page = 1
- this.list = []
- this.last = false
- // await this.getList()
- this.get_banner()
- },
- onReachBottom() {
- if (!this.last) {
- this.page++
- }
- console.log(this.page)
- this.getList()
- },
- methods: {
- //获取轮播图
- //获取轮播图
- get_banner() {
- this.list1=[]
- this.$u.get('/base/banner',{position:'information'}).then(res => {
- let banner=res.data.list
- banner.map(item=>{
- this.list1.push(item.cover_resource.url)
- })
- console.log(res, '轮播图')
- })
- },
- // change() {},
- //截取时间
- getTime(time) {
- if (!time) return '--'
- else return time.split(' ')[0]
- },
- //判断是否是微信
- is_weixin() {
- let ua = navigator.userAgent.toLowerCase();
- return ua.indexOf('micromessenger') != -1;
- },
- navTitle() {
- let navTitle = document.getElementsByTagName('uni-page-head');
- navTitle[0].style.display = 'none'
- },
- //选择本周还是下周
- changTab(id) {
- this.list = []
- this.current_tab = id
- this.page = 1
- this.last = false
- this.getList()
- },
- getTabList() {
- this.$u.get('/inform/category-user-tree', {
- type: 1
- }).then(res => {
- console.log(res, 'pp')
- this.tab_list = res.data
- this.current_tab = res.data[0].id
- this.getList()
- })
- },
- getList() {
- this.$u.get('/inform/information', {
- category_id: this.current_tab,
- title: this.searchValue,
- page: this.page,
- per_page: 15
- }).then(res => {
- console.log(res, 'ppp')
- let data = res.data.list
- console.log(res, 'course1')
- if (this.page > 1 && data.length == 0) {
- uni.showToast({
- title: '暂无更多',
- icon: 'none'
- })
- this.last = true
- } else {
- this.list = this.list.concat(data)
- }
- })
- },
- detail(id) {
- console.log('详情')
- uni.navigateTo({
- url: './details?id=' + id
- })
- },
- //点击搜索
- searchActive() {
- this.list = []
- this.page = 1
- this.last = false
- console.log(this.searchValue, '用户点击了搜索')
- this.getList()
- },
- //清空搜索框
- clearActive() {
- this.list = []
- this.page = 1
- this.last = false
- this.getList()
- console.log(this.searchValue, '用户点击了搜索---')
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- page {
- position: relative;
- background-color: #F7F7F7;
- }
- .add {
- position: fixed;
- bottom: 75px;
- right: 15px;
- text-align: center;
- z-index: 6;
- .add-buttom {
- width: 36px;
- height: 36px;
- background: #6A6A6A;
- display: inline-block;
- text-align: center;
- line-height: 36px;
- opacity: 1;
- border-radius: 50%;
- }
- .add-tips {
- font-size: 10px;
- font-family: PingFang SC;
- font-weight: bold;
- line-height: 14px;
- color: #292929;
- opacity: 1;
- margin-top: 3px;
- }
- }
- .search {
- background-color: #FFFFFF;
- padding: 8px 15px;
- margin-top: 6px;
- display: flex;
- justify-items: center;
- justify-content: center;
- align-items: center;
- .search-button {
- padding: 0 10px;
- color: #138E57;
- font-size: 15px;
- text-align: center;
- }
- .u-demo-block__content {
- flex: 1;
- }
- ::v-deep {
- .u-action {
- color: #138E57 !important;
- }
- }
- }
- .active {
- position: relative;
- overflow: hidden;
- height: 100%;
- .top {
- padding: 15px 15px 0;
- // background-size: 100%;
- // background-repeat: no-repeat;
- }
- .tab {
- display: flex;
- align-items: center;
- width: 80%;
- margin: 0 auto;
- .item,
- .active-item {
- margin-top: 17px;
- view {
- display: block;
- }
- font-size: 16px;
- font-family: PingFang SC;
- font-weight: bold;
- line-height: 20px;
- color: rgba(113, 113, 113, .43);
- opacity: 0.43;
- opacity: 1;
- flex: 1;
- text-align: center;
- .week {
- padding-bottom: 12px;
- }
- .line {
- width: 11px;
- height: 4px;
- background: #3B7653;
- opacity: 1;
- border-radius: 2px;
- display: block;
- margin: 0 auto;
- }
- }
- .active-item {
- font-size: 18px;
- font-family: PingFang SC;
- font-weight: bold;
- line-height: 20px;
- color: #3B7653;
- .week {
- padding-bottom: 8px;
- }
- }
- }
- .list {
- padding: 15px;
- .list-item {
- background: #FFFFFF;
- opacity: 1;
- border-radius: 4px;
- padding: 16px 15px;
- position: relative;
- display: flex;
- align-items: center;
- margin-bottom: 10px;
- overflow: hidden;
- .tips {
- position: absolute;
- // width: 52px;
- display: inline-block;
- padding: 0 7px;
- text-align: center;
- background: #FFAA1D;
- top: 0;
- right: 0;
- opacity: 1;
- border-radius: 0px 4px 0px 4px;
- font-size: 8px;
- color: #fff;
- .sign-num {
- font-size: 12px;
- font-weight: 600;
- }
- }
- image {
- flex: 0 0 60px;
- width: 60px;
- height: 60px;
- margin-right: 6px;
- }
- .right {
- flex: 1;
- padding-left: 5px;
- width: calc(100% - 170px);
- view {
- height: 19px;
- line-height: 19px;
- }
- .title {
- width: 220px;
- font-size: 14px;
- font-family: PingFang SC;
- color: #0C0C0C;
- opacity: 1;
- white-space: nowrap;
- /*设置不换行*/
- overflow: hidden;
- /*设置隐藏*/
- text-overflow: ellipsis;
- /*设置隐藏部分为省略号*/
- }
- .text {
- font-size: 12px;
- font-family: PingFang SC;
- font-weight: 400;
- color: #666666;
- margin-top: 3px;
- width: 230px;
- white-space: nowrap;
- /*设置不换行*/
- overflow: hidden;
- /*设置隐藏*/
- text-overflow: ellipsis;
- /*设置隐藏部分为省略号*/
- }
- .time {
- display: flex;
-
-
- font-size: 10px;
- color: #858585;
- align-items: center;
- view:nth-child(2) {
- padding: 0 16px;
- }
- }
- }
- }
- }
- }
- </style>
|