testResult.vue 7.7 KB

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