inleft
2022-03-01 88f419df77ade235ea5e5e24be204842a24b7b33
commit | author | age
9bcb19 1 <template>
I 2   <div class="page-header-index-wide">
3     <a-card :bordered="false" :bodyStyle="{ padding: '16px 0', height: '100%' }" :style="{ height: '100%' }">
4       <div class="account-settings-info-main" :class="device">
5         <div class="account-settings-info-left">
6           <a-menu
7             :mode="device == 'mobile' ? 'horizontal' : 'inline'"
8             :style="{ border: '0', width: device == 'mobile' ? '560px' : 'auto'}"
9             :selectedKeys="selectedKeys"
10             type="inner"
11             @openChange="onOpenChange"
12           >
13             <a-menu-item key="/account/settings/base">
14               <router-link :to="{ name: 'BaseSettings' }">
15                 基本设置
16               </router-link>
17             </a-menu-item>
18             <a-menu-item key="/account/settings/security">
19               <router-link :to="{ name: 'SecuritySettings' }">
20                 安全设置
21               </router-link>
22             </a-menu-item>
23             <a-menu-item key="/account/settings/custom">
24               <router-link :to="{ name: 'CustomSettings' }">
25                 个性化
26               </router-link>
27             </a-menu-item>
28             <a-menu-item key="/account/settings/binding">
29               <router-link :to="{ name: 'BindingSettings' }">
30                 账户绑定
31               </router-link>
32             </a-menu-item>
33             <a-menu-item key="/account/settings/notification">
34               <router-link :to="{ name: 'NotificationSettings' }">
35                 新消息通知
36               </router-link>
37             </a-menu-item>
38           </a-menu>
39         </div>
40         <div class="account-settings-info-right">
41           <div class="account-settings-info-title">
42             <span>{{ $route.meta.title }}</span>
43           </div>
44           <route-view></route-view>
45         </div>
46       </div>
47     </a-card>
48   </div>
49 </template>
50
51 <script>
52 import { PageView, RouteView } from '@/layouts'
53 import { mixinDevice } from '@/utils/mixin.js'
54
55 export default {
56   components: {
57     RouteView,
58     PageView
59   },
60   mixins: [mixinDevice],
61   data () {
62     return {
63       // horizontal  inline
64       mode: 'inline',
65
66       openKeys: [],
67       selectedKeys: [],
68
69       // cropper
70       preview: {},
71       option: {
72         img: '/avatar2.jpg',
73         info: true,
74         size: 1,
75         outputType: 'jpeg',
76         canScale: false,
77         autoCrop: true,
78         // 只有自动截图开启 宽度高度才生效
79         autoCropWidth: 180,
80         autoCropHeight: 180,
81         fixedBox: true,
82         // 开启宽度和高度比例
83         fixed: true,
84         fixedNumber: [1, 1]
85       },
86
87       pageTitle: ''
88     }
89   },
90   mounted () {
91     this.updateMenu()
92   },
93   methods: {
94     onOpenChange (openKeys) {
95       this.openKeys = openKeys
96     },
97     updateMenu () {
98       const routes = this.$route.matched.concat()
99       this.selectedKeys = [ routes.pop().path ]
100     }
101   },
102   watch: {
103     '$route' (val) {
104       this.updateMenu()
105     }
106   }
107 }
108 </script>
109
110 <style lang="less" scoped>
111   .account-settings-info-main {
112     width: 100%;
113     display: flex;
114     height: 100%;
115     overflow: auto;
116
117     &.mobile {
118       display: block;
119
120       .account-settings-info-left {
121         border-right: unset;
122         border-bottom: 1px solid #e8e8e8;
123         width: 100%;
124         height: 50px;
125         overflow-x: auto;
126         overflow-y: scroll;
127       }
128       .account-settings-info-right {
129         padding: 20px 40px;
130       }
131     }
132
133     .account-settings-info-left {
134       border-right: 1px solid #e8e8e8;
135       width: 224px;
136     }
137
138     .account-settings-info-right {
139       flex: 1 1;
140       padding: 8px 40px;
141
142       .account-settings-info-title {
143         color: rgba(0,0,0,.85);
144         font-size: 20px;
145         font-weight: 500;
146         line-height: 28px;
147         margin-bottom: 12px;
148       }
149       .account-settings-info-view {
150         padding-top: 12px;
151       }
152     }
153   }
154
155 </style>