doc.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <template>
  2. <view class="content">
  3. <view class="inner">
  4. <view v-for="(item,index) in docs" :key="index" class="item" @click="showDetail(item)">
  5. <view class="user-info">
  6. <view class="name">{{item.userName}}</view>
  7. <text class="gray-tag" v-if="item.sex==1">男</text>
  8. <text class="gray-tag" v-if="item.sex==2">女</text>
  9. <view class="gray-tag">{{utils.getAge(item.birthday)}}岁</view>
  10. <view class="blue-tag">标签</view>
  11. </view>
  12. <!-- <view class="stage-box">
  13. <text class="stage">阶段1:</text>
  14. <text class="stage-text">药物治疗胰岛素降糖,洛氟沙星抗感染治疗中治疗中治疗中治疗中</text>
  15. </view>
  16. <view class="progress-box">
  17. <progress :percent="80" activeColor="#4BC9B1" border-radius="5" stroke-width="5" />
  18. </view> -->
  19. <view class="period">建档时间 {{item.createTime}}</view>
  20. <view class="period">备注 {{item.remark!=null?item.remark:''}}</view>
  21. </view>
  22. <view v-if="docs.length == 0" class="no-data-box" @click="getMyDocList()">
  23. <image src="../../static/images/no_data.png" mode="aspectFit"></image>
  24. <view class="empty-title">暂无数据</view>
  25. </view>
  26. </view>
  27. <view class="btn-box">
  28. <view class="sub-btn" @click="addDoc">创建健康档案</view>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. import {getMyDocList,delDoc} from '@/api/doc.js'
  34. export default {
  35. data() {
  36. return {
  37. docs:[],
  38. }
  39. },
  40. onLoad() {
  41. this.getMyDocList()
  42. uni.$on('refreshDoc', () => {
  43. this.getMyDocList()
  44. })
  45. },
  46. methods: {
  47. showDetail(item){
  48. uni.navigateTo({
  49. url: './docDetail?docId='+item.docId
  50. })
  51. },
  52. editDoc(item){
  53. uni.navigateTo({
  54. url: './addDoc?type=edit&docId='+item.docId
  55. })
  56. },
  57. delDoc(item){
  58. uni.showModal({
  59. title:"提示",
  60. content:"确认删除吗?",
  61. showCancel:true,
  62. cancelText:'取消',
  63. confirmText:'确定',
  64. success:res=>{
  65. if(res.confirm){
  66. // 用户点击确定
  67. var data={docId:item.docId}
  68. delDoc(data).then(
  69. res => {
  70. if(res.code==200){
  71. uni.showToast({
  72. icon:'success',
  73. title: "操作成功",
  74. });
  75. this.getMyDocList()
  76. }else{
  77. uni.showToast({
  78. icon:'none',
  79. title: "请求失败",
  80. });
  81. }
  82. },
  83. rej => {}
  84. );
  85. }else{
  86. // 否则点击了取消
  87. }
  88. }
  89. })
  90. },
  91. getMyDocList(){
  92. uni.showLoading({
  93. title:"正在加载中"
  94. })
  95. getMyDocList().then(
  96. res => {
  97. uni.hideLoading()
  98. if(res.code==200){
  99. this.docs=res.data;
  100. }else{
  101. uni.showToast({
  102. icon:'none',
  103. title: "请求失败",
  104. });
  105. }
  106. },
  107. rej => {}
  108. );
  109. },
  110. addDoc() {
  111. uni.navigateTo({
  112. url: './addDoc?type=add'
  113. })
  114. }
  115. }
  116. }
  117. </script>
  118. <style lang="scss">
  119. page{
  120. height: 100%;
  121. }
  122. .content{
  123. height: 100%;
  124. display: flex;
  125. flex-direction: column;
  126. justify-content: space-between;
  127. .inner{
  128. flex: 1;
  129. padding: 20upx 20upx 160upx;
  130. .item{
  131. background: #FFFFFF;
  132. border-radius: 20upx;
  133. margin-bottom: 20upx;
  134. padding: 40upx 30upx;
  135. &:last-child{
  136. margin-bottom: 0;
  137. }
  138. .user-info{
  139. display: flex;
  140. align-items: center;
  141. .name{
  142. font-size: 36upx;
  143. font-family: PingFang SC;
  144. font-weight: bold;
  145. color: #111111;
  146. line-height: 1;
  147. margin-right: 20upx;
  148. }
  149. .gray-tag{
  150. height: 46upx;
  151. line-height: 46upx;
  152. padding: 0 16upx;
  153. font-size: 24upx;
  154. font-family: PingFang SC;
  155. font-weight: 500;
  156. color: #333333;
  157. background: #F7F7F7;
  158. border-radius: 8upx;
  159. margin-right: 10upx;
  160. }
  161. .blue-tag{
  162. height: 46upx;
  163. line-height: 46upx;
  164. padding: 0 16upx;
  165. font-size: 24upx;
  166. font-family: PingFang SC;
  167. font-weight: bold;
  168. color: #4BC9B1;
  169. background: #E2F6F2;
  170. border-radius: 8upx;
  171. }
  172. }
  173. .stage-box{
  174. white-space: nowrap;
  175. overflow: hidden;
  176. text-overflow: ellipsis;
  177. margin-top: 34upx;
  178. .stage{
  179. font-size: 26upx;
  180. font-family: PingFang SC;
  181. font-weight: 500;
  182. color: #111111;
  183. line-height: 1;
  184. }
  185. .stage-text{
  186. font-size: 26upx;
  187. font-family: PingFang SC;
  188. font-weight: 500;
  189. color: #666666;
  190. line-height: 1;
  191. }
  192. }
  193. .progress-box{
  194. margin-top: 18upx;
  195. }
  196. .period{
  197. font-size: 28upx;
  198. font-family: PingFang SC;
  199. font-weight: 500;
  200. color: #999999;
  201. line-height: 1;
  202. margin-top: 40upx;
  203. }
  204. }
  205. }
  206. .btn-box{
  207. z-index: 9999;
  208. width: 100%;
  209. padding: 30upx;
  210. position: fixed;
  211. bottom: 0;
  212. left: 0;
  213. box-sizing: border-box;
  214. background: #FFFFFF;
  215. .sub-btn{
  216. width: 100%;
  217. height: 88upx;
  218. line-height: 88upx;
  219. text-align: center;
  220. font-size: 30upx;
  221. font-family: PingFang SC;
  222. font-weight: bold;
  223. color: #FFFFFF;
  224. background: #018C39;
  225. border-radius: 44upx;
  226. }
  227. }
  228. }
  229. </style>