reset.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. <template>
  2. <cwg-page-wrapper :isLoginPage="true" >
  3. <view class="main-content">
  4. <view class="global-header-bar pc-header">
  5. <view class="header-inner">
  6. <view class="logo-placeholder"></view> <!-- 左侧可预留放logo或留空 -->
  7. <!-- 这里由于没有深色背景,传递深色文字颜色 -->
  8. <LoginHeaderGroup text-color="#fff" :icon-color="isDark ? '#fff' : '#97A1C0' " />
  9. </view>
  10. </view>
  11. <view class="reset-container">
  12. <view class="company u-flex-y u-flex-y-center">
  13. <image v-if="!isDark" src="/static/images/vu/logo-full.svg" class="company-icon" mode="widthFix"></image>
  14. <image v-else src="/static/images/vu/logo-full-white.svg" class="company-icon" mode="widthFix"></image>
  15. </view>
  16. <uni-row class="content">
  17. <uni-col :span="20" :offset="2" :lg="{ span: 10, offset: 7 }">
  18. <view class="reset-title">{{ t('forget.title') }}</view>
  19. <view class="reset-form">
  20. <view class="form-label">{{ t('forget.form') }}</view>
  21. <uni-easyinput v-model="email" :placeholder="t('newSignup.item7')" class="custom-input">
  22. </uni-easyinput>
  23. <view class="reset-button">
  24. <button class="btn btn-danger" @click="handleReset">{{ t('forget.forget') }}</button>
  25. </view>
  26. <view class="login-link">
  27. <button @click="handleLogin" class="link-text">{{ t('forget.cancel') }}</button>
  28. </view>
  29. </view>
  30. </uni-col>
  31. </uni-row>
  32. </view>
  33. <!-- <view class="chat-icon" :class="{ 'chat-icon-expanded': isChatIconExpanded, 'chat-icon-hidden': type == 'chat' }"-->
  34. <!-- @click="handleChatIconClick">-->
  35. <!-- <cwg-icon name="chat" color="#fff" />-->
  36. <!-- </view>-->
  37. </view>
  38. </cwg-page-wrapper>
  39. </template>
  40. <script setup lang="ts">
  41. import { ref, computed } from 'vue'
  42. import { useI18n } from 'vue-i18n'
  43. import useRouter from '@/hooks/useRouter'
  44. import { userApi } from '@/api/user'
  45. import config from '@/config'
  46. import LoginHeaderGroup from './components/LoginHeaderGroup.vue'
  47. import { useWindowWidth } from '@/composables/useWindowWidth'
  48. import LiveChatService from '@/utils/liveChat.js'
  49. import useGlobalStore from '@/stores/use-global-store'
  50. const windowWidth = useWindowWidth(300)
  51. const isMobile = computed(() => windowWidth.value <= 991)
  52. const { t } = useI18n()
  53. const router = useRouter()
  54. const loading = ref(false)
  55. const email = ref('')
  56. const globalStore = useGlobalStore()
  57. const isDark = computed(() => globalStore.theme === 'dark')
  58. async function handleReset() {
  59. if (!email.value) {
  60. uni.showToast({ title: t('vaildate.email.empty'), icon: 'none' })
  61. return
  62. }
  63. if (!config.Pattern.Email.test(email.value)) {
  64. uni.showToast({ title: t('vaildate.email.format'), icon: 'none' })
  65. return
  66. }
  67. loading.value = true
  68. try {
  69. const res = await userApi.forgetPwd({ email: email.value })
  70. uni.showToast({ title: res.msg, icon: 'success' })
  71. setTimeout(() => {
  72. router.push('/pages/login/index')
  73. }, 1000)
  74. } catch (error: any) {
  75. uni.showToast({ title: error.message, icon: 'none' })
  76. } finally {
  77. loading.value = false
  78. }
  79. }
  80. const isChatIconExpanded = ref(false)
  81. // 处理聊天图标点击
  82. const handleChatIconClick = () => {
  83. // 如果还没显示 → 先滑出来
  84. if (!isChatIconExpanded.value) {
  85. isChatIconExpanded.value = true
  86. return
  87. }
  88. if (isMobile.value) {
  89. router.push('/pages/common/chat')
  90. } else {
  91. if (LiveChatService) {
  92. LiveChatService.showChat();
  93. }
  94. }
  95. setTimeout(() => {
  96. isChatIconExpanded.value = false
  97. }, 300)
  98. }
  99. function handleChange(value: any) {
  100. if (value.key == 'email') {
  101. email.value = value.value
  102. }
  103. }
  104. function handleLogin() {
  105. router.push('/pages/login/index')
  106. }
  107. </script>
  108. <style scoped lang="scss">
  109. @import "@/uni.scss";
  110. .company {
  111. margin-bottom: px2rpx(24);
  112. }
  113. .chat-icon {
  114. width: px2rpx(50);
  115. height: px2rpx(50);
  116. border-radius: 50%;
  117. background-color: #cf1322;
  118. display: flex;
  119. align-items: center;
  120. justify-content: center;
  121. position: fixed;
  122. bottom: px2rpx(25);
  123. right: px2rpx(0);
  124. z-index: 999;
  125. cursor: pointer;
  126. transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  127. box-shadow: 0 px2rpx(8) px2rpx(20) rgba(0, 0, 0, 0.15);
  128. will-change: transform;
  129. }
  130. .chat-icon:hover {
  131. transform: scale(1.1);
  132. }
  133. .chat-icon-expanded {
  134. bottom: px2rpx(20);
  135. right: px2rpx(20);
  136. transform: scale(1.1);
  137. box-shadow: 0 px2rpx(12) px2rpx(30) rgba(0, 0, 0, 0.2);
  138. }
  139. .chat-icon-hidden {
  140. display: none;
  141. }
  142. :deep(uni-content) {
  143. padding-left: 0 !important;
  144. }
  145. .main-content {
  146. display: flex;
  147. flex-direction: column;
  148. }
  149. .global-header-bar {
  150. width: 100%;
  151. height: px2rpx(60);
  152. display: flex;
  153. align-items: center;
  154. justify-content: center;
  155. flex-shrink: 0;
  156. z-index: 100;
  157. &.pc-header {
  158. background-color: transparent;
  159. border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  160. }
  161. .header-inner {
  162. width: 100%;
  163. padding: 0 5%;
  164. display: flex;
  165. justify-content: space-between;
  166. /* 两端对齐,可放logo和组件 */
  167. align-items: center;
  168. }
  169. }
  170. .mobile-header-bar {
  171. position: absolute;
  172. top: px2rpx(20);
  173. right: px2rpx(20);
  174. z-index: 10;
  175. }
  176. .reset-container {
  177. margin-top: px2rpx(20);
  178. display: flex;
  179. flex-direction: column;
  180. align-items: center;
  181. justify-content: center;
  182. }
  183. .content {
  184. width: 100%;
  185. margin: 0 auto;
  186. }
  187. .reset-title {
  188. font-size: px2rpx(28);
  189. font-weight: bold;
  190. color: var(--bs-emphasis-color);
  191. margin-bottom: px2rpx(40);
  192. width: 100%;
  193. text-align: center;
  194. }
  195. .reset-form {
  196. width: 100%;
  197. }
  198. .form-label {
  199. font-size: px2rpx(16);
  200. color: var(--bs-heading-color);
  201. margin-bottom: px2rpx(8);
  202. }
  203. .custom-input {
  204. margin-bottom: px2rpx(40);
  205. :deep(.uni-easyinput__content) {
  206. height: px2rpx(40);
  207. border: 1px solid #dcdfe6;
  208. border-radius: px2rpx(4);
  209. }
  210. }
  211. .reset-button {
  212. margin-bottom: px2rpx(20);
  213. :deep(button) {
  214. width: 100%;
  215. height: px2rpx(44);
  216. line-height: px2rpx(44);
  217. border-radius: px2rpx(8);
  218. background-color: var(--bs-btn-bg);
  219. border: none;
  220. display: flex;
  221. align-items: center;
  222. justify-content: center;
  223. color: #fff;
  224. font-size: px2rpx(16);
  225. font-weight: 500;
  226. margin: 0;
  227. &::after {
  228. border: none;
  229. }
  230. }
  231. }
  232. .login-link {
  233. text-align: center;
  234. .link-text {
  235. width: 100%;
  236. height: px2rpx(44);
  237. line-height: px2rpx(44);
  238. border-radius: px2rpx(8);
  239. background-color: transparent;
  240. border: 1px solid #e4e4e4;
  241. color: var(--bs-heading-color);
  242. font-size: px2rpx(16);
  243. font-weight: 500;
  244. margin: 0;
  245. &::after {
  246. border: none;
  247. }
  248. }
  249. }
  250. </style>