This commit is contained in:
张文涛 2024-10-22 22:55:08 +08:00
parent 1e581dda5f
commit 2572f8273f
12 changed files with 547 additions and 464 deletions

View File

@ -142,7 +142,7 @@
{ // //
"path": "pages/news/news-topic-cate",
"style": {
"navigationBarTitleText": "话题分类",
"navigationBarTitleText": "分类",
"app-plus": {
"bounce": "none"
}
@ -373,13 +373,13 @@
"iconWidth": "24px",
"list": [{
"pagePath": "pages/home/home",
"text": "招聘",
"text": "首页",
"iconPath": "/static/img/tabbar/home.png",
"selectedIconPath": "/static/img/tabbar/home-ed.png"
},
{
"pagePath": "pages/news/news",
"text": "培训",
"text": "课程",
"iconPath": "/static/img/tabbar/news.png",
"selectedIconPath": "/static/img/tabbar/news-ed.png"
},

View File

@ -35,7 +35,8 @@
<slot>
<view class="relative flex flex-row justify-center items-center">
<!-- 图片 -->
<image class="w-full rounded-20" :src="info.coverPic" mode="widthFix" lazy-load @click="goDetail()">
<image class="rounded-20" style="width: 100%; height: 300rpx !important;" :src="info.coverPic"
mode="aspectFill" lazy-load @click="goDetail()">
</image>
<template v-if="info.type === 'video'">
<!-- 视频 -->
@ -47,7 +48,7 @@
</view>
</slot>
<!-- 点赞评论 -->
<view class="flex flex-row justify-between items-center text-gray-500 my-10">
<!-- <view class="flex flex-row justify-between items-center text-gray-500 my-10">
<view class="flex flex-row justify-center items-center">
<view class="flex flex-row justify-center items-center mr-20" @click.stop="handleMark('smile')">
<view class="iconfont mr-10 text-36" :class="[handleIcon('smile',info.infoNum)]"></view>
@ -68,7 +69,7 @@
{{info.shareNum}}
</view>
</view>
</view>
</view> -->
</view>
</template>
@ -153,7 +154,23 @@
goDetail() {
if (this.isDetail) return //
this.$u.route('pages/home/detail', {
data: JSON.stringify(this.info)
data: JSON.stringify({
age: 30,
commentNum: 388,
coverPic: "/static/img/list/01.jpg",
infoNum: {
cryNum: 2,
index: 0,
smileNum: 13
},
isFollow: false,
sex: 1,
shareNum: 32,
title: "做一件有价值的事情,坚持下去等待时间的回报吧!",
type: "img",
userPic: "/static/img/header/a.svg",
username: "芒种"
})
})
}
}

View File

@ -12,13 +12,12 @@
@click="handlePreview(index)"></image>
</view>
</info-list>
<u-gap height="20" bgColor="#F9FAFB"></u-gap>
<!-- <u-gap height="20" bgColor="#F9FAFB"></u-gap>
<view class="p-20 text-30 font-bold">
最新评论<text class="ml-10">3</text>
</view>
</view> -->
<!-- 评论列表 -->
<view class="comment">
<!-- 头像 -->
<!-- <view class="comment">
<image class="rounded-full mr-20" src="../../static/img/header/a.svg" mode="aspectFill"
style="width: 100rpx;height: 100rpx;"></image>
<view class="flex-1 flex flex-col">
@ -40,13 +39,13 @@
</view>
</view>
</view>
</view>
</view> -->
<!-- 分享功能 -->
<popup-share :show.sync="showShare"></popup-share>
<!-- 底部操作栏 -->
<view class="bottom-input">
<!-- <view class="bottom-input">
</view>
<bottom-input v-if="showComment" @submit="submit"></bottom-input>
<bottom-input v-if="showComment" @submit="submit"></bottom-input> -->
</view>
</template>
@ -67,6 +66,7 @@
}
},
onLoad(e) {
console.log(e);
e.data && this.init(JSON.parse(e.data))
},
//
@ -179,4 +179,4 @@
height: 100rpx;
}
}
</style>
</style>

View File

@ -1,242 +1,250 @@
<template>
<!-- 首页 -->
<view class="home">
<!-- 小程序导航栏 -->
<!-- 新鲜事页 -->
<view class="news">
<!-- 导航栏 -->
<!-- <u-navbar placeholder>
<view slot="left"></view>
<view slot="center" class="nav-center">
<view :class="{'active':tabIndex === index}" @click="changeTab(index)" v-for="(item,index) in tabList"
:key="index">
<view class="nav-title">{{item.name}}</view>
<view class="active-line"></view>
</view>
</view>
</u-navbar> -->
<!-- #ifdef MP-WEIXIN -->
<u-navbar placeholder>
<view slot="left" @click="btn" class="iconfont iconqiandao" style="visibility: hidden;"></view>
<view slot="center" class="nav-center">
<u-search placeholder="搜索新鲜事" @click="handleSearch()" :showAction="false" disabled></u-search>
<u-search placeholder="搜索新鲜事" @click="goSearch()" :showAction="false" disabled></u-search>
</view>
<!-- <view slot="right" class="iconfont iconPensyumaobi" @click="handlePublish()"></view> -->
</u-navbar>
<!-- #endif -->
<!-- 标签 -->
<u-sticky bgColor="#fff">
<u-tabs class="wrap-card" ref="tabs" @change="changeTab" :list="tablist" :current="tabIndex"
lineColor="#3c9cff" :activeStyle="{color:'#3c9cff'}" :inactiveStyle="{color:'#909399'}" lineWidth="30"
:scrollable="false">
</u-tabs>
</u-sticky>
<!-- 列表 -->
<swiper class="flex-1" :current="swiperIndex" @animationfinish="animationfinish">
<swiper-item class="h-full" v-for="(item, index) in swiperList" :key="index">
<scroll-view :ref="'scrollView'+index" :scroll-top="scrollTops[tabIndex]" class="w-full h-full" scroll-y
@scrolltolower="reachBottom" @scroll="scroll">
<!-- 有内容 -->
<template v-if="item.list.length > 0">
<!-- 资讯列表 -->
<info-list :item="item1" v-for="(item1,index1) in item.list" :key="index1" :index="index1"
@mark="handleMark" @follow="handleFollow">
</info-list>
<u-loadmore :status="loadStatus[tabIndex]"></u-loadmore>
</template>
<!-- 无内容 -->
<template v-else>
<u-empty text="本来无一物,何处惹尘埃" icon="/static/img/demo/winter.png" textSize="16" marginTop='25%'
mode="list"></u-empty>
</template>
<!-- 信息列表 -->
<swiper class="bg-white px-20 py-20" :style="{height:swiperHeight + 'px'}" :current="tabIndex"
@change="changeSwiper">
<!-- <swiper-item>
<scroll-view scroll-y class="flow h-full" @scrolltolower="reachBottom">
<info-list v-for="(item,index) in followList.list" :key="index" :item="item">
</info-list>
<u-loadmore :status="followList.loadStatus"></u-loadmore>
</scroll-view>
</swiper-item> -->
<!-- 话题 -->
<swiper-item>
<scroll-view scroll-y class="topic h-full">
<!-- 搜索框 -->
<!-- <view class="search-input" @click="goSearch">
<u-input type="text" placeholder="请输入搜索内容"
placeholderClass="iconfont iconsousuo text-28" border="none" inputAlign="center" clearable
confirmType="search" disabled>
</u-input>
</view> -->
<!-- 轮播图 -->
<u-swiper :list="topicList.swiper" keyName="image" indicator indicatorMode="line" circular
height="320rpx" bgColor="#ffffff"></u-swiper>
<news-topic-nav title="招聘公告" url=""></news-topic-nav>
<view class="last-update">
<topic-list v-if='index<=2' :item="item" v-for="(item,index) in topicList.list"
:key="index"></topic-list>
</view>
<news-topic-nav title="技能培训" url=""></news-topic-nav>
<view class="last-update">
<topic-list v-if='index<=2' :item="item" v-for="(item,index) in topicList.list"
:key="index"></topic-list>
</view>
</scroll-view>
</swiper-item>
</swiper>
<!-- 回到顶部 -->
<view v-if="scrollTop[tabIndex] > 400" class="go-top" @click="goTop">
<u-icon color="#3c9cff" name="arrow-up" size="24"></u-icon>
</view>
</view>
</template>
<script>
import {
newsList
newsList,
topicList
} from "@/utils/data/data.js"
import {
register
} from '@/api/login.js'
import InfoList from "@/pages/home/cpns/info-list.vue"
import NewsTopicNav from "@/pages/news/cpns/news-topic-nav.vue"
import TopicList from "@/pages/news/cpns/topic-list.vue"
export default {
components: {
InfoList
InfoList,
NewsTopicNav,
TopicList
},
data() {
return {
scrollTops: [0, 0, 0, 0, 0, 0],
scrollTop: [0, 0, 0, 0, 0, 0],
// // loadmore/ loading / nomore
loadStatus: ['loadmore', 'loadmore', 'loadmore', 'loadmore', 'loadmore', 'loadmore'],
//
tabIndex: 0,
tablist: [{
name: "关注"
//
tabIndex: 1,
tabList: [{
name: "关注",
id: 'follow'
},
{
name: "谷雨"
},
{
name: "芒种"
},
{
name: "小满",
},
{
name: "霜降"
},
{
name: "寒露"
name: "话题",
id: 'topic'
}
],
//
swiperIndex: 0,
swiperList: newsList
swiperHeight: 0,
//
followList: {
//
loadStatus: 'loadmore',
//
list: newsList[0].list
},
//
topicList: {
swiper: [ //
{
image: '/static/img/demo/winter.png',
title: '迷人的春天是令人欢欣鼓舞的。'
},
{
image: '/static/img/demo/winter.png',
title: '一道残阳铺水中,半江瑟瑟半江红。'
},
{
image: '/static/img/demo/winter.png',
title: '金秋的阳光温馨恬静,金秋的微风和煦轻柔。'
},
{
image: '/static/img/demo/winter.png',
title: '风吹过,寒气直侵入骨头。'
}
],
list: topicList[1].list
}
}
},
//
onNavigationBarSearchInputClicked() {
this.handleSearch()
},
//
onNavigationBarButtonTap(e) {
switch (e.index) {
case 1:
this.handlePublish()
break;
}
onLoad() {
// swiperHeight
uni.getSystemInfo({
success: (res) => {
// screenHeight) = (statusBarHeight) + (44px) + 使(windowHeight)
// 使 = swiper +
this.swiperHeight = res.windowHeight - 44
}
})
},
methods: {
btn() {
uni.login({
success: (res) => {
console.log(res);
}
})
// tabbar
changeTab(index) {
this.tabIndex = index
},
//
handlePublish() {
this.$u.route('/pages/home/release')
},
//
handleSearch() {
this.$u.route('/pages/home/search', {
type: 'info'
})
},
// tab
changeTab(item) {
this.tabIndex = item.index
this.swiperIndex = item.index
},
// swipertabsswiper
animationfinish(e) {
// swiper
changeSwiper(e) {
this.tabIndex = e.detail.current
this.swiperIndex = e.detail.current
},
// scroll-view
// scroll-view
reachBottom() {
//
if (this.loadStatus[this.tabIndex] !== 'loadmore') return
//
this.loadStatus.splice(this.tabIndex, 1, "loading")
if (this.followList.loadStatus !== 'loadmore') return;
//
this.followList.loadStatus = "loading"
setTimeout(() => {
this.getList(this.tabIndex)
this.getList()
}, 1000);
},
//
getList(index) {
getList(idx) {
// 5
for (let i = 0; i < 5; i++) {
let curr = this.$u.random(0, this.swiperList[index].list.length - 1)
let data = this.swiperList[index].list[curr]
this.swiperList[index].list.push(data)
let index = this.$u.random(0, this.followList.list.length - 1)
let data = JSON.parse(JSON.stringify(this.followList.list[index]))
this.followList.list.push(data)
}
//
this.loadStatus.splice(this.tabIndex, 1, "nomore")
//
this.followList.loadStatus = "nomore"
},
//
scroll(e) {
const index = this.tabIndex
this.scrollTop.splice(index, 1, e.detail.scrollTop) // 400
},
//
goTop() {
const index = this.tabIndex
// view
this.scrollTops.splice(index, 1, this.scrollTop[index])
this.$nextTick(function() {
this.scrollTops.splice(index, 1, 0)
this.scrollTop.splice(index, 1, 0)
//
goSearch() {
this.$u.route('/pages/home/search', {
type: 'topic'
})
},
//
handleFollow(item) {
this.swiperList[this.swiperIndex].list[item.index].isFollow = item.value
const title = item.value ? '关注成功' : '取消成功'
uni.showToast({
title,
icon: 'none',
})
},
//
handleMark(item) {
let infoNum = this.swiperList[this.swiperIndex].list[item.index].infoNum
switch (item.value) {
case 'smile':
if (infoNum.index == 1) return //
else if (infoNum.index == 2) infoNum.cryNum--
infoNum.index = 1
infoNum.smileNum++
break;
case 'cry':
if (infoNum.index == 2) return //
else if (infoNum.index == 1) infoNum.smileNum--
infoNum.index = 2
infoNum.cryNum++
break
}
const title = item.value === 'smile' ? '谢谢表扬' : '继续加油'
uni.showToast({
title,
icon: 'none',
})
},
}
}
}
</script>
<style lang="scss" scoped>
.home {
display: flex;
flex-direction: column;
height: calc(100vh - var(--window-top) - var(--window-bottom)); // - -
width: 100%;
.news {
//
/* #ifdef MP-WEIXIN */
//
/deep/ .u-navbar {
.iconfont {
font-size: 48rpx;
color: $uni-color-green;
}
.nav-center {
text-align: center;
display: flex;
justify-content: center;
align-items: center;
.nav-title {
width: 60rpx;
font-size: 30rpx;
padding: 0 15rpx;
font-weight: bold;
color: $uni-text-color-gray;
}
.active {
position: relative;
display: flex;
justify-content: center;
align-items: center;
.nav-title {
color: $uni-color-green;
}
.active-line {
border-bottom: 8rpx solid $uni-color-green;
border-radius: 20rpx;
width: 70rpx;
position: absolute;
bottom: -10rpx;
left: 50%;
margin-left: -35rpx;
}
}
}
.u-navbar__content {
margin-right: 180rpx !important; //
padding-right: 180rpx !important; //
}
}
/* #endif */
.topic {
.search-input {
margin-top: 20rpx;
margin-bottom: 20rpx;
height: 70rpx;
background-color: #F4F4F4;
border-radius: 10rpx;
/deep/ .u-input {
height: 100%;
}
}
.last-update {
padding: 0 20rpx 20rpx;
.last-update-name {
font-size: 32rpx;
padding-bottom: 5rpx;
}
}
//
.go-top {
position: fixed;
right: 30rpx;
bottom: 100rpx;
height: 80rpx;
width: 80rpx;
background: #ffffff;
display: flex;
justify-content: center;
align-items: center;
border-radius: 100%;
}
}
</style>

View File

@ -6,15 +6,15 @@
<!-- 头像栏 -->
<view class="flex items-center wrap-card" hover-class="bg-gray-100" @click="$u.route('/pages/mine/set')">
<image class="header-img" src="/static/img/header/a.svg" mode=""
@click.stop="$u.route('/pages/mine/user-space')"></image>
@click.stop="$u.route('/pages/mine/set')"></image>
<view class="flex flex-col flex-1 px-20">
<text class="text-32 font-bold">MrThinco</text>
<text class="text-28 text-gray-500 mt-10">总帖子&nbsp;38&nbsp;&nbsp;今日发帖&nbsp;2</text>
<text class="text-28 text-gray-500 mt-10">17729744485</text>
</view>
<text class="iconfont iconqianjin"></text>
</view>
<!-- 统计栏 -->
<view class="wrap-card flex items-center">
<!-- <view class="wrap-card flex items-center">
<view v-for="(item,index) in countList" :key="index"
class="flex-1 flex flex-col items-center justify-center">
<view class="text-32 font-bold">
@ -24,7 +24,7 @@
{{item.name}}
</view>
</view>
</view>
</view> -->
<!-- 广告位 -->
<view class="wrap-card">
<image class="adv-img rounded-20" src="../../static/img/list/01.jpg" mode="aspectFill"></image>
@ -63,23 +63,23 @@
],
//
setList: [
{
icon: 'iconhuiyuan',
name: '个人空间',
url: 'user-space'
},
// {
// icon: 'iconhuiyuan',
// name: '',
// url: 'user-space'
// },
{
icon: 'iconliulan',
name: '浏览历史'
},
{
icon: 'iconrenzheng',
name: '社区认证'
},
{
icon: 'iconshenhe',
name: '审核帖子'
},
// {
// icon: 'iconrenzheng',
// name: ''
// },
// {
// icon: 'iconshenhe',
// name: ''
// },
// #ifdef MP-WEIXIN
{
icon: 'iconshezhi1',

View File

@ -7,18 +7,18 @@
</u-cell>
</u-cell-group>
<!-- 底部操作 -->
<view class="wrap-bottom-bar">
<!-- <view class="wrap-bottom-bar">
<view class="bar-placeholder"></view>
<view class="bar-content">
<u-button :customStyle="btnStyle" :ripple="true" shape="circle" @click="goPage('logout')">退出</u-button>
</view>
</view>
</view> -->
<!-- 退出 -->
<u-modal title="提示" @cancel="logoutShow=false" showCancelButton :show="logoutShow" @confirm="logout"
ref="uModal" :asyncClose="true" content="您是否确定要,退出登录?"></u-modal>
<!-- <u-modal title="提示" @cancel="logoutShow=false" showCancelButton :show="logoutShow" @confirm="logout"
ref="uModal" :asyncClose="true" content="您是否确定要,退出登录?"></u-modal> -->
<!-- 注销 -->
<u-modal title="提示" @cancel="cancleShow=false" showCancelButton :show="cancleShow" @confirm="cancleShow=false"
ref="uModal" :asyncClose="true" content="您是否确定要,注销账号?"></u-modal>
<!-- <u-modal title="提示" @cancel="cancleShow=false" showCancelButton :show="cancleShow" @confirm="cancleShow=false"
ref="uModal" :asyncClose="true" content="您是否确定要,注销账号?"></u-modal> -->
</view>
</template>
@ -29,34 +29,36 @@
logoutShow: false,
cancleShow: false,
//
setList: [{
name: '账号与安全',
url: 'edit-pwd'
},
{
name: '绑定邮箱',
url: 'bind-email'
},
setList: [
// {
// name: '',
// url: 'edit-pwd'
// },
// {
// name: '',
// url: 'bind-email'
// },
{
name: '修改资料',
url: 'edit-info'
},
{
name: '清除缓存',
url: 'clear'
},
{
name: '意见反馈',
url: 'feedback'
},
{
name: '关于社区',
url: 'about'
},
{
name: '注销账号',
url: 'cancle'
}
// ,
// {
// name: '',
// url: 'clear'
// },
// {
// name: '',
// url: 'feedback'
// },
// {
// name: '',
// url: 'about'
// },
// {
// name: '',
// url: 'cancle'
// }
],
//
btnStyle: {

View File

@ -1,8 +1,8 @@
<template>
<view class="hot-nav">
<view class="flex justify-between column-one">
<view class="">热门分类</view>
<view class="flex justify-between items-center" @click="goTopicNav()">
<view class="">{{title}}</view>
<view class="flex justify-between items-center nav" @click="goTopicNav()">
更多<view class="iconfont iconqianjin"></view>
</view>
</view>
@ -20,17 +20,20 @@
* @property {Array} list 列表信息
*/
export default {
props:{
list: Array
props: {
list: Array,
title: "",
url: ''
},
data() {
return {
};
},
methods: {
//
goTopicNav() {
//
this.$u.route('/pages/news/news-topic-cate');
}
}
@ -38,27 +41,34 @@
</script>
<style lang="scss" scoped>
.hot-nav {
// border-top: 1rpx solid #EEEEEE;
border-bottom: 1rpx solid #EEEEEE;
padding: 20rpx 20rpx 0 20rpx;
margin-top: 10rpx;
.column-one {
margin-bottom: 20rpx;
& > view:last-child {
.hot-nav {
// border-top: 1rpx solid #EEEEEE;
border-bottom: 1rpx solid #EEEEEE;
padding: 20rpx 20rpx 0 20rpx;
margin-top: 10rpx;
.column-one {
margin-bottom: 20rpx;
&>view:last-child {
color: #9b9b9b;
}
&>view:first-child {
font-size: 32rpx;
}
}
.column-two>view {
text-align: center;
flex: 1;
background: #f9f9f9;
color: #9b9b9b;
}
& > view:first-child {
font-size: 32rpx;
border-radius: 10rpx;
margin: 0 10rpx;
}
}
.column-two > view {
text-align: center;
flex: 1;
background: #f9f9f9;
color: #9b9b9b;
border-radius: 10rpx;
margin: 0 10rpx;
.nav{
font-size: 28rpx;
}
}
</style>
</style>

View File

@ -1,12 +1,12 @@
<template>
<!-- 新鲜事/话题列表 -->
<view class="topic-list flex items-center" @click="goTopicDetail(item)">
<image style="width: 200rpx; height: 140rpx;" :src="item.img" lazy-load mode="aspectFill"></image>
<image style="width: 200rpx; height: 140rpx;" :src="item.img" lazy-load mode="aspectFill"></image>
<view class="my-20 flex-1">
<view class="text-black text-32">#{{item.title}}#</view>
<view class="text-gray-400 text-26 my-10">{{item.desc}}</view>
<view class="text-gray-400 text-24 my-10 flex w-full">
<view class="w-1-2 text-left">热度{{item.totalNum}}</view>
<view class="w-1-2 text-left">观看量{{item.totalNum}}</view>
<view class="w-1-2 text-left">今日{{item.todayNum}}</view>
</view>
</view>
@ -35,9 +35,28 @@
methods: {
//
goTopicDetail(item) {
this.$u.route({
url: '/pages/news/news-topic-detail',
params: item
// this.$u.route({
// url: '/pages/news/news-topic-detail',
// params: item
// })
this.$u.route('pages/home/detail', {
data: JSON.stringify({
age: 30,
commentNum: 388,
coverPic: "/static/img/list/01.jpg",
infoNum: {
cryNum: 2,
index: 0,
smileNum: 13
},
isFollow: false,
sex: 1,
shareNum: 32,
title: "做一件有价值的事情,坚持下去等待时间的回报吧!",
type: "img",
userPic: "/static/img/header/a.svg",
username: "芒种"
})
})
}
}
@ -53,4 +72,4 @@
margin-right: 20rpx;
}
}
</style>
</style>

View File

@ -4,7 +4,7 @@
<!-- 标签 -->
<u-sticky bgColor="#fff">
<u-tabs class="wrap-card" ref="tabs" @change="changeTab" :list="tablist" :current="tabIndex"
lineColor="#01906c" :activeStyle="{color:'#01906c'}" :inactiveStyle="{color:'#909399'}" lineWidth="30"
lineColor="#3c9cff" :activeStyle="{color:'#3c9cff'}" :inactiveStyle="{color:'#909399'}" lineWidth="30"
:scrollable="false">
</u-tabs>
</u-sticky>

View File

@ -1,248 +1,245 @@
<template>
<!-- 新鲜事页 -->
<view class="news">
<!-- 导航栏 -->
<!-- <u-navbar placeholder>
<view slot="left"></view>
<view slot="center" class="nav-center">
<view :class="{'active':tabIndex === index}" @click="changeTab(index)" v-for="(item,index) in tabList"
:key="index">
<view class="nav-title">{{item.name}}</view>
<view class="active-line"></view>
</view>
</view>
</u-navbar> -->
<!-- 首页 -->
<view class="home">
<!-- 小程序导航栏 -->
<!-- #ifdef MP-WEIXIN -->
<u-navbar placeholder>
<view slot="left" @click="btn" class="iconfont iconqiandao" style="visibility: hidden;"></view>
<view slot="center" class="nav-center">
<u-search placeholder="搜索新鲜事" @click="goSearch()" :showAction="false" disabled></u-search>
<u-search placeholder="搜索新鲜事" @click="handleSearch()" :showAction="false" disabled></u-search>
</view>
<!-- <view slot="right" class="iconfont iconPensyumaobi" @click="handlePublish()"></view> -->
</u-navbar>
<!-- #endif -->
<!-- 信息列表 -->
<swiper class="bg-white px-20 py-20" :style="{height:swiperHeight + 'px'}" :current="tabIndex"
@change="changeSwiper">
<!-- <swiper-item>
<scroll-view scroll-y class="flow h-full" @scrolltolower="reachBottom">
<info-list v-for="(item,index) in followList.list" :key="index" :item="item">
</info-list>
<u-loadmore :status="followList.loadStatus"></u-loadmore>
</scroll-view>
</swiper-item> -->
<!-- 话题 -->
<swiper-item>
<scroll-view scroll-y class="topic h-full">
<!-- 搜索框 -->
<!-- <view class="search-input" @click="goSearch">
<u-input type="text" placeholder="请输入搜索内容"
placeholderClass="iconfont iconsousuo text-28" border="none" inputAlign="center" clearable
confirmType="search" disabled>
</u-input>
</view> -->
<!-- 轮播图 -->
<u-swiper :list="topicList.swiper" keyName="image" indicator indicatorMode="line" circular
height="320rpx" bgColor="#ffffff"></u-swiper>
<!-- 热门分类 -->
<news-topic-nav></news-topic-nav>
<!-- 最近更新 -->
<view class="last-update">
<!-- <view class="last-update-name">最近更新</view> -->
<topic-list v-if='index<=3' :item="item" v-for="(item,index) in topicList.list"
:key="index"></topic-list>
</view>
<!-- 标签 -->
<u-sticky bgColor="#fff">
<u-tabs class="wrap-card" ref="tabs" @change="changeTab" :list="tablist" :current="tabIndex"
lineColor="#3c9cff" :activeStyle="{color:'#3c9cff'}" :inactiveStyle="{color:'#909399'}" lineWidth="30"
:scrollable="false">
<view slot="right" style="padding-right: 4px;" @tap="$u.route('/pages/news/news-topic-cate')">
<u-icon name="list" size="23" bold></u-icon>
</view>
</u-tabs>
</u-sticky>
<!-- 列表 -->
<swiper class="flex-1" :current="swiperIndex" @animationfinish="animationfinish">
<swiper-item class="h-full" v-for="(item, index) in swiperList" :key="index">
<scroll-view :ref="'scrollView'+index" :scroll-top="scrollTops[tabIndex]" class="w-full h-full" scroll-y
@scrolltolower="reachBottom" @scroll="scroll">
<!-- 有内容 -->
<template v-if="item.list.length > 0">
<!-- 资讯列表 -->
<info-list :item="item1" v-for="(item1,index1) in item.list" :key="index1" :index="index1"
@mark="handleMark" @follow="handleFollow">
</info-list>
<u-loadmore :status="loadStatus[tabIndex]"></u-loadmore>
</template>
<!-- 无内容 -->
<template v-else>
<u-empty text="本来无一物,何处惹尘埃" icon="/static/img/demo/winter.png" textSize="16" marginTop='25%'
mode="list"></u-empty>
</template>
</scroll-view>
</swiper-item>
</swiper>
<!-- 回到顶部 -->
<view v-if="scrollTop[tabIndex] > 400" class="go-top" @click="goTop">
<u-icon color="#3c9cff" name="arrow-up" size="24"></u-icon>
</view>
</view>
</template>
<script>
import {
newsList,
topicList
newsList
} from "@/utils/data/data.js"
import {
register
} from '@/api/login.js'
import InfoList from "@/pages/home/cpns/info-list.vue"
import NewsTopicNav from "@/pages/news/cpns/news-topic-nav.vue"
import TopicList from "@/pages/news/cpns/topic-list.vue"
export default {
components: {
InfoList,
NewsTopicNav,
TopicList
InfoList
},
data() {
return {
//
tabIndex: 1,
tabList: [{
name: "关注",
id: 'follow'
scrollTops: [0, 0, 0, 0, 0, 0],
scrollTop: [0, 0, 0, 0, 0, 0],
// // loadmore/ loading / nomore
loadStatus: ['loadmore', 'loadmore', 'loadmore', 'loadmore', 'loadmore', 'loadmore'],
//
tabIndex: 0,
tablist: [{
name: "关注"
},
{
name: "话题",
id: 'topic'
name: "谷雨"
},
{
name: "芒种"
},
{
name: "小满",
},
{
name: "霜降"
},
{
name: "寒露"
}
],
swiperHeight: 0,
//
followList: {
//
loadStatus: 'loadmore',
//
list: newsList[0].list
},
//
topicList: {
swiper: [ //
{
image: '/static/img/demo/winter.png',
title: '迷人的春天是令人欢欣鼓舞的。'
},
{
image: '/static/img/demo/winter.png',
title: '一道残阳铺水中,半江瑟瑟半江红。'
},
{
image: '/static/img/demo/winter.png',
title: '金秋的阳光温馨恬静,金秋的微风和煦轻柔。'
},
{
image: '/static/img/demo/winter.png',
title: '风吹过,寒气直侵入骨头。'
}
],
list: topicList[1].list
}
//
swiperIndex: 0,
swiperList: newsList
}
},
onLoad() {
// swiperHeight
uni.getSystemInfo({
success: (res) => {
// screenHeight) = (statusBarHeight) + (44px) + 使(windowHeight)
// 使 = swiper +
this.swiperHeight = res.windowHeight - 44
}
})
//
onNavigationBarSearchInputClicked() {
this.handleSearch()
},
//
onNavigationBarButtonTap(e) {
switch (e.index) {
case 1:
this.handlePublish()
break;
}
},
methods: {
// tabbar
changeTab(index) {
this.tabIndex = index
btn() {
uni.login({
success: (res) => {
console.log(res);
}
})
},
// swiper
changeSwiper(e) {
//
handlePublish() {
this.$u.route('/pages/home/release')
},
//
handleSearch() {
this.$u.route('/pages/home/search', {
type: 'info'
})
},
// tab
changeTab(item) {
this.tabIndex = item.index
this.swiperIndex = item.index
},
// swipertabsswiper
animationfinish(e) {
this.tabIndex = e.detail.current
this.swiperIndex = e.detail.current
},
// scroll-view
// scroll-view
reachBottom() {
//
if (this.followList.loadStatus !== 'loadmore') return;
//
this.followList.loadStatus = "loading"
if (this.loadStatus[this.tabIndex] !== 'loadmore') return
//
this.loadStatus.splice(this.tabIndex, 1, "loading")
setTimeout(() => {
this.getList()
this.getList(this.tabIndex)
}, 1000);
},
//
getList(idx) {
getList(index) {
// 5
for (let i = 0; i < 5; i++) {
let index = this.$u.random(0, this.followList.list.length - 1)
let data = JSON.parse(JSON.stringify(this.followList.list[index]))
this.followList.list.push(data)
let curr = this.$u.random(0, this.swiperList[index].list.length - 1)
let data = this.swiperList[index].list[curr]
this.swiperList[index].list.push(data)
}
//
this.followList.loadStatus = "nomore"
//
this.loadStatus.splice(this.tabIndex, 1, "nomore")
},
//
goSearch() {
this.$u.route('/pages/home/search', {
type: 'topic'
//
scroll(e) {
const index = this.tabIndex
this.scrollTop.splice(index, 1, e.detail.scrollTop) // 400
},
//
goTop() {
const index = this.tabIndex
// view
this.scrollTops.splice(index, 1, this.scrollTop[index])
this.$nextTick(function() {
this.scrollTops.splice(index, 1, 0)
this.scrollTop.splice(index, 1, 0)
})
}
},
//
handleFollow(item) {
this.swiperList[this.swiperIndex].list[item.index].isFollow = item.value
const title = item.value ? '关注成功' : '取消成功'
uni.showToast({
title,
icon: 'none',
})
},
//
handleMark(item) {
let infoNum = this.swiperList[this.swiperIndex].list[item.index].infoNum
switch (item.value) {
case 'smile':
if (infoNum.index == 1) return //
else if (infoNum.index == 2) infoNum.cryNum--
infoNum.index = 1
infoNum.smileNum++
break;
case 'cry':
if (infoNum.index == 2) return //
else if (infoNum.index == 1) infoNum.smileNum--
infoNum.index = 2
infoNum.cryNum++
break
}
const title = item.value === 'smile' ? '谢谢表扬' : '继续加油'
uni.showToast({
title,
icon: 'none',
})
},
}
}
</script>
<style lang="scss" scoped>
.news {
.home {
display: flex;
flex-direction: column;
height: calc(100vh - var(--window-top) - var(--window-bottom)); // - -
width: 100%;
//
//
/* #ifdef MP-WEIXIN */
/deep/ .u-navbar {
.iconfont {
font-size: 48rpx;
color: $uni-color-green;
}
.nav-center {
text-align: center;
display: flex;
justify-content: center;
align-items: center;
.nav-title {
width: 60rpx;
font-size: 30rpx;
padding: 0 15rpx;
font-weight: bold;
color: $uni-text-color-gray;
}
.active {
position: relative;
display: flex;
justify-content: center;
align-items: center;
.nav-title {
color: $uni-color-green;
}
.active-line {
border-bottom: 8rpx solid $uni-color-green;
border-radius: 20rpx;
width: 70rpx;
position: absolute;
bottom: -10rpx;
left: 50%;
margin-left: -35rpx;
}
}
}
.u-navbar__content {
padding-right: 180rpx !important; //
margin-right: 180rpx !important; //
}
}
.topic {
.search-input {
margin-top: 20rpx;
margin-bottom: 20rpx;
height: 70rpx;
background-color: #F4F4F4;
border-radius: 10rpx;
/deep/ .u-input {
height: 100%;
}
}
.last-update {
padding: 0 20rpx 20rpx;
.last-update-name {
font-size: 32rpx;
padding-bottom: 5rpx;
}
}
/* #endif */
//
.go-top {
position: fixed;
right: 30rpx;
bottom: 100rpx;
height: 80rpx;
width: 80rpx;
background: #ffffff;
display: flex;
justify-content: center;
align-items: center;
border-radius: 100%;
}
}
</style>

View File

@ -1,16 +1,20 @@
<template>
<!-- 小纸条列表 -->
<view class="paper-item flex items-center p-20 border-b border-gray-100" hover-class="bg-gray" @click="goChat">
<image class="item-img mr-20 rounded-full" :src="item.avatar" mode=""></image>
<view class="flex-1 flex flex-col">
<view class="flex justify-between items-center">
<text class="text-30">{{item.nickName}}</text>
<text class="text-28 text-gray-500">{{item.createTime}}</text>
<image class=" rounded-20" style="width: 80rpx; height: 80rpx;margin: 0 20rpx;" :src="item.avatar" mode=""></image>
<view style="display: flex;align-items: center;">
<view class="flex flex-content">
<text class="text1">退役士兵教育培训承训机构申请表</text>
<text class="text2">退役士兵教育培训承训机构申请表描述信息</text>
</view>
<view class="flex justify-between items-center text-26 text-gray-500">
<view>
<image style="width: 50rpx; height: 50rpx;" :src="imageUrl+'retired/icon-retired-download.png'" mode="">
</image>
</view>
<!-- <view class="flex justify-between items-center text-26 text-gray-500">
<text class="item-content line-1">{{item.content}}</text>
<u-badge type="error" max="99" :value="item.count"></u-badge>
</view>
</view> -->
</view>
</view>
</template>
@ -25,7 +29,7 @@
},
data() {
return {
imageUrl: getApp().globalData.imgUrl
}
},
methods: {
@ -47,4 +51,30 @@
max-width: 500rpx;
}
}
</style>
.flex-content {
flex-direction: column;
// border: solid 1px red;
margin-right: 30rpx;
.text1 {
width: 480rpx;
text-overflow: ellipsis;
overflow: hidden;
word-break: break-all;
white-space: nowrap;
font-size: 32rpx;
}
.text2 {
width: 480rpx;
text-overflow: ellipsis;
overflow: hidden;
word-break: break-all;
white-space: nowrap;
font-size: 24rpx;
color: #a2a2a2;
margin-top: 12rpx;
}
}
</style>

View File

@ -5,13 +5,13 @@
<!-- #ifdef MP-WEIXIN -->
<u-navbar placeholder>
<view class="flex" slot="left">
<view class="iconfont iconduoren" @click="handleFirend()">
<view style="visibility: hidden;" class="iconfont iconduoren" @click="handleFirend()">
</view>
<view class="iconfont iconcaidan ml-20" @click="showPopup = true">
<view style="visibility: hidden;" class="iconfont iconcaidan ml-20" @click="showPopup = true">
</view>
</view>
<view slot="center" class="nav-center">
小纸条
技能培训
</view>
</u-navbar>
<!-- #endif -->
@ -20,7 +20,7 @@
<u-empty v-if="list.length === 0" text="本来无一物,何处惹尘埃" icon="/static/img/demo/winter.png" textSize="16"
marginTop='25%' mode="list"></u-empty>
<!-- 底部弹窗 -->
<u-popup :show="showPopup" @close="showPopup = false" mode="top" :safeAreaInsetTop="true">
<!-- <u-popup :show="showPopup" @close="showPopup = false" mode="top" :safeAreaInsetTop="true">
<view class="flex justify-center items-center text-30 py-20 border-b" hover-class="bg-gray"
@click="popupHandle('friend')">
<text class="iconfont iconsousuo mr-20"></text>添加好友
@ -29,7 +29,7 @@
@click="popupHandle('clear')">
<text class="iconfont iconshanchu mr-20"></text>清空消息
</view>
</u-popup>
</u-popup> -->
</view>
</template>