login.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  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 accountLogin from "./components/account-login.vue";
  66. import smsLogin from "./components/sms-login.vue";
  67. export default {
  68. components:{
  69. accountLogin,
  70. smsLogin
  71. },
  72. data(){
  73. return {
  74. loginList:[
  75. // {
  76. // name: "验证码登录",
  77. // id: 1,
  78. // },
  79. {
  80. name: "密码登录",
  81. id: 2,
  82. },
  83. ],
  84. loginType:2,
  85. barHeight:0.,
  86. protocol:false,
  87. isLogin:true,
  88. isDisabled:false
  89. }
  90. },
  91. onLoad() {
  92. },
  93. methods:{
  94. loginTypeClick(item) {
  95. this.loginType = item.id;
  96. },
  97. // 忘记密码
  98. changePassword() {
  99. uni.navigateTo({
  100. url: "/pages/login/forget-password",
  101. });
  102. },
  103. //勾选协议
  104. onChange() {
  105. this.protocol = !this.protocol;
  106. },
  107. // 查看协议
  108. onProtocol(id, title, key) {
  109. uni.navigateTo({
  110. url: `/pages/public/richtext?id=${id}&title=${title}&key=${key}`,
  111. });
  112. },
  113. // 登录
  114. toLogin(){
  115. // 同意协议
  116. // if (!this.protocol) {
  117. // uni.$u.toast("请先阅读并勾选协议");
  118. // return;
  119. // }
  120. if (this.loginType == 1) {
  121. this.$refs.smsLoginRef.smsLoginSubmit();
  122. } else {
  123. this.$refs.accountLoginRef.accountLoginSubmit();
  124. }
  125. },
  126. // 注册下一步
  127. nextClick(){
  128. if (this.protocol) {
  129. uni.$u.toast("请先阅读并勾选协议");
  130. return;
  131. }
  132. this.isDisabled = true;
  133. // const res = await smsRegisterRef.value.smsRegisterSubmit();
  134. }
  135. }
  136. }
  137. </script>
  138. <style lang="scss" scoped>
  139. .content-block {
  140. min-height: 100vh;
  141. display: flex;
  142. flex-direction: column;
  143. // align-items: center;
  144. // height: calc(100vh - v-bind(barHeight));
  145. padding: 0 30rpx;
  146. padding-top: var(--status-bar-height);
  147. background: url('@/static/image/login/page-bg.png') no-repeat;
  148. background-size: 100% 100%;
  149. .text-box {
  150. color: #1A1A1A;
  151. margin-top: 74rpx;
  152. .text-box-1 {
  153. font-family: "PingFang SC";
  154. font-size: 80rpx;
  155. font-weight: 600;
  156. }
  157. .text-box-2 {
  158. font-family: "PingFang SC";
  159. font-size: 32rpx;
  160. font-weight: 500;
  161. }
  162. }
  163. .input-box {
  164. z-index: 3;
  165. border-radius: 40rpx 40rpx 0 0;
  166. flex: 1;
  167. width: 100%;
  168. padding: 40rpx 30rpx 30rpx;
  169. margin-top: 30rpx;
  170. box-sizing: border-box;
  171. display: flex;
  172. flex-direction: column;
  173. justify-content: space-between;
  174. background: url('@/static/image/login/box-bg.png') no-repeat;
  175. background-size: 100% 100%;
  176. .login-box {
  177. &-tab {
  178. color: #999;
  179. font-size: 32rpx;
  180. font-weight: 400;
  181. line-height: normal;
  182. display: flex;
  183. margin-bottom: 50rpx;
  184. }
  185. .activeLogin {
  186. color: #333;
  187. font-weight: 600;
  188. position: relative;
  189. z-index: 2;
  190. &::after {
  191. content: "";
  192. display: block;
  193. width: 66rpx;
  194. height: 12rpx;
  195. background-color: #0256FF;
  196. border-radius: 52rpx;
  197. position: absolute;
  198. bottom: 0;
  199. left: 50%;
  200. transform: translateX(-50%);
  201. z-index: -1;
  202. }
  203. }
  204. }
  205. }
  206. .toLoginBtn {
  207. height: 88rpx;
  208. background: linear-gradient(90deg, #59C0E9 0%, #0256FF 100%);
  209. border-radius: 16rpx;
  210. color: #fff;
  211. margin-bottom: 32rpx;
  212. margin-top: 30rpx;
  213. }
  214. .toRegisterBtn {
  215. color: #333;
  216. border: 1px solid #bfc8db;
  217. border-radius: 16rpx;
  218. height: 88rpx;
  219. }
  220. .forget-box {
  221. color: #adb5bd;
  222. font-size: 24rpx;
  223. font-style: normal;
  224. font-weight: 400;
  225. line-height: normal;
  226. text-align: right;
  227. margin-top: 14rpx;
  228. text {
  229. color: #f39801;
  230. }
  231. }
  232. .agreement-box {
  233. .tcp-text {
  234. color: #f49700;
  235. }
  236. .agreement-text {
  237. color: #adb5bd;
  238. font-size: 24rpx;
  239. }
  240. .isAgreement {
  241. color: #333;
  242. }
  243. .safe-box {
  244. height: calc(constant(safe-area-inset-bottom) / 5 * 3);
  245. height: calc(env(safe-area-inset-bottom) / 5 * 3);
  246. }
  247. }
  248. }
  249. </style>