|
@@ -5,10 +5,10 @@
|
|
|
class="pull-left welcome-img">
|
|
|
<div style="margin-left: 46px">
|
|
|
<div class="welcome-title">
|
|
|
- hi,欢迎使用{{logoTitle}}
|
|
|
+ hi,欢迎使用{{ logoTitle }}
|
|
|
</div>
|
|
|
<div class="welcome-content">
|
|
|
- 众测群智,不一样的深度测试
|
|
|
+ {{ login_description }}
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="welcome-btn">
|
|
@@ -24,94 +24,98 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import Http from '@/js/http.js'
|
|
|
- import {logout, storageGet} from '@/js/index.js'
|
|
|
- import {mapActions,mapGetters} from 'vuex'
|
|
|
- import {CONFIG,login_url} from "../../config";
|
|
|
+import Http from '@/js/http.js'
|
|
|
+import {logout, storageGet} from '@/js/index.js'
|
|
|
+import {mapActions, mapGetters} from 'vuex'
|
|
|
+import {CONFIG, login_url} from "../../config";
|
|
|
+import {storageRemove} from "../../js/index";
|
|
|
|
|
|
- export default {
|
|
|
- name: "LoginCard",
|
|
|
- data() {
|
|
|
- return {
|
|
|
- logoTitle:CONFIG.logoTitle,
|
|
|
- logo_background:CONFIG.logo_background,
|
|
|
- isLogin: false,
|
|
|
- user: {},
|
|
|
- loginUrl: login_url,
|
|
|
- userImg: ''
|
|
|
+export default {
|
|
|
+ name: "LoginCard",
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ logoTitle: CONFIG.logoTitle,
|
|
|
+ logo_background: CONFIG.logo_background,
|
|
|
+ isLogin: false,
|
|
|
+ user: {},
|
|
|
+ loginUrl: login_url,
|
|
|
+ userImg: '',
|
|
|
+ login_description: CONFIG.login_description
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapGetters(['getUserInfo'])
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ loadData() {
|
|
|
+ if (storageGet('user') || this.getUserInfo.id) {
|
|
|
+ this.isLogin = true;
|
|
|
+ this.user = storageGet('user') || this.getUserInfo;
|
|
|
}
|
|
|
},
|
|
|
- computed: {
|
|
|
- ...mapGetters(['getUserInfo'])
|
|
|
+ userLogout() {
|
|
|
+ this.isLogin = false
|
|
|
+ logout().then((res) => {
|
|
|
+ console.log('logout');
|
|
|
+ storageRemove('user');
|
|
|
+ location.reload();
|
|
|
+ })
|
|
|
},
|
|
|
- methods: {
|
|
|
- loadData() {
|
|
|
- if (storageGet('user') || this.getUserInfo) {
|
|
|
- this.isLogin = true;
|
|
|
- this.user = storageGet('user') || this.getUserInfo;
|
|
|
- }
|
|
|
- },
|
|
|
- userLogout() {
|
|
|
- this.isLogin = false
|
|
|
- logout().then((res) => {
|
|
|
- this.$router.go(0)
|
|
|
+ getUserImg() {
|
|
|
+ if (this.user && this.user.userVO && this.user.userVO.id) {
|
|
|
+ Http.get(`/api/user/image/${this.user.userVO.id}`).then((res) => {
|
|
|
+ if (res.data) {
|
|
|
+ this.userImg = res.data;
|
|
|
+ }
|
|
|
})
|
|
|
- },
|
|
|
- getUserImg() {
|
|
|
- if (this.user&&this.user.userVO&&this.user.userVO.id) {
|
|
|
- Http.get(`/api/user/image/${this.user.userVO.id}`).then((res) => {
|
|
|
- if (res.data) {
|
|
|
- this.userImg = res.data;
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
- },
|
|
|
- mounted() {
|
|
|
+
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.loadData();
|
|
|
+ this.getUserImg();
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ getUserInfo(val) {
|
|
|
this.loadData();
|
|
|
this.getUserImg();
|
|
|
- },
|
|
|
- watch:{
|
|
|
- getUserInfo(val){
|
|
|
- this.loadData();
|
|
|
- this.getUserImg();
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
- @import "../../style/main";
|
|
|
+@import "../../style/main";
|
|
|
|
|
|
- .login-card {
|
|
|
- margin-bottom: 13px;
|
|
|
+.login-card {
|
|
|
+ margin-bottom: 13px;
|
|
|
|
|
|
- .welcome-img {
|
|
|
- width: 40px;
|
|
|
- height: 40px;
|
|
|
- display: inline-block;
|
|
|
- margin: 2px 0;
|
|
|
- }
|
|
|
+ .welcome-img {
|
|
|
+ width: 40px;
|
|
|
+ height: 40px;
|
|
|
+ display: inline-block;
|
|
|
+ margin: 2px 0;
|
|
|
+ }
|
|
|
|
|
|
- .welcome-title {
|
|
|
- font-size: 14px;
|
|
|
- font-family: Source Han Sans CN;
|
|
|
- font-weight: bold;
|
|
|
- color: rgba(0, 0, 0, 1);
|
|
|
- }
|
|
|
+ .welcome-title {
|
|
|
+ font-size: 14px;
|
|
|
+ font-family: Source Han Sans CN;
|
|
|
+ font-weight: bold;
|
|
|
+ color: rgba(0, 0, 0, 1);
|
|
|
+ }
|
|
|
|
|
|
- .welcome-content {
|
|
|
- font-size: 13px;
|
|
|
- font-family: Source Han Sans CN;
|
|
|
- font-weight: 400;
|
|
|
- color: rgba(0, 0, 0, 1);
|
|
|
- }
|
|
|
+ .welcome-content {
|
|
|
+ font-size: 13px;
|
|
|
+ font-family: Source Han Sans CN;
|
|
|
+ font-weight: 400;
|
|
|
+ color: rgba(0, 0, 0, 1);
|
|
|
+ }
|
|
|
|
|
|
- .welcome-btn {
|
|
|
- width: 100%;
|
|
|
- height: 28px;
|
|
|
- margin-top: 20px;
|
|
|
- }
|
|
|
+ .welcome-btn {
|
|
|
+ width: 100%;
|
|
|
+ height: 28px;
|
|
|
+ margin-top: 20px;
|
|
|
}
|
|
|
+}
|
|
|
</style>
|