index.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <template>
  2. <view class="content">
  3. <u-image width="100%" height="100%" :fade="false" src="../../static/images/loginBg.png"></u-image>
  4. <view style="position:fixed;top:350rpx;z-index:10">
  5. <u-image style="margin-left: 292rpx;" width="169rpx" height="169rpx" :fade="false" src="../../static/images/logo.png"></u-image>
  6. <u-input style="margin-left:140rpx;margin-top:142rpx;width:475rpx;"
  7. :clearable="false"
  8. placeholder="用户名"
  9. placeholder-style="color: #FFFFFF;font-size: 29rpx;font-family: Segoe UI;font-weight: 400;line-height: 40rpx;"
  10. height="80"
  11. v-model="userinfo.username"
  12. type="text"
  13. :custom-style="{'color':'#fff'}"
  14. borderZ />
  15. <u-input style="margin-left:140rpx;margin-top:83rpx;width:475rpx;"
  16. :clearable="false"
  17. placeholder="密码"
  18. placeholder-style="color: #FFFFFF;font-size: 29rpx;font-family: Segoe UI;font-weight: 400;line-height: 40rpx;"
  19. v-model="userinfo.password"
  20. type="password"
  21. borderZ
  22. password-icon
  23. iconName="suo"
  24. :custom-style="{'color':'#fff'}" />
  25. <view style="margin-left:140rpx;margin-top:38rpx;">
  26. <u-checkbox
  27. v-model="userinfo.checked"
  28. active-color="transparent">
  29. <text class="rem-password">记住密码</text>
  30. </u-checkbox>
  31. </view>
  32. <fxyk-button style="margin-left:131rpx;margin-top:83rpx;border-radius: 58rpx;"
  33. width="488"
  34. height="99"
  35. content="登录"
  36. bgColor="#EBB162"
  37. isLoginButton
  38. @click.native="jump_index"/>
  39. </view>
  40. <u-toast ref="uToast" />
  41. </view>
  42. </template>
  43. <script>
  44. import { mapGetters,mapMutations } from "vuex"
  45. export default {
  46. data() {
  47. return {
  48. userinfo: {
  49. username: '',
  50. password: '',
  51. checked: false
  52. }
  53. }
  54. },
  55. onLoad() {
  56. this.init()
  57. },
  58. computed: {
  59. ...mapGetters(['info'])
  60. },
  61. methods: {
  62. ...mapMutations(['login']),
  63. init() {
  64. if(this.info.checked) {
  65. this.userinfo = this.info
  66. }
  67. },
  68. // 跳到首页
  69. jump_index() {
  70. // 验证账号密码
  71. // 是否输入账号和密码
  72. if (!this.userinfo.username || !this.userinfo.password) {
  73. this.$refs.uToast.show({
  74. title: '请输入用户名和密码',
  75. type: 'error',
  76. icon: false
  77. })
  78. return
  79. }
  80. // 存储用户信息
  81. this.login(this.userinfo)
  82. // 跳转
  83. this.$refs.uToast.show({
  84. title: '登录成功',
  85. type: 'success',
  86. icon: false,
  87. duration: 200,
  88. isTab: true,
  89. url: '/pages/index/index'
  90. })
  91. }
  92. }
  93. }
  94. </script>
  95. <style lang='scss' scoped>
  96. page {
  97. width: 100%;
  98. height: 100%;
  99. }
  100. .content {
  101. width: 100%;
  102. height: 100%;
  103. min-height: 100vh;
  104. background-color: $yk-main-bg-color;
  105. }
  106. .rem-password {
  107. height: 40rpx;
  108. font-size: 30rpx;
  109. font-family: Segoe UI;
  110. font-weight: 400;
  111. line-height: 40rpx;
  112. color: #D8D7D7;
  113. }
  114. </style>