set.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <template>
  2. <view class="set-box">
  3. <en-nav title="设置" title-color="#333333" ></en-nav>
  4. <view class="set-list">
  5. <view class="set-item">
  6. <view class="item-text sys-height-44 sys-color-black">清理缓存</view>
  7. <view class="item-icon" @click="clearStorage()">
  8. <text class=" sys-height-44 sys-color-gray-9"> {{storageSize}}</text>
  9. <text class="iconfont sys-height-44 sys-color-gray-9"> &#xe62b;</text>
  10. </view>
  11. </view>
  12. </view>
  13. <view class="set-list">
  14. <view class="set-item" @click="goToUrl(setItem.url)" v-for="setItem in setList">
  15. <view class="item-text sys-height-44 sys-color-black">{{setItem.text}}</view>
  16. <view class="item-icon">
  17. <text class="iconfont sys-height-44 sys-color-gray-9"> &#xe62b;</text>
  18. </view>
  19. </view>
  20. </view>
  21. <view class="set-list">
  22. <view class="set-item" @click="goToUrl(sysItem.url)" v-for="sysItem in sysList">
  23. <view class="item-text sys-height-44 sys-color-black">{{sysItem.text}}</view>
  24. <view class="item-icon">
  25. <text class="iconfont sys-height-44 sys-color-gray-9"> &#xe62b;</text>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="set-list">
  30. <view class="set-item" @click="goToUrl('./set/conversion')">
  31. <view class="item-text sys-height-44 sys-color-black">兑换码</view>
  32. <view class="item-icon">
  33. <text class="iconfont sys-height-44 sys-color-gray-9"> &#xe62b;</text>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="set-id sys-color-gray-9">ID:87999890</view>
  38. <view class="set-quit sys-color-black">退出账号</view>
  39. </view>
  40. </template>
  41. <script>
  42. import EnNav from "@/components/en-utils/en-nav/en-nav";
  43. export default {
  44. components: {EnNav},
  45. data() {
  46. return {
  47. storageSize:'',
  48. setList:[
  49. {'text':'实名认证(未认证)','url':'./set/autonym'},
  50. {'text':'修改密码','url':'./set/change-pass'},
  51. {'text':'修改绑定手机','url':'./set/chang-phone'},
  52. {'text':'更多设置','url':'./set/more-set'},
  53. ],
  54. sysList:[
  55. {'text':'意见与反馈','url':''},
  56. {'text':'关于我们','url':'./agreement/about-us'},
  57. {'text':'用户协议','url':'./agreement/agreement'},
  58. {'text':'隐私政策','url':'./agreement/privacy'},
  59. // {'text':'第三方信息共享清单','url':''},
  60. {'text':'个人信息清单','url':'./agreement/personage'},
  61. {'text':'相关许可证','url':'./agreement/all-permission'},
  62. // {'text':'ICOCO权限及用途说明','url':''},
  63. // {'text':'隐私中心','url':''},
  64. ],
  65. }
  66. },
  67. mounted() {
  68. this.getStorageSize()
  69. },
  70. methods: {
  71. goToUrl(url){
  72. if(url===''){
  73. return;
  74. }
  75. uni.navigateTo({
  76. 'url':url
  77. })
  78. },
  79. getStorageSize:function(){
  80. let that = this;
  81. uni.getStorageInfo({
  82. success(res) {
  83. console.log(res)
  84. console.log(res.keys);
  85. console.log(res.limitSize);
  86. let size = res.currentSize;
  87. if (size < 1024) {
  88. that.storageSize = (size).toFixed(2) + ' B';
  89. } else if (size/1024>=1 && size/1024/1024<1) {
  90. that.storageSize = (Math.floor(size/1024*100)/100).toFixed(2) + ' KB';
  91. } else if (size/1024/1024>=1) {
  92. that.storageSize = (Math.floor(size/1024/1024*100)/100).toFixed(2) + ' M';
  93. }
  94. }
  95. })
  96. },
  97. clearStorage:function (){
  98. let that = this;
  99. uni.showModal({
  100. title:'提示',
  101. content:'确定清除缓存吗?',
  102. confirmText:'立即清除',
  103. success(res) {
  104. if(res.confirm){
  105. let token=uni.getStorageSync('token')
  106. uni.clearStorageSync();
  107. if(token){
  108. uni.setStorageSync('token',token)
  109. }
  110. //重新获取并显示清除后的缓存大小
  111. that.getStorageSize();
  112. uni.showToast({
  113. title:'清除成功'
  114. })
  115. }
  116. }
  117. })
  118. }
  119. }
  120. }
  121. </script>
  122. <style scoped lang="scss">
  123. .set-box{
  124. background-color: #F9F9F9;
  125. min-height: 100vh;
  126. padding-bottom: 50rpx;
  127. .set-list{
  128. margin: 20rpx 32rpx 0 32rpx;
  129. background-color: #fff;
  130. border-radius: 20rpx;
  131. padding: 0 32rpx;
  132. .set-item{
  133. padding: 32rpx 0;
  134. display: flex;
  135. justify-content: space-between;
  136. border-bottom: 1rpx solid #F2F2F2;
  137. .item-text{
  138. font-size: 28rpx;
  139. }
  140. .item-icon{
  141. .iconfont{
  142. font-size: 28rpx;
  143. }
  144. }
  145. }
  146. .set-item:last-child{
  147. border-bottom: none;
  148. }
  149. }
  150. .set-id{
  151. text-align: center;
  152. margin-top: 40rpx;
  153. font-size: 24rpx;
  154. }
  155. .set-quit{
  156. margin: 40rpx 32rpx;
  157. font-size: 32rpx;
  158. height: 88rpx;
  159. line-height: 88rpx;
  160. border-radius: 16rpx;
  161. background: #E0E0E0;
  162. text-align: center;
  163. }
  164. }
  165. </style>