Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
W
wly-APP
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘川
wly-APP
Commits
3fd7acb2
Commit
3fd7acb2
authored
Mar 28, 2022
by
chuan.liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增消息中心 消息列表界面
parent
dffa38a1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
618 additions
and
15 deletions
+618
-15
pages.json
pages.json
+23
-1
apply-page.nvue
pages/message-list/apply-page.nvue
+300
-0
message-list.nvue
pages/message-list/message-list.nvue
+140
-0
message.nvue
pages/message/message.nvue
+155
-14
No files found.
pages.json
View file @
3fd7acb2
...
...
@@ -365,9 +365,31 @@
"path"
:
"pages/message/message"
,
"style"
:
{
"app-plus"
:
{
"titleNView"
:
{
"titleAlign"
:
"left"
,
"titleColor"
:
"#333"
,
"titleSize"
:
"17px"
,
"backgroundColor"
:
"#fff"
,
"titleText"
:
"消息中心"
,
"autoBackButton"
:
false
}
}
}
},
{
"path"
:
"pages/message-list/message-list"
,
"style"
:
{
"app-plus"
:
{
"titleNView"
:
{
"titleAlign"
:
"left"
,
"titleColor"
:
"#333"
,
"titleSize"
:
"17px"
,
"backgroundColor"
:
"#fff"
,
"titleText"
:
"消息中心"
,
"autoBackButton"
:
true
}
}
}
}
],
"globalStyle"
:
{
...
...
pages/message-list/apply-page.nvue
0 → 100644
View file @
3fd7acb2
<template>
<view class="page-news">
<uni-list ref="list" class="listview" :enableBackToTop="true" :scroll-y="true" @scrolltolower="loadMore()">
<uni-refresh class="refresh" @refresh="onrefresh" @pullingdown="onpullingdown" :display="refreshing ? 'show' : 'hide'">
<div class="refresh-view">
<image class="refresh-icon" :src="refreshIcon" :style="{width: (refreshing || pulling) ? 0: '32px'}" :class="{'refresh-icon-active': refreshFlag}"></image>
<uni-load-more v-if="refreshing" class="loading-icon" status="loading" :contentText="loadingMoreText"></uni-load-more>
<text class="loading-text">{{refreshText}}</text>
</div>
</uni-refresh>
<uni-cell v-for="(item, index) in dataList" :key="item.id">
<apply-item :newsItem="item" @click="goDetail(item)"></apply-item>
</uni-cell>
<uni-cell v-if="isLoading || dataList.length > 4">
<view class="loading-more">
<text class="loading-more-text">{{loadingText}}</text>
</view>
</uni-cell>
</uni-list>
<!-- <no-data class="no-data" v-if="isNoData" @retry="loadMore"></no-data> -->
</view>
</template>
<script>
import uniList from '@/components/uni-list.vue';
import uniCell from '@/components/uni-cell.vue';
import uniRefresh from '@/components/uni-refresh.vue';
import uniLoadMore from '@/components/uni-load-more.vue';
import noData from '@/components/nodata.nvue';
import applyItem from './apply-item.nvue';
export default {
components: {
uniList,
uniCell,
uniRefresh,
uniLoadMore,
noData,
applyItem
},
props: {
nid: {
type: [Number, String],
default: ''
}
},
data() {
return {
dataList: [],
navigateFlag: false,
pulling: false,
refreshing: false,
refreshFlag: false,
refreshText: "",
isLoading: false,
loadingText: '加载中...',
isNoData: false,
pulling: false,
angle: 0,
loadingMoreText: {
contentdown: '',
contentrefresh: '',
contentnomore: ''
},
refreshIcon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAB5QTFRFcHBw3Nzct7e39vb2ycnJioqK7e3tpqam29vb////D8oK7wAAAAp0Uk5T////////////ALLMLM8AAABxSURBVHja7JVBDoAgDASrjqj//7CJBi90iyYeOHTPMwmFZrHjYyyFYYUy1bwUZqtJIYVxhf1a6u0R7iUvWsCcrEtwJHp8MwMdvh2amHduiZD3rpWId9+BgPd7Cc2LIkPyqvlQvKxKBJ//Qwq/CacAAwDUv0a0YuKhzgAAAABJRU5ErkJggg=="
}
},
created() {
this.pullTimer = null;
this.requestParams = {
columnId: this.nid,
minId: 0,
pageSize: 10,
column: 'id,post_id,title,author_name,cover,published_at,comments_count'
};
this._isWidescreen = false;
// #ifdef H5
var mediaQueryOb = uni.createMediaQueryObserver(this)
mediaQueryOb.observe({
minWidth: 768
}, matches => {
this._isWidescreen = matches;
})
// #endif
},
methods: {
loadData(refresh) {
if (this.isLoading) {
return;
}
this.isLoading = true;
this.isNoData = false;
this.requestParams.time = new Date().getTime() + '';
var startTime = new Date();
uni.request({
// url: this.$host + 'api/news',
url: 'https://unidemo.dcloud.net.cn/api/news',
data: this.requestParams,
success: (result) => {
var endTime = new Date();
const data = result.data;
this.isNoData = (data.length <= 0);
const data_list = data.map((news) => {
return {
id: this.newGuid() + news.id,
newsid: news.id,
article_type: 1,
datetime: (new Date(news.published_at.replace(/\-/g, '/')).getTime()),
title: news.title,
image_url: news.cover,
source: news.author_name,
comment_count: news.comments_count,
post_id: news.post_id
};
});
if (refresh) {
this.dataList = data_list;
this.requestParams.minId = 0;
} else {
this.dataList = this.dataList.concat(data_list);
this.requestParams.minId = data[data.length - 1].id;
}
if (this.dataList.length > 0 && this._isWidescreen && this.dataList.length <= 10) {
this.goDetail(this.dataList[0]);
}
},
fail: (err) => {
if (this.dataList.length == 0) {
this.isNoData = true;
}
},
complete: (e) => {
this.isLoading = false;
if (refresh) {
this.refreshing = false;
this.refreshFlag = false;
this.refreshText = "已刷新";
if (this.pullTimer) {
clearTimeout(this.pullTimer);
}
this.pullTimer = setTimeout(() => {
this.pulling = false;
}, 1000);
}
}
});
},
loadMore(e) {
this.loadData();
},
clear() {
this.dataList.length = 0;
this.requestParams.minId = 0;
},
goDetail(detail) {
},
refreshData() {
if (this.isLoading) {
return;
}
this.pulling = true;
this.refreshing = true;
this.refreshText = "正在刷新...";
this.loadData(true);
},
onrefresh(e) {
this.refreshData();
// #ifdef APP-NVUE
this.$refs.list.resetLoadmore();
// #endif
},
onpullingdown(e) {
if (this.refreshing) {
return;
}
// var angle = (e.pullingDistance) / e.viewHeight * 180;
// if (angle > 180) {
// angle = 180;
// }
// tab.angle = angle;
this.pulling = false;
if (Math.abs(e.pullingDistance) > Math.abs(e.viewHeight)) {
this.refreshFlag = true;
this.refreshText = "释放立即刷新";
} else {
this.refreshFlag = false;
this.refreshText = "下拉可以刷新";
}
},
newGuid() {
let s4 = function() {
return (65536 * (1 + Math.random()) | 0).toString(16).substring(1);
}
return (s4() + s4() + "-" + s4() + "-4" + s4().substr(0, 3) + "-" + s4() + "-" + s4() + s4() + s4()).toUpperCase();
}
}
}
</script>
<style lang="scss" scoped>
.no-data {
flex: 1;
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
z-index: 10;
}
.page-news {
flex: 1;
flex-direction: column;
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
}
.listview {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
/* #ifndef APP-NVUE */
display: flex;
flex-direction: column;
/* #endif */
/* #ifndef MP-ALIPAY */
flex-direction: column;
/* #endif */
}
.refresh {
justify-content: center;
}
.refresh-view {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
width: 750rpx;
height: 64px;
flex-direction: row;
flex-wrap: nowrap;
align-items: center;
justify-content: center;
}
.refresh-icon {
width: 32px;
height: 32px;
transition-duration: .5s;
transition-property: transform;
transform: rotate(0deg);
transform-origin: 15px 15px;
}
.refresh-icon-active {
transform: rotate(180deg);
}
.loading-icon {
width: 28px;
height: 28px;
margin-right: 5px;
color: gray;
}
.loading-text {
margin-left: 2px;
font-size: 16px;
color: #999999;
}
.loading-more {
align-items: center;
justify-content: center;
padding-top: 14px;
padding-bottom: 14px;
text-align: center;
}
.loading-more-text {
font-size: 28upx;
color: #999;
}
</style>
pages/message-list/message-list.nvue
0 → 100644
View file @
3fd7acb2
<template>
<view class="order view">
<view class="status_bar" :style="navHeight"></view>
<view class="listview">
<view class="cell-list">
<text class="date">10:18</text>
<view class="cell-list-block">
<view class="list-block-title">
<image class="icon-address" src="@/static/image/uc_address@3x.png" mode="aspectFit"></image>
<text class="list-block-title__text">最新消息</text>
</view>
<view class="cell-list-block__content">
<text class="cell-list-block__title">新川商贸要货审批,请尽快审批。新川商贸要货审批,请尽快审批。</text>
</view>
</view>
<view class="cell-list-block">
<view class="list-block-title">
<image class="icon-address" src="@/static/image/uc_address@3x.png" mode="aspectFit"></image>
<text class="list-block-title__text">最新消息</text>
</view>
<view class="cell-list-block__content">
<text class="cell-list-block__title">新川商贸要货审批,请尽快审批。新川商贸要货审批,请尽快审批。新川商贸要货审批,请尽快审批。新川商贸要货审批,请尽快审批。</text>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import {
mapState
} from 'vuex'
export default {
data() {
return {
}
},
computed: {
navHeight() {
return {
'height': `${this.sysinfo.safeArea.top + 44}px`
}
},
...mapState(['sysinfo'])
},
methods: {
}
}
</script>
<style lang="scss" scoped>
.view {
flex-direction: column;
}
/* #ifndef APP-PLUS */
page {
width: 100%;
min-height: 100%;
display: flex;
background: #fff;
}
.status_bar {
height: var(--status-bar-height);
}
/* #endif */
.order {
flex: 1;
background: #f0f4f5;
overflow-y: scroll;
padding: 24rpx;
}
.listview {
flex: 1;
flex-direction: column;
}
.cell-list {
flex-direction: column;
}
.date{
font-size: 28rpx;
color: #999999;
font-size: 28rpx;
text-align: center;
margin-bottom: 24rpx;
}
.icon-address {
width: 44rpx;
height: 44rpx;
margin-right: 16rpx;
}
.cell-list-block__content {
display: flex;
flex: 1;
flex-direction: column;
margin-bottom: 40rpx;
}
.cell-list-block__title {
color: #333;
font-size: 30rpx;
flex: 1;
align-items: center;
margin-bottom: 4rpx;
}
.cell-list-block {
overflow: hidden;
display: flex;
flex-direction: column;
background: #fff;
padding: 20rpx 24rpx;
border-radius: 20rpx;
margin-bottom: 56rpx;
}
.list-block-title {
display: flex;
align-items: center;
margin-bottom: 16rpx;
}
.list-block-title__text {
color: #999999;
font-size: 26rpx;
}
</style>
pages/message/message.nvue
View file @
3fd7acb2
<template>
<div>
</div>
</template>
<script>
export default {
}
</script>
<style>
<template>
<view class="order view">
<view class="status_bar" :style="navHeight"></view>
<view class="listview">
<view class="cell-list">
<view class="cell-list-block" @click="goMessageList('unread')">
<image class="icon-address" src="@/static/image/uc_address@3x.png" mode="aspectFit"></image>
<view class="cell-list-block__content">
<text class="cell-list-block__title">未读消息</text>
<text class="cell-list-block__desc">最新消息:新川商贸要货审批</text>
</view>
<text class="dot">2</text>
<image class="icon-arrow" src="@/static/image/arrow_r@3x.png" mode="aspectFit"></image>
</view>
<view class="cell-list-block" @click="goMessageList('read')">
<image class="icon-address" src="@/static/image/uc_setting@3x.png" mode="aspectFit"></image>
<view class="cell-list-block__content">
<text class="cell-list-block__title">已读消息</text>
<text class="cell-list-block__desc">暂无内容</text>
</view>
<image class="icon-arrow" src="@/static/image/arrow_r@3x.png" mode="aspectFit"></image>
</view>
</view>
</view>
</view>
</template>
<script>
import {
mapState
} from 'vuex'
export default {
data() {
return {
}
},
computed: {
navHeight() {
return {
'height': `${this.sysinfo.safeArea.top + 44}px`
}
},
...mapState(['sysinfo'])
},
methods: {
goMessageList(type) {
uni.navigateTo({
url: `/pages/message-list/message-list`
});
}
}
}
</script>
<style lang="scss" scoped>
.view {
flex-direction: column;
}
/* #ifndef APP-PLUS */
page {
width: 100%;
min-height: 100%;
display: flex;
background: #fff;
}
.status_bar {
height: var(--status-bar-height);
}
/* #endif */
.order {
flex: 1;
background: #f0f4f5;
overflow-y: scroll;
padding-top: 16rpx;
}
.listview {
flex: 1;
flex-direction: column;
}
.cell-list {
flex-direction: column;
}
.icon-address {
width: 60rpx;
height: 60rpx;
margin-right: 44rpx;
}
.cell-list-block__content {
display: flex;
flex: 1;
flex-direction: column;
}
.cell-list-block__title {
color: #333;
font-size: 30rpx;
flex: 1;
align-items: center;
margin-bottom: 4rpx;
}
.cell-list-block__desc {
color: #999;
font-size: 26rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.icon-arrow {
width: 12rpx;
height: 20rpx;
}
.cell-list-block {
position: relative;
overflow: hidden;
display: flex;
height: 144rpx;
background: #fff;
padding: 0 36rpx 0 40rpx;
align-items: center;
}
.cell-list-block:after {
content: '';
position: absolute;
width: 750rpx;
left: 40rpx;
bottom: 0;
z-index: 10;
height: 2rpx;
background-color: #eee;
}
.dot {
width: 44rpx;
height: 36rpx;
background: #ff0f00;
border-radius: 18rpx;
color: #fff;
margin-right: 28rpx;
text-align: center;
}
</style>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment