feat:第三方授权解除绑定对接
This commit is contained in:
@@ -115,3 +115,16 @@ export function getOtherAuthInfo(params) {
|
|||||||
params: params,
|
params: params,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除第三方授权
|
||||||
|
* @param {*} ids
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function delOtherAuth(ids) {
|
||||||
|
return request({
|
||||||
|
url: `/auth`,
|
||||||
|
method: "delete",
|
||||||
|
params: { id: ids },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
@@ -21,14 +21,15 @@
|
|||||||
:table-data="tableData"
|
:table-data="tableData"
|
||||||
:options="tableOptions"
|
:options="tableOptions"
|
||||||
:columns="tableColumn"
|
:columns="tableColumn"
|
||||||
|
@command="handleAction"
|
||||||
></yi-table>
|
></yi-table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, onMounted } from "vue";
|
import { ref, computed, onMounted } from "vue";
|
||||||
import { getOtherAuthInfo } from "@/apis/auth.js";
|
import { getOtherAuthInfo, delOtherAuth } from "@/apis/auth.js";
|
||||||
import YiTable from "@/components/yi-table/index.vue";
|
import YiTable from "@/components/yi-table/index.vue";
|
||||||
import useUserStore from "@/stores/user";
|
import useUserStore from "@/stores/user";
|
||||||
|
|
||||||
@@ -48,29 +49,23 @@ const tableColumn = [
|
|||||||
align: "center",
|
align: "center",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: "timeInterval",
|
prop: "authType",
|
||||||
label: "绑定账号信息",
|
label: "绑定账号信息",
|
||||||
minWidth: "110",
|
minWidth: "110",
|
||||||
align: "center",
|
align: "center",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: "timeInterval",
|
prop: "name",
|
||||||
label: "详情",
|
label: "详情",
|
||||||
minWidth: "110",
|
minWidth: "110",
|
||||||
align: "center",
|
align: "center",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: "timeInterval",
|
prop: "creationTime",
|
||||||
label: "绑定时间",
|
label: "绑定时间",
|
||||||
minWidth: "110",
|
minWidth: "110",
|
||||||
align: "center",
|
align: "center",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
prop: "timeInterval",
|
|
||||||
label: "状态",
|
|
||||||
minWidth: "110",
|
|
||||||
align: "center",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: "操作",
|
label: "操作",
|
||||||
align: "center",
|
align: "center",
|
||||||
@@ -78,18 +73,46 @@ const tableColumn = [
|
|||||||
fixed: "right",
|
fixed: "right",
|
||||||
buttons: [
|
buttons: [
|
||||||
{
|
{
|
||||||
name: "绑定",
|
name: "解除绑定",
|
||||||
type: "text",
|
type: "danger",
|
||||||
command: "edit",
|
command: "delete",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
onMounted(async () => {
|
const tableData = ref([]);
|
||||||
|
const checkList = async () => {
|
||||||
const { data } = await getOtherAuthInfo({ userId: userInfo.id });
|
const { data } = await getOtherAuthInfo({ userId: userInfo.id });
|
||||||
|
tableData.value = data;
|
||||||
|
};
|
||||||
|
onMounted(() => {
|
||||||
|
checkList();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 操作事件
|
||||||
|
const handleAction = (command, row) => {
|
||||||
|
switch (command) {
|
||||||
|
case "delete":
|
||||||
|
ElMessageBox.confirm(`确定解除${row.authType}的绑定吗?`, "警告", {
|
||||||
|
confirmButtonText: "确认",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning",
|
||||||
|
}).then(async () => {
|
||||||
|
await delOtherAuth(row.id);
|
||||||
|
await checkList();
|
||||||
|
ElMessage({
|
||||||
|
message: `已解除${row.authType}绑定!`,
|
||||||
|
type: "success",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const handleQQLogin = () => {
|
const handleQQLogin = () => {
|
||||||
window.open(
|
window.open(
|
||||||
"https://graph.qq.com/oauth2.0/authorize?response_type=code&client_id=102087446&redirect_uri=https://ccnetcore.com/auth/qq&state=1&scope=get_user_info",
|
"https://graph.qq.com/oauth2.0/authorize?response_type=code&client_id=102087446&redirect_uri=https://ccnetcore.com/auth/qq&state=1&scope=get_user_info",
|
||||||
|
|||||||
Reference in New Issue
Block a user