This commit is contained in:
zoujiandong 2025-06-13 19:09:30 +08:00
parent 518a5d1b47
commit a31fc3c1e6
40 changed files with 4210 additions and 532 deletions

View File

@ -18,6 +18,7 @@ const api = {
getHomeStatics(data) { //首页统计数据
return request('/clinical/stats', data, 'get', true);
},
getArticleDetail(id) { //获取详情
return request('/clinical/article/'+id,{}, 'get', false);
},
@ -82,6 +83,9 @@ const api = {
getStaticDoctor(id){
return request('/clinical/stats/doctor/'+id,{}, 'get',false);
},
getStaticSick(data) { //首页统计数据
return request('/clinical/stats/label', data, 'get', false);
},
getStaticHospital(id){
return request('/clinical/stats/hospital/'+id, {}, 'get',false);
},
@ -152,7 +156,7 @@ const api = {
return request('/user/collect/search',data, 'post',false,'application/json');
},
getMyRead(data){
return request('/user/case/read/search',data, 'post',false,'application/json');
return request('/user/case/read/search',data, 'post',true,'application/json');
},
getOss(data){
return request('/sign/oss',data, 'get', false);
@ -160,11 +164,21 @@ const api = {
getCaseLabel(data){
return request('/case/label',data,'get', false);
},
getSearchLabel(data){
return request('/clinical/label/search',data,'post', true,'application/json');
},
addVote(id,data){
return request('/exchange/vote/'+id,data,'post',true,'application/json');
},
ossUpload(url,data){
return request(url,data,'post','multipart/form-data')
},
getUserPoint(data){
return request('/user/point',data,'get');
},
givePoint(data){
return request('/reward',data,'post',true);
}
}

View File

@ -59,6 +59,8 @@ watch(()=>props.type,(newVal)=>{
placeholder.value='输入医生姓名'
}else if(newVal==='hospital'){
placeholder.value='输入医院名称'
}else if(newVal==='video' || newVal==='article' || newVal==='case' ){
placeholder.value='搜索疾病、症状、医院'
}
},{immediate: true })

View File

@ -0,0 +1,27 @@
<template>
<!--增加audio标签支持-->
<audio
:id="node.attr.id"
:class="node.classStr"
:style="node.styleStr"
:src="node.attr.src"
:loop="node.attr.loop"
:poster="node.attr.poster"
:name="node.attr.name"
:author="node.attr.author"
controls></audio>
</template>
<script>
export default {
name: 'wxParseAudio',
props: {
node: {
type: Object,
default() {
return {};
},
},
},
};
</script>

View File

@ -0,0 +1,86 @@
<template>
<image
:mode="node.attr.mode"
:lazy-load="node.attr.lazyLoad"
:class="node.classStr"
:style="newStyleStr || node.styleStr"
:data-src="node.attr.src"
:src="node.attr.src"
@tap="wxParseImgTap"
@load="wxParseImgLoad"
/>
</template>
<script>
export default {
name: 'wxParseImg',
data() {
return {
newStyleStr: '',
preview: true,
};
},
props: {
node: {
type: Object,
default() {
return {};
},
},
},
methods: {
wxParseImgTap(e) {
if (!this.preview) return;
const { src } = e.currentTarget.dataset;
if (!src) return;
let parent = this.$parent;
while(!parent.preview || typeof parent.preview !== 'function') {// TODO
parent = parent.$parent;
}
parent.preview(src, e);
},
//
wxParseImgLoad(e) {
const { src } = e.currentTarget.dataset;
if (!src) return;
const { width, height } = e.mp.detail;
const recal = this.wxAutoImageCal(width, height);
const { imageheight, imageWidth } = recal;
const { padding, mode } = this.node.attr;
const { styleStr } = this.node;
const imageHeightStyle = mode === 'widthFix' ? '' : `height: ${imageheight}px;`;
this.newStyleStr = `${styleStr}; ${imageHeightStyle}; width: ${imageWidth}px; padding: 0 ${+padding}px;`;
},
//
wxAutoImageCal(originalWidth, originalHeight) {
//
const { padding } = this.node.attr;
const windowWidth = this.node.$screen.width - (2 * padding);
const results = {};
if (originalWidth < 60 || originalHeight < 60) {
const { src } = this.node.attr;
let parent = this.$parent;
while(!parent.preview || typeof parent.preview !== 'function') {
parent = parent.$parent;
}
parent.removeImageUrl(src);
this.preview = false;
}
//
if (originalWidth > windowWidth) {
// widthwidth
results.imageWidth = windowWidth;
results.imageheight = windowWidth * (originalHeight / originalWidth);
} else {
//
results.imageWidth = originalWidth;
results.imageheight = originalHeight;
}
return results;
},
},
};
</script>

View File

@ -0,0 +1,107 @@
<template>
<view>
<!--判断是否是标签节点-->
<block v-if="node.node == 'element'">
<block v-if="node.tag == 'button'">
<button type="default" size="mini">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</button>
</block>
<!--li类型-->
<block v-else-if="node.tag == 'li'">
<view :class="node.classStr" :style="node.styleStr">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</view>
</block>
<!--video类型-->
<block v-else-if="node.tag == 'video'">
<wx-parse-video :node="node" />
</block>
<!--audio类型-->
<block v-else-if="node.tag == 'audio'">
<wx-parse-audio :node="node" />
</block>
<!--img类型-->
<block v-else-if="node.tag == 'img'">
<wx-parse-img :node="node" />
</block>
<!--a类型-->
<block v-else-if="node.tag == 'a'">
<view @click="wxParseATap" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</view>
</block>
<!--table类型-->
<block v-else-if="node.tag == 'table'">
<view :class="node.classStr" class="table" :style="node.styleStr">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</view>
</block>
<!--br类型-->
<block v-else-if="node.tag == 'br'">
<text>\n</text>
</block>
<!--其他标签-->
<block v-else>
<view :class="node.classStr" :style="node.styleStr">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</view>
</block>
</block>
<!--判断是否是文本节点-->
<block v-else-if="node.node == 'text'">{{node.text}}</block>
</view>
</template>
<script>
import wxParseTemplate from './wxParseTemplate1';
import wxParseImg from './wxParseImg';
import wxParseVideo from './wxParseVideo';
import wxParseAudio from './wxParseAudio';
export default {
name: 'wxParseTemplate0',
props: {
node: {},
},
components: {
wxParseTemplate,
wxParseImg,
wxParseVideo,
wxParseAudio,
},
methods: {
wxParseATap(e) {
const {
href
} = e.currentTarget.dataset;// TODO currentTargetdataset
if (!href) return;
let parent = this.$parent;
while(!parent.preview || typeof parent.preview !== 'function') {// TODO
parent = parent.$parent;
}
parent.navigate(href, e);
},
},
};
</script>

View File

@ -0,0 +1,99 @@
<template>
<view :class="(node.tag == 'li' ? node.classStr : (node.node==='text'?'text':''))">
<!--判断是否是标签节点-->
<block v-if="node.node == 'element'">
<block v-if="node.tag == 'button'">
<button type="default" size="mini">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</button>
</block>
<!--li类型-->
<block v-else-if="node.tag == 'li'">
<!-- <view :class="node.classStr" :style="node.styleStr"> -->
<view :style="node.styleStr">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</view>
</block>
<!--video类型-->
<block v-else-if="node.tag == 'video'">
<wx-parse-video :node="node" />
</block>
<!--audio类型-->
<block v-else-if="node.tag == 'audio'">
<wx-parse-audio :node="node" />
</block>
<!--img类型-->
<block v-else-if="node.tag == 'img'">
<wx-parse-img :node="node" />
</block>
<!--a类型-->
<block v-else-if="node.tag == 'a'">
<view @click="wxParseATap" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</view>
</block>
<!--br类型-->
<block v-else-if="node.tag == 'br'">
<text>\n</text>
</block>
<!--其他标签-->
<block v-else>
<view :class="node.classStr" :style="node.styleStr">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</view>
</block>
</block>
<!--判断是否是文本节点-->
<block v-else-if="node.node == 'text'">{{node.text}}</block>
</view>
</template>
<script>
import wxParseTemplate from './wxParseTemplate2';
import wxParseImg from './wxParseImg';
import wxParseVideo from './wxParseVideo';
import wxParseAudio from './wxParseAudio';
export default {
name: 'wxParseTemplate1',
props: {
node: {},
},
components: {
wxParseTemplate,
wxParseImg,
wxParseVideo,
wxParseAudio,
},
methods: {
wxParseATap(e) {
const {
href
} = e.currentTarget.dataset;
if (!href) return;
let parent = this.$parent;
while(!parent.preview || typeof parent.preview !== 'function') {
parent = parent.$parent;
}
parent.navigate(href, e);
},
},
};
</script>

View File

@ -0,0 +1,97 @@
<template>
<view>
<!--判断是否是标签节点-->
<block v-if="node.node == 'element'">
<block v-if="node.tag == 'button'">
<button type="default" size="mini">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</button>
</block>
<!--li类型-->
<block v-else-if="node.tag == 'li'">
<view :class="node.classStr" :style="node.styleStr">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</view>
</block>
<!--video类型-->
<block v-else-if="node.tag == 'video'">
<wx-parse-video :node="node" />
</block>
<!--audio类型-->
<block v-else-if="node.tag == 'audio'">
<wx-parse-audio :node="node" />
</block>
<!--img类型-->
<block v-else-if="node.tag == 'img'">
<wx-parse-img :node="node" />
</block>
<!--a类型-->
<block v-else-if="node.tag == 'a'">
<view @click="wxParseATap" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</view>
</block>
<!--br类型-->
<block v-else-if="node.tag == 'br'">
<text>\n</text>
</block>
<!--其他标签-->
<block v-else>
<view :class="node.classStr" :style="node.styleStr">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</view>
</block>
</block>
<!--判断是否是文本节点-->
<block v-else-if="node.node == 'text'">{{node.text}}</block>
</view>
</template>
<script>
import wxParseTemplate from './wxParseTemplate11';
import wxParseImg from './wxParseImg';
import wxParseVideo from './wxParseVideo';
import wxParseAudio from './wxParseAudio';
export default {
name: 'wxParseTemplate10',
props: {
node: {},
},
components: {
wxParseTemplate,
wxParseImg,
wxParseVideo,
wxParseAudio,
},
methods: {
wxParseATap(e) {
const {
href
} = e.currentTarget.dataset;
if (!href) return;
let parent = this.$parent;
while(!parent.preview || typeof parent.preview !== 'function') {
parent = parent.$parent;
}
parent.navigate(href, e);
},
},
};
</script>

View File

@ -0,0 +1,87 @@
<template>
<view>
<!--判断是否是标签节点-->
<block v-if="node.node == 'element'">
<!--button类型-->
<block v-if="node.tag == 'button'">
<button type="default" size="mini">
</button>
</block>
<!--li类型-->
<block v-else-if="node.tag == 'li'">
<view :class="node.classStr" :style="node.styleStr">
{{node.text}}
</view>
</block>
<!--video类型-->
<block v-else-if="node.tag == 'video'">
<wx-parse-video :node="node" />
</block>
<!--audio类型-->
<block v-else-if="node.tag == 'audio'">
<wx-parse-audio :node="node" />
</block>
<!--img类型-->
<block v-else-if="node.tag == 'img'">
<wx-parse-img :node="node" />
</block>
<!--a类型-->
<block v-else-if="node.tag == 'a'">
<view @click="wxParseATap" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
{{node.text}}
</view>
</block>
<!--br类型-->
<block v-else-if="node.tag == 'br'">
<text>\n</text>
</block>
<!--其他标签-->
<block v-else>
<view :class="node.classStr" :style="node.styleStr">
{{node.text}}
</view>
</block>
</block>
<!--判断是否是文本节点-->
<block v-else-if="node.node == 'text'">{{node.text}}</block>
</view>
</template>
<script>
import wxParseImg from './wxParseImg';
import wxParseVideo from './wxParseVideo';
import wxParseAudio from './wxParseAudio';
export default {
name: 'wxParseTemplate11',
props: {
node: {},
},
components: {
wxParseImg,
wxParseVideo,
wxParseAudio,
},
methods: {
wxParseATap(e) {
const {
href
} = e.currentTarget.dataset;
if (!href) return;
let parent = this.$parent;
while(!parent.preview || typeof parent.preview !== 'function') {
parent = parent.$parent;
}
parent.navigate(href, e);
},
},
};
</script>

View File

@ -0,0 +1,98 @@
<template>
<view>
<!--判断是否是标签节点-->
<block v-if="node.node == 'element'">
<block v-if="node.tag == 'button'">
<button type="default" size="mini">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</button>
</block>
<!--li类型-->
<block v-else-if="node.tag == 'li'">
<view :class="node.classStr" :style="node.styleStr">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</view>
</block>
<!--video类型-->
<block v-else-if="node.tag == 'video'">
<wx-parse-video :node="node" />
</block>
<!--audio类型-->
<block v-else-if="node.tag == 'audio'">
<wx-parse-audio :node="node" />
</block>
<!--img类型-->
<block v-else-if="node.tag == 'img'">
<wx-parse-img :node="node" />
</block>
<!--a类型-->
<block v-else-if="node.tag == 'a'">
<view @click="wxParseATap" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</view>
</block>
<!--br类型-->
<block v-else-if="node.tag == 'br'">
<text>\n</text>
</block>
<!--其他标签-->
<block v-else>
<view :class="node.classStr" :style="node.styleStr">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</view>
</block>
</block>
<!--判断是否是文本节点-->
<block v-else-if="node.node == 'text'">{{node.text}}</block>
</view>
</template>
<script>
import wxParseTemplate from './wxParseTemplate3';
import wxParseImg from './wxParseImg';
import wxParseVideo from './wxParseVideo';
import wxParseAudio from './wxParseAudio';
export default {
name: 'wxParseTemplate2',
props: {
node: {},
},
components: {
wxParseTemplate,
wxParseImg,
wxParseVideo,
wxParseAudio,
},
methods: {
wxParseATap(e) {
const {
href
} = e.currentTarget.dataset;
if (!href) return;
let parent = this.$parent;
while(!parent.preview || typeof parent.preview !== 'function') {
parent = parent.$parent;
}
parent.navigate(href, e);
},
},
};
</script>

View File

@ -0,0 +1,98 @@
<template>
<view>
<!--判断是否是标签节点-->
<block v-if="node.node == 'element'">
<block v-if="node.tag == 'button'">
<button type="default" size="mini">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</button>
</block>
<!--li类型-->
<block v-else-if="node.tag == 'li'">
<view :class="node.classStr" :style="node.styleStr">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</view>
</block>
<!--video类型-->
<block v-else-if="node.tag == 'video'">
<wx-parse-video :node="node" />
</block>
<!--audio类型-->
<block v-else-if="node.tag == 'audio'">
<wx-parse-audio :node="node" />
</block>
<!--img类型-->
<block v-else-if="node.tag == 'img'">
<wx-parse-img :node="node" />
</block>
<!--a类型-->
<block v-else-if="node.tag == 'a'">
<view @click="wxParseATap" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</view>
</block>
<!--br类型-->
<block v-else-if="node.tag == 'br'">
<text>\n</text>
</block>
<!--其他标签-->
<block v-else>
<view :class="node.classStr" :style="node.styleStr">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</view>
</block>
</block>
<!--判断是否是文本节点-->
<block v-else-if="node.node == 'text'">{{node.text}}</block>
</view>
</template>
<script>
import wxParseTemplate from './wxParseTemplate4';
import wxParseImg from './wxParseImg';
import wxParseVideo from './wxParseVideo';
import wxParseAudio from './wxParseAudio';
export default {
name: 'wxParseTemplate3',
props: {
node: {},
},
components: {
wxParseTemplate,
wxParseImg,
wxParseVideo,
wxParseAudio,
},
methods: {
wxParseATap(e) {
const {
href
} = e.currentTarget.dataset;
if (!href) return;
let parent = this.$parent;
while(!parent.preview || typeof parent.preview !== 'function') {
parent = parent.$parent;
}
parent.navigate(href, e);
},
},
};
</script>

View File

@ -0,0 +1,98 @@
<template>
<view>
<!--判断是否是标签节点-->
<block v-if="node.node == 'element'">
<block v-if="node.tag == 'button'">
<button type="default" size="mini">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</button>
</block>
<!--li类型-->
<block v-else-if="node.tag == 'li'">
<view :class="node.classStr" :style="node.styleStr">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</view>
</block>
<!--video类型-->
<block v-else-if="node.tag == 'video'">
<wx-parse-video :node="node" />
</block>
<!--audio类型-->
<block v-else-if="node.tag == 'audio'">
<wx-parse-audio :node="node" />
</block>
<!--img类型-->
<block v-else-if="node.tag == 'img'">
<wx-parse-img :node="node" />
</block>
<!--a类型-->
<block v-else-if="node.tag == 'a'">
<view @click="wxParseATap" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</view>
</block>
<!--br类型-->
<block v-else-if="node.tag == 'br'">
<text>\n</text>
</block>
<!--其他标签-->
<block v-else>
<view :class="node.classStr" :style="node.styleStr">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</view>
</block>
</block>
<!--判断是否是文本节点-->
<block v-else-if="node.node == 'text'">{{node.text}}</block>
</view>
</template>
<script>
import wxParseTemplate from './wxParseTemplate5';
import wxParseImg from './wxParseImg';
import wxParseVideo from './wxParseVideo';
import wxParseAudio from './wxParseAudio';
export default {
name: 'wxParseTemplate4',
props: {
node: {},
},
components: {
wxParseTemplate,
wxParseImg,
wxParseVideo,
wxParseAudio,
},
methods: {
wxParseATap(e) {
const {
href
} = e.currentTarget.dataset;
if (!href) return;
let parent = this.$parent;
while(!parent.preview || typeof parent.preview !== 'function') {
parent = parent.$parent;
}
parent.navigate(href, e);
},
},
};
</script>

View File

@ -0,0 +1,98 @@
<template>
<view>
<!--判断是否是标签节点-->
<block v-if="node.node == 'element'">
<block v-if="node.tag == 'button'">
<button type="default" size="mini">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</button>
</block>
<!--li类型-->
<block v-else-if="node.tag == 'li'">
<view :class="node.classStr" :style="node.styleStr">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</view>
</block>
<!--video类型-->
<block v-else-if="node.tag == 'video'">
<wx-parse-video :node="node" />
</block>
<!--audio类型-->
<block v-else-if="node.tag == 'audio'">
<wx-parse-audio :node="node" />
</block>
<!--img类型-->
<block v-else-if="node.tag == 'img'">
<wx-parse-img :node="node" />
</block>
<!--a类型-->
<block v-else-if="node.tag == 'a'">
<view @click="wxParseATap" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</view>
</block>
<!--br类型-->
<block v-else-if="node.tag == 'br'">
<text>\n</text>
</block>
<!--其他标签-->
<block v-else>
<view :class="node.classStr" :style="node.styleStr">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</view>
</block>
</block>
<!--判断是否是文本节点-->
<block v-else-if="node.node == 'text'">{{node.text}}</block>
</view>
</template>
<script>
import wxParseTemplate from './wxParseTemplate6';
import wxParseImg from './wxParseImg';
import wxParseVideo from './wxParseVideo';
import wxParseAudio from './wxParseAudio';
export default {
name: 'wxParseTemplate5',
props: {
node: {},
},
components: {
wxParseTemplate,
wxParseImg,
wxParseVideo,
wxParseAudio,
},
methods: {
wxParseATap(e) {
const {
href
} = e.currentTarget.dataset;
if (!href) return;
let parent = this.$parent;
while(!parent.preview || typeof parent.preview !== 'function') {
parent = parent.$parent;
}
parent.navigate(href, e);
},
},
};
</script>

View File

@ -0,0 +1,98 @@
<template>
<view>
<!--判断是否是标签节点-->
<block v-if="node.node == 'element'">
<block v-if="node.tag == 'button'">
<button type="default" size="mini">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</button>
</block>
<!--li类型-->
<block v-else-if="node.tag == 'li'">
<view :class="node.classStr" :style="node.styleStr">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</view>
</block>
<!--video类型-->
<block v-else-if="node.tag == 'video'">
<wx-parse-video :node="node" />
</block>
<!--audio类型-->
<block v-else-if="node.tag == 'audio'">
<wx-parse-audio :node="node" />
</block>
<!--img类型-->
<block v-else-if="node.tag == 'img'">
<wx-parse-img :node="node" />
</block>
<!--a类型-->
<block v-else-if="node.tag == 'a'">
<view @click="wxParseATap" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</view>
</block>
<!--br类型-->
<block v-else-if="node.tag == 'br'">
<text>\n</text>
</block>
<!--其他标签-->
<block v-else>
<view :class="node.classStr" :style="node.styleStr">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</view>
</block>
</block>
<!--判断是否是文本节点-->
<block v-else-if="node.node == 'text'">{{node.text}}</block>
</view>
</template>
<script>
import wxParseTemplate from './wxParseTemplate7';
import wxParseImg from './wxParseImg';
import wxParseVideo from './wxParseVideo';
import wxParseAudio from './wxParseAudio';
export default {
name: 'wxParseTemplate6',
props: {
node: {},
},
components: {
wxParseTemplate,
wxParseImg,
wxParseVideo,
wxParseAudio,
},
methods: {
wxParseATap(e) {
const {
href
} = e.currentTarget.dataset;
if (!href) return;
let parent = this.$parent;
while(!parent.preview || typeof parent.preview !== 'function') {
parent = parent.$parent;
}
parent.navigate(href, e);
},
},
};
</script>

View File

@ -0,0 +1,98 @@
<template>
<view>
<!--判断是否是标签节点-->
<block v-if="node.node == 'element'">
<block v-if="node.tag == 'button'">
<button type="default" size="mini">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</button>
</block>
<!--li类型-->
<block v-else-if="node.tag == 'li'">
<view :class="node.classStr" :style="node.styleStr">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</view>
</block>
<!--video类型-->
<block v-else-if="node.tag == 'video'">
<wx-parse-video :node="node" />
</block>
<!--audio类型-->
<block v-else-if="node.tag == 'audio'">
<wx-parse-audio :node="node" />
</block>
<!--img类型-->
<block v-else-if="node.tag == 'img'">
<wx-parse-img :node="node" />
</block>
<!--a类型-->
<block v-else-if="node.tag == 'a'">
<view @click="wxParseATap" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</view>
</block>
<!--br类型-->
<block v-else-if="node.tag == 'br'">
<text>\n</text>
</block>
<!--其他标签-->
<block v-else>
<view :class="node.classStr" :style="node.styleStr">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</view>
</block>
</block>
<!--判断是否是文本节点-->
<block v-else-if="node.node == 'text'">{{node.text}}</block>
</view>
</template>
<script>
import wxParseTemplate from './wxParseTemplate8';
import wxParseImg from './wxParseImg';
import wxParseVideo from './wxParseVideo';
import wxParseAudio from './wxParseAudio';
export default {
name: 'wxParseTemplate7',
props: {
node: {},
},
components: {
wxParseTemplate,
wxParseImg,
wxParseVideo,
wxParseAudio,
},
methods: {
wxParseATap(e) {
const {
href
} = e.currentTarget.dataset;
if (!href) return;
let parent = this.$parent;
while(!parent.preview || typeof parent.preview !== 'function') {
parent = parent.$parent;
}
parent.navigate(href, e);
},
},
};
</script>

View File

@ -0,0 +1,98 @@
<template>
<view>
<!--判断是否是标签节点-->
<block v-if="node.node == 'element'">
<block v-if="node.tag == 'button'">
<button type="default" size="mini">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</button>
</block>
<!--li类型-->
<block v-else-if="node.tag == 'li'">
<view :class="node.classStr" :style="node.styleStr">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</view>
</block>
<!--video类型-->
<block v-else-if="node.tag == 'video'">
<wx-parse-video :node="node" />
</block>
<!--audio类型-->
<block v-else-if="node.tag == 'audio'">
<wx-parse-audio :node="node" />
</block>
<!--img类型-->
<block v-else-if="node.tag == 'img'">
<wx-parse-img :node="node" />
</block>
<!--a类型-->
<block v-else-if="node.tag == 'a'">
<view @click="wxParseATap" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</view>
</block>
<!--br类型-->
<block v-else-if="node.tag == 'br'">
<text>\n</text>
</block>
<!--其他标签-->
<block v-else>
<view :class="node.classStr" :style="node.styleStr">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</view>
</block>
</block>
<!--判断是否是文本节点-->
<block v-else-if="node.node == 'text'">{{node.text}}</block>
</view>
</template>
<script>
import wxParseTemplate from './wxParseTemplate9';
import wxParseImg from './wxParseImg';
import wxParseVideo from './wxParseVideo';
import wxParseAudio from './wxParseAudio';
export default {
name: 'wxParseTemplate8',
props: {
node: {},
},
components: {
wxParseTemplate,
wxParseImg,
wxParseVideo,
wxParseAudio,
},
methods: {
wxParseATap(e) {
const {
href
} = e.currentTarget.dataset;
if (!href) return;
let parent = this.$parent;
while(!parent.preview || typeof parent.preview !== 'function') {
parent = parent.$parent;
}
parent.navigate(href, e);
},
},
};
</script>

View File

@ -0,0 +1,98 @@
<template>
<view>
<!--判断是否是标签节点-->
<block v-if="node.node == 'element'">
<block v-if="node.tag == 'button'">
<button type="default" size="mini">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</button>
</block>
<!--li类型-->
<block v-else-if="node.tag == 'li'">
<view :class="node.classStr" :style="node.styleStr">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</view>
</block>
<!--video类型-->
<block v-else-if="node.tag == 'video'">
<wx-parse-video :node="node" />
</block>
<!--audio类型-->
<block v-else-if="node.tag == 'audio'">
<wx-parse-audio :node="node" />
</block>
<!--img类型-->
<block v-else-if="node.tag == 'img'">
<wx-parse-img :node="node" />
</block>
<!--a类型-->
<block v-else-if="node.tag == 'a'">
<view @click="wxParseATap" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</view>
</block>
<!--br类型-->
<block v-else-if="node.tag == 'br'">
<text>\n</text>
</block>
<!--其他标签-->
<block v-else>
<view :class="node.classStr" :style="node.styleStr">
<block v-for="(node, index) of node.nodes" :key="index">
<wx-parse-template :node="node" />
</block>
</view>
</block>
</block>
<!--判断是否是文本节点-->
<block v-else-if="node.node == 'text'">{{node.text}}</block>
</view>
</template>
<script>
import wxParseTemplate from './wxParseTemplate10';
import wxParseImg from './wxParseImg';
import wxParseVideo from './wxParseVideo';
import wxParseAudio from './wxParseAudio';
export default {
name: 'wxParseTemplate9',
props: {
node: {},
},
components: {
wxParseTemplate,
wxParseImg,
wxParseVideo,
wxParseAudio,
},
methods: {
wxParseATap(e) {
const {
href
} = e.currentTarget.dataset;
if (!href) return;
let parent = this.$parent;
while(!parent.preview || typeof parent.preview !== 'function') {
parent = parent.$parent;
}
parent.navigate(href, e);
},
},
};
</script>

View File

@ -0,0 +1,15 @@
<template>
<!--增加video标签支持并循环添加-->
<view :class="node.classStr" :style="node.styleStr">
<video :class="node.classStr" class="video-video" :src="node.attr.src"></video>
</view>
</template>
<script>
export default {
name: 'wxParseVideo',
props: {
node: {},
},
};
</script>

View File

@ -0,0 +1,261 @@
/**
* html2Json 改造来自: https://github.com/Jxck/html2json
*
*
* author: Di (微信小程序开发工程师)
* organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
* 垂直微信小程序开发交流社区
*
* github地址: https://github.com/icindy/wxParse
*
* for: 微信小程序富文本解析
* detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
*/
import wxDiscode from './wxDiscode';
import HTMLParser from './htmlparser';
function makeMap(str) {
const obj = {};
const items = str.split(',');
for (let i = 0; i < items.length; i += 1) obj[items[i]] = true;
return obj;
}
// Block Elements - HTML 5
const block = makeMap('br,code,address,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video');
// Inline Elements - HTML 5
const inline = makeMap('a,abbr,acronym,applet,b,basefont,bdo,big,button,cite,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var');
// Elements that you can, intentionally, leave open
// (and which close themselves)
const closeSelf = makeMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr');
function removeDOCTYPE(html) {
const isDocument = /<body.*>([^]*)<\/body>/.test(html);
return isDocument ? RegExp.$1 : html;
}
function trimHtml(html) {
return html
.replace(/<!--.*?-->/gi, '')
.replace(/\/\*.*?\*\//gi, '')
.replace(/[ ]+</gi, '<')
.replace(/<script[^]*<\/script>/gi, '')
.replace(/<style[^]*<\/style>/gi, '');
}
function getScreenInfo() {
const screen = {};
wx.getSystemInfo({
success: (res) => {
screen.width = res.windowWidth;
screen.height = res.windowHeight;
},
});
return screen;
}
function html2json(html, customHandler, imageProp, host) {
// 处理字符串
html = removeDOCTYPE(html);
html = trimHtml(html);
html = wxDiscode.strDiscode(html);
// 生成node节点
const bufArray = [];
const results = {
nodes: [],
imageUrls: [],
};
const screen = getScreenInfo();
function Node(tag) {
this.node = 'element';
this.tag = tag;
this.$screen = screen;
}
HTMLParser(html, {
start(tag, attrs, unary) {
// node for this element
const node = new Node(tag);
if (bufArray.length !== 0) {
const parent = bufArray[0];
if (parent.nodes === undefined) {
parent.nodes = [];
}
}
if (block[tag]) {
node.tagType = 'block';
} else if (inline[tag]) {
node.tagType = 'inline';
} else if (closeSelf[tag]) {
node.tagType = 'closeSelf';
}
node.attr = attrs.reduce((pre, attr) => {
const { name } = attr;
let { value } = attr;
if (name === 'class') {
node.classStr = value;
}
// has multi attibutes
// make it array of attribute
if (name === 'style') {
node.styleStr = value;
}
if (value.match(/ /)) {
value = value.split(' ');
}
// if attr already exists
// merge it
if (pre[name]) {
if (Array.isArray(pre[name])) {
// already array, push to last
pre[name].push(value);
} else {
// single value, make it array
pre[name] = [pre[name], value];
}
} else {
// not exist, put it
pre[name] = value;
}
return pre;
}, {});
// 优化样式相关属性
if (node.classStr) {
node.classStr += ` ${node.tag}`;
} else {
node.classStr = node.tag;
}
if (node.tagType === 'inline') {
node.classStr += ' inline';
}
// 对img添加额外数据
if (node.tag === 'img') {
let imgUrl = node.attr.src;
imgUrl = wxDiscode.urlToHttpUrl(imgUrl, imageProp.domain);
Object.assign(node.attr, imageProp, {
src: imgUrl || '',
});
if (imgUrl) {
results.imageUrls.push(imgUrl);
}
}
// 处理a标签属性
if (node.tag === 'a') {
node.attr.href = node.attr.href || '';
}
// 处理font标签样式属性
if (node.tag === 'font') {
const fontSize = [
'x-small',
'small',
'medium',
'large',
'x-large',
'xx-large',
'-webkit-xxx-large',
];
const styleAttrs = {
color: 'color',
face: 'font-family',
size: 'font-size',
};
if (!node.styleStr) node.styleStr = '';
Object.keys(styleAttrs).forEach((key) => {
if (node.attr[key]) {
const value = key === 'size' ? fontSize[node.attr[key] - 1] : node.attr[key];
node.styleStr += `${styleAttrs[key]}: ${value};`;
}
});
}
// 临时记录source资源
if (node.tag === 'source') {
results.source = node.attr.src;
}
if (customHandler.start) {
customHandler.start(node, results);
}
if (unary) {
// if this tag doesn't have end tag
// like <img src="hoge.png"/>
// add to parents
const parent = bufArray[0] || results;
if (parent.nodes === undefined) {
parent.nodes = [];
}
parent.nodes.push(node);
} else {
bufArray.unshift(node);
}
},
end(tag) {
// merge into parent tag
const node = bufArray.shift();
if (node.tag !== tag) {
console.error('invalid state: mismatch end tag');
}
// 当有缓存source资源时于于video补上src资源
if (node.tag === 'video' && results.source) {
node.attr.src = results.source;
delete results.source;
}
if (customHandler.end) {
customHandler.end(node, results);
}
if (bufArray.length === 0) {
results.nodes.push(node);
} else {
const parent = bufArray[0];
if (!parent.nodes) {
parent.nodes = [];
}
parent.nodes.push(node);
}
},
chars(text) {
if (!text.trim()) return;
const node = {
node: 'text',
text,
};
if (customHandler.chars) {
customHandler.chars(node, results);
}
if (bufArray.length === 0) {
results.nodes.push(node);
} else {
const parent = bufArray[0];
if (parent.nodes === undefined) {
parent.nodes = [];
}
parent.nodes.push(node);
}
},
});
return results;
}
export default html2json;

View File

@ -0,0 +1,156 @@
/**
*
* htmlParser改造自: https://github.com/blowsie/Pure-JavaScript-HTML5-Parser
*
* author: Di (微信小程序开发工程师)
* organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
* 垂直微信小程序开发交流社区
*
* github地址: https://github.com/icindy/wxParse
*
* for: 微信小程序富文本解析
* detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
*/
// Regular Expressions for parsing tags and attributes
const startTag = /^<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z0-9_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/;
const endTag = /^<\/([-A-Za-z0-9_]+)[^>]*>/;
const attr = /([a-zA-Z0-9_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g;
function makeMap(str) {
const obj = {};
const items = str.split(',');
for (let i = 0; i < items.length; i += 1) obj[items[i]] = true;
return obj;
}
// Empty Elements - HTML 5
const empty = makeMap('area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr');
// Block Elements - HTML 5
const block = makeMap('address,code,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video');
// Inline Elements - HTML 5
const inline = makeMap('a,abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var');
// Elements that you can, intentionally, leave open
// (and which close themselves)
const closeSelf = makeMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr');
// Attributes that have their values filled in disabled="disabled"
const fillAttrs = makeMap('checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected');
function HTMLParser(html, handler) {
let index;
let chars;
let match;
let last = html;
const stack = [];
stack.last = () => stack[stack.length - 1];
function parseEndTag(tag, tagName) {
// If no tag name is provided, clean shop
let pos;
if (!tagName) {
pos = 0;
} else {
// Find the closest opened tag of the same type
tagName = tagName.toLowerCase();
for (pos = stack.length - 1; pos >= 0; pos -= 1) {
if (stack[pos] === tagName) break;
}
}
if (pos >= 0) {
// Close all the open elements, up the stack
for (let i = stack.length - 1; i >= pos; i -= 1) {
if (handler.end) handler.end(stack[i]);
}
// Remove the open elements from the stack
stack.length = pos;
}
}
function parseStartTag(tag, tagName, rest, unary) {
tagName = tagName.toLowerCase();
if (block[tagName]) {
while (stack.last() && inline[stack.last()]) {
parseEndTag('', stack.last());
}
}
if (closeSelf[tagName] && stack.last() === tagName) {
parseEndTag('', tagName);
}
unary = empty[tagName] || !!unary;
if (!unary) stack.push(tagName);
if (handler.start) {
const attrs = [];
rest.replace(attr, function genAttr(matches, name) {
const value = arguments[2] || arguments[3] || arguments[4] || (fillAttrs[name] ? name : '');
attrs.push({
name,
value,
escaped: value.replace(/(^|[^\\])"/g, '$1\\"'), // "
});
});
if (handler.start) {
handler.start(tagName, attrs, unary);
}
}
}
while (html) {
chars = true;
if (html.indexOf('</') === 0) {
match = html.match(endTag);
if (match) {
html = html.substring(match[0].length);
match[0].replace(endTag, parseEndTag);
chars = false;
}
// start tag
} else if (html.indexOf('<') === 0) {
match = html.match(startTag);
if (match) {
html = html.substring(match[0].length);
match[0].replace(startTag, parseStartTag);
chars = false;
}
}
if (chars) {
index = html.indexOf('<');
let text = '';
while (index === 0) {
text += '<';
html = html.substring(1);
index = html.indexOf('<');
}
text += index < 0 ? html : html.substring(0, index);
html = index < 0 ? '' : html.substring(index);
if (handler.chars) handler.chars(text);
}
if (html === last) throw new Error(`Parse Error: ${html}`);
last = html;
}
// Clean up any remaining tags
parseEndTag();
}
export default HTMLParser;

View File

@ -0,0 +1,195 @@
// HTML 支持的数学符号
function strNumDiscode(str) {
str = str.replace(/&forall;/g, '∀');
str = str.replace(/&part;/g, '∂');
str = str.replace(/&exist;/g, '∃');
str = str.replace(/&empty;/g, '∅');
str = str.replace(/&nabla;/g, '∇');
str = str.replace(/&isin;/g, '∈');
str = str.replace(/&notin;/g, '∉');
str = str.replace(/&ni;/g, '∋');
str = str.replace(/&prod;/g, '∏');
str = str.replace(/&sum;/g, '∑');
str = str.replace(/&minus;/g, '');
str = str.replace(/&lowast;/g, '');
str = str.replace(/&radic;/g, '√');
str = str.replace(/&prop;/g, '∝');
str = str.replace(/&infin;/g, '∞');
str = str.replace(/&ang;/g, '∠');
str = str.replace(/&and;/g, '∧');
str = str.replace(/&or;/g, '');
str = str.replace(/&cap;/g, '∩');
str = str.replace(/&cup;/g, '');
str = str.replace(/&int;/g, '∫');
str = str.replace(/&there4;/g, '∴');
str = str.replace(/&sim;/g, '');
str = str.replace(/&cong;/g, '≅');
str = str.replace(/&asymp;/g, '≈');
str = str.replace(/&ne;/g, '≠');
str = str.replace(/&le;/g, '≤');
str = str.replace(/&ge;/g, '≥');
str = str.replace(/&sub;/g, '⊂');
str = str.replace(/&sup;/g, '⊃');
str = str.replace(/&nsub;/g, '⊄');
str = str.replace(/&sube;/g, '⊆');
str = str.replace(/&supe;/g, '⊇');
str = str.replace(/&oplus;/g, '⊕');
str = str.replace(/&otimes;/g, '⊗');
str = str.replace(/&perp;/g, '⊥');
str = str.replace(/&sdot;/g, '⋅');
return str;
}
// HTML 支持的希腊字母
function strGreeceDiscode(str) {
str = str.replace(/&Alpha;/g, 'Α');
str = str.replace(/&Beta;/g, 'Β');
str = str.replace(/&Gamma;/g, 'Γ');
str = str.replace(/&Delta;/g, 'Δ');
str = str.replace(/&Epsilon;/g, 'Ε');
str = str.replace(/&Zeta;/g, 'Ζ');
str = str.replace(/&Eta;/g, 'Η');
str = str.replace(/&Theta;/g, 'Θ');
str = str.replace(/&Iota;/g, 'Ι');
str = str.replace(/&Kappa;/g, 'Κ');
str = str.replace(/&Lambda;/g, 'Λ');
str = str.replace(/&Mu;/g, 'Μ');
str = str.replace(/&Nu;/g, 'Ν');
str = str.replace(/&Xi;/g, 'Ν');
str = str.replace(/&Omicron;/g, 'Ο');
str = str.replace(/&Pi;/g, 'Π');
str = str.replace(/&Rho;/g, 'Ρ');
str = str.replace(/&Sigma;/g, 'Σ');
str = str.replace(/&Tau;/g, 'Τ');
str = str.replace(/&Upsilon;/g, 'Υ');
str = str.replace(/&Phi;/g, 'Φ');
str = str.replace(/&Chi;/g, 'Χ');
str = str.replace(/&Psi;/g, 'Ψ');
str = str.replace(/&Omega;/g, 'Ω');
str = str.replace(/&alpha;/g, 'α');
str = str.replace(/&beta;/g, 'β');
str = str.replace(/&gamma;/g, 'γ');
str = str.replace(/&delta;/g, 'δ');
str = str.replace(/&epsilon;/g, 'ε');
str = str.replace(/&zeta;/g, 'ζ');
str = str.replace(/&eta;/g, 'η');
str = str.replace(/&theta;/g, 'θ');
str = str.replace(/&iota;/g, 'ι');
str = str.replace(/&kappa;/g, 'κ');
str = str.replace(/&lambda;/g, 'λ');
str = str.replace(/&mu;/g, 'μ');
str = str.replace(/&nu;/g, 'ν');
str = str.replace(/&xi;/g, 'ξ');
str = str.replace(/&omicron;/g, 'ο');
str = str.replace(/&pi;/g, 'π');
str = str.replace(/&rho;/g, 'ρ');
str = str.replace(/&sigmaf;/g, 'ς');
str = str.replace(/&sigma;/g, 'σ');
str = str.replace(/&tau;/g, 'τ');
str = str.replace(/&upsilon;/g, 'υ');
str = str.replace(/&phi;/g, 'φ');
str = str.replace(/&chi;/g, 'χ');
str = str.replace(/&psi;/g, 'ψ');
str = str.replace(/&omega;/g, 'ω');
str = str.replace(/&thetasym;/g, 'ϑ');
str = str.replace(/&upsih;/g, 'ϒ');
str = str.replace(/&piv;/g, 'ϖ');
str = str.replace(/&middot;/g, '·');
return str;
}
function strcharacterDiscode(str) {
// 加入常用解析
str = str.replace(/&nbsp;/g, ' ');
str = str.replace(/&ensp;/g, '');
str = str.replace(/&emsp;/g, ' ');
str = str.replace(/&quot;/g, "'");
str = str.replace(/&amp;/g, '&');
str = str.replace(/&lt;/g, '<');
str = str.replace(/&gt;/g, '>');
str = str.replace(/&#8226;/g, '•');
return str;
}
// HTML 支持的其他实体
function strOtherDiscode(str) {
str = str.replace(/&OElig;/g, 'Œ');
str = str.replace(/&oelig;/g, 'œ');
str = str.replace(/&Scaron;/g, 'Š');
str = str.replace(/&scaron;/g, 'š');
str = str.replace(/&Yuml;/g, 'Ÿ');
str = str.replace(/&fnof;/g, 'ƒ');
str = str.replace(/&circ;/g, 'ˆ');
str = str.replace(/&tilde;/g, '˜');
str = str.replace(/&ensp;/g, '');
str = str.replace(/&emsp;/g, '');
str = str.replace(/&thinsp;/g, '');
str = str.replace(/&zwnj;/g, '');
str = str.replace(/&zwj;/g, '');
str = str.replace(/&lrm;/g, '');
str = str.replace(/&rlm;/g, '');
str = str.replace(/&ndash;/g, '');
str = str.replace(/&mdash;/g, '—');
str = str.replace(/&lsquo;/g, '');
str = str.replace(/&rsquo;/g, '');
str = str.replace(/&sbquo;/g, '');
str = str.replace(/&ldquo;/g, '“');
str = str.replace(/&rdquo;/g, '”');
str = str.replace(/&bdquo;/g, '„');
str = str.replace(/&dagger;/g, '†');
str = str.replace(/&Dagger;/g, '‡');
str = str.replace(/&bull;/g, '•');
str = str.replace(/&hellip;/g, '…');
str = str.replace(/&permil;/g, '‰');
str = str.replace(/&prime;/g, '');
str = str.replace(/&Prime;/g, '″');
str = str.replace(/&lsaquo;/g, '');
str = str.replace(/&rsaquo;/g, '');
str = str.replace(/&oline;/g, '‾');
str = str.replace(/&euro;/g, '€');
str = str.replace(/&trade;/g, '™');
str = str.replace(/&larr;/g, '←');
str = str.replace(/&uarr;/g, '↑');
str = str.replace(/&rarr;/g, '→');
str = str.replace(/&darr;/g, '↓');
str = str.replace(/&harr;/g, '↔');
str = str.replace(/&crarr;/g, '↵');
str = str.replace(/&lceil;/g, '⌈');
str = str.replace(/&rceil;/g, '⌉');
str = str.replace(/&lfloor;/g, '⌊');
str = str.replace(/&rfloor;/g, '⌋');
str = str.replace(/&loz;/g, '◊');
str = str.replace(/&spades;/g, '♠');
str = str.replace(/&clubs;/g, '♣');
str = str.replace(/&hearts;/g, '♥');
str = str.replace(/&diams;/g, '♦');
str = str.replace(/&#39;/g, "'");
return str;
}
function strDiscode(str) {
str = strNumDiscode(str);
str = strGreeceDiscode(str);
str = strcharacterDiscode(str);
str = strOtherDiscode(str);
return str;
}
function urlToHttpUrl(url, domain) {
if (/^\/\//.test(url)) {
return `https:${url}`;
} else if (/^\//.test(url)) {
return `https://${domain}${url}`;
}
return url;
}
export default {
strDiscode,
urlToHttpUrl,
};

View File

@ -0,0 +1,102 @@
## uParse 适用于 uni-app/mpvue 的富文本解析组件
> 支持 Html、Markdown 解析Fork自: [mpvue-wxParse](https://github.com/F-loat/mpvue-wxParse)
## 属性
| 名称 | 类型 | 默认值 | 描述 |
| -----------------|--------------- | ------------- | ---------------- |
| loading | Boolean | false | 数据加载状态 |
| className | String | — | 自定义 class 名称 |
| content | String | — | 渲染内容 |
| noData | String | 数据不能为空 | 空数据时的渲染展示 |
| startHandler | Function | 见源码 | 自定义 parser 函数 |
| endHandler | Function | null | 自定义 parser 函数 |
| charsHandler | Function | null | 自定义 parser 函数 |
| imageProp | Object | 见下文 | 图片相关参数 |
### 自定义 parser 函数具体介绍
* 传入的参数为当前节点 `node` 对象及解析结果 `results` 对象,例如 `startHandler(node, results)`
* 无需返回值,通过对传入的参数直接操作来完成需要的改动
* 自定义函数会在原解析函数处理之后执行
### imageProp 对象具体属性
| 名称 | 类型 | 默认值 | 描述 |
| -----------------|--------------- | ------------- | ------------------ |
| mode | String | 'aspectFit' | 图片裁剪、缩放的模式 |
| padding | Number | 0 | 图片内边距 |
| lazyLoad | Boolean | false | 图片懒加载 |
| domain | String | '' | 图片服务域名 |
## 事件
| 名称 | 参数 | 描述 |
| -----------------|----------------- | ---------------- |
| preview | 图片地址,原始事件 | 预览图片时触发 |
| navigate | 链接地址,原始事件 | 点击链接时触发 |
## 基本使用方法
``` vue
<template>
<div>
<u-parse :content="article" @preview="preview" @navigate="navigate" />
</div>
</template>
<script>
import uParse from '@/components/u-parse/u-parse.vue'
export default {
components: {
uParse
},
data () {
return {
article: '<div>我是HTML代码</div>'
}
},
methods: {
preview(src, e) {
// do something
},
navigate(href, e) {
// do something
}
}
}
</script>
<style>
@import url("@/components/u-parse/u-parse.css");
</style>
```
## 渲染 Markdown
> 先将 markdown 转换为 html 即可
```
npm install marked
```
``` js
import marked from 'marked'
import uParse from '@/components/u-parse/u-parse.vue'
export default {
components: {
uParse
},
data () {
return {
article: marked(`#hello, markdown!`)
}
}
}
```

View File

@ -0,0 +1,232 @@
/**
* author: Di (微信小程序开发工程师)
* organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
* 垂直微信小程序开发交流社区
*
* github地址: https://github.com/icindy/wxParse
*
* for: 微信小程序富文本解析
* detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
*/
.wxParse {
width: 100%;
font-family: Helvetica, sans-serif;
font-size: 30upx;
color: #666;
line-height: 1.8;
}
.wxParse view {
word-break: hyphenate;
}
.wxParse .inline {
display: inline;
margin: 0;
padding: 0;
}
.wxParse .div {
margin: 0;
padding: 0;
}
.wxParse .h1 .text {
font-size: 2em;
margin: 0.67em 0;
}
.wxParse .h2 .text {
font-size: 1.5em;
margin: 0.83em 0;
}
.wxParse .h3 .text {
font-size: 1.17em;
margin: 1em 0;
}
.wxParse .h4 .text {
margin: 1.33em 0;
}
.wxParse .h5 .text {
font-size: 0.83em;
margin: 1.67em 0;
}
.wxParse .h6 .text {
font-size: 0.67em;
margin: 2.33em 0;
}
.wxParse .h1 .text,
.wxParse .h2 .text,
.wxParse .h3 .text,
.wxParse .h4 .text,
.wxParse .h5 .text,
.wxParse .h6 .text,
.wxParse .b,
.wxParse .strong {
font-weight: bolder;
}
.wxParse .p {
margin: 1em 0;
}
.wxParse .i,
.wxParse .cite,
.wxParse .em,
.wxParse .var,
.wxParse .address {
font-style: italic;
}
.wxParse .pre,
.wxParse .tt,
.wxParse .code,
.wxParse .kbd,
.wxParse .samp {
font-family: monospace;
}
.wxParse .pre {
overflow: auto;
background: #f5f5f5;
padding: 16upx;
white-space: pre;
margin: 1em 0upx;
}
.wxParse .code {
display: inline;
background: #f5f5f5;
}
.wxParse .big {
font-size: 1.17em;
}
.wxParse .small,
.wxParse .sub,
.wxParse .sup {
font-size: 0.83em;
}
.wxParse .sub {
vertical-align: sub;
}
.wxParse .sup {
vertical-align: super;
}
.wxParse .s,
.wxParse .strike,
.wxParse .del {
text-decoration: line-through;
}
.wxParse .strong,
.wxParse .s {
display: inline;
}
.wxParse .a {
color: deepskyblue;
}
.wxParse .video {
text-align: center;
margin: 22upx 0;
}
.wxParse .video-video {
width: 100%;
}
.wxParse .img {
display: inline-block;
width: 0;
height: 0;
max-width: 100%;
overflow: hidden;
}
.wxParse .blockquote {
margin: 10upx 0;
padding: 22upx 0 22upx 22upx;
font-family: Courier, Calibri, "宋体";
background: #f5f5f5;
border-left: 6upx solid #dbdbdb;
}
.wxParse .blockquote .p {
margin: 0;
}
.wxParse .ul, .wxParse .ol {
display: block;
margin: 1em 0;
padding-left: 33upx;
}
.wxParse .ol {
list-style-type: disc;
}
.wxParse .ol {
list-style-type: decimal;
}
.wxParse .ol>weixin-parse-template,.wxParse .ul>weixin-parse-template {
display: list-item;
align-items: baseline;
text-align: match-parent;
}
.wxParse .ol>.li,.wxParse .ul>.li {
display: list-item;
align-items: baseline;
text-align: match-parent;
}
.wxParse .ul .ul, .wxParse .ol .ul {
list-style-type: circle;
}
.wxParse .ol .ol .ul, .wxParse .ol .ul .ul, .wxParse .ul .ol .ul, .wxParse .ul .ul .ul {
list-style-type: square;
}
.wxParse .u {
text-decoration: underline;
}
.wxParse .hide {
display: none;
}
.wxParse .del {
display: inline;
}
.wxParse .figure {
overflow: hidden;
}
.wxParse .table {
width: 100%;
}
.wxParse .thead, .wxParse .tfoot, .wxParse .tr {
display: flex;
flex-direction: row;
}
.wxParse .tr {
width:100%;
display: flex;
border-right: 2upx solid #e0e0e0;
border-bottom: 2upx solid #e0e0e0;
}
.wxParse .th,
.wxParse .td {
display: flex;
width: 1276upx;
overflow: auto;
flex: 1;
padding: 11upx;
border-left: 2upx solid #e0e0e0;
}
.wxParse .td:last {
border-top: 2upx solid #e0e0e0;
}
.wxParse .th {
background: #f0f0f0;
border-top: 2upx solid #e0e0e0;
}

View File

@ -0,0 +1,118 @@
<!--**
* forked fromhttps://github.com/F-loat/mpvue-wxParse
*
* github地址: https://github.com/dcloudio/uParse
*
* for: uni-app框架下 富文本解析
*/-->
<template>
<!--基础元素-->
<div class="wxParse" :class="className" v-if="!loading">
<block v-for="(node,index) of nodes" :key="index">
<wxParseTemplate :node="node" />
</block>
</div>
</template>
<script>
import HtmlToJson from './libs/html2json';
import wxParseTemplate from './components/wxParseTemplate0';
export default {
name: 'wxParse',
props: {
loading: {
type: Boolean,
default: false,
},
className: {
type: String,
default: '',
},
content: {
type: String,
default: '',
},
noData: {
type: String,
default: '<div style="color: red;">数据不能为空</div>',
},
startHandler: {
type: Function,
default() {
return (node) => {
node.attr.class = null;
node.attr.style = null;
};
},
},
endHandler: {
type: Function,
default: null,
},
charsHandler: {
type: Function,
default: null,
},
imageProp: {
type: Object,
default() {
return {
mode: 'aspectFit',
padding: 0,
lazyLoad: false,
domain: '',
};
},
},
},
components: {
wxParseTemplate,
},
data() {
return {
imageUrls: [],
};
},
computed: {
nodes() {
const {
content,
noData,
imageProp,
startHandler,
endHandler,
charsHandler,
} = this;
const parseData = content || noData;
const customHandler = {
start: startHandler,
end: endHandler,
chars: charsHandler,
};
const results = HtmlToJson(parseData, customHandler, imageProp, this);
this.imageUrls = results.imageUrls;
console.log(results)
return results.nodes;
},
},
methods: {
navigate(href, $event) {
this.$emit('navigate', href, $event);
},
preview(src, $event) {
if (!this.imageUrls.length) return;
wx.previewImage({
current: src,
urls: this.imageUrls,
});
this.$emit('preview', src, $event);
},
removeImageUrl(src) {
const { imageUrls } = this;
imageUrls.splice(imageUrls.indexOf(src), 1);
},
},
};
</script>

View File

@ -1,7 +1,7 @@
import App from './App'
import navTo from './utils/navTo'
import uviewPlus, { setConfig } from 'uview-plus'
// #ifndef VUE3
console.log(222)
import Vue from 'vue'
import './uni.promisify.adaptor'
Vue.config.productionTip = false
@ -16,6 +16,7 @@ app.$mount()
import { createSSRApp } from 'vue'
export function createApp() {
const app = createSSRApp(App)
app.use(uviewPlus, () => {
return {
options: {
@ -28,6 +29,7 @@ export function createApp() {
}
})
console.log(uni.$u.config.v);
app.config.globalProperties.$navTo = navTo
return {
app
}

View File

@ -27,6 +27,27 @@
"navigationStyle": "custom"
}
},
{
"path": "pages/certImg/certImg",
"style": {
"navigationBarTitleText": "uni-app",
"navigationStyle": "custom"
}
},
{
"path": "pages/sickList/sickList",
"style": {
"navigationBarTitleText": "uni-app",
"navigationStyle": "custom"
}
},
{
"path": "pages/videoList/videoList",
"style": {
"navigationBarTitleText": "uni-app",
"navigationStyle": "custom"
}
},
{
"path": "pages/login/login",
"style": {

View File

@ -1,7 +1,7 @@
<template>
<view class="content">
<view class="page">
<web-view src="https:www.baidu.com/" ></web-view>
<web-view :src="src" ></web-view>
</view>
<tabBar :value="1"></tabBar>
</view>
@ -9,12 +9,20 @@
<script setup>
import { reactive, ref } from 'vue';
import { onShow } from "@dcloudio/uni-app";
import { onShow,onLoad } from "@dcloudio/uni-app";
import tabBar from '@/components/tabBar/tabBar.vue';
const webviewStyles=reactive({
width:"100%",
height:'calc(100vh - 0rpx)'
const src = ref('https://dev-caseplatform.igandan.com/web/home?token=');
onLoad((options)=>{
const { envVersion } = uni.getAccountInfoSync().miniProgram;
let token=''
if (envVersion == "release") {
token=uni.setStorageSync("AUTH_TOKEN_CASEDATA");
} else {
token= uni.setStorageSync("DEV_AUTH_TOKEN_CASEDATA");
};
src.value = 'https://dev-caseplatform.igandan.com/web/home?token='+token;
})
</script>
<style scoped>

View File

@ -26,7 +26,7 @@
</view>
</view>
<view class="list">
<view class="cell" v-for="item in most_read_articles" :key="item.exchange_id">
<view class="cell" v-for="item in most_read_articles" :key="item.exchange_id" @click="goDetail(item.exchange_id)">
<view class="circle"></view>
<view class="title ellipsis-two-lines">{{ item.exchange_title }}</view>
</view>
@ -46,6 +46,7 @@
class="cell"
v-for="(item) in new_articles"
:key="item.exchange_id"
@click="goDetail(item.exchange_id)"
>
<view class="title ellipsis-two-lines">{{
item.exchange_title
@ -181,7 +182,11 @@
Object.assign(numInfo,result);
})
}
const goDetail = (id) => {
uni.navigateTo({
url: `/pages/detail/detail?id=${id}&type=exchange`,
});
};
const videoErrorCallback = (e) => {
uni.showModal({
content: e.target.errMsg,

32
pages/certImg/certImg.vue Normal file
View File

@ -0,0 +1,32 @@
<template>
<backNav :navName="'病例收录证书'"></backNav>
<view class="imgbox">
<u--image
:showLoading="true"
:src="src"
width="100%"
mode="widthFix"
></u--image>
</view>
</template>
<script setup>
import { ref } from 'vue';
import { onLoad } from "@dcloudio/uni-app";
import backNav from "@/components/backNav/backNav.vue";
const src = ref('')
onLoad((options) => {
if(options.src){
src.value = options.src;
}else{
src.value= 'https://cn.bing.com//th?id=OHR.SanMiguelAzores_ZH-CN2511982585_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp';
}
});
</script>
<style lang='scss' scoped>
.imgbox{
margin-top: -30rpx;
}
</style>

View File

@ -9,7 +9,12 @@
@query="queryList"
>
<template #top>
<navBarSearch :searchWord="keyWord" :navName="navName"></navBarSearch>
<navBarSearch :searchWord="keyWord" :navName="navName" @changeWord="changeWord"></navBarSearch>
<view class="detail" v-if="isSearch">
<view class="desc" >检索到<text class="red">{{numInfo.search_article_num}}篇文章</text></view>
<view class="desc">检索到<text class="red">{{numInfo.search_video_num}}个视频</text></view>
<view class="desc" v-if="keyWord">检索词:<text class="red">{{ keyWord }}</text></view>
</view>
<view class="tabcon">
<up-tabs :activeStyle="{
color: '#3CC7C0'
@ -19,8 +24,8 @@
}" lineColor="#3CC7C0" lineWidth="155rpx" lineHeight="2" :list="tabList" @click="switchTab"></up-tabs>
</view>
</template>
<view class="item" v-for="(item, index) in dataList" :key="index" @click="isArticle?goDetail(item.article_id):goDetail(item.video_id)">
<view class="title ellipsis">{{isArticle?item.article_title:item.video_title }}</view>
<view class="item" v-for="(item, index) in dataList" :key="index" @click="goDetail(item.cert_image)">
<view class="title ellipsis">{{tab==0?item.article_title:item.video_title }}</view>
<view class="tagsbox">
<view class="tag" v-for="tag in item.author" :key="tag.author_id">{{ tag.doctor_name }}</view>
</view>
@ -55,104 +60,57 @@ import dayjs from "dayjs";
import switchImg from "@/static/switch.png";
import certImg from "@/static/cert.png";
const paging = ref(null);
const uDropdownRef=ref(null);
const isSearch=ref(false);
const dataList = ref([]);
const total = ref(0);
const value = ref("");
const keyWord = ref("");
const page=ref(1);
const isArticle=ref(true);
const tab=ref(0);
const hospital_id=ref('');
const hospital_name=ref('');
const doctor_id=ref('');
const doctor_name=ref('');
const numInfo=reactive({});
const navName=ref('肝胆相照临床病例库')
const options= ref([
{
label: "正序",
value: 'asc',
},
{
label: "倒序",
value: 'desc',
},
]);
const formatdate=(date)=>{
return dayjs(date).format('YYYY-MM-DD')
}
const tabList=ref([{
name: '文章病例库',
}, {
name: '视频病例库',
}])
const order=reactive({
read_num:'',
push_date:''
})
const switchTab=(index)=>{
console.log('item', index);
tab.value=index.index;
paging.value.reload();
}
onLoad((options) => {
if(options.keyWord){
keyWord.value = options.keyWord;
};
if(options.order=='new'){
order.push_date='asc'
};
if(options.order=='read'){
order.read_num='desc'
};
if(options.order=='video'){
isArticle.value=false;
}
if(options.doctor_id){
doctor_id.value=options.doctor_id;
doctor_name.value=options.doctor_name
navName.value= doctor_name.value+'临床病例库'
getStaticDoctor(doctor_id.value)
}
if(options.hospital_id){
hospital_id.value=options.hospital_id;
hospital_name.value=options.hospital_name;
navName.value= hospital_name.value+'临床病例库'
getStaticDoctor(hospital_id.value)
})
const goDetail=(url)=>{
}
});
const change=(e)=>{
paging.value.reload();
}
const formatdate=(date)=>{
return dayjs(date).format('YYYY-MM-DD')
}
const goDetail=(id)=>{
console.log(11111)
console.log(id)
let type=isArticle.value?'article':'video'
uni.navigateTo({
url: `/pages/detail/detail?id=${id}&type=${type}`
url: `/pages/certImg/certImg?src=${url}`
})
}
const swicthType=()=>{
isArticle.value=!isArticle.value;
dataList.value=[];
order.read_num='';
order.push_date='';
paging.value.reload();
const changeWord=(val)=>{
keyWord.value=val;
isSearch.value=true;
paging.value.reload();
}
const searchArticle =(params) => {
let searchForm={
keyword: keyWord.value,
doctor_id:doctor_id.value,
hospital_id:hospital_id.value
}
if(!order.read_num){
delete order.read_num
}
if(!order.push_date){
delete order.push_date
}
if(order.read_num || order.push_date){
searchForm.order=order
if(isSearch.value){
formatdate.is_need_num=1
}
api.searchArticle({
...searchForm,
@ -160,29 +118,27 @@ const searchArticle =(params) => {
}).then((res)=>{
paging.value.complete(res.data.data.data);
total.value=res.data.data.total;
numInfo.search_article_num=res.data.data.search_article_num;
numInfo.search_video_num=res.data.data.search_video_num;
}).catch(err=>{
paging.value.complete(false);
})
}
const searchVideo = async(params) => {
let searchForm={
let searchForm={
keyword: keyWord.value,
doctor_id:doctor_id.value,
}
if(!order.read_num){
delete order.read_num
}
if(!order.push_date){
delete order.push_date
}
if(order.read_num || order.push_date){
searchForm.order=order
}
api.searchVideo({
...searchForm,
...params
}).then((res)=>{
paging.value.complete(res.data.data.data);
total.value=res.data.data.total;
numInfo.search_article_num=res.data.data.search_article_num;
numInfo.search_video_num=res.data.data.search_video_num;
}).catch(err=>{
paging.value.complete(false);
})
@ -207,11 +163,23 @@ const queryList = (pageNo, pageSize) => {
page: pageNo,
page_size: pageSize,
};
isArticle.value?searchArticle(params):searchVideo(params)
tab.value==0?searchArticle(params):searchVideo(params)
};
</script>
<style lang="scss" scoped>
.detail {
background: #f9f9f9;
padding: 12rpx 30rpx;
.desc {
font-size: 26rpx;
color: #4b5563;
line-height: 40rpx;
}
.red{
color: #FF0000;
}
}
.tabcon{
margin:0 20rpx;
}
@ -239,27 +207,7 @@ const queryList = (pageNo, pageSize) => {
}
}
}
.filterbox{
display: flex;
height:128rpx;
align-items: center;
position: relative;
.type{
position: absolute;
left:30rpx;
top:24rpx;
display: flex;
justify-content: center;
align-items: center;
background: #F3F4F6;
border-radius: 15rpx;
height: 74rpx;
padding:0 25rpx;
z-index:2;
}
}
.u-page {
:deep(.u-flex) {
:deep(.u-flex) {
display: flex;
flex-direction:row;
overflow: hidden;
@ -269,7 +217,7 @@ const queryList = (pageNo, pageSize) => {
background: #fff;
z-index:1;
margin-left: 180rpx;
margin-left: -30rpx;
}
:deep(.u-dropdown__menu__item){
@ -282,6 +230,8 @@ const queryList = (pageNo, pageSize) => {
margin-left: 60rpx;
}
.u-page {
.deal {
margin-top: 20rpx;
display: flex;

View File

@ -11,7 +11,9 @@
<backNav :navName="'肝胆相照临床病例库'"></backNav>
<view class="box">
<view class="title" v-if="type == 'video'">{{ info.video_title }}</view>
<view class="title" v-else-if="type=='article'">{{ info.article_title }}</view>
<view class="title" v-else-if="type == 'article'">{{
info.article_title
}}</view>
<view class="title" v-else>{{ info.exchange_title }}</view>
<view class="content">
<view class="info" v-for="item in info.author">
@ -49,25 +51,6 @@
</view>
</view>
<view class="bar"></view>
<view class="detail">
<!-- <view class="votebox">
<view class="name">在线投票</view>
<view class="title">肝胆相照临床病例库肝胆相照临床病例库肝胆</view>
<view class="options">
<view class="option">
<view class="row">
<view class="left">治疗有效性</view>
<view class="num">0%</view>
</view>
<view class="line">
<view class="inner" style="width: 10%"></view>
</view>
</view>
</view>
</view> -->
</view>
<canvas
v-if="showCanvas"
@ -101,7 +84,7 @@
mode="widthFix"
width="38rpx"
></up--image>
<view class="imgboxshang">
<view class="imgboxshang" @click="openGivePop">
<up--image
:src="shangImg"
mode="widthFix"
@ -124,9 +107,65 @@
>
</polyv-player>
</view>
<view class="videobox" v-else>
<view class="videobox" v-else-if="type == 'article'">
<view class="content" v-html="info.article_content"></view>
</view>
<view class="videobox" v-else>
<view class="cloumn" v-if="info.exchange_content">
<view class="stitle">病例信息</view>
<u-parse :content="fromatImg(info.exchange_content)"></u-parse>
<!-- <view class="con" v-html="fromatImg(info.exchange_content)"></view> -->
</view>
<view class="cloumn" v-if="info.exchange_summary">
<view class="stitle">结果与讨论</view>
<u-parse :content="fromatImg(info.exchange_summary)"></u-parse>
<!-- <view class="con" v-html="fromatImg(info.exchange_summary)"></view> -->
</view>
<view class="bar"></view>
<view class="detail" v-if="info.case_exchange_vote && info.case_exchange_vote.vote_title">
<view class="votebox" v-if="info.case_exchange_vote.is_have_voted!=1">
<view class="name">在线投票</view>
<view class="title" >{{ info.case_exchange_vote.vote_title }}</view>
<view class="group">
<up-radio-group
v-model="option_id"
placement="column"
>
<view class="row" v-for="item in info.case_exchange_vote.case_exchange_vote_option" :key="item.option_id">
<up-radio
activeColor="#3CC7C0"
:label="item.option_value"
:name="item.option_id"
>
</up-radio>
</view>
</up-radio-group>
<view class="btn" @click="addVote">投票</view>
</view>
</view>
<view class="votebox" v-else>
<view class="name">在线投票</view>
<view class="title">{{ info.case_exchange_vote.vote_title }}</view>
<view class="options">
<view class="option" v-for="item in info.case_exchange_vote.case_exchange_vote_option" :key="item.option_id">
<view class="row">
<view class="left">{{item.option_value }}</view>
<view class="num">{{item.proportion}}%</view>
</view>
<view class="line">
<view class="inner" :style="{width:proportion/100 }"></view>
</view>
</view>
</view>
</view>
</view>
<!-- <view class="detail" v-if="info.case_exchange_vote && info.case_exchange_vote.vote_title">
</view> -->
</view>
<view class="bar"></view>
<view class="comnum">
<view class="imgcon">
@ -173,7 +212,7 @@
<view class="question">{{ item.content }}</view>
<view class="commentImg" v-if="item.comment_image">
<up-image
:src="(item.comment_image)"
:src="item.comment_image"
radius="16rpx"
width="150rpx"
height="150rpx"
@ -220,9 +259,9 @@
class="question"
v-html="formatHtml(cell.content)"
></view>
<view class="commentImg" v-if="cell.comment_image">
<view class="commentImg" v-if="cell.comment_image">
<up-image
:src="(cell.comment_image)"
:src="cell.comment_image"
radius="16rpx"
width="150rpx"
height="150rpx"
@ -264,7 +303,7 @@
:placeholder="placeholder"
></up--textarea>
</view>
<view class="imgbox" v-if="imgList.length>0">
<view class="imgbox" v-if="imgList.length > 0">
<view class="imgunit">
<up--image
:src="imgList[0]"
@ -282,7 +321,6 @@
<view class="left">
<up-upload
:show-upload-list="false"
@afterRead="afterRead"
name="imgupload"
multiple
@ -369,15 +407,15 @@
>
</view>
<view class="question">{{ mainCommentObj.content }}</view>
<view class="commentImg" v-if="mainCommentObj.comment_image">
<up-image
:src="mainCommentObj.comment_image"
radius="16rpx"
width="150rpx"
height="150rpx"
@click="previewImg(mainCommentObj.comment_image)"
></up-image>
</view>
<view class="commentImg" v-if="mainCommentObj.comment_image">
<up-image
:src="mainCommentObj.comment_image"
radius="16rpx"
width="150rpx"
height="150rpx"
@click="previewImg(mainCommentObj.comment_image)"
></up-image>
</view>
<view class="date">{{
formatDate(mainCommentObj.created_at)
}}</view>
@ -416,7 +454,7 @@
>
</view>
<view class="question" v-html="formatHtml(cell.content)"></view>
<view class="commentImg" v-if="cell.comment_image">
<view class="commentImg" v-if="cell.comment_image">
<up-image
:src="cell.comment_image"
radius="16rpx"
@ -447,17 +485,19 @@
<view class="title">打赏</view>
<view class="count">
积分余额
<text class="num">100</text>积分
<text class="earn">去赚积分</text>
<text class="num">{{ point }}</text>积分
<!-- <text class="earn">去赚积分</text> -->
</view>
<view class="countbox">
<view class="minus">-</view>
<view class="minus" @click="changePoint('minus')">-</view>
<up-input
placeholder="请输入内容"
placeholder="请输入打赏积分"
type="number"
border="surround"
v-model="value"
@input="inputPoint"
v-model="givePointValue"
></up-input>
<view class="add">+</view>
<view class="add" @click="changePoint('add')">+</view>
</view>
<view class="btnbox">
<view class="cancle" @click="showGive = false">取消</view>
@ -494,6 +534,7 @@ import backNav from "@/components/backNav/backNav.vue";
import commentImg from "@/static/comment_icon.png";
import list from "@/uni_modules/z-paging/components/z-paging/z-paging";
import api from "@/api/api";
import uParse from "@/components/u-parse/u-parse.vue";
import { onLoad } from "@dcloudio/uni-app";
import dayjs from "dayjs";
const paging = ref(null);
@ -502,6 +543,7 @@ const total = ref(0);
const imgList = ref([]);
const showCanvas = ref(false);
const showCommentDialog = ref(false);
const givePointValue = ref(5);
const canvasWidth = ref(0);
const canvasHeight = ref(0);
const showModal = ref(false);
@ -522,16 +564,62 @@ const mainCommentObj = reactive({});
const childList = ref([]);
const clickIndex = ref(0);
const is_top = ref(false);
const option_id = ref("");
const point=ref(0)
const confirmGive = () => {
showGive.value = false;
givePoint();
};
const openGivePop=()=>{
showGive.value=true;
getUserPoint();
}
const formatDay = (date) => {
return dayjs(date).format("YYYY-MM-DD");
};
const formatDate = (date) => {
return dayjs(date).format("YYYY-MM-DD HH:mm");
};
const inputPoint=()=>{
if (givePointValue.value < 5) {
givePointValue.value = 5;
uni.showToast({
icon: "none",
title: "每次打赏范围5~100积分",
});
}
if (givePointValue.value > 100) {
givePointValue.value = 100;
uni.showToast({
icon: "none",
title: "每次打赏范围5~100积分",
});
}
};
const changePoint = (type) => {
if (type == 'minus') {
if (givePointValue.value > 5) {
givePointValue.value = givePointValue.value - 5
} else {
uni.showToast({
icon: "none",
title: "每次打赏范围5~100积分",
});
}
} else {
if (givePointValue.value <= 95) {
givePointValue.value = givePointValue.value + 5
} else {
uni.showToast({
icon: "none",
title: "每次打赏范围5~100积分",
});
}
}
}
const openMorePop = (obj, list, index) => {
showMore.value = true;
childList.value = list;
@ -556,16 +644,54 @@ const getExchangeDetail = (id) => {
Object.assign(info, result);
});
};
const getUserPoint=()=>{
api.getUserPoint().then(res=>{
console.log(res.data.data)
point.value=res.data.data
})
}
const givePoint=()=>{
if(point.value<givePointValue.value){
uni.showToast({
icon:'none',
title:'积分不足!'
})
return false
}
let giveType=1;
if(type.value=='article'){
giveType=1
}else if(type.value=='video'){
giveType=2
}else{
giveType=3
}
api.givePoint({
id:id.value,
type:giveType,
point:givePointValue.value,
}).then(res=>{
uni.showToast({
icon:'none',
title:'打赏成功!'
})
showGive.value=false;
})
}
onLoad((options) => {
id.value = options.id;
type.value = options.type;
if (type.value == "article") {
getArticleDetail(options.id);
} else if(type.value == "video") {
} else if (type.value == "video") {
getVideoDetail(options.id);
}else{
} else {
getExchangeDetail(options.id);
}
});
const clearComment = () => {
parent_id.value = null;
@ -613,11 +739,11 @@ const queryList = (pageNo, pageSize) => {
page_size: pageSize,
};
// type.value == "article" ? getArticleComment(params) : getVideoComment(params);
if(type.value == "article"){
getArticleComment(params)
}else if(type.value == "video"){
if (type.value == "article") {
getArticleComment(params);
} else if (type.value == "video") {
getVideoComment(params);
}else{
} else {
getExchangeComment(params);
}
};
@ -650,7 +776,7 @@ const getArticleComment = (params) => {
});
};
const getVideoComment = (params) => {
const form = {
const form = {
video_id: id.value,
is_have_sub_comment: 1,
};
@ -677,7 +803,7 @@ const getVideoComment = (params) => {
});
};
const getExchangeComment = (params) => {
const form = {
const form = {
exchange_id: id.value,
is_have_sub_comment: 1,
};
@ -1044,7 +1170,7 @@ const chooseImg = () => {
const handleUpload = (file) => {
let File = file.file;
//
api
.getOss({
@ -1058,7 +1184,7 @@ const handleUpload = (file) => {
let time = dayjs().format("YYYYMMDDHHmmss");
let random = generateRandomNumber();
let filename = time + random;
let imgType ="."+getImageFormat(File[0].url);
let imgType = "." + getImageFormat(File[0].url);
return new Promise((resolve, reject) => {
uni.uploadFile({
url: host, //
@ -1074,7 +1200,7 @@ const handleUpload = (file) => {
if (res.statusCode === 204) {
let url = host + "/" + dir + filename + imgType;
console.log(url);
imgList.value=[url]
imgList.value = [url];
}
},
fail: (err) => {
@ -1082,7 +1208,6 @@ const handleUpload = (file) => {
},
});
});
}
});
};
@ -1090,20 +1215,20 @@ const generateRandomNumber = () => {
let randomNumber = Math.floor(1000 + Math.random() * 9000);
return randomNumber;
};
const getImageFormat=(imageUrl)=>{
const lastDotIndex = imageUrl.lastIndexOf('.');
if (lastDotIndex !== -1) {
return imageUrl.substring(lastDotIndex + 1);
}
return 'unknown';
};
const getImageFormat = (imageUrl) => {
const lastDotIndex = imageUrl.lastIndexOf(".");
if (lastDotIndex !== -1) {
return imageUrl.substring(lastDotIndex + 1);
}
return "unknown";
};
const afterRead = (file, lists, name) => {
console.log(lists);
console.log(name);
handleUpload(file);
};
const delImg = (index) => {
imgList.value=[];
imgList.value = [];
};
const collectArticle = (id) => {
api.collectArticle(id).then((res) => {
@ -1164,10 +1289,12 @@ const cancelCollectExchange = (id) => {
const toggleCollect = () => {
if (type.value == "video") {
info.is_collect ? cancelCollectVideo(id.value) : collectVideo(id.value);
} else if(type.value == "article") {
} else if (type.value == "article") {
info.is_collect ? cancelCollectArticle(id.value) : collectArticle(id.value);
}else{
info.is_collect ? cancelCollectExchange(id.value) : collectExchange(id.value);
} else {
info.is_collect
? cancelCollectExchange(id.value)
: collectExchange(id.value);
}
};
const addArticleComment = (id, data) => {
@ -1221,12 +1348,18 @@ const delVideoComment = (id) => {
paging.value.refresh();
});
};
const fromatImg = (val) => {
return val.replace(/\<img/gi, '<img style="width:100%"');
};
const delExchangeComment = (id) => {
// API
api.delExchangeComment(id).then((res) => {
//
uni.showToast({
icon: "none",
title: "删除成功",
});
//
paging.value.refresh();
});
};
@ -1297,9 +1430,9 @@ const delComment = () => {
const confirmDel = () => {
if (type.value == "article") {
delArticleComment(parent_id.value);
} else if(type.value == "video") {
} else if (type.value == "video") {
delVideoComment(parent_id.value);
}else{
} else {
delExchangeComment(parent_id.value);
}
showModal.value = false;
@ -1310,11 +1443,11 @@ const toggleTop = () => {
is_top.value
? cancelTopArticleComment(parent_id.value)
: topArticleComment(parent_id.value);
} else if(type.value == "video") {
} else if (type.value == "video") {
is_top.value
? cancelTopVideoComment(parent_id.value)
: topVideoComment(parent_id.value);
}else{
} else {
is_top.value
? cancelTopExchangeComment(parent_id.value)
: topExchangeComment(parent_id.value);
@ -1334,8 +1467,8 @@ const sendComment = () => {
? "回复" + reply_name.value + "" + content.value
: content.value,
};
if(imgList.value.length>0){
postData.comment_image = imgList.value[0]
if (imgList.value.length > 0) {
postData.comment_image = imgList.value[0];
}
if (parent_id.value !== null) {
postData.parent_id = parent_id.value;
@ -1345,9 +1478,9 @@ const sendComment = () => {
}
if (type.value == "article") {
addArticleComment(id.value, postData);
} else if(type.value == "video") {
} else if (type.value == "video") {
addVideoComment(id.value, postData);
}else{
} else {
addExchangeComment(id.value, postData);
}
};
@ -1360,11 +1493,44 @@ const formatHtml = (val) => {
}
return val;
};
const addVote = () => {
if (!option_id.value) {
uni.showToast({
icon: "none",
title: "请选择投票选项!",
});
return false;
}
api
.addVote(id.value, {
option_id: option_id.value,
})
.then((res) => {
uni.showToast({
icon: "none",
title: "投票成功!",
});
getExchangeDetail(id.value);
});
};
</script>
<style lang='scss' scoped>
.videobox{
padding:20rpx 30rpx;
.videobox {
padding: 20rpx 30rpx;
.cloumn{
padding-bottom: 30rpx;
}
:deep(.video) {
display: flex;
justify-content: center;
}
.con {
:deep(.img) {
width: 100%;
}
}
}
.zanboxpop {
display: flex;
@ -1619,6 +1785,27 @@ const formatHtml = (val) => {
.votebox {
padding: 30rpx;
background: #fff;
.group{
margin-top: 20rpx;
.row{
border-radius: 20rpx;
border: 2rpx solid #B8B8B8;
padding: 16rpx;
background: #fff;
margin-bottom:24rpx;
}
}
.btn {
margin: 50rpx 40rpx 0;
height: 92rpx;
background: #3cc7c0;
border-radius: 46rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 32rpx;
color: #ffffff;
}
.name {
font-size: 36rpx;
color: #000000;
@ -1637,6 +1824,7 @@ const formatHtml = (val) => {
color: #4b5563;
display: flex;
align-items: center;
margin-bottom: 10rpx;
justify-content: space-between;
}
.line {

View File

@ -18,7 +18,7 @@
<view class="kubox">
<view class="row">
<up--image
@click="goList('video')"
@click="goVideo"
:src="videoImg"
radius="20rpx"
width="330rpx"
@ -27,7 +27,7 @@
></up--image>
<up--image
:src="sickImg"
@click="goList('article')"
@click="goSick"
width="330rpx"
radius="20rpx"
height="176rpx"
@ -68,7 +68,7 @@
</view>
</view>
<view class="listbox">
<view class="cell" v-for="item in new_articles" :key="item.article_id">
<view class="cell" v-for="item in new_articles" :key="item.article_id" @click="goDetail(item.article_id)">
<view class="circle"></view>
<view class="info">
<view class="name">{{item.article_title }}</view>
@ -89,7 +89,7 @@
</view>
</view>
<view class="listbox">
<view class="cell" v-for="item in most_read_articles" :key="item.article_id">
<view class="cell" v-for="item in most_read_articles" :key="item.article_id" @click="goDetail(item.article_id)">
<view class="circle"></view>
<view class="info">
<view class="name">{{item.article_title }}</view>
@ -109,7 +109,7 @@
</view>
</view>
<view class="list">
<view class="cell" v-for="item in recommend_hospital" :key="item.hospital_id">{{ item.hospital_name }}</view>
<view class="cell" v-for="item in recommend_hospital" :key="item.hospital_id" @click="goListBy(item.hospital_id,item.hospital_name ,'hospital')">{{ item.hospital_name }}</view>
</view>
</view>
<view class="recbox">
@ -121,7 +121,7 @@
</view>
</view>
<view class="list">
<view class="cell" v-for="item in recommend_doctor" :key="item.doctor_id">{{ item.doctor_name }}</view>
<view class="cell" v-for="item in recommend_doctor" :key="item.doctor_id" @click="goListBy(item.doctor_id,item.doctor_name ,'doctor')">{{ item.doctor_name }}</view>
</view>
</view>
</view>
@ -130,7 +130,7 @@
</template>
<script setup>
import { ref, reactive, onMounted } from "vue";
import { ref, reactive, onMounted,getCurrentInstance } from "vue";
import { onLoad} from "@dcloudio/uni-app";
import tabBar from "@/components/tabBar/tabBar.vue";
import navBar from "@/components/navBar/navBar.vue";
@ -148,6 +148,22 @@ const new_articles = ref([]);
const recommend_doctor=ref([]);
const recommend_hospital=ref([]);
const numInfo=reactive({})
const goDetail = (id) => {
uni.navigateTo({
url: `/pages/detail/detail?id=${id}&type=article`,
});
};
const goListBy=(id,name,type)=>{
let url=''
if(type=='doctor'){
url=`/pages/search/search?doctor_id=${id}&doctor_name=${name}`
}else{
url=`/pages/search/search?hospital_id=${id}&hospital_name=${name}`
}
uni.navigateTo({
url:url,
});
}
const getData = async() => {
const {data}=await api.getHomeData();
@ -163,7 +179,7 @@ const getData = async() => {
api.getHomeStatics().then((res) => {
let result=res.data.data;
Object.assign(numInfo,result);
console.log(numInfo.value)
})
}
const goList=(type)=>{
@ -171,6 +187,16 @@ const goList=(type)=>{
url:'/pages/search/search?order='+type
})
};
const goVideo=()=>{
uni.navigateTo({
url:'/pages/videoList/videoList'
})
}
const goSick=()=>{
uni.navigateTo({
url:'/pages/sickList/sickList'
})
}
const searchDoctor=()=>{
uni.navigateTo({
url:'/pages/searchList/searchList?type=doctor&name=医生&id='
@ -183,8 +209,8 @@ const goHospital=()=>{
}
onLoad(() => {
getStatic();
getData();
});
</script>
<style lang="scss" scoped>

View File

@ -214,6 +214,7 @@ const getPhoneNumber = (e) => {
api.wxLogin({
phone_code: e.target.code,
wx_code: res,
source:1
})
.then((data) => {
let result=data.data.data;

View File

@ -125,7 +125,7 @@ onLoad(()=>{
})
const goCert = () => {
uni.navigateTo({
url: "/pages/certList/certList",
url: "/pages/certList/certList?doctor_id="+userInfo.doctor_id,
});
};
const goDoctor=(id,name)=>{

View File

@ -9,8 +9,8 @@
@query="queryList"
>
<template #top>
<navBarSearch :searchWord="keyWord" :navName="navName"></navBarSearch>
<view class="databox" v-if="hospital_id || doctor_id">
<navBarSearch :searchWord="keyWord" :navName="navName" @changeWord="changeWord"></navBarSearch>
<view class="databox" v-if="hospital_id || doctor_id || (label_iden && !canOpenCase)">
<view class="cell">
<view class="num">{{ numInfo.article_collect_num }}</view>
<view class="name">文章</view>
@ -24,13 +24,15 @@
<view class="name">阅读量</view>
</view>
</view>
<view class="detail" v-if="total>0 && !(hospital_id || doctor_id)">
<view class="desc" v-if="isArticle">检索到:<text class="red">{{total}}篇文章</text></view>
<view class="desc" v-else>检索到<text class="red">{{total}}个视频</text></view>
<view class="bar"></view>
<view class="detail" v-if="isSearch">
<view class="desc" >检索到<text class="red">{{searchInfo.search_article_num}}篇文章</text></view>
<view class="desc" >检索到<text class="red">{{searchInfo.search_video_num}}个视频</text></view>
<view class="desc" v-if="keyWord">检索词:<text class="red">{{ keyWord }}</text></view>
</view>
<view class="filterbox">
<view class="filterbox" :class="{active:canOpenCase}">
<view class="type" @click="swicthType">{{!isArticle?'文章':'视频'}}<up--image :src="switchImg" width="31rpx" height="31rpx"></up--image></view>
<view class="casesdown" @click="openCase" v-if="canOpenCase">筛选<up--image :src="caseImg" width="31rpx" height="31rpx"></up--image></view>
<up-dropdown class="u-dropdown" ref="uDropdownRef">
<up-dropdown-item
v-model="order.push_date"
@ -72,6 +74,84 @@
</view>
</z-paging>
</view>
<up-popup
:round="10"
zIndex="9"
:show="showCase"
mode="bottom"
@close="closeCase"
>
<view class="votepop casepop">
<view class="titlebox">
<view class="left" @click="showCase = false">取消</view>
<view class="left continue" @click="continueCase" v-show="level != 3"
>继续选择</view
>
<view class="right" @click="confirmCase">确定</view>
</view>
<view class="casecon">
<view v-show="level == 1" >
<up-radio-group
v-model="caseValue1"
iconPlacement="right"
placement="column"
>
<view
class="column"
v-for="item in labelObj.list1"
:key="item.app_iden"
>
<up-radio
activeColor="#3CC7C0 "
:label="item.label_name"
:name="item.app_iden"
></up-radio>
</view>
</up-radio-group>
</view>
<view v-show="level == 2" >
<up-radio-group
v-model="caseValue2"
iconPlacement="right"
placement="column"
>
<view
class="column"
v-for="item in labelObj.list2"
:key="item.app_iden"
>
<up-radio
activeColor="#3CC7C0 "
:label="item.label_name"
:name="item.app_iden"
></up-radio>
</view>
</up-radio-group>
</view>
<view v-show="level == 3" >
<up-radio-group
v-model="caseValue3"
iconPlacement="right"
placement="column"
>
<view
class="column"
v-for="item in labelObj.list2"
:key="item.app_iden"
>
<up-radio
activeColor="#3CC7C0 "
:label="item.label_name"
:name="item.app_iden"
></up-radio>
</view>
</up-radio-group>
</view>
</view>
</view>
</up-popup>
</template>
<script setup>
@ -82,19 +162,20 @@ import api from "@/api/api";
import { onLoad } from "@dcloudio/uni-app";
import dayjs from "dayjs";
import switchImg from "@/static/switch.png";
import caseImg from "@/static/caseIcon.png";
const paging = ref(null);
const uDropdownRef=ref(null);
const dataList = ref([]);
const total = ref(0);
const value = ref("");
const keyWord = ref("");
const page=ref(1);
const label_iden = ref("");
const isArticle=ref(true);
const hospital_id=ref('');
const hospital_name=ref('');
const doctor_id=ref('');
const doctor_name=ref('');
const numInfo=reactive({});
const searchInfo=reactive({})
const navName=ref('肝胆相照临床病例库')
const options= ref([
{
@ -106,12 +187,96 @@ const options= ref([
value: 'desc',
},
]);
const isSearch=ref(false);
const order=reactive({
read_num:'',
push_date:''
})
const showCase = ref(false);
const canOpenCase = ref(false);
const caseValue1 = ref("");
const caseValue2 = ref("");
const caseValue3 = ref("");
const level = ref(1);
const labelObj = reactive({
list1: [],
list2: [],
list3: [],
});
const getCaseLabel = (lev,pid=0) => {
api.getCaseLabel({
pid:pid
}).then((res) => {
if (lev == 1) {
labelObj.list1 = res.data.data;
} else if (lev == 2) {
labelObj.list2 = res.data.data;
} else if (lev == 3) {
labelObj.list3 = res.data.data;
}
level.value = lev;
});
};
const openCase=()=>{
getCaseLabel(1,0)
showCase.value = true;
}
const confirmCase = () => {
if (level.value == 1 && caseValue1.value == "") {
uni.showToast({ title: "请选择疾病", icon: "none" });
return false;
}
if (level.value == 2 && caseValue2.value == "") {
uni.showToast({ title: "请选择疾病", icon: "none" });
return false;
}
if (level.value == 3 && caseValue3.value == "") {
uni.showToast({ title: "请选择疾病", icon: "none" });
return false;
}
showCase.value = false;
if(level.value == 1){
label_iden.value = caseValue1.value
}
if(level.value == 2 ){
label_iden.value = caseValue2.value
}
if(level.value == 3 ){
label_iden.value = caseValue3.value
}
};
const continueCase = () => {
if (level.value == 1 && caseValue1.value == "") {
uni.showToast({ title: "请选择疾病", icon: "none" });
return false;
}
if (level.value == 2 && caseValue2.value == "") {
uni.showToast({ title: "请选择疾病", icon: "none" });
return false;
}
if (level.value == 3 && caseValue3.value == "") {
uni.showToast({ title: "请选择疾病", icon: "none" });
return false;
}
if(level.value == 1 ){
getCaseLabel(2,caseValue1.value);
}else if(level.value == 2 ){
getCaseLabel(3,caseValue2.value);
}
paging.value.reload();
};
const closeCase = () => {
showCase.value = false;
};
const changeWord=(value)=>{
keyWord.value=value;
isSearch.value=true;
paging.value.reload()
}
onLoad((options) => {
if(options.keyWord){
keyWord.value = options.keyWord;
@ -135,9 +300,16 @@ onLoad((options) => {
hospital_id.value=options.hospital_id;
hospital_name.value=options.hospital_name;
navName.value= hospital_name.value+'临床病例库'
getStaticDoctor(hospital_id.value)
getStaticHospital(hospital_id.value)
}
if(options.case_id){
label_iden.value=options.case_id;
navName.value= options.case_name+'临床病例库'
getStaticSick(label_iden.value)
}else{
canOpenCase.value = true;
}
});
const change=(e)=>{
paging.value.reload();
@ -163,8 +335,11 @@ const swicthType=()=>{
const searchArticle =(params) => {
let searchForm={
keyword: keyWord.value,
doctor_id:doctor_id.value,
hospital_id:hospital_id.value
hospital_id:hospital_id.value,
doctor_id:doctor_id.value
}
if(isSearch.value){
searchForm.is_need_num=1;
}
if(!order.read_num){
delete order.read_num
@ -181,6 +356,8 @@ const searchArticle =(params) => {
}).then((res)=>{
paging.value.complete(res.data.data.data);
total.value=res.data.data.total;
searchInfo.search_video_num=res.data.data.search_video_num;
searchInfo.search_article_num=res.data.data.search_article_num;
}).catch(err=>{
paging.value.complete(false);
})
@ -189,6 +366,11 @@ const searchArticle =(params) => {
const searchVideo = async(params) => {
let searchForm={
keyword: keyWord.value,
hospital_id:hospital_id.value,
doctor_id:doctor_id.value
}
if(isSearch.value){
searchForm.is_need_num=1;
}
if(!order.read_num){
delete order.read_num
@ -200,10 +382,13 @@ const searchVideo = async(params) => {
searchForm.order=order
}
api.searchVideo({
...searchForm,
...params
}).then((res)=>{
paging.value.complete(res.data.data.data);
total.value=res.data.data.total;
searchInfo.search_video_num=res.data.data.search_video_num;
searchInfo.search_article_num=res.data.data.search_article_num;
}).catch(err=>{
paging.value.complete(false);
})
@ -224,6 +409,25 @@ const getStaticDoctor=(id)=>{
}
})
}
const getStaticSick=(id)=>{
api.getStaticSick({
label_iden:id
}).then((res)=>{
let result=res.data.data;
if(result){
Object.assign(numInfo,result);
}else{
Object.assign(numInfo,{
article_num: 0,
article_read_num: 0,
video_collect_num: 0,
video_num: 0,
video_read_num: 0,
});
}
})
}
const getStaticHospital=(id)=>{
api.getStaticHospital(id).then((res)=>{
let result=res.data.data;
@ -253,6 +457,114 @@ const queryList = (pageNo, pageSize) => {
</script>
<style lang="scss" scoped>
.bar {
width: 100%;
background: #f9fafb;
height: 20rpx;
}
.votepop {
.confirm {
margin: 39rpx 30rpx 0;
height: 92rpx;
background: #3cc7c0;
border-radius: 15rpx;
display: flex;
align-items: center;
font-size: 31rpx;
color: #ffffff;
justify-content: center;
}
.del {
margin: 30rpx 30rpx 30rpx;
height: 92rpx;
background: #fff;
border-radius: 15rpx;
font-size: 31rpx;
color: #666666;
display: flex;
align-items: center;
justify-content: center;
}
.tips {
margin-top: 30rpx;
font-size: 27rpx;
color: #9ca3af;
line-height: 38rpx;
padding: 0 30rpx;
}
.add {
margin: 0 30rpx;
display: flex;
align-items: center;
height: 92rpx;
justify-content: center;
background: #f5f5f5;
border-radius: 15rpx;
font-size: 31rpx;
color: #4b5563;
.desc {
margin-left: 10rpx;
}
}
.titlebox {
padding: 0 30rpx;
height: 86rpx;
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 2rpx solid #f3f4f6;
.left {
font-size: 31rpx;
color: #4b5563;
}
.right {
font-size: 31rpx;
color: #3cc7c0;
}
}
.votecon {
max-height: calc(100vh - 530rpx);
overflow-y: scroll;
.row {
display: flex;
align-items: center;
.iconbox {
margin-left: 15rpx;
align-items: center;
}
}
.titlebox {
border: none;
margin: 30rpx 0 20rpx;
.title {
font-size: 31rpx;
color: #111827;
}
.desc {
font-size: 27rpx;
color: #9ca3af;
}
}
}
}
.casepop{
display: flex;
flex-direction: column;
max-height: calc(100vh - 400rpx);
.continue{
color: #2878ff !important;
}
}
.casecon {
flex:1;
overflow-y: scroll;
padding-top: 10rpx;
min-height: 350rpx;
.column {
padding: 0 30rpx;
border-bottom: 2rpx solid #e5e7eb;
}
}
.databox {
height: 162rpx;
background: #ffffff;
@ -278,37 +590,20 @@ const queryList = (pageNo, pageSize) => {
}
}
.filterbox{
display: flex;
height:128rpx;
align-items: center;
position: relative;
.type{
position: absolute;
left:30rpx;
top:24rpx;
display: flex;
justify-content: center;
align-items: center;
background: #F3F4F6;
border-radius: 15rpx;
height: 74rpx;
padding:0 25rpx;
z-index:2;
}
}
.u-page {
:deep(.u-flex) {
:deep(.u-flex) {
display: flex;
flex-direction:row;
overflow: hidden;
}
:deep(.u-dropdown__menu){
background: #fff;
z-index:1;
margin-left: 180rpx;
margin-left: 160rpx;
}
:deep(.u-dropdown__menu__item__text){
font-size: 14px!important;
}
:deep(.u-dropdown__menu__item){
@ -320,6 +615,102 @@ const queryList = (pageNo, pageSize) => {
margin-left: 60rpx;
}
display: flex;
height:128rpx;
align-items: center;
position: relative;
.type{
position: absolute;
left:30rpx;
top:24rpx;
color: #606266;
font-size:14px;
display: flex;
justify-content: center;
align-items: center;
background: #F3F4F6;
border-radius: 15rpx;
height: 74rpx;
padding:0 25rpx;
z-index:2;
}
.casesdown{
font-size:14px;
color: #606266;
position: absolute;
left:190rpx;
top:24rpx;
display: flex;
justify-content: center;
align-items: center;
background: #F3F4F6;
border-radius: 15rpx;
height: 74rpx;
padding:0 25rpx;
z-index:2;
}
}
.filterbox.active{
:deep(.u-flex) {
display: flex;
flex-direction:row;
overflow: hidden;
}
:deep(.u-dropdown__menu){
background: #fff;
z-index:1;
margin-left: 330rpx;
}
:deep(.u-dropdown__menu__item__text){
font-size: 14px!important;
}
:deep(.u-dropdown__menu__item){
height:74rpx;
padding:0 20rpx;
background: #F3F4F6;
border-radius: 15rpx;
flex:none;
margin-left: 20rpx;
}
display: flex;
height:128rpx;
align-items: center;
position: relative;
.type{
position: absolute;
left:30rpx;
top:24rpx;
color: #606266;
font-size: 14px;
display: flex;
justify-content: center;
align-items: center;
background: #F3F4F6;
border-radius: 15rpx;
height: 74rpx;
padding:0 25rpx;
z-index:2;
}
.casesdown{
font-size: 14px;
color: #606266;
position: absolute;
left:190rpx;
top:24rpx;
display: flex;
justify-content: center;
align-items: center;
background: #F3F4F6;
border-radius: 15rpx;
height: 74rpx;
padding:0 25rpx;
z-index:2;
}
}
.u-page {
.deal {
margin-top: 20rpx;
display: flex;

View File

@ -70,84 +70,6 @@
</view>
</z-paging>
</view>
<up-popup
:round="10"
zIndex="9"
:show="showCase"
mode="bottom"
@close="closeCase"
>
<view class="votepop casepop">
<view class="titlebox">
<view class="left" @click="showCase = false">取消</view>
<view class="left continue" @click="continueCase" v-show="level != 3"
>继续选择</view
>
<view class="right" @click="confirmCase">确定</view>
</view>
<view class="casecon">
<view v-show="level == 1" >
<up-radio-group
v-model="caseValue1"
iconPlacement="right"
placement="column"
>
<view
class="column"
v-for="item in labelObj.list1"
:key="item.app_iden"
>
<up-radio
activeColor="#3CC7C0 "
:label="item.label_name"
:name="item.app_iden"
></up-radio>
</view>
</up-radio-group>
</view>
<view v-show="level == 2" >
<up-radio-group
v-model="caseValue2"
iconPlacement="right"
placement="column"
>
<view
class="column"
v-for="item in labelObj.list2"
:key="item.app_iden"
>
<up-radio
activeColor="#3CC7C0 "
:label="item.label_name"
:name="item.app_iden"
></up-radio>
</view>
</up-radio-group>
</view>
<view v-show="level == 3" >
<up-radio-group
v-model="caseValue3"
iconPlacement="right"
placement="column"
>
<view
class="column"
v-for="item in labelObj.list2"
:key="item.app_iden"
>
<up-radio
activeColor="#3CC7C0 "
:label="item.label_name"
:name="item.app_iden"
></up-radio>
</view>
</up-radio-group>
</view>
</view>
</view>
</up-popup>
</template>
<script setup>
@ -168,97 +90,6 @@ const keyWord = ref("");
const isArticle=ref(true)
const type=ref('doctor')
const navName=ref('医生临床病例库');
const showCase = ref(false);
const caseValue1 = ref("");
const caseValue2 = ref("");
const caseValue3 = ref("");
const level = ref(1);
const labelObj = reactive({
list1: [],
list2: [],
list3: [],
});
const getCaseLabel = (lev,pid=0) => {
api.getCaseLabel({
pid:pid
}).then((res) => {
if (lev == 1) {
labelObj.list1 = res.data.data;
} else if (lev == 2) {
labelObj.list2 = res.data.data;
} else if (lev == 3) {
labelObj.list3 = res.data.data;
}
level.value = lev;
});
};
const confirmCase = () => {
if (level.value == 1 && caseValue1.value == "") {
uni.showToast({ title: "请选择疾病", icon: "none" });
return false;
}
if (level.value == 2 && caseValue2.value == "") {
uni.showToast({ title: "请选择疾病", icon: "none" });
return false;
}
if (level.value == 3 && caseValue3.value == "") {
uni.showToast({ title: "请选择疾病", icon: "none" });
return false;
}
showCase.value = false;
if(level.value == 1){
let label = labelObj.list1.find((item) => item.app_iden == caseValue1.value);
console.log(label);
labelList.value.push({
app_iden:label.app_iden,
label_name:label.label_name,
});
}
if(level.value == 2 ){
let label = labelObj.list2.find((item) => item.app_iden == caseValue2.value);
labelList.value.push({
app_iden:label.app_iden,
label_name:label.label_name,
});
}
if(level.value == 3 ){
let label = labelObj.list3.find((item) => item.app_iden == caseValue3.value);
labelList.value.push({
app_iden:label.app_iden,
label_name:label.label_name,
});
}
//
labelList.value=labelList.value.filter((item, index) => labelList.value.findIndex(i => i.app_iden === item.app_iden) === index);
caseValue1.value = "";
caseValue2.value = "";
caseValue3.value = "";
};
const continueCase = () => {
if (level.value == 1 && caseValue1.value == "") {
uni.showToast({ title: "请选择疾病", icon: "none" });
return false;
}
if (level.value == 2 && caseValue2.value == "") {
uni.showToast({ title: "请选择疾病", icon: "none" });
return false;
}
if (level.value == 3 && caseValue3.value == "") {
uni.showToast({ title: "请选择疾病", icon: "none" });
return false;
}
if(level.value == 1 ){
getCaseLabel(2,caseValue1.value);
}else if(level.value == 2 ){
getCaseLabel(3,caseValue2.value);
}
};
const closeCase = () => {
showCase.value = false;
};
const options= ref([
{
label: "正序",
@ -437,110 +268,7 @@ const changeWord=(value)=>{
</script>
<style lang="scss" scoped>
.votepop {
.confirm {
margin: 39rpx 30rpx 0;
height: 92rpx;
background: #3cc7c0;
border-radius: 15rpx;
display: flex;
align-items: center;
font-size: 31rpx;
color: #ffffff;
justify-content: center;
}
.del {
margin: 30rpx 30rpx 30rpx;
height: 92rpx;
background: #fff;
border-radius: 15rpx;
font-size: 31rpx;
color: #666666;
display: flex;
align-items: center;
justify-content: center;
}
.tips {
margin-top: 30rpx;
font-size: 27rpx;
color: #9ca3af;
line-height: 38rpx;
padding: 0 30rpx;
}
.add {
margin: 0 30rpx;
display: flex;
align-items: center;
height: 92rpx;
justify-content: center;
background: #f5f5f5;
border-radius: 15rpx;
font-size: 31rpx;
color: #4b5563;
.desc {
margin-left: 10rpx;
}
}
.titlebox {
padding: 0 30rpx;
height: 86rpx;
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 2rpx solid #f3f4f6;
.left {
font-size: 31rpx;
color: #4b5563;
}
.right {
font-size: 31rpx;
color: #3cc7c0;
}
}
.votecon {
max-height: calc(100vh - 530rpx);
overflow-y: scroll;
.row {
display: flex;
align-items: center;
.iconbox {
margin-left: 15rpx;
align-items: center;
}
}
.titlebox {
border: none;
margin: 30rpx 0 20rpx;
.title {
font-size: 31rpx;
color: #111827;
}
.desc {
font-size: 27rpx;
color: #9ca3af;
}
}
}
}
.casepop{
display: flex;
flex-direction: column;
max-height: calc(100vh - 400rpx);
.continue{
color: #2878ff !important;
}
}
.casecon {
flex:1;
overflow-y: scroll;
padding-top: 10rpx;
min-height: 350rpx;
.column {
padding: 0 30rpx;
border-bottom: 2rpx solid #e5e7eb;
}
}
.databox {
height: 162rpx;
background: #ffffff;
@ -576,6 +304,9 @@ const changeWord=(value)=>{
border-bottom: 2rpx solid rgba(0,0,0,0.08);
align-items: center;
position: relative;
:deep(.u-dropdown__menu__item__text){
font-size: 14px!important;
}
.type{
position: absolute;
left:30rpx;

455
pages/sickList/sickList.vue Normal file
View File

@ -0,0 +1,455 @@
<template>
<view class="u-page">
<z-paging
ref="paging"
inside-more
loading-more-no-more-text="咱也是有底线的!"
:auto-show-back-to-top="true"
v-model="dataList"
@query="queryList"
>
<template #top>
<navBarSearch :searchWord="keyWord" :navName="navName" :type="'case'" @changeWord="changeWord"></navBarSearch>
<!-- <view class="databox">
<view class="cell">
<view class="num">22</view>
<view class="name">文章</view>
</view>
<view class="cell">
<view class="num">11</view>
<view class="name">视频</view>
</view>
<view class="cell">
<view class="num">44</view>
<view class="name">阅读量</view>
</view>
</view> -->
<!-- <view class="detail" v-if="total>0">
<view class="desc" v-if="isArticle">检索到:<text class="red">{{total}}篇文章</text></view>
<view class="desc" v-else>检索到<text class="red">{{total}}个视频</text></view>
<view class="desc" v-if="keyWord">检索词:<text class="red">{{ keyWord }}</text></view>
</view> -->
<view class="filterbox">
<!-- <view class="type" @click="swicthType">{{!isArticle?'文章':'视频'}}<up--image :src="switchImg" width="31rpx" height="31rpx"></up--image></view> -->
<up-dropdown class="u-dropdown" ref="uDropdownRef">
<up-dropdown-item
v-model="order.push_date"
title="发布时间"
@change="change"
:options="options"
></up-dropdown-item>
<up-dropdown-item
v-model="order.article_num"
title="文章数量"
@change="change"
:options="options"
></up-dropdown-item>
<!-- <up-dropdown-item
v-model="order.article_num"
title="阅读量"
@change="change"
:options="options"
></up-dropdown-item> -->
</up-dropdown>
</view>
</template>
<view class="listbox">
<view class="item" v-for="(item, index) in dataList" :key="index" @click="goDetail(item.label_iden,item.label_name)">
<view class="title ellipsis">{{item.label_name}}</view>
<!-- <view class="tagsbox">
<view class="tag" v-for="tag in item.author" :key="tag.author_id">{{ tag.doctor_name }}</view>
</view> -->
<view class="deal">
<view class="left">
<view class="count">
病例数{{ item.video_num+item.article_num}}<up--image :src="arrowrightImg" width="32rpx" height="32rpx"></up--image></view>
</view>
<view class="time">
<!-- <up-icon name="clock" color="#6B7280" size="28rpx"></up-icon> -->
<view class="num">更新时间{{formatdate(item.last_push_date) }}</view>
</view>
</view>
</view>
</view>
</z-paging>
</view>
</template>
<script setup>
import { ref, reactive} from "vue";
import navBarSearch from "@/components/navBarSearch/navBarSearch.vue";
import list from "@/uni_modules/z-paging/components/z-paging/z-paging";
import api from "@/api/api";
import { onLoad } from "@dcloudio/uni-app";
import dayjs from "dayjs";
import switchImg from "@/static/switch.png";
import arrowrightImg from "@/static/arrowright.png";
const paging = ref(null);
const uDropdownRef=ref(null);
const dataList = ref([]);
const total = ref(0);
const value = ref("");
const keyWord = ref("");
const isArticle=ref(true)
const type=ref('doctor')
const navName=ref('疾病临床病例库');
const options= ref([
{
label: "正序",
value: 'asc',
},
{
label: "倒序",
value: 'desc',
},
]);
const order=reactive({
article_num:'',
push_date:''
})
onLoad((options) => {
if(options.type=='hospital'){
type.value ='hospital';
}
keyWord.value=options.name;
if(options.name){
navName.value=options.name+'临床病例库'
}
if((options.name='医生' || options.name=='医院') && !options.id){
keyWord.value='';
}
if(options.order=='new'){
order.push_date='asc'
};
if(options.order=='read'){
order.article_num='desc'
};
});
const change=(e)=>{
paging.value.reload();
}
const formatdate=(date)=>{
return dayjs(date).format('YYYY-MM-DD')
}
const searchList = async(params) => {
let searchForm={
label_name: keyWord.value,
}
if(!order.article_num){
delete order.article_num
}
if(!order.push_date){
delete order.push_date
}
if(order.article_num || order.push_date){
searchForm.order=order
}
api.getSearchLabel({
...searchForm,
...params
}).then((res)=>{
paging.value.complete(res.data.data.data);
total.value=res.data.data.total;
}).catch(err=>{
paging.value.complete(false);
})
}
const queryList = (pageNo, pageSize) => {
const params = {
page: pageNo,
page_size: pageSize,
};
searchList(params);
};
const goDetail=(id,name)=>{
let url=`/pages/search/search?case_id=${id}&case_name=${name}`
uni.navigateTo({
url:url,
});
}
/**
* 修改关键词并更新界面
*
* @param value 输入的关键词
*/
const changeWord=(value)=>{
console.log(value);
if(value){
navName.value=value+'临床病例库';
keyWord.value=value;
dataList.value=[];
order.article_num='';
order.push_date='';
paging.value.reload();
}
}
</script>
<style lang="scss" scoped>
.votepop {
.confirm {
margin: 39rpx 30rpx 0;
height: 92rpx;
background: #3cc7c0;
border-radius: 15rpx;
display: flex;
align-items: center;
font-size: 31rpx;
color: #ffffff;
justify-content: center;
}
.del {
margin: 30rpx 30rpx 30rpx;
height: 92rpx;
background: #fff;
border-radius: 15rpx;
font-size: 31rpx;
color: #666666;
display: flex;
align-items: center;
justify-content: center;
}
.tips {
margin-top: 30rpx;
font-size: 27rpx;
color: #9ca3af;
line-height: 38rpx;
padding: 0 30rpx;
}
.add {
margin: 0 30rpx;
display: flex;
align-items: center;
height: 92rpx;
justify-content: center;
background: #f5f5f5;
border-radius: 15rpx;
font-size: 31rpx;
color: #4b5563;
.desc {
margin-left: 10rpx;
}
}
.titlebox {
padding: 0 30rpx;
height: 86rpx;
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 2rpx solid #f3f4f6;
.left {
font-size: 31rpx;
color: #4b5563;
}
.right {
font-size: 31rpx;
color: #3cc7c0;
}
}
.votecon {
max-height: calc(100vh - 530rpx);
overflow-y: scroll;
.row {
display: flex;
align-items: center;
.iconbox {
margin-left: 15rpx;
align-items: center;
}
}
.titlebox {
border: none;
margin: 30rpx 0 20rpx;
.title {
font-size: 31rpx;
color: #111827;
}
.desc {
font-size: 27rpx;
color: #9ca3af;
}
}
}
}
.casepop{
display: flex;
flex-direction: column;
max-height: calc(100vh - 400rpx);
.continue{
color: #2878ff !important;
}
}
.casecon {
flex:1;
overflow-y: scroll;
padding-top: 10rpx;
min-height: 350rpx;
.column {
padding: 0 30rpx;
border-bottom: 2rpx solid #e5e7eb;
}
}
.databox {
height: 162rpx;
background: #ffffff;
display: flex;
margin-bottom: 20rpx;
// padding: 0 30rpx;
justify-content: space-between;
.cell {
flex: 1;
padding: 35rpx 0;
text-align: center;
.num {
font-size: 38rpx;
color: #3cc7c0;
}
.name {
margin-top: 18rpx;
font-size: 28rpx;
color: #4b5563;
}
}
}
.listbox{
background: #F8F9FA;
overflow: hidden;
}
.filterbox{
display: flex;
height:128rpx;
background:#fff;
border-bottom: 2rpx solid rgba(0,0,0,0.08);
align-items: center;
position: relative;
.type{
position: absolute;
left:30rpx;
top:24rpx;
display: flex;
justify-content: center;
align-items: center;
background: #F3F4F6;
border-radius: 15rpx;
height: 74rpx;
padding:0 25rpx;
z-index:2;
}
}
.u-page {
:deep(.z-paging-content-fixed){
background: #F8F9FA!important;
}
:deep(.u-flex) {
display: flex;
flex-direction:row;
overflow: hidden;
}
:deep(.u-image){
background: none!important;
}
:deep(.u-dropdown__menu){
background: #fff;
z-index:1;
margin-left:30rpx;
}
:deep(.u-dropdown__menu__item){
height:74rpx;
padding:0 20rpx;
background: #F3F4F6;
border-radius: 15rpx;
flex:none;
margin-left: 30rpx;
}
.deal {
margin-top: 20rpx;
display: flex;
color: #6b7280;
background:#fff;
font-size: 24rpx;
justify-content: space-between;
.left {
display: flex;
align-items: center;
font-size: 27rpx;
.count{
display: flex;
align-items: center;
}
}
.collect {
display: flex;
align-items: center;
}
.eyebox {
width: 160rpx;
display: flex;
align-items: center;
}
.time {
display: flex;
align-items: center;
}
.num {
margin-left: 8rpx;
}
}
.item {
margin:30rpx;
background: #fff;
padding:30rpx;
box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.08);
border-radius: 23rpx;
.title {
font-size: 30rpx;
color: #111827;
line-height: 46rpx;
}
}
.tagsbox {
margin-top: 20rpx;
display: flex;
.tag {
padding: 0 10rpx;
margin-right: 16rpx;
height: 46rpx;
line-height: 46rpx;
text-align: center;
background: rgba(60, 199, 192, 0.1);
border-radius: 8rpx;
font-weight: 400;
font-size: 24rpx;
color: #3cc7c0;
}
}
}
.detail {
background: #f9f9f9;
padding: 12rpx 30rpx;
.desc {
font-size: 26rpx;
color: #4b5563;
line-height: 40rpx;
}
.red{
color: #FF0000;
}
}
</style>

View File

@ -22,6 +22,25 @@
>检索词<text class="red">{{ keyWord }}</text></view
>
</view>
<view class="bar"></view>
<view class="filterbox">
<!-- <view class="type" @click="swicthType">{{!isArticle?'文章':'视频'}}<up--image :src="switchImg" width="31rpx" height="31rpx"></up--image></view> -->
<up-dropdown class="u-dropdown" ref="uDropdownRef">
<up-dropdown-item
v-model="order.push_date"
title="发布时间"
@change="change"
:options="options"
></up-dropdown-item>
<up-dropdown-item
v-model="order.read_num"
title="阅读量"
@change="change"
:options="options"
></up-dropdown-item>
</up-dropdown>
</view>
</template>
<view class="box">
<!-- <view class="bar"></view> -->
@ -131,7 +150,7 @@
</template>
<script setup>
import { ref } from "vue";
import { ref,reactive} from "vue";
import navBar from "@/components/navBar/navBar.vue";
import tabBar from "@/components/tabBar/tabBar.vue";
import headImg from "@/static/headImg.png";
@ -146,6 +165,21 @@ const dataList = ref([]);
const total = ref(0);
const keyWord = ref("");
const showNum = ref(false);
const options= ref([
{
label: "正序",
value: 'asc',
},
{
label: "倒序",
value: 'desc',
},
]);
const order=reactive({
read_num:'',
push_date:''
})
const formatdate = (date) => {
return dayjs(date).format("YYYY-MM-DD");
};
@ -191,15 +225,15 @@ const searchList = async (params) => {
user_id: user_id.value,
is_selected: Number(is_selected.value)
};
// if(!order.read_num){
// delete order.read_num
// }
// if(!order.push_date){
// delete order.push_date
// }
// if(order.read_num || order.push_date){
// searchForm.order=order
// }
if(!order.read_num){
delete order.read_num
}
if(!order.push_date){
delete order.push_date
}
if(order.read_num || order.push_date){
searchForm.order=order
}
api.searchExchage({
...searchForm,
...params,
@ -215,6 +249,31 @@ const searchList = async (params) => {
</script>
<style lang='scss' scoped>
.filterbox{
display: flex;
height:128rpx;
align-items: center;
position: relative;
border-bottom: 2rpx solid #f3f4f6;
:deep(.u-dropdown__menu__item__text){
font-size: 14px!important;
}
.type{
color: #606266;
font-size:14px;
position: absolute;
left:30rpx;
top:24rpx;
display: flex;
justify-content: center;
align-items: center;
background: #F3F4F6;
border-radius: 15rpx;
height: 74rpx;
padding:0 25rpx;
z-index:2;
}
}
.detail {
background: #f9f9f9;
padding: 12rpx 30rpx;
@ -231,6 +290,29 @@ const searchList = async (params) => {
display: flex;
flex-direction: column;
height: calc(100vh - 100rpx);
:deep(.u-flex) {
display: flex;
flex-direction:row;
overflow: hidden;
}
:deep(.u-dropdown__menu){
background: #fff;
z-index:1;
margin-left: 0rpx;
}
:deep(.u-dropdown__menu__item){
height:74rpx;
padding:0 20rpx;
background: #F3F4F6;
border-radius: 15rpx;
flex:none;
margin-left: 30rpx;
}
}
.box {

View File

@ -0,0 +1,391 @@
<template>
<view class="u-page">
<z-paging
ref="paging"
inside-more
loading-more-no-more-text="咱也是有底线的!"
:auto-show-back-to-top="true"
v-model="dataList"
@query="queryList"
>
<template #top>
<navBarSearch :searchWord="keyWord" :navName="navName" @changeWord="changeWord" :type="'video'"></navBarSearch>
<view class="databox" >
<view class="cell" v-if="isArticle">
<view class="num">{{ numInfo.article_collect_num }}</view>
<view class="name">文章</view>
</view>
<view class="cell" v-else>
<view class="num">{{ numInfo.video_collect_num }}</view>
<view class="name">视频</view>
</view>
<view class="cell" v-if="isArticle">
<view class="num">{{numInfo.article_read_num }}</view>
<view class="name">阅读量</view>
</view>
<view class="cell" v-else>
<view class="num">{{numInfo.video_read_num}}</view>
<view class="name">阅读量</view>
</view>
</view>
<view class="bar"></view>
<!-- <view class="detail" v-if="isSearch">
<view class="desc" v-if="isArticle">检索到:<text class="red">{{searchInfo.search_article_num}}篇文章</text></view>
<view class="desc" v-else>检索到<text class="red">{{searchInfo.search_video_num}}个视频</text></view>
<view class="desc" v-if="keyWord">检索词:<text class="red">{{ keyWord }}</text></view>
</view> -->
<view class="filterbox">
<!-- <view class="type" @click="swicthType">{{!isArticle?'文章':'视频'}}<up--image :src="switchImg" width="31rpx" height="31rpx"></up--image></view> -->
<up-dropdown class="u-dropdown" ref="uDropdownRef">
<up-dropdown-item
v-model="order.push_date"
title="发布时间"
@change="change"
:options="options"
></up-dropdown-item>
<up-dropdown-item
v-model="order.read_num"
title="阅读量"
@change="change"
:options="options"
></up-dropdown-item>
</up-dropdown>
</view>
</template>
<view class="item" v-for="(item, index) in dataList" :key="index" @click="isArticle?goDetail(item.article_id):goDetail(item.video_id)">
<view class="title ellipsis">{{isArticle?item.article_title:item.video_title }}</view>
<view class="tagsbox">
<view class="tag" v-for="tag in item.author" :key="tag.author_id">{{ tag.doctor_name }}</view>
</view>
<view class="deal">
<view class="left">
<view class="eyebox">
<up-icon name="eye" color="#6B7280" size="28rpx"></up-icon>
<view class="num">{{item.read_num }}</view>
</view>
<view class="collect">
<up-icon name="heart" color="#6B7280" size="28rpx"></up-icon>
<view class="num">{{item.collect_num }}</view>
</view>
</view>
<view class="time">
<up-icon name="clock" color="#6B7280" size="28rpx"></up-icon>
<view class="num">{{formatdate(item.push_date) }}</view>
</view>
</view>
</view>
</z-paging>
</view>
</template>
<script setup>
import { ref, reactive } from "vue";
import navBarSearch from "@/components/navBarSearch/navBarSearch.vue";
import list from "@/uni_modules/z-paging/components/z-paging/z-paging";
import api from "@/api/api";
import { onLoad } from "@dcloudio/uni-app";
import dayjs from "dayjs";
import switchImg from "@/static/switch.png";
const paging = ref(null);
const uDropdownRef=ref(null);
const dataList = ref([]);
const total = ref(0);
const keyWord = ref("");
const isArticle=ref(false);
const hospital_id=ref('');
const hospital_name=ref('');
const doctor_id=ref('');
const doctor_name=ref('');
const numInfo=reactive({});
const searchInfo=reactive({})
const navName=ref('视频临床病例库')
const options= ref([
{
label: "正序",
value: 'asc',
},
{
label: "倒序",
value: 'desc',
},
]);
const isSearch=ref(false);
const order=reactive({
read_num:'',
push_date:''
})
const changeWord=(value)=>{
keyWord.value=value;
isSearch.value=true;
paging.value.reload()
}
onLoad((options) => {
if(options.keyWord){
keyWord.value = options.keyWord;
};
if(options.order=='new'){
order.push_date='asc'
};
if(options.order=='read'){
order.read_num='desc'
};
if(options.order=='video'){
isArticle.value=false;
}
getStatic();
if(options.doctor_id){
doctor_id.value=options.doctor_id;
doctor_name.value=options.doctor_name
navName.value= doctor_name.value+'临床病例库'
getStaticDoctor(doctor_id.value)
}
if(options.hospital_id){
hospital_id.value=options.hospital_id;
hospital_name.value=options.hospital_name;
navName.value= hospital_name.value+'临床病例库'
getStaticDoctor(hospital_id.value)
}
});
const change=(e)=>{
paging.value.reload();
}
const formatdate=(date)=>{
return dayjs(date).format('YYYY-MM-DD')
}
const goDetail=(id)=>{
console.log(11111)
console.log(id)
let type=isArticle.value?'article':'video'
uni.navigateTo({
url: `/pages/detail/detail?id=${id}&type=${type}`
})
}
const getStatic=()=>{
api.getHomeStatics().then((res) => {
let result=res.data.data;
Object.assign(numInfo,result);
})
}
const searchArticle =(params) => {
let searchForm={
keyword: keyWord.value,
hospital_id:hospital_id.value,
doctor_id:doctor_id.value
}
if(isSearch.value){
searchForm.is_need_num=1;
}
if(!order.read_num){
delete order.read_num
}
if(!order.push_date){
delete order.push_date
}
if(order.read_num || order.push_date){
searchForm.order=order
}
api.searchArticle({
...searchForm,
...params
}).then((res)=>{
paging.value.complete(res.data.data.data);
total.value=res.data.data.total;
searchInfo.search_video_num=res.data.data.search_video_num;
searchInfo.search_article_num=res.data.data.search_article_num;
}).catch(err=>{
paging.value.complete(false);
})
}
const searchVideo = async(params) => {
let searchForm={
keyword: keyWord.value,
hospital_id:hospital_id.value,
doctor_id:doctor_id.value
}
if(isSearch.value){
searchForm.is_need_num=1;
}
if(!order.read_num){
delete order.read_num
}
if(!order.push_date){
delete order.push_date
}
if(order.read_num || order.push_date){
searchForm.order=order
}
api.searchVideo({
...searchForm,
...params
}).then((res)=>{
paging.value.complete(res.data.data.data);
total.value=res.data.data.total;
searchInfo.search_video_num=res.data.data.search_video_num;
searchInfo.search_article_num=res.data.data.search_article_num;
}).catch(err=>{
paging.value.complete(false);
})
}
const queryList = (pageNo, pageSize) => {
console.log(666666);
const params = {
page: pageNo,
page_size: pageSize,
};
isArticle.value?searchArticle(params):searchVideo(params)
};
</script>
<style lang="scss" scoped>
.bar {
width: 100%;
background: #f9fafb;
height: 20rpx;
}
.databox {
height: 162rpx;
background: #ffffff;
display: flex;
margin-bottom: 20rpx;
// padding: 0 30rpx;
justify-content: space-between;
.cell {
flex: 1;
padding: 35rpx 0;
text-align: center;
.num {
font-size: 38rpx;
color: #3cc7c0;
}
.name {
margin-top: 18rpx;
font-size: 28rpx;
color: #4b5563;
}
}
}
.filterbox{
display: flex;
height:128rpx;
align-items: center;
position: relative;
border-bottom: 2rpx solid #f3f4f6;
:deep(.u-dropdown__menu__item__text){
font-size: 14px!important;
}
.type{
color: #606266;
font-size:14px;
position: absolute;
left:30rpx;
top:24rpx;
display: flex;
justify-content: center;
align-items: center;
background: #F3F4F6;
border-radius: 15rpx;
height: 74rpx;
padding:0 25rpx;
z-index:2;
}
}
.u-page {
:deep(.u-flex) {
display: flex;
flex-direction:row;
overflow: hidden;
}
:deep(.u-dropdown__menu){
background: #fff;
z-index:1;
margin-left: 30rpx;
}
:deep(.u-dropdown__menu__item){
height:74rpx;
padding:0 20rpx;
background: #F3F4F6;
border-radius: 15rpx;
flex:none;
margin-left: 30rpx;
}
.deal {
margin-top: 20rpx;
display: flex;
color: #6b7280;
font-size: 24rpx;
justify-content: space-between;
.left {
display: flex;
align-items: center;
}
.collect {
display: flex;
align-items: center;
}
.eyebox {
width: 160rpx;
display: flex;
align-items: center;
}
.time {
display: flex;
align-items: center;
}
.num {
margin-left: 8rpx;
}
}
.item {
border-bottom: 1rpx solid #f3f4f6;
padding: 30rpx;
.title {
font-size: 30rpx;
color: #111827;
line-height: 46rpx;
}
}
.tagsbox {
margin-top: 20rpx;
display: flex;
.tag {
padding: 0 10rpx;
margin-right: 16rpx;
height: 46rpx;
line-height: 46rpx;
text-align: center;
background: rgba(60, 199, 192, 0.1);
border-radius: 8rpx;
font-weight: 400;
font-size: 24rpx;
color: #3cc7c0;
}
}
}
.detail {
background: #f9f9f9;
padding: 12rpx 30rpx;
.desc {
font-size: 26rpx;
color: #4b5563;
line-height: 40rpx;
}
.red{
color: #FF0000;
}
}
</style>

BIN
static/caseIcon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 438 B

View File

@ -1,22 +1,35 @@
import pageUrl from './pageUrl'
function navTo(obj){
// let token='';
// if(process.env.NODE_ENV === 'development'){
// token = uni.getStorageSync('DEV_AUTH_TOKEN_CASEDATA');
// }else{
// token = uni.getStorageSync('AUTH_TOKEN_CASEDATA');
// }
// if(!token){
// let page_url=pageUrl();
// uni.setStorageSync('redirectUrl',page_url);
// uni.navigateTo({
// url: '/pages/login/login?redirectUrl=has'
// });
// }else{
// uni.navigateTo(obj)
// }
uni.navigateTo(obj)
function navTo(obj) {
let token = '';
if (process.env.NODE_ENV === 'development') {
token = uni.getStorageSync('DEV_AUTH_TOKEN_CASEDATA');
} else {
token = uni.getStorageSync('AUTH_TOKEN_CASEDATA');
}
if (!token) {
let page_url = pageUrl();
uni.setStorageSync('redirectUrl', page_url);
uni.navigateTo({
url: '/pages/login/login?redirectUrl=has'
});
} else {
// # ifdef MP-WEIXIN
const pages = getCurrentPages();
let len = pages.length;
if (len < 10) {
uni.navigateTo(obj)
} else {
uni.redirectTo(obj)
}
// # endif
// # ifdef H5
uni.navigateTo(obj)
//# endif
}
}
export default navTo