即将修改网站-联系我们-混乱中

This commit is contained in:
qingyu 2025-06-23 11:37:06 +08:00
parent 4a91040b14
commit 6fe815b8d9
9 changed files with 159 additions and 471 deletions

15
package-lock.json generated
View File

@ -2356,10 +2356,11 @@
"dev": true "dev": true
}, },
"node_modules/fast-diff": { "node_modules/fast-diff": {
"version": "1.2.0", "version": "1.3.0",
"resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz", "resolved": "https://registry.npmmirror.com/fast-diff/-/fast-diff-1.3.0.tgz",
"integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==", "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==",
"dev": true "dev": true,
"license": "Apache-2.0"
}, },
"node_modules/fast-glob": { "node_modules/fast-glob": {
"version": "3.3.1", "version": "3.3.1",
@ -6672,9 +6673,9 @@
"dev": true "dev": true
}, },
"fast-diff": { "fast-diff": {
"version": "1.2.0", "version": "1.3.0",
"resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz", "resolved": "https://registry.npmmirror.com/fast-diff/-/fast-diff-1.3.0.tgz",
"integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==", "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==",
"dev": true "dev": true
}, },
"fast-glob": { "fast-glob": {

View File

@ -3,12 +3,12 @@
*/ */
import request from '@/utils/request' import request from '@/utils/request'
// 获取菜单列表 // 获取菜单列表
export const getDataList = (params) => request.basic.get('/api/v1/web_site', params) export const getWebData = (params) => request.basic.get('/api/v1/web_site', params)
// 获取菜单条数据 // 获取菜单条数据
export const getMenu = (id) => request.basic.get(`/api/v1/web_site/${id}`) export const getMenu = (id) => request.basic.get(`/api/v1/web_site/${id}`)
// 添加菜单 // 添加菜单
export const createMenu = (params) => request.basic.post('/api/v1/web_site', params) export const createMenu = (params) => request.basic.post('/api/v1/web_site', params)
// 更新菜单 // 更新菜单
export const updateMenu = (id, params) => request.basic.put(`/api/v1/web_site/${id}`, params) export const updateWebData = (id, params) => request.basic.put(`/api/v1/web_site/${id}`, params)
// 删除菜单 // 删除菜单
export const delMenu = (id) => request.basic.delete(`/api/v1/web_site/${id}`) export const delMenu = (id) => request.basic.delete(`/api/v1/web_site/${id}`)

View File

@ -53,7 +53,7 @@ import { useForm, useModal } from '@/hooks'
import { message } from 'ant-design-vue' import { message } from 'ant-design-vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { createMenu, getMenu, updateMenu } from '@/apis/modules/imgmgt' import { createMenu, getMenu, updateMenu } from '@/apis/modules/team'
const emit = defineEmits(['ok']) const emit = defineEmits(['ok'])
const { t } = useI18n() // t const { t } = useI18n() // t
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal() const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()

View File

@ -102,7 +102,7 @@ import { usePagination } from '@/hooks'
import EditDialog from './components/EditDialog.vue' import EditDialog from './components/EditDialog.vue'
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue' import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { delMenu, getDataList } from '@/apis/modules/imgmgt' import { delMenu, getDataList } from '@/apis/modules/team'
defineOptions({ defineOptions({
name: 'team', name: 'team',
}) })

View File

@ -5,18 +5,38 @@
<a-card class="mb-8-2"> <a-card class="mb-8-2">
<a-row :gutter="12"> <a-row :gutter="12">
<a-col :span="24"> <a-col :span="24">
<a-form-item :label="'名称'" name="name"> <a-form-item :label="'零容忍'" name="reportContent">
<a-input :placeholder="'请输入名称'" v-model:value="formData.name"></a-input> <a-textarea :placeholder="'请输入零容忍内容'" v-model:value="formData.reportContent"></a-textarea>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-item :label="'链接'" name="link"> <a-form-item :label="'举报邮箱'" name="email">
<a-input :placeholder="'请输入链接'" v-model:value="formData.link"></a-input> <a-input :placeholder="'请输入举报邮箱'" v-model:value="formData.email"></a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-item :label="'顺序'" name="sequence"> <a-form-item :label="'经度'" name="lat">
<a-input-number :placeholder="'请输入顺序'" v-model:value="formData.sequence"></a-input-number> <a-input-number :placeholder="'请输入经度'" v-model:value="formData.lat"></a-input-number>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item :label="'纬度'" name="lon">
<a-input-number :placeholder="'请输入经度'" v-model:value="formData.lon"></a-input-number>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item :label="'地址'" name="address">
<a-input :placeholder="'请输入地址'" v-model:value="formData.address"></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item :label="'电话'" name="phone">
<a-input :placeholder="'请输入电话'" v-model:value="formData.phone"></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item :label="'编码'" name="reportNum">
<a-input :placeholder="'请输入编码'" v-model:value="formData.reportNum"></a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
@ -28,8 +48,8 @@
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-item :label="'图片'" name="img"> <a-form-item :label="'图片'" name="reportImage">
<x-upload-image v-model="img" @imgChange="imgChange" /> <x-upload-image v-model="reportImage" @imgChange="imgChange" />
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
@ -47,7 +67,7 @@ import { useForm, useModal } from '@/hooks'
import { message } from 'ant-design-vue' import { message } from 'ant-design-vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { createMenu, getMenu, updateMenu } from '@/apis/modules/imgmgt' import { createMenu, getMenu, updateMenu } from '@/apis/modules/webSite'
const emit = defineEmits(['ok']) const emit = defineEmits(['ok'])
const { t } = useI18n() // t const { t } = useI18n() // t
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal() const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
@ -58,10 +78,16 @@ const rolesValue = ref([])
const roles = ref([]) const roles = ref([])
const img = ref('') const img = ref('')
formRules.value = { formRules.value = {
name: { required: true, message: '请输入名称' }, reportContent: { required: true, message: '请输入零容忍内容' },
email: { required: true, message: '请输入举报邮箱' },
lat: { required: true, message: '请输入经度' },
lon: { required: true, message: '请输入纬度' },
address: { required: true, message: '请输入地址' },
phone: { required: true, message: '请输入电话' },
reportNum: { required: true, message: '请输入编码' },
status: [{ required: true, message: '请选择状态', trigger: 'change' }], status: [{ required: true, message: '请选择状态', trigger: 'change' }],
sequence: [{ required: true, message: '请选择顺序', trigger: 'change' }], sequence: [{ required: true, message: '请选择顺序', trigger: 'change' }],
img: [{ required: true, message: '请上传图片', trigger: 'change' }], reportImage: [{ required: false, message: '请上传图片', trigger: 'change' }],
} }
/** /**
* select 选择框 * select 选择框
@ -78,7 +104,6 @@ const imgChange = (value) => {
function handleCreate() { function handleCreate() {
showModal({ showModal({
type: 'create', type: 'create',
// 80about
title: '添加公司动态', title: '添加公司动态',
}) })
formData.value.status = 'enabled' formData.value.status = 'enabled'
@ -114,7 +139,7 @@ function handleOk() {
showLoading() showLoading()
const params = { const params = {
...values, ...values,
img: formData.value.img, reportImage: formData.value.reportImage,
// pushAt:dayjs(formData.value.pushAt).format("YYYY-MM-DD"), // pushAt:dayjs(formData.value.pushAt).format("YYYY-MM-DD"),
} }
let result = null let result = null

View File

@ -39,7 +39,7 @@
<template #icon> <template #icon>
<plus-outlined></plus-outlined> <plus-outlined></plus-outlined>
</template> </template>
新增零容忍信息 新增动态
</a-button> </a-button>
</x-action-bar> </x-action-bar>
<a-table :columns="columns" :data-source="listData" bordered="true" :loading="loading" <a-table :columns="columns" :data-source="listData" bordered="true" :loading="loading"
@ -75,62 +75,6 @@
</a-tooltip> </a-tooltip>
</template> </template>
<template v-if="'status' === column.dataIndex">
<a-tag v-if="record.status === 'enabled'" :color="'green'">启用</a-tag>
<a-tag v-if="record.status === 'disabled'" :color="'red'">停用</a-tag>
</template>
<template v-if="'action' === column.key">
<x-action-button @click="$refs.editDialogRef.handleEdit(record)">
<a-tooltip>
<template #title> {{ $t('pages.system.user.edit') }}</template>
<edit-outlined /> </a-tooltip></x-action-button>
<x-action-button @click="handleDelete(record)">
<a-tooltip>
<template #title>{{ $t('pages.system.delete') }}</template>
<delete-outlined style="color: #ff4d4f" /> </a-tooltip></x-action-button>
</template>
</template>
</a-table>
<x-action-bar class="mb-8-2" style="margin-top: 20px">
<a-button type="primary" @click="$refs.editDialogRef.handleCreate()">
<template #icon>
<plus-outlined></plus-outlined>
</template>
新增社交媒体
</a-button>
</x-action-bar>
<a-table :columns="columnsS" :data-source="listData" bordered="true" :loading="loading"
:pagination="paginationState" :scroll="{ x: 1000 }" @change="onTableChange">
<template #bodyCell="{ column, record }">
<template v-if="'reportImage' === column.dataIndex">
<!-- <a-image :width="60" :src="record.img || $imageErr.imgErr" />-->
<a-image :width="60" :src="config('http.apiBasic') + record.img || $imageErr.imgErr" />
</template>
<template v-if="column.dataIndex === 'reportContent'">
<a-tooltip :title="record.reportContent">
<span>{{ record.reportContent }}</span>
</a-tooltip>
</template>
<template v-if="column.dataIndex === 'email'">
<a-tooltip :title="record.email">
<span>{{ record.email }}</span>
</a-tooltip>
</template>
<template v-if="column.dataIndex === 'address'">
<a-tooltip :title="record.address">
<span>{{ record.address }}</span>
</a-tooltip>
</template>
<template v-if="column.dataIndex === 'phone'">
<a-tooltip :title="record.phone">
<span>{{ record.phone }}</span>
</a-tooltip>
</template>
<template v-if="column.dataIndex === 'reportNum'">
<a-tooltip :title="record.reportNum">
<span>{{ record.reportNum }}</span>
</a-tooltip>
</template>
<template v-if="'status' === column.dataIndex"> <template v-if="'status' === column.dataIndex">
<a-tag v-if="record.status === 'enabled'" :color="'green'">启用</a-tag> <a-tag v-if="record.status === 'enabled'" :color="'green'">启用</a-tag>
@ -148,7 +92,6 @@
</template> </template>
</template> </template>
</a-table> </a-table>
</a-card> </a-card>
</a-col> </a-col>
</a-row> </a-row>
@ -168,26 +111,23 @@ import { usePagination } from '@/hooks'
import EditDialog from './components/EditDialog.vue' import EditDialog from './components/EditDialog.vue'
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue' import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { delMenu, getDataList } from '@/apis/modules/imgmgt' import { delMenu, getDataList } from '@/apis/modules/webSite'
import { getWebDataList } from '@/apis/modules/webSite'
defineOptions({ defineOptions({
name: 'contactUs', name: 'contactUs',
}) })
const { t } = useI18n() // t const { t } = useI18n() // t
const columns = [ const columns = [
{ title: '图片', dataIndex: 'img', width: 100, align: 'center' }, { title: '图片', dataIndex: 'reportImage', width: 100, align: 'center' },
{ title: '零容忍', dataIndex: 'reportContent', key: 'reportContent' }, { title: '零容忍', dataIndex: 'reportContent', key: 'reportContent' },
{ title: '举报邮箱', dataIndex: 'email', key: 'email' }, { title: '举报邮箱', dataIndex: 'email', key: 'email' },
{ title: '经度', dataIndex: 'lat', key: 'lat' },
{ title: '纬度', dataIndex: 'lon', key: 'lon' },
{ title: '地址', dataIndex: 'address', width: 120, align: 'center' }, { title: '地址', dataIndex: 'address', width: 120, align: 'center' },
{ title: '电话', dataIndex: 'phone', width: 100, align: 'center' }, { title: '电话', dataIndex: 'phone', width: 100, align: 'center' },
{ title: '编码', dataIndex: 'reportNum', width: 100, align: 'center' }, { title: '编码', dataIndex: 'reportNum', width: 100, align: 'center' },
{ title: t('button.action'), key: 'action', fixed: 'right', width: 100, align: 'center' }, { title: t('button.action'), key: 'action', fixed: 'right', width: 100, align: 'center' },
] ]
const columnsS = [
{ title: '图片', dataIndex: 'img', width: 100, align: 'center' },
{ title: '链接', dataIndex: 'reportContent', key: 'reportContent' },
{ title: '名称', dataIndex: 'name', key: 'name' },
{ title: t('button.action'), key: 'action', fixed: 'right', width: 100, align: 'center' },
]
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } = const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } =
usePagination() usePagination()
@ -203,7 +143,7 @@ async function getPageList() {
showLoading() showLoading()
const { pageSize, current } = paginationState const { pageSize, current } = paginationState
const { success, data, total } = await apis.webSite const { success, data, total } = await apis.webSite
.getDataList({ .getWebDataList({
pageSize, pageSize,
page: current, page: current,
...searchFormData.value, ...searchFormData.value,
@ -213,8 +153,7 @@ async function getPageList() {
}) })
hideLoading() hideLoading()
if (config('http.code.success') === success) { if (config('http.code.success') === success) {
//type10friendlyLinks listData.value = data
listData.value = data.filter(item => item.type===10)
paginationState.total = total paginationState.total = total
} }
} catch (error) { } catch (error) {

View File

@ -1,112 +1,20 @@
<template> <template>
<a-modal <a-modal :open="modal.open" :title="modal.title" :width="640" :confirm-loading="modal.confirmLoading"
:open="modal.open" :after-close="onAfterClose" :cancel-text="cancelText" :ok-text="okText" @ok="handleOk" @cancel="handleCancel">
:title="modal.title" <a-form ref="formRef" :model="formData" :rules="formRules">
:width="640"
:confirm-loading="modal.confirmLoading"
:after-close="onAfterClose"
:cancel-text="cancelText"
:ok-text="okText"
@ok="handleOk"
@cancel="handleCancel">
<a-form
ref="formRef"
:model="formData"
:rules="formRules"
:label-col="{ style: { width: '90px' } }">
<a-card class="mb-8-2"> <a-card class="mb-8-2">
<a-row :gutter="12">
<a-col :span="12">
<a-form-item
:label="$t('pages.system.user.form.username')"
name="username">
<a-input
:placeholder="$t('pages.system.user.form.username.placeholder')"
v-model:value="formData.username"></a-input>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item
:label="$t('pages.system.user.form.password')"
name="password">
<a-input-password
v-model:value="formData.password"
:placeholder="$t('pages.system.user.form.password.placeholder')" />
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="12">
<a-col :span="12">
<a-form-item
:label="$t('pages.system.user.form.name')"
name="name">
<a-input
:placeholder="$t('pages.system.user.form.name.placeholder')"
v-model:value="formData.name"></a-input>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item
:label="$t('pages.system.user.form.roles')"
name="roles">
<a-select
v-model:value="formData.roles"
mode="multiple"
style="width: 100%"
:placeholder="$t('pages.system.user.form.roles.placeholder')"
:options="roles"
@change="handleChange"></a-select>
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="12">
<a-col :span="12">
<a-form-item
:label="$t('pages.system.user.form.phone')"
type="tel"
name="phone">
<a-input
:placeholder="$t('pages.system.user.form.phone.placeholder')"
type="tel"
v-model:value="formData.phone"></a-input>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item
:label="$t('pages.system.user.form.email')"
type="email"
name="email">
<a-input
:placeholder="$t('pages.system.user.form.email.placeholder')"
type="email"
v-model:value="formData.email"></a-input>
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="12"> <a-row :gutter="12">
<a-col :span="24"> <a-col :span="24">
<a-form-item <a-form-item :label="'声明'" name="affirm">
:label="$t('pages.system.user.form.remark')" <a-input :placeholder="'请输入声明内容'" v-model:value="formData.affirm"></a-input>
name="remark">
<a-textarea
:placeholder="$t('pages.system.user.form.remark.placeholder')"
v-model:value="formData.remark"></a-textarea>
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row>
<a-row :gutter="12">
<a-col :span="24"> <a-col :span="24">
<a-form-item <a-form-item :label="'状态'" name="status">
:label="$t('pages.system.user.form.status')" <a-radio-group v-model:value="formData.status" :options="[
name="status"> { label: '启用', value: 'enabled' },
<a-radio-group { label: '停用', value: 'disabled' },
v-model:value="formData.status" ]"></a-radio-group>
:options="[
{ label: $t('pages.system.user.form.status.activated'), value: 'activated' },
{ label: $t('pages.system.user.form.status.freezed'), value: 'freezed' },
]"></a-radio-group>
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
@ -123,6 +31,8 @@ import apis from '@/apis'
import { useForm, useModal } from '@/hooks' import { useForm, useModal } from '@/hooks'
import { message } from 'ant-design-vue' import { message } from 'ant-design-vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import dayjs from 'dayjs'
import { createMenu, getMenu, updateMenu } from '@/apis/modules/imgmgt'
const emit = defineEmits(['ok']) const emit = defineEmits(['ok'])
const { t } = useI18n() // t const { t } = useI18n() // t
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal() const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
@ -131,53 +41,31 @@ const cancelText = ref(t('button.cancel'))
const okText = ref(t('button.confirm')) const okText = ref(t('button.confirm'))
const rolesValue = ref([]) const rolesValue = ref([])
const roles = ref([]) const roles = ref([])
const img = ref('')
formRules.value = { formRules.value = {
name: { required: true, message: t('pages.system.user.form.username.placeholder') }, name: { required: true, message: '请输入名称' },
username: { required: true, message: t('pages.system.user.form.code.placeholder') }, status: [{ required: true, message: '请选择状态', trigger: 'change' }],
status: { required: true, message: t('pages.system.user.form.status') },
roles: [{ required: true, message: t('pages.system.user.form.roles.placeholder'), trigger: 'change' }],
} }
/**
* 请求角色
*/
getRole()
/** /**
* select 选择框 * select 选择框
*/ */
const handleChange = (value) => { const handleChange = (value) => {
rolesValue.value = value rolesValue.value = value
} }
const imgChange = (value) => {
formData.value.img = value
}
/** /**
* 新建 * 新建
*/ */
function handleCreate() { function handleCreate() {
showModal({ showModal({
type: 'create', type: 'create',
title: t('pages.system.user.add'), title: '添加公司动态',
}) })
formData.value.status = 'enabled'
} }
async function getRole() {
const { success, data } = await apis.role.getRoleList().catch(() => {
throw new Error()
})
if (!success) {
return message.error('当前角色信息错误')
}
let roleArr = []
if (data.length) {
data.forEach((item) => {
roleArr.push({
label: item.name,
value: item.id,
})
})
}
roles.value = roleArr
}
/** /**
* 编辑 * 编辑
*/ */
@ -186,58 +74,60 @@ async function handleEdit(record = {}) {
type: 'edit', type: 'edit',
title: t('pages.system.user.edit'), title: t('pages.system.user.edit'),
}) })
const { data, success } = await apis.users.getUsers(record.id).catch() const { data, success } = await apis.webSite.getMenu(record.id).catch()
if (!success) { if (!success) {
hideModal() hideModal()
return return
} }
let roles = [] formData.value = { ...data }
if (data.roles) { formData.value.pushAt=dayjs(data.pushAt)
roles = formatArr(data.roles, 'edit') console.log(formData.value)
} // img.value = config('http.apiBasic') + data.img
data.roles = roles
formRecord.value = data
formData.value = cloneDeep(data)
} }
/** /**
* 确定 * 确定
*/ */
function handleOk() { function handleOk() {
formRef.value // if (!formData.value.img) return message.error('');
.validateFields() formRef.value.validateFields().then(async (values) => {
.then(async (values) => { console.log(values)
try { try {
showLoading() showLoading()
const params = {
const params = { ...values,
...values, // img: formData.value.img,
roles: formatArr(rolesValue.value), pushAt:dayjs(formData.value.pushAt).format("YYYY-MM-DD"),
} // type: 10 ,
let result = null // // 10friendlyLinks
switch (modal.value.type) {
case 'create':
result = await apis.users.createUsers(params).catch(() => {
throw new Error()
})
break
case 'edit':
result = await apis.users.updateUsers(formData.value.id, params).catch(() => {
throw new Error()
})
break
}
hideLoading()
if (config('http.code.success') === result?.success) {
hideModal()
emit('ok')
}
} catch (error) {
hideLoading()
} }
}) let result = null
.catch(() => { console.log(modal.value.type)
switch (modal.value.type) {
case 'create':
result = await apis.webSite.createMenu(params).catch(() => {
throw new Error()
})
break
case 'edit':
// result = await apis.webSite.updateMenu(formData.value.id, params).catch(() => {
result = await apis.webSite.updateMenu(formData.value.id, params).catch(() => {
throw new Error()
})
break
}
hideLoading()
if (config('http.code.success') === result?.success) {
hideModal()
emit('ok')
}
} catch (error) {
console.log(error)
hideLoading()
}
})
.catch((e) => {
console.log(e)
hideLoading() hideLoading()
}) })
} }
@ -273,6 +163,7 @@ function formatArr(data, type = '') {
* 取消 * 取消
*/ */
function handleCancel() { function handleCancel() {
img.value = ''
hideModal() hideModal()
} }

View File

@ -1,233 +1,65 @@
<template> <template>
<x-search-bar class="mb-8-2"> <x-search-bar class="mb-8-2">
<template #default="{ gutter, colSpan }"> <template #default="{ gutter, colSpan }">
<a-form <x-editor placeholder="请输入声明内容" v-model:value="searchFormData.affirm"></x-editor>
:label-col="{ style: { width: '100px' } }" <a-button ghost type="primary" @click="handleSearch" style="margin-top: 20px">保存</a-button>
:model="searchFormData"
layout="inline">
<a-row :gutter="gutter">
<a-col v-bind="colSpan">
<a-form-item
:label="$t('pages.system.user.form.username')"
name="username">
<a-input
:placeholder="$t('pages.system.user.form.username.placeholder')"
v-model:value="searchFormData.username"></a-input>
</a-form-item>
</a-col>
<a-col v-bind="colSpan">
<a-form-item name="name">
<template #label>
{{ $t('pages.system.user.form.name') }}
<a-tooltip :title="$t('pages.system.user.form.name')">
<question-circle-outlined class="ml-4-1 color-placeholder" />
</a-tooltip>
</template>
<a-input
:placeholder="$t('pages.system.user.form.name.placeholder')"
v-model:value="searchFormData.name"></a-input>
</a-form-item>
</a-col>
<a-col
class="align-right"
v-bind="colSpan">
<a-space>
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
<a-button
ghost
type="primary"
@click="handleSearch">
{{ $t('button.search') }}
</a-button>
</a-space>
</a-col>
</a-row>
</a-form>
</template> </template>
</x-search-bar> </x-search-bar>
<a-row
:gutter="8"
:wrap="false">
<a-col flex="auto">
<a-card type="flex">
<x-action-bar class="mb-8-2">
<a-button
type="primary"
@click="$refs.editDialogRef.handleCreate()">
<template #icon>
<plus-outlined></plus-outlined>
</template>
{{ $t('pages.system.user.add') }}
</a-button>
</x-action-bar>
<a-table
:columns="columns"
:data-source="listData"
:loading="loading"
:pagination="paginationState"
:scroll="{ x: 1000 }"
@change="onTableChange">
<template #bodyCell="{ column, record }">
<template v-if="'statusType' === column.key">
<!--状态-->
<a-tag
v-if="statusUserTypeEnum.is('activated', record.status)"
color="processing">
{{ statusUserTypeEnum.getDesc(record.status) }}
</a-tag>
<!--状态-->
<a-tag
v-if="statusUserTypeEnum.is('freezed', record.status)"
color="processing">
{{ statusUserTypeEnum.getDesc(record.status) }}
</a-tag>
</template>
<template v-if="'createAt' === column.key">
{{ formatUtcDateTime(record.created_at) }}
</template>
<template v-if="'action' === column.key">
<x-action-button @click="$refs.editDialogRef.handleEdit(record)">
<a-tooltip>
<template #title> {{ $t('pages.system.user.edit') }}</template>
<edit-outlined /> </a-tooltip
></x-action-button>
<x-action-button @click="handleDelete(record)">
<a-tooltip>
<template #title>{{ $t('pages.system.delete') }}</template>
<delete-outlined style="color: #ff4d4f" /> </a-tooltip
></x-action-button>
</template>
</template>
</a-table>
</a-card>
</a-col>
</a-row>
<edit-dialog
ref="editDialogRef"
@ok="onOk"></edit-dialog>
</template> </template>
<script setup> <script setup>
import { message, Modal } from 'ant-design-vue' import { message } from 'ant-design-vue'
import { ref } from 'vue' import { ref } from 'vue'
import apis from '@/apis' import apis from '@/apis' // saveAffirm
import { formatUtcDateTime } from '@/utils/util'
import { config } from '@/config'
import { statusUserTypeEnum } from '@/enums/system'
import { usePagination } from '@/hooks' import { usePagination } from '@/hooks'
import EditDialog from './components/EditDialog.vue'
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { getWebData,updateWebData } from '@/apis/modules/webSite' //
defineOptions({ defineOptions({
name: 'websiteStatement', name: 'friendlyLinks',
}) })
const { t } = useI18n() // t const { t } = useI18n()
const columns = [ const { showLoading, hideLoading, searchFormData } = usePagination()
{ title: t('pages.system.user.form.username'), dataIndex: 'username', width: 120 }, searchFormData.affirm = '' //
{ title: t('pages.system.user.form.name'), dataIndex: 'name', key: 'name', width: 100 },
{ title: t('pages.system.user.form.phone'), dataIndex: 'phone', width: 120 },
{ title: t('pages.system.user.form.email'), dataIndex: 'email', width: 100 },
{ title: t('pages.system.user.form.status'), dataIndex: 'status', key: 'statusType', width: 60 },
{ title: t('pages.system.user.form.created_at'), key: 'createAt', fixed: 'right', width: 120 },
{ title: t('button.action'), key: 'action', fixed: 'right', width: 100 },
]
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } = //
usePagination()
const editDialogRef = ref()
getPageList() getPageList()
/** /**
* 获取用户列表 * 获取声明内容
* @returns {Promise<void>}
*/ */
async function getPageList() { async function getPageList() {
try { try {
showLoading() showLoading()
const { pageSize, current } = paginationState const res = await getWebData() // { data: { affirm: '' } }
const { success, data, total } = await apis.users if (res?.data?.affirm) {
.getUsersList({ searchFormData.affirm = res.data.affirm
pageSize,
page: current,
...searchFormData.value,
})
.catch(() => {
throw new Error()
})
hideLoading()
if (config('http.code.success') === success) {
listData.value = data
paginationState.total = total
} }
} catch (error) { } catch (e) {
message.error('获取声明内容失败')
} finally {
hideLoading() hideLoading()
} }
} }
/** /**
* 删除 * 提交声明内容
*/ */
function handleDelete({ id }) { async function handleSearch() {
Modal.confirm({ if (!searchFormData.affirm?.trim()) {
title: t('pages.system.user.delTip'), message.warning('请输入声明内容')
content: t('button.confirm'), return
okText: t('button.confirm'), }
onOk: () => {
return new Promise((resolve, reject) => {
;(async () => {
try {
const { success } = await apis.users.delUsers(id).catch(() => {
throw new Error()
})
if (config('http.code.success') === success) {
resolve()
message.success(t('component.message.success.delete'))
await getPageList()
}
} catch (error) {
reject()
}
})()
})
},
})
}
/** try {
* 分页 showLoading()
*/ await apis.updateWebData({ affirm: searchFormData.affirm }) //
function onTableChange({ current, pageSize }) {
paginationState.current = current
paginationState.pageSize = pageSize
getPageList()
}
/** message.success('保存成功')
* 搜索 } catch (e) {
*/ message.error('保存失败,请重试')
function handleSearch() { } finally {
resetPagination() hideLoading()
getPageList() }
}
/**
* 重置
*/
function handleResetSearch() {
searchFormData.value = {}
resetPagination()
getPageList()
}
/**
* 编辑完成
*/
async function onOk() {
message.success(t('component.message.success.delete'))
await getPageList()
} }
</script> </script>

View File

@ -1203,9 +1203,9 @@ fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3:
integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==
fast-diff@^1.1.2: fast-diff@^1.1.2:
version "1.2.0" version "1.3.0"
resolved "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz" resolved "https://registry.npmmirror.com/fast-diff/-/fast-diff-1.3.0.tgz"
integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w== integrity sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==
fast-glob@^3.3.0: fast-glob@^3.3.0:
version "3.3.1" version "3.3.1"