introduction.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. <template>
  2. <view class="container">
  3. <view class="content">
  4. <swiper indicator-dots class="swiper">
  5. <swiper-item v-for="(item, index) in photoArr" :key="index">
  6. <image :src="item" mode="aspectFill" @click="imgClick(item)"></image>
  7. </swiper-item>
  8. </swiper>
  9. <view class="content_inner">
  10. <view class="title">{{hospitalInfo.HospitalName}}</view>
  11. <view class="tip">
  12. <text class="tip_tow">综合医院</text>
  13. <text class="tip_tow border_left">{{hospitalInfo.HospitalLevel}}</text>
  14. <text class="tip_tow border_left">医保定点</text>
  15. </view>
  16. <view class="details">
  17. <view :class="['details_text', showMore ? 'infoTxtMore' : 'infoTxt']">
  18. <view>
  19. <rich-text :nodes="processedIntro"></rich-text>
  20. <view></view>
  21. </view>
  22. </view>
  23. <view class="details_an" @click="moreClick">
  24. {{showMore?'收起':'展开'}}
  25. <image :class="['right_img', showMore ? 'right_img_up' : '']" :src="iconUrl.icon_right"></image>
  26. </view>
  27. </view>
  28. <view class="basis_info">
  29. <view class="info_item">
  30. <view class="item_title">门诊时间</view>
  31. <view class="item_tip">{{hospitalInfo.OfficeHours}}</view>
  32. </view>
  33. <view class="info_item">
  34. <view class="item_title">公交路线</view>
  35. <view class="item_tip">{{hospitalInfo.HospitalTraffic}}</view>
  36. </view>
  37. </view>
  38. <view class="message">
  39. <view class="message_list border_bottom" @click="optionClick('mobile')">
  40. <image class="item_img" :src="iconUrl.icon_phone"></image>
  41. <text>{{hospitalInfo.Contact}}</text>
  42. <image class="public_right_img" :src="iconUrl.icon_right"></image>
  43. </view>
  44. <view class="message_list" @click="optionClick('address')">
  45. <image class="item_img" :src="iconUrl.icon_address"></image>
  46. <text class="address">{{(hospitalInfo.ProvinceName || '') + (hospitalInfo.CityName || '') + (hospitalInfo.AreaName || '') + (hospitalInfo.HospitalAddress || '')}}</text>
  47. <image class="public_right_img" :src="iconUrl.icon_right"></image>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. </template>
  54. <script setup lang="ts">
  55. import { ref } from 'vue';
  56. import { onLoad } from '@dcloudio/uni-app';
  57. import { common } from '@/utils';
  58. import icon from '@/utils/icon';
  59. import { queryBHospitalList } from '@/pagesPatient/service/new/index';
  60. import { REQUEST_CONFIG } from '@/config';
  61. const iconUrl = icon;
  62. const hospitalInfo = ref<any>({});
  63. const photoArr = ref<string[]>([]);
  64. const showMore = ref(false);
  65. const processedIntro = ref('');
  66. const app = getApp();
  67. onLoad((options) => {
  68. main();
  69. });
  70. const main = async () => {
  71. let hospitalLocalData = {
  72. HospitalId: app.globalData.districtId || app.globalData.hosId
  73. };
  74. let hospitalLocalResp = await queryBHospitalList(hospitalLocalData);
  75. if (!common.isEmpty(hospitalLocalResp)) {
  76. let infoObj = hospitalLocalResp[0];
  77. let photos: string[] = [];
  78. if (!common.isEmpty(infoObj.PhotoUrl)) {
  79. try {
  80. let parsedPhotos = JSON.parse(infoObj.PhotoUrl);
  81. // 处理图片url
  82. for (let i in parsedPhotos) {
  83. parsedPhotos[i] = parsedPhotos[i].indexOf('http') != -1 ? parsedPhotos[i] : `${REQUEST_CONFIG.BASE_URL}${parsedPhotos[i]}`;
  84. photos.push(parsedPhotos[i]);
  85. }
  86. } catch (e) {
  87. // Fallback if parse fails
  88. photos.push(infoObj.PhotoUrl);
  89. }
  90. } else {
  91. if (infoObj.HospitalPicture) {
  92. photos.push(infoObj.HospitalPicture);
  93. }
  94. }
  95. // Process intro
  96. if (infoObj.HosBrief) {
  97. let info = unescape(infoObj.HosBrief).replace(/ style=".*?"/g, '');
  98. processedIntro.value = info;
  99. }
  100. photoArr.value = photos;
  101. hospitalInfo.value = infoObj;
  102. }
  103. };
  104. const imgClick = (url: string) => {
  105. uni.previewImage({
  106. urls: photoArr.value,
  107. current: url
  108. });
  109. };
  110. const moreClick = () => {
  111. showMore.value = !showMore.value;
  112. };
  113. const optionClick = (type: string) => {
  114. let mobile = hospitalInfo.value.Contact;
  115. if (type == 'address') {
  116. // Attempt to open location
  117. if (hospitalInfo.value.Latitude && hospitalInfo.value.Longitude) {
  118. uni.openLocation({
  119. latitude: parseFloat(hospitalInfo.value.Latitude),
  120. longitude: parseFloat(hospitalInfo.value.Longitude),
  121. name: hospitalInfo.value.HospitalName,
  122. address: (hospitalInfo.value.ProvinceName || '') + (hospitalInfo.value.CityName || '') + (hospitalInfo.value.AreaName || '') + (hospitalInfo.value.HospitalAddress || '')
  123. });
  124. } else {
  125. common.showToast('暂无位置信息');
  126. }
  127. } else if (type == "mobile") {
  128. uni.makePhoneCall({
  129. phoneNumber: mobile,
  130. });
  131. }
  132. };
  133. </script>
  134. <style lang="scss" scoped>
  135. .banner_img {
  136. width: 100%;
  137. height: 424upx;
  138. }
  139. .content_inner, .tabber_inner, .view_details {
  140. padding: 28upx 30upx 40upx;
  141. background-color: #fff;
  142. }
  143. .title {
  144. font-size: 36upx;
  145. font-weight: 500;
  146. color: rgba(0, 0, 0, 1);
  147. }
  148. .tip {
  149. font-size: 26upx;
  150. font-weight: 400;
  151. color: rgba(166, 166, 166, 1);
  152. padding: 22upx 0 40upx;
  153. }
  154. .tip .tip_tow {
  155. display: inline-block;
  156. padding: 0 8upx;
  157. }
  158. .tip_tow::after {
  159. border-color: #a6a6a6;
  160. }
  161. .details_text view {
  162. font-family: Source Han Sans CN !important;
  163. color: rgba(85, 85, 85, 1) !important;
  164. font-size: 30upx !important;
  165. font-weight: 400 !important;
  166. line-height: 48upx !important;
  167. }
  168. .infoTxtMore {
  169. word-wrap: break-word;
  170. text-align: justify;
  171. }
  172. .infoTxt {
  173. overflow: hidden;
  174. text-overflow: ellipsis;
  175. display: -webkit-box;
  176. -webkit-line-clamp: 3;
  177. line-clamp: 3;
  178. -webkit-box-orient: vertical;
  179. text-align: justify;
  180. font-family: PingFangSC-Regular;
  181. }
  182. .details .details_an {
  183. padding: 30upx 0 40upx;
  184. font-size: 26upx;
  185. display: flex;
  186. align-items: center;
  187. justify-content: center;
  188. color: #a6a6a6;
  189. }
  190. .right_img {
  191. width: 12upx;
  192. height: 21upx;
  193. margin-left: 14upx;
  194. transform: rotateZ(90deg);
  195. }
  196. .right_img_up {
  197. transform: rotateZ(-90deg);
  198. }
  199. .message {
  200. background: rgba(255, 255, 255, 1);
  201. box-shadow: 0upx 0upx 40upx 0upx rgba(0, 0, 0, 0.06);
  202. border-radius: 20upx;
  203. }
  204. .message_list {
  205. min-height: 100upx;
  206. font-size: 30upx;
  207. font-weight: 400;
  208. color: rgba(85, 85, 85, 1);
  209. display: flex;
  210. align-items: center;
  211. padding: 20upx 30upx;
  212. position: relative;
  213. }
  214. .item_img {
  215. width: 32upx;
  216. height: 32upx;
  217. margin-right: 26upx;
  218. }
  219. .public_right_img {
  220. right: 30upx;
  221. }
  222. /* 基础信息 */
  223. .info_item {
  224. padding-bottom: 58upx;
  225. }
  226. .item_title {
  227. font-size: 32upx;
  228. font-weight: 500;
  229. color: rgba(0, 0, 0, 1);
  230. }
  231. .item_tip {
  232. font-size: 28upx;
  233. font-weight: 400;
  234. color: rgba(85, 85, 85, 1);
  235. line-height: 44upx;
  236. margin-top: 29upx;
  237. }
  238. .address {
  239. max-width: 90%;
  240. }
  241. </style>