setting.vue 5.5 KB

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