用工小程序前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

127 lines
3.4 KiB

6 months ago
3 months ago
6 months ago
3 months ago
6 months ago
3 months ago
6 months ago
3 months ago
6 months ago
3 months ago
6 months ago
4 months ago
6 months ago
4 months ago
3 months ago
4 months ago
3 months ago
4 months ago
6 months ago
  1. <template>
  2. <view>
  3. <view class="se-px-30 se-pt-40 se-pb-20 se-fs-26 se-c-text-third">
  4. 账号设置
  5. </view>
  6. <view class="se-px-30 se-py-20 se-flex se-flex-h-sb se-fs-28 se-c-black" @click="outLogin">
  7. <view class="se-flex se-flex-h-c">
  8. <image class="se-w-40 se-h-30 se-mr-10" src="@/static/image/7822.png" mode=""></image>
  9. <text>切换账号</text>
  10. </view>
  11. <view>
  12. <u-icon name="arrow-right"></u-icon>
  13. </view>
  14. </view>
  15. <view class="se-px-30 se-pt-40 se-pb-20 se-fs-26 se-c-text-third">
  16. 系统设置
  17. </view>
  18. <view class="se-px-30 se-py-20 se-pt-40 se-flex se-flex-h-sb se-fs-28 se-c-black" @click="onCache">
  19. <view class="se-flex se-flex-h-c">
  20. <image class="se-w-30 se-h-30 se-mr-10" src="@/static/image/47822.png" mode=""></image>
  21. <text>清理缓存</text>
  22. </view>
  23. <view class="">
  24. <u-icon name="arrow-right"></u-icon>
  25. </view>
  26. </view>
  27. <view class="se-px-30 se-py-20 se-pt-40 se-flex se-flex-h-sb se-fs-28 se-c-black" @click="checkUpdate">
  28. <view class="se-flex se-flex-h-c">
  29. <!-- <image class="se-w-50 se-h-30 se-mr-40" src="@/static/image/home.png" mode=""></image> -->
  30. <text>版本更新</text>
  31. </view>
  32. <view class="">
  33. <u-icon name="arrow-right"></u-icon>
  34. </view>
  35. </view>
  36. <view class="se-px-30 se-py-20 se-pt-40 se-flex se-flex-h-sb se-fs-28 se-c-black" @click="outLogin">
  37. <view class="se-flex se-flex-h-c">
  38. <!-- <image class="se-w-50 se-h-30 se-mr-40" src="@/static/image/home.png" mode=""></image> -->
  39. <text>退出登录</text>
  40. </view>
  41. <view class="">
  42. <u-icon name="arrow-right"></u-icon>
  43. </view>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. export default{
  49. data(){
  50. return{
  51. }
  52. },
  53. methods:{
  54. onCache(){
  55. wx.clearStorage({
  56. success() {
  57. wx.showToast({
  58. title: "缓存已清除",
  59. icon: "none",
  60. });
  61. },
  62. fail() {
  63. wx.showToast({
  64. title: "清除失败",
  65. icon: "none",
  66. });
  67. },
  68. });
  69. },
  70. checkUpdate() {
  71. if (wx.getUpdateManager) {
  72. const updateManager = wx.getUpdateManager();
  73. // 监听是否有新版本
  74. updateManager.onCheckForUpdate((res) => {
  75. console.log("是否有新版本:", res.hasUpdate);
  76. if(!res.hasUpdate){
  77. uni.showToast({
  78. icon: "none",
  79. title: "暂无新版本"
  80. })
  81. }
  82. });
  83. // 监听新版本下载完成
  84. updateManager.onUpdateReady(() => {
  85. wx.showModal({
  86. title: "更新提示",
  87. content: "新版本已经准备好,是否重启应用?",
  88. success: (res) => {
  89. if (res.confirm) {
  90. updateManager.applyUpdate(); // 强制应用新版本
  91. }
  92. },
  93. });
  94. });
  95. // 监听更新失败
  96. updateManager.onUpdateFailed(() => {
  97. wx.showModal({
  98. title: "更新失败",
  99. content: "请删除小程序后重新打开。",
  100. });
  101. });
  102. } else {
  103. console.log("当前基础库版本不支持更新管理");
  104. }
  105. },
  106. outLogin(){
  107. uni.removeStorageSync("token")
  108. uni.removeStorageSync("company")
  109. uni.removeStorageSync("boss")
  110. uni.removeStorageSync("worker")
  111. uni.removeStorageSync("userInfo")
  112. uni.removeStorageSync("sysList")
  113. uni.redirectTo({
  114. url:"/pages/auth/index"
  115. })
  116. }
  117. }
  118. }
  119. </script>
  120. <style>
  121. </style>