setting.vue 5.7 KB

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