提交 c330ad9e authored 作者: xuyanwei's avatar xuyanwei

修改问题

......@@ -23,7 +23,7 @@ module.exports = {
// Various Dev Server settings
host: '192.168.2.39', // can be overwritten by process.env.HOST
host: '192.168.2.40', // can be overwritten by process.env.HOST
port: 8082, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
autoOpenBrowser: false,
errorOverlay: true,
......
......@@ -135,3 +135,21 @@ export function getFilePathAPI(params) {
method: 'get',
})
}
//获取留言板列表
export function getMessageListAPI(params) {
return request({
url: `${requestPath.commonfg}/message/page`,
method: 'get',
params
})
}
//发送留言
export function sendMessageAPI(data) {
return request({
url: `${requestPath.commonfg}/message/add`,
method: 'post',
data
})
}
......@@ -14,7 +14,7 @@
return {
link:[
{tit:'首页',icon:'./static/img/home.png',iconHover:'./static/img/home-h.png',curLink:'/'},
{tit:'留言板',icon:'./static/img/massage.png',iconHover:'./static/img/massage-h.png',curLink:''},
{tit:'留言板',icon:'./static/img/massage.png',iconHover:'./static/img/massage-h.png',curLink:'/messageBoard'},
{tit:'我的',icon:'./static/img/me.png',iconHover:'./static/img/me-h.png',curLink:'/my'},
],
}
......
......@@ -21,4 +21,7 @@ input,button,select,textarea{outline:none;font-family:'微软雅黑',Helvetica N
text-align: center;
}
#app .play .video{width: 100%; height: 80%;overflow: hidden}
#app .play .video .xgplayer{width: 100%; max-height: 100%!important;}
......@@ -97,14 +97,16 @@ Vue.prototype.userName=function(val){
return name;
}
/*router.beforeEach((to, from, next) => { //to: Route:即将要进入的目标路由对象//from: Route:当前导航正要离开的路由//next: Function: 一定要调用该方法来resolve 这个钩子执行效果依赖 next 方法的调用参数。
if(from.name=='play'||from.name=="pdf"){
to.meta.isBack=true;
Vue.prototype.timeE=function(val){
if(val&&val.length>16){
val=val.slice(0,16);
}
next()
})*/
return val;
}
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
......
......@@ -229,6 +229,18 @@ let router = new Router({
},
component: () => import('@/views/answerRecord/index.vue'),
},
/*留言板 X*/
{
path: '/messageBoard',
name: 'messageBoard',
meta: {
title: "留言板",
keepAlive: true, //此组件需要被缓存
isBack:false, //用于判断上一个页面是哪个
isLogin: true
},
component: () => import('@/views/messageBoard/index.vue'),
},
]
})
export default router
......
......@@ -34,7 +34,7 @@ let store = new Vuex.Store({
Cookies.set('Y-Token', null);
Cookies.set('userId', null);
Cookies.set('isFirstLogin', '');
router.push('/');
router.push('/login');
},
......
......@@ -3,12 +3,12 @@
<div class="business">
<comHeader></comHeader>
<ul class="content">
<van-list v-model="loading"
:immediate-check="false"
:finished="finished"
finished-text="——这是我的底线——"
@load="onLoad">
<li v-for="(item,index) in list" :key="index" @click="linkDetails(item)">
<van-list v-model="loading"
:immediate-check="false"
:finished="finished"
:finished-text="noHave"
@load="onLoad">
<li v-for="(item,index) in list" :key="index" @click="linkDetails(item)">
<div class="title"><img :src="`./static/img/${item.resourceType==5?'video':'pdf'}.png`" alt="">
<h1>{{item.name}}</h1></div>
<p v-if="item.test">{{item.test}}</p>
......@@ -20,8 +20,9 @@
</template>
<script>
import { getResListAPI } from '@/api/xywApi';
import { Icon ,NavBar,List ,Toast } from 'vant';
import {getResListAPI} from '@/api/xywApi';
import {Icon, NavBar, List, Toast} from 'vant';
export default {
name: 'HelloWorld',
data() {
......@@ -35,44 +36,54 @@
],
loading: false,
finished: false,
listQuery:{
listQuery: {
pageNum: 1,
pageSize: 20,
diyTypeCode:''
diyTypeCode: ''
},
pageCount:0,
isFirstEnter:false,
showName:null,
total:0,
toastPage:null,
pageCount: 0,
isFirstEnter: false,
showName: null,
total: 0,
toastPage: null,
noHave: '',
}
},
components: {
"van-icon":Icon,
"van-nav-bar":NavBar,
"van-list":List
"van-icon": Icon,
"van-nav-bar": NavBar,
"van-list": List
},
created() {
this.isFirstEnter=true;
this.listQuery.diyTypeCode=this.$route.query.code;
this.showName=this.$route.query.showName;
this.getList ();
this.isFirstEnter = true;
this.listQuery.diyTypeCode = this.$route.query.code;
this.showName = this.$route.query.showName;
/*this.getList ();*/
},
watch: {},
methods: {
getList () {
getList() {
this.noHave='';
this.toastPage = Toast.loading({
message: '加载中...',
forbidClick: true,
loadingType: 'spinner',
duration: 0
});
getResListAPI({ ...this.listQuery }).then(res=>{
getResListAPI({...this.listQuery}).then(res => {
if (res.data.status) {
if (res.data.data.list.length > 0 && res.data.data.list) {
this.list = res.data.data.list;
this.total = res.data.data.total || 0;
this.pageCount = res.data.data.pages;
}
this.total = res.data.data.total || 0;
this.pageCount = res.data.data.pages;
if (this.total == 0) {
this.finished = true;
this.noHave = '暂无数据';
} else if (this.pageCount == 1) {
this.finished = true;
this.noHave = '——这是我的底线——';
}
this.toastPage.clear();
} else {
......@@ -80,64 +91,66 @@
}
})
},
onLoad(){
setTimeout(()=>{
onLoad() {
if(this.total==0||this.pageCount==1)return
setTimeout(() => {
this.getMoreList();
},500)
}, 500)
},
getMoreList(){
if (this.listQuery.pageNum < this.pageCount) {
this.listQuery.pageNum++;
getResListAPI({ ...this.listQuery }).then(res => {
this.loading = true;
if (res.data.status) {
if (res.data.data.list.length > 0 && res.data.data.list) {
this.list = [ ...this.list,...res.data.data.list];
this.total = res.data.data.total || 0;
// 加载状态结束
this.loading = false;
}
} else {
Toast.fail('检索信息获取失败');
getMoreList() {
if (this.listQuery.pageNum < this.pageCount) {
this.listQuery.pageNum++;
getResListAPI({...this.listQuery}).then(res => {
this.loading = true;
if (res.data.status) {
if (res.data.data.list.length > 0 && res.data.data.list) {
this.list = [...this.list, ...res.data.data.list];
this.total = res.data.data.total || 0;
// 加载状态结束
this.loading = false;
}
})
} else {//数据加载完成
this.finished = true;
}
} else {
Toast.fail('检索信息获取失败');
}
})
} else {//数据加载完成
this.finished = true;
this.noHave = '——这是我的底线——';
}
},
linkDetails(item){
if(item.resourceType==5){
this.$router.push({path:'/play',query:{videoAndPdf:item.videoAndPdf,id:item.id}});
}else if(item.resourceType==10){
this.$router.push({path:'/pdf',query:{videoAndPdf:item.videoAndPdf,id:item.id}});
linkDetails(item) {
if (item.resourceType == 5) {
this.$router.push({path: '/play', query: {videoAndPdf: item.videoAndPdf, id: item.id}});
} else if (item.resourceType == 10) {
this.$router.push({path: '/pdf', query: {videoAndPdf: item.videoAndPdf, id: item.id}});
}
}
},
activated() {
if(!this.$route.meta.isBack|| this.isFirstEnter){
this.list=[];// 把数据清空,可以稍微避免让用户看到之前缓存的数据
if (!this.$route.meta.isBack || this.isFirstEnter) {
this.list = [];// 把数据清空,可以稍微避免让用户看到之前缓存的数据
// 如果isBack是false,表明需要获取新数据,否则就不再请求,直接使用缓存的数据
this.loading=false;
this.finished=false;
this.listQuery={
this.loading = false;
this.finished = false;
this.listQuery = {
pageNum: 1,
pageSize: 20,
diyTypeCode:''
},
this.listQuery.diyTypeCode=this.$route.query.code;
this.showName=this.$route.query.showName;
this.getList ();
diyTypeCode: ''
};
this.listQuery.diyTypeCode = this.$route.query.code;
this.showName = this.$route.query.showName;
this.getList();
// console.log(this.$route.meta.isBack,this.isFirstEnter,'this')
}
// 恢复成默认的false,避免isBack一直是true,导致下次无法获取数据
this.$route.meta.isBack=false
this.isFirstEnter=false;
this.$route.meta.isBack = false
this.isFirstEnter = false;
},
}
</script>
......@@ -147,11 +160,13 @@
.business {
width: 100%;
padding-top: .5rem;
.content {
li {
margin: 0 .15rem;
padding: .1rem 0;
border-bottom: 1px solid #EEEEEE;
.title {
display: flex;
justify-content: flex-start;
......
......@@ -18,7 +18,7 @@
<van-list v-model="loading"
:immediate-check="false"
:finished="finished"
finished-text="——这是我的底线——"
:finished-text="noHave"
@load="onLoad">
<li v-for="(item,index) in list" :key="index" @click="linkDetails(item)">
<div class="title"><img :src="`./static/img/${item.type==6?'video':'pdf'}.png`" alt="">
......@@ -57,6 +57,7 @@
},
pageCount:0,
isFirstEnter:false,
noHave:'',//
}
},
created() {
......@@ -95,8 +96,8 @@
})
},
getList(n){
console.log(22222333)
this.loading = true;
this.noHave='';
if(n==1){//页面进来
this.list=[];
this.dataFn(this.listQuery);
......@@ -107,6 +108,7 @@
this.dataFn(this.listQuery);
} else {//数据加载完成
this.finished = true;
this.noHave='——这是我的底线——';
}
},
dataFn(data){
......@@ -115,6 +117,13 @@
this.list=res.data.data.list;
this.total = res.data.data.total || 0;
this.pageCount = res.data.data.pages;
if(this.total==0){
this.finished = true;
this.noHave='暂无数据';
}else if(res.data.data.pages==1){
this.finished = true;
this.noHave='——这是我的底线——';
}
}
this.loading = false;
})
......
<template>
<!--留言板-->
<div class="messageBoard">
<ul class="tab">
<li :class="curTab==index&&'active'" v-for="(item,index) in ['全部留言','我的留言']" @click="curTab=index">{{item}}</li>
</ul>
<ul class="dataList">
<van-list v-model="loading"
:immediate-check="false"
:finished="finished"
:finished-text="noHave"
@load="onLoad">
<li v-for="(itD,inD) in dataList" :key="inD">
<div class="createName"><h1>{{itD.realName}}</h1>{{timeE(itD.releaseTime)}}</div>
<p>{{itD.content}}</p>
<div class="replyName" v-if="itD.replyContent"><h2>管理员回复</h2>{{timeE(itD.replyTime)}}</div>
<p>{{itD.replyContent}}</p>
</li>
</van-list>
</ul>
<div class="want" @click="isShow=true,message=''">
<img src="../../assets/img/list/message.png" alt="">
</div>
<Foot></Foot>
<!--留言弹出框-->
<div class="pop" v-if="isShow">
<div class="popClose"><img src="../../assets/img/list/ft_icon_guanbi.png" alt="" @click="isShow=false"></div>
<div class="popText">
<textarea cols="30" rows="10" v-model="message" placeholder="请输入留言内容..."></textarea>
<!--<h1>{{message.length}}/300</h1>-->
<button @click="sendTo">提交</button>
</div>
</div>
</div>
</template>
<script>
import {Icon, NavBar, List, Toast,Field} from 'vant';
import Foot from "../../components/Foot";
import {getMessageListAPI,sendMessageAPI} from '../../api/xywApi';
export default {
name: 'HelloWorld',
data() {
return {
curTab:0,
message:'',
isShow:false,
loading: false,
finished: false,
dataList:[],
listQuery:{
pageNum: 1,
pageSize: 20,
queryCondition:0
},
pageCount:0,
total:0,
noHave:'',
}
},
components: {
"van-icon": Icon,
"van-nav-bar": NavBar,
"van-list": List,
"van-field": Field,
Foot:Foot,
},
created() {
this.getList();
},
watch: {
curTab(n,o){
this.listQuery.pageNum=1;
this.listQuery.queryCondition=n;
this.dataList=[];
this.getList();
},
},
methods: {
onLoad(){
if (this.listQuery.pageNum*20 < this.total) {
this.listQuery.pageNum++;
this.getList();
}else{
this.finished = true;
this.noHave='——这是我的底线——';
}
},
getList(){
this.noHave='';
/*this.loading = true;*/
getMessageListAPI(this.listQuery).then(res => {
if (res.data.status) {
this.dataList = [...this.dataList, ...res.data.data.list];
this.total=res.data.data.total||0;
/*this.pageCount = res.data.data.pages;*/
if(res.data.data.total==0){
this.finished = true;
this.noHave='暂无数据';
}else if(res.data.data.pages==1){
this.finished = true;
this.noHave='——这是我的底线——';
}
}
this.loading = false;
})
},
/*发留言*/
sendTo(){
if(this.message.trim()==''){
Toast.fail('请输入留言内容');
return
}
var regStr = /[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF][\u200D|\uFE0F]|[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF]|[0-9|*|#]\uFE0F\u20E3|[0-9|#]\u20E3|[\u203C-\u3299]\uFE0F\u200D|[\u203C-\u3299]\uFE0F|[\u2122-\u2B55]|\u303D|[\A9|\AE]\u3030|\uA9|\uAE|\u3030/ig;
if(regStr.test(this.message)){
Toast.fail('暂不支持表情输入');
return
}
sendMessageAPI({
'content':this.message,
}).then(res=>{
if(res.data.status){
Toast.success('留言发送成功');
this.isShow=false;
this.listQuery.pageNum=1;
/*this.getList();*/
}else{
Toast.fail('留言发送失败');
}
})
},
},
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="less">
.messageBoard {
width: 100%;
height: 100%;
background: #f2f2f2;
overflow: auto;
.tab{
width: 100%;
height: .44rem;
color: #fff;
background: #02A8AB;
font-size: .15rem;font-weight: bold;
display: flex;
align-items: center;
justify-content: center;
.active{font-size: .18rem;}
li{
padding: 0 .25rem;
}
}
.dataList{
li{
padding: .12rem .15rem;
border-bottom: .1rem solid #f2f2f2;
background: #fff;
.createName{
color: #212020;
font-size: .13rem;
display: flex;
align-items: center;
line-height: .36rem;
h1{font-size: .15rem;height: .36rem;}
}
p{
color: #818389;font-size: .14rem;line-height: .22rem;/*padding-bottom: .1rem;*/
}
.replyName{
border-top: 1px solid #eee;
color: #FB6E53;
font-size: .13rem;
line-height: .36rem;
display: flex;
align-items: center;
margin-top: .1rem;
padding-top: .05rem;
h2{
height: .36rem;
font-size: .15rem;height: .36rem;line-height: .36rem
}
}
}
}
.want{
width: .6rem;
height: .6rem;
position: fixed;
right: .1rem;
bottom: 1rem;
img{
width: .6rem;
height: .6rem;
}
}
.pop{
position: fixed;
z-index: 1111;
bottom: 0;
left:0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.3);
display: flex;
justify-content: flex-end;
flex-direction: column;
.popClose{width:100%;height: .182rem;padding-bottom: .155rem;
display: flex;
justify-content: flex-end;
img{
width: .185rem;height: .182rem;
padding-right: .125rem;
}}
.popText{
height:30%;
width: 3.45rem;
padding: .15rem .15rem .02rem .15rem;
background: #fff;
textarea{width: 100%;height:calc(100% - .85rem);font-size: .15rem;border:none;resize: none}
::-webkit-input-placeholder { /* WebKit browsers */
color: #B9BDC6;
}
::-moz-placeholder { /* Mozilla Firefox 19+ */
color: #B9BDC6;
}
:-ms-input-placeholder { /* Internet Explorer 10+ */
color: #B9BDC6;
}
h1{ color: #999999;font-size: .12rem; font-weight: normal;text-align: right}
button{
background: url("../../assets/img/list/ft_but_fabu.png") no-repeat;
width:.52rem;
height: .315rem;
text-align: center;
line-height: .315rem;
color: #FDFDFD;
font-size: .14rem;
border: none;
margin-top: .2rem;
float: right;display: block;
}
}
}
}
</style>
......@@ -108,7 +108,7 @@
align-items: center;
.video{
width: 100%;
height: 2.15rem;
/*height: 2.15rem;*/
background: rgba(255,255,255,0.2);
display: flex;
align-items: center;
......
......@@ -18,7 +18,7 @@
return {
list:[
{name:'竞赛通知附件.docx',link:'./static/file/竞赛通知附件.docx'},
{name:'公共就业服务专项业务竞赛前台需求说明书.doc',link:'公共就业服务专项业务竞赛前台需求说明书.doc'},
{name:'竞赛通知.docx',link:'./static/file/竞赛通知.docx'},
]
}
},
......
No preview for this file type
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论