LoginView.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <template>
  2. <div class="login-view">
  3. <img
  4. class="title"
  5. src="@/assets/images/login-page-title.png"
  6. alt=""
  7. draggable="false"
  8. >
  9. <div class="interaction-area">
  10. <div class="row-1">
  11. <div class="input-wrap">
  12. <input
  13. v-model="nickName"
  14. type="text"
  15. maxlength="6"
  16. placeholder="请输入昵称"
  17. >
  18. <div class="count">
  19. {{ nickName.length }}/6
  20. </div>
  21. </div>
  22. <button
  23. class="as-visitor"
  24. :disabled="!nickName"
  25. @click="onClickAsVisitor"
  26. >
  27. 游客模式
  28. </button>
  29. </div>
  30. <button class="as-wx-user" />
  31. </div>
  32. </div>
  33. </template>
  34. <script setup>
  35. import { ref, computed, watch, onMounted } from "vue"
  36. import { useRoute, useRouter } from "vue-router"
  37. import { useStore } from "vuex"
  38. const route = useRoute()
  39. const router = useRouter()
  40. const store = useStore()
  41. const nickName = ref('')
  42. nickName.value = `云城居民${utils.getRandomString(2)}`
  43. function onClickAsVisitor() {
  44. store.commit('setLoginStatus', store.getters.loginStatusEnum.visitor)
  45. store.commit('setUserName', nickName.value)
  46. if (route.query.redirect && !route.query.redirect.includes('login')) {
  47. router.push({
  48. path: decodeURI(route.query.redirect)
  49. })
  50. } else {
  51. router.push({
  52. name: 'HomeView'
  53. })
  54. }
  55. }
  56. </script>
  57. <style lang="less" scoped>
  58. .login-view{
  59. position: fixed;
  60. left: 0;
  61. top: 0;
  62. width: 100%;
  63. height: 100%;
  64. background-image: url(@/assets/images/login-bg.jpg);
  65. background-size: cover;
  66. background-repeat: no-repeat;
  67. background-position: center center;
  68. >img.title{
  69. position: absolute;
  70. left: 50%;
  71. bottom: 50%;
  72. transform: translate(-50%, 0);
  73. width: 30vw;
  74. }
  75. >.interaction-area{
  76. position: absolute;
  77. left: 50%;
  78. bottom: calc(107 / 972 * 100%);
  79. transform: translate(-50%, 0);
  80. >.row-1{
  81. display: flex;
  82. align-items: center;
  83. margin-bottom: 4px;
  84. >.input-wrap{
  85. width: 283px;
  86. height: 75px;
  87. background: rgba(0,0,0,0.25);
  88. border-radius: 8px 8px 8px 8px;
  89. border: 2px solid #FFFFFF;
  90. display: flex;
  91. justify-content: space-between;
  92. align-items: center;
  93. padding-left: 27px;
  94. padding-right: 22px;
  95. margin-right: 7px;
  96. >input{
  97. width: 170px;
  98. font-family: Source Han Sans CN, Source Han Sans CN;
  99. font-weight: 400;
  100. font-size: 24px;
  101. color: #FFFFFF;
  102. line-height: 28px;
  103. &::placeholder {
  104. font-size: 24px;
  105. color: rgba(255, 255, 255, 0.5);
  106. line-height: 28px;
  107. }
  108. }
  109. >.count{
  110. flex: 0 0 auto;
  111. font-family: Source Han Sans CN, Source Han Sans CN;
  112. font-weight: 400;
  113. font-size: 24px;
  114. color: #FFFFFF;
  115. line-height: 28px;
  116. opacity: 0.5;
  117. }
  118. }
  119. >button.as-visitor{
  120. width: 135px;
  121. height: 88px;
  122. background-image: url(@/assets/images/visitor-login-button-bg.png);
  123. background-size: cover;
  124. background-repeat: no-repeat;
  125. background-position: center center;
  126. font-family: Source Han Sans CN, Source Han Sans CN;
  127. font-weight: 400;
  128. font-size: 24px;
  129. color: #FFFFFF;
  130. line-height: 28px;
  131. text-shadow: 0px 1px 1px rgba(135,111,82,0.5);
  132. &[disabled] {
  133. opacity: 0.7;
  134. cursor: not-allowed;
  135. }
  136. }
  137. }
  138. >button.as-wx-user{
  139. width: 422px;
  140. height: 75px;
  141. background-image: url(@/assets/images/button-wechat.png);
  142. background-size: cover;
  143. background-repeat: no-repeat;
  144. background-position: center center;
  145. }
  146. }
  147. }
  148. </style>