testResult.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. <template>
  2. <view class="content">
  3. <view class="cont">
  4. <view class="bg">
  5. <image src="https://fs-1319721001.cos.ap-chongqing.myqcloud.com/fs/20240229/8e52ab17eabc4534b3ce56026fd5c624.jpg" ></image>
  6. </view>
  7. <view class="cont-box" v-if="report!=null">
  8. <view class="user">
  9. <image :src="JSON.parse(report.patientJson).avatar==null?'https://fs-1319721001.cos.ap-chongqing.myqcloud.com/fs/20240229/22cb9518a55040dea74d8f730551a7a2.jpg':JSON.parse(report.patientJson).avatar"></image>
  10. <view class="user-box">
  11. <view class="sex">性别 {{JSON.parse(report.patientJson).sex==1?"男":"女"}}</view>
  12. <view class="username">年龄 {{JSON.parse(report.patientJson).age}}岁</view>
  13. </view>
  14. </view>
  15. <view class="items">
  16. <view class="result-box">
  17. <view class="time">检测时间 {{report.createTime}}</view>
  18. <view class="title">您属于{{report.testResult}}</view>
  19. <view class="name">{{report.testResult}}</view>
  20. </view>
  21. <!-- <view class="item-box" :key="index" v-for="(item,index) in JSON.parse(report.conditioningPlanJson) ">
  22. <view class="item">
  23. <view class="title-box">
  24. <view class="title">{{item.name}}</view>
  25. </view>
  26. <view class="descs" >{{item.value.replace(/\\n/g, '<br>')}}</view>
  27. </view>
  28. <view v-if="index<JSON.parse(report.conditioningPlanJson).length-2" class="line"></view>
  29. </view>
  30. -->
  31. </view>
  32. <view class="tips">注:报告内容仅供参考,具体情况以医生建议为准</view>
  33. <view class="banner" v-if="advImgs.length>0">
  34. <u-swiper
  35. :list="advImgs"
  36. circular
  37. @click="handleAdvClick">
  38. </u-swiper>
  39. </view>
  40. </view>
  41. </view>
  42. <view class="share" @click="shareImg()">
  43. <text>分享</text>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. import {getAdvList} from '@/api/adv.js'
  49. import {getTestReport,getTestReportImg} from '@/api/test.js'
  50. export default {
  51. data() {
  52. return {
  53. advImgs:[],
  54. advs:[],
  55. reportId:null,
  56. statusBarHeight: uni.getStorageSync('menuInfo').statusBarHeight,
  57. report:null,
  58. };
  59. },
  60. onLoad(option) {
  61. this.reportId=option.reportId;
  62. this.getTestReport();
  63. },
  64. onShow() {
  65. this.getAdvList();
  66. },
  67. methods:{
  68. shareImg(){
  69. var data={reportId:this.reportId}
  70. getTestReportImg(data).then(
  71. res => {
  72. if(res.code==200){
  73. console.log(res)
  74. wx.downloadFile({
  75. url: res.img,
  76. success: (res1) => {
  77. console.log(res1)
  78. wx.showShareImageMenu({
  79. path: res1.tempFilePath
  80. })
  81. },
  82. fail:(res2)=>{
  83. console.log(res2)
  84. }
  85. })
  86. }
  87. },
  88. err => {
  89. }
  90. );
  91. },
  92. handleAdvClick(item){
  93. console.log(item);
  94. if(item.showType==1){
  95. uni.setStorageSync('url',item.advUrl);
  96. uni.navigateTo({
  97. url:"h5"
  98. })
  99. }
  100. else if(item.showType==2){
  101. uni.navigateTo({
  102. url:item.advUrl
  103. })
  104. }
  105. else if(item.showType==3){
  106. uni.setStorageSync('content',item.content);
  107. uni.navigateTo({
  108. url:"content"
  109. })
  110. }
  111. },
  112. getAdvList() {
  113. //联网加载数据
  114. var that = this;
  115. var data = {
  116. advType:3
  117. };
  118. getAdvList(data).then(res => {
  119. if(res.code==200){
  120. that.advImgs=[];
  121. that.advs=res.data;
  122. that.advs.forEach(function(element) {
  123. if(element.imageUrl!=null&&element.imageUrl!=""){
  124. that.advImgs.push(element.imageUrl);
  125. }
  126. });
  127. console.log(that.advImgs)
  128. }else{
  129. uni.showToast({
  130. icon:'none',
  131. title: "请求失败",
  132. });
  133. }
  134. });
  135. },
  136. getTestReport(){
  137. var data={reportId:this.reportId}
  138. getTestReport(data).then(
  139. res => {
  140. if(res.code==200){
  141. this.report=res.report;
  142. }
  143. },
  144. err => {
  145. }
  146. );
  147. },
  148. goBack(){
  149. uni.navigateBack()
  150. }
  151. }
  152. }
  153. </script>
  154. <style lang="scss">
  155. page{
  156. background-color: #FDF7F0;
  157. height: 100%;
  158. }
  159. .content{
  160. .cont{
  161. position: relative;
  162. width: 100%;
  163. display: flex;
  164. flex-direction: column;
  165. .bg{
  166. width: 100%;
  167. height:100%;
  168. // background-color: #018C39;
  169. // background: linear-gradient(#66b2ef, #018C39);
  170. position: fixed;
  171. image{
  172. width: 100%;
  173. height:100%;
  174. }
  175. z-index: 1;
  176. }
  177. .cont-box{
  178. z-index: 1000;
  179. margin-top: 88rpx;
  180. .user{
  181. box-sizing: border-box;
  182. width: 100%;
  183. display: flex;
  184. flex-direction: column;
  185. align-items: center;
  186. justify-content: center;
  187. padding: 30rpx;
  188. image{
  189. border-radius: 50%;
  190. border: 2rpx solid #ffffff;
  191. width:120rpx;
  192. height:120rpx;
  193. }
  194. .user-box{
  195. padding: 30rpx;
  196. display: flex;
  197. align-items: center;
  198. justify-content: center;
  199. .sex{
  200. font-weight: bold;
  201. font-size: 40supx;
  202. font-family: PingFang SC;
  203. color: #925924;
  204. }
  205. .username{
  206. margin-left: 15rpx;
  207. font-size: 40supx;
  208. font-family: PingFang SC;
  209. color: #925924;
  210. }
  211. }
  212. }
  213. .items{
  214. width: 100%;
  215. box-sizing: border-box;
  216. display: flex;
  217. flex-direction: column;
  218. align-items: flex-start;
  219. justify-content: flex-start;
  220. padding: 20rpx;
  221. .result-box{
  222. width: 100%;
  223. box-sizing: border-box;
  224. display: flex;
  225. flex-direction: column;
  226. align-items:center;
  227. justify-content: center;
  228. padding: 30rpx;
  229. background-color: #fff;
  230. border-radius: 15rpx;
  231. margin-bottom: 15rpx;
  232. .time{
  233. margin-top: 15rpx;
  234. font-family: PingFang SC;
  235. font-size: 24rpx;
  236. color: #9B9B9B;
  237. }
  238. .title{
  239. margin-top: 15rpx;
  240. font-family: PingFang SC;
  241. font-size: 28rpx;
  242. color: #626468;
  243. }
  244. .name{
  245. margin-top: 30rpx;
  246. font-family: PingFang SC;
  247. font-weight: bold;
  248. font-size: 60rpx;
  249. color: #925924;
  250. }
  251. .descs{
  252. font-family: PingFang SC;
  253. font-size: 28rpx;
  254. color: #2A2B2E;
  255. padding: 30rpx;
  256. margin-top: 30rpx;
  257. background-color: #F5F6F6;
  258. border-radius: 10rpx;
  259. }
  260. }
  261. .item-box{
  262. width: 100%;
  263. .item{
  264. width: 100%;
  265. padding: 30rpx;
  266. background-color: #fff;
  267. border-radius:30rpx;
  268. .title-box{
  269. display: flex;
  270. align-items:center;
  271. justify-content: flex-start;
  272. .title{
  273. margin-left: 10rpx;
  274. font-size: 32supx;
  275. font-family: PingFang SC;
  276. color: #925924;
  277. font-weight: bold;
  278. }
  279. .title-line{
  280. width: 8rpx;
  281. height: 28rpx;
  282. background: #018C39;
  283. border-radius: 2px 2px 2px 2px;
  284. opacity: 1;
  285. }
  286. }
  287. .descs{
  288. white-space: pre-line;
  289. margin-top: 10rpx;
  290. font-size: 28supx;
  291. font-family: PingFang SC;
  292. color: #2A2B2E;
  293. }
  294. }
  295. .line{
  296. margin: 0rpx 30rpx;
  297. border-bottom: #b5b5b5 3rpx dashed;
  298. }
  299. }
  300. }
  301. .tips{
  302. width: 100%;
  303. display: flex;
  304. align-items: center;
  305. justify-content: center;
  306. margin: 15rpx 0rpx;
  307. color: #9B9B9B;
  308. font-size: 24rpx;
  309. }
  310. .banner{
  311. height:250rpx;
  312. width: 100%;
  313. padding: 15rpx 20upx;
  314. }
  315. }
  316. }
  317. }
  318. .share{
  319. width: 100rpx;
  320. height:100rpx;
  321. z-index: 9999;
  322. border-radius: 50%;
  323. position: fixed;
  324. bottom: 100rpx;
  325. right:50rpx;
  326. background-color: #925924;
  327. color: #fff;
  328. font-weight: bold;
  329. font-size: 28rpx;
  330. display: flex;
  331. flex-direction: column;
  332. align-items: center;
  333. justify-content: center;
  334. }
  335. </style>