contact.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. <template>
  2. <view class="ct-page">
  3. <view class="ct-nav" :style="{ paddingTop: statusBar + 'px' }">
  4. <view class="ct-nav-row">
  5. <view class="ct-back" @tap="goBack">
  6. <text class="ct-back-icon">←</text>
  7. </view>
  8. <text class="ct-nav-title">{{ copy.title }}</text>
  9. <view class="ct-nav-placeholder" />
  10. </view>
  11. </view>
  12. <scroll-view
  13. scroll-y
  14. class="ct-scroll"
  15. :style="{ height: scrollHeight + 'px' }"
  16. >
  17. <view class="ct-body" :style="{ paddingBottom: safeBottom + 'px' }">
  18. <view class="ct-hero">
  19. <view class="ct-hero-icon-wrap">
  20. <text class="ct-hero-icon">✉</text>
  21. </view>
  22. <text class="ct-hero-title">{{ copy.title }}</text>
  23. <text class="ct-hero-desc">{{ copy.desc }}</text>
  24. </view>
  25. <view v-if="loading" class="ct-state-card">
  26. <text class="ct-state-text">{{ copy.loading }}</text>
  27. </view>
  28. <view v-else-if="!email" class="ct-state-card">
  29. <text class="ct-state-icon">—</text>
  30. <text class="ct-state-text">{{ copy.empty }}</text>
  31. </view>
  32. <view
  33. v-else
  34. class="ct-email-card"
  35. hover-class="ct-email-card--press"
  36. @tap="copyEmail"
  37. >
  38. <view class="ct-email-head">
  39. <text class="ct-email-label">{{ copy.emailLabel }}</text>
  40. <view class="ct-copy-pill" @tap.stop="copyEmail">
  41. <text class="ct-copy-pill-text">{{ copy.copyBtn }}</text>
  42. </view>
  43. </view>
  44. <text class="ct-email-value">{{ email }}</text>
  45. <text class="ct-email-hint">{{ copy.tapCopy }}</text>
  46. </view>
  47. </view>
  48. </scroll-view>
  49. </view>
  50. </template>
  51. <script>
  52. import { fetchAppBrand } from '@/features/shell/app-config-gateway'
  53. import { copyText } from '@/core/storage/clipboard-copy'
  54. export default {
  55. data() {
  56. return {
  57. statusBar: 0,
  58. scrollHeight: 600,
  59. safeBottom: 0,
  60. loading: false,
  61. email: ''
  62. }
  63. },
  64. computed: {
  65. copy() {
  66. const t = this.$t.bind(this)
  67. return {
  68. title: t('about.contactTitle'),
  69. desc: t('about.contactHeroDesc'),
  70. emailLabel: t('about.contactEmailLabel'),
  71. copyBtn: t('about.contactCopy'),
  72. tapCopy: t('about.contactTapCopy'),
  73. empty: t('about.contactEmpty'),
  74. loading: t('about.contactLoading'),
  75. network: t('user.realnameNetworkError')
  76. }
  77. }
  78. },
  79. onLoad() {
  80. const sys = uni.getSystemInfoSync()
  81. this.statusBar = sys.statusBarHeight || 0
  82. this.safeBottom = sys.safeAreaInsets ? sys.safeAreaInsets.bottom : 0
  83. const navH = this.statusBar + uni.upx2px(88)
  84. this.scrollHeight = (sys.windowHeight || 667) - navH
  85. this.loadContact()
  86. },
  87. methods: {
  88. goBack() {
  89. if (getCurrentPages().length > 1) {
  90. uni.navigateBack({ delta: 1 })
  91. } else {
  92. uni.navigateTo({
  93. url: '/pages/account/about',
  94. fail: () => uni.reLaunch({ url: '/pages/mine/index' })
  95. })
  96. }
  97. },
  98. async loadContact() {
  99. if (this.loading) return
  100. this.loading = true
  101. try {
  102. const brand = await fetchAppBrand()
  103. this.email = brand.email || ''
  104. } catch (_) {
  105. this.email = ''
  106. this.$appKit && this.$appKit.msg(this.copy.network)
  107. } finally {
  108. this.loading = false
  109. }
  110. },
  111. copyEmail() {
  112. if (!this.email) return
  113. copyText(this.email, true, this.$i18n)
  114. }
  115. }
  116. }
  117. </script>
  118. <style scoped>
  119. .ct-page {
  120. min-height: 100vh;
  121. background-color: #f4f6fb;
  122. }
  123. .ct-nav {
  124. background-color: #ffffff;
  125. border-bottom: 1rpx solid #eef1f6;
  126. }
  127. .ct-nav-row {
  128. display: flex;
  129. flex-direction: row;
  130. align-items: center;
  131. height: 88rpx;
  132. padding: 0 24rpx;
  133. box-sizing: border-box;
  134. }
  135. .ct-back {
  136. width: 64rpx;
  137. height: 64rpx;
  138. display: flex;
  139. align-items: center;
  140. justify-content: center;
  141. }
  142. .ct-back-icon {
  143. font-size: 40rpx;
  144. color: #1a1d26;
  145. line-height: 1;
  146. }
  147. .ct-nav-title {
  148. flex: 1;
  149. text-align: center;
  150. font-size: 32rpx;
  151. font-weight: 600;
  152. color: #1a1d26;
  153. }
  154. .ct-nav-placeholder {
  155. width: 64rpx;
  156. }
  157. .ct-body {
  158. padding: 24rpx 28rpx 40rpx;
  159. box-sizing: border-box;
  160. }
  161. .ct-hero {
  162. display: flex;
  163. flex-direction: column;
  164. align-items: center;
  165. padding: 32rpx 24rpx 40rpx;
  166. }
  167. .ct-hero-icon-wrap {
  168. width: 120rpx;
  169. height: 120rpx;
  170. border-radius: 32rpx;
  171. background: linear-gradient(145deg, #eef4ff 0%, #e8f0fe 100%);
  172. box-shadow: 0 12rpx 36rpx rgba(74, 140, 255, 0.14);
  173. display: flex;
  174. align-items: center;
  175. justify-content: center;
  176. margin-bottom: 24rpx;
  177. }
  178. .ct-hero-icon {
  179. font-size: 52rpx;
  180. line-height: 1;
  181. }
  182. .ct-hero-title {
  183. font-size: 36rpx;
  184. font-weight: 700;
  185. color: #1a1d26;
  186. margin-bottom: 12rpx;
  187. }
  188. .ct-hero-desc {
  189. font-size: 26rpx;
  190. color: #8a8d9e;
  191. line-height: 1.6;
  192. text-align: center;
  193. max-width: 560rpx;
  194. }
  195. .ct-state-card,
  196. .ct-email-card {
  197. background-color: #ffffff;
  198. border-radius: 24rpx;
  199. box-shadow: 0 6rpx 24rpx rgba(74, 140, 255, 0.06);
  200. padding: 32rpx 28rpx;
  201. box-sizing: border-box;
  202. }
  203. .ct-state-card {
  204. display: flex;
  205. flex-direction: column;
  206. align-items: center;
  207. justify-content: center;
  208. min-height: 200rpx;
  209. }
  210. .ct-state-icon {
  211. font-size: 40rpx;
  212. color: #c5cad6;
  213. margin-bottom: 16rpx;
  214. line-height: 1;
  215. }
  216. .ct-state-text {
  217. font-size: 28rpx;
  218. color: #8a8d9e;
  219. text-align: center;
  220. line-height: 1.5;
  221. }
  222. .ct-email-card--press {
  223. background-color: #f7f9fc;
  224. }
  225. .ct-email-head {
  226. display: flex;
  227. flex-direction: row;
  228. align-items: center;
  229. justify-content: space-between;
  230. margin-bottom: 20rpx;
  231. }
  232. .ct-email-label {
  233. font-size: 26rpx;
  234. color: #8a8d9e;
  235. }
  236. .ct-copy-pill {
  237. padding: 10rpx 24rpx;
  238. border-radius: 999rpx;
  239. background-color: rgba(74, 140, 255, 0.1);
  240. border: 1rpx solid rgba(74, 140, 255, 0.22);
  241. }
  242. .ct-copy-pill-text {
  243. font-size: 24rpx;
  244. color: #4a8cff;
  245. font-weight: 600;
  246. line-height: 1.2;
  247. }
  248. .ct-email-value {
  249. display: block;
  250. font-size: 32rpx;
  251. font-weight: 600;
  252. color: #4a8cff;
  253. line-height: 1.5;
  254. word-break: break-all;
  255. }
  256. .ct-email-hint {
  257. display: block;
  258. margin-top: 16rpx;
  259. font-size: 24rpx;
  260. color: #b0b4c0;
  261. line-height: 1.4;
  262. }
  263. </style>