diseaseDetails.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. <template>
  2. <view class="content" v-if="item!=null">
  3. <view class="detail-cont">
  4. <view class="title-box">
  5. <view class="line"></view>
  6. <view class="title">疾病名称</view>
  7. </view>
  8. <view class="desc" v-html="item.diseaseName"></view>
  9. <view class="title-box">
  10. <view class="line"></view>
  11. <view class="title">病情症状</view>
  12. </view>
  13. <view class="desc" v-html="item.symptom"></view>
  14. <view class="title-box">
  15. <view class="line"></view>
  16. <view class="title">病情诊断</view>
  17. </view>
  18. <view class="desc" v-html="item.diagnose"></view>
  19. <view class="title-box">
  20. <view class="line"></view>
  21. <view class="title">相关检验</view>
  22. </view>
  23. <view class="desc" v-html="item.inspect"></view>
  24. </view>
  25. <view class="ad">
  26. <u-swiper
  27. :list="advImgs"
  28. indicator
  29. indicatorMode="line"
  30. circular
  31. @click="handleAdvClick"
  32. ></u-swiper>
  33. </view>
  34. <!-- 分享弹窗 -->
  35. <u-popup :show="showShare" @close="showShare = false" >
  36. <share-box :shareItem="shareItem" @closeShare='showShare = false' ></share-box>
  37. </u-popup>
  38. <h5-down-app-tip :pageUrl="pageUrl"/>
  39. </view>
  40. </template>
  41. <script>
  42. import {getDiseaseById} from '@/api/disease'
  43. import {getAdvList} from '@/api/adv.js'
  44. export default {
  45. data() {
  46. return {
  47. advs:[],
  48. advImgs:[],
  49. diseaseId:null,
  50. item:{},
  51. showShare:false,
  52. shareItem:{ imageUrl:"",title:"",path:"",isMini:true, yyb:true },
  53. pageUrl: ''
  54. };
  55. },
  56. onLoad(option) {
  57. this.diseaseId=option.diseaseId;
  58. },
  59. onShow() {
  60. if(!this.$isLogin()) {
  61. uni.navigateTo({
  62. url: '/pages/auth/loginIndex'
  63. })
  64. return
  65. }
  66. this.pageUrl = '/pages/article/diseaseDetails?diseaseId='+this.diseaseId;
  67. this.getAdvList();
  68. this.getDiseaseById();
  69. },
  70. onShareAppMessage(res) {
  71. if(this.$isLogin()){
  72. return {
  73. title: this.item.diseaseName,
  74. path: '/pages_index/diseaseDetails?diseaseId='+this.diseaseId,
  75. imageUrl: 'https://zkzh-2025.oss-cn-beijing.aliyuncs.com/appimgs/minilogo.png' //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
  76. }
  77. }
  78. },
  79. //分享到朋友圈
  80. onShareTimeline(res) {
  81. if(this.$isLogin()){
  82. return {
  83. title: this.item.diseaseName,
  84. path: '/pages_index/diseaseDetails?diseaseId='+this.diseaseId,
  85. imageUrl: 'https://zkzh-2025.oss-cn-beijing.aliyuncs.com/appimgs/minilogo.png' //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
  86. }
  87. }
  88. },
  89. onNavigationBarButtonTap(e) {
  90. //#ifdef APP-PLUS
  91. this.shareItem.healthId= this.diseaseId;
  92. this.shareItem.title= this.item.diseaseName;
  93. this.shareItem.imageUrl="/static/logo.png";
  94. this.shareItem.isMini=true;
  95. this.shareItem.path='/pages/article/diseaseDetails?diseaseId='+this.diseaseId;
  96. this.showShare=true;
  97. //#endif
  98. },
  99. methods:{
  100. handleAdvClick(index){
  101. var ad=this.advs[index];
  102. console.log(ad.advUrl);
  103. if(ad.showType==1){
  104. uni.setStorageSync('url',ad.appAdvUrl);
  105. uni.navigateTo({
  106. url:"h5"
  107. })
  108. }
  109. else if(ad.showType==2){
  110. uni.navigateTo({
  111. url:ad.appAdvUrl
  112. })
  113. }
  114. else if(ad.showType==3){
  115. uni.setStorageSync('content',ad.content);
  116. uni.navigateTo({
  117. url:"content"
  118. })
  119. }
  120. },
  121. getAdvList() {
  122. //联网加载数据
  123. var that = this;
  124. var data = {
  125. advType:7
  126. };
  127. getAdvList(data).then(res => {
  128. if(res.code==200){
  129. that.advImgs=[];
  130. that.advs=[];
  131. res.data.forEach(function(element) {
  132. if(element.imageUrl!=null&&element.imageUrl!=""){
  133. that.advs.push(element);
  134. that.advImgs.push(element.imageUrl);
  135. }
  136. });
  137. }else{
  138. uni.showToast({
  139. icon:'none',
  140. title: "请求失败",
  141. });
  142. }
  143. });
  144. },
  145. getDiseaseById(){
  146. let data = {diseaseId:this.diseaseId};
  147. getDiseaseById(data).then(
  148. res => {
  149. if(res.code==200){
  150. this.item=res.data;
  151. }else{
  152. uni.showToast({
  153. icon:'none',
  154. title: "请求失败",
  155. });
  156. }
  157. },
  158. rej => {}
  159. );
  160. },
  161. }
  162. }
  163. </script>
  164. <style lang="scss" scoped>
  165. page{
  166. height: 100%;
  167. }
  168. .content{
  169. }
  170. .detail-cont{
  171. margin: 20rpx;
  172. padding: 15rpx;
  173. box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
  174. background-color: #fff;
  175. border-radius: 15rpx;
  176. .title-box{
  177. width: 100%;
  178. display: flex;
  179. justify-content: flex-start;
  180. align-items: center;
  181. .line{
  182. width: 6rpx;
  183. height:30rpx;
  184. background-color: #2583EB;
  185. }
  186. .title{
  187. margin-left: 15rpx;
  188. font-size: 32upx;
  189. font-family: PingFang SC;
  190. font-weight: bold;
  191. color: #333;
  192. }
  193. }
  194. .desc{
  195. margin-top: 15rpx;
  196. margin-bottom: 15rpx;
  197. font-size: 28upx;
  198. font-family: PingFang SC;
  199. color: #9a9a9c;
  200. }
  201. }
  202. .ad{
  203. margin-bottom: 50rpx;
  204. width: 100%;
  205. padding: 15rpx;
  206. }
  207. </style>