文档资料加下拉刷新

This commit is contained in:
2023-08-29 14:28:08 +08:00
parent 0b26ff7122
commit 1d5b7a535b
2 changed files with 50 additions and 27 deletions

View File

@ -11,7 +11,7 @@
> >
<template slot="title"> <template slot="title">
<div v-show="!show">文档资料</div> <div v-show="!show">文档资料</div>
<van-field v-model="keyword" placeholder="请输入关键词" v-show="show" @keyup.enter="getList"/> <van-field v-model="keyword" placeholder="请输入关键词" v-show="show" @input="getList"/>
</template> </template>
<template slot="right"> <template slot="right">
<div class="rightWrap" @click="show = !show"> <div class="rightWrap" @click="show = !show">
@ -29,25 +29,27 @@
</div> </div>
</div> </div>
<div class="contentWrap" v-show="!showEmpty"> <div class="contentWrap" v-show="!showEmpty">
<div class="itemWrap" v-for="(item,index) in pageList" :key="index"> <van-pull-refresh v-model="isLoading" @refresh="onRefresh" style="min-height:85vh">
<div class="info flexBetween common"> <div class="itemWrap" v-for="(item,index) in pageList" :key="index" @click="goH5Detail(item)">
<div class="title">{{ item.pushUser }}</div> <div class="info flexBetween common">
<div class="time">{{ item.pushTime }}</div> <div class="title">{{ item.pushUser }}</div>
</div> <div class="time">{{ item.pushTime }}</div>
<div class="imgWrap"> </div>
<img :src="item.themePicture"> <div class="imgWrap">
<div class="name">{{item.name}}</div> <img :src="item.themePicture">
</div> <div class="name">{{item.name}}</div>
<div class="num common">{{ item.synopsis }}</div> </div>
<div class="doc flexBetween common"> <div class="num common">{{ item.synopsis }}</div>
<div class="left">{{ item.docType?.label }}</div> <div class="doc flexBetween common">
<div class="right"> <div class="left">{{ item.docType?.label }}</div>
<span style="color: red;font-size: 14px;margin-right: 8px">{{ item.listShowButton==null ? '已处理' : '未处理' }}</span> <div class="right">
<span style="opacity: .9;color: #ccc">阅读 {{item.readCount}}</span> <span style="color: red;font-size: 14px;margin-right: 8px">{{ item.listShowButton==null ? '已处理' : '未处理' }}</span>
<span style="opacity: .9;color: #ccc">阅读 {{item.readCount}}</span>
</div>
</div> </div>
</div> </div>
</div> </van-pull-refresh>
</div> </div>
<div class="empty" style="display: flex;justify-content: center;align-items: center;height:calc(100% - 86px);background-color: #FAFAFA" v-show="showEmpty"> <div class="empty" style="display: flex;justify-content: center;align-items: center;height:calc(100% - 86px);background-color: #FAFAFA" v-show="showEmpty">
<img src="@/assets/empty.png" style="width: 100%"/> <img src="@/assets/empty.png" style="width: 100%"/>
</div> </div>
@ -69,6 +71,7 @@ export default {
pageSize:10, pageSize:10,
keyword:'', keyword:'',
trainingType:1, trainingType:1,
isLoading:false,
show:false, show:false,
showEmpty:false showEmpty:false
} }
@ -77,6 +80,28 @@ export default {
this.getList() this.getList()
}, },
methods:{ methods:{
goH5Detail(item){
let data = {
"action": "goTraining",
"params": {
"id": item.id,
}
};
let u = navigator.userAgent;
let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
if(isiOS){
window.webkit.messageHandlers.nativeObject.postMessage(data);
}else {
window.android.sendMessage("articleId=" + item.id);
}
},
onRefresh() {
this.getList()
setTimeout(() => {
this.$toast('刷新成功');
this.isLoading = false;
}, 1000);
},
async changeTab(index) { async changeTab(index) {
this.activeIndex = index this.activeIndex = index
this.pageNum = 1 this.pageNum = 1
@ -161,6 +186,7 @@ export default {
padding: 0 8px; padding: 0 8px;
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
.itemWrap{ .itemWrap{
margin-top: 16px; margin-top: 16px;
@include wh(100%, 300px); @include wh(100%, 300px);

View File

@ -23,7 +23,7 @@
</div> </div>
<div class="contentWrap" v-show="!showEmpty"> <div class="contentWrap" v-show="!showEmpty">
<van-pull-refresh v-model="isLoading" @refresh="onRefresh"> <van-pull-refresh v-model="isLoading" @refresh="onRefresh" style="min-height:85vh">
<div class="itemWrap" v-for="(item,index) in pageList" :key="index" @click="goH5Detail(item)"> <div class="itemWrap" v-for="(item,index) in pageList" :key="index" @click="goH5Detail(item)">
<div class="info flexBetween common"> <div class="info flexBetween common">
<div class="title">{{ item.pushUser }}</div> <div class="title">{{ item.pushUser }}</div>
@ -87,14 +87,11 @@ export default {
}; };
let u = navigator.userAgent; let u = navigator.userAgent;
let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
// if (window.MyAppBridge) { if(isiOS){
if(isiOS){ window.webkit.messageHandlers.nativeObject.postMessage(data);
window.webkit.messageHandlers.nativeObject.postMessage(data); }else {
}else { window.android.sendMessage("articleId=" + item.id);
window.android.sendMessage("articleId=" + item.id); }
}
// }
// window.location.href = `http://crm1.sino-assist.com/res/training/training.html?id=${item.id}&source=supplierApp&supplierId=${this.supplierId}&userId=${this.userId}`;
}, },
onRefresh() { onRefresh() {
this.getList() this.getList()