setting.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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. <!-- TODO 芋艿:统一的配置界面 -->
  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. title: '用户协议'
  63. })
  64. "
  65. >
  66. 《用户协议》
  67. </view>
  68. <view class="agreement-text">与</view>
  69. <view
  70. class="tcp-text"
  71. @tap="
  72. sheep.$router.go('/pages/public/richtext', {
  73. title: '隐私协议'
  74. })
  75. "
  76. >
  77. 《隐私协议》
  78. </view>
  79. </view>
  80. </view>
  81. <view class="copyright-text ss-m-b-10">{{ appInfo.copyright }}</view>
  82. <view class="copyright-text">{{ appInfo.copytime }}</view>
  83. </view>
  84. <su-fixed bottom placeholder>
  85. <view class="ss-p-x-20 ss-p-b-40">
  86. <button
  87. class="loginout-btn ss-reset-button ui-BG-Main ui-Shadow-Main"
  88. @tap="onLogout"
  89. v-if="isLogin"
  90. >
  91. 退出登录
  92. </button>
  93. </view>
  94. </su-fixed>
  95. </s-layout>
  96. </template>
  97. <script setup>
  98. import sheep from '@/sheep';
  99. import { computed, reactive } from 'vue';
  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 result = await sheep.$store('user').logout();
  122. if (result) {
  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. return;
  136. }
  137. const result = await sheep.$store('user').logout();
  138. if (result) {
  139. sheep.$router.go('/pages/index/user');
  140. }
  141. },
  142. });
  143. }
  144. </script>
  145. <style lang="scss" scoped>
  146. .container-list {
  147. width: 100%;
  148. }
  149. .set-title {
  150. margin: 0 30rpx;
  151. }
  152. .header-box {
  153. padding: 100rpx 0;
  154. .logo-img {
  155. width: 160rpx;
  156. height: 160rpx;
  157. border-radius: 50%;
  158. }
  159. .name {
  160. font-size: 42rpx;
  161. font-weight: 400;
  162. color: $dark-3;
  163. }
  164. .version {
  165. font-size: 32rpx;
  166. font-weight: 500;
  167. line-height: 32rpx;
  168. color: $gray-b;
  169. }
  170. }
  171. .set-footer {
  172. margin: 100rpx 0 0 0;
  173. .copyright-text {
  174. font-size: 22rpx;
  175. font-weight: 500;
  176. color: $gray-c;
  177. line-height: 30rpx;
  178. }
  179. .agreement-box {
  180. font-size: 26rpx;
  181. font-weight: 500;
  182. .tcp-text {
  183. color: var(--ui-BG-Main);
  184. }
  185. .agreement-text {
  186. color: $dark-9;
  187. }
  188. }
  189. }
  190. .loginout-btn {
  191. width: 100%;
  192. height: 80rpx;
  193. border-radius: 40rpx;
  194. font-size: 30rpx;
  195. }
  196. .list-border {
  197. font-size: 28rpx;
  198. font-weight: 400;
  199. color: #333333;
  200. border-bottom: 2rpx solid #eeeeee;
  201. }
  202. :deep(.uni-list-item__content-title) {
  203. font-size: 28rpx;
  204. font-weight: 500;
  205. color: #333;
  206. }
  207. :deep(.uni-list-item__extra-text) {
  208. color: #bbbbbb;
  209. font-size: 28rpx;
  210. }
  211. </style>