11
This commit is contained in:
@@ -1,163 +0,0 @@
|
||||
<template>
|
||||
<view class="body">
|
||||
<view v-for="(value,key) in data" class="newsList" @click="goList(value)" :key="key">
|
||||
<view class="newsIcon">
|
||||
<image :src="value.icon" mode=""></image>
|
||||
<view v-if="news.unread[value.id] > 0" class="point"></view>
|
||||
</view>
|
||||
<view class="newsListRight">
|
||||
<view class="head">
|
||||
<view class="head_left">
|
||||
{{value.title}}
|
||||
</view>
|
||||
<view class="head_right" v-if="value.data.length > 0">
|
||||
{{value.data[0][0][value.prop.time]}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="content" v-if="value.data.length > 0">
|
||||
{{value.prop.desc(value)}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<cs-button></cs-button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapGetters
|
||||
} from 'vuex'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
loading: false
|
||||
}
|
||||
},
|
||||
onLoad() {},
|
||||
onShow() {
|
||||
if (!this.$store.state.user.token) {
|
||||
uni.redirectTo({
|
||||
url: "/pages/login/login"
|
||||
})
|
||||
} else {
|
||||
uni.$emit('newsReadChange')
|
||||
}
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.loading = true
|
||||
this.$store.dispatch("newsInit").then(() => {
|
||||
this.loading = false
|
||||
uni.stopPullDownRefresh();
|
||||
}).catch(() => {
|
||||
this.loading = false
|
||||
uni.stopPullDownRefresh();
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
goList(item) {
|
||||
if (item.data.length === 0) {
|
||||
uni.showToast({
|
||||
title: '暂无消息',
|
||||
icon: 'none'
|
||||
});
|
||||
return
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: './newsList?type=' + item.id
|
||||
})
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['news']),
|
||||
data() {
|
||||
return this.news.data
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.content {
|
||||
font-family: PingFangSC-Regular;
|
||||
font-size: 28rpx;
|
||||
color: #666666;
|
||||
width: 560rpx;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
/*不换行*/
|
||||
text-overflow: ellipsis;
|
||||
/*超出部分文字以...显示*/
|
||||
}
|
||||
|
||||
.head_right {
|
||||
float: right;
|
||||
font-family: PingFangSC-Regular;
|
||||
font-size: 24rpx;
|
||||
color: #CCCCCC;
|
||||
}
|
||||
|
||||
.head_left {
|
||||
float: left;
|
||||
font-family: PingFangSC-Regular;
|
||||
font-size: 36rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.head {
|
||||
overflow: hidden;
|
||||
width: 560rpx;
|
||||
}
|
||||
|
||||
.newsListRight {
|
||||
float: left;
|
||||
width: 560rpx;
|
||||
height: 50rpx;
|
||||
line-height: 50rpx;
|
||||
padding-left: 30rpx;
|
||||
}
|
||||
|
||||
.newsList .newsIcon {
|
||||
position: relative;
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
display: inline-block;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.newsList image {
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
}
|
||||
|
||||
.newsList .point {
|
||||
position: absolute;
|
||||
top: 5rpx;
|
||||
right: 10rpx;
|
||||
width: 20rpx;
|
||||
height: 20rpx;
|
||||
background: red;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.newsList {
|
||||
border-bottom: 1rpx solid #dddddd;
|
||||
padding-bottom: 30rpx;
|
||||
padding-right: 30rpx;
|
||||
padding-top: 30rpx;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.body {
|
||||
background-color: #fefefe;
|
||||
padding-left: 30rpx;
|
||||
|
||||
width: 720rpx;
|
||||
}
|
||||
|
||||
page {
|
||||
background: #f6f6f6;
|
||||
}
|
||||
</style>
|
||||
@@ -1,100 +0,0 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="titlt">
|
||||
<view class="title_left">
|
||||
{{data.title}}
|
||||
</view>
|
||||
<view class="title_time">
|
||||
{{data.createTime}}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="content">
|
||||
<rich-text :nodes="nodes"></rich-text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
noticeDetail
|
||||
} from '@/api/news.js';
|
||||
import parseHtml from '@/untils/html-parser.js'
|
||||
import {
|
||||
mapGetters
|
||||
} from 'vuex'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
content: {},
|
||||
data: {},
|
||||
nodes: []
|
||||
}
|
||||
},
|
||||
onLoad({
|
||||
type
|
||||
}) {
|
||||
this.id = type
|
||||
uni.setNavigationBarTitle({
|
||||
title: this.news.data[type].title
|
||||
});
|
||||
uni.$emit('getNewsDetail', (data) => {
|
||||
this.data = data
|
||||
})
|
||||
this.nodes = parseHtml(this.data.content)
|
||||
},
|
||||
onShow() {
|
||||
if (this.data.isRead === 0) {
|
||||
this.$store.dispatch('readNew', {
|
||||
key: this.id,
|
||||
id: this.data.id
|
||||
})
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['news']),
|
||||
list() {
|
||||
if (this.id) {
|
||||
return this.news.data[this.id].data
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.content {
|
||||
padding: 10rpx 30rpx;
|
||||
}
|
||||
|
||||
text {
|
||||
|
||||
font-family: PingFangSC-Regular;
|
||||
font-size: 28rpx;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.title_time {
|
||||
font-family: PingFangSC-Regular;
|
||||
font-size: 24rpx;
|
||||
color: #CCCCCC;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.titlt {
|
||||
overflow: hidden;
|
||||
padding: 10rpx 30rpx;
|
||||
|
||||
}
|
||||
|
||||
.title_left {
|
||||
font-family: PingFangSC-Regular;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
float: left;
|
||||
}
|
||||
</style>
|
||||
@@ -1,202 +0,0 @@
|
||||
<template>
|
||||
<view>
|
||||
<view :key="group" v-for="(item,group) in list">
|
||||
<m-slide-list :prop="prop" :key="value.id" v-for="(value,index) in item" :value="value" :button="buttonList" @remove="click(value,group,index)"
|
||||
@controller-reg="controller.reg" @controller-moving="controller.moving" @controller-opened="controller.opened"
|
||||
@controller-closed="controller.closed">
|
||||
<view class="news-item">
|
||||
<view class="now-message-info" hover-class="uni-item--hover" @click="clickMethod(value)" :style="{width:windowWidth}">
|
||||
<view class="list-right">
|
||||
<view v-if="value[prop.isRead] === 0" class="point"></view>
|
||||
<view class="list-title">{{ value[prop.title] }}</view>
|
||||
<view class="list-detail">{{ value[prop.listDesc] }}</view>
|
||||
</view>
|
||||
<view class="list-right-1" v-if="value[prop.time]">{{ value[prop.time] }}</view>
|
||||
</view>
|
||||
<view style="clear:both"></view>
|
||||
</view>
|
||||
</m-slide-list>
|
||||
<!-- <view class="news-loading">
|
||||
加载中...
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import mSlideList from '../../components/mark-slide-list/mark-slide-list.vue';
|
||||
import controller from '../../components/mark-slide-list/controller';
|
||||
import {
|
||||
mapGetters
|
||||
} from 'vuex'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
mSlideList
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
id: '',
|
||||
controller: new controller(),
|
||||
buttonList: [{
|
||||
title: '删除',
|
||||
background: '#ff3b32',
|
||||
clickName: 'remove'
|
||||
}]
|
||||
};
|
||||
},
|
||||
onLoad({
|
||||
type
|
||||
}) {
|
||||
this.id = type
|
||||
uni.setNavigationBarTitle({
|
||||
title: this.news.data[type].title
|
||||
});
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.loading = true
|
||||
this.$store.dispatch("newsReload", this.id).then(() => {
|
||||
this.loading = false
|
||||
uni.stopPullDownRefresh();
|
||||
}).catch(() => {
|
||||
this.loading = false
|
||||
uni.stopPullDownRefresh();
|
||||
})
|
||||
},
|
||||
// onPageScroll(obj) {},
|
||||
onReachBottom() {
|
||||
if (!this.loading) {
|
||||
this.loading = true
|
||||
this.$store.dispatch("newsGetNextPage", this.id).then(() => {
|
||||
this.loading = false
|
||||
})
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
//查看详情
|
||||
clickMethod(data) {
|
||||
this.news.data[this.id].navigateTo(data, this.$store.dispatch)
|
||||
},
|
||||
click(value, group, index) {
|
||||
this.$store.dispatch('removeNew', {
|
||||
id: value.id,
|
||||
key: this.id,
|
||||
group,
|
||||
index
|
||||
})
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['news']),
|
||||
list() {
|
||||
if (this.id) {
|
||||
return this.news.data[this.id].data
|
||||
}
|
||||
},
|
||||
prop() {
|
||||
if (this.id) {
|
||||
return this.news.data[this.id].prop
|
||||
}
|
||||
},
|
||||
windowWidth() {
|
||||
return uni.getSystemInfoSync().windowWidth + 'px';
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.uni-item--hover {
|
||||
background-color: #f1f1f1 !important;
|
||||
}
|
||||
|
||||
.news-item {
|
||||
height: 160rpx;
|
||||
}
|
||||
|
||||
.now-message-info {
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
/* justify-content: space-between; */
|
||||
font-size: 16px;
|
||||
clear: both;
|
||||
height: 160rpx;
|
||||
padding: 0 30rpx;
|
||||
// margin-bottom: 20rpx;
|
||||
background: #ffffff;
|
||||
float: left;
|
||||
border-bottom: 1px solid #f2f2f2;
|
||||
|
||||
.icon-image {
|
||||
border-radius: 10rpx;
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.icon-circle {
|
||||
background: #3396fb;
|
||||
border-radius: 100%;
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
line-height: 100rpx;
|
||||
text-align: center;
|
||||
color: #ffffff;
|
||||
font-weight: bold;
|
||||
font-size: 20px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.list-right {
|
||||
position: relative;
|
||||
float: left;
|
||||
margin-left: 25rpx;
|
||||
margin-right: 30rpx;
|
||||
|
||||
.point {
|
||||
position: absolute;
|
||||
top: 15rpx;
|
||||
left: -25rpx;
|
||||
width: 20rpx;
|
||||
height: 20rpx;
|
||||
background: red;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.list-title {
|
||||
width: 350rpx;
|
||||
line-height: 1.5;
|
||||
overflow: hidden;
|
||||
margin-bottom: 10rpx;
|
||||
color: #333;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 1;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.list-detail {
|
||||
width: 350rpx;
|
||||
font-size: 14px;
|
||||
color: #a9a9a9;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 1;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
.list-right-1 {
|
||||
position: absolute;
|
||||
right: 30rpx;
|
||||
color: #a9a9a9;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.news-loading {}
|
||||
</style>
|
||||
Reference in New Issue
Block a user