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.

222 lines
5.7 KiB

8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
  1. <template>
  2. <view class="main" :style="{ background: `url(${imgUrl}) no-repeat`, backgroundSize: backgroundSize }">
  3. <!-- <view class="u-back-top">
  4. <view class="backBox">
  5. <u-icon name="arrow-left" color="#333" size="28"></u-icon>
  6. </view>
  7. </view> -->
  8. <u-navbar title=" " :bgColor="bgColor" :autoBack="true" ></u-navbar>
  9. <view class="title">教练端短信验证码登录</view>
  10. <view class="form">
  11. <view class="form-item">
  12. <view class="prefix">
  13. <view class="jia">+</view>
  14. <view class="num">86</view>
  15. <view class="" style="margin: 0 32rpx 0 12rpx;">
  16. <u-icon name="arrow-down" color="#333" size="16" ></u-icon>
  17. </view>
  18. </view>
  19. <view class="inputBox my">
  20. <!-- <u--input placeholder="请输入手机号" border="none" clearable type="number" maxlength="11" v-model="FormData.phone"></u--input> -->
  21. <input v-model="FormData.phone" placeholder="请输入手机号" type="number" maxlength="11" >
  22. </view>
  23. </view>
  24. <view class="form-item">
  25. <view class="inputBox my">
  26. <!-- <u--input placeholder="请输入验证码" border="none" clearable style="height: 100%;" :clearable="false" v-model="FormData.code"></u--input> -->
  27. <input type="text" placeholder="请输入验证码" v-model="FormData.code">
  28. </view>
  29. <view class="code" @click='goSms' :class="{active: isPhone&&!codeOn}">{{codeText}}</view>
  30. </view>
  31. <view class="loginBtn" :class="{active: btnHighlight}" @click="submitFn"> </view>
  32. <view style="margin-top: 40rpx;">
  33. <privacyRadion :isCheck="isCheck" @changeRadio="changeRadio"></privacyRadion>
  34. </view>
  35. <!-- <button @click="$goPage('/pages/userCenter/login/face')">进入人脸识别</button> -->
  36. </view>
  37. <u-action-sheet :actions="list" title="请选择您要登录的角色" :show="showRole" @select="selectClick" ></u-action-sheet>
  38. </view>
  39. </template>
  40. <script>
  41. import { getLoginCode, loginSMS, coachSmsLogin } from '@/config/api.js'
  42. import privacyRadion from './comp/privacyRadion.vue'
  43. import { imgUrl } from '@/config/site.config'
  44. export default {
  45. components: {privacyRadion},
  46. data() {
  47. return {
  48. imgUrl: imgUrl+'loginTopBg.png',
  49. backgroundSize: '100% 360rpx',
  50. isCheck:false,
  51. codeText: '获取验证码',
  52. FormData: {},
  53. codeOn: false,
  54. bgColor: 'transparent',
  55. list: [{name: '实操教练', id: 3}, {name: '校长', id: 4}],
  56. showRole: false,
  57. }
  58. },
  59. onLoad(options) {
  60. },
  61. computed: {
  62. isPhone() {
  63. return uni.$u.test.mobile(this.FormData.phone)
  64. },
  65. btnHighlight() {
  66. return this.isPhone&&this.FormData.code*1>999
  67. }
  68. },
  69. methods: {
  70. // 是否选择协议
  71. changeRadio(val) {
  72. this.isCheck = val
  73. },
  74. // 发送短信验证码
  75. goSms() {
  76. const {
  77. FormData
  78. } = this
  79. if (!FormData.phone) return this.$u.toast('请输入手机号');
  80. if (!this.isPhone) return this.$u.toast('手机号格式有误');
  81. if (this.codeOn) return
  82. this.codeOn = true;
  83. getLoginCode({
  84. scene: 11,
  85. mobile: FormData.phone,
  86. }).then(()=>{
  87. var time = 60;
  88. this.codeText = time + "秒后重新发送"
  89. var timer = setInterval(() => {
  90. time--;
  91. this.codeText = time + "秒后重新发送"
  92. if (time == 0) {
  93. clearInterval(timer);
  94. this.codeText = "获取验证码";
  95. this.codeOn = false;
  96. }
  97. }, 1000);
  98. }).catch(()=>{
  99. this.codeOn = false;
  100. })
  101. // 获取验证码
  102. },
  103. async submitFn() {
  104. if(!this.btnHighlight) return
  105. if(!this.isCheck) return this.$u.toast('请勾选产品协议与隐私政策');
  106. let obj = {
  107. mobile: this.FormData.phone,
  108. code: this.FormData.code
  109. }
  110. const res = await coachSmsLogin(obj)
  111. this.$store.commit('update_vuex_loginInfo',res.data)
  112. await this.$store.dispatch('getUserInfo')
  113. if(res.userType==5) {
  114. this.showRole = true
  115. }else {
  116. if(res.userType==3) this.$store.commit('upDateIdentity', '实操教练')
  117. if(res.userType==4) this.$store.commit('upDateIdentity', '校长')
  118. uni.switchTab({
  119. url: '/pages/tabbar/statistics/index'
  120. })
  121. }
  122. },
  123. selectClick(item) {
  124. this.showRole = false
  125. this.$store.commit('upDateIdentity', item.name)
  126. uni.switchTab({
  127. url: '/pages/tabbar/statistics/index'
  128. })
  129. // alert(item.name)
  130. }
  131. }
  132. }
  133. </script>
  134. <style lang="scss" scoped>
  135. .main {
  136. width: 100%;
  137. min-height: 100vh;
  138. // background: url('../../../static/images/userCenter/loginTopBg.png') no-repeat;
  139. // background-size: 100% 360rpx;
  140. .uni-input-placeholder {
  141. color: #BBBBBB !important;
  142. }
  143. .u-back-top {
  144. padding: 32rpx 0 0 0;
  145. .backBox {
  146. padding: 24rpx;
  147. }
  148. }
  149. .title {
  150. font-size: 48rpx;
  151. color: #333;
  152. padding: 202rpx 0 80rpx 0;
  153. text-align: center;
  154. font-weight: 600;
  155. }
  156. .form {
  157. padding: 0 46rpx;
  158. .form-item {
  159. height: 112rpx;
  160. background: #F4F7FF;
  161. border-radius: 16rpx;
  162. width: 100%;
  163. line-height: 112rpx;
  164. display: flex;
  165. margin-bottom: 40rpx;
  166. padding: 0 40rpx;
  167. .prefix {
  168. display: flex;
  169. align-items: center;
  170. font-size: 32rpx;
  171. color: #333;
  172. font-weight: 600;
  173. }
  174. .inputBox {
  175. flex: 1;
  176. input {
  177. display: block;
  178. width: 100%;
  179. height: 100%;
  180. display: block;
  181. line-height: 112rpx;
  182. font-size: 30rpx;
  183. }
  184. }
  185. .code {
  186. color: #BBBBBB;
  187. margin-left: 30rpx;
  188. &.active {
  189. color: $themC
  190. }
  191. }
  192. }
  193. .loginBtn {
  194. width: 100%;
  195. height: 112rpx;
  196. background: rgba(25,137,250,0.3);
  197. border-radius: 16rpx;
  198. text-align: center;
  199. line-height: 112rpx;
  200. font-size: 32rpx;
  201. font-weight: 600;
  202. color: #fff;
  203. margin-top: 100rpx;
  204. &.active {
  205. background: rgba(25,137,250,1);
  206. }
  207. }
  208. }
  209. }
  210. </style>