uploadRecord.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <template>
  2. <view v-show="show">
  3. <view
  4. class="item"
  5. @click="openModel(item)"
  6. hover-class="navigator-hover"
  7. v-for="item in list"
  8. :key="item.rowindex"
  9. >
  10. <view class="title">{{ item.createdate || " --" }}</view>
  11. <view class="row u-line-3">
  12. {{ item.analysis || item.content || "--" }}
  13. </view>
  14. </view>
  15. <u-modal
  16. :show="showModal"
  17. confirmText="复制"
  18. cancelText="关闭"
  19. showCancelButton
  20. @cancel="
  21. () => {
  22. this.showModal = false;
  23. this.showItem = {};
  24. }
  25. "
  26. @confirm="copyShowItem()"
  27. >
  28. <view class="slot-content">
  29. <view>
  30. <view class="modal-header">
  31. <view class="label">{{ showItem.createdate }}</view>
  32. <view class="sliding-block">
  33. <view
  34. class="but"
  35. :class="showMode == '译文' ? 'action' : ''"
  36. style="left: 0"
  37. hover-class="navigator-hover"
  38. @click="showMode = '译文'"
  39. >译文</view
  40. >
  41. <view
  42. class="but"
  43. hover-class="navigator-hover"
  44. style="right: 0"
  45. :class="showMode == '原文' ? 'action' : ''"
  46. @click="showMode = '原文'"
  47. >原文</view
  48. >
  49. <view
  50. class="sliding"
  51. :style="{
  52. transform: `translateX(${showMode == '译文' ? 0 : '34px'})`,
  53. }"
  54. />
  55. </view>
  56. </view>
  57. <view class="modal-content">
  58. {{
  59. (showMode == "译文" ? showItem.analysis : showItem.content) ||
  60. "--"
  61. }}
  62. </view>
  63. </view>
  64. </view>
  65. </u-modal>
  66. </view>
  67. </template>
  68. <script>
  69. let paging = {};
  70. export default {
  71. name: "uploadRecord",
  72. props: {
  73. w_deviceid: String,
  74. },
  75. data() {
  76. return {
  77. show: false,
  78. showModal: false,
  79. showItem: {},
  80. uninitialized: true,
  81. showMode: "译文",
  82. list: [],
  83. where: {
  84. begindate: "",
  85. enddate: "",
  86. },
  87. };
  88. },
  89. methods: {
  90. getList(init = false) {
  91. if (init)
  92. paging = {
  93. pageNumber: 1,
  94. pageTotal: 1,
  95. };
  96. return new Promise((resolve) => {
  97. if (paging.pageNumber > paging.pageTotal) return resolve();
  98. this.$Http
  99. .basic({
  100. id: 20230701132202,
  101. content: {
  102. type: 1,
  103. w_deviceid: this.w_deviceid,
  104. ...paging,
  105. where: this.where,
  106. },
  107. })
  108. .then((res) => {
  109. console.log("上传记录", res);
  110. resolve(!this.cutoff(res.msg));
  111. if (this.cutoff(res.msg)) return;
  112. paging.pageNumber = res.pageNumber + 1;
  113. paging.pageTotal = res.pageTotal;
  114. this.list =
  115. res.pageNumber == 1 ? res.data : this.list.concat(res.data);
  116. });
  117. });
  118. },
  119. copyShowItem() {
  120. let that = this;
  121. uni.setClipboardData({
  122. data:
  123. this.showMode == "译文"
  124. ? this.showItem.analysis
  125. : this.showItem.content,
  126. complete: (res) => {
  127. console.log("复制", res);
  128. that.showModal = false;
  129. that.showItem = {};
  130. },
  131. });
  132. },
  133. openModel(item) {
  134. this.showModal = true;
  135. this.showMode = "译文";
  136. this.showItem = item;
  137. },
  138. },
  139. };
  140. </script>
  141. <style lang="scss" scoped>
  142. .item {
  143. width: 355px;
  144. margin: 0 auto 10px;
  145. padding: 10px;
  146. background: #fff;
  147. border-radius: 4px;
  148. box-sizing: border-box;
  149. .title {
  150. line-height: 21px;
  151. font-size: 15px;
  152. font-family: PingFang SC-Medium, PingFang SC;
  153. font-weight: bold;
  154. color: #333333;
  155. margin-bottom: 10px;
  156. }
  157. .row {
  158. line-height: 17px;
  159. font-size: 12px;
  160. color: #666666;
  161. margin-bottom: 5px;
  162. }
  163. }
  164. /deep/.u-empty {
  165. z-index: 1 !important;
  166. }
  167. .modal-header {
  168. display: flex;
  169. justify-content: space-around;
  170. .label {
  171. font-weight: 700;
  172. }
  173. .sliding-block {
  174. position: relative;
  175. flex-shrink: 0;
  176. width: 74px;
  177. height: 20px;
  178. border-radius: 12px;
  179. overflow: hidden;
  180. box-sizing: border-box;
  181. background: #f5f6fa;
  182. .but {
  183. position: absolute;
  184. font-size: 10px;
  185. width: 40px;
  186. text-align: center;
  187. line-height: 21px;
  188. z-index: 2;
  189. color: #bbbbbb;
  190. border-radius: 12px;
  191. transition: color 0.3s ease;
  192. }
  193. .action {
  194. color: #ffffff !important;
  195. z-index: 3 !important;
  196. }
  197. .sliding {
  198. position: absolute;
  199. width: 40px;
  200. height: 20px;
  201. background: #3874f6;
  202. border-radius: 12px;
  203. z-index: 1;
  204. transition: transform 0.3s ease;
  205. }
  206. }
  207. }
  208. .modal-content {
  209. width: 300px;
  210. display: inline-block;
  211. white-space: pre-wrap;
  212. word-wrap: break-word;
  213. margin-top: 20px;
  214. }
  215. </style>