docRecord.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  1. <template>
  2. <view class="content">
  3. <mescroll-body top="0rpx" bottom="148rpx" ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
  4. <view class="inner">
  5. <view class="illness-info" v-for="(item,index) in dataList" :key="index">
  6. <view class="head-box" >
  7. <view class="left">
  8. <image class="img" src="../../static/images/detault_head.jpg" mode=""></image>
  9. <text class="name">{{item.userName}}</text>
  10. </view>
  11. <view class="time">{{utils.formatDate(item.createTime)}}</view>
  12. </view>
  13. <view class="illness-text">
  14. {{item.title}}
  15. </view>
  16. <scroll-view v-if="item.photos.length>0" class="imag-scroll" scroll-x="true" >
  17. <view class="imag-list">
  18. <view v-for="(img,imgIndex) in item.photos" :key="imgIndex" class="item" @click="previewImage(item,imgIndex)">
  19. <image class="img" :src="img" mode="aspectFill"></image>
  20. </view>
  21. </view>
  22. </scroll-view>
  23. <view class="reply" v-for="(subItem,index) in item.replys">
  24. <view class="reply-title">
  25. <image class="img" src="../../static/images/detault_head.jpg" mode=""></image>
  26. <text class="name">{{subItem.companyNickName}}</text>
  27. </view>
  28. <view class="reply-content">
  29. 医嘱:{{subItem.content}}
  30. </view>
  31. <scroll-view v-if="!utils.isEmpty(subItem.images)" class="imag-scroll" scroll-x="true" >
  32. <view class="imag-list rimag-list">
  33. <view v-for="(sImg,sIndex) in utils.photosToArr(subItem.images)" :key="sIndex" class="item" @click="sPreviewImage(utils.photosToArr(subItem.images),sIndex)">
  34. <image class="img rimg" :src="sImg" mode="aspectFill"></image>
  35. </view>
  36. </view>
  37. </scroll-view>
  38. <view class="reply-time">
  39. 回复时间:{{utils.formatDate(subItem.createTime)}}
  40. </view>
  41. </view>
  42. <view v-if="item.showMore" class="more" @click="loadMoreReply(item)">查看更多</view>
  43. </view>
  44. </view>
  45. </mescroll-body>
  46. <view class="btn-box">
  47. <view class="sub-btn" @click="addDocRecord">写记录</view>
  48. </view>
  49. </view>
  50. </template>
  51. <script>
  52. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  53. import {getMyDocRecordList,getDocRecordReplyList} from '@/api/doc.js'
  54. export default {
  55. mixins: [MescrollMixin],
  56. data() {
  57. return {
  58. docId:null,
  59. mescroll:null,
  60. // 上拉加载的配置
  61. upOption: {
  62. onScroll:true,
  63. use: true, // 是否启用上拉加载; 默认true
  64. page: {
  65. num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  66. size: 10 // 每页数据的数量,默认10
  67. },
  68. noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  69. empty: {
  70. icon:'/static/images/no_data.png',
  71. tip: '暂无数据'
  72. }
  73. },
  74. // 列表数据
  75. dataList: [],
  76. }
  77. },
  78. onLoad(options) {
  79. this.docId=options.docId;
  80. var that=this;
  81. uni.$on('refreshDocRecord', () => {
  82. that.mescroll.resetUpScroll()
  83. })
  84. },
  85. methods: {
  86. loadMoreReply(item){
  87. item.pageNum=item.pageNum+1;
  88. var data = {
  89. recordId:item.recordId,
  90. page: item.pageNum,
  91. pageSize: item.pageSize
  92. };
  93. getDocRecordReplyList(data).then(res => {
  94. if(res.code==200){
  95. //设置列表数据
  96. item.replys = item.replys.concat(res.data.list);
  97. if(item.replys.length>=res.data.total){
  98. item.showMore=false
  99. }
  100. else{
  101. item.showMore=true
  102. }
  103. }else{
  104. }
  105. });
  106. },
  107. previewImage(item,index){
  108. //预览图片
  109. uni.previewImage({
  110. urls: item.photos,
  111. current: item.photos[index]
  112. });
  113. },
  114. sPreviewImage(subItem,index){
  115. //预览图片
  116. console.log(subItem)
  117. uni.previewImage({
  118. urls: subItem,
  119. current: subItem[index]
  120. });
  121. },
  122. mescrollInit(mescroll) {
  123. this.mescroll = mescroll;
  124. },
  125. /*下拉刷新的回调 */
  126. downCallback(mescroll) {
  127. mescroll.resetUpScroll()
  128. },
  129. upCallback(page) {
  130. //联网加载数据
  131. var that = this;
  132. var data = {
  133. docId:this.docId,
  134. page: page.num,
  135. pageSize: page.size
  136. };
  137. getMyDocRecordList(data).then(res => {
  138. if(res.code==200){
  139. //设置列表数据
  140. res.data.list.forEach(function(item) {
  141. item.pageNum=1;
  142. item.pageSize=10;
  143. if(item.replys.length==10){
  144. item.showMore=true;
  145. }
  146. else{
  147. item.showMore=false;
  148. }
  149. var images=[];
  150. if(item.images!=null&&item.images!=""){
  151. var imgs=item.images.split(",");
  152. imgs.forEach(function(img) {
  153. if(img!=""){
  154. images.push(img)
  155. }
  156. })
  157. item.photos=images;
  158. }
  159. item.photos=images;
  160. })
  161. if (page.num == 1) {
  162. that.dataList = res.data.list;
  163. } else {
  164. that.dataList = that.dataList.concat(res.data.list);
  165. }
  166. that.mescroll.endBySize(res.data.list.length, res.data.total);
  167. }else{
  168. uni.showToast({
  169. icon:'none',
  170. title: "请求失败",
  171. });
  172. that.dataList = null;
  173. that.mescroll.endErr();
  174. }
  175. });
  176. },
  177. addDocRecord() {
  178. uni.navigateTo({
  179. url: './addDocRecord?docId='+this.docId
  180. })
  181. }
  182. }
  183. }
  184. </script>
  185. <style lang="scss">
  186. page{
  187. height: 100%;
  188. }
  189. .content{
  190. height: 100%;
  191. .inner{
  192. padding: 20upx;
  193. .illness-info{
  194. background: #FFFFFF;
  195. border-radius: 16upx;
  196. padding: 30upx;
  197. margin-bottom: 20rpx;
  198. .head-box{
  199. display: flex;
  200. align-items: center;
  201. justify-content: space-between;
  202. .left{
  203. display: flex;
  204. align-items: center;
  205. .img{
  206. width: 80upx;
  207. height: 80upx;
  208. border-radius: 50%;
  209. margin-right: 20upx;
  210. }
  211. .name{
  212. font-size: 30upx;
  213. font-family: PingFang SC;
  214. font-weight: bold;
  215. color: #111111;
  216. }
  217. }
  218. .time{
  219. font-size: 26upx;
  220. font-family: PingFang SC;
  221. font-weight: 500;
  222. color: #808080;
  223. }
  224. }
  225. .illness-text{
  226. font-size: 30upx;
  227. font-family: PingFang SC;
  228. font-weight: 500;
  229. color: #111111;
  230. line-height: 50upx;
  231. margin-top: 20upx;
  232. }
  233. .imag-scroll{
  234. margin-top: 20upx;
  235. .imag-list{
  236. display: flex;
  237. align-items: center;
  238. .item{
  239. flex-shrink: 0;
  240. width: calc(25% - 8upx);
  241. height: 160upx;
  242. margin-right: 10upx;
  243. overflow: hidden;
  244. &:first-child{
  245. border-radius: 12upx 0 0 12upx;
  246. }
  247. &:last-child{
  248. margin-right: 0;
  249. border-radius: 0 12upx 12upx 0;
  250. }
  251. .img{
  252. width: 100%;
  253. height: 100%;
  254. }
  255. }
  256. }
  257. }
  258. .time-hand-box{
  259. margin-top: 40upx;
  260. display: flex;
  261. align-items: center;
  262. justify-content: space-between;
  263. .time{
  264. font-size: 24upx;
  265. font-family: PingFang SC;
  266. font-weight: 500;
  267. color: #999999;
  268. line-height: 1;
  269. }
  270. .right{
  271. display: flex;
  272. align-items: center;
  273. .item{
  274. display: flex;
  275. align-items: center;
  276. margin-right: 60upx;
  277. &:last-child{
  278. margin-right: 0;
  279. }
  280. .img{
  281. width: 28upx;
  282. height: 28upx;
  283. margin-right: 10upx;
  284. }
  285. .text{
  286. font-size: 28upx;
  287. font-family: PingFang SC;
  288. font-weight: 500;
  289. color: #999999;
  290. line-height: 1;
  291. }
  292. }
  293. }
  294. }
  295. .reply{
  296. border-bottom: 1rpx solid #f5f5f5;
  297. display: flex;
  298. align-items: flex-start;
  299. flex-direction: column;
  300. justify-content: flex-start;
  301. margin-top: 20upx;
  302. &:last-child {
  303. border-bottom: none;
  304. margin-top: 0rpx;
  305. }
  306. .reply-title{
  307. font-size: 30upx;
  308. font-family: PingFang SC;
  309. font-weight: bold;
  310. color: #111111;
  311. line-height: 50upx;
  312. margin-top: 25upx;
  313. display: flex;
  314. align-items: center;
  315. justify-content: flex-start;
  316. image{
  317. width: 50rpx;
  318. height:50rpx;
  319. border-radius: 50%;
  320. }
  321. .name{
  322. padding: 8upx 12upx;
  323. line-height: 40upx;
  324. background: #E2F6F2;
  325. border-radius: 6upx;
  326. font-size: 24upx;
  327. font-family: PingFang SC;
  328. font-weight: bold;
  329. color: #4BC9B1;
  330. margin-left: 15upx;
  331. }
  332. }
  333. .reply-content{
  334. margin-top: 20upx;
  335. padding: 20upx 25upx;
  336. font-size: 28upx;
  337. font-family: PingFang SC;
  338. font-weight: 500;
  339. color: #666666;
  340. line-height: 42upx;
  341. background: #F5F7F7;
  342. border-radius: 10upx;
  343. }
  344. .imag-scroll{
  345. margin-top: 20upx;
  346. .imag-list{
  347. display: flex;
  348. align-items: center;
  349. .item{
  350. flex-shrink: 0;
  351. width: calc(25% - 8upx);
  352. height: 160upx;
  353. margin-right: 10upx;
  354. overflow: hidden;
  355. border-radius: 12upx;
  356. &:first-child{
  357. //border-radius: 12upx 0 0 12upx;
  358. }
  359. &:last-child{
  360. margin-right: 0;
  361. //border-radius: 0 12upx 12upx 0;
  362. }
  363. .img{
  364. width: 100%;
  365. height: 100%;
  366. }
  367. }
  368. }
  369. .rimag-list{
  370. .item{
  371. flex-shrink: 0;
  372. width: 110upx;
  373. height: 110upx;
  374. margin-right: 10upx;
  375. overflow: hidden;
  376. border-radius: 12upx;
  377. .rimg{
  378. width: 100%;
  379. height: 100%;
  380. }
  381. }
  382. }
  383. }
  384. .reply-time{
  385. font-size: 26upx;
  386. font-family: PingFang SC;
  387. font-weight: 500;
  388. color: #cacaca;
  389. padding-bottom: 20rpx;
  390. }
  391. }
  392. .more{
  393. font-size: 26upx;
  394. font-family: PingFang SC;
  395. color: #666666;
  396. padding: 20rpx 0rpx 0rpx;
  397. display: flex;
  398. align-items: center;
  399. justify-content: center;
  400. }
  401. .text-para{
  402. font-size: 28upx;
  403. font-family: PingFang SC;
  404. font-weight: 500;
  405. color: #111111;
  406. line-height: 42upx;
  407. margin-bottom: 23upx;
  408. &:last-child{
  409. margin-bottom: 0;
  410. }
  411. .name{
  412. font-size: 28upx;
  413. font-family: PingFang SC;
  414. font-weight: bold;
  415. color: #4BC9B1;
  416. line-height: 42upx;
  417. }
  418. }
  419. }
  420. }
  421. .btn-box{
  422. z-index: 9999;
  423. width: 100%;
  424. padding: 30upx;
  425. position: fixed;
  426. bottom: 0;
  427. left: 0;
  428. box-sizing: border-box;
  429. background: #FFFFFF;
  430. .sub-btn{
  431. width: 100%;
  432. height: 88upx;
  433. line-height: 88upx;
  434. text-align: center;
  435. font-size: 30upx;
  436. font-family: PingFang SC;
  437. font-weight: bold;
  438. color: #FFFFFF;
  439. background: #018C39;
  440. border-radius: 44upx;
  441. }
  442. }
  443. }
  444. </style>