123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481 |
- <template>
- <view class="login">
- <view class="container">
- <!--插画-->
- <view class="right-top-sign"></view>
- <view class="wrapper">
- <view class="left-top-sign">LOGIN</view>
- <view class="welcome">
- 园林局移动办公平台
- </view>
- <u-image width="500" height="500" :src="src2"></u-image>
- <view class="input-content">
- <view class="input-item">
- <text class="tit">用户名</text>
- <input v-model="username" placeholder="请输入用户名" :focus="isfocus1" @confirm="confirm('1')" />
- </view>
- <view class="input-item">
- <text class="tit">密码</text>
- <input type="password" v-model="password" placeholder="请输入密码" maxlength="20" :focus="isfocus2"
- @confirm="confirm('2')" />
- </view>
- <view class="input-item input-item-sms-code">
- <view class="input-wrapper">
- <view class="oa-input-wrapper">
- <view class="tit">验证码:</view>
- <input v-model="captcha" placeholder="请输入验证码" maxlength="4" data-key="mobile"
- :focus="isfocus3" @confirm="confirm('3')" />
- </view>
- <view @click="getCaptcha()">
- <img class="sms-code-img" v-bind:src="src" width="100%" height="100%"></img>
- </view>
- </view>
- </view>
- <view>
- <button class="confirm-btn" :class="'bg-' + themeColor.name" v-on:click="prelogin()">
- 登录
- </button>
- <!-- <view style="float: right;margin-top: 5px;margin-right: 10px;" @click="backIndex()">返回首页</view> -->
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- toastMsg
- } from '@/pages/toast/toast.js'
- export default {
- components: {
- },
- data() {
- return {
- smsCodeBtnDisabled: false,
- src: "",
- uuid: "",
- captcha: "",
- username: "",
- password: "",
- token: "",
- isfocus1: true,
- isfocus2: false,
- isfocus3: false,
- src2:'@/static/logo.png'
- };
- },
- created() {
- this.checkStatus();
- this.getCaptcha();
- },
- methods: {
- checkStatus() {
- },
- confirm(index) {
- switch (index) {
- case '1':
- this.isfocus1 = false;
- this.isfocus2 = true;
- this.isfocus3 = false;
- break;
- case '2':
- this.isfocus1 = false;
- this.isfocus2 = false;
- this.isfocus3 = true;
- break;
- case '3':
- this.isfocus1 = false;
- this.isfocus2 = false;
- this.isfocus3 = false;
- this.prelogin();
- break;
- }
- },
- getCaptcha() {
- var url = this.$mConfig.baseUrl + '/captchaImage';
- var that = this;
- uni.request({
- url: url,
- success: (res) => {
- that.src = "data:image/gif;base64," + res.data.img;
- that.uuid = res.data.uuid;
- }
- });
- },
- prelogin() {
- if (this.username == '') {
- toastMsg('warning', "请输入用户名");
- return false;
- }
- if (this.password == '') {
- toastMsg('warning', "请输入密码");
- return false;
- }
- if (this.captcha == '') {
- toastMsg('warning', "请输入验证码");
- return false;
- }
- toastMsg("loading", "奋力加载中..");
- this.login();
- },
- login() {
- var url = this.$mConfig.baseUrl + '/appinterface/login';
- var that = this;
- uni.request({
- url: url,
- method: "POST",
- data: {
- username: this.username,
- password: this.password,
- code: this.captcha,
- uuid: this.uuid
- },
- dataType: "JSON",
- success: (res) => {
- uni.hideToast();
- if (res.statusCode == "200") {
- var data = res.data;
- if (data != null) {
- if (data.code == "200") {
- toastMsg("success", "登录成功");
- //保存登录状态信息
- that.token = data.token;
- that.$store.commit('login', data);
- that.getTabBarBadge();
- uni.reLaunch({
- url: '../index/index'
- });
- } else {
- that.getCaptcha();
- toastMsg("warning", data.msg);
- }
- }
- } else {
- that.getCaptcha();
- toastMsg("warning", "网络异常");
- }
- }
- });
- },
- backIndex() {
- uni.reLaunch({
- url: '../index/index'
- });
- }
- }
- }
- </script>
- <style lang="scss">
- page {
- background: $color-white;
- }
- .container {
- padding-top: 115px;
- position: relative;
- width: 100vw;
- overflow: hidden;
- background: #fff;
- .wrapper {
- position: relative;
- z-index: 90;
- background: #fff;
- padding-bottom: 40upx;
- }
- .back-btn {
- position: absolute;
- left: 40upx;
- z-index: 9999;
- padding-top: var(--status-bar-height);
- top: 40upx;
- font-size: 40upx;
- color: $font-color-dark;
- }
- .left-top-sign {
- font-size: 120upx;
- color: $page-color-base;
- position: relative;
- left: -16upx;
- }
- .right-top-sign {
- position: absolute;
- top: 80upx;
- right: -30upx;
- z-index: 95;
- &:before,
- &:after {
- display: block;
- content: '';
- width: 400upx;
- height: 80upx;
- background: #b4f3e2;
- }
- &:before {
- transform: rotate(50deg);
- border-radius: 0 50px 0 0;
- }
- &:after {
- position: absolute;
- right: -198upx;
- top: 0;
- transform: rotate(-50deg);
- border-radius: 50px 0 0 0;
- /* background: pink; */
- }
- }
- .left-bottom-sign {
- position: absolute;
- left: -270upx;
- bottom: -320upx;
- border: 100upx solid #d0d1fd;
- border-radius: 50%;
- padding: 180upx;
- }
- .welcome {
- position: relative;
- left: 50upx;
- top: -90upx;
- font-size: 46upx;
- color: #555;
- text-shadow: 1px 0px 1px rgba(0, 0, 0, 0.3);
- }
- .input-content {
- padding: 0 60upx;
- }
- .input-item {
- display: flex;
- flex-direction: column;
- align-items: flex-start;
- justify-content: center;
- padding: 0 30upx;
- background: $page-color-light;
- height: 120upx;
- border-radius: 4px;
- margin-bottom: 50upx;
- &:last-child {
- margin-bottom: 0;
- }
- .tit {
- height: 50upx;
- line-height: 56upx;
- font-size: $font-sm + 2upx;
- color: $font-color-base;
- }
- input {
- height: 60upx;
- font-size: $font-base + 2upx;
- color: $font-color-dark;
- width: 100%;
- }
- }
- .input-item-sms-code {
- position: relative;
- width: 100%;
- .sms-code-btn {
- position: absolute;
- color: #111;
- right: 20upx;
- bottom: 20upx;
- font-size: 28upx;
- }
- .sms-code-btn,
- sms-code-resend {
- width: 240upx;
- font-size: $font-base - 2upx;
- }
- .sms-code-resend {
- color: #999;
- }
- .sms-code-btn:after {
- border: none;
- background-color: transparent;
- }
- }
- .forget-section {
- font-size: $font-sm + 2upx;
- color: $font-color-spec;
- text-align: center;
- margin-top: 40upx;
- }
- .register-section {
- margin: 30upx 0 50upx 0;
- width: 100%;
- font-size: $font-sm + 2upx;
- color: $font-color-base;
- text-align: center;
- text {
- color: $font-color-spec;
- margin-left: 10upx;
- }
- text:first-child {
- margin-right: 10upx;
- }
- }
- .btn-group {
- display: flex;
- margin-bottom: 20upx;
- }
- }
- .login-type-2 {
- width: 100%;
- position: relative;
- .back-btn {
- position: absolute;
- left: 40upx;
- z-index: 9999;
- padding-top: var(--status-bar-height);
- top: 40upx;
- font-size: 48upx;
- color: $color-white;
- }
- .login-top {
- height: 460upx;
- position: relative;
- .desc {
- position: absolute;
- top: 200upx;
- left: 40upx;
- font-size: 48upx;
- .title {
- font-size: 48upx;
- }
- }
- .login-pic {
- position: absolute;
- width: 220upx;
- height: 270upx;
- right: 30upx;
- top: 100upx;
- }
- }
- .login-type-content {
- position: relative;
- top: -72upx;
- .login-bg {
- width: 94vw;
- height: 94vw;
- margin: 0 3vw;
- }
- .main {
- width: 94vw;
- position: absolute;
- top: 0;
- left: 3vw;
- .nav-bar {
- display: flex;
- height: 100upx;
- justify-content: center;
- align-items: center;
- position: relative;
- z-index: 10;
- .nav-bar-item {
- flex: 1;
- display: flex;
- height: 100%;
- line-height: 96upx;
- font-size: $font-lg;
- display: flex;
- margin: 0 120upx;
- justify-content: center;
- }
- .nav-bar-item-active {
- border-bottom: 5upx solid;
- }
- }
- .login-type-form {
- width: 80%;
- margin: 50upx auto;
- .input-item {
- position: relative;
- height: 90upx;
- line-height: 90upx;
- margin-bottom: $spacing-lg;
- .iconfont {
- font-size: 50upx;
- position: absolute;
- left: 0;
- }
- .login-type-input {
- height: 90upx;
- padding-left: 80upx;
- border-bottom: 1upx solid rgba(0, 0, 0, .1);
- }
- }
- }
- .login-type-tips {
- padding: 0 50upx;
- display: flex;
- justify-content: space-between;
- }
- .confirm-btn {
- height: 80upx;
- line-height: 80upx;
- }
- }
- }
- .login-type-bottom {
- width: 100%;
- padding-bottom: 30upx;
- text-align: center;
- font-size: $font-lg;
- }
- .sms-code-img {
- position: absolute;
- color: #111;
- right: 9px;
- bottom: 9px;
- font-size: 13px;
- }
- }
- </style>
|