diseaseDetails.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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. </view>
  35. </template>
  36. <script>
  37. import {getDiseaseById} from '@/api/disease'
  38. import {getAdvList} from '@/api/adv.js'
  39. export default {
  40. data() {
  41. return {
  42. advs:[],
  43. advImgs:[],
  44. diseaseId:null,
  45. item:{},
  46. };
  47. },
  48. onLoad(option) {
  49. this.diseaseId=option.diseaseId;
  50. },
  51. onShow() {
  52. this.getAdvList();
  53. this.getDiseaseById();
  54. },
  55. onShareAppMessage(res) {
  56. if(this.$isLogin()){
  57. return {
  58. title: this.item.diseaseName,
  59. path: '/pages_index/diseaseDetails?id='+this.diseaseId,
  60. imageUrl: 'https://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20230106/6b459adfb1004c1a96219bcdf07e337c.png' //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
  61. }
  62. }
  63. },
  64. //分享到朋友圈
  65. onShareTimeline(res) {
  66. if(this.utils.isLogin()){
  67. return {
  68. title: this.item.diseaseName,
  69. imageUrl: 'https://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20230106/6b459adfb1004c1a96219bcdf07e337c.png' //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
  70. }
  71. }
  72. },
  73. methods:{
  74. handleAdvClick(index){
  75. var ad=this.advs[index];
  76. console.log(ad.advUrl);
  77. if(ad.showType==1){
  78. uni.setStorageSync('url',ad.advUrl);
  79. uni.navigateTo({
  80. url:"h5"
  81. })
  82. }
  83. else if(ad.showType==2){
  84. uni.navigateTo({
  85. url:ad.advUrl
  86. })
  87. }
  88. else if(ad.showType==3){
  89. uni.setStorageSync('content',ad.content);
  90. uni.navigateTo({
  91. url:"content"
  92. })
  93. }
  94. },
  95. getAdvList() {
  96. //联网加载数据
  97. var that = this;
  98. var data = {
  99. advType:7
  100. };
  101. getAdvList(data).then(res => {
  102. if(res.code==200){
  103. that.advImgs=[];
  104. that.advs=[];
  105. res.data.forEach(function(element) {
  106. if(element.imageUrl!=null&&element.imageUrl!=""){
  107. that.advs.push(element);
  108. that.advImgs.push(element.imageUrl);
  109. }
  110. });
  111. }else{
  112. uni.showToast({
  113. icon:'none',
  114. title: "请求失败",
  115. });
  116. }
  117. });
  118. },
  119. getDiseaseById(){
  120. let data = {diseaseId:this.diseaseId};
  121. getDiseaseById(data).then(
  122. res => {
  123. if(res.code==200){
  124. this.item=res.data;
  125. }else{
  126. uni.showToast({
  127. icon:'none',
  128. title: "请求失败",
  129. });
  130. }
  131. },
  132. rej => {}
  133. );
  134. },
  135. }
  136. }
  137. </script>
  138. <style lang="scss">
  139. page{
  140. height: 100%;
  141. }
  142. .content{
  143. }
  144. .detail-cont{
  145. margin: 20rpx;
  146. padding: 15rpx;
  147. box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
  148. background-color: #fff;
  149. border-radius: 15rpx;
  150. .title-box{
  151. width: 100%;
  152. display: flex;
  153. justify-content: flex-start;
  154. align-items: center;
  155. .line{
  156. width: 6rpx;
  157. height:30rpx;
  158. background-color: #C39A58;
  159. }
  160. .title{
  161. margin-left: 15rpx;
  162. font-size: 32upx;
  163. font-family: PingFang SC;
  164. font-weight: bold;
  165. color: #333;
  166. }
  167. }
  168. .desc{
  169. margin-top: 15rpx;
  170. margin-bottom: 15rpx;
  171. font-size: 28upx;
  172. font-family: PingFang SC;
  173. color: #9a9a9c;
  174. }
  175. }
  176. .ad{
  177. margin-bottom: 50rpx;
  178. width: 100%;
  179. padding: 15rpx;
  180. }
  181. </style>