|
@@ -0,0 +1,116 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <el-card>
|
|
|
+ <!-- 添加el-dialog组件 -->
|
|
|
+ <el-table :data="tableData" border style="width: 100%;margin-top:20px">
|
|
|
+ <el-table-column label="序号" width="60">
|
|
|
+ <template #default="scope">
|
|
|
+ {{ scope.$index + 1 }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="name" label="名称" width="180">
|
|
|
+ <template #default="scope">
|
|
|
+ {{ scope.row.name }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="synopsis" label="联系方式" width="180">
|
|
|
+ <template #default="scope">
|
|
|
+ {{ scope.row.phone }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="type" label="消息" width="180">
|
|
|
+ <template #default="scope">
|
|
|
+ {{ scope.row.message }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="type" label="时间" width="300">
|
|
|
+ <template #default="scope">
|
|
|
+ {{ scope.row.CreatedAt }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" width="200">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-button type="danger" size="small" @click="deleteProduct(scope.row.ID)">删除</el-button>
|
|
|
+ <!-- <el-button type="primary" size="small" @click="deleteResource(scope.row.ID)">修改</el-button>-->
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <!-- 分页 -->
|
|
|
+ <el-pagination style="margin-top:20px" :current-page="searchForm.page" :page-size="searchForm.size"
|
|
|
+ :total="total"
|
|
|
+ @current-change="handleCurrentChange"/>
|
|
|
+ </el-card>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+import {onMounted, reactive, ref} from "vue";
|
|
|
+import {ElMessage, ElMessageBox} from 'element-plus';
|
|
|
+import {useRouter} from 'vue-router'
|
|
|
+import contact from "../../api/contact.js";
|
|
|
+
|
|
|
+const router = useRouter();
|
|
|
+// Dom 挂载之后
|
|
|
+onMounted(() => {
|
|
|
+ getContactAll();
|
|
|
+})
|
|
|
+// 资源数据
|
|
|
+const typeMapping = {
|
|
|
+ recruit: '招募',
|
|
|
+ about: '关于我们',
|
|
|
+}
|
|
|
+const showUpload = ref(false);
|
|
|
+const showUploadDialog = ref(false);
|
|
|
+let tableData = ref([]);
|
|
|
+let total = ref(0);
|
|
|
+const toggleUpload = () => {
|
|
|
+ showUpload.value = !showUpload.value;
|
|
|
+};
|
|
|
+// 搜索条件
|
|
|
+const searchForm = reactive({
|
|
|
+ page: 1,
|
|
|
+ size: 10,
|
|
|
+ desc: 'created_at desc'
|
|
|
+})
|
|
|
+// 获取资源列表
|
|
|
+const getContactAll = async () => {
|
|
|
+ const res = await contact.getAllContact(searchForm);
|
|
|
+ tableData.value = res.data.Data.Data;
|
|
|
+ total.value = res.data.Data.Size;
|
|
|
+}
|
|
|
+
|
|
|
+const handleCurrentChange = (current) => {
|
|
|
+ searchForm.page = current;
|
|
|
+ getContactAll();
|
|
|
+}
|
|
|
+const searchUser = () => {
|
|
|
+ searchForm.current = 1;
|
|
|
+ getContactAll();
|
|
|
+}
|
|
|
+// 删除资源信息
|
|
|
+const deleteProduct = (id) => {
|
|
|
+ ElMessageBox.confirm(
|
|
|
+ '确定要删除该资源信息吗?',
|
|
|
+ {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ }
|
|
|
+ ).then(async () => {
|
|
|
+ const res = await contact.deleteContact({id: id});
|
|
|
+ if (res.data.code === 200) {
|
|
|
+ ElMessage.success("删除成功")
|
|
|
+ await getContactAll();
|
|
|
+ } else {
|
|
|
+ ElMessage.error(res.data.Msg)
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ ElMessage({
|
|
|
+ type: 'info',
|
|
|
+ message: '取消删除',
|
|
|
+ })
|
|
|
+ })
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped></style>
|