mirror of
https://gitee.com/xiangheng/x_admin.git
synced 2025-12-24 08:12:55 +08:00
优化字典,删除部分代码
This commit is contained in:
@@ -1,26 +0,0 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 页面装修详情
|
||||
export function getDecoratePages(params: any) {
|
||||
return request.get({ url: '/decorate/pages/detail', params }, { ignoreCancelToken: true })
|
||||
}
|
||||
|
||||
// 页面装修保存
|
||||
export function setDecoratePages(params: any) {
|
||||
return request.post({ url: '/decorate/pages/save', params })
|
||||
}
|
||||
|
||||
// 获取首页文章数据
|
||||
export function getDecorateArticle(params?: any) {
|
||||
return request.get({ url: '/decorate/data/article', params })
|
||||
}
|
||||
|
||||
// 底部导航详情
|
||||
export function getDecorateTabbar(params?: any) {
|
||||
return request.get({ url: '/decorate/tabbar/detail', params })
|
||||
}
|
||||
|
||||
// 底部导航保存
|
||||
export function setDecorateTabbar(params: any) {
|
||||
return request.post({ url: '/decorate/tabbar/save', params })
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
/**
|
||||
* @return { Promise }
|
||||
* @description 获取热门搜索数据
|
||||
*/
|
||||
export function getSearch() {
|
||||
return request.get({ url: '/setting/search/detail' })
|
||||
}
|
||||
|
||||
export interface List {
|
||||
name: string // 搜索关键字
|
||||
sort: number // 热门搜索排序
|
||||
}
|
||||
|
||||
export interface Search {
|
||||
isHotSearch: number // 是否开启搜索0/1
|
||||
list: List[]
|
||||
}
|
||||
/**
|
||||
* @return { Promise }
|
||||
* @param { Search } Search
|
||||
* @description 设置热门搜索
|
||||
*/
|
||||
export function setSearch(params: Search) {
|
||||
return request.post({ url: '/setting/search/save', params })
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 获取存储引擎列表
|
||||
export function storageLists() {
|
||||
return request.get({ url: '/setting/storage/list' })
|
||||
}
|
||||
|
||||
// 设置存储引擎信息
|
||||
export function storageChange(params: any) {
|
||||
return request.post({ url: '/setting/storage/change', params })
|
||||
}
|
||||
|
||||
// 设置存储引擎信息
|
||||
export function storageSetup(params: any) {
|
||||
return request.post({ url: '/setting/storage/edit', params })
|
||||
}
|
||||
|
||||
// 获取存储配置信息
|
||||
export function storageDetail(params: any) {
|
||||
return request.get({ url: '/setting/storage/detail', params })
|
||||
}
|
||||
@@ -11,12 +11,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" min-width="120" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
v-perms="['admin:setting:storage:edit']"
|
||||
type="primary"
|
||||
link
|
||||
@click="handleSet(row.alias)"
|
||||
>
|
||||
<el-button type="primary" link @click="handleSet(row.alias)">
|
||||
设置
|
||||
</el-button>
|
||||
</template>
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
</el-form-item>
|
||||
<el-form-item class="w-[280px]" label="数据状态">
|
||||
<el-select v-model="queryParams.status">
|
||||
<el-option label="全部" value />
|
||||
<el-option label="正常" :value="1" />
|
||||
<el-option label="停用" :value="0" />
|
||||
</el-select>
|
||||
@@ -61,7 +60,7 @@
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column label="ID" prop="id" />
|
||||
<!-- <el-table-column label="ID" prop="id" /> -->
|
||||
<el-table-column label="数据名称" prop="name" min-width="120">
|
||||
<template v-slot="{ row }">
|
||||
<span :style="{ color: row.color }">{{ row.name }}</span>
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
</el-form-item>
|
||||
<el-form-item class="w-[280px]" label="状态">
|
||||
<el-select v-model="queryParams.dictStatus">
|
||||
<el-option label="全部" value />
|
||||
<el-option label="正常" :value="1" />
|
||||
<el-option label="停用" :value="0" />
|
||||
</el-select>
|
||||
@@ -53,9 +52,9 @@
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column label="ID" prop="id" />
|
||||
<el-table-column label="字典名称" prop="dictName" min-width="120" />
|
||||
<el-table-column label="字典类型" prop="dictType" min-width="120" />
|
||||
<!-- <el-table-column label="ID" prop="id" width="100" /> -->
|
||||
<el-table-column label="字典名称" prop="dictName" />
|
||||
<el-table-column label="字典类型" prop="dictType" />
|
||||
<el-table-column label="状态">
|
||||
<template v-slot="{ row }">
|
||||
<el-tag v-if="row.dictStatus == 1" type="primary">正常</el-tag>
|
||||
@@ -67,7 +66,7 @@
|
||||
prop="dictRemark"
|
||||
show-tooltip-when-overflow
|
||||
/>
|
||||
<el-table-column label="创建时间" prop="createTime" min-width="180" />
|
||||
<el-table-column label="创建时间" prop="createTime" />
|
||||
<el-table-column label="操作" width="190" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
@@ -85,7 +84,7 @@
|
||||
>
|
||||
<router-link
|
||||
:to="{
|
||||
path: '/dev_tools/dict/data',
|
||||
path: '/setting/dict/data',
|
||||
query: {
|
||||
type: row.dictType
|
||||
}
|
||||
|
||||
@@ -1,180 +0,0 @@
|
||||
<template>
|
||||
<div class="hot-search">
|
||||
<el-card class="!border-none" shadow="never">
|
||||
<el-form ref="formRef" :model="formData" label-width="100px">
|
||||
<el-form-item label="功能状态" style="margin-bottom: 0">
|
||||
<div>
|
||||
<el-radio-group v-model="formData.isHotSearch">
|
||||
<el-radio :label="1">开启</el-radio>
|
||||
<el-radio :label="0">关闭</el-radio>
|
||||
</el-radio-group>
|
||||
|
||||
<div class="form-tips">默认开启,关闭则前端不显示该功能</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="!border-none mt-4" shadow="never">
|
||||
<div class="lg:flex">
|
||||
<div class="flex-1 min-w-0">
|
||||
<el-button type="primary" class="mb-4" @click="handleAdd">
|
||||
<template #icon>
|
||||
<icon name="el-icon-Plus" />
|
||||
</template>
|
||||
添加
|
||||
</el-button>
|
||||
<el-table size="large" :data="formData.list">
|
||||
<el-table-column label="关键词" prop="describe" min-width="200">
|
||||
<template #default="{ row }">
|
||||
<el-input
|
||||
v-model.trim="row.name"
|
||||
clearable
|
||||
placeholder="请输入关键字"
|
||||
show-word-limit
|
||||
maxlength="30"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="排序" prop="describe" min-width="80">
|
||||
<template #default="{ row }">
|
||||
<el-input v-model="row.sort" type="number" clearable />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" min-width="80" fixed="right">
|
||||
<template #default="{ $index }">
|
||||
<el-button
|
||||
v-perms="['admin:setting:storage:edit']"
|
||||
type="danger"
|
||||
link
|
||||
@click="handleDel($index)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<div class="flex-none hot-search-phone mt-4 lg:mt-0 lg:ml-4">
|
||||
<div class="mb-4 text-center">- 热搜预览图 -</div>
|
||||
<div class="hot-search-phone-content">
|
||||
<!-- 搜索框 -->
|
||||
<div class="search-com">
|
||||
<div class="search-con flex items-center px-[15px]">
|
||||
<icon name="el-icon-Search" :size="17" />
|
||||
<span class="ml-[5px]">请输入关键词搜索</span>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 热门搜索 -->
|
||||
<div class="hot-search-title">热门搜索</div>
|
||||
<div class="hot-search-text">
|
||||
<span
|
||||
class="truncate max-w-full"
|
||||
v-for="(text, index) in list"
|
||||
:key="index"
|
||||
>{{ text.name }}</span
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<footer-btns v-perms="['admin:setting:search:save']">
|
||||
<el-button type="primary" @click="handleSave">保存</el-button>
|
||||
</footer-btns>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="search">
|
||||
import { getSearch, setSearch } from '@/api/setting/search'
|
||||
import type { Search } from '@/api/setting/search'
|
||||
import feedback from '@/utils/feedback'
|
||||
|
||||
const formData = reactive<Search>({
|
||||
isHotSearch: 1,
|
||||
list: []
|
||||
})
|
||||
|
||||
const list = computed(() => {
|
||||
return formData.list.filter((item) => item.name).sort((v1, v2) => v2.sort - v1.sort)
|
||||
})
|
||||
|
||||
// 获取登录注册数据
|
||||
const getData = async () => {
|
||||
try {
|
||||
const data = await getSearch()
|
||||
for (const key in formData) {
|
||||
//@ts-ignore
|
||||
formData[key] = data[key]
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('获取=>', error)
|
||||
}
|
||||
}
|
||||
|
||||
const handleAdd = () => {
|
||||
formData.list.push({
|
||||
name: '',
|
||||
sort: 0
|
||||
})
|
||||
}
|
||||
|
||||
const handleDel = (index: number) => {
|
||||
formData.list.splice(index, 1)
|
||||
}
|
||||
|
||||
const handleSave = async () => {
|
||||
try {
|
||||
await setSearch(formData)
|
||||
feedback.msgSuccess('操作成功')
|
||||
getData()
|
||||
} catch (error) {
|
||||
console.log('保存=>', error)
|
||||
}
|
||||
}
|
||||
|
||||
getData()
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.hot-search {
|
||||
.hot-search-phone {
|
||||
width: 300px;
|
||||
&-content {
|
||||
width: 100%;
|
||||
height: 530px;
|
||||
padding: 12px 12px;
|
||||
border-radius: 10px;
|
||||
border: 1px solid #e6e6e6;
|
||||
|
||||
.search-com {
|
||||
.search-con {
|
||||
height: 100%;
|
||||
height: 36px;
|
||||
border-radius: 36px;
|
||||
background: #f4f4f4;
|
||||
color: #999999;
|
||||
}
|
||||
}
|
||||
|
||||
.hot-search-title {
|
||||
padding: 10px 0;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.hot-search-text {
|
||||
span {
|
||||
font-size: 12px;
|
||||
border-radius: 100px;
|
||||
padding: 5px 10px;
|
||||
margin: 0 6px 6px 0;
|
||||
display: inline-block;
|
||||
background-color: #f4f4f4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,196 +0,0 @@
|
||||
<template>
|
||||
<div class="edit-popup">
|
||||
<popup
|
||||
ref="popupRef"
|
||||
title="设置存储"
|
||||
:async="true"
|
||||
width="550px"
|
||||
@confirm="handleSubmit"
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" label-width="120px" :rules="formRules">
|
||||
<el-form-item label="存储方式" prop="alias">
|
||||
<div>
|
||||
<el-radio model-value>{{ getStorageInfo?.name }} </el-radio>
|
||||
<div class="form-tips">{{ getStorageInfo?.tips }}</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<div v-if="formData.alias !== 'local'">
|
||||
<el-form-item label=" 存储空间名称" prop="bucket">
|
||||
<div class="flex-1">
|
||||
<el-input
|
||||
v-model="formData.bucket"
|
||||
placeholder="请输入存储空间名称(Bucket)"
|
||||
clearable
|
||||
/>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="ACCESS_KEY" prop="accessKey">
|
||||
<el-input
|
||||
v-model="formData.accessKey"
|
||||
placeholder="请输入ACCESS_KEY(AK)"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="SECRET_KEY" prop="secretKey">
|
||||
<el-input
|
||||
v-model="formData.secretKey"
|
||||
placeholder="请输入SECRET_KEY(SK)"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="空间域名" prop="domain">
|
||||
<div class="flex-1">
|
||||
<div>
|
||||
<el-input
|
||||
v-model="formData.domain"
|
||||
placeholder="请输入空间域名(Domain)"
|
||||
clearable
|
||||
/>
|
||||
</div>
|
||||
<div class="form-tips">
|
||||
请补全http://或https://,例如https://static.cloud.com
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-if="formData.alias == StorageEnum.QCLOUD"
|
||||
label="REGION"
|
||||
prop="region"
|
||||
>
|
||||
<el-input v-model="formData.region" placeholder="请输入region" clearable />
|
||||
</el-form-item>
|
||||
</div>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-radio-group v-model="formData.status">
|
||||
<el-radio :label="0">关闭</el-radio>
|
||||
<el-radio :label="1">开启</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</popup>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { storageSetup } from '@/api/setting/storage'
|
||||
import type { FormInstance } from 'element-plus'
|
||||
import Popup from '@/components/popup/index.vue'
|
||||
import { storageDetail } from '@/api/setting/storage'
|
||||
import feedback from '@/utils/feedback'
|
||||
enum StorageEnum {
|
||||
LOCAL = 'local', // 本地
|
||||
QINIU = 'qiniu', // 七牛云
|
||||
ALIYUN = 'aliyun', // 阿里云OSS
|
||||
QCLOUD = 'qcloud' // 腾讯云OSS
|
||||
}
|
||||
|
||||
const emit = defineEmits(['success'])
|
||||
const formRef = shallowRef<FormInstance>()
|
||||
const popupRef = shallowRef<InstanceType<typeof Popup>>()
|
||||
const formData = reactive({
|
||||
alias: '',
|
||||
bucket: '',
|
||||
accessKey: '',
|
||||
secretKey: '',
|
||||
domain: '',
|
||||
region: '', // 腾讯云需要
|
||||
status: 0
|
||||
})
|
||||
|
||||
const storageArr = [
|
||||
{
|
||||
name: '本地存储',
|
||||
type: StorageEnum.LOCAL,
|
||||
tips: '本地存储方式不需要配置其他参数'
|
||||
},
|
||||
{
|
||||
name: '七牛云存储',
|
||||
type: StorageEnum.QINIU,
|
||||
tips: '切换七牛云存储后,素材库需要重新上传至七牛云'
|
||||
},
|
||||
{
|
||||
name: '阿里云OSS',
|
||||
type: StorageEnum.ALIYUN,
|
||||
tips: '切换阿里云OSS后,素材库需要重新上传至阿里云OSS'
|
||||
},
|
||||
{
|
||||
name: '腾讯云OSS',
|
||||
type: StorageEnum.QCLOUD,
|
||||
tips: '切换腾讯云OSS后,素材库需要重新上传至腾讯云OSS'
|
||||
}
|
||||
]
|
||||
|
||||
const formRules = {
|
||||
bucket: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入存储空间名称',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
accessKey: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入ACCESS_KEY',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
secretKey: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入SECRET_KEY',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
domain: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入空间域名',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
region: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入REGION',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
const getStorageInfo = computed(() => {
|
||||
return storageArr.find((item) => item.type == formData.alias)
|
||||
})
|
||||
|
||||
const handleSubmit = async () => {
|
||||
await formRef.value?.validate()
|
||||
await storageSetup(formData)
|
||||
feedback.msgSuccess('操作成功')
|
||||
popupRef.value?.close()
|
||||
emit('success')
|
||||
}
|
||||
|
||||
const getDetail = async () => {
|
||||
const data = await storageDetail({
|
||||
alias: formData.alias
|
||||
})
|
||||
for (const key in data) {
|
||||
//@ts-ignore
|
||||
formData[key] = data[key]
|
||||
}
|
||||
}
|
||||
|
||||
const open = (type: string) => {
|
||||
formData.alias = type
|
||||
popupRef.value?.open()
|
||||
getDetail()
|
||||
}
|
||||
|
||||
const handleClose = () => {
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
open
|
||||
})
|
||||
</script>
|
||||
@@ -1,65 +0,0 @@
|
||||
<template>
|
||||
<div class="storage">
|
||||
<el-card class="!border-none" shadow="never">
|
||||
<el-alert
|
||||
type="warning"
|
||||
title="温馨提示:1.切换存储方式后,需要将资源文件传输至新的存储端;2.请勿随意切换存储方式,可能导致图片无法查看"
|
||||
:closable="false"
|
||||
show-icon
|
||||
></el-alert>
|
||||
</el-card>
|
||||
<el-card class="!border-none mt-4" shadow="never" v-loading="state.loading">
|
||||
<el-table size="large" :data="state.lists">
|
||||
<el-table-column label="储存方式" prop="alias" min-width="120" />
|
||||
<el-table-column label="储存位置" prop="describe" min-width="160" />
|
||||
<el-table-column label="状态" min-width="80">
|
||||
<template #default="{ row }">
|
||||
<el-tag v-if="row.status == 1" type="primary">开启</el-tag>
|
||||
<el-tag type="danger" v-else>关闭</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" min-width="80" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
v-perms="['admin:setting:storage:edit']"
|
||||
type="primary"
|
||||
link
|
||||
@click="handleSet(row.alias)"
|
||||
>
|
||||
设置
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
<edit-popup ref="editRef" @success="getLists" />
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup name="storage">
|
||||
import { storageLists } from '@/api/setting/storage'
|
||||
import EditPopup from './edit.vue'
|
||||
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
|
||||
|
||||
// 列表数据
|
||||
const state = reactive({
|
||||
loading: false,
|
||||
lists: []
|
||||
})
|
||||
|
||||
// 获取存储引擎列表数据
|
||||
const getLists = async () => {
|
||||
try {
|
||||
state.loading = true
|
||||
state.lists = await storageLists()
|
||||
state.loading = false
|
||||
} catch (error) {
|
||||
state.loading = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleSet = (alias: string) => {
|
||||
editRef.value?.open(alias)
|
||||
}
|
||||
|
||||
getLists()
|
||||
</script>
|
||||
Reference in New Issue
Block a user