shouJiQingLi.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <template>
  2. <view class="content">
  3. <view :style="{ paddingTop: statusBarHeight + 'px' }">
  4. <view class="flex w ai_center jc_center fd_c mgt-20">
  5. <!-- <qiun-data-charts
  6. style="width: 360rpx;height: 360rpx;"
  7. type="arcbar"
  8. :opts="opts"
  9. :chartData="chartData"
  10. /> -->
  11. <image src="/static/image/source/jiasu.png" v-if="!status"
  12. style="width: 350rpx;height: 350rpx;"></image>
  13. <iCircle
  14. v-else
  15. :percent="percent"
  16. :size="350"
  17. stroke-color="#44ebd9"
  18. BgId="BgId1"
  19. InId="InId1"
  20. trailWidth="30"
  21. strokeWidth="30"
  22. trailColor="#d0effd"
  23. >
  24. <text style="font-size:48rpx; color: #333;font-weight: bold;">{{ percent }}%</text>
  25. <view slot="canvas">
  26. <canvas
  27. class="CanvasBox strokeCanvas"
  28. canvas-id="BgId1"
  29. ></canvas>
  30. <canvas
  31. class="CanvasBox trailCanvas"
  32. canvas-id="InId1"
  33. ></canvas>
  34. </view>
  35. </iCircle>
  36. <view class="text-24 mgt-20">发现大量垃圾</view>
  37. <view class="text-888 text-22 mgt-20">占用大量手机内存,急需清理</view>
  38. <view class="mgt-50 clean_btn cursor" @click="sureClean">
  39. {{ status?'正在清理中':'立即清理' }}
  40. </view>
  41. </view>
  42. <view class="w bg-white h-320 mgt-80 radio-30 pd-20">
  43. <view v-for="(i,key) in info" class="bg-eee h-80 radio-20 mgb-20 flex jc_between ai_center pdx-20">
  44. <view>
  45. <i v-if="key == '剩余内存'" style="color: #42aa87;" class="fas fa-rocket"></i>
  46. <i v-else-if="key == '总计内存'" style="color: #42aa87;" class="fas fa-file"></i>
  47. <i v-else-if="key == '已使用'" style="color: #42aa87;" class="fas fa-pie-chart"></i>
  48. &nbsp; {{ key }}
  49. </view>
  50. <view class="" style="color: #42aa87;">
  51. {{ i }}GB
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. </template>
  58. <script setup>
  59. import { ref, onMounted } from "vue";
  60. import { onShow } from "@dcloudio/uni-app";
  61. import iCircle from '@/components/xiaoran-circle/xiaoran-circle.vue';
  62. var statusBarHeight = uni.getStorageSync('statusBarHeight')
  63. onMounted(()=>{
  64. getServerData();
  65. })
  66. const info = ref({
  67. '剩余内存':20.99,
  68. '总计内存': 50.12,
  69. '已使用':29.13,
  70. })
  71. const percent = ref(0)
  72. const status = ref(false)
  73. var timer = null
  74. const sureClean = ()=>{
  75. if(status.value) return
  76. status.value = !status.value
  77. if(status.value){
  78. timer = setInterval(() => {
  79. if(percent.value < 100){
  80. let num = Math.ceil(Math.random()*3)
  81. percent.value += percent.value + num > 100 ? 1 : num
  82. }else{
  83. clearInterval(timer)
  84. percent.value = 0
  85. status.value = false
  86. }
  87. }, 200)
  88. }else{
  89. percent.value = 0
  90. }
  91. }
  92. const chartData = ref({
  93. })
  94. const opts = ref({
  95. color: ["#1890FF","#91CB74","#FAC858","#EE6666","#73C0DE","#3CA272","#FC8452","#9A60B4","#ea7ccc"],
  96. padding: undefined,
  97. title: {
  98. name: "80%",
  99. fontSize: 35,
  100. color: "#000"
  101. },
  102. subtitle: {
  103. name: "",
  104. fontSize: 25,
  105. color: "#666666"
  106. },
  107. extra: {
  108. arcbar: {
  109. type: "circle",
  110. width: 14,
  111. backgroundColor: "#cfeffc",
  112. startAngle: 1.5,
  113. endAngle: 0.25,
  114. gap: 2
  115. }
  116. },
  117. background:'rgba(0,0,0,1)',
  118. })
  119. const getServerData = () => {
  120. //模拟从服务器获取数据时的延时
  121. setTimeout(() => {
  122. //模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接
  123. let res = {
  124. series: [
  125. {
  126. name: "",
  127. color: "#3ceedc",
  128. data: 0.8
  129. }
  130. ]
  131. };
  132. chartData.value = JSON.parse(JSON.stringify(res));
  133. }, 50);
  134. }
  135. </script>
  136. <style lang="scss" scoped>
  137. .content{
  138. height: 100vh;
  139. padding: 28rpx;
  140. background: linear-gradient(to bottom, #a5eed0, #dcefaf);
  141. .clean_btn{
  142. width: 400rpx;
  143. text-align: center;
  144. background: #fff;
  145. height: 80rpx;
  146. line-height: 80rpx;
  147. color: #42aa87;
  148. border-radius: 40rpx;
  149. border: 1rpx solid;
  150. }
  151. }
  152. .CanvasBox {
  153. width: 100%;
  154. height: 100%;
  155. position: absolute;
  156. top: 0px;
  157. left: 0px;
  158. display: flex;
  159. justify-content: center;
  160. align-items: center;
  161. }
  162. </style>