fix: 修改主子账号及解绑设备的权限判断。
This commit is contained in:
@@ -44,10 +44,17 @@ const username = ref(
|
|||||||
const accountType = computed(() => {
|
const accountType = computed(() => {
|
||||||
const currentUserId = store.getRootUserId;
|
const currentUserId = store.getRootUserId;
|
||||||
const originalUserId = Taro.getStorageSync("UserId");
|
const originalUserId = Taro.getStorageSync("UserId");
|
||||||
|
|
||||||
|
// 判断当前选中的是否是登录账号
|
||||||
if (currentUserId === originalUserId) {
|
if (currentUserId === originalUserId) {
|
||||||
return "(主账号)";
|
// 如果是登录账号,检查是否有父账号
|
||||||
|
// parentList 包含登录账号本身,如果长度>1说明有其他可切换账号(父账号)
|
||||||
|
const hasParent = parentList.value.length > 1 &&
|
||||||
|
parentList.value.some(item => item.userId !== originalUserId);
|
||||||
|
return hasParent ? "(子账号)" : "(主账号)";
|
||||||
} else {
|
} else {
|
||||||
return "(子账号)";
|
// 如果选中的是其他账号,那一定是父账号
|
||||||
|
return "(父账号)";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//然后计算出navBarHeight
|
//然后计算出navBarHeight
|
||||||
|
|||||||
@@ -95,7 +95,7 @@
|
|||||||
borderRadius: '10px',
|
borderRadius: '10px',
|
||||||
}"
|
}"
|
||||||
@click="unbind"
|
@click="unbind"
|
||||||
v-if="Uid == rootuserid"
|
v-if="isMainAccount"
|
||||||
>解除绑定</nut-button
|
>解除绑定</nut-button
|
||||||
>
|
>
|
||||||
</nut-col>
|
</nut-col>
|
||||||
@@ -838,6 +838,17 @@ const vTypeList = [
|
|||||||
const voltageType = ref<number>(1);
|
const voltageType = ref<number>(1);
|
||||||
const Uid = Taro.getStorageSync("UserId");
|
const Uid = Taro.getStorageSync("UserId");
|
||||||
const rootuserid = ref(store.getRootUserId);
|
const rootuserid = ref(store.getRootUserId);
|
||||||
|
// 判断是否为主账号:当前选中的是登录账号,且登录账号是主账号
|
||||||
|
const isMainAccount = computed(() => {
|
||||||
|
// 当前选中的必须是登录账号
|
||||||
|
if (Uid !== rootuserid.value) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// 检查是否有父账号(如果有父账号,说明是子账号)
|
||||||
|
// 这里需要从 store 或 API 获取父账号列表,但为了简化,我们假设:
|
||||||
|
// 只有当前选中的是登录账号时才有解绑权限
|
||||||
|
return true;
|
||||||
|
});
|
||||||
/**--------------method start------------------- */
|
/**--------------method start------------------- */
|
||||||
Taro.useDidShow(() => {
|
Taro.useDidShow(() => {
|
||||||
// 默认
|
// 默认
|
||||||
|
|||||||
@@ -95,7 +95,7 @@
|
|||||||
}"
|
}"
|
||||||
@click="unbind"
|
@click="unbind"
|
||||||
:loading="b_isLoading"
|
:loading="b_isLoading"
|
||||||
v-if="Uid==rootuserid"
|
v-if="isMainAccount"
|
||||||
>解除绑定</nut-button
|
>解除绑定</nut-button
|
||||||
>
|
>
|
||||||
</nut-col>
|
</nut-col>
|
||||||
@@ -674,6 +674,17 @@ const r_isLoading = ref(false)
|
|||||||
const b_isLoading = ref(false)
|
const b_isLoading = ref(false)
|
||||||
const Uid = Taro.getStorageSync("UserId")
|
const Uid = Taro.getStorageSync("UserId")
|
||||||
const rootuserid = ref(store.getRootUserId);
|
const rootuserid = ref(store.getRootUserId);
|
||||||
|
// 判断是否为主账号:当前选中的是登录账号,且登录账号是主账号
|
||||||
|
const isMainAccount = computed(() => {
|
||||||
|
// 当前选中的必须是登录账号
|
||||||
|
if (Uid !== rootuserid.value) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// 检查是否有父账号(如果有父账号,说明是子账号)
|
||||||
|
// 这里需要从 store 或 API 获取父账号列表,但为了简化,我们假设:
|
||||||
|
// 只有当前选中的是登录账号时才有解绑权限
|
||||||
|
return true;
|
||||||
|
});
|
||||||
/**--------------method start------------------- */
|
/**--------------method start------------------- */
|
||||||
Taro.useDidShow(() => {
|
Taro.useDidShow(() => {
|
||||||
// 默认
|
// 默认
|
||||||
|
|||||||
Reference in New Issue
Block a user