From f48b2102886e3191c757befb15af840a6ba20844 Mon Sep 17 00:00:00 2001 From: whyczyk <525500596@qq.com> Date: 星期二, 28 九月 2021 17:09:59 +0800 Subject: [PATCH] 实时告警首页提交 --- src/pages/login.vue | 304 +++++++++++++++++++++++++------------------------- 1 files changed, 152 insertions(+), 152 deletions(-) diff --git a/src/pages/login.vue b/src/pages/login.vue index e6ef2e8..e7dcfb9 100644 --- a/src/pages/login.vue +++ b/src/pages/login.vue @@ -1,171 +1,171 @@ <template> - <div class="loginDiv"> - <div class="logo-bg"></div> - <div class="login-con"> - <div class="appName">鎴愰兘鐭冲寲鍛婅APP</div> - <div class="login-title">鐧诲綍</div> - <div class="lineInput"> - <img src="../assets/img/login-ico1.png" class="ico1"> - <van-field v-model="userName" placeholder="璇疯緭鍏ヨ处鍙�" /> - </div> - <div class="lineInput"> - <img src="../assets/img/login-ico2.png" class="ico2"> - <van-field v-model="password" placeholder="璇疯緭鍏ュ瘑鐮�" type="password" /> - </div> - <div class="subBtn" @click="submit">鐧诲綍</div> - </div> + <div class="loginDiv"> + <div class="logo-bg"></div> + <div class="login-con"> + <div class="appName">鎴愰兘鐭冲寲鍛婅APP</div> + <div class="login-title">鐧诲綍</div> + <div class="lineInput"> + <img src="../assets/img/login-ico1.png" class="ico1"> + <van-field v-model="userName" placeholder="璇疯緭鍏ヨ处鍙�" /> + </div> + <div class="lineInput"> + <img src="../assets/img/login-ico2.png" class="ico2"> + <van-field v-model="password" placeholder="璇疯緭鍏ュ瘑鐮�" type="password" /> + </div> + <div class="subBtn" @click="submit">鐧诲綍</div> + </div> - </div> + </div> </template> <script> - import { - login - } from "@/assets/js/api"; - import { - mapMutations, - } from 'vuex'; - export default { - data() { - return { - userName: '', - password: '' - } - }, - mounted() { +import { + login +} from "@/assets/js/api"; +import { + mapMutations, +} from 'vuex'; +export default { + data() { + return { + userName: '', + password: '' + } + }, + mounted() { - }, - methods: { - ...mapMutations(['setUserPower']), - // 鐧诲綍 - submit() { - let self = this; - if (self.userName == '') { - self.$toast('璇疯緭鍏ヨ处鍙�!') - return - } - if (self.password == '') { - self.$toast('璇疯緭鍏ュ瘑鐮�!') - return - } - // 寮�鍚瓑寰呮 - this.$toast.loading({ - message: '鐧诲綍涓�...', - duration: 0 - }) - login(self.userName, self.password).then(res => { - // 瀵圭粨鏋滆繘琛屽鐞� - self.handleLogin(res) - }).catch(error => { - // 鍏抽棴绛夊緟 - // console.log(error); - self.$toast("缃戠粶寮傚父"); - }); - }, - // 鐧诲綍楠岃瘉 - handleLogin(res) { - let self = this; - // 鍏抽棴绛夊緟 - // this.loading = false; - let rs = JSON.parse(res.data.result); - if (rs.code == 1) { - self.$toast("鐧诲綍鎴愬姛!"); - sessionStorage.setItem('username', self.username); - sessionStorage.setItem('userId', rs.data); - self.setUserPower(rs.data2); - self.$router.push({ - path: '/index' - }) - } else { - self.$toast(rs.msg); - } - }, - } - } + }, + methods: { + ...mapMutations(['setUserPower']), + // 鐧诲綍 + submit() { + let self = this; + if (self.userName == '') { + self.$toast('璇疯緭鍏ヨ处鍙�!') + return + } + if (self.password == '') { + self.$toast('璇疯緭鍏ュ瘑鐮�!') + return + } + // 寮�鍚瓑寰呮 + this.$toast.loading({ + message: '鐧诲綍涓�...', + duration: 0 + }) + login(self.userName, self.password).then(res => { + // 瀵圭粨鏋滆繘琛屽鐞� + self.handleLogin(res) + }).catch(error => { + // 鍏抽棴绛夊緟 + // console.log(error); + self.$toast("缃戠粶寮傚父"); + }); + }, + // 鐧诲綍楠岃瘉 + handleLogin(res) { + let self = this; + // 鍏抽棴绛夊緟 + // this.loading = false; + let rs = JSON.parse(res.data.result); + if (rs.code == 1) { + self.$toast("鐧诲綍鎴愬姛!"); + sessionStorage.setItem('username', self.username); + sessionStorage.setItem('userId', rs.data); + self.setUserPower(rs.data2); + self.$router.push({ + path: '/menu' + }) + } else { + self.$toast(rs.msg); + } + }, + } +} </script> <style scoped="scoped"> - .loginDiv { - width: 100%; - height: 100%; - background: #ffffff; - padding-top: 160px; - } +.loginDiv { + width: 100%; + height: 100%; + background: #ffffff; + padding-top: 160px; +} - .logo-bg { - width: 100%; - height: 100%; - background: url('../assets/img/logo-bg.png') 0 0 no-repeat; - background-size: 100% 100%; - position: absolute; - left: 0; - top: 0; - } +.logo-bg { + width: 100%; + height: 100%; + background: url("../assets/img/logo-bg.png") 0 0 no-repeat; + background-size: 100% 100%; + position: absolute; + left: 0; + top: 0; +} - .login-con { - width: 100%; - padding: 0 70px; - position: relative; - } +.login-con { + width: 100%; + padding: 0 70px; + position: relative; +} - .appName { - color: #ffffff; - font-size: 48px; - font-weight: bold; - margin-bottom: 240px; - width: 100%; - text-align: center; - } +.appName { + color: #ffffff; + font-size: 48px; + font-weight: bold; + margin-bottom: 240px; + width: 100%; + text-align: center; +} - .login-title { - width: 110px; - height: 76px; - line-height: 76px; - font-size: 50px; - font-weight: bold; - color: #333; - border-bottom: 8px solid #4B88F9; - text-align: center; - margin-bottom: 68px; - } +.login-title { + width: 110px; + height: 76px; + line-height: 76px; + font-size: 50px; + font-weight: bold; + color: #333; + border-bottom: 8px solid #4b88f9; + text-align: center; + margin-bottom: 68px; +} - .lineInput { - width: 100%; - height: 88px; - background-color: #f5f5f5; - border-radius: 44px; - margin-bottom: 40px; - display: flex; - align-items: center; - justify-content: space-between; - padding: 0 40px; - } +.lineInput { + width: 100%; + height: 88px; + background-color: #f5f5f5; + border-radius: 44px; + margin-bottom: 40px; + display: flex; + align-items: center; + justify-content: space-between; + padding: 0 40px; +} - .lineInput .ico1 { - width: 25px; - height: 31px; - } +.lineInput .ico1 { + width: 25px; + height: 31px; +} - .lineInput .ico2 { - width: 26px; - height: 31px; - } +.lineInput .ico2 { + width: 26px; + height: 31px; +} - .lineInput /deep/ .van-cell { - background-color: transparent; - } +.lineInput /deep/ .van-cell { + background-color: transparent; +} - .subBtn { - width: 100%; - height: 88px; - border-radius: 44px; - background-image: linear-gradient(to right, #08aeec, #4B88F9); - box-shadow: 0 10px 20px rgb(85 149 246 / 50%); - display: flex; - align-items: center; - justify-content: center; - color: #ffffff; - font-size: 32px; - margin-top: 50px; - } +.subBtn { + width: 100%; + height: 88px; + border-radius: 44px; + background-image: linear-gradient(to right, #08aeec, #4b88f9); + box-shadow: 0 10px 20px rgb(85 149 246 / 50%); + display: flex; + align-items: center; + justify-content: center; + color: #ffffff; + font-size: 32px; + margin-top: 50px; +} </style> \ No newline at end of file -- Gitblit v1.9.1