setting.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <template>
  2. <view class="page-content">
  3. <mx-nav-bar title="关于"/>
  4. <view class="fx-col fx-cen-cen py-80">
  5. <uv-image src="/static/logo.png" width="80" height="auto" mode="widthFix"/>
  6. </view>
  7. <uv-cell-group class="bg-white !flex-none">
  8. <uv-cell v-for="s in settings" v-bind="s" @click="s.handler()"/>
  9. </uv-cell-group>
  10. </view>
  11. </template>
  12. <script setup>
  13. import {onMounted, reactive} from 'vue'
  14. import {useTransfer} from "@/hooks/useTransfer";
  15. import {useCacheStore} from "@/hooks/useCacheStore";
  16. import {useEnvStore} from "@/hooks/useEnvStore";
  17. import {confirmAsync} from "@/utils/uni-helper";
  18. import {useUserStore} from "@/hooks/useUserStore";
  19. import {sizeFormat} from "@/utils";
  20. const {transferToProtocolUser, transferToProtocolPrivacy, transferToIndex, cleanAllTransferCacheData} = useTransfer()
  21. const {getSize: getCacheSize, gcCache} = useCacheStore()
  22. const {systemInfo} = useEnvStore()
  23. const {LogoutPhysical, GetInfo} = useUserStore()
  24. const settings = reactive([
  25. {
  26. title: '服务协议',
  27. icon: '/static/personal/icon-yonghuxieyi@2x.png',
  28. isLink: true,
  29. handler: () => transferToProtocolUser()
  30. },
  31. {
  32. title: '隐私政策',
  33. icon: '/static/personal/icon-yinxixieyi@2x.png',
  34. isLink: true,
  35. handler: () => transferToProtocolPrivacy()
  36. },
  37. {
  38. title: '清除缓存', //icon_cache
  39. icon: '/static/personal/icon_cache.png',
  40. rightIcon: 'reload',
  41. isLink: true,
  42. handler: () => {
  43. cleanAllTransferCacheData() // 清理页面大对象
  44. GetInfo() // GetInfo也会清除缓存,借机也更新一下用户信息
  45. calculateCacheSize()
  46. }
  47. },
  48. {
  49. title: '当前版本',
  50. icon: '/static/personal/icon-dangqianbanben@2x.png',
  51. value: systemInfo.value.appVersion,
  52. handler: () => {
  53. }
  54. },
  55. {
  56. title: '注销账号',
  57. icon: 'trash',
  58. isLink: true,
  59. handler: async () => {
  60. const msg = '是否注销账号,注销后卡号将不能再注册使用系统且永久失效。请谨慎操作!'
  61. await confirmAsync(msg)
  62. await LogoutPhysical()
  63. transferToIndex()
  64. }
  65. },
  66. {
  67. title: 'APP备案号',
  68. icon: 'empty-permission',
  69. value: '湘ICP备18012964号-8A',
  70. handler: () => {
  71. }
  72. },
  73. {
  74. title: '客服电话',
  75. icon: 'server-man',
  76. value: '400-1797-985',
  77. handler: () => {
  78. }
  79. }
  80. ])
  81. onMounted(() => calculateCacheSize())
  82. const calculateCacheSize = function () {
  83. gcCache()
  84. let size = getCacheSize()
  85. settings[2].value = sizeFormat(size)
  86. }
  87. </script>
  88. <style scoped>
  89. ::v-deep .uv-cell__body {
  90. font-size: 16px;
  91. padding: 12px 15px;
  92. }
  93. </style>