login.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <!-- 登录 -->
  2. <template>
  3. <view class="login">
  4. <view class="flex-null-1"></view>
  5. <img class="logo-img" src="@/static/logo.png" alt="">
  6. <view class="logo-text">(积分兑换)</view>
  7. <view class="input-max-box">
  8. <view class="input-max-box-one">
  9. <view class="input-box">
  10. <img src="@/static/img_log_in_account.png">
  11. <input type="text" v-model="username" @confirm="login()" placeholder="请输入手机号" maxlength="30">
  12. </view>
  13. </view>
  14. <!-- <view class="input-max-box-two">
  15. <view class="input-box">
  16. <img src="@/static/img_log_in_password.png">
  17. <input type="password" v-model="password" @confirm="login()" placeholder="请输入密码" maxlength="30">
  18. </view>
  19. </view> -->
  20. <view class="button-box" @click="login()">登录</view>
  21. </view>
  22. <view class="flex-null-2"></view>
  23. </view>
  24. </template>
  25. <script>
  26. import {
  27. hex_md5
  28. } from '@/utils/md5.js';
  29. import {
  30. login
  31. } from '@/api/indexAKY';
  32. import {
  33. browserDetection
  34. } from '@/utils/auth';
  35. export default {
  36. data() {
  37. return {
  38. username: "",
  39. password: "",
  40. }
  41. },
  42. onLoad() {
  43. },
  44. onShow() {
  45. browserDetection();
  46. },
  47. methods: {
  48. //登录
  49. async login() {
  50. let self = this;
  51. if (!this.username) {
  52. uni.showToast({
  53. mask: true,
  54. icon: "none",
  55. position: "center",
  56. title: "请输入手机号",
  57. duration: 2000
  58. });
  59. return
  60. }
  61. // if (!this.password) {
  62. // uni.showToast({
  63. // mask: true,
  64. // icon: "none",
  65. // position: "center",
  66. // title: "请输入密码",
  67. // duration: 2000
  68. // });
  69. // return
  70. // }
  71. let obj = {
  72. // account: this.username,
  73. // password: hex_md5(this.password),
  74. mob : this.username,
  75. // password: hex_md5(this.password),
  76. }
  77. const {
  78. data
  79. } = await login(obj)
  80. if (data.code == 1) {
  81. console.log('data',data);
  82. uni.setStorageSync('token', data.data.token);
  83. uni.redirectTo({
  84. url: '/pages/home',
  85. });
  86. }
  87. },
  88. }
  89. }
  90. </script>
  91. <style lang="stylus" scoped>
  92. .login {
  93. flex: 1;
  94. display: flex;
  95. flex-direction: column;
  96. overflow: hidden;
  97. background: url(../static/back.png);
  98. background-size: 100% 100%;
  99. .flex-null-1 {
  100. flex: 2;
  101. }
  102. .flex-null-2 {
  103. flex: 3;
  104. }
  105. .logo-img {
  106. width: 448rpx;
  107. height: 187rpx;
  108. margin: 0 auto 0;
  109. }
  110. .logo-text {
  111. margin-top:40rpx;
  112. /* 1. 字体设置:必须够粗 */
  113. font-family: "Microsoft YaHei", "SimHei", sans-serif;
  114. font-weight: 900;
  115. /* 最粗 */
  116. font-size: 52rpx;
  117. /* 根据实际需要调整大小 */
  118. letter-spacing: 2rpx;
  119. color: #ffffff;
  120. text-shadow:
  121. -1rpx -1rpx 0 #7cb9e8,
  122. 1rpx -1rpx 0 #7cb9e8,
  123. -1rpx 1rpx 0 #7cb9e8,
  124. 1rpx 1rpx 0 #7cb9e8,
  125. -2rpx 0rpx 0 #7cb9e8,
  126. 2rpx 0rpx 0 #7cb9e8,
  127. 0rpx -2rpx 0 #7cb9e8,
  128. 0rpx 2rpx 0 #7cb9e8,
  129. 0rpx 0rpx 4rpx rgba(124, 185, 232, 0.6);
  130. padding: 15rpx 40rpx;
  131. display: inline-block;
  132. text-align: center;
  133. }
  134. .input-max-box {
  135. .input-max-box-one {
  136. overflow: hidden;
  137. // margin-top: 68rpx;
  138. .input-box {
  139. display flex;
  140. width: 600rpx;
  141. height: 80rpx;
  142. border: 1rpx solid #0183FA;
  143. border-radius: 40rpx;
  144. margin: 147rpx auto 0;
  145. img {
  146. width: 28rpx;
  147. height: 32rpx;
  148. margin: 24rpx 31rpx;
  149. }
  150. input {
  151. flex: 1;
  152. font-size: 24rpx;
  153. height: 80rpx;
  154. line-height: 80rpx;
  155. margin-right: 31rpx;
  156. }
  157. }
  158. .text-box {
  159. height: 59rpx;
  160. line-height: 59rpx;
  161. color: #DC1616;
  162. font-size: 24rpx;
  163. margin-left: 102rpx;
  164. }
  165. }
  166. .input-max-box-two {
  167. margin-top: 40rpx;
  168. .input-box {
  169. display flex;
  170. width: 600rpx;
  171. height: 80rpx;
  172. border: 1rpx solid #0183FA;
  173. border-radius: 40rpx;
  174. margin: 0 auto 0;
  175. img {
  176. width: 30rpx;
  177. height: 32rpx;
  178. margin: 24rpx 30rpx;
  179. }
  180. input {
  181. flex: 1;
  182. font-size: 24rpx;
  183. height: 80rpx;
  184. line-height: 80rpx;
  185. margin-right: 31rpx;
  186. }
  187. }
  188. .text-box {
  189. height: 59rpx;
  190. line-height: 59rpx;
  191. color: #DC1616;
  192. font-size: 24rpx;
  193. margin-left: 102rpx;
  194. }
  195. }
  196. }
  197. .button-box {
  198. width: 600rpx;
  199. line-height: 80rpx;
  200. background: #0183FA;
  201. border-radius: 40rpx;
  202. font-size: 36rpx;
  203. color: #fff;
  204. text-align center;
  205. margin: 140rpx auto 0;
  206. }
  207. }
  208. </style>