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.

265 lines
4.9 KiB

10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
  1. <template>
  2. <view class="content">
  3. <view v-if="step === 1">
  4. <view style="height: 138rpx; width: 100%;"></view>
  5. <view class="a1 flex">
  6. <image src="/static/icons/icon7.png" style="width: 29rpx;height: 32rpx; margin-right: 10rpx"/>
  7. <span>手机号快捷登录</span>
  8. </view>
  9. <!-- <view class="a2">未注册手机号将自动创建账号</view> -->
  10. <view class="a3"></view>
  11. <view class="a4 flex">
  12. <view class="left-area">+86</view>
  13. <input placeholder="请输入手机号" v-model="phone"/>
  14. </view>
  15. <button class="a5" @click="clickSendCode">下一步</button>
  16. </view>
  17. <view v-if="step === 2">
  18. <view class="b1">
  19. <span>输入验证码</span>
  20. </view>
  21. <view class="b2">
  22. 验证码已发送至{{ phone }}
  23. </view>
  24. <view>
  25. <view class="flex flex-sb" style="padding: 40rpx; width: calc(100% - 80rpx)">
  26. <input v-for="i in 4" class="input-m" type="number"
  27. :class="{active: i === yzmCode.length+1}"
  28. :focus="i === yzmCode.length+1"
  29. :value="yzmCode[i-1]"
  30. @click="clickNum(i)" @input="inputNum" />
  31. </view>
  32. </view>
  33. <view class="b3">
  34. 没收到验证码?<span @click="clickSendCode">重新发送</span>
  35. </view>
  36. <view class="b4" @click="toWxLogin">
  37. 确认登录
  38. </view>
  39. </view>
  40. </view>
  41. </template>
  42. <script>
  43. export default {
  44. data() {
  45. return {
  46. step: 1,
  47. openid: '',
  48. yzmCode: '',
  49. phone : '',
  50. }
  51. },
  52. onShow() {
  53. // this.getConfig()
  54. // this.code = this.GetQueryString('code');
  55. // if (!this.code) {
  56. // this.getwx_authorize();
  57. // }
  58. },
  59. methods: {
  60. clickCancel(){
  61. uni.switchTab({ url: '/pages/index/index' })
  62. },
  63. clickSendCode(){
  64. this.$api('getVipCode', {
  65. phone : this.phone
  66. }, res => {
  67. if(res.code == 200){
  68. this.step = 2
  69. uni.showToast({
  70. title : '发送成功',
  71. icon : 'none'
  72. })
  73. }
  74. }, '发送中...')
  75. },
  76. clickNum(i){
  77. this.yzmCode = this.yzmCode.substring(0, i-1)
  78. },
  79. inputNum(event){
  80. if (event){
  81. this.yzmCode = this.yzmCode + event.detail.value.toString().substring(0,1)
  82. // if (this.yzmCode.length === 6){
  83. // this.checkCode()
  84. // }
  85. }
  86. },
  87. checkCode(){
  88. this.clickCancel()
  89. },
  90. //微信登录
  91. toWxLogin(code) {
  92. this.$api('wxTechnicianLogin', {
  93. code : this.yzmCode,
  94. phone : this.phone
  95. }, res=> {
  96. if(res.code == 200){
  97. uni.setStorageSync("token", res.result.token)
  98. uni.setStorageSync("userInfo", JSON.stringify(res.result.userInfo))
  99. uni.switchTab({
  100. url: '/pages/index/index'
  101. })
  102. }
  103. }, true)
  104. },
  105. }
  106. }
  107. </script>
  108. <style scoped>
  109. .b1{
  110. width: 100%;
  111. height: 56rpx;
  112. font-size: 40rpx;
  113. font-family: PingFang SC, PingFang SC-Heavy;
  114. font-weight: 800;
  115. text-align: center;
  116. color: #333333;
  117. margin-top: 38rpx;
  118. }
  119. .b2{
  120. width: 100%;
  121. height: 40rpx;
  122. font-size: 28rpx;
  123. font-family: PingFang SC, PingFang SC-Regular;
  124. font-weight: 400;
  125. text-align: center;
  126. color: #a5a5a5;
  127. margin-top: 20rpx;
  128. }
  129. .input-m{
  130. width: 96rpx;
  131. height: 136rpx;
  132. background: #f8f8f8;
  133. border-radius: 16rpx;
  134. line-height: 136rpx;
  135. font-size: 52rpx;
  136. font-family: PingFang SC, PingFang SC-Heavy;
  137. font-weight: 800;
  138. text-align: center;
  139. color: #333333;
  140. }
  141. .input-m.active{
  142. width: 90rpx;
  143. height: 130rpx;
  144. border: 3rpx solid #51d0b4;
  145. }
  146. .b3{
  147. font-size: 28rpx;
  148. font-family: PingFang SC, PingFang SC-Regular;
  149. font-weight: 400;
  150. text-align: center;
  151. color: #666666;
  152. }
  153. .b3 span{
  154. color: #51D0B4;
  155. }
  156. .b4{
  157. width: 556rpx;
  158. height: 90rpx;
  159. line-height: 90rpx;
  160. border-radius: 46rpx;
  161. background: #51d0b4;
  162. font-size: 28rpx;
  163. font-family: PingFang SC, PingFang SC-Regular;
  164. font-weight: 400;
  165. text-align: center;
  166. color: #ffffff;
  167. margin: 94rpx auto;
  168. }
  169. .a1{
  170. font-size: 32rpx;
  171. line-height: 38rpx;
  172. font-family: PingFang SC, PingFang SC-Heavy,serif;
  173. font-weight: 800;
  174. text-align: left;
  175. color: #333333;
  176. margin-left: 98rpx;
  177. margin-bottom: 12rpx;
  178. }
  179. .a2 {
  180. font-size: 28rpx;
  181. font-family: PingFang SC, PingFang SC-Regular;
  182. font-weight: 400;
  183. text-align: left;
  184. color: #a5a5a5;
  185. margin-left: 98rpx;
  186. }
  187. .a3 {
  188. width: 100%;
  189. height: 120rpx;
  190. }
  191. .a4 {
  192. width: 556rpx;
  193. height: 90rpx;
  194. line-height: 90rpx;
  195. background: #f5f5f5;
  196. border-radius: 45rpx;
  197. margin: 0 auto;
  198. }
  199. .left-area{
  200. width: 136rpx;
  201. font-size: 32rpx;
  202. font-family: PingFang SC, PingFang SC-Bold;
  203. font-weight: 700;
  204. text-align: center;
  205. color: #333333;
  206. }
  207. .a4 input{
  208. line-height: 90rpx;
  209. padding: 22rpx 0;
  210. font-size: 32rpx;
  211. font-family: PingFang SC, PingFang SC-Bold;
  212. font-weight: 700;
  213. color: #333333;
  214. }
  215. .a5 {
  216. width: 556rpx;
  217. height: 90rpx;
  218. line-height: 90rpx;
  219. background: #51d0b4;
  220. border-radius: 46px;
  221. margin: 60rpx auto;
  222. font-size: 28rpx;
  223. font-family: PingFang SC, PingFang SC-Regular;
  224. font-weight: 400;
  225. text-align: center;
  226. color: #ffffff;
  227. }
  228. </style>