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.

267 lines
4.9 KiB

10 months ago
10 months ago
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. let data = {
  93. code : this.yzmCode,
  94. phone : this.phone
  95. }
  96. console.log(data);
  97. this.$api('wxTechnicianLogin', data, res=> {
  98. if(res.code == 200){
  99. uni.setStorageSync("token", res.result.token)
  100. uni.setStorageSync("userInfo", JSON.stringify(res.result.userInfo))
  101. uni.switchTab({
  102. url: '/pages/index/index'
  103. })
  104. }
  105. }, true)
  106. },
  107. }
  108. }
  109. </script>
  110. <style scoped>
  111. .b1{
  112. width: 100%;
  113. height: 56rpx;
  114. font-size: 40rpx;
  115. font-family: PingFang SC, PingFang SC-Heavy;
  116. font-weight: 800;
  117. text-align: center;
  118. color: #333333;
  119. margin-top: 38rpx;
  120. }
  121. .b2{
  122. width: 100%;
  123. height: 40rpx;
  124. font-size: 28rpx;
  125. font-family: PingFang SC, PingFang SC-Regular;
  126. font-weight: 400;
  127. text-align: center;
  128. color: #a5a5a5;
  129. margin-top: 20rpx;
  130. }
  131. .input-m{
  132. width: 96rpx;
  133. height: 136rpx;
  134. background: #f8f8f8;
  135. border-radius: 16rpx;
  136. line-height: 136rpx;
  137. font-size: 52rpx;
  138. font-family: PingFang SC, PingFang SC-Heavy;
  139. font-weight: 800;
  140. text-align: center;
  141. color: #333333;
  142. }
  143. .input-m.active{
  144. width: 90rpx;
  145. height: 130rpx;
  146. border: 3rpx solid #EF8C94;
  147. }
  148. .b3{
  149. font-size: 28rpx;
  150. font-family: PingFang SC, PingFang SC-Regular;
  151. font-weight: 400;
  152. text-align: center;
  153. color: #666666;
  154. }
  155. .b3 span{
  156. color: #EF8C94;
  157. }
  158. .b4{
  159. width: 556rpx;
  160. height: 90rpx;
  161. line-height: 90rpx;
  162. border-radius: 46rpx;
  163. background: #EF8C94;
  164. font-size: 28rpx;
  165. font-family: PingFang SC, PingFang SC-Regular;
  166. font-weight: 400;
  167. text-align: center;
  168. color: #ffffff;
  169. margin: 94rpx auto;
  170. }
  171. .a1{
  172. font-size: 32rpx;
  173. line-height: 38rpx;
  174. font-family: PingFang SC, PingFang SC-Heavy,serif;
  175. font-weight: 800;
  176. text-align: left;
  177. color: #333333;
  178. margin-left: 98rpx;
  179. margin-bottom: 12rpx;
  180. }
  181. .a2 {
  182. font-size: 28rpx;
  183. font-family: PingFang SC, PingFang SC-Regular;
  184. font-weight: 400;
  185. text-align: left;
  186. color: #a5a5a5;
  187. margin-left: 98rpx;
  188. }
  189. .a3 {
  190. width: 100%;
  191. height: 120rpx;
  192. }
  193. .a4 {
  194. width: 556rpx;
  195. height: 90rpx;
  196. line-height: 90rpx;
  197. background: #f5f5f5;
  198. border-radius: 45rpx;
  199. margin: 0 auto;
  200. }
  201. .left-area{
  202. width: 136rpx;
  203. font-size: 32rpx;
  204. font-family: PingFang SC, PingFang SC-Bold;
  205. font-weight: 700;
  206. text-align: center;
  207. color: #333333;
  208. }
  209. .a4 input{
  210. line-height: 90rpx;
  211. padding: 22rpx 0;
  212. font-size: 32rpx;
  213. font-family: PingFang SC, PingFang SC-Bold;
  214. font-weight: 700;
  215. color: #333333;
  216. }
  217. .a5 {
  218. width: 556rpx;
  219. height: 90rpx;
  220. line-height: 90rpx;
  221. background: #EF8C94;
  222. border-radius: 46px;
  223. margin: 60rpx auto;
  224. font-size: 28rpx;
  225. font-family: PingFang SC, PingFang SC-Regular;
  226. font-weight: 400;
  227. text-align: center;
  228. color: #ffffff;
  229. }
  230. </style>