index.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <template>
  2. <view class="container">
  3. <uni-section :title="task !== null ? task.name : '当前无检测任务'" type="line">
  4. <uni-list :border="true" v-if="list.length > 0">
  5. <view :id="item && item.residentId" class="delBox" v-for="(item, index) in list" :key="index" >
  6. <uni-list-chat :class="{ left: isId == item.residentId }" class="item" :avatar="item.avatar || '/static/user1.png'" :title="item.name" :note="item.phone" badge-positon="left">
  7. <view class="chat-custom-right">
  8. <text class="chat-custom-text">{{ item && item.status == 0 ? '未检' : '已检' }}</text>
  9. <button type="primary" size="mini" :disabled="item && item.status == 1" @click="filing(item)">报备</button>
  10. </view>
  11. </uni-list-chat>
  12. </view>
  13. </uni-list>
  14. <text v-else class="chat-custom-text msgText">请完善成员信息 / 家庭成员审核中</text>
  15. </uni-section>
  16. </view>
  17. </template>
  18. <script>
  19. import requestFamily from '../../api/family.js';
  20. export default {
  21. data() {
  22. return {
  23. isId: '',
  24. startX: 0,
  25. extraIcon: {
  26. color: '#ff8319',
  27. size: '20',
  28. type: 'plusempty'
  29. },
  30. list: [],
  31. natTaskId: '',
  32. task: null
  33. }
  34. },
  35. async mounted() {
  36. const task = await requestFamily.runningTask();
  37. if (task.code == 200) {
  38. this.task = task.data[0];
  39. this.natTaskId = task.data[0].natTaskId;
  40. this.query();
  41. }
  42. },
  43. onShow() {
  44. this.isId = '';
  45. },
  46. methods: {
  47. async query() {
  48. // const { userId } = uni.getStorageSync('userinfo');
  49. const familyInfo = await requestFamily.getFamilyInfo();
  50. if (familyInfo.code == 200) {
  51. const membersStatus = await requestFamily.membersStatus({ natTaskId: this.natTaskId });
  52. familyInfo.rows = familyInfo.rows.map(e => {
  53. const resident = membersStatus.data.find(j => j.residentId == e.residentId);
  54. return { ...e, status: resident?.status || 0 };
  55. })
  56. this.list = familyInfo.rows;
  57. }
  58. },
  59. // 报备
  60. async filing(e) {
  61. const res = await requestFamily.filing({ residentId: e.residentId, natTaskId: this.natTaskId });
  62. if (res.code == 200) {
  63. this.query();
  64. uni.showToast({
  65. title: '报备成功',
  66. duration: 2000,
  67. });
  68. }
  69. }
  70. }
  71. }
  72. </script>
  73. <style>
  74. .container {
  75. width: 100%;
  76. }
  77. .addUser {
  78. display: block;
  79. /* width: 90%; */
  80. margin: 5px auto;
  81. }
  82. .chat-custom-text {
  83. font-size: 12px;
  84. color: #999;
  85. width: 100%;
  86. text-align: center;
  87. display: block;
  88. }
  89. .addUser .uni-list-item__container {
  90. flex: none;
  91. margin: 0 auto;
  92. }
  93. .addUser .uni-list-item__content-title {
  94. color: #ff8319;
  95. }
  96. .delBox {
  97. display: flex;
  98. width: 100%;
  99. overflow: hidden;
  100. }
  101. .item {
  102. width: 100%;
  103. }
  104. .del {
  105. display: block;
  106. width: 50px;
  107. background: red;
  108. }
  109. .right {
  110. margin-right: -100px;
  111. }
  112. .uni-icons {
  113. display: block;
  114. width: 100%;
  115. text-align: center;
  116. line-height: 2.3em;
  117. }
  118. .left {
  119. margin-left: -100px;
  120. }
  121. .compose {
  122. background: #1aad19;
  123. }
  124. .msgText {
  125. padding-bottom: 20px;
  126. }
  127. </style>