mobileLogin.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  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(e) {
  70. // this.openid = this.$Route.query.openid;
  71. // this.accessToken = this.$Route.query.accessToken;
  72. this.toPath = e.toPath;
  73. },
  74. methods:{
  75. chgeCode(){
  76. this.$refs.codeRef.getCode();
  77. },
  78. async submit(){
  79. // console.log('submit---');
  80. // return;
  81. // if(! this.isAgree){
  82. // this.$tools.msg('您尚未同意协议')
  83. // return;
  84. // }else
  85. if(! this.$tools.match(this.mobile,'mobile')){
  86. return;
  87. }else if(!this.$tools.match(this.code,'code') ){
  88. return;
  89. }
  90. let sendData={
  91. mobile:this.mobile,
  92. code:this.code,
  93. user_type: 1,
  94. }
  95. let res=await this.$request('login.mobilelogin',sendData);
  96. let userInfo = res.data.userinfo || {};
  97. uni.setStorageSync("token",userInfo.token);
  98. this.$store.dispatch('userInfo/getinfo');
  99. this.$tools.msg(res.msg);
  100. this.$refs.submitRef.chgeStatus();
  101. setTimeout(()=>{
  102. if(this.toPath){
  103. uni.redirectTo({
  104. url:this.toPath
  105. })
  106. return;
  107. }
  108. this.goBack()
  109. },800)
  110. },
  111. },
  112. }
  113. </script>
  114. <style lang="scss">
  115. page{
  116. background-color: #fff;
  117. }
  118. .page{
  119. // min-height: 100vh;
  120. width: 100%;
  121. // padding-bottom: 100rpx;
  122. }
  123. .p-header{
  124. width: 750rpx;
  125. // height: 470rpx;
  126. height: 400rpx;
  127. position: relative;
  128. .img{
  129. width: 180rpx;
  130. height: 180rpx;
  131. // border-radius: 180rpx;
  132. // background-color: $base-color;
  133. }
  134. .txt{
  135. margin-top: 33rpx;
  136. font-size: 28rpx;
  137. font-family: PingFang SC;
  138. font-weight: 500;
  139. color: #92B99C;
  140. }
  141. }
  142. .p-form{
  143. width: 630rpx;
  144. margin: 0 auto;
  145. .c-pwd{
  146. height: 63rpx;
  147. line-height: 63rpx;
  148. width: 100%;
  149. text-align: right;
  150. font-size: 24rpx;
  151. font-family: PingFang SC;
  152. font-weight: 500;
  153. color: #333333;
  154. }
  155. .c-item{
  156. width: 100%;
  157. height: 84rpx;
  158. background-color: #F1F1F1;
  159. padding: 0 26rpx;
  160. margin-bottom: 30rpx;
  161. border-radius: 8rpx;
  162. }
  163. .i-ic{
  164. width: 30rpx;
  165. height: 30rpx;
  166. margin-right: 17rpx;
  167. }
  168. .i-inpt{
  169. flex:1;
  170. .inpt{
  171. width: 100%;
  172. height: 84rpx;
  173. line-height: 84rpx;
  174. color:#333;
  175. font-size: 30rpx;
  176. }
  177. .code-inpt{
  178. flex:1;
  179. margin-right: 20rpx;
  180. height: 103rpx;
  181. line-height: 103rpx;
  182. color:#333;
  183. font-size: 26rpx;
  184. }
  185. .phone-code{
  186. width: 200rpx;
  187. height: 60rpx;
  188. background: #0D91FF;
  189. box-shadow: 0rpx 6rpx 10rpx 0rpx rgba(13, 145, 255, 0.28);
  190. border-radius: 30rpx;
  191. line-height: 60rpx;
  192. text-align: center;
  193. font-size: 26rpx;
  194. color: #FFFFFF;
  195. }
  196. }
  197. // .i-code{
  198. // width: 180rpx;
  199. // height: 70rpx;
  200. // }
  201. }
  202. .last-c-item{
  203. margin-bottom: 100rpx !important;
  204. }
  205. .p-btn{
  206. margin: 0 auto;
  207. width: 630rpx;
  208. height: 84rpx;
  209. border-radius: 8rpx;
  210. line-height: 84rpx;
  211. text-align: center;
  212. font-size: 34rpx;
  213. font-family: PingFang SC;
  214. font-weight: 500;
  215. background-color: $base-color;
  216. color: #fff;
  217. border-radius: 8rpx;
  218. &.disabled{
  219. background-color: #eee;
  220. box-shadow: none;
  221. border: none;
  222. }
  223. }
  224. .p-login{
  225. font-size: 28rpx;
  226. height: 80rpx;
  227. line-height: 80rpx;
  228. text-align: right;
  229. width: 630rpx;
  230. margin:16rpx auto 0;
  231. font-weight: bold;
  232. padding-right: 10rpx;
  233. .stxt{
  234. color: #999999;
  235. }
  236. .mtxt{
  237. color: $base-color;
  238. padding: 0 10rpx;
  239. }
  240. }
  241. .p-reg{
  242. margin-top: 30rpx;
  243. font-size: 28rpx;
  244. font-family: PingFang SC;
  245. font-weight: 500;
  246. text-align: center;
  247. width: 100%;
  248. .stxt{
  249. color: #999999;
  250. }
  251. .mtxt{
  252. color: #333;
  253. }
  254. }
  255. .p-tips{
  256. position: absolute;
  257. z-index: 2;
  258. bottom: 30rpx;
  259. left: 0;
  260. width: 100%;
  261. .ic{
  262. width: 30rpx;
  263. height: 30rpx;
  264. margin-right: 22rpx;
  265. }
  266. .txt{
  267. color:#999999;
  268. font-size: 24rpx;
  269. font-family: PingFang SC;
  270. font-weight: 500;
  271. }
  272. .link{
  273. color:#333333;
  274. font-size: 24rpx;
  275. font-family: PingFang SC;
  276. font-weight: 500;
  277. }
  278. }
  279. </style>