login.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <template>
  2. <view class="content-block">
  3. <view class="text-box">
  4. <view class="text-box-1">Hello!</view>
  5. <view class="text-box-2">欢迎使用象力WMS系统</view>
  6. </view>
  7. <view class="input-box">
  8. <!-- 登录 -->
  9. <view class="login-box" v-if="isLogin">
  10. <view class="login-box-tab">
  11. <view
  12. class="ss-m-r-16"
  13. v-for="(item, i) in loginList"
  14. :key="i"
  15. :class="loginType == item.id ? 'activeLogin' : ''"
  16. @click="loginTypeClick(item)"
  17. >{{ item.name }}</view
  18. >
  19. </view>
  20. <view>
  21. <sms-login v-if="loginType == 1" ref="smsLoginRef"></sms-login>
  22. <account-login
  23. v-if="loginType == 2"
  24. ref="accountLoginRef"
  25. ></account-login>
  26. <button class="toLoginBtn ss-reset-button" @tap="toLogin">
  27. 登 录
  28. </button>
  29. <view class="forget-box" @click="changePassword">忘记密码?</view>
  30. </view>
  31. </view>
  32. <!-- <view class="agreement-box flex_box">
  33. <radio
  34. :checked="protocol"
  35. color="var(&#45;&#45;ui-BG-Main)"
  36. style="transform: scale(0.8)"
  37. @tap.top="onChange"
  38. />
  39. <view class="agreement-text flex_box" :class="{'isAgreement': protocol}">
  40. 我已阅读并同意
  41. <view
  42. class="tcp-text"
  43. @tap.stop="
  44. onProtocol(1, '用户协议', 'small:program:user:agreement')
  45. "
  46. >
  47. 《用户协议》
  48. </view>
  49. <view class="agreement-text" :class="{'isAgreement': protocol}">和</view>
  50. <view
  51. class="tcp-text"
  52. @tap.stop="
  53. onProtocol(2, '隐私条款', 'small:program:privacy:agreement')
  54. "
  55. >
  56. 《隐私条款》
  57. </view>
  58. </view> -->
  59. <view class="safe-box"></view>
  60. </view>
  61. </view>
  62. </view>
  63. </template>
  64. <script>
  65. import { onLoad, onShow } from "@dcloudio/uni-app";
  66. import accountLogin from "./components/account-login.vue";
  67. import smsLogin from "./components/sms-login.vue";
  68. // import smsRegister from "./components/sms-register.vue";
  69. export default {
  70. components:{
  71. accountLogin,
  72. smsLogin
  73. },
  74. data(){
  75. return {
  76. loginList:[
  77. {
  78. name: "验证码登录",
  79. id: 1,
  80. },
  81. {
  82. name: "密码登录",
  83. id: 2,
  84. },
  85. ],
  86. loginType:2,
  87. barHeight:0.,
  88. protocol:false,
  89. isLogin:true,
  90. isDisabled:false
  91. }
  92. },
  93. onLoad() {
  94. },
  95. methods:{
  96. loginTypeClick(item) {
  97. this.loginType = item.id;
  98. },
  99. // 忘记密码
  100. changePassword() {
  101. uni.navigateTo({
  102. url: "/pages/login/forget-password",
  103. });
  104. },
  105. //勾选协议
  106. onChange() {
  107. this.protocol = !this.protocol;
  108. },
  109. // 查看协议
  110. onProtocol(id, title, key) {
  111. uni.navigateTo({
  112. url: `/pages/public/richtext?id=${id}&title=${title}&key=${key}`,
  113. });
  114. },
  115. // 登录
  116. toLogin(){
  117. // 同意协议
  118. // if (!this.protocol) {
  119. // uni.$u.toast("请先阅读并勾选协议");
  120. // return;
  121. // }
  122. if (this.loginType == 1) {
  123. this.$refs.smsLoginRef.smsLoginSubmit();
  124. } else {
  125. this.$refs.accountLoginRef.accountLoginSubmit();
  126. }
  127. },
  128. // 注册下一步
  129. nextClick(){
  130. if (this.protocol) {
  131. uni.$u.toast("请先阅读并勾选协议");
  132. return;
  133. }
  134. this.isDisabled = true;
  135. // const res = await smsRegisterRef.value.smsRegisterSubmit();
  136. }
  137. }
  138. }
  139. </script>
  140. <style lang="scss" scoped>
  141. .content-block {
  142. min-height: 100vh;
  143. display: flex;
  144. flex-direction: column;
  145. // align-items: center;
  146. // height: calc(100vh - v-bind(barHeight));
  147. padding: 0 30rpx;
  148. padding-top: var(--status-bar-height);
  149. background: url('@/static/image/login/page-bg.png') no-repeat;
  150. background-size: 100% 100%;
  151. .text-box {
  152. color: #1A1A1A;
  153. margin-top: 74rpx;
  154. .text-box-1 {
  155. font-family: "PingFang SC";
  156. font-size: 80rpx;
  157. font-weight: 600;
  158. }
  159. .text-box-2 {
  160. font-family: "PingFang SC";
  161. font-size: 32rpx;
  162. font-weight: 500;
  163. }
  164. }
  165. .input-box {
  166. z-index: 3;
  167. border-radius: 40rpx 40rpx 0 0;
  168. flex: 1;
  169. width: 100%;
  170. padding: 40rpx 30rpx 30rpx;
  171. margin-top: 30rpx;
  172. box-sizing: border-box;
  173. display: flex;
  174. flex-direction: column;
  175. justify-content: space-between;
  176. background: url('@/static/image/login/box-bg.png') no-repeat;
  177. background-size: 100% 100%;
  178. .login-box {
  179. &-tab {
  180. color: #999;
  181. font-size: 32rpx;
  182. font-weight: 400;
  183. line-height: normal;
  184. display: flex;
  185. margin-bottom: 50rpx;
  186. }
  187. .activeLogin {
  188. color: #333;
  189. font-weight: 600;
  190. position: relative;
  191. z-index: 2;
  192. &::after {
  193. content: "";
  194. display: block;
  195. width: 66rpx;
  196. height: 12rpx;
  197. background-color: #0256FF;
  198. border-radius: 52rpx;
  199. position: absolute;
  200. bottom: 0;
  201. left: 50%;
  202. transform: translateX(-50%);
  203. z-index: -1;
  204. }
  205. }
  206. }
  207. }
  208. .toLoginBtn {
  209. height: 88rpx;
  210. background: linear-gradient(90deg, #59C0E9 0%, #0256FF 100%);
  211. border-radius: 16rpx;
  212. color: #fff;
  213. margin-bottom: 32rpx;
  214. margin-top: 30rpx;
  215. }
  216. .toRegisterBtn {
  217. color: #333;
  218. border: 1px solid #bfc8db;
  219. border-radius: 16rpx;
  220. height: 88rpx;
  221. }
  222. .forget-box {
  223. color: #adb5bd;
  224. font-size: 24rpx;
  225. font-style: normal;
  226. font-weight: 400;
  227. line-height: normal;
  228. text-align: right;
  229. margin-top: 14rpx;
  230. text {
  231. color: #f39801;
  232. }
  233. }
  234. .agreement-box {
  235. .tcp-text {
  236. color: #f49700;
  237. }
  238. .agreement-text {
  239. color: #adb5bd;
  240. font-size: 24rpx;
  241. }
  242. .isAgreement {
  243. color: #333;
  244. }
  245. .safe-box {
  246. height: calc(constant(safe-area-inset-bottom) / 5 * 3);
  247. height: calc(env(safe-area-inset-bottom) / 5 * 3);
  248. }
  249. }
  250. }
  251. </style>