Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 
 

255 wiersze
5.1 KiB

  1. <template>
  2. <view class="container">
  3. <view class="back-btn yticon icon-zuojiantou-up" @click="navBack"></view>
  4. <!-- 设置白色背景防止软键盘把下部绝对定位元素顶上来盖住输入框等 -->
  5. <view class="wrapper">
  6. <view class="left-top-sign">LOGIN</view>
  7. <view class="welcome">
  8. Welcome Back !
  9. </view>
  10. <view class="input-content">
  11. <view class="input-item">
  12. <text class="tit">Account</text>
  13. <input type="text" :value="mobile" placeholder="" data-key="mobile" @input="inputChange" />
  14. </view>
  15. <view class="input-item">
  16. <text class="tit">Password</text>
  17. <input type="mobile" value="" placeholder="" placeholder-class="input-empty" maxlength="20"
  18. password data-key="password" @input="inputChange" @confirm="toLogin" />
  19. </view>
  20. <view class="input-item">
  21. <text style="line-height: 28px;font-size: 13px;color: #606266;">
  22. Forget Password ? please contact
  23. <a style="margin-left: 10px" href="mailto:wendy.wang@inter.ikea.com">wendy.wang@inter.ikea.com</a>
  24. </text>
  25. </view>
  26. </view>
  27. <button class="confirm-btn" @click="toLogin" :disabled="logining">Login</button>
  28. <!-- #ifdef MP-WEIXIN -->
  29. <!-- <button class="confirm-btn" open-type="getPhoneNumber" @getphonenumber="loginForWechatMini">授权微信绑定电话号码一键登录</button> -->
  30. <!-- #endif -->
  31. <!-- <view class="forget-section"> -->
  32. <!-- <view><label @click="register('resetpwd')">忘记密码</label> -->
  33. <!-- - <label @click="register('register')">立马注册</label></view> -->
  34. <!-- </view> -->
  35. </view>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. import {
  41. mapMutations
  42. } from 'vuex';
  43. export default {
  44. data() {
  45. return {
  46. mobile: '',
  47. password: '',
  48. logining: false
  49. }
  50. },
  51. onLoad() {
  52. },
  53. methods: {
  54. ...mapMutations(['login']),
  55. inputChange(e) {
  56. const key = e.currentTarget.dataset.key;
  57. this[key] = e.detail.value;
  58. },
  59. navBack() {
  60. uni.navigateBack();
  61. },
  62. async toLogin() {
  63. this.logining = true;
  64. let data = await this.$api.request('/user/login', 'POST', {
  65. mobile: this.mobile,
  66. password: this.password
  67. })
  68. if (data) {
  69. this.$store.commit('login', data)
  70. this.logining = true;
  71. setTimeout(function() {
  72. // uni.navigateBack();
  73. uni.switchTab({
  74. url: '/pages/index/index'
  75. })
  76. }, 2000)
  77. } else {
  78. this.logining = false;
  79. }
  80. },
  81. register(event) {
  82. uni.navigateTo({
  83. url: './register?event=' + event
  84. })
  85. },
  86. // #ifdef MP-WEIXIN
  87. async loginForWechatMini(e) {
  88. if (e.hasOwnProperty('detail')) {
  89. let data = await this.$api.request('/user/loginForWechatMini', 'POST', {
  90. encryptedData: e.detail.encryptedData,
  91. iv: e.detail.iv
  92. });
  93. if (data) {
  94. this.$store.commit('login', data);
  95. this.$api.msg('登录成功');
  96. setTimeout(function() {
  97. let pages = getCurrentPages(); //当前页
  98. if(pages.length==1&&pages[0].route=='pages/public/login'){
  99. uni.switchTab({
  100. url: `pages/index/index`
  101. });
  102. }else{
  103. uni.navigateBack();
  104. }
  105. }, 2000);
  106. }
  107. }
  108. },
  109. // #endif
  110. },
  111. }
  112. </script>
  113. <style lang='scss'>
  114. page {
  115. background: #fff;
  116. }
  117. .container {
  118. padding-top: 160rpx;
  119. position: relative;
  120. display: flex;
  121. justify-content: center;
  122. height: 100vh;
  123. overflow: hidden;
  124. background: #fff;
  125. }
  126. .wrapper {
  127. position: relative;
  128. z-index: 90;
  129. background: #fff;
  130. padding-bottom: 40upx;
  131. max-width: 1000upx;
  132. }
  133. .back-btn {
  134. position: absolute;
  135. left: 40upx;
  136. z-index: 9999;
  137. padding-top: var(--status-bar-height);
  138. top: 40upx;
  139. font-size: 40upx;
  140. color: $font-color-dark;
  141. }
  142. .left-top-sign {
  143. font-size: 120upx;
  144. color: $page-color-base;
  145. position: relative;
  146. left: -16upx;
  147. }
  148. .welcome {
  149. position: relative;
  150. left: 50upx;
  151. top: -90upx;
  152. font-size: 46upx;
  153. color: #555;
  154. text-shadow: 1px 0px 1px rgba(0, 0, 0, .3);
  155. }
  156. .input-content {
  157. padding: 0 60upx;
  158. }
  159. .input-item {
  160. display: flex;
  161. flex-direction: column;
  162. align-items: flex-start;
  163. justify-content: center;
  164. padding: 0 30upx;
  165. background: $page-color-light;
  166. height: 120upx;
  167. border-radius: 4px;
  168. margin-bottom: 50upx;
  169. word-break: break-all;
  170. &:last-child {
  171. margin-bottom: 0;
  172. }
  173. .tit {
  174. height: 50upx;
  175. line-height: 56upx;
  176. font-size: $font-sm+2upx;
  177. color: $font-color-base;
  178. }
  179. input {
  180. height: 60upx;
  181. font-size: $font-base + 2upx;
  182. color: $font-color-dark;
  183. width: 100%;
  184. }
  185. }
  186. .confirm-btn {
  187. width: 630upx;
  188. height: 76upx;
  189. line-height: 76upx;
  190. border-radius: 50px;
  191. margin-top: 70upx;
  192. background: $uni-color-primary;
  193. color: #fff;
  194. font-size: $font-lg;
  195. &:after {
  196. border-radius: 100px;
  197. }
  198. }
  199. .forget-section {
  200. font-size: $font-sm+10upx;
  201. color: $font-color-spec;
  202. text-align: center;
  203. margin-top: 100upx;
  204. label {
  205. margin: 10upx 60upx;
  206. }
  207. }
  208. .register-section {
  209. position: absolute;
  210. left: 0;
  211. bottom: 50upx;
  212. width: 100%;
  213. font-size: $font-sm+2upx;
  214. color: $font-color-base;
  215. text-align: center;
  216. text {
  217. color: $font-color-spec;
  218. margin-left: 10upx;
  219. }
  220. }
  221. </style>