index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. <template>
  2. <view class="login-content">
  3. <view class="login-content-info">
  4. <view class="login-bgm">
  5. <image class="login-logo" :src="logoUrl" mode="scaleToFill"></image>
  6. <text>{{ title }}</text>
  7. </view>
  8. <view class="login-info">
  9. <view class="login-info-box">
  10. <text class="login-info-title">账号密码登陆</text>
  11. <view class="login-info-form">
  12. <u--form
  13. labelWidth="0"
  14. :borderBottom="false"
  15. :model="form"
  16. :rules="rules"
  17. ref="uForm">
  18. <u-form-item prop="name">
  19. <u--input
  20. v-model="form.name"
  21. placeholder="请输入账号"
  22. border="surround"
  23. shape="circle"
  24. prefixIcon="account-fill"
  25. prefixIconStyle="font-size: 22px;color: #909399"
  26. ></u--input>
  27. </u-form-item>
  28. <u-form-item prop="password">
  29. <u--input
  30. v-model="form.password"
  31. placeholder="请输入账密码"
  32. border="surround"
  33. shape="circle"
  34. prefixIcon="lock-fill"
  35. prefixIconStyle="font-size: 22px;color: #909399"
  36. ></u--input>
  37. </u-form-item>
  38. </u--form>
  39. </view>
  40. <view class="login-info-submit">
  41. <u-button
  42. class="login-info-submit-but"
  43. @click="submit()"
  44. :loading="loading"
  45. loadingText="登录中..."
  46. >登录</u-button>
  47. </view>
  48. <view class="login-info-tip">暂不支持自行注册</view>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. </template>
  54. <script>
  55. export default {
  56. data() {
  57. return {
  58. title: '《伟大转折》剧目全民分享系统',
  59. logoUrl: this.$commonConfig.staticUrl + "login/logo.png",
  60. loading: false,
  61. form: {
  62. name: '',
  63. password: '',
  64. },
  65. rules: {
  66. 'name': {
  67. type: 'string',
  68. required: true,
  69. message: '请填写账号',
  70. trigger: ['blur', 'change']
  71. },
  72. 'password': {
  73. type: 'string',
  74. max: 1,
  75. required: true,
  76. message: '请填写密码',
  77. trigger: ['blur', 'change']
  78. },
  79. },
  80. }
  81. },
  82. onReady() {
  83. //如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。
  84. this.$refs.uForm.setRules(this.rules)
  85. },
  86. onLoad() {
  87. },
  88. onShow() {
  89. },
  90. methods: {
  91. /**
  92. *
  93. * 提交登录
  94. *
  95. */
  96. submit() {
  97. this.loading = true
  98. this.$refs.uForm.validate().then(res => {
  99. this.$u.toast('校验通过')
  100. }).catch(errors => {
  101. this.$u.toast('校验失败')
  102. this.loading = false
  103. })
  104. }
  105. }
  106. }
  107. </script>
  108. <style lang="scss" scoped>
  109. .login-content {
  110. width: 100%;
  111. height: 100%;
  112. position: relative;
  113. box-sizing: border-box;
  114. --bgm-height: 630rpx;
  115. }
  116. /** 背景 */
  117. .login-content-box {
  118. width: 100%;
  119. height: 100%;
  120. box-sizing: border-box;
  121. }
  122. .login-bgm {
  123. width: 100%;
  124. height: 630rpx;
  125. background-image: url("#{$image-beas-url}login/bgm.png");
  126. background-size: 100% auto;
  127. background-repeat: no-repeat;
  128. box-sizing: border-box;
  129. display: flex;
  130. flex-direction: column;
  131. justify-content: center;
  132. align-items: center;
  133. .login-logo {
  134. width: 240rpx;
  135. height: 172rpx;
  136. padding: 50rpx 0;
  137. }
  138. >text {
  139. font-size: 32rpx;
  140. font-family: SourceHanSansCN, SourceHanSansCN;
  141. font-weight: bold;
  142. color: #FFFFFF;
  143. }
  144. }
  145. .login-info {
  146. width: 100%;
  147. height: calc(100% - var(--bgm-height) + 40rpx);
  148. background-color: #fff;
  149. border-radius: 28rpx 28rpx 0rpx 0rpx;
  150. position: absolute;
  151. bottom: 0;
  152. left: 0;
  153. z-index: 22;
  154. box-sizing: border-box;
  155. padding: 80rpx;
  156. .login-info-box {
  157. width: 100%;
  158. height: 100%;
  159. display: flex;
  160. flex-direction: column;
  161. box-sizing: border-box;
  162. .login-info-title {
  163. font-size: 32rpx;
  164. font-family: SourceHanSansCN, SourceHanSansCN;
  165. font-weight: bold;
  166. color: #2D2D2D;
  167. padding-bottom: 40rpx;
  168. }
  169. .login-info-form {
  170. }
  171. .login-info-submit {
  172. width: 100%;
  173. height: 80rpx;
  174. padding: 40rpx 0 20rpx;
  175. flex-shrink: 0;
  176. .login-info-submit-but {
  177. display: flex;
  178. justify-content: center;
  179. align-items: center;
  180. border-radius: 40rpx;
  181. width: 100% !important;
  182. height: 100% !important;
  183. background-color: var(--gd-bgm-color);
  184. color: #fff;
  185. }
  186. }
  187. .login-info-tip {
  188. width: 100%;
  189. text-align: center;
  190. font-size: 24rpx;
  191. font-family: SourceHanSansCN, SourceHanSansCN;
  192. font-weight: 400;
  193. color: #C2C2C2;
  194. }
  195. }
  196. }
  197. /** tabar */
  198. .main-tabar {
  199. width: 80vw;
  200. height: 100rpx;
  201. position: fixed;
  202. bottom: 20rpx;
  203. left: 50%;
  204. transform: translateX(-50%);
  205. box-sizing: border-box;
  206. .main-tabar-info {
  207. width: 100%;
  208. height: 100%;
  209. display: flex;
  210. justify-content: space-between;
  211. box-shadow: rgba(0, 0, 0, 0.4) 0px 2px 6px 0px;
  212. border-radius: 40rpx;
  213. .main-tabar-item {
  214. flex: 1;
  215. display: flex;
  216. align-items: center;
  217. flex-direction: column;
  218. justify-content: center;
  219. image {
  220. width: 50rpx;
  221. height: 50rpx;
  222. }
  223. text {
  224. font-size: 24rpx;
  225. }
  226. }
  227. }
  228. }
  229. </style>