shouJiQingLi.vue 3.8 KB

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