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.
 
 
 
 
 
 

253 wiersze
5.0 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. width: 100vw;
  121. height: 100vh;
  122. overflow: hidden;
  123. background: #fff;
  124. }
  125. .wrapper {
  126. position: relative;
  127. z-index: 90;
  128. background: #fff;
  129. padding-bottom: 40upx;
  130. }
  131. .back-btn {
  132. position: absolute;
  133. left: 40upx;
  134. z-index: 9999;
  135. padding-top: var(--status-bar-height);
  136. top: 40upx;
  137. font-size: 40upx;
  138. color: $font-color-dark;
  139. }
  140. .left-top-sign {
  141. font-size: 120upx;
  142. color: $page-color-base;
  143. position: relative;
  144. left: -16upx;
  145. }
  146. .welcome {
  147. position: relative;
  148. left: 50upx;
  149. top: -90upx;
  150. font-size: 46upx;
  151. color: #555;
  152. text-shadow: 1px 0px 1px rgba(0, 0, 0, .3);
  153. }
  154. .input-content {
  155. padding: 0 60upx;
  156. }
  157. .input-item {
  158. display: flex;
  159. flex-direction: column;
  160. align-items: flex-start;
  161. justify-content: center;
  162. padding: 0 30upx;
  163. background: $page-color-light;
  164. height: 120upx;
  165. border-radius: 4px;
  166. margin-bottom: 50upx;
  167. word-break: break-all;
  168. &:last-child {
  169. margin-bottom: 0;
  170. }
  171. .tit {
  172. height: 50upx;
  173. line-height: 56upx;
  174. font-size: $font-sm+2upx;
  175. color: $font-color-base;
  176. }
  177. input {
  178. height: 60upx;
  179. font-size: $font-base + 2upx;
  180. color: $font-color-dark;
  181. width: 100%;
  182. }
  183. }
  184. .confirm-btn {
  185. width: 630upx;
  186. height: 76upx;
  187. line-height: 76upx;
  188. border-radius: 50px;
  189. margin-top: 70upx;
  190. background: $uni-color-primary;
  191. color: #fff;
  192. font-size: $font-lg;
  193. &:after {
  194. border-radius: 100px;
  195. }
  196. }
  197. .forget-section {
  198. font-size: $font-sm+10upx;
  199. color: $font-color-spec;
  200. text-align: center;
  201. margin-top: 100upx;
  202. label {
  203. margin: 10upx 60upx;
  204. }
  205. }
  206. .register-section {
  207. position: absolute;
  208. left: 0;
  209. bottom: 50upx;
  210. width: 100%;
  211. font-size: $font-sm+2upx;
  212. color: $font-color-base;
  213. text-align: center;
  214. text {
  215. color: $font-color-spec;
  216. margin-left: 10upx;
  217. }
  218. }
  219. </style>