setting.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. <template>
  2. <s-layout class="set-wrap" title="系统设置" :bgStyle="{ color: '#fff' }">
  3. <view class="header-box ss-flex-col ss-row-center ss-col-center">
  4. <image
  5. class="logo-img ss-m-b-46"
  6. :src="sheep.$url.cdn(appInfo.logo)"
  7. mode="aspectFit"
  8. ></image>
  9. <view class="name ss-m-b-24">{{ appInfo.name }}</view>
  10. </view>
  11. <view class="container-list">
  12. <uni-list :border="false">
  13. <uni-list-item
  14. title="当前版本"
  15. :rightText="appInfo.version"
  16. showArrow
  17. clickable
  18. :border="false"
  19. class="list-border"
  20. @tap="onCheckUpdate"
  21. />
  22. <uni-list-item
  23. title="本地缓存"
  24. :rightText="storageSize"
  25. showArrow
  26. :border="false"
  27. class="list-border"
  28. />
  29. <uni-list-item
  30. title="关于我们"
  31. showArrow
  32. clickable
  33. :border="false"
  34. class="list-border"
  35. @tap="
  36. sheep.$router.go('/pages/public/richtext', {
  37. title: '关于我们'
  38. })
  39. "
  40. />
  41. <!-- 为了过审 只有 iOS-App 有注销账号功能 -->
  42. <uni-list-item
  43. v-if="isLogin && sheep.$platform.os === 'ios' && sheep.$platform.name === 'App'"
  44. title="注销账号"
  45. rightText=""
  46. showArrow
  47. clickable
  48. :border="false"
  49. class="list-border"
  50. @click="onLogoff"
  51. />
  52. </uni-list>
  53. </view>
  54. <view class="set-footer ss-flex-col ss-row-center ss-col-center">
  55. <view class="agreement-box ss-flex ss-col-center ss-m-b-40">
  56. <view class="ss-flex ss-col-center ss-m-b-10">
  57. <view
  58. class="tcp-text"
  59. @tap="
  60. sheep.$router.go('/pages/public/richtext', {
  61. title: '用户协议'
  62. })
  63. "
  64. >
  65. 《用户协议》
  66. </view>
  67. <view class="agreement-text">与</view>
  68. <view
  69. class="tcp-text"
  70. @tap="
  71. sheep.$router.go('/pages/public/richtext', {
  72. title: '隐私协议'
  73. })
  74. "
  75. >
  76. 《隐私协议》
  77. </view>
  78. </view>
  79. </view>
  80. <view class="copyright-text ss-m-b-10">{{ appInfo.copyright }}</view>
  81. <view class="copyright-text">{{ appInfo.copytime }}</view>
  82. </view>
  83. <su-fixed bottom placeholder>
  84. <view class="ss-p-x-20 ss-p-b-40">
  85. <button
  86. class="loginout-btn ss-reset-button ui-BG-Main ui-Shadow-Main"
  87. @tap="onLogout"
  88. v-if="isLogin"
  89. >
  90. 退出登录
  91. </button>
  92. </view>
  93. </su-fixed>
  94. </s-layout>
  95. </template>
  96. <script setup>
  97. import sheep from '@/sheep';
  98. import { computed, reactive } from 'vue';
  99. import AuthUtil from '@/sheep/api/member/auth';
  100. const appInfo = computed(() => sheep.$store('app').info);
  101. const isLogin = computed(() => sheep.$store('user').isLogin);
  102. const storageSize = uni.getStorageInfoSync().currentSize + 'Kb';
  103. const state = reactive({
  104. showModal: false,
  105. });
  106. function onCheckUpdate() {
  107. sheep.$platform.checkUpdate();
  108. // 小程序初始化时已检查更新
  109. // H5实时更新无需检查
  110. // App 1.跳转应用市场更新 2.手动热更新 3.整包更新
  111. }
  112. // 注销账号
  113. function onLogoff() {
  114. uni.showModal({
  115. title: '提示',
  116. content: '确认注销账号?',
  117. success: async function (res) {
  118. if (!res.confirm) {
  119. return;
  120. }
  121. const { code } = await AuthUtil.logout();
  122. if (code !== 0) {
  123. return;
  124. }
  125. sheep.$store('user').logout();
  126. sheep.$router.go('/pages/index/user');
  127. },
  128. });
  129. }
  130. // 退出账号
  131. function onLogout() {
  132. uni.showModal({
  133. title: '提示',
  134. content: '确认退出账号?',
  135. success: async function (res) {
  136. if (!res.confirm) {
  137. return;
  138. }
  139. const { code } = await AuthUtil.logout();
  140. if (code !== 0) {
  141. return;
  142. }
  143. sheep.$store('user').logout();
  144. sheep.$router.go('/pages/index/user');
  145. },
  146. });
  147. }
  148. </script>
  149. <style lang="scss" scoped>
  150. .container-list {
  151. width: 100%;
  152. }
  153. .set-title {
  154. margin: 0 30rpx;
  155. }
  156. .header-box {
  157. padding: 100rpx 0;
  158. .logo-img {
  159. width: 160rpx;
  160. height: 160rpx;
  161. border-radius: 50%;
  162. }
  163. .name {
  164. font-size: 42rpx;
  165. font-weight: 400;
  166. color: $dark-3;
  167. }
  168. .version {
  169. font-size: 32rpx;
  170. font-weight: 500;
  171. line-height: 32rpx;
  172. color: $gray-b;
  173. }
  174. }
  175. .set-footer {
  176. margin: 100rpx 0 0 0;
  177. .copyright-text {
  178. font-size: 22rpx;
  179. font-weight: 500;
  180. color: $gray-c;
  181. line-height: 30rpx;
  182. }
  183. .agreement-box {
  184. font-size: 26rpx;
  185. font-weight: 500;
  186. .tcp-text {
  187. color: var(--ui-BG-Main);
  188. }
  189. .agreement-text {
  190. color: $dark-9;
  191. }
  192. }
  193. }
  194. .loginout-btn {
  195. width: 100%;
  196. height: 80rpx;
  197. border-radius: 40rpx;
  198. font-size: 30rpx;
  199. }
  200. .list-border {
  201. font-size: 28rpx;
  202. font-weight: 400;
  203. color: #333333;
  204. border-bottom: 2rpx solid #eeeeee;
  205. }
  206. :deep(.uni-list-item__content-title) {
  207. font-size: 28rpx;
  208. font-weight: 500;
  209. color: #333;
  210. }
  211. :deep(.uni-list-item__extra-text) {
  212. color: #bbbbbb;
  213. font-size: 28rpx;
  214. }
  215. </style>