feat: 重新登录逻辑更改
This commit is contained in:
@@ -5,8 +5,6 @@
|
||||
"ComputedRef": true,
|
||||
"DirectiveBinding": true,
|
||||
"EffectScope": true,
|
||||
"ElMessage": true,
|
||||
"ElMessageBox": true,
|
||||
"ExtractDefaultPropTypes": true,
|
||||
"ExtractPropTypes": true,
|
||||
"ExtractPublicPropTypes": true,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts" setup>
|
||||
import { ElMessageBox } from 'element-plus';
|
||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||
import { ref, watch } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { getUserInfo } from '@/api';
|
||||
@@ -60,6 +60,19 @@ function onAfterLeave() {
|
||||
}
|
||||
}
|
||||
|
||||
// 重新登录
|
||||
async function onReLogin() {
|
||||
// 在这里执行退出方法
|
||||
await userStore.logout();
|
||||
// 清空回话列表并回到默认页
|
||||
await sessionStore.requestSessionList(1, true);
|
||||
await sessionStore.createSessionBtn();
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '退出成功',
|
||||
});
|
||||
await router.replace('/');
|
||||
}
|
||||
function handleThirdPartyLogin(type: any) {
|
||||
const redirectUri = encodeURIComponent(`${window.location.origin}/chat`);
|
||||
console.log('cccc', type);
|
||||
@@ -321,16 +334,16 @@ function openContact() {
|
||||
</div>
|
||||
<el-divider content-position="center">
|
||||
<p class="w-max">
|
||||
开通Vip后,点击下方重新登录意社区
|
||||
开通Vip后,点击下方重新登录以生效
|
||||
</p>
|
||||
</el-divider>
|
||||
<el-button
|
||||
class="w-full"
|
||||
type="primary"
|
||||
size="large"
|
||||
@click="handleThirdPartyLogin(SSO_CLIENT_LOGIN_AGAIN)"
|
||||
@click="onReLogin()"
|
||||
>
|
||||
意社区重新登录
|
||||
重新登录
|
||||
</el-button>
|
||||
<el-divider class="w-max">
|
||||
<p class="w-max">
|
||||
|
||||
@@ -1,12 +1,19 @@
|
||||
<script lang="ts" setup>
|
||||
import { Camera, Edit, SuccessFilled } from '@element-plus/icons-vue';
|
||||
import { format } from 'date-fns';
|
||||
import { computed, ref } from 'vue';
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import { getUserInfo } from '@/api';
|
||||
import QrCodeLogin from '@/components/LoginDialog/components/QrCodeLogin/index.vue';
|
||||
import { useUserStore } from '@/stores';
|
||||
import { getUserProfilePicture, WECHAT_QRCODE_TYPE } from '@/utils/user.ts';
|
||||
|
||||
const userStore = useUserStore();
|
||||
|
||||
onMounted(async () => {
|
||||
const resUserInfo = await getUserInfo();
|
||||
userStore.setUserInfo(resUserInfo.data);
|
||||
});
|
||||
|
||||
const user = computed(() => userStore.userInfo.user || {});
|
||||
const wechatDialogVisible = ref(false);
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import { useRouter } from 'vue-router';
|
||||
|
||||
import { getUserInfo } from '@/api';
|
||||
import {
|
||||
SSO_CLIENT_LOGIN_AGAIN,
|
||||
SSO_SEVER_URL,
|
||||
} from '@/config/sso.ts';
|
||||
|
||||
@@ -50,6 +49,18 @@ function parseUrlParams() {
|
||||
onMounted(() => {
|
||||
parseUrlParams();
|
||||
});
|
||||
async function onReLogin() {
|
||||
// 在这里执行退出方法
|
||||
await userStore.logout();
|
||||
// 清空回话列表并回到默认页
|
||||
await sessionStore.requestSessionList(1, true);
|
||||
await sessionStore.createSessionBtn();
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '退出成功',
|
||||
});
|
||||
await router.replace('/');
|
||||
}
|
||||
function handleThirdPartyLogin(type: any) {
|
||||
const redirectUri = encodeURIComponent(`${window.location.origin}/chat`);
|
||||
console.log('cccc', type);
|
||||
@@ -184,7 +195,7 @@ function contactCustomerService() {
|
||||
<!-- 重新登录提示 -->
|
||||
<!-- 绿色背景 -->
|
||||
<div class="mb-4 text-gray-600 ">
|
||||
开通 VIP 后,需要重新登录意社区生效。<br>
|
||||
开通 VIP 后,需要重新登录生效。<br>
|
||||
</div>
|
||||
<div v-if="false" class="order-info p-4 rounded-lg mb-4 bg-[#ffc406] mb-4 text-gray-600 ">
|
||||
加入售后群获得更多专业支持!
|
||||
@@ -200,9 +211,9 @@ function contactCustomerService() {
|
||||
class="w-full py-3 text-lg font-medium"
|
||||
type="primary"
|
||||
size="large"
|
||||
@click="handleThirdPartyLogin(SSO_CLIENT_LOGIN_AGAIN)"
|
||||
@click="onReLogin()"
|
||||
>
|
||||
意社区重新登录
|
||||
重新登录
|
||||
</ElButton>
|
||||
|
||||
<ElButton
|
||||
|
||||
Reference in New Issue
Block a user