You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

238 lines
4.6 KiB

4 months ago
  1. <template>
  2. <view class="content">
  3. <view class="padding">
  4. <view class="logoCon">
  5. <view class="logo">
  6. <image src="@/static/images/logo.png" mode=""></image>
  7. </view>
  8. <view class="name">事务通</view>
  9. </view>
  10. <view class="from">
  11. <view class="formItem flex">
  12. <view class="prefix">+86</view>
  13. <view class="line"></view>
  14. <view class="inputBox">
  15. <up-input v-model="FormData.phone" border="none" placeholder="请输入手机号"></up-input>
  16. </view>
  17. </view>
  18. <view class="formItem flex">
  19. <view class="inputBox">
  20. <up-input v-model="FormData.code" border="none" placeholder="输入验证码"></up-input>
  21. </view>
  22. <view class="sedCode" @click="goSms">{{codeText}}</view>
  23. </view>
  24. <view class="oneBtnBox" :class="{isActive: btnHighlight}">
  25. <oneBtn text="登 录" @click="submitFn" ></oneBtn>
  26. </view>
  27. </view>
  28. <privacyRadion style="margin-top: 40rpx;" :isCheck="isCheck" @changeRadio="changeRadio"/>
  29. <view class="other">
  30. <view class="lineTxt">其它登录方式</view>
  31. <view class="icon" @click="$goPage('/pages/subPage/login/loginwx')">
  32. <image src="@/static/images/loginicon.png" mode=""></image>
  33. </view>
  34. <view class="txt">快捷登录</view>
  35. </view>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. import { getLoginCode } from '@/config/api.js'
  41. export default {
  42. data() {
  43. return {
  44. FormData: {
  45. phone: '',
  46. code: ''
  47. },
  48. codeText: '获取验证码',
  49. codeOn: false,
  50. isCheck: false
  51. }
  52. },
  53. computed: {
  54. isPhone() {
  55. return uni.$u.test.mobile(this.FormData.phone)
  56. },
  57. btnHighlight() {
  58. return this.isPhone&&this.FormData.code*1>999
  59. }
  60. },
  61. methods: {
  62. // 是否选择协议
  63. changeRadio(val) {
  64. uni.hideKeyboard();
  65. this.isCheck = val
  66. },
  67. getLoginCodeFn() {
  68. getLoginCode
  69. },
  70. // 发送短信验证码
  71. goSms() {
  72. uni.hideKeyboard();
  73. const {
  74. FormData
  75. } = this
  76. if (!FormData.phone) return this.$u.toast('请输入手机号');
  77. if (!this.isPhone) return this.$u.toast('手机号格式有误');
  78. if (this.codeOn) return
  79. this.codeOn = true;
  80. getLoginCode({
  81. scene: 1,
  82. mobile: FormData.phone,
  83. }).then(()=>{
  84. var time = 60;
  85. this.codeText = time + "秒后重新发送"
  86. var timer = setInterval(() => {
  87. time--;
  88. this.codeText = time + "秒后重新发送"
  89. if (time == 0) {
  90. clearInterval(timer);
  91. this.codeText = "获取验证码";
  92. this.codeOn = false;
  93. }
  94. }, 1000);
  95. }).catch(()=>{
  96. this.codeOn = false;
  97. })
  98. // 获取验证码
  99. },
  100. // 提交代码
  101. async submitFn() {
  102. uni.hideKeyboard();
  103. if(!this.btnHighlight) return
  104. if(!this.isCheck) return this.$u.toast('请勾选产品协议与隐私政策');
  105. let obj = {
  106. mobile: this.FormData.phone,
  107. code: this.FormData.code
  108. }
  109. const res = await loginSMS(obj)
  110. // await this.$store.dispatch('getUserInfo')
  111. uni.switchTab({
  112. url: '/pages/tabbar/index/index'
  113. })
  114. }
  115. }
  116. }
  117. </script>
  118. <style lang="scss" scoped>
  119. image {
  120. display: block;
  121. width: 100%;
  122. height: 100%;
  123. }
  124. .other {
  125. display: flex;
  126. flex-direction: column;
  127. align-items: center;
  128. justify-content: center;
  129. font-size: 22rpx;
  130. color: #9C9C9C;
  131. position: fixed;
  132. bottom: 80rpx;
  133. left: 0;
  134. width: 100%;
  135. .lineTxt {
  136. position: relative;
  137. &::before {
  138. content: '';
  139. position: absolute;
  140. width: 240rpx;
  141. height: 1rpx;
  142. top: 50%;
  143. background: #e6e6e6;
  144. right: 150rpx;
  145. transform: translateY(50%);
  146. z-index: 99;
  147. }
  148. &::after {
  149. content: '';
  150. position: absolute;
  151. width: 240rpx;
  152. height: 1rpx;
  153. top: 50%;
  154. background: #e6e6e6;
  155. left: 150rpx;
  156. transform: translateY(50%);
  157. z-index: 99;
  158. }
  159. }
  160. .icon {
  161. width: 80rpx;
  162. height: 80rpx;
  163. margin: 20rpx 0;
  164. }
  165. .txt {
  166. }
  167. }
  168. .content {
  169. .logoCon {
  170. display: flex;
  171. flex-direction: column;
  172. align-items: center;
  173. justify-content: center;
  174. padding-top: 50rpx;
  175. .logo {
  176. width: 160rpx;
  177. height: 160rpx;
  178. }
  179. .name {
  180. font-size: 32rpx;
  181. margin-top: 20rpx;
  182. font-weight: 700;
  183. }
  184. }
  185. .from {
  186. margin-top: 20rpx;
  187. .formItem {
  188. height: 108rpx;
  189. border-bottom: 1px solid #EFEFEF;
  190. .prefix {
  191. font-size: 28rpx;
  192. color: #333;
  193. width: 120rpx;
  194. text-align: center;
  195. }
  196. .line {
  197. width: 1px;
  198. height: 40rpx;
  199. background: #EFEFEF;
  200. margin-right: 30rpx;
  201. }
  202. .inputBox {
  203. flex: 1;
  204. width: 0;
  205. }
  206. .sedCode {
  207. font-size: 28rpx;
  208. color: $themC;
  209. }
  210. }
  211. .oneBtnBox {
  212. margin-top: 40rpx;
  213. opacity: 0.4;
  214. &.isActive {
  215. opacity: 1;
  216. }
  217. }
  218. }
  219. }
  220. </style>