|
@@ -98,12 +98,12 @@
|
|
<scroll-view style="height: calc(100% - 4px);width:100vw;background:#0d2e59;" scroll-y="true">
|
|
<scroll-view style="height: calc(100% - 4px);width:100vw;background:#0d2e59;" scroll-y="true">
|
|
<view class="unit">
|
|
<view class="unit">
|
|
<view class="unit-title">切换企业</view>
|
|
<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>
|
|
|
|
- <text class="list-name">{{ item.tenantName }}</text>
|
|
|
|
|
|
+ <view :class="item.id == useStore.tenantId ? 'active' : ''" class="list" v-for="(item, index) in tenantIdList" :key="index">
|
|
|
|
+ <image class="list-image" src="@/static/images/index/unit-active.png" v-if="item.id == useStore.tenantId" @click="changeTenantId(item.id)"></image>
|
|
|
|
+ <image class="list-image" src="@/static/images/index/unit.png" v-if="item.id != useStore.tenantId" @click="changeTenantId(item.id)"></image>
|
|
|
|
+ <text class="list-name" @click="changeTenantId(item.id)">{{ item.tenantName }}</text>
|
|
<image class="list-right" src="@/static/images/index/right.png" v-if="item.id == useStore.tenantId"></image>
|
|
<image class="list-right" src="@/static/images/index/right.png" v-if="item.id == useStore.tenantId"></image>
|
|
- <!-- <text class="list-state">默认企业</text> -->
|
|
|
|
|
|
+ <text class="list-state" @click="defaultEnterprise(item)" :style="{ color: item.isDefault ? '#8D8F93' : '#2A98FF' }">{{ item.isDefault ? '默认企业' : '设为默认' }}</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</scroll-view>
|
|
</scroll-view>
|
|
@@ -125,7 +125,7 @@ import { useStores, commonStores } from "@/store/modules/index";
|
|
import * as jwx from "@/utils/jssdk.js"; //引入js sdk的封装
|
|
import * as jwx from "@/utils/jssdk.js"; //引入js sdk的封装
|
|
import { getToken, setToken, removeToken } from "@/utils/auth";
|
|
import { getToken, setToken, removeToken } from "@/utils/auth";
|
|
import { storage, storageSystem } from "@/utils/storage"; // 公共方法引用
|
|
import { storage, storageSystem } from "@/utils/storage"; // 公共方法引用
|
|
-import { getTenantByUser } from "@/api/system/user.js";
|
|
|
|
|
|
+import { getTenantByUser, putTenantByUser } from "@/api/system/user.js";
|
|
import { decrypt, encrypt } from "@/plugins/jsencrypt";
|
|
import { decrypt, encrypt } from "@/plugins/jsencrypt";
|
|
/*----------------------------------公共变量-----------------------------------*/
|
|
/*----------------------------------公共变量-----------------------------------*/
|
|
const { proxy } = getCurrentInstance();
|
|
const { proxy } = getCurrentInstance();
|
|
@@ -176,6 +176,12 @@ function getTenantList(id) {
|
|
tenantIdList.value = res.data
|
|
tenantIdList.value = res.data
|
|
accountState.value = true;
|
|
accountState.value = true;
|
|
}
|
|
}
|
|
|
|
+ for(let i=0;i<tenantIdList.value.length;i++){
|
|
|
|
+ if(tenantIdList.value[i].isDefault){
|
|
|
|
+ useStore.SET_STORAGE_OBJECT_KEYS({ tenantId: tenantIdList.value[i].id });
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
});
|
|
});
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
@@ -217,6 +223,19 @@ function changeTenantId(id) {
|
|
});
|
|
});
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * 默认企业
|
|
|
|
+ * @param {Object} val 企业对象
|
|
|
|
+ */
|
|
|
|
+ function defaultEnterprise(val){
|
|
|
|
+ putTenantByUser({
|
|
|
|
+ userId:useStore?.userId,
|
|
|
|
+ tenantId:val.id
|
|
|
|
+ }).then(() => {
|
|
|
|
+ changeTenantId(val.id)
|
|
|
|
+ })
|
|
|
|
+}
|
|
/**
|
|
/**
|
|
* @初始化
|
|
* @初始化
|
|
*/
|
|
*/
|
|
@@ -582,14 +601,14 @@ onShow(() => {
|
|
&-right {
|
|
&-right {
|
|
position: absolute;
|
|
position: absolute;
|
|
top: 38%;
|
|
top: 38%;
|
|
- right: 10%;
|
|
|
|
|
|
+ right: 25%;
|
|
width: 16px;
|
|
width: 16px;
|
|
height: 11px;
|
|
height: 11px;
|
|
vertical-align: middle;
|
|
vertical-align: middle;
|
|
}
|
|
}
|
|
&-state {
|
|
&-state {
|
|
position: absolute;
|
|
position: absolute;
|
|
- right: 20px;
|
|
|
|
|
|
+ right: 10px;
|
|
top: 16px;
|
|
top: 16px;
|
|
font-size: 12px;
|
|
font-size: 12px;
|
|
color: #2a98ff;
|
|
color: #2a98ff;
|