testResult.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. <template>
  2. <view class="content">
  3. <view class="cont">
  4. <view class="bg">
  5. <image :src="imgPath+'/app/commonCourse/bg-class.png'" ></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?imgPath+'/app/commonCourse/head-img.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}}</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/index.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. computed: {
  63. imgPath() {
  64. return this.$store.state.imgpath
  65. },
  66. },
  67. onLoad(option) {
  68. this.reportId=option.reportId;
  69. this.getTestReport();
  70. },
  71. onShow() {
  72. this.getAdvList();
  73. },
  74. methods:{
  75. shareImg(){
  76. var data={reportId:this.reportId}
  77. getTestReportImg(data).then(
  78. res => {
  79. if(res.code==200){
  80. console.log(res)
  81. wx.downloadFile({
  82. url: res.img,
  83. success: (res1) => {
  84. console.log(res1)
  85. wx.showShareImageMenu({
  86. path: res1.tempFilePath
  87. })
  88. },
  89. fail:(res2)=>{
  90. console.log(res2)
  91. }
  92. })
  93. }
  94. },
  95. err => {
  96. }
  97. );
  98. // uni.navigateTo({
  99. // url: '/pages_index/testResultImg?reportId=' + this.reportId
  100. // })
  101. },
  102. handleAdvClick(index){
  103. var ad=this.advs[index];
  104. console.log(ad.advUrl);
  105. if(ad.showType==1){
  106. uni.setStorageSync('url',ad.advUrl);
  107. uni.navigateTo({
  108. url:"h5"
  109. })
  110. }
  111. else if(ad.showType==2){
  112. uni.navigateTo({
  113. url:ad.advUrl
  114. })
  115. }
  116. else if(ad.showType==3){
  117. uni.setStorageSync('content',ad.content);
  118. uni.navigateTo({
  119. url:"content"
  120. })
  121. }
  122. },
  123. getAdvList() {
  124. //联网加载数据
  125. var that = this;
  126. var data = {
  127. advType:3
  128. };
  129. getAdvList(data).then(res => {
  130. if(res.code==200){
  131. that.advImgs=[];
  132. that.advs=res.data;
  133. that.advs.forEach(function(element) {
  134. if(element.imageUrl!=null&&element.imageUrl!=""){
  135. that.advImgs.push(element.imageUrl);
  136. }
  137. });
  138. console.log(that.advImgs)
  139. }else{
  140. uni.showToast({
  141. icon:'none',
  142. title: "请求失败",
  143. });
  144. }
  145. });
  146. },
  147. getTestReport(){
  148. var data={reportId:this.reportId}
  149. getTestReport(data).then(
  150. res => {
  151. if(res.code==200){
  152. this.report=res.report;
  153. }
  154. },
  155. err => {
  156. }
  157. );
  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: #2BC7B9;
  180. // background: linear-gradient(#2BC7B9, #88e2da);
  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: 88rpx;
  191. .user{
  192. width: 100%;
  193. display: flex;
  194. flex-direction: column;
  195. align-items: center;
  196. justify-content: center;
  197. padding: 30rpx;
  198. image{
  199. border-radius: 50%;
  200. border: 2rpx solid #ffffff;
  201. width:120rpx;
  202. height:120rpx;
  203. }
  204. .user-box{
  205. padding: 30rpx;
  206. display: flex;
  207. align-items: center;
  208. justify-content: center;
  209. .sex{
  210. font-weight: bold;
  211. font-size: 40supx;
  212. font-family: PingFang SC;
  213. color: #925924;
  214. }
  215. .username{
  216. margin-left: 15rpx;
  217. font-size: 40supx;
  218. font-family: PingFang SC;
  219. color: #925924;
  220. }
  221. }
  222. }
  223. .items{
  224. width: 100%;
  225. display: flex;
  226. flex-direction: column;
  227. align-items: flex-start;
  228. justify-content: flex-start;
  229. padding: 20rpx;
  230. .result-box{
  231. width: 100%;
  232. display: flex;
  233. flex-direction: column;
  234. align-items:center;
  235. justify-content: center;
  236. padding: 30rpx;
  237. background-color: #fff;
  238. border-radius: 15rpx;
  239. margin-bottom: 15rpx;
  240. .time{
  241. margin-top: 15rpx;
  242. font-family: PingFang SC;
  243. font-size: 24rpx;
  244. color: #9B9B9B;
  245. }
  246. .title{
  247. margin-top: 15rpx;
  248. font-family: PingFang SC;
  249. font-size: 28rpx;
  250. color: #626468;
  251. }
  252. .name{
  253. margin-top: 30rpx;
  254. font-family: PingFang SC;
  255. font-weight: bold;
  256. font-size: 60rpx;
  257. color: #925924;
  258. }
  259. .descs{
  260. font-family: PingFang SC;
  261. font-size: 28rpx;
  262. color: #2A2B2E;
  263. padding: 30rpx;
  264. margin-top: 30rpx;
  265. background-color: #F5F6F6;
  266. border-radius: 10rpx;
  267. }
  268. }
  269. .item-box{
  270. width: 100%;
  271. .item{
  272. width: 100%;
  273. padding: 30rpx;
  274. background-color: #fff;
  275. border-radius:30rpx;
  276. .title-box{
  277. display: flex;
  278. align-items:center;
  279. justify-content: flex-start;
  280. .title{
  281. margin-left: 10rpx;
  282. font-size: 32supx;
  283. font-family: PingFang SC;
  284. color: #925924;
  285. font-weight: bold;
  286. }
  287. .title-line{
  288. width: 8rpx;
  289. height: 28rpx;
  290. background: #2BC7B9;
  291. border-radius: 2px 2px 2px 2px;
  292. opacity: 1;
  293. }
  294. }
  295. .descs{
  296. white-space: pre-line;
  297. margin-top: 10rpx;
  298. font-size: 28supx;
  299. font-family: PingFang SC;
  300. color: #2A2B2E;
  301. }
  302. }
  303. .line{
  304. margin: 0rpx 30rpx;
  305. border-bottom: #b5b5b5 3rpx dashed;
  306. }
  307. }
  308. }
  309. .tips{
  310. width: 100%;
  311. display: flex;
  312. align-items: center;
  313. justify-content: center;
  314. margin: 15rpx 0rpx;
  315. color: #9B9B9B;
  316. font-size: 24rpx;
  317. }
  318. .banner{
  319. height:250rpx;
  320. width: 100%;
  321. padding: 15rpx 20upx;
  322. }
  323. }
  324. }
  325. }
  326. .share{
  327. width: 100rpx;
  328. height:100rpx;
  329. z-index: 9999;
  330. border-radius: 50%;
  331. position: fixed;
  332. bottom: 100rpx;
  333. right:50rpx;
  334. background-color: #925924;
  335. color: #fff;
  336. font-weight: bold;
  337. font-size: 28rpx;
  338. display: flex;
  339. flex-direction: column;
  340. align-items: center;
  341. justify-content: center;
  342. }
  343. </style>