oldlogin.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <template>
  2. <view class="oldlogin">
  3. <view class="status_bar"></view>
  4. <view class="oldlogin_img_area">
  5. <image class="oldlogin_img" src="../../static/loginimg.png" mode="widthFix"></image>
  6. <view class="oldlogin_img_text">
  7. {{loginName.substring(0,3)}}****{{loginName.substring(7,11)}}
  8. </view>
  9. </view>
  10. <view class="mt-50 mlr-60 card_area">
  11. <view class="flex-n fac card_area_item">
  12. <view class="card_icon iconfont iconsuotou"></view>
  13. <view class="flex-n fac ml-19 card_content flex-1">
  14. <z-input class="card_input flex-1 mr-20" align="left" :type="switchSave?'':'password'"
  15. v-model="passWord" placeholder="登录密码"></z-input>
  16. <switch :checked="switchSave" @change="changeswitchSave" />
  17. </view>
  18. </view>
  19. </view>
  20. <z-button width="630" class="mt-70" @click="login">登 录</z-button>
  21. <view class="flex-n fac fja mt-60">
  22. <view class="oldlogin_text" @click="gotoForgetPage">
  23. 忘记登录密码
  24. </view>
  25. <view class="oldlogin_text" @click="switchMode=true">
  26. 切换登录方式
  27. </view>
  28. </view>
  29. <z-select-popup :visible.sync="switchMode">
  30. <view @click="userOther">使用其他账号登录</view>
  31. </z-select-popup>
  32. <z-message></z-message>
  33. </view>
  34. </template>
  35. <script>
  36. const app = getApp({
  37. allowDefault: true
  38. });
  39. export default {
  40. data() {
  41. return {
  42. switchSave: false,
  43. switchMode: false,
  44. loginName: '15940515817',
  45. passWord: ''
  46. };
  47. },
  48. mounted() {
  49. //获取重新修改的登录信息,之前的手机号
  50. uni.getStorage({
  51. key: 'loginName',
  52. success: (res) => {
  53. this.loginName = res.data;
  54. }
  55. })
  56. },
  57. methods: {
  58. login() {
  59. // app/account/login
  60. this.$axios.post('account/login', {
  61. // loginName:this.loginName,
  62. loginName: 'admin',
  63. passWord: this.passWord
  64. }).then(res => {
  65. console.log(res.data)
  66. console.log(app.globalData)
  67. app.globalData.authorization = res.data.Authorization;
  68. let storeId='';
  69. if (res.data.storeId) {
  70. storeId = res.data.storeId;
  71. } else {
  72. storeId=res.data.store[0].storeId||''
  73. }
  74. uni.setStorage({
  75. key: 'storeId',
  76. data:storeId
  77. })
  78. app.globalData.userId = res.data.userId;
  79. uni.setStorage({
  80. key:'userInfo',
  81. data:res.data
  82. })
  83. uni.setStorage({
  84. key: 'loginName',
  85. data: this.loginName
  86. })
  87. this.$store.state.dicChange = true;
  88. uni.setStorage({
  89. key: 'passWord',
  90. data: this.passWord
  91. })
  92. uni.switchTab({
  93. url: '../remind/index/index',
  94. success: res => {},
  95. fail: () => {},
  96. complete: () => {}
  97. });
  98. }).catch(err => {
  99. console.log(err)
  100. uni.showToast({
  101. title: err.msg,
  102. icon: 'none',
  103. duration: 2000
  104. })
  105. })
  106. },
  107. userOther() {
  108. uni.redirectTo({
  109. url: './newlogin'
  110. })
  111. },
  112. changeswitchSave(e) {
  113. this.switchSave = e.detail.value;
  114. },
  115. gotoForgetPage() {
  116. uni.navigateTo({
  117. url: '../center/setting/forgetpass',
  118. success: res => {},
  119. fail: () => {},
  120. complete: () => {}
  121. });
  122. }
  123. }
  124. }
  125. </script>
  126. <style scoped lang="scss">
  127. .oldlogin {
  128. width: 100%;
  129. height: 100vh;
  130. overflow: hidden;
  131. background: url(../../static/login_bg.png);
  132. background-size: 100% auto;
  133. background-repeat: no-repeat;
  134. background-position: left bottom;
  135. .status_bar {
  136. height: var(--status-bar-height);
  137. }
  138. .oldlogin_img_area {
  139. text-align: center;
  140. .oldlogin_img {
  141. width: 200rpx;
  142. margin-top: 100rpx;
  143. border-radius: 200rpx;
  144. background: white;
  145. border: 5rpx solid #AAAAAA;
  146. border-radius: 50%;
  147. }
  148. .oldlogin_img_text {
  149. font-size: 28rpx;
  150. font-weight: bold;
  151. color: #333333;
  152. }
  153. }
  154. }
  155. .card_area {
  156. .card_area_item {
  157. height: 100rpx;
  158. }
  159. .card_icon {
  160. min-width: 40rpx;
  161. font-size: 40rpx;
  162. color: #2481EE;
  163. }
  164. .card_content {
  165. border-bottom: 1px solid #B8B8B8;
  166. }
  167. .card_input {
  168. padding: 20rpx 0;
  169. }
  170. }
  171. .oldlogin_text {
  172. font-size: 24rpx;
  173. color: #2481EE;
  174. }
  175. </style>