testResult.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  1. <template>
  2. <view class="content">
  3. <view class="cont">
  4. <view class="bg">
  5. <image src="https://zkzh-2025.oss-cn-beijing.aliyuncs.com/appimgs/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://zkzh-2025.oss-cn-beijing.aliyuncs.com/appimgs/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}}</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. <!-- #ifndef H5 -->
  45. <!-- <view class="share" @click="shareImg()">
  46. <text>分享</text>
  47. </view> -->
  48. <!-- #endif -->
  49. <!-- 分享弹窗 -->
  50. <u-popup :show="showShare" @close="showShare = false" >
  51. <share-box :shareItem="shareItem" @closeShare='showShare = false' ></share-box>
  52. </u-popup>
  53. <h5-down-app-tip :pageUrl="pageUrl"/>
  54. </view>
  55. </template>
  56. <script>
  57. import {getAdvList} from '@/api/adv.js'
  58. import {getTestReport,getTestReportImg} from '@/api/test.js'
  59. export default {
  60. data() {
  61. return {
  62. advImgs:[],
  63. advs:[],
  64. reportId:null,
  65. statusBarHeight: uni.getStorageSync('menuInfo').statusBarHeight,
  66. report:null,
  67. img: "",
  68. showShare:false,
  69. shareItem:{ imageUrl:"",title:"",path:"",isMini:true },
  70. pageUrl: ''
  71. };
  72. },
  73. onShareAppMessage(res) {
  74. if(this.$isLogin()){
  75. return {
  76. title: "测试结果",
  77. path: '/pages_index/testResult?reportId='+this.reportId,
  78. imageUrl: this.img //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
  79. }
  80. }
  81. },
  82. //分享到朋友圈
  83. onShareTimeline(res) {
  84. if(this.$isLogin()){
  85. return {
  86. title: "测试结果",
  87. path: '/pages_index/testResult?reportId='+this.reportId,
  88. imageUrl: this.img //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
  89. }
  90. }
  91. },
  92. onLoad(option) {
  93. this.reportId=option.reportId;
  94. this.getTestReport();
  95. },
  96. onShow() {
  97. if(!this.$isLogin()) {
  98. uni.navigateTo({
  99. url: '/pages/auth/loginIndex'
  100. })
  101. return
  102. }
  103. this.pageUrl = '/pages/article/testResult?reportId='+this.reportId;
  104. this.getAdvList();
  105. },
  106. methods:{
  107. shareImg(){
  108. var data={reportId:this.reportId}
  109. getTestReportImg(data).then(
  110. res => {
  111. if(res.code==200){
  112. this.img = res.img
  113. // #ifdef APP-PLUS
  114. this.shareItem.title= "测试结果";
  115. this.shareItem.imageUrl=res.img;
  116. this.shareItem.compressImage = 1;
  117. this.shareItem.isMini=true;
  118. this.shareItem.path='/pages_index/testResult?reportId='+this.reportId;
  119. let cdn=uni.getStorageSync('h5Path');
  120. this.shareItem.url=cdn+'/pages/article/testResult?reportId='+this.reportId;
  121. this.showShare=true;
  122. // #endif
  123. // console.log(res)
  124. // wx.downloadFile({
  125. // url: res.img,
  126. // success: (res1) => {
  127. // console.log(res1)
  128. // wx.showShareImageMenu({
  129. // path: res1.tempFilePath
  130. // })
  131. // },
  132. // fail:(res2)=>{
  133. // console.log(res2)
  134. // }
  135. // })
  136. }
  137. },
  138. err => {
  139. }
  140. );
  141. // uni.navigateTo({
  142. // url: '/pages_index/testResultImg?reportId=' + this.reportId
  143. // })
  144. },
  145. handleAdvClick(index){
  146. var ad=this.advs[index];
  147. if(ad.showType==1){
  148. uni.setStorageSync('url',ad.appAdvUrl);
  149. uni.navigateTo({
  150. url:"h5"
  151. })
  152. }
  153. else if(ad.showType==3){
  154. uni.setStorageSync('content',ad.appAdvUrl);
  155. uni.navigateTo({
  156. url:"content"
  157. })
  158. }
  159. else{
  160. uni.navigateTo({
  161. url:ad.appAdvUrl
  162. })
  163. }
  164. },
  165. getAdvList() {
  166. //联网加载数据
  167. var that = this;
  168. var data = {
  169. advType:3
  170. };
  171. getAdvList(data).then(res => {
  172. if(res.code==200){
  173. that.advImgs=[];
  174. that.advs=res.data;
  175. that.advs.forEach(function(element) {
  176. if(element.imageUrl!=null&&element.imageUrl!=""){
  177. that.advImgs.push(element.imageUrl);
  178. }
  179. });
  180. console.log(that.advImgs)
  181. }else{
  182. uni.showToast({
  183. icon:'none',
  184. title: "请求失败",
  185. });
  186. }
  187. });
  188. },
  189. getTestReport(){
  190. var data={reportId:this.reportId}
  191. getTestReport(data).then(
  192. res => {
  193. if(res.code==200){
  194. this.report=res.report;
  195. }
  196. },
  197. err => {
  198. }
  199. );
  200. },
  201. goBack(){
  202. uni.navigateBack()
  203. }
  204. }
  205. }
  206. </script>
  207. <style lang="scss" scoped>
  208. page{
  209. background-color: #FDF7F0;
  210. height: 100%;
  211. }
  212. .content{
  213. .cont{
  214. position: relative;
  215. width: 100%;
  216. display: flex;
  217. flex-direction: column;
  218. .bg{
  219. width: 100%;
  220. height:100%;
  221. // background-color: #2583EB;
  222. // background: linear-gradient(#2583EB, #88e2da);
  223. position: fixed;
  224. image{
  225. width: 100%;
  226. height:100%;
  227. }
  228. z-index: 1;
  229. }
  230. .cont-box{
  231. z-index: 99;
  232. margin-top: 88rpx;
  233. .user{
  234. width: 100%;
  235. display: flex;
  236. flex-direction: column;
  237. align-items: center;
  238. justify-content: center;
  239. padding: 30rpx;
  240. image{
  241. border-radius: 50%;
  242. border: 2rpx solid #ffffff;
  243. width:120rpx;
  244. height:120rpx;
  245. }
  246. .user-box{
  247. padding: 30rpx;
  248. display: flex;
  249. align-items: center;
  250. justify-content: center;
  251. .sex{
  252. font-weight: bold;
  253. font-size: 40supx;
  254. font-family: PingFang SC;
  255. color: #925924;
  256. }
  257. .username{
  258. margin-left: 15rpx;
  259. font-size: 40supx;
  260. font-family: PingFang SC;
  261. color: #2583EB;
  262. }
  263. }
  264. }
  265. .items{
  266. width: 100%;
  267. display: flex;
  268. flex-direction: column;
  269. align-items: flex-start;
  270. justify-content: flex-start;
  271. padding: 20rpx;
  272. .result-box{
  273. width: 100%;
  274. display: flex;
  275. flex-direction: column;
  276. align-items:center;
  277. justify-content: center;
  278. padding: 30rpx;
  279. background-color: #fff;
  280. border-radius: 15rpx;
  281. margin-bottom: 15rpx;
  282. .time{
  283. margin-top: 15rpx;
  284. font-family: PingFang SC;
  285. font-size: 24rpx;
  286. color: #9B9B9B;
  287. }
  288. .title{
  289. margin-top: 15rpx;
  290. font-family: PingFang SC;
  291. font-size: 28rpx;
  292. color: #626468;
  293. }
  294. .name{
  295. margin-top: 30rpx;
  296. font-family: PingFang SC;
  297. font-weight: bold;
  298. font-size: 60rpx;
  299. color: #2583EB;
  300. }
  301. .descs{
  302. font-family: PingFang SC;
  303. font-size: 28rpx;
  304. color: #2A2B2E;
  305. padding: 30rpx;
  306. margin-top: 30rpx;
  307. background-color: #F5F6F6;
  308. border-radius: 10rpx;
  309. }
  310. }
  311. .item-box{
  312. width: 100%;
  313. .item{
  314. width: 100%;
  315. padding: 30rpx;
  316. background-color: #fff;
  317. border-radius:30rpx;
  318. .title-box{
  319. display: flex;
  320. align-items:center;
  321. justify-content: flex-start;
  322. .title{
  323. margin-left: 10rpx;
  324. font-size: 32supx;
  325. font-family: PingFang SC;
  326. color: #2583EB;
  327. font-weight: bold;
  328. }
  329. .title-line{
  330. width: 8rpx;
  331. height: 28rpx;
  332. background: #2583EB;
  333. border-radius: 2px 2px 2px 2px;
  334. opacity: 1;
  335. }
  336. }
  337. .descs{
  338. white-space: pre-line;
  339. margin-top: 10rpx;
  340. font-size: 28supx;
  341. font-family: PingFang SC;
  342. color: #2A2B2E;
  343. }
  344. }
  345. .line{
  346. margin: 0rpx 30rpx;
  347. border-bottom: #b5b5b5 3rpx dashed;
  348. }
  349. }
  350. }
  351. .tips{
  352. width: 100%;
  353. display: flex;
  354. align-items: center;
  355. justify-content: center;
  356. margin: 15rpx 0rpx;
  357. color: #9B9B9B;
  358. font-size: 24rpx;
  359. }
  360. .banner{
  361. height:250rpx;
  362. width: 100%;
  363. padding: 15rpx 20upx;
  364. }
  365. }
  366. }
  367. }
  368. .share{
  369. width: 100rpx;
  370. height:100rpx;
  371. z-index: 9999;
  372. border-radius: 50%;
  373. position: fixed;
  374. bottom: 100rpx;
  375. right:50rpx;
  376. background-color: #2583EB;
  377. color: #fff;
  378. font-weight: bold;
  379. font-size: 28rpx;
  380. display: flex;
  381. flex-direction: column;
  382. align-items: center;
  383. justify-content: center;
  384. }
  385. </style>