testResult.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  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 v-if="conditioningPlanJson!=null" class="item-box" :key="index" v-for="(item,index) in conditioningPlanJson ">
  22. <view class="item">
  23. <view class="title-box">
  24. <view class="title">{{item.name}}</view>
  25. </view>
  26. <view class="descs" >{{ getValue(item) }}</view>
  27. </view>
  28. <view v-if="index<conditioningPlanJson.length-2" class="line"></view>
  29. </view>
  30. </view>
  31. <view class="tips">注:报告内容仅供参考,具体情况以医生建议为准</view>
  32. <view class="banner" v-if="advImgs.length>0">
  33. <u-swiper
  34. :list="advImgs"
  35. circular
  36. @click="handleAdvClick">
  37. </u-swiper>
  38. </view>
  39. </view>
  40. </view>
  41. <view class="share" @click="shareImg()">
  42. <text>分享</text>
  43. </view>
  44. </view>
  45. </template>
  46. <script>
  47. import {getAdvList} from '@/api/adv.js'
  48. import {getTestReport,getTestReportImg} from '@/api/test.js'
  49. export default {
  50. data() {
  51. return {
  52. advImgs:[],
  53. advs:[],
  54. reportId:null,
  55. statusBarHeight: uni.getStorageSync('menuInfo').statusBarHeight,
  56. report:null,
  57. conditioningPlanJson: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. this.conditioningPlanJson=JSON.parse(this.report.conditioningPlanJson);
  143. }
  144. },
  145. err => {
  146. }
  147. );
  148. },
  149. getValue(item){
  150. let strVal="";
  151. if(item==null){
  152. return strVal;
  153. }
  154. if (item.value !== undefined && item.value !== null) {
  155. strVal = item.value.replace(/\\n/g, '<br/>'); // 替换字面上的 `\n`
  156. }
  157. return strVal;
  158. },
  159. goBack(){
  160. uni.navigateBack()
  161. }
  162. }
  163. }
  164. </script>
  165. <style lang="scss">
  166. page{
  167. background-color: #FDF7F0;
  168. height: 100%;
  169. }
  170. .content{
  171. .cont{
  172. position: relative;
  173. width: 100%;
  174. display: flex;
  175. flex-direction: column;
  176. .bg{
  177. width: 100%;
  178. height:100%;
  179. // background-color: #018C39;
  180. // background: linear-gradient(#66b2ef, #018C39);
  181. position: fixed;
  182. image{
  183. width: 100%;
  184. height:100%;
  185. }
  186. z-index: 1;
  187. }
  188. .cont-box{
  189. z-index: 1000;
  190. margin-top: 0rpx;
  191. .user{
  192. box-sizing: border-box;
  193. width: 100%;
  194. display: flex;
  195. flex-direction: column;
  196. align-items: center;
  197. justify-content: center;
  198. padding: 30rpx;
  199. margin-top: 30rpx;
  200. image{
  201. border-radius: 50%;
  202. border: 2rpx solid #ffffff;
  203. width:120rpx;
  204. height:120rpx;
  205. }
  206. .user-box{
  207. padding: 30rpx;
  208. display: flex;
  209. align-items: center;
  210. justify-content: center;
  211. .sex{
  212. font-weight: bold;
  213. font-size: 40supx;
  214. font-family: PingFang SC;
  215. color: #925924;
  216. }
  217. .username{
  218. margin-left: 15rpx;
  219. font-size: 40supx;
  220. font-family: PingFang SC;
  221. color: #925924;
  222. }
  223. }
  224. }
  225. .items{
  226. width: 100%;
  227. box-sizing: border-box;
  228. display: flex;
  229. flex-direction: column;
  230. align-items: flex-start;
  231. justify-content: flex-start;
  232. padding: 20rpx;
  233. .result-box{
  234. width: 100%;
  235. box-sizing: border-box;
  236. display: flex;
  237. flex-direction: column;
  238. align-items:center;
  239. justify-content: center;
  240. padding: 30rpx;
  241. background-color: #fff;
  242. border-radius: 15rpx;
  243. margin-bottom: 15rpx;
  244. .time{
  245. margin-top: 15rpx;
  246. font-family: PingFang SC;
  247. font-size: 24rpx;
  248. color: #9B9B9B;
  249. }
  250. .title{
  251. margin-top: 15rpx;
  252. font-family: PingFang SC;
  253. font-size: 28rpx;
  254. color: #626468;
  255. }
  256. .name{
  257. margin-top: 30rpx;
  258. font-family: PingFang SC;
  259. font-weight: bold;
  260. font-size: 60rpx;
  261. color: #925924;
  262. }
  263. .descs{
  264. font-family: PingFang SC;
  265. font-size: 28rpx;
  266. color: #2A2B2E;
  267. padding: 30rpx;
  268. margin-top: 30rpx;
  269. background-color: #F5F6F6;
  270. border-radius: 10rpx;
  271. }
  272. }
  273. .item-box{
  274. width: 100%;
  275. .item{
  276. width: 100%;
  277. padding: 30rpx;
  278. background-color: #fff;
  279. border-radius:30rpx;
  280. .title-box{
  281. display: flex;
  282. align-items:center;
  283. justify-content: flex-start;
  284. .title{
  285. margin-left: 10rpx;
  286. font-size: 32supx;
  287. font-family: PingFang SC;
  288. color: #925924;
  289. font-weight: bold;
  290. }
  291. .title-line{
  292. width: 8rpx;
  293. height: 28rpx;
  294. background: #018C39;
  295. border-radius: 2px 2px 2px 2px;
  296. opacity: 1;
  297. }
  298. }
  299. .descs{
  300. white-space: pre-line;
  301. margin-top: 10rpx;
  302. font-size: 28supx;
  303. font-family: PingFang SC;
  304. color: #2A2B2E;
  305. }
  306. }
  307. .line{
  308. margin: 0rpx 30rpx;
  309. border-bottom: #b5b5b5 3rpx dashed;
  310. }
  311. }
  312. }
  313. .tips{
  314. width: 100%;
  315. display: flex;
  316. align-items: center;
  317. justify-content: center;
  318. margin: 15rpx 0rpx;
  319. margin-bottom: 50rpx;
  320. color: #9B9B9B;
  321. font-size: 24rpx;
  322. }
  323. .banner{
  324. height:250rpx;
  325. width: 100%;
  326. padding: 15rpx 20upx;
  327. }
  328. }
  329. }
  330. }
  331. .share{
  332. width: 100rpx;
  333. height:100rpx;
  334. z-index: 9999;
  335. border-radius: 50%;
  336. position: fixed;
  337. bottom: 100rpx;
  338. right:50rpx;
  339. background-color: #925924;
  340. color: #fff;
  341. font-weight: bold;
  342. font-size: 28rpx;
  343. display: flex;
  344. flex-direction: column;
  345. align-items: center;
  346. justify-content: center;
  347. }
  348. </style>