🎨新增用户头像更换、客户端邮件通知
This commit is contained in:
parent
9d67b38796
commit
0ef9dfab57
@ -47,3 +47,8 @@ export const getClientConnects = () => {
|
|||||||
export const offlineClient = (id: string) => {
|
export const offlineClient = (id: string) => {
|
||||||
return http.request<any>("post", baseUri("/client/offline/" + id));
|
return http.request<any>("post", baseUri("/client/offline/" + id));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 发送邮件
|
||||||
|
export const sendMail = (id: string) => {
|
||||||
|
return http.request<any>("post", baseUri("/client/to-email/" + id));
|
||||||
|
};
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { http } from "@/utils/http";
|
import { http } from "@/utils/http";
|
||||||
import { baseUri } from "@/api/utils";
|
import { baseUri } from "@/api/utils";
|
||||||
|
import { data } from "autoprefixer";
|
||||||
|
|
||||||
// 获取当前登陆用户信息
|
// 获取当前登陆用户信息
|
||||||
export const getUser = () => {
|
export const getUser = () => {
|
||||||
@ -30,3 +31,8 @@ export const deleteUser = (userId: string) => {
|
|||||||
export const changePassword = (data?: object) => {
|
export const changePassword = (data?: object) => {
|
||||||
return http.request("post", baseUri("/user/change-password"), { data });
|
return http.request("post", baseUri("/user/change-password"), { data });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 生成头像
|
||||||
|
export const generateAvatar = () => {
|
||||||
|
return http.request<any>("post", baseUri("/user/change-avatar"));
|
||||||
|
};
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import { FormInstance } from "element-plus";
|
import { FormInstance } from "element-plus";
|
||||||
|
import { generateAvatar } from "@/api/user";
|
||||||
|
|
||||||
// 声明 props 类型
|
// 声明 props 类型
|
||||||
export interface FormProps {
|
export interface FormProps {
|
||||||
@ -41,11 +42,29 @@ function getUserEditFormRef() {
|
|||||||
return userEditFormRef.value;
|
return userEditFormRef.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 切换头像
|
||||||
|
const changeAvatar = () => {
|
||||||
|
generateAvatar().then(res => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
userEditForm.value.avatar = res.data;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
defineExpose({ getUserEditFormRef });
|
defineExpose({ getUserEditFormRef });
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<el-form ref="userEditFormRef" :model="userEditForm" label-width="20%">
|
<el-form ref="userEditFormRef" :model="userEditForm" label-width="20%">
|
||||||
|
<el-form-item prop="avatar">
|
||||||
|
<el-avatar
|
||||||
|
style="cursor: pointer; margin-left: 25%"
|
||||||
|
size="large"
|
||||||
|
fit="cover"
|
||||||
|
:src="userEditForm.avatar"
|
||||||
|
@click="changeAvatar()"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item
|
<el-form-item
|
||||||
prop="name"
|
prop="name"
|
||||||
label="名称"
|
label="名称"
|
||||||
|
@ -4,7 +4,8 @@ import {
|
|||||||
downloadClient,
|
downloadClient,
|
||||||
generateClientIP,
|
generateClientIP,
|
||||||
getClients,
|
getClients,
|
||||||
saveClient
|
saveClient,
|
||||||
|
sendMail
|
||||||
} from "@/api/clients";
|
} from "@/api/clients";
|
||||||
import { h, reactive, ref } from "vue";
|
import { h, reactive, ref } from "vue";
|
||||||
import { addDialog } from "@/components/ReDialog/index";
|
import { addDialog } from "@/components/ReDialog/index";
|
||||||
@ -15,6 +16,7 @@ import "plus-pro-components/es/components/search/style/css";
|
|||||||
import { storageLocal } from "@pureadmin/utils";
|
import { storageLocal } from "@pureadmin/utils";
|
||||||
import { ArrowDown } from "@element-plus/icons-vue";
|
import { ArrowDown } from "@element-plus/icons-vue";
|
||||||
import { ElMessageBox } from "element-plus";
|
import { ElMessageBox } from "element-plus";
|
||||||
|
import { message } from "@/utils/message";
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
// name 作为一种规范最好必须写上并且和路由的name保持一致
|
// name 作为一种规范最好必须写上并且和路由的name保持一致
|
||||||
@ -152,7 +154,7 @@ const openAddClientDialog = () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
const serverInfo = storageLocal().getItem("server-info");
|
const serverInfo = storageLocal().getItem("server-info");
|
||||||
const restartRule = storageLocal().getItem("restart-rule") ? 1 : 0;
|
const restartRule = !storageLocal().getItem("restart-rule") ? 1 : 0;
|
||||||
addDialog({
|
addDialog({
|
||||||
width: "40%",
|
width: "40%",
|
||||||
title: "新增",
|
title: "新增",
|
||||||
@ -280,6 +282,15 @@ const ellipsis = (str: string) => {
|
|||||||
return str;
|
return str;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 发送到邮件
|
||||||
|
const sendToEmail = (clientID: string) => {
|
||||||
|
sendMail(clientID).then(res => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
message("发送邮件成功", { type: "success" });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
getClientsApi(clientSearchForm.value);
|
getClientsApi(clientSearchForm.value);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -310,7 +321,10 @@ getClientsApi(clientSearchForm.value);
|
|||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<el-card body-style="padding: inherit" shadow="hover">
|
<el-card body-style="padding: inherit" shadow="hover">
|
||||||
<div class="flex flex-wrap gap-4" style="display: flex;justify-content: center;">
|
<div
|
||||||
|
class="flex flex-wrap gap-4"
|
||||||
|
style="display: flex; justify-content: center"
|
||||||
|
>
|
||||||
<el-card
|
<el-card
|
||||||
v-for="val in clientsList.data"
|
v-for="val in clientsList.data"
|
||||||
style="float: left; width: 500px"
|
style="float: left; width: 500px"
|
||||||
@ -339,6 +353,11 @@ getClientsApi(clientSearchForm.value);
|
|||||||
>下载</el-button
|
>下载</el-button
|
||||||
>
|
>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
|
<el-dropdown-item>
|
||||||
|
<el-button type="success" @click="sendToEmail(val.id)"
|
||||||
|
>邮件</el-button
|
||||||
|
>
|
||||||
|
</el-dropdown-item>
|
||||||
<el-dropdown-item>
|
<el-dropdown-item>
|
||||||
<el-button
|
<el-button
|
||||||
type="danger"
|
type="danger"
|
||||||
|
Loading…
Reference in New Issue
Block a user