|
@@ -22,9 +22,15 @@
|
|
|
{{siteinfo.enterprisename}}<i class="el-icon-arrow-down el-icon--right"></i>
|
|
|
</div>
|
|
|
</span>
|
|
|
- <el-dropdown-menu slot="dropdown">
|
|
|
+ <el-dropdown-menu style="width:200px;text-align:center" slot="dropdown">
|
|
|
<el-dropdown-item @click.native="$router.replace({path:'/user_center'})">个人中心</el-dropdown-item>
|
|
|
- <el-dropdown-item v-if="canChangeSite" @click.native="$router.replace({path:'/accounts'})">切换账号</el-dropdown-item>
|
|
|
+ <!-- <el-dropdown-item v-if="canChangeSite" @click.native="$router.replace({path:'/accounts'})">切换账号</el-dropdown-item> -->
|
|
|
+ <el-dropdown-item v-for="item in accountList" :key="item.index" divided @click.native="selectAccount(item)">
|
|
|
+ <div class="flex-align-center flex-between">
|
|
|
+ <p><span class="avatar-mini">{{item.enterprisename?item.enterprisename.substr(0, 1):item.sitename.substr(0, 1)}}</span><span>{{item.enterprisename?item.enterprisename:item.sitename}}</span></p>
|
|
|
+ <small>{{item.name}}</small>
|
|
|
+ </div>
|
|
|
+ </el-dropdown-item>
|
|
|
<el-dropdown-item divided @click.native="loginOut()">退出登录</el-dropdown-item>
|
|
|
</el-dropdown-menu>
|
|
|
</el-dropdown>
|
|
@@ -41,7 +47,8 @@ export default {
|
|
|
accountInfo:{},
|
|
|
url:"http://weather.cma.cn/api/weather/view?stationid=",
|
|
|
weather:{},
|
|
|
- searchValue:''
|
|
|
+ searchValue:'',
|
|
|
+ accountList:[]
|
|
|
}
|
|
|
},
|
|
|
computed:{
|
|
@@ -55,6 +62,11 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods:{
|
|
|
+ // 选择登录账号
|
|
|
+ selectAccount (item) {
|
|
|
+ sessionStorage.setItem('active_account',JSON.stringify(item))
|
|
|
+ this.$router.go(0)
|
|
|
+ },
|
|
|
async getWeather () {
|
|
|
const res = await axios.get(this.url)
|
|
|
console.log(res)
|
|
@@ -110,6 +122,7 @@ export default {
|
|
|
mounted () {
|
|
|
this.siteInfos()
|
|
|
this.getWeather()
|
|
|
+ this.accountList = JSON.parse(sessionStorage.getItem('account_list'))
|
|
|
this.accountInfo = JSON.parse(sessionStorage.getItem('active_account'))
|
|
|
},
|
|
|
}
|
|
@@ -207,4 +220,18 @@ export default {
|
|
|
background-color: rgba(255 ,255,255,.2);
|
|
|
}
|
|
|
}
|
|
|
+.avatar-mini{
|
|
|
+ display: inline-block;
|
|
|
+ position: relative;
|
|
|
+ height:20px;
|
|
|
+ width: 20px;
|
|
|
+ line-height: 20px;
|
|
|
+ text-align: center;
|
|
|
+ margin-right: 5px;
|
|
|
+ color:#fff;
|
|
|
+ font-size: 12px;
|
|
|
+ font-weight: 500;
|
|
|
+ border-radius: 100%;
|
|
|
+ background: #3874F6;
|
|
|
+}
|
|
|
</style>
|