From 829517bc9c6ff792c93be3ddbeff0e4d1dfca648 Mon Sep 17 00:00:00 2001 From: zhangzengfei <zhangzengfei@smartai.com> Date: 星期三, 15 九月 2021 17:21:04 +0800 Subject: [PATCH] fix run serve. user npm 7.12.0 --- src/pages/index/App.vue | 131 ++++++++++++++++++++++++++++++------------- 1 files changed, 90 insertions(+), 41 deletions(-) diff --git a/src/pages/index/App.vue b/src/pages/index/App.vue index bb2b52f..2d1738b 100644 --- a/src/pages/index/App.vue +++ b/src/pages/index/App.vue @@ -1,7 +1,7 @@ <template> <div class v-loading="vLoading" :style="`width: ${currentWidth}px;height:${currentHeight}px`"> <div class="web-site"> - <a href="http://www.aiotlink.com" target="_blank">www.aiotlink.com</a> + <a href="http://www.smartai.com" target="_blank">www.smartai.com</a> </div> <licence /> <div class="right-bg" style> @@ -45,7 +45,15 @@ </el-form-item> </el-form> </div> - <p class="gradient-text gradient-text-one">鈥斺�斺�� {{serverTitle || '鏅� 鑳� 璁� 绠� 鑺� 鐐� 鈥� ReID'}} 鈥斺�斺��</p> + <!-- <p class="gradient-text gradient-text-one">鈥斺�斺�� {{serverTitle || 'SmartAI 鈥� ReID'}} 鈥斺�斺��</p> --> + <p class="gradient-text gradient-text-one"> + 鈥斺�� + <b>SmartAI</b> 浜哄伐鏅鸿兘鎿嶄綔绯荤粺 鈥斺�� + </p> + <p + class="gradient-text gradient-text-one" + style="letter-spacing: 1.8px;font-size:15px;" + >V1.0.0</p> </div> </div> </template> @@ -54,6 +62,7 @@ import { tologin, getLoginUserData, getServerName } from './api.ts' import ParticleNetwork from './ParticleNetwork' import Licence from '@/components/licence' +import { getMenuListData } from "@/api/utils"; export default { name: 'login-pgae', @@ -83,7 +92,41 @@ currentHeight: 1057, currentWidth: 1920 }), + created() { + this.getServerName() + this.getScreenHeight() + }, + mounted() { + // 鑷姩鐧诲綍鎺ュ彛 + this.loginRobot(); + }, + watch: {}, + beforeDestroy() { + window.onresize = null + }, methods: { + loginRobot() { + // 瑙f瀽璺敱鍙傛暟锛屽苟缂撳瓨 + let user = this.getQueryVariable("username"); + let passwd = this.getQueryVariable("password"); + if (user.length && passwd.length) { + sessionStorage.setItem("autoLogin", JSON.stringify({ username: user, passwd: passwd })); + + this.user.loginName = user; + this.user.password = passwd; + this.systemLogin(); + return; + } + + // 鐧婚檰瓒呮椂鍚庣殑閲嶆柊鐧婚檰 + let sessionInfo = sessionStorage.getItem('autoLogin'); + if (sessionInfo) { + let authority = JSON.parse(sessionInfo); + this.user.loginName = authority.username; + this.user.password = authority.passwd; + this.systemLogin(); + } + }, systemLogin() { this.nullRule = this.rules this.$nextTick(() => { @@ -96,7 +139,6 @@ background: 'rgba(0, 0, 0, 0.7)' }) this.testLogin() - // return false } else { this.nullRule = {} } @@ -105,9 +147,9 @@ }) }, async testLogin() { + // location.assign("/view/desktop/") tologin({ username: this.user.loginName, password: this.user.password }) .then(json => { - // console.log(json, "鐧诲綍璇锋眰"); const loginedInfo = { access_token: json.token_type + ' ' + json.access_token, refresh_token: json.refresh_token @@ -118,48 +160,35 @@ this.getLoginUserData() }) .catch(err => { - // console.log(err, "鐧诲綍鎶ラ敊"); this.loading.close() this.$notify({ title: '鎻愮ず', type: 'error', - message: err + message: err.msg }) this.$refs.pwd.focus() }) }, async getLoginUserData() { - let json = await getLoginUserData() - if (!json.error) { - // this.loading.close() - sessionStorage.setItem('userInfo', JSON.stringify(json)) - this.$notify({ - title: '鎻愮ず', - type: 'success', - message: '鐧诲綍鎴愬姛锛�' - }) - // await this.getMenuList() - // this.$router.push('/Layout/Video') - location.assign("/view/desktop") - return json + let res = await getLoginUserData() + if (res.success) { + sessionStorage.setItem('userInfo', JSON.stringify(res.data)) + this.$notify.success("鐧诲綍鎴愬姛锛�") + // 鑾峰彇鏉冮檺 + await this.getMenuList() + location.assign("/view/desktop/") + return res.data } else { - this.$notify({ - title: '鎻愮ず', - type: 'error', - message: '鐧诲綍澶辫触锛�' - }) - // this.loading.close() + this.$notify.error("鐧诲綍澶辫触锛�") } }, getScreenHeight() { this.currentHeight = document.documentElement.clientHeight this.currentWidth = document.documentElement.clientWidth - // console.log(this.currentHeight, "褰撳墠绐楀彛澶у皬"); window.onresize = () => { this.currentHeight = document.documentElement.clientHeight this.currentWidth = document.documentElement.clientWidth - // console.log(this.currentHeight, "褰撳墠绐楀彛澶у皬2", this.currentWidth); this.$forceUpdate() } }, @@ -169,19 +198,37 @@ this.serverTitle = res.data.serverName window.document.title = res.data.serverName ? res.data.serverName - : '鏅� 鑳� 璁� 绠� 鑺� 鐐�' + : 'SmartAI' sessionStorage.setItem('title', res.data.serverName) } }, + async getMenuList() { + let results = await getMenuListData({}); + if (results && results.success) { + /* 瀛樺偍鏉冮檺 */ + let buttonAuthoritys = results.data; + if (results && results.length && this.$route.query.is_login) { + this.$router.replace(results[0].url); + } + sessionStorage.setItem("buttonAuthoritys", "," + buttonAuthoritys + ","); + sessionStorage.setItem("menuInfo", JSON.stringify(results)); + } else { + this.$toast({ + type: "error", + message: "鑿滃崟鑾峰彇澶辫触" + }); + } + }, + getQueryVariable(variable) { + var query = window.location.search.substring(1); + var vars = query.split("&"); + for (var i = 0; i < vars.length; i++) { + var pair = vars[i].split("="); + if (pair[0] == variable) { return pair[1]; } + } + return (false); + } }, - created() { - this.getServerName() - this.getScreenHeight() - }, - watch: {}, - beforeDestroy() { - window.onresize = null - } } </script> <style lang="scss"> @@ -214,10 +261,10 @@ } .left-bg { position: absolute; - top: 30%; + top: 29%; right: 18%; width: 390px; - height: 402px; + height: 426px; background: rgba(146, 208, 255, 0.23); border-radius: 4px; text-align: center; @@ -234,14 +281,16 @@ } .login-form { margin: 40px 10px; - // margin: 24px 10px 40px 10px; } .gradient-text { - line-height: 50px; - font-size: 20px; + line-height: 36px; + font-size: 17px; font-family: -webkit-pictograph; font-weight: bolder; position: relative; + b { + font-size: 20px; + } } .gradient-text-one { background-image: linear-gradient(to right, #51feff 5%, #ff8725 100%); -- Gitblit v1.8.0