File tree 7 files changed +79
-49
lines changed
Filter options
7 files changed +79
-49
lines changed
Original file line number Diff line number Diff line change @@ -27,7 +27,12 @@ module.exports = {
27
27
autoOpenBrowser : true ,
28
28
assetsSubDirectory : 'static' ,
29
29
assetsPublicPath : '/' ,
30
- proxyTable : { } ,
30
+ proxyTable : {
31
+ '/api-v1' : {
32
+ target : 'http://localhost:8081' ,
33
+ changeOrigin : true
34
+ }
35
+ } ,
31
36
// CSS Sourcemaps off by default because relative paths are "buggy"
32
37
// with this option, according to the CSS-Loader README
33
38
// (https://github.com/webpack/css-loader#sourcemaps)
Original file line number Diff line number Diff line change
1
+ 当跨域无法请求的时候我们可以修改工程下config文件夹下的index.js中的dev:{}部分。dev: {
2
+ env: require('./dev.env'),
3
+ port: 8080,
4
+ autoOpenBrowser: false,
5
+ assetsSubDirectory: 'static',
6
+ assetsPublicPath: '/',
7
+ proxyTable: {
8
+ '/api': {
9
+ target: 'http://api.douban.com/v2',
10
+ changeOrigin: true,
11
+ pathRewrite: {
12
+ '^/api': ''
13
+ }
14
+ }
15
+ },
16
+ // CSS Sourcemaps off by default because relative paths are "buggy"
17
+ // with this option, according to the CSS-Loader README
18
+ // (https://github.com/webpack/css-loader#sourcemaps)
19
+ // In our experience, they generally work as expected,
20
+ // just be aware of this issue when enabling this option.
21
+ cssSourceMap: false
22
+ }
Original file line number Diff line number Diff line change @@ -6,12 +6,13 @@ import PlatformService from '../../services/platform.service';
6
6
import moment from 'moment' ;
7
7
import debounce from 'throttle-debounce/debounce' ;
8
8
import { Vue , Prop , Component } from 'vue-property-decorator'
9
-
10
9
import TodoListItem from '@/components/todo-list-item/TodoListItem.vue'
11
10
import ZeusMenu from '@/components/zeus-menu/zeus-menu.vue' ;
11
+ import ZeusUser from '@/components/zeus-user/zeus-user.vue' ;
12
12
@Component ( {
13
13
components : {
14
- ZeusMenu
14
+ ZeusMenu,
15
+ ZeusUser
15
16
}
16
17
} )
17
18
export default class PlatformComponent extends Vue {
@@ -38,7 +39,7 @@ export default class PlatformComponent extends Vue {
38
39
companyInfo : any = null // 公司信息 - 修改
39
40
40
41
created ( ) {
41
- // this.search();
42
+ this . search ( ) ;
42
43
}
43
44
44
45
// 获取左侧列表接口
Original file line number Diff line number Diff line change 14
14
</div >
15
15
<div class =" header-help" >
16
16
<el-button type =" primary" @click =" addNew" >新增</el-button >
17
- <!-- < zeus-user></zeus-user> -- >
17
+ <zeus-user ></zeus-user >
18
18
</div >
19
19
</header >
20
20
<transition name =" fade" mode =" out-in" v-if =" navList.length" >
Original file line number Diff line number Diff line change
1
+ import { Vue , Component } from 'vue-property-decorator'
2
+ //import Api from '../../services/login.js';
3
+ import Clickoutside from 'element-ui/lib/utils/clickoutside' ;
4
+ @Component ( {
5
+ name : 'zeus-user' ,
6
+ directives : { Clickoutside }
7
+ } )
8
+ export default class UserComponent extends Vue {
9
+ activeName :string = '' ;
10
+ showDropDown :boolean = false ;
11
+ dropDown ( ) {
12
+ this . showDropDown = ! this . showDropDown ;
13
+ }
14
+ handleBlur ( ) {
15
+ this . showDropDown = false ;
16
+ }
17
+ logout ( ) {
18
+ //const userInfo = JSON.parse(localStorage.getItem('userInfo'));
19
+ // Api.logout({
20
+ // token: userInfo.token,
21
+ // accountId: userInfo.username
22
+ // })
23
+ // .then(({data}) => {
24
+ // if (data.code === 1) {
25
+ // this.$message({
26
+ // message: '退出成功',
27
+ // type: 'success'
28
+ // });
29
+ // setTimeout(() => {
30
+ // location.href = '/login';
31
+ // }, 500);
32
+ // } else {
33
+ // this.$message({
34
+ // message: data.message,
35
+ // type: 'warning'
36
+ // });
37
+ // }
38
+ // });
39
+ }
40
+ }
Original file line number Diff line number Diff line change 10
10
</transition >
11
11
</div >
12
12
</template >
13
- <script >
14
- import Api from ' ../../services/login.js' ;
15
- import Clickoutside from ' element-ui/lib/utils/clickoutside' ;
16
- export default {
17
- directives: { Clickoutside },
18
- data () {
19
- return {
20
- activeName: ' ' ,
21
- showDropDown: false
22
- };
23
- },
24
- methods: {
25
- dropDown () {
26
- this .showDropDown = ! this .showDropDown ;
27
- },
28
- handleBlur () {
29
- this .showDropDown = false ;
30
- },
31
- logout () {
32
- const userInfo = JSON .parse (localStorage .getItem (' userInfo' ));
33
- Api .logout ({
34
- token: userInfo .token ,
35
- accountId: userInfo .username
36
- })
37
- .then (({data}) => {
38
- if (data .code === 1 ) {
39
- this .$message ({
40
- message: ' 退出成功' ,
41
- type: ' success'
42
- });
43
- setTimeout (() => {
44
- location .href = ' /login' ;
45
- }, 500 );
46
- } else {
47
- this .$message ({
48
- message: data .message ,
49
- type: ' warning'
50
- });
51
- }
52
- });
53
- }
54
- }
55
- };
13
+ <script lang="ts">
14
+ import ZeusUserComponent from ' @/components/zeus-user/zeus-user.component'
15
+ export default ZeusUserComponent
56
16
</script >
57
17
<style scoped lang="scss">
58
18
.user {
Original file line number Diff line number Diff line change 6
6
import Vue from 'vue'
7
7
import App from './App.vue'
8
8
import router from './router'
9
-
9
+ import axios from 'axios' ;
10
10
import ElementUI from 'element-ui'
11
11
import 'element-ui/lib/theme-default/index.css'
12
12
import InfiniteScroll from 'vue-infinite-scroll' ;
13
13
import './assets/css/index.scss' ;
14
14
import 'font-awesome/css/font-awesome.css' ;
15
+
16
+ axios . defaults . baseURL = '/api-v1/' ;
15
17
Vue . use ( ElementUI )
16
18
Vue . use ( InfiniteScroll )
17
19
/* eslint-disable no-new */
You can’t perform that action at this time.
0 commit comments