mobileLogin.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. <template>
  2. <view class="page">
  3. <view class="p-header flex-col align-center justify-center">
  4. <image src="/static/log_logo.png" mode="widthFix" class="img"></image>
  5. <text class="txt">盲go小程序</text>
  6. <!-- <image src="/static/home_logo.png" mode="widthFix" class="ic"></image> -->
  7. </view>
  8. <view class="p-form">
  9. <view class="c-item align-center">
  10. <image src="/static/log_tel.png" mode="widthFix" class="i-ic"></image>
  11. <view class="i-inpt">
  12. <input type="number" class="inpt" placeholder="请输入手机号" v-model="mobile"/>
  13. </view>
  14. </view>
  15. <view class="c-item align-center last-c-item">
  16. <image src="/static/log_yan.png" mode="widthFix" class="i-ic"></image>
  17. <view class="i-inpt">
  18. <input type="number" class="inpt" placeholder="请输入验证码" v-model="code"/>
  19. </view>
  20. <view class="code-wrap" @tap="chgeCode">
  21. <phoneCode ref="codeRef" :mobile="mobile" event="mobilelogin" />
  22. </view>
  23. </view>
  24. <!--
  25. <view class="c-pwd last-c-item" @tap="navTo('/pages/login/forget')">
  26. 忘记密码?
  27. </view>
  28. -->
  29. <!--
  30. <view class="c-item align-center last-c-item">
  31. <image src="/static/log_yao.png" mode="widthFix" class="i-ic"></image>
  32. <view class="i-inpt">
  33. <input type="text" class="inpt" placeholder="请输入邀请码(选填)" v-model="invite_no"/>
  34. </view>
  35. </view>
  36. -->
  37. </view>
  38. <submit-btn @submit="submit" ref="submitRef">
  39. <template v-slot:btns="{isSubmitted}">
  40. <view class="p-btn" :class="{'disabled':isSubmitted}">
  41. 登录
  42. </view>
  43. </template>
  44. </submit-btn>
  45. <!--
  46. <view class="p-login" @tap="navTo('/pages/login/register')">
  47. <text class="stxt">还没有账号,请点击</text>
  48. <text class="mtxt">注册</text>
  49. </view>
  50. -->
  51. </view>
  52. </template>
  53. <script>
  54. import phoneCode from './components/phoneCode.vue'
  55. export default {
  56. components:{
  57. phoneCode,
  58. },
  59. data() {
  60. return {
  61. // isAgree:true,
  62. mobile:'',
  63. code:'',
  64. // password:'',
  65. // repassword:'',
  66. // invite_no:'',
  67. };
  68. },
  69. onLoad(opt) {
  70. // this.openid = this.$Route.query.openid;
  71. // this.accessToken = this.$Route.query.accessToken;
  72. if(opt.code){
  73. this.invite_no = opt.code;
  74. }
  75. },
  76. methods:{
  77. chgeCode(){
  78. this.$refs.codeRef.getCode();
  79. },
  80. async submit(){
  81. // console.log('submit---');
  82. // return;
  83. // if(! this.isAgree){
  84. // this.$tools.msg('您尚未同意协议')
  85. // return;
  86. // }else
  87. if(! this.$tools.match(this.mobile,'mobile')){
  88. return;
  89. }else if(!this.$tools.match(this.code,'code') ){
  90. return;
  91. }
  92. let sendData={
  93. mobile:this.mobile,
  94. code:this.code,
  95. user_type: 1,
  96. }
  97. let res=await this.$request('login.mobilelogin',sendData);
  98. let userInfo = res.data.userinfo || {};
  99. uni.setStorageSync("token",userInfo.token);
  100. this.$tools.msg(res.msg);
  101. this.$refs.submitRef.chgeStatus();
  102. setTimeout(()=>{
  103. this.goBack(2)
  104. },800)
  105. },
  106. },
  107. }
  108. </script>
  109. <style lang="scss">
  110. page{
  111. background-color: #fff;
  112. }
  113. .page{
  114. // min-height: 100vh;
  115. width: 100%;
  116. // padding-bottom: 100rpx;
  117. }
  118. .p-header{
  119. width: 750rpx;
  120. // height: 470rpx;
  121. height: 400rpx;
  122. position: relative;
  123. .img{
  124. width: 180rpx;
  125. height: 180rpx;
  126. // border-radius: 180rpx;
  127. // background-color: $base-color;
  128. }
  129. .txt{
  130. margin-top: 33rpx;
  131. font-size: 28rpx;
  132. font-family: PingFang SC;
  133. font-weight: 500;
  134. color: #92B99C;
  135. }
  136. }
  137. .p-form{
  138. width: 630rpx;
  139. margin: 0 auto;
  140. .c-pwd{
  141. height: 63rpx;
  142. line-height: 63rpx;
  143. width: 100%;
  144. text-align: right;
  145. font-size: 24rpx;
  146. font-family: PingFang SC;
  147. font-weight: 500;
  148. color: #333333;
  149. }
  150. .c-item{
  151. width: 100%;
  152. height: 84rpx;
  153. background-color: #F1F1F1;
  154. padding: 0 26rpx;
  155. margin-bottom: 30rpx;
  156. border-radius: 8rpx;
  157. }
  158. .i-ic{
  159. width: 30rpx;
  160. height: 30rpx;
  161. margin-right: 17rpx;
  162. }
  163. .i-inpt{
  164. flex:1;
  165. .inpt{
  166. width: 100%;
  167. height: 84rpx;
  168. line-height: 84rpx;
  169. color:#333;
  170. font-size: 30rpx;
  171. }
  172. .code-inpt{
  173. flex:1;
  174. margin-right: 20rpx;
  175. height: 103rpx;
  176. line-height: 103rpx;
  177. color:#333;
  178. font-size: 26rpx;
  179. }
  180. .phone-code{
  181. width: 200rpx;
  182. height: 60rpx;
  183. background: #0D91FF;
  184. box-shadow: 0rpx 6rpx 10rpx 0rpx rgba(13, 145, 255, 0.28);
  185. border-radius: 30rpx;
  186. line-height: 60rpx;
  187. text-align: center;
  188. font-size: 26rpx;
  189. color: #FFFFFF;
  190. }
  191. }
  192. // .i-code{
  193. // width: 180rpx;
  194. // height: 70rpx;
  195. // }
  196. }
  197. .last-c-item{
  198. margin-bottom: 100rpx !important;
  199. }
  200. .p-btn{
  201. margin: 0 auto;
  202. width: 630rpx;
  203. height: 84rpx;
  204. border-radius: 8rpx;
  205. line-height: 84rpx;
  206. text-align: center;
  207. font-size: 34rpx;
  208. font-family: PingFang SC;
  209. font-weight: 500;
  210. background-color: $base-color;
  211. color: #fff;
  212. border-radius: 8rpx;
  213. &.disabled{
  214. background-color: #eee;
  215. box-shadow: none;
  216. border: none;
  217. }
  218. }
  219. .p-login{
  220. font-size: 28rpx;
  221. height: 80rpx;
  222. line-height: 80rpx;
  223. text-align: right;
  224. width: 630rpx;
  225. margin:16rpx auto 0;
  226. font-weight: bold;
  227. padding-right: 10rpx;
  228. .stxt{
  229. color: #999999;
  230. }
  231. .mtxt{
  232. color: $base-color;
  233. padding: 0 10rpx;
  234. }
  235. }
  236. .p-reg{
  237. margin-top: 30rpx;
  238. font-size: 28rpx;
  239. font-family: PingFang SC;
  240. font-weight: 500;
  241. text-align: center;
  242. width: 100%;
  243. .stxt{
  244. color: #999999;
  245. }
  246. .mtxt{
  247. color: #333;
  248. }
  249. }
  250. .p-tips{
  251. position: absolute;
  252. z-index: 2;
  253. bottom: 30rpx;
  254. left: 0;
  255. width: 100%;
  256. .ic{
  257. width: 30rpx;
  258. height: 30rpx;
  259. margin-right: 22rpx;
  260. }
  261. .txt{
  262. color:#999999;
  263. font-size: 24rpx;
  264. font-family: PingFang SC;
  265. font-weight: 500;
  266. }
  267. .link{
  268. color:#333333;
  269. font-size: 24rpx;
  270. font-family: PingFang SC;
  271. font-weight: 500;
  272. }
  273. }
  274. </style>