dayOnlinePageList.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <view>
  3. <view
  4. class="dialogMask"
  5. v-if="isShow"
  6. :style="{
  7. height: height + 'px',
  8. }"
  9. @click.stop="hide"
  10. >
  11. <view
  12. class="dialogContent"
  13. @click.stop
  14. >
  15. <view
  16. class="dialogHead"
  17. @click="hide"
  18. >
  19. <view>
  20. <text class="title">{{ item.date + " " + item.timeCount }}</text>
  21. </view>
  22. <view>
  23. <image
  24. src="@/devTools/page/static/unfold.png"
  25. class="fold"
  26. />
  27. </view>
  28. </view>
  29. <scroll-view
  30. scroll-y
  31. class="scrollList"
  32. >
  33. <view
  34. v-for="(row, index) in item.page"
  35. :key="index"
  36. class="pageLogItem"
  37. @click.stop="showMenu(row)"
  38. >
  39. <text class="p">页面:{{ row.r }}</text>
  40. <text class="t">活跃:{{ row.timeCount }}</text>
  41. </view>
  42. <view style="height: 100rpx"></view>
  43. </scroll-view>
  44. </view>
  45. </view>
  46. </view>
  47. </template>
  48. <script>
  49. let success, error;
  50. export default {
  51. data() {
  52. return {
  53. /**
  54. * 是否展示
  55. */
  56. isShow: false,
  57. /**
  58. * 屏幕高度
  59. */
  60. height: uni.getSystemInfoSync().windowHeight,
  61. /**
  62. * 详情列表
  63. */
  64. item: {
  65. date: "",
  66. timeCount: "",
  67. page: [
  68. {
  69. r: "",
  70. timeCount: "",
  71. },
  72. ],
  73. },
  74. };
  75. },
  76. methods: {
  77. /**
  78. * 展示弹窗
  79. */
  80. show(item) {
  81. let that = this;
  82. return new Promise((yes, err) => {
  83. success = yes;
  84. error = err;
  85. that.item.date = item.date;
  86. that.item.timeCount = item.timeCount;
  87. that.item.page = item.page;
  88. that.isShow = true;
  89. });
  90. },
  91. /**
  92. * 关闭弹窗
  93. */
  94. hide() {
  95. this.isShow = false;
  96. error();
  97. },
  98. /**
  99. * 保存
  100. */
  101. save() {
  102. this.isShow = false;
  103. success(this.value);
  104. },
  105. /**
  106. * 展示菜单
  107. */
  108. showMenu(row) {
  109. let that = this;
  110. let r = String(row.r).substring(0, 10) + "...";
  111. let menu = [
  112. {
  113. text: `复制路径(${r})`,
  114. click() {
  115. uni.setClipboardData({
  116. data: row.r,
  117. });
  118. },
  119. },
  120. {
  121. text: `复制时间(${row.timeCount})`,
  122. click() {
  123. uni.setClipboardData({
  124. data: row.timeCount,
  125. });
  126. },
  127. },
  128. {
  129. text: `跳转至此页面`,
  130. click() {
  131. uni.$emit("devTools_showRouteDialog", row.r);
  132. },
  133. },
  134. ];
  135. uni.showActionSheet({
  136. itemList: menu.map((x) => x.text),
  137. success({ tapIndex }) {
  138. menu[tapIndex].click();
  139. },
  140. });
  141. },
  142. },
  143. };
  144. </script>
  145. <style lang="scss" scoped>
  146. .dialogMask {
  147. display: flex;
  148. flex-direction: column-reverse;
  149. background-color: rgba(0, 0, 0, 0.3);
  150. width: 750rpx;
  151. flex: 1;
  152. /* #ifndef APP-PLUS */
  153. height: 100vh;
  154. backdrop-filter: blur(1px);
  155. /* #endif */
  156. position: fixed;
  157. left: 0;
  158. top: 0;
  159. z-index: 999;
  160. .dialogContent {
  161. display: flex;
  162. flex-direction: column;
  163. width: 750rpx;
  164. background-color: #fff;
  165. border-radius: 20rpx 20rpx 0 0;
  166. .dialogHead {
  167. display: flex;
  168. flex-direction: row;
  169. align-items: center;
  170. justify-content: space-between;
  171. height: 80rpx;
  172. border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  173. width: 750rpx;
  174. .title {
  175. margin-left: 20rpx;
  176. font-size: 24rpx;
  177. line-height: 24rpx;
  178. color: #333;
  179. }
  180. .fold {
  181. width: 20rpx;
  182. height: 20rpx;
  183. margin-right: 20rpx;
  184. }
  185. }
  186. .scrollList {
  187. width: 750rpx;
  188. height: 750rpx;
  189. .pageLogItem {
  190. width: 750rpx;
  191. display: flex;
  192. flex-direction: column;
  193. padding: 10rpx 20rpx;
  194. border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  195. &:active {
  196. background-color: rgba(0, 0, 0, 0.05);
  197. }
  198. .p {
  199. font-size: 20rpx;
  200. color: #333;
  201. }
  202. .t {
  203. margin-top: 4rpx;
  204. font-size: 20rpx;
  205. color: #333;
  206. }
  207. }
  208. }
  209. }
  210. }
  211. </style>