setting.vue 5.6 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. <!-- TODO 芋艿:统一的配置界面 -->
  30. <uni-list-item
  31. title="关于我们"
  32. showArrow
  33. clickable
  34. :border="false"
  35. class="list-border"
  36. @tap="
  37. sheep.$router.go('/pages/public/richtext', {
  38. id: appInfo.about_us.id,
  39. title: appInfo.about_us.title,
  40. })
  41. "
  42. />
  43. <!-- 为了过审 只有 iOS-App 有注销账号功能 -->
  44. <uni-list-item
  45. v-if="isLogin && sheep.$platform.os === 'ios' && sheep.$platform.name === 'App'"
  46. title="注销账号"
  47. rightText=""
  48. showArrow
  49. clickable
  50. :border="false"
  51. class="list-border"
  52. @click="onLogoff"
  53. />
  54. </uni-list>
  55. </view>
  56. <!-- TODO 芋艿:统一的配置界面 -->
  57. <view class="set-footer ss-flex-col ss-row-center ss-col-center">
  58. <view class="agreement-box ss-flex ss-col-center ss-m-b-40">
  59. <view class="ss-flex ss-col-center ss-m-b-10">
  60. <view
  61. class="tcp-text"
  62. @tap="
  63. sheep.$router.go('/pages/public/richtext', {
  64. id: appInfo.user_protocol.id,
  65. title: appInfo.user_protocol.title,
  66. })
  67. "
  68. >
  69. 《{{ appInfo.user_protocol.title }}》
  70. </view>
  71. <view class="agreement-text">与</view>
  72. <view
  73. class="tcp-text"
  74. @tap="
  75. sheep.$router.go('/pages/public/richtext', {
  76. id: appInfo.privacy_protocol.id,
  77. title: appInfo.privacy_protocol.title,
  78. })
  79. "
  80. >
  81. 《{{ appInfo.privacy_protocol.title }}》
  82. </view>
  83. </view>
  84. </view>
  85. <view class="copyright-text ss-m-b-10">{{ appInfo.copyright }}</view>
  86. <view class="copyright-text">{{ appInfo.copytime }}</view>
  87. </view>
  88. <su-fixed bottom placeholder>
  89. <view class="ss-p-x-20 ss-p-b-40">
  90. <button
  91. class="loginout-btn ss-reset-button ui-BG-Main ui-Shadow-Main"
  92. @tap="onLogout"
  93. v-if="isLogin"
  94. >
  95. 退出登录
  96. </button>
  97. </view>
  98. </su-fixed>
  99. </s-layout>
  100. </template>
  101. <script setup>
  102. import sheep from '@/sheep';
  103. import { computed, reactive } from 'vue';
  104. const appInfo = computed(() => sheep.$store('app').info);
  105. const isLogin = computed(() => sheep.$store('user').isLogin);
  106. const storageSize = uni.getStorageInfoSync().currentSize + 'Kb';
  107. const state = reactive({
  108. showModal: false,
  109. });
  110. function onCheckUpdate() {
  111. sheep.$platform.checkUpdate();
  112. // 小程序初始化时已检查更新
  113. // H5实时更新无需检查
  114. // App 1.跳转应用市场更新 2.手动热更新 3.整包更新
  115. }
  116. // 注销账号
  117. function onLogoff() {
  118. uni.showModal({
  119. title: '提示',
  120. content: '确认注销账号?',
  121. success: async function (res) {
  122. if (!res.confirm) {
  123. return;
  124. }
  125. const result = await sheep.$store('user').logout();
  126. if (result) {
  127. sheep.$router.go('/pages/index/user');
  128. }
  129. },
  130. });
  131. }
  132. // 退出账号
  133. function onLogout() {
  134. uni.showModal({
  135. title: '提示',
  136. content: '确认退出账号?',
  137. success: async function (res) {
  138. if (!res.confirm) {
  139. return;
  140. }
  141. const result = await sheep.$store('user').logout();
  142. if (result) {
  143. sheep.$router.go('/pages/index/user');
  144. }
  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>