login.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  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. pwd : this.password,
  76. // password: hex_md5(this.password),
  77. }
  78. const {
  79. data
  80. } = await login(obj)
  81. if (data.code == 1) {
  82. console.log('data',data);
  83. uni.setStorageSync('token', data.data.token);
  84. uni.redirectTo({
  85. url: '/pages/home',
  86. });
  87. }
  88. },
  89. }
  90. }
  91. </script>
  92. <style lang="stylus" scoped>
  93. .login {
  94. flex: 1;
  95. display: flex;
  96. flex-direction: column;
  97. overflow: hidden;
  98. background: url(../static/back.png);
  99. background-size: 100% 100%;
  100. .flex-null-1 {
  101. flex: 2;
  102. }
  103. .flex-null-2 {
  104. flex: 3;
  105. }
  106. .logo-img {
  107. width: 448rpx;
  108. height: 187rpx;
  109. margin: 0 auto 0;
  110. }
  111. .logo-text {
  112. margin-top:40rpx;
  113. /* 1. 字体设置:必须够粗 */
  114. font-family: "Microsoft YaHei", "SimHei", sans-serif;
  115. font-weight: 900;
  116. /* 最粗 */
  117. font-size: 52rpx;
  118. /* 根据实际需要调整大小 */
  119. letter-spacing: 2rpx;
  120. color: #ffffff;
  121. text-shadow:
  122. -1rpx -1rpx 0 #7cb9e8,
  123. 1rpx -1rpx 0 #7cb9e8,
  124. -1rpx 1rpx 0 #7cb9e8,
  125. 1rpx 1rpx 0 #7cb9e8,
  126. -2rpx 0rpx 0 #7cb9e8,
  127. 2rpx 0rpx 0 #7cb9e8,
  128. 0rpx -2rpx 0 #7cb9e8,
  129. 0rpx 2rpx 0 #7cb9e8,
  130. 0rpx 0rpx 4rpx rgba(124, 185, 232, 0.6);
  131. padding: 15rpx 40rpx;
  132. display: inline-block;
  133. text-align: center;
  134. }
  135. .input-max-box {
  136. .input-max-box-one {
  137. overflow: hidden;
  138. // margin-top: 68rpx;
  139. .input-box {
  140. display flex;
  141. width: 600rpx;
  142. height: 80rpx;
  143. border: 1rpx solid #0183FA;
  144. border-radius: 40rpx;
  145. margin: 147rpx auto 0;
  146. img {
  147. width: 28rpx;
  148. height: 32rpx;
  149. margin: 24rpx 31rpx;
  150. }
  151. input {
  152. flex: 1;
  153. font-size: 24rpx;
  154. height: 80rpx;
  155. line-height: 80rpx;
  156. margin-right: 31rpx;
  157. }
  158. }
  159. .text-box {
  160. height: 59rpx;
  161. line-height: 59rpx;
  162. color: #DC1616;
  163. font-size: 24rpx;
  164. margin-left: 102rpx;
  165. }
  166. }
  167. .input-max-box-two {
  168. margin-top: 40rpx;
  169. .input-box {
  170. display flex;
  171. width: 600rpx;
  172. height: 80rpx;
  173. border: 1rpx solid #0183FA;
  174. border-radius: 40rpx;
  175. margin: 0 auto 0;
  176. img {
  177. width: 30rpx;
  178. height: 32rpx;
  179. margin: 24rpx 30rpx;
  180. }
  181. input {
  182. flex: 1;
  183. font-size: 24rpx;
  184. height: 80rpx;
  185. line-height: 80rpx;
  186. margin-right: 31rpx;
  187. }
  188. }
  189. .text-box {
  190. height: 59rpx;
  191. line-height: 59rpx;
  192. color: #DC1616;
  193. font-size: 24rpx;
  194. margin-left: 102rpx;
  195. }
  196. }
  197. }
  198. .button-box {
  199. width: 600rpx;
  200. line-height: 80rpx;
  201. background: #0183FA;
  202. border-radius: 40rpx;
  203. font-size: 36rpx;
  204. color: #fff;
  205. text-align center;
  206. margin: 140rpx auto 0;
  207. }
  208. }
  209. </style>