feat:第三方授权解除绑定对接
This commit is contained in:
@@ -115,3 +115,16 @@ export function getOtherAuthInfo(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"
|
||||
:options="tableOptions"
|
||||
:columns="tableColumn"
|
||||
@command="handleAction"
|
||||
></yi-table>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, onMounted } from "vue";
|
||||
import { getOtherAuthInfo } from "@/apis/auth.js";
|
||||
import { ref, computed, onMounted } from "vue";
|
||||
import { getOtherAuthInfo, delOtherAuth } from "@/apis/auth.js";
|
||||
import YiTable from "@/components/yi-table/index.vue";
|
||||
import useUserStore from "@/stores/user";
|
||||
|
||||
@@ -48,29 +49,23 @@ const tableColumn = [
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
prop: "timeInterval",
|
||||
prop: "authType",
|
||||
label: "绑定账号信息",
|
||||
minWidth: "110",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
prop: "timeInterval",
|
||||
prop: "name",
|
||||
label: "详情",
|
||||
minWidth: "110",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
prop: "timeInterval",
|
||||
prop: "creationTime",
|
||||
label: "绑定时间",
|
||||
minWidth: "110",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
prop: "timeInterval",
|
||||
label: "状态",
|
||||
minWidth: "110",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
label: "操作",
|
||||
align: "center",
|
||||
@@ -78,18 +73,46 @@ const tableColumn = [
|
||||
fixed: "right",
|
||||
buttons: [
|
||||
{
|
||||
name: "绑定",
|
||||
type: "text",
|
||||
command: "edit",
|
||||
name: "解除绑定",
|
||||
type: "danger",
|
||||
command: "delete",
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
onMounted(async () => {
|
||||
const tableData = ref([]);
|
||||
const checkList = async () => {
|
||||
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 = () => {
|
||||
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",
|
||||
|
||||
Reference in New Issue
Block a user