Commit 7af8103d authored by 胡占生's avatar 胡占生 🇨🇳

消息中心更改

parent 01410880
This diff is collapsed.
......@@ -9,17 +9,94 @@ import request from '@/utils/axios'
// })
// }
/* post请求 */
export function postMessgaelist(url,data) {
//消息信息列表
export function postMessgaelist(data) {
return request({
url: '/messageInfo/list',
method: 'post',
data
})
}
//未读消息变为已读
export function noticeRemove(data) {
return request({
url: url,
url: '/messageInfo/changeRead',
method: 'post',
data
})
}
//清除未读消息列表
export function removeAllMessgae(data) {
return request({
url: "/messageInfo/changeStatus",
method: 'get',
data
})
}
//删除已读消息
export function removeMessgae(data) {
return request({
url: "/messageInfo/remove",
method: 'post',
data
})
}
export function noticeRemove(url,data) {
//待办事项列表
export function waitList(data) {
return request({
url: "/backlogInfo/list",
method: 'post',
data
})
}
//未读消息数
export function badgeNumber(data) {
return request({
url: "/backlogInfo/unReadCount",
method: 'get',
data
})
}
//删除已办事项
export function removeWaitList(data) {
return request({
url: "/backlogInfo/remove",
method: 'post',
data
})
}
//通知公告列表
export function notificationList(data) {
return request({
url: "/noticeInfo/list",
method: 'post',
data
})
}
//清除通知公告未读
export function removeAllNotification(data) {
return request({
url: "/noticeInfo/changeStatus",
method: 'get',
data
})
}
//清除通知未读改为已读
export function readNotification(data) {
return request({
url: "/noticeInfo/changeRead",
method: 'post',
data
})
}
//删除已读通知列表
export function removeNotification(data) {
return request({
url: url,
url: "/noticeInfo/remove",
method: 'post',
data
})
......
......@@ -11,7 +11,7 @@ import router from '../router'
import { Toast } from 'vant';
import { Notify } from 'vant';
import { Dialog } from 'vant';
import { getToken ,removeToken} from '@/utils/auth' // get token from cookie
import { getToken, removeToken } from '@/utils/auth' // get token from cookie
const service = axios.create({
baseURL: '/hse/app-api', //前缀路径
headers: {//请求头部
......@@ -26,19 +26,19 @@ service.interceptors.request.use(config => {
config.headers['token'] = getToken()
}
return config
},error => {
}, error => {
return Promise.reject(error)
})
service.interceptors.response.use(response => {
const res = response.data//获取请求返回数据
const code = response.status//获取请求响应码
if(code == 200) {//请求响应码200 代表已经请求到接口
if(res.code === 0) {//接口响应码0 代表接口代码运行正常
if (code == 200) {//请求响应码200 代表已经请求到接口
if (res.code === 0) {//接口响应码0 代表接口代码运行正常
return res
}else if(res.code === 301){
} else if (res.code === 301) {
// Notify({ type: 'danger', message: res.msg});
return res
}else if(res.code === 403){
} else if (res.code === 403) {
Dialog.alert({
title: '提示',
message: res.msg,
......@@ -47,14 +47,15 @@ service.interceptors.response.use(response => {
removeToken()
location.reload()
});
} else {
return res
}
}else{
} else {
Promise.reject(new Error('Error'))
}
},err=>{
}, err => {
Toast.fail('请求失败');
return Promise.reject(err)
})
export default service
})
export default service
......@@ -14,20 +14,28 @@
title-active-color="#000000"
sticky
offset-top="1.333333rem"
@click="onClick"
>
<van-tab
title="待办事项"
name="待办事项"
:badge="messageNewsNum.待办事项 > 0 ? messageNewsNum.待办事项 : ''"
>
<wait-event :actives="activeName"></wait-event>
</van-tab>
<van-tab
title="消息信息"
name="消息信息"
:badge="messageNewsNum > 0 ? messageNewsNum : ''"
:badge="messageNewsNum.消息信息 > 0 ? messageNewsNum.消息信息 : ''"
>
<message-news @messageLength="getMessageLength"></message-news>
</van-tab>
<van-tab title="" name="" disabled badge="">
<wait-event></wait-event>
<message-news :actives="activeName"></message-news>
</van-tab>
<van-tab title="" name="" disabled badge="">
<notice-info></notice-info>
<van-tab
title="通知公告"
name="通知公告"
:badge="messageNewsNum.通知公告 > 0 ? messageNewsNum.通知公告 : ''"
>
<notice-info :actives="activeName"></notice-info>
</van-tab>
</van-tabs>
</div>
......@@ -42,6 +50,7 @@ import messageNews from "./messageNews";
import waitEvent from "./waitEvent";
import noticeInfo from "./noticeInfo";
import tabBar from "@/components/TabBar";
import { badgeNumber } from "@/service/message";
export default {
components: {
messageNews,
......@@ -51,18 +60,34 @@ export default {
},
data() {
return {
activeName: "消息信息",
messageNewsNum: "",
searchValue:''
activeName: "",
messageNewsNum: {},
searchValue: "",
};
},
created() {
this.activeName = sessionStorage.getItem("activeNames")
? sessionStorage.getItem("activeNames")
: "";
// this.activeName = actives;
this.getBadgeNumber();
},
mounted() {},
methods: {
onSearch(){
onClick(e) {
this.activeName = e;
sessionStorage.setItem("activeNames", e);
sessionStorage.setItem("activeIndex", 0);
this.getBadgeNumber();
},
onSearch() {
console.log("[ 1111 ]", 1111);
},
getMessageLength(len) {
this.messageNewsNum = len;
//获取未读消息数
getBadgeNumber() {
badgeNumber().then((res) => {
this.messageNewsNum = res.data;
});
},
},
};
......
<template>
<div>
<LHeader :text="text"></LHeader>
<van-cell-group inset>
<div class="messgae-title">
<span>{{ messageList.noticeTitle }}</span>
<span>{{ messageList.sendTime }}</span>
</div>
<div class="message-content">
{{ messageList.upcomingUserName }},您好!您有一条来自{{
messageList.createUserName
}}{{ messageList.noticeTitle }}相关的待处理任务...
</div>
</van-cell-group>
</div>
</template>
<script>
import { Toast } from "vant";
import LHeader from "@/components/header.vue";
export default {
components: {
LHeader,
},
data() {
return {
messageList: {},
text: "消息详情",
messageCategory: [
{
key: "0",
category: "全部",
},
{
key: "1",
category: "已办",
},
{
key: "2",
category: "待办",
},
],
activeIndex: 0,
searchVal: "",
waitList: [], // 待办列表
// refreshing: false, // 下拉刷新开关
// loading: false, // 列表滚动到底部会触发load事件
// finished: false // 列表数据全部加载完成
};
},
mounted() {},
created() {
this.messageList = JSON.parse(this.$route.params.id);
console.log(
"%c [ this.messageList ]",
"font-size:13px; background:pink; color:#bf2c9f;",
this.messageList
);
},
methods: {
// 点击类别
selectCategory(index, data) {
this.activeIndex = index;
},
// 搜索事件
onSearch(val) {
if (val !== "") {
console.log(this.search);
}
},
// // 下拉刷新事件
// onRefresh() {
// // 清空列表数据
// this.finished = false;
// // 重新加载数据
// // 将 loading 设置为 true,表示处于加载状态
// this.loading = true;
// this.onLoad();
// },
// // 列表初始化函数
// onLoad() {
// setTimeout(() => {
// if (this.refreshing) {
// this.refreshing = false;
// }
// // 加载完成后将loading改成 false
// this.loading = false;
// // 为什么会连续触发 load 事件? 先加上这句 this.finished = true; 以后再删
// // this.finished = true;
// // 如果列表数据全部加载完成 则将finished改为true
// // if (this.list.length >= 40) {
// // this.finished = true;
// // }
// }, 5000);
// }
},
};
</script>
<style lang="less" scoped>
/* @import url(); 引入css类 */
.message-wrap {
padding: 10px 10px 0;
background-color: #f0f1f5;
// 标签
.category-wrap {
.my-tag-style {
width: 75px;
height: 21px;
font-size: 13px;
border: 1px solid #1989fa;
border-radius: 4px;
color: #1989fa;
display: inline-block;
text-align: center;
line-height: 21px;
margin-right: 10px;
}
.active {
color: white;
background-color: #1989fa;
}
}
// 搜索
.search-wrap {
margin: 10px 0;
.van-search {
border-radius: 5px;
padding: 5px 12px;
}
.van-search__content {
background-color: #ffffff;
}
}
// 内容
.con-list {
.van-cell-group--inset {
margin: 0;
margin-bottom: 10px;
padding: 10px;
font-size: 13px;
.message-content {
margin-top: 10px;
}
}
}
}
</style>
<template>
<div>
<van-pull-refresh
v-model="isLoading"
success-text="刷新成功"
@refresh="onRefresh"
>
<div class="message-wrap">
<!-- 标签 -->
<div class="category-wrap">
......@@ -11,6 +16,8 @@
@click="clickCategory(index, item.category)"
>{{ item.category }}</span
>
<span class="my-tag-style" @click="clearNo()">清除未读</span>
</div>
<!-- 搜索 -->
......@@ -25,7 +32,6 @@
<div @click="onSearch">搜索</div>
</template>
</van-search>
<!-- <van-search v-model="searchVal" placeholder="搜索" @search="onSearch" /> -->
</div>
<!-- 内容列表 -->
<div class="con-list" @touchmove="showIndex = null">
......@@ -42,46 +48,43 @@
:key="index"
@click="touchstart(index, item)"
>
<van-badge :dot="item.status == 0 ? true : false">
<div style="padding: 10px; min-width: calc(100vw - 1.6rem)">
<!--@touchend.prevent="touchend(index)" 长按备份-->
<div class="messgae-title">
<span>{{ item.noticeTitle }}</span> <span>{{ item.sendTime }}</span>
<span>{{ item.title }}</span>
<span>{{ item.createTime }}</span>
</div>
<div class="message-content">
{{ item.upcomingUserName }},您好!您有一条来自{{
item.createUserName
}}的{{ item.noticeTitle }}相关的待处理任务...
{{ item.messageBy }},您好!您有一条来自{{ item.menuName }}的{{
item.content
}}相关的待处理任务...
</div>
<!-- 长按显示遮罩层 -->
<van-overlay :show="showIndex == index" v-if="item.status == '未读'">
<div class="wrapper" @click.stop="showIndex = null">
<!-- <van-button round type="primary" @click="goDetail(item)"
>查看</van-button
> -->
<van-button
round
type="info"
@click="read(item)"
v-if="item.status == '未读'"
>已读</van-button
>
</div>
</van-overlay>
</van-badge>
</van-cell-group>
<!-- </van-list>
</van-pull-refresh> -->
</div>
</div>
</van-pull-refresh>
</div>
</template>
<script>
import { postMessgaelist, noticeRemove } from "@/service/message";
import {
postMessgaelist,
noticeRemove,
removeAllMessgae,
removeMessgae,
} from "@/service/message";
export default {
props: {
actives: String,
default: () => "",
},
data() {
return {
isLoading: false,
show: false,
messageCategory: [
{
key: "0",
......@@ -109,136 +112,132 @@ export default {
};
},
created() {
this.unRead();
this.activeIndex = sessionStorage.getItem("activeIndex")
? sessionStorage.getItem("activeIndex")
: 0;
this.setMessage();
this.getMessageSort();
},
methods: {
//下拉刷新
onRefresh() {
setTimeout(() => {
this.$toast("刷新成功");
this.isLoading = false;
this.getMessageSort();
this.$parent.$parent.$parent.$parent.getBadgeNumber();
}, 1000);
},
// 点击类别
clickCategory(index, data) {
// 关闭遮罩层
this.showIndex = null;
this.activeIndex = index;
this.getMessageSort();
this.activeVal = this.messageCategory[index].category;
// 点击全部还是已读还是未读
this.selectCategory(data);
this.setMessage();
},
// 搜索事件
onSearch(val) {
this.selectCategory(this.activeVal, this.searchVal);
},
// 封装全部 已读 和 未读的方法
selectCategory(data, val = "") {
if (data == "全部") {
if (val) {
if (this.activeIndex == 0) {
let formData = new FormData();
formData.append("noticeContent", val);
formData.append("status", 0);
formData.append("keyword", this.searchVal);
this.getMessageList(formData);
} else {
this.getMessageList();
}
} else {
} else if (this.activeIndex == 1) {
let formData = new FormData();
formData.append("status", data);
if (val) {
formData.append("noticeContent", val);
}
formData.append("status", 1);
formData.append("keyword", this.searchVal);
this.getMessageList(formData);
} else if (this.activeIndex == 2) {
let formData = new FormData();
formData.append("keyword", this.searchVal);
this.getMessageList(formData);
}
},
// 点击消息条目时的点击事件 变成已读
setMessage() {
sessionStorage.setItem("activeNames", this.actives);
sessionStorage.setItem("activeIndex", this.activeIndex);
},
read(data) {
// 判断showIndex是否等于null 如果不等于则先将showIndex改为null
this.showIndex = null;
if (data.status == "未读") {
if (data.status == 0) {
let formData = new FormData();
formData.append("ids", data.pid);
noticeRemove("/mobile/noticeRemove", formData).then((res) => {
formData.append("id", data.id);
noticeRemove(formData).then((res) => {
if (res.code == 0) {
// 如果请求接口成功 则重新请求一下未读消息的条数
this.unRead();
// 重新请求对应的接口 刷新列表数据
let val = this.activeVal;
this.selectCategory(val);
this.getMessageSort();
}
});
}
},
// 请求有多少未读消息的接口
unRead() {
//根据类别请求接口
getMessageSort() {
if (this.activeIndex == 0) {
let formData = new FormData();
formData.append("status", "未读");
postMessgaelist("/mobile/notice", formData).then((res) => {
if (res.code == 0) {
// 向父组件发送消息条数
this.$emit("messageLength", res.total);
// 给消息列表赋值
this.messageList = res.rows;
formData.append("status", 0);
this.getMessageList(formData);
} else if (this.activeIndex == 1) {
let formData = new FormData();
formData.append("status", 1);
this.getMessageList(formData);
} else if (this.activeIndex == 2) {
this.getMessageList();
}
});
},
// 请求消息接口方法
getMessageList(data) {
postMessgaelist("/mobile/notice", data).then((res) => {
getMessageList(Data) {
postMessgaelist(Data).then((res) => {
this.messageList = res.rows;
});
},
// // 下拉刷新事件
// onRefresh() {
// // 清空列表数据
// this.finished = false;
// // 重新加载数据
// // 将 loading 设置为 true,表示处于加载状态
// this.loading = true;
// this.onLoad();
// },
// // 列表初始化函数
// onLoad() {
// setTimeout(() => {
// if (this.refreshing) {
// this.refreshing = false;
// }
// // 加载完成后将loading改成 false
// this.loading = false;
// // 为什么会连续触发 load 事件? 先加上这句 this.finished = true; 以后再删
// // this.finished = true;
// // 如果列表数据全部加载完成 则将finished改为true
// // if (this.list.length >= 40) {
// // this.finished = true;
// // }
// }, 5000);
// }
touchstart(index, item) {
// clearTimeout(this.Loop); //再次清空延时器,防止重复注册定时器
if (this.showIndex != null) {
this.showIndex = null;
return;
}
this.showIndex = index;
// this.Loop = setTimeout(
// function() {
// this.showIndex = index;
// }.bind(this),
// 0
// ); // 这里的1000是指需要长按的时间,单位为ms
this.read(item);
this.$router.push({
name: "message-details",
params: {
id: JSON.stringify(item),
},
});
},
// touchend(index) {
// // 这个方法主要是用来将每次手指移出之后将计时器清零 长按备份
// clearTimeout(this.Loop);
// },
// 详情
goDetail(data) {
this.showIndex = null;
//清除所有未读
clearNo() {
this.$dialog
.confirm({
title: "提示",
message: "确定清楚所有未读内容内容",
confirmButtonColor: "#1989FA",
})
.then(() => {
removeAllMessgae()
.then((res) => {
if (res.code == "0") {
this.$notify({ type: "success", message: "清楚成功" });
this.$parent.$parent.$parent.$parent.getBadgeNumber();
this.getMessageSort();
} else {
this.$notify({
type: "primary",
message: "没有未读消息可以清除",
});
}
})
.catch((err) => {
console.log(
"%c [ err ]",
"font-size:13px; background:pink; color:#bf2c9f;",
err
);
});
})
.catch(() => {
// on cancel
});
},
},
};
......@@ -246,6 +245,7 @@ export default {
<style lang="less" scoped>
/* @import url(); 引入css类 */
.message-wrap {
min-height: 58vh;
padding: 10px 10px 0;
background-color: #f0f1f5;
// 标签
......
<template>
<div>
<van-pull-refresh
v-model="isLoading"
success-text="刷新成功"
@refresh="onRefresh"
>
<div class="message-wrap">
<!-- 标签 -->
<div class="category-wrap">
......@@ -14,6 +19,7 @@
@click="selectCategory(index, item.category)"
>{{ item.category }}</span
>
<span class="my-tag-style" @click="clearNo()">清除未读</span>
</div>
<!-- 搜索 -->
......@@ -38,35 +44,53 @@
<!-- 内容列表 -->
<div class="con-list">
<!-- <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
<van-list
v-model="loading"
:finished="finished"
finished-text="没有更多了"
@load="onLoad"
> -->
<!-- <van-cell-group inset>
<div class="messgae-title">隐患确认信息</div>
<van-cell-group
inset
v-for="(item, index) in notificationList"
:key="index"
@click="touchstart(index, item)"
>
<van-badge :dot="item.status == 0 ? true : false">
<div style="padding: 10px; min-width: calc(100vw - 1.6rem)">
<div class="messgae-title">
<span>{{ item.title }}</span>
<span>{{ item.createTime }}</span>
</div>
<div class="mse_title">
{{ item.title }}
</div>
<div class="message-content">
张大海已确认一般隐患B类,右万宝宝负责整改。
{{ item.content }}
</div>
</div>
</van-cell-group> -->
<!-- </van-list>
</van-pull-refresh> -->
</van-badge>
</van-cell-group>
</div>
</div>
</van-pull-refresh>
</div>
</template>
<script>
import { Toast } from "vant";
import {
notificationList,
removeAllNotification,
readNotification,
removeNotification,
} from "@/service/message";
export default {
props: {
actives: String,
default: () => "",
},
data() {
return {
isLoading: false,
messageCategory: [
{
key: "0",
category: "全部",
category: "未读",
},
{
key: "1",
......@@ -74,65 +98,148 @@ export default {
},
{
key: "2",
category: "未读",
category: "全部",
},
],
activeIndex: 0,
searchVal: "",
notificationList: [],
// refreshing: false, // 下拉刷新开关
// loading: false, // 列表滚动到底部会触发load事件
// finished: false // 列表数据全部加载完成
};
},
mounted() {},
created() {
this.activeIndex = sessionStorage.getItem("activeIndex")
? sessionStorage.getItem("activeIndex")
: 0;
this.getNotificationSort();
this.setMessage();
},
methods: {
//下拉刷新
onRefresh() {
setTimeout(() => {
this.$toast("刷新成功");
this.isLoading = false;
this.getNotificationSort();
this.$parent.$parent.$parent.$parent.getBadgeNumber();
}, 1000);
},
// 点击类别
selectCategory(index, data) {
this.activeIndex = index;
this.getNotificationSort();
this.setMessage();
},
// 搜索事件
onSearch(val) {
if (val !== "") {
console.log(this.searchVal);
if (this.activeIndex == 0) {
let formData = new FormData();
formData.append("status", 0);
formData.append("keyword", this.searchVal);
this.getNotificationList(formData);
} else if (this.activeIndex == 1) {
let formData = new FormData();
formData.append("status", 1);
formData.append("keyword", this.searchVal);
this.getNotificationList(formData);
} else if (this.activeIndex == 2) {
let formData = new FormData();
formData.append("keyword", this.searchVal);
this.getNotificationList(formData);
}
},
// // 下拉刷新事件
// onRefresh() {
// // 清空列表数据
// this.finished = false;
// // 重新加载数据
// // 将 loading 设置为 true,表示处于加载状态
// this.loading = true;
// this.onLoad();
// },
// // 列表初始化函数
// onLoad() {
// setTimeout(() => {
// if (this.refreshing) {
// this.refreshing = false;
// }
// // 加载完成后将loading改成 false
// this.loading = false;
// // 为什么会连续触发 load 事件? 先加上这句 this.finished = true; 以后再删
// // this.finished = true;
// // 如果列表数据全部加载完成 则将finished改为true
// // if (this.list.length >= 40) {
// // this.finished = true;
// // }
// }, 5000);
// }
setMessage() {
sessionStorage.setItem("activeNames", this.actives);
sessionStorage.setItem("activeIndex", this.activeIndex);
},
//点击消息条目时的点击事件 变成已读
read(data) {
if (data.status == 0) {
let formData = new FormData();
formData.append("id", data.id);
readNotification(formData).then((res) => {
if (res.code == 0) {
this.getNotificationSort();
}
});
}
},
//根据类别请求接口
getNotificationSort() {
if (this.activeIndex == 0) {
let formData = new FormData();
formData.append("status", 0);
this.getNotificationList(formData);
} else if (this.activeIndex == 1) {
let formData = new FormData();
formData.append("status", 1);
this.getNotificationList(formData);
} else if (this.activeIndex == 2) {
this.getNotificationList();
}
},
//请求通知全部公告列表
getNotificationList(Data) {
notificationList(Data).then((res) => {
this.notificationList = res.rows;
});
},
touchstart(index, item) {
this.read(item);
this.$router.push({
name: "message-details",
params: {
id: JSON.stringify(item),
},
});
},
//清除未读
clearNo() {
this.$dialog
.confirm({
title: "提示",
message: "确定清楚所有未读内容内容",
confirmButtonColor: "#1989FA",
})
.then(() => {
removeAllNotification()
.then((res) => {
if (res.code == "0") {
this.$notify({ type: "success", message: "清楚成功" });
this.$parent.$parent.$parent.$parent.getBadgeNumber();
this.getNotificationSort();
} else {
this.$notify({
type: "primary",
message: "没有未读消息可以清除",
});
}
})
.catch((err) => {
console.log(
"%c [ err ]",
"font-size:13px; background:pink; color:#bf2c9f;",
err
);
});
})
.catch(() => {
// on cancel
});
},
},
};
</script>
<style lang="less" scoped>
/* @import url(); 引入css类 */
.message-wrap {
min-height: 58vh;
padding: 10px 10px 0;
background-color: #f0f1f5;
// 标签
......@@ -172,10 +279,22 @@ export default {
margin-bottom: 10px;
padding: 10px;
font-size: 13px;
.messgae-title {
.mse_title {
margin-top: 10px;
}
.message-content {
margin-top: 10px;
text-indent: 28px;
}
.messgae-title {
display: flex;
justify-content: space-between;
align-items: center;
}
.bot_but {
display: flex;
justify-content: right;
align-items: center;
}
}
}
......
<template>
<div>
<van-pull-refresh
v-model="isLoading"
success-text="刷新成功"
@refresh="onRefresh"
>
<div class="message-wrap">
<!-- 标签 -->
<div class="category-wrap">
......@@ -32,84 +37,139 @@
<!-- 内容列表 -->
<div class="con-list">
<!-- <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
<van-list
v-model="loading"
:finished="finished"
finished-text="没有更多了"
@load="onLoad"
> -->
<!-- <van-cell-group inset>
<div class="messgae-title">隐患确认信息</div>
<div class="message-content">
张大海已确认一般隐患B类,右万宝宝负责整改。
<van-cell-group
inset
v-for="(item, index) in waitList"
:key="index"
@click="touchstart(index, item)"
>
<van-badge :dot="item.status == 0 ? true : false">
<div style="padding: 10px; min-width: calc(100vw - 1.6rem)">
<div class="messgae-title">
<span>{{ item.title }}</span>
<span>{{ item.createTime }}</span>
</div>
<div class="message-content">{{ item.content }}</div>
<div class="bot_but">
<van-button color="#33CCFF" size="mini">立即处理</van-button>
</div>
</van-cell-group> -->
<!-- </van-list>
</van-pull-refresh> -->
</div>
</van-badge>
</van-cell-group>
</div>
</div>
</van-pull-refresh>
</div>
</template>
<script>
import { Toast } from "vant";
import { waitList, removeWaitList } from "@/service/message";
export default {
props: {
actives: String,
default: () => "",
},
data() {
return {
isLoading: false,
messageCategory: [
{
key: "0",
category: "全部",
category: "待办",
},
{
key: "1",
category: "",
category: "",
},
{
key: "2",
category: "未读",
category: "全部",
},
],
activeIndex: 0,
searchVal: "",
waitList: [], // 待办列表
// refreshing: false, // 下拉刷新开关
// loading: false, // 列表滚动到底部会触发load事件
// finished: false // 列表数据全部加载完成
};
},
mounted() {},
created() {
this.activeIndex = sessionStorage.getItem("activeIndex")
? sessionStorage.getItem("activeIndex")
: 0;
this.getWaitSort();
this.setMessage();
},
methods: {
//下拉刷新
onRefresh() {
setTimeout(() => {
this.$toast("刷新成功");
this.isLoading = false;
this.getWaitSort();
this.$parent.$parent.$parent.$parent.getBadgeNumber();
}, 1000);
},
// 点击类别
selectCategory(index, data) {
this.activeIndex = index;
this.getWaitSort();
this.setMessage();
},
// 搜索事件
onSearch(val) {
if (val !== "") {
console.log(this.search)
if (this.activeIndex == 0) {
let formData = new FormData();
formData.append("status", 0);
formData.append("keyword", this.searchVal);
this.getWaitList(formData);
} else if (this.activeIndex == 1) {
let formData = new FormData();
formData.append("status", 1);
formData.append("keyword", this.searchVal);
this.getWaitList(formData);
} else if (this.activeIndex == 2) {
let formData = new FormData();
formData.append("keyword", this.searchVal);
this.getWaitList(formData);
}
},
setMessage() {
sessionStorage.setItem("activeNames", this.actives);
sessionStorage.setItem("activeIndex", this.activeIndex);
},
//根据类别请求接口
getWaitSort() {
if (this.activeIndex == 0) {
let formData = new FormData();
formData.append("status", 0);
this.getWaitList(formData);
} else if (this.activeIndex == 1) {
let formData = new FormData();
formData.append("status", 1);
this.getWaitList(formData);
} else if (this.activeIndex == 2) {
this.getWaitList();
}
},
// // 下拉刷新事件
// onRefresh() {
// // 清空列表数据
// this.finished = false;
// // 重新加载数据
// // 将 loading 设置为 true,表示处于加载状态
// this.loading = true;
// this.onLoad();
// },
// // 列表初始化函数
// onLoad() {
// setTimeout(() => {
// if (this.refreshing) {
// this.refreshing = false;
// }
// 请求消息接口方法
getWaitList(Data) {
waitList(Data).then((res) => {
this.waitList = res.rows;
});
},
touchstart(index, item) {
this.$router.push({
path: item.appUrl,
query: {},
});
},
// // 加载完成后将loading改成 false
// this.loading = false;
// // 为什么会连续触发 load 事件? 先加上这句 this.finished = true; 以后再删
......@@ -127,6 +187,7 @@ export default {
<style lang="less" scoped>
/* @import url(); 引入css类 */
.message-wrap {
min-height: 58vh;
padding: 10px 10px 0;
background-color: #f0f1f5;
// 标签
......@@ -164,11 +225,21 @@ export default {
.van-cell-group--inset {
margin: 0;
margin-bottom: 10px;
padding: 10px;
font-size: 13px;
padding: 10px;
.message-content {
margin-top: 10px;
}
.messgae-title {
display: flex;
justify-content: space-between;
align-items: center;
}
.bot_but {
display: flex;
justify-content: right;
align-items: center;
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment