|
@@ -4,8 +4,8 @@
|
|
|
<view class="u-navbar__content__left__item" v-if="tenantIdList.length == 1">
|
|
|
<view class="u-navbar__content__left__item__title">应用中心</view>
|
|
|
</view>
|
|
|
- <view v-if="tenantIdList.length > 1 && accountState">
|
|
|
- <image class="unit-change" src="@/static/images/index/unitChange.png" @click="showLeftStateClick()" ></image>
|
|
|
+ <view v-if="tenantIdList.length > 1 && accountState">
|
|
|
+ <image class="unit-change" src="@/static/images/index/unitChange.png" @click="showLeftStateClick()"></image>
|
|
|
</view>
|
|
|
</template>
|
|
|
<template #center>
|
|
@@ -30,7 +30,6 @@
|
|
|
:refresherThreshold="44"
|
|
|
:refresherBackground="'#f5f6f7'"
|
|
|
@refresh="refresh"
|
|
|
- @touchstart="touchStart" @touchend="touchEnd"
|
|
|
>
|
|
|
<template #default>
|
|
|
<view class="home-container">
|
|
@@ -80,12 +79,12 @@
|
|
|
</view>
|
|
|
</template>
|
|
|
</oa-scroll>
|
|
|
- <uni-drawer ref="showLeft" mode="left" style="height:calc(100vh - 44px);width:90%;margin-top:44px;">
|
|
|
+ <uni-drawer ref="showLeft" mode="left" style="height: calc(100vh - 44px); width: 90%; margin-top: 44px">
|
|
|
<view class="unit">
|
|
|
<view class="unit-title">切换企业</view>
|
|
|
- <view :class="item.id == useStore.tenantId ? 'active' : ''" class="list" v-for="(item, index) in tenantIdList" :key="index" @click="changeTenantId(item.id)">
|
|
|
- <image class="list-image" src="@/static/images/index/unit-active.png" v-if="item.id == useStore.tenantId" ></image>
|
|
|
- <image class="list-image" src="@/static/images/index/unit.png" v-if="item.id != useStore.tenantId" ></image>
|
|
|
+ <view :class="item.id == useStore.tenantId ? 'active' : ''" class="list" v-for="(item, index) in tenantIdList" :key="index" @click="changeTenantId(item.id)">
|
|
|
+ <image class="list-image" src="@/static/images/index/unit-active.png" v-if="item.id == useStore.tenantId"></image>
|
|
|
+ <image class="list-image" src="@/static/images/index/unit.png" v-if="item.id != useStore.tenantId"></image>
|
|
|
<text class="list-name">{{ item.tenantName }}</text>
|
|
|
<image class="list-right" src="@/static/images/index/right.png" v-if="item.id == useStore.tenantId"></image>
|
|
|
<text class="list-state">默认企业</text>
|
|
@@ -136,87 +135,88 @@ const { dialogFlag } = toRefs(state);
|
|
|
/**
|
|
|
* @企业弹框切换
|
|
|
*/
|
|
|
-function showLeftStateClick(){
|
|
|
+function showLeftStateClick() {
|
|
|
showLeftState.value = !showLeftState.value;
|
|
|
- if(showLeftState.value){
|
|
|
- showDrawer()
|
|
|
- }else{
|
|
|
- closeDrawer()
|
|
|
+ if (showLeftState.value) {
|
|
|
+ showDrawer();
|
|
|
+ } else {
|
|
|
+ closeDrawer();
|
|
|
}
|
|
|
}
|
|
|
// 单位打开窗口
|
|
|
function showDrawer() {
|
|
|
- showLeft.value.open()
|
|
|
+ showLeft.value.open();
|
|
|
}
|
|
|
// 单位关闭窗口
|
|
|
function closeDrawer(e) {
|
|
|
- showLeft.value.close()
|
|
|
+ showLeft.value.close();
|
|
|
}
|
|
|
//获取企业列表
|
|
|
-function getTenantList(id){
|
|
|
+function getTenantList(id) {
|
|
|
getTenantByUser(id).then((res) => {
|
|
|
- tenantIdList.value = res.data
|
|
|
- if(storage.get("account")?.userName && storage.get("account")?.passWord){
|
|
|
+ tenantIdList.value = res.data;
|
|
|
+ if (storage.get("account")?.userName && storage.get("account")?.passWord) {
|
|
|
accountState.value = true;
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
}
|
|
|
/**
|
|
|
* @企业切换
|
|
|
*/
|
|
|
-function changeTenantId(id){
|
|
|
-
|
|
|
- storage.set("tenantId",id)
|
|
|
- var info = JSON.parse(JSON.stringify({
|
|
|
- userName:storage.get("account")?.userName,
|
|
|
- passWord:storage.get("account")?.passWord,
|
|
|
- tenantId:id,
|
|
|
- }))
|
|
|
+function changeTenantId(id) {
|
|
|
+ storage.set("tenantId", id);
|
|
|
+ var info = JSON.parse(
|
|
|
+ JSON.stringify({
|
|
|
+ userName: storage.get("account")?.userName,
|
|
|
+ passWord: storage.get("account")?.passWord,
|
|
|
+ tenantId: id,
|
|
|
+ })
|
|
|
+ );
|
|
|
useStore.LogOut().then(() => {
|
|
|
//#ifdef APP-PLUS
|
|
|
- uni.navigateTo({
|
|
|
- url: "/pages/index",
|
|
|
- });
|
|
|
+ uni.navigateTo({
|
|
|
+ url: "/pages/index",
|
|
|
+ });
|
|
|
//#endif
|
|
|
//#ifndef APP-PLUS
|
|
|
//#endif
|
|
|
- if (localStorage.getItem("type")) {
|
|
|
- wx.miniProgram.navigateTo({
|
|
|
- appId: 'wxf5ad8734295d43f8',
|
|
|
- url: '/pages/login?type=logout'
|
|
|
- })
|
|
|
- } else {
|
|
|
- useStore.Login(
|
|
|
- {
|
|
|
- username: decrypt(info.userName),
|
|
|
- password: decrypt(info.passWord),
|
|
|
- tenantId: id,
|
|
|
- method:"switch",
|
|
|
- cids: proxy.$settingStore.pushClientId || undefined,
|
|
|
- type: proxy.$common.isWechatMp() ? "wx" : "app",
|
|
|
- openId: proxy.$common.isWechatMp() ? localStorage.getItem("wxOpenId") : undefined,
|
|
|
- }
|
|
|
- ).then(() => {
|
|
|
+ if (localStorage.getItem("type")) {
|
|
|
+ wx.miniProgram.navigateTo({
|
|
|
+ appId: "wxf5ad8734295d43f8",
|
|
|
+ url: "/pages/login?type=logout",
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ useStore
|
|
|
+ .Login({
|
|
|
+ username: decrypt(info.userName),
|
|
|
+ password: decrypt(info.passWord),
|
|
|
+ tenantId: id,
|
|
|
+ method: "switch",
|
|
|
+ cids: proxy.$settingStore.pushClientId || undefined,
|
|
|
+ type: proxy.$common.isWechatMp() ? "wx" : "app",
|
|
|
+ openId: proxy.$common.isWechatMp() ? localStorage.getItem("wxOpenId") : undefined,
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
// /** 获取用户信息 */
|
|
|
- useStore.SET_STORAGE_OBJECT_KEYS({"tenantId":id})
|
|
|
+ useStore.SET_STORAGE_OBJECT_KEYS({ tenantId: id });
|
|
|
proxy.$modal.closeLoading();
|
|
|
useStore.GetInfo().then((res) => {
|
|
|
proxy.$settingStore.initThemeColor(storageSystem.get("themeColor")); //初始化默认主题
|
|
|
- init()
|
|
|
- closeDrawer()
|
|
|
+ init();
|
|
|
+ closeDrawer();
|
|
|
});
|
|
|
});
|
|
|
- }
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
/**
|
|
|
* @初始化
|
|
|
*/
|
|
|
async function init(options) {
|
|
|
- if(useStore?.userId){
|
|
|
- tenantIdChange.value = useStore.tenantId; //切换租户ID
|
|
|
- getTenantList(useStore.userId); //调用获取企业列表方法
|
|
|
- }
|
|
|
+ if (useStore?.userId) {
|
|
|
+ tenantIdChange.value = useStore.tenantId; //切换租户ID
|
|
|
+ getTenantList(useStore.userId); //调用获取企业列表方法
|
|
|
+ }
|
|
|
//#ifdef H5
|
|
|
await useStore.GetWxOpenId(2, options); //调用获取微信公众号openId
|
|
|
//#endif
|
|
@@ -536,65 +536,65 @@ onShow(() => {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-.unit-change{
|
|
|
- width:18px;
|
|
|
- height:18px;
|
|
|
- position:fixed;
|
|
|
- top:12px;
|
|
|
- left:12px;
|
|
|
+.unit-change {
|
|
|
+ width: 18px;
|
|
|
+ height: 18px;
|
|
|
+ position: fixed;
|
|
|
+ top: 12px;
|
|
|
+ left: 12px;
|
|
|
}
|
|
|
-.unit{
|
|
|
- width:100vw !important;
|
|
|
- height:100%;
|
|
|
- background: #0D2E59;
|
|
|
- position:fixed;
|
|
|
- top:0px;
|
|
|
- left:0%;
|
|
|
- &-title{
|
|
|
- margin:15px 0 10px 10px;
|
|
|
- color:#fff;
|
|
|
+.unit {
|
|
|
+ width: 100vw !important;
|
|
|
+ height: 100%;
|
|
|
+ background: #0d2e59;
|
|
|
+ position: fixed;
|
|
|
+ top: 0px;
|
|
|
+ left: 0%;
|
|
|
+ &-title {
|
|
|
+ margin: 15px 0 10px 10px;
|
|
|
+ color: #fff;
|
|
|
}
|
|
|
- .list{
|
|
|
- margin-top:10px;
|
|
|
- padding:10px;
|
|
|
- position:relative;
|
|
|
- width:90%;
|
|
|
- &-image{
|
|
|
- width:29px;
|
|
|
- height:29px;
|
|
|
- vertical-align:middle;
|
|
|
- margin-right:10px;
|
|
|
+ .list {
|
|
|
+ margin-top: 10px;
|
|
|
+ padding: 10px;
|
|
|
+ position: relative;
|
|
|
+ width: 90%;
|
|
|
+ &-image {
|
|
|
+ width: 29px;
|
|
|
+ height: 29px;
|
|
|
+ vertical-align: middle;
|
|
|
+ margin-right: 10px;
|
|
|
}
|
|
|
- &-name{
|
|
|
- vertical-align:middle;
|
|
|
- color:#fff;
|
|
|
- width:60%;
|
|
|
- display:inline-block;
|
|
|
+ &-name {
|
|
|
+ vertical-align: middle;
|
|
|
+ color: #fff;
|
|
|
+ width: 60%;
|
|
|
+ display: inline-block;
|
|
|
white-space: nowrap; /* 防止文本换行 */
|
|
|
overflow: hidden; /* 隐藏超出容器的文本 */
|
|
|
text-overflow: ellipsis; /* 显示省略号以代表被隐藏的文本 */
|
|
|
}
|
|
|
- &-right{
|
|
|
- position:absolute;
|
|
|
- top:38%;
|
|
|
- right:30%;
|
|
|
- width:16px;
|
|
|
- height:11px;
|
|
|
- vertical-align:middle;
|
|
|
+ &-right {
|
|
|
+ position: absolute;
|
|
|
+ top: 38%;
|
|
|
+ right: 30%;
|
|
|
+ width: 16px;
|
|
|
+ height: 11px;
|
|
|
+ vertical-align: middle;
|
|
|
}
|
|
|
- &-state{
|
|
|
- position:absolute;
|
|
|
- right:20px;
|
|
|
- top:16px;
|
|
|
- font-size:12px;
|
|
|
- color:#2A98FF;
|
|
|
+ &-state {
|
|
|
+ position: absolute;
|
|
|
+ right: 20px;
|
|
|
+ top: 16px;
|
|
|
+ font-size: 12px;
|
|
|
+ color: #2a98ff;
|
|
|
}
|
|
|
- &-state.active{
|
|
|
- color:#999;
|
|
|
+ &-state.active {
|
|
|
+ color: #999;
|
|
|
}
|
|
|
}
|
|
|
- .list.active{
|
|
|
- background:#193B61;
|
|
|
+ .list.active {
|
|
|
+ background: #193b61;
|
|
|
}
|
|
|
}
|
|
|
</style>
|