diseaseDetails.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  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 },
  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://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20230106/6b459adfb1004c1a96219bcdf07e337c.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://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20230106/6b459adfb1004c1a96219bcdf07e337c.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_index/diseaseDetails?diseaseId='+this.diseaseId;
  96. let cdn=uni.getStorageSync('h5Path');
  97. this.shareItem.url=cdn+'/pages/article/diseaseDetails?diseaseId='+this.diseaseId;
  98. this.showShare=true;
  99. //#endif
  100. },
  101. methods:{
  102. handleAdvClick(index){
  103. var ad=this.advs[index];
  104. console.log(ad.advUrl);
  105. if(ad.showType==1){
  106. uni.setStorageSync('url',ad.appAdvUrl);
  107. uni.navigateTo({
  108. url:"h5"
  109. })
  110. }
  111. else if(ad.showType==2){
  112. uni.navigateTo({
  113. url:ad.appAdvUrl
  114. })
  115. }
  116. else if(ad.showType==3){
  117. uni.setStorageSync('content',ad.content);
  118. uni.navigateTo({
  119. url:"content"
  120. })
  121. }
  122. },
  123. getAdvList() {
  124. //联网加载数据
  125. var that = this;
  126. var data = {
  127. advType:7
  128. };
  129. getAdvList(data).then(res => {
  130. if(res.code==200){
  131. that.advImgs=[];
  132. that.advs=[];
  133. res.data.forEach(function(element) {
  134. if(element.imageUrl!=null&&element.imageUrl!=""){
  135. that.advs.push(element);
  136. that.advImgs.push(element.imageUrl);
  137. }
  138. });
  139. }else{
  140. uni.showToast({
  141. icon:'none',
  142. title: "请求失败",
  143. });
  144. }
  145. });
  146. },
  147. getDiseaseById(){
  148. let data = {diseaseId:this.diseaseId};
  149. getDiseaseById(data).then(
  150. res => {
  151. if(res.code==200){
  152. this.item=res.data;
  153. }else{
  154. uni.showToast({
  155. icon:'none',
  156. title: "请求失败",
  157. });
  158. }
  159. },
  160. rej => {}
  161. );
  162. },
  163. }
  164. }
  165. </script>
  166. <style lang="scss" scoped>
  167. page{
  168. height: 100%;
  169. }
  170. .content{
  171. }
  172. .detail-cont{
  173. margin: 20rpx;
  174. padding: 15rpx;
  175. box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
  176. background-color: #fff;
  177. border-radius: 15rpx;
  178. .title-box{
  179. width: 100%;
  180. display: flex;
  181. justify-content: flex-start;
  182. align-items: center;
  183. .line{
  184. width: 6rpx;
  185. height:30rpx;
  186. background-color: #FF5C03;
  187. }
  188. .title{
  189. margin-left: 15rpx;
  190. font-size: 32upx;
  191. font-family: PingFang SC;
  192. font-weight: bold;
  193. color: #333;
  194. }
  195. }
  196. .desc{
  197. margin-top: 15rpx;
  198. margin-bottom: 15rpx;
  199. font-size: 28upx;
  200. font-family: PingFang SC;
  201. color: #9a9a9c;
  202. }
  203. }
  204. .ad{
  205. margin-bottom: 50rpx;
  206. width: 100%;
  207. padding: 15rpx;
  208. }
  209. </style>