config.vue 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <template>
  2. <hc-sys class="hc-config-page" :isNavBar="false">
  3. <view class="cu-list menu sm-border mt-1">
  4. <view class="cu-item arrow" @click="toPageClick('/pages/my/info')">
  5. <view class="content hc-flex">
  6. <text class="i-ri-user-3-fill text-blue text-32 mr-1"/>
  7. <text class="text-gray-4">个人资料</text>
  8. </view>
  9. <view class="action">{{userInfo.real_name}}</view>
  10. </view>
  11. <view class="cu-item">
  12. <view class="content hc-flex">
  13. <text class="i-solar-calendar-search-outline text-blue text-32 mr-1"/>
  14. <text class="text-gray-4">填报提醒</text>
  15. </view>
  16. <view class="action">
  17. <switch :checked="appCheck" @change="fillSwitchChange" style="transform:scale(0.9)"/>
  18. </view>
  19. </view>
  20. </view>
  21. <view class="cu-list menu sm-border">
  22. <view class="cu-item">
  23. <view class="content hc-flex">
  24. <text class="i-ri-pantone-fill text-purple text-32 mr-1"/>
  25. <text class="text-gray-4">当前版本</text>
  26. </view>
  27. <view class="action text-gray-5">v{{appInfo.version}}</view>
  28. </view>
  29. <view class="cu-item">
  30. <view class="content hc-flex">
  31. <text class="i-ri-rocket-fill text-cyan text-32 mr-1"/>
  32. <text class="text-gray-4">检测升级</text>
  33. </view>
  34. <view class="action">
  35. <!--view class="cu-tag round bg-blue light">有新版本</view-->
  36. <text class="text-26 text-gray-5">暂无新版本</text>
  37. </view>
  38. </view>
  39. </view>
  40. </hc-sys>
  41. </template>
  42. <script setup>
  43. import {ref} from "vue";
  44. import {onLoad} from '@dcloudio/uni-app'
  45. import {useAppStore} from "@/store";
  46. import userApi from '~api/user/index';
  47. //初始变量
  48. const store = useAppStore()
  49. const userInfo = ref(store.userInfo);
  50. const appInfo = ref({version: '-', wgt: '-'});
  51. //渲染完成
  52. onLoad(() => {
  53. const {appVersion, appWgtVersion} = uni.getSystemInfoSync();
  54. appInfo.value = {version: appVersion, wgt: appWgtVersion}
  55. userConfigInfo()
  56. })
  57. const toPageClick = (url) => {
  58. uni.navigateTo({url: url});
  59. }
  60. //获取配置
  61. const appCheck = ref(true)
  62. const userConfigInfo = async () => {
  63. const { data } = await userApi.userConfigInfo()
  64. appCheck.value = data?.appCheck !== 2
  65. }
  66. //填报弹窗
  67. const fillSwitchChange = ({detail}) => {
  68. const check = detail.value ? 1 : 2
  69. userApi.userConfigSave({
  70. appCheck: check
  71. })
  72. appCheck.value = detail.value
  73. }
  74. </script>