loginoriginal.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  1. <template>
  2. <view class="login">
  3. <view class="container">
  4. <!--插画-->
  5. <view class="right-top-sign"></view>
  6. <view class="wrapper">
  7. <view class="left-top-sign">LOGIN</view>
  8. <view class="welcome">
  9. 园林局移动办公平台
  10. </view>
  11. <u-image width="500" height="500" :src="src2"></u-image>
  12. <view class="input-content">
  13. <view class="input-item">
  14. <text class="tit">用户名</text>
  15. <input v-model="username" placeholder="请输入用户名" :focus="isfocus1" @confirm="confirm('1')" />
  16. </view>
  17. <view class="input-item">
  18. <text class="tit">密码</text>
  19. <input type="password" v-model="password" placeholder="请输入密码" maxlength="20" :focus="isfocus2"
  20. @confirm="confirm('2')" />
  21. </view>
  22. <view class="input-item input-item-sms-code">
  23. <view class="input-wrapper">
  24. <view class="oa-input-wrapper">
  25. <view class="tit">验证码:</view>
  26. <input v-model="captcha" placeholder="请输入验证码" maxlength="4" data-key="mobile"
  27. :focus="isfocus3" @confirm="confirm('3')" />
  28. </view>
  29. <view @click="getCaptcha()">
  30. <img class="sms-code-img" v-bind:src="src" width="100%" height="100%"></img>
  31. </view>
  32. </view>
  33. </view>
  34. <view>
  35. <button class="confirm-btn" :class="'bg-' + themeColor.name" v-on:click="prelogin()">
  36. 登录
  37. </button>
  38. <!-- <view style="float: right;margin-top: 5px;margin-right: 10px;" @click="backIndex()">返回首页</view> -->
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </template>
  46. <script>
  47. import {
  48. toastMsg
  49. } from '@/pages/toast/toast.js'
  50. export default {
  51. components: {
  52. },
  53. data() {
  54. return {
  55. smsCodeBtnDisabled: false,
  56. src: "",
  57. uuid: "",
  58. captcha: "",
  59. username: "",
  60. password: "",
  61. token: "",
  62. isfocus1: true,
  63. isfocus2: false,
  64. isfocus3: false,
  65. src2:'@/static/logo.png'
  66. };
  67. },
  68. created() {
  69. this.checkStatus();
  70. this.getCaptcha();
  71. },
  72. methods: {
  73. checkStatus() {
  74. },
  75. confirm(index) {
  76. switch (index) {
  77. case '1':
  78. this.isfocus1 = false;
  79. this.isfocus2 = true;
  80. this.isfocus3 = false;
  81. break;
  82. case '2':
  83. this.isfocus1 = false;
  84. this.isfocus2 = false;
  85. this.isfocus3 = true;
  86. break;
  87. case '3':
  88. this.isfocus1 = false;
  89. this.isfocus2 = false;
  90. this.isfocus3 = false;
  91. this.prelogin();
  92. break;
  93. }
  94. },
  95. getCaptcha() {
  96. var url = this.$mConfig.baseUrl + '/captchaImage';
  97. var that = this;
  98. uni.request({
  99. url: url,
  100. success: (res) => {
  101. that.src = "data:image/gif;base64," + res.data.img;
  102. that.uuid = res.data.uuid;
  103. }
  104. });
  105. },
  106. prelogin() {
  107. if (this.username == '') {
  108. toastMsg('warning', "请输入用户名");
  109. return false;
  110. }
  111. if (this.password == '') {
  112. toastMsg('warning', "请输入密码");
  113. return false;
  114. }
  115. if (this.captcha == '') {
  116. toastMsg('warning', "请输入验证码");
  117. return false;
  118. }
  119. toastMsg("loading", "奋力加载中..");
  120. this.login();
  121. },
  122. login() {
  123. var url = this.$mConfig.baseUrl + '/appinterface/login';
  124. var that = this;
  125. uni.request({
  126. url: url,
  127. method: "POST",
  128. data: {
  129. username: this.username,
  130. password: this.password,
  131. code: this.captcha,
  132. uuid: this.uuid
  133. },
  134. dataType: "JSON",
  135. success: (res) => {
  136. uni.hideToast();
  137. if (res.statusCode == "200") {
  138. var data = res.data;
  139. if (data != null) {
  140. if (data.code == "200") {
  141. toastMsg("success", "登录成功");
  142. //保存登录状态信息
  143. that.token = data.token;
  144. that.$store.commit('login', data);
  145. that.getTabBarBadge();
  146. uni.reLaunch({
  147. url: '../index/index'
  148. });
  149. } else {
  150. that.getCaptcha();
  151. toastMsg("warning", data.msg);
  152. }
  153. }
  154. } else {
  155. that.getCaptcha();
  156. toastMsg("warning", "网络异常");
  157. }
  158. }
  159. });
  160. },
  161. backIndex() {
  162. uni.reLaunch({
  163. url: '../index/index'
  164. });
  165. }
  166. }
  167. }
  168. </script>
  169. <style lang="scss">
  170. page {
  171. background: $color-white;
  172. }
  173. .container {
  174. padding-top: 115px;
  175. position: relative;
  176. width: 100vw;
  177. overflow: hidden;
  178. background: #fff;
  179. .wrapper {
  180. position: relative;
  181. z-index: 90;
  182. background: #fff;
  183. padding-bottom: 40upx;
  184. }
  185. .back-btn {
  186. position: absolute;
  187. left: 40upx;
  188. z-index: 9999;
  189. padding-top: var(--status-bar-height);
  190. top: 40upx;
  191. font-size: 40upx;
  192. color: $font-color-dark;
  193. }
  194. .left-top-sign {
  195. font-size: 120upx;
  196. color: $page-color-base;
  197. position: relative;
  198. left: -16upx;
  199. }
  200. .right-top-sign {
  201. position: absolute;
  202. top: 80upx;
  203. right: -30upx;
  204. z-index: 95;
  205. &:before,
  206. &:after {
  207. display: block;
  208. content: '';
  209. width: 400upx;
  210. height: 80upx;
  211. background: #b4f3e2;
  212. }
  213. &:before {
  214. transform: rotate(50deg);
  215. border-radius: 0 50px 0 0;
  216. }
  217. &:after {
  218. position: absolute;
  219. right: -198upx;
  220. top: 0;
  221. transform: rotate(-50deg);
  222. border-radius: 50px 0 0 0;
  223. /* background: pink; */
  224. }
  225. }
  226. .left-bottom-sign {
  227. position: absolute;
  228. left: -270upx;
  229. bottom: -320upx;
  230. border: 100upx solid #d0d1fd;
  231. border-radius: 50%;
  232. padding: 180upx;
  233. }
  234. .welcome {
  235. position: relative;
  236. left: 50upx;
  237. top: -90upx;
  238. font-size: 46upx;
  239. color: #555;
  240. text-shadow: 1px 0px 1px rgba(0, 0, 0, 0.3);
  241. }
  242. .input-content {
  243. padding: 0 60upx;
  244. }
  245. .input-item {
  246. display: flex;
  247. flex-direction: column;
  248. align-items: flex-start;
  249. justify-content: center;
  250. padding: 0 30upx;
  251. background: $page-color-light;
  252. height: 120upx;
  253. border-radius: 4px;
  254. margin-bottom: 50upx;
  255. &:last-child {
  256. margin-bottom: 0;
  257. }
  258. .tit {
  259. height: 50upx;
  260. line-height: 56upx;
  261. font-size: $font-sm + 2upx;
  262. color: $font-color-base;
  263. }
  264. input {
  265. height: 60upx;
  266. font-size: $font-base + 2upx;
  267. color: $font-color-dark;
  268. width: 100%;
  269. }
  270. }
  271. .input-item-sms-code {
  272. position: relative;
  273. width: 100%;
  274. .sms-code-btn {
  275. position: absolute;
  276. color: #111;
  277. right: 20upx;
  278. bottom: 20upx;
  279. font-size: 28upx;
  280. }
  281. .sms-code-btn,
  282. sms-code-resend {
  283. width: 240upx;
  284. font-size: $font-base - 2upx;
  285. }
  286. .sms-code-resend {
  287. color: #999;
  288. }
  289. .sms-code-btn:after {
  290. border: none;
  291. background-color: transparent;
  292. }
  293. }
  294. .forget-section {
  295. font-size: $font-sm + 2upx;
  296. color: $font-color-spec;
  297. text-align: center;
  298. margin-top: 40upx;
  299. }
  300. .register-section {
  301. margin: 30upx 0 50upx 0;
  302. width: 100%;
  303. font-size: $font-sm + 2upx;
  304. color: $font-color-base;
  305. text-align: center;
  306. text {
  307. color: $font-color-spec;
  308. margin-left: 10upx;
  309. }
  310. text:first-child {
  311. margin-right: 10upx;
  312. }
  313. }
  314. .btn-group {
  315. display: flex;
  316. margin-bottom: 20upx;
  317. }
  318. }
  319. .login-type-2 {
  320. width: 100%;
  321. position: relative;
  322. .back-btn {
  323. position: absolute;
  324. left: 40upx;
  325. z-index: 9999;
  326. padding-top: var(--status-bar-height);
  327. top: 40upx;
  328. font-size: 48upx;
  329. color: $color-white;
  330. }
  331. .login-top {
  332. height: 460upx;
  333. position: relative;
  334. .desc {
  335. position: absolute;
  336. top: 200upx;
  337. left: 40upx;
  338. font-size: 48upx;
  339. .title {
  340. font-size: 48upx;
  341. }
  342. }
  343. .login-pic {
  344. position: absolute;
  345. width: 220upx;
  346. height: 270upx;
  347. right: 30upx;
  348. top: 100upx;
  349. }
  350. }
  351. .login-type-content {
  352. position: relative;
  353. top: -72upx;
  354. .login-bg {
  355. width: 94vw;
  356. height: 94vw;
  357. margin: 0 3vw;
  358. }
  359. .main {
  360. width: 94vw;
  361. position: absolute;
  362. top: 0;
  363. left: 3vw;
  364. .nav-bar {
  365. display: flex;
  366. height: 100upx;
  367. justify-content: center;
  368. align-items: center;
  369. position: relative;
  370. z-index: 10;
  371. .nav-bar-item {
  372. flex: 1;
  373. display: flex;
  374. height: 100%;
  375. line-height: 96upx;
  376. font-size: $font-lg;
  377. display: flex;
  378. margin: 0 120upx;
  379. justify-content: center;
  380. }
  381. .nav-bar-item-active {
  382. border-bottom: 5upx solid;
  383. }
  384. }
  385. .login-type-form {
  386. width: 80%;
  387. margin: 50upx auto;
  388. .input-item {
  389. position: relative;
  390. height: 90upx;
  391. line-height: 90upx;
  392. margin-bottom: $spacing-lg;
  393. .iconfont {
  394. font-size: 50upx;
  395. position: absolute;
  396. left: 0;
  397. }
  398. .login-type-input {
  399. height: 90upx;
  400. padding-left: 80upx;
  401. border-bottom: 1upx solid rgba(0, 0, 0, .1);
  402. }
  403. }
  404. }
  405. .login-type-tips {
  406. padding: 0 50upx;
  407. display: flex;
  408. justify-content: space-between;
  409. }
  410. .confirm-btn {
  411. height: 80upx;
  412. line-height: 80upx;
  413. }
  414. }
  415. }
  416. .login-type-bottom {
  417. width: 100%;
  418. padding-bottom: 30upx;
  419. text-align: center;
  420. font-size: $font-lg;
  421. }
  422. .sms-code-img {
  423. position: absolute;
  424. color: #111;
  425. right: 9px;
  426. bottom: 9px;
  427. font-size: 13px;
  428. }
  429. }
  430. </style>