|
|
|
|
@ -1,7 +1,7 @@ |
|
|
|
|
<template> |
|
|
|
|
<div class="guidance"> |
|
|
|
|
<div class="guide_title">{{ article.title }}</div> |
|
|
|
|
<div v-html="article.content" class="guide_contant" ref="scrollView" id="scroll-view" ></div> |
|
|
|
|
<div v-html="article.content" class="guide_contant" ref="scrollView" id="scroll-view"></div> |
|
|
|
|
<div class="guide_btn"> |
|
|
|
|
<div class="guide_actBtn" @click="doCancel">取消</div> |
|
|
|
|
<div class="guide_actBtn blue" @click="doRead">已阅读</div> |
|
|
|
|
@ -10,31 +10,42 @@ |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
import {queryArticleDetail} from "@/api/hospital"; |
|
|
|
|
import { queryArticleDetail } from "@/api/hospital"; |
|
|
|
|
export default { |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
isFlag: false,//是否阅读到底部 |
|
|
|
|
article:{ |
|
|
|
|
title:'', |
|
|
|
|
content:'' |
|
|
|
|
article: { |
|
|
|
|
title: '', |
|
|
|
|
content: '' |
|
|
|
|
},//须知内容 |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
mounted() { |
|
|
|
|
if(this.$route.query.deptId){ |
|
|
|
|
if (this.$route.query.deptId) { |
|
|
|
|
this.queryAticle(this.$route.query.deptId); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
//须知详情 |
|
|
|
|
queryAticle(id) { |
|
|
|
|
queryArticleDetail(id).then(res => { |
|
|
|
|
if(JSON.stringify(res.data) != '{}'){ |
|
|
|
|
res.data.content = decodeURIComponent(res.data.content); |
|
|
|
|
this.article = res.data; |
|
|
|
|
} |
|
|
|
|
this.$toast.loading({ |
|
|
|
|
message: '加载中', |
|
|
|
|
duration: 0, |
|
|
|
|
}) |
|
|
|
|
try { |
|
|
|
|
queryArticleDetail(id).then(res => { |
|
|
|
|
this.$toast.clear(); |
|
|
|
|
if (JSON.stringify(res.data) != '{}') { |
|
|
|
|
res.data.content = decodeURIComponent(res.data.content); |
|
|
|
|
this.article = res.data; |
|
|
|
|
} |
|
|
|
|
}, err => { |
|
|
|
|
this.$toast.clear(); |
|
|
|
|
}) |
|
|
|
|
} catch (error) { |
|
|
|
|
this.$toast.clear(); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
//取消 |
|
|
|
|
doCancel() { |
|
|
|
|
@ -43,11 +54,11 @@ export default { |
|
|
|
|
//已阅读 |
|
|
|
|
doRead() { |
|
|
|
|
let readBox = this.$refs.scrollView; |
|
|
|
|
console.log(readBox.scrollHeight,readBox.scrollTop,readBox.clientHeight) |
|
|
|
|
if(readBox.scrollHeight - readBox.scrollTop !== readBox.clientHeight){ |
|
|
|
|
console.log(readBox.scrollHeight, readBox.scrollTop, readBox.clientHeight) |
|
|
|
|
if (readBox.scrollHeight - readBox.scrollTop !== readBox.clientHeight) { |
|
|
|
|
console.log('未阅读完成'); |
|
|
|
|
this.isFlag = false; |
|
|
|
|
}else{ |
|
|
|
|
} else { |
|
|
|
|
this.isFlag = true; |
|
|
|
|
} |
|
|
|
|
if (!this.isFlag) { |
|
|
|
|
@ -66,7 +77,7 @@ export default { |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
//阅读完整 |
|
|
|
|
this.$router.replace({ name: 'examination', query:{id: this.$route.query.deptId} }) |
|
|
|
|
this.$router.replace({ name: 'examination', query: { id: this.$route.query.deptId } }) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
//监听阅读进度 |
|
|
|
|
@ -75,7 +86,7 @@ export default { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
const { scrollTop, clientHeight, scrollHeight } = e.target; |
|
|
|
|
console.log(scrollTop,clientHeight,scrollHeight) |
|
|
|
|
console.log(scrollTop, clientHeight, scrollHeight) |
|
|
|
|
if ((scrollTop + clientHeight) >= (scrollHeight - 5) || scrollTop == 0) { |
|
|
|
|
this.isFlag = true; |
|
|
|
|
console.log('阅读完成') |
|
|
|
|
@ -110,7 +121,8 @@ export default { |
|
|
|
|
overflow-y: auto; |
|
|
|
|
margin: 0.93rem 0.4rem 0 0; |
|
|
|
|
padding: 0 0.4rem; |
|
|
|
|
img{ |
|
|
|
|
|
|
|
|
|
img { |
|
|
|
|
max-width: 100% !important; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|