Compare commits
2 Commits
444a8e6200
...
b30b13af4e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b30b13af4e | ||
|
|
f5c114b657 |
@@ -27,7 +27,7 @@ const editorConfig = {
|
||||
|
||||
editorConfig.MENU_CONF["uploadImage"] = {
|
||||
// 服务端上传地址,根据实际业务改写
|
||||
server: 'http://chat.qxmier.com/adminapi/UploadFile/file_upload',
|
||||
server: 'http://vschat.qxmier.com/adminapi/UploadFile/file_upload',
|
||||
// form-data 的 fieldName,根据实际业务改写
|
||||
fieldName: "files",
|
||||
// 选择文件时的类型限制,根据实际业务改写
|
||||
|
||||
@@ -74,10 +74,11 @@ const handleFileSuccess = ({ data, code }, file, fileList) => {
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<!-- http://vschat.qxmier.com -->
|
||||
<!-- {{ acceptType http://chat.qxmier.com }} -->
|
||||
<el-upload v-model:file-list="fileList" drag multiple class="pure-upload" list-type="picture-card"
|
||||
:accept="acceptType ? acceptType : 'image/jpeg,image/png,image/gif'"
|
||||
action="http://chat.qxmier.com/adminapi/UploadFile/file_upload" :limit="limit" name="files"
|
||||
action="http://vschat.qxmier.com/adminapi/UploadFile/file_upload" :limit="limit" name="files"
|
||||
:headers="{ Authorization: getToken().accessToken }" :on-exceed="onExceed" :before-upload="onBefore"
|
||||
:on-success="handleFileSuccess">
|
||||
<IconifyIconOffline :icon="Add" class="m-auto mt-4" width="30" />
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export const URL = "http://chat.qxmier.com";
|
||||
export const URL = "http://vschat.qxmier.com";
|
||||
// http://chat.qxmier.com 正式
|
||||
// http://vschat.qxmier.com 测试
|
||||
@@ -3,6 +3,7 @@ import { ref } from "vue";
|
||||
import RichText from '@/components/RichText/index.vue';
|
||||
const ruleFormRef = ref();
|
||||
const formRules = ref({
|
||||
title: [{ required: true, message: "请输入礼包标题", trigger: "blur" }],
|
||||
highest_gain: [{ required: true, message: "请输入礼包总价值", trigger: "blur" }],
|
||||
meet: [{ required: true, message: "请输入累计购买金额", trigger: "blur" }],
|
||||
num: [{ required: true, message: "请输入抽奖次数", trigger: "blur" }],
|
||||
@@ -16,7 +17,8 @@ const newFormInline = ref(
|
||||
highest_gain: "",
|
||||
meet: "",
|
||||
num: "",
|
||||
content: ""
|
||||
content: "",
|
||||
title: ""
|
||||
}
|
||||
);
|
||||
function getRef() {
|
||||
@@ -30,6 +32,10 @@ defineExpose({ getRef });
|
||||
|
||||
<template>
|
||||
<el-form ref="ruleFormRef" :model="newFormInline" :rules="formRules" label-width="120px">
|
||||
<el-form-item label="礼包标题" prop="title">
|
||||
<el-input placeholder="请输入礼包标题" v-model="newFormInline.title">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="礼包总价值" prop="highest_gain">
|
||||
<el-input placeholder="请输入礼包总价值" v-model="newFormInline.highest_gain">
|
||||
</el-input>
|
||||
|
||||
@@ -36,15 +36,15 @@ defineExpose({ getRef });
|
||||
|
||||
<template>
|
||||
<el-form ref="ruleFormRef" :model="newFormInline" :rules="formRules" label-width="120px">
|
||||
<el-form-item label="分类" prop="tid">
|
||||
<el-select v-model="newFormInline.tid" placeholder="请选择分类">
|
||||
<el-form-item label="礼物分类" prop="tid">
|
||||
<el-select v-model="newFormInline.tid" placeholder="请选择礼物分类">
|
||||
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="分类名称" prop="name">
|
||||
<el-input v-model="newFormInline.name" clearable placeholder="请输入分类名称" />
|
||||
<el-form-item label="标签名称" prop="name">
|
||||
<el-input v-model="newFormInline.name" clearable placeholder="请输入标签名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" prop="sort">
|
||||
<el-input-number v-model="newFormInline.sort"></el-input-number>
|
||||
|
||||
@@ -17,7 +17,7 @@ export function useData() {
|
||||
name: ""
|
||||
});
|
||||
const searchLabel = ref([
|
||||
{ label: "分类名称", prop: "name", type: "input" }
|
||||
{ label: "标签名称", prop: "name", type: "input" }
|
||||
]);
|
||||
const pagination = ref({
|
||||
total: 0,
|
||||
@@ -32,10 +32,15 @@ export function useData() {
|
||||
},
|
||||
{
|
||||
label: "排序",
|
||||
prop: "sort"
|
||||
prop: "sort",
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
label: "分类名称",
|
||||
label: "礼物分类",
|
||||
prop: "type"
|
||||
},
|
||||
{
|
||||
label: "标签名称",
|
||||
prop: "name"
|
||||
},
|
||||
{
|
||||
@@ -75,7 +80,7 @@ export function useData() {
|
||||
const handleDelete = async rowData => {
|
||||
const { code } = await removeClassifyData({ id: rowData.id });
|
||||
if (code) {
|
||||
message(`您删除了分类名称为${rowData.name}的这条数据`, {
|
||||
message(`您删除了标签名称为${rowData.name}的这条数据`, {
|
||||
type: "success"
|
||||
});
|
||||
onSearch(searchForm.value);
|
||||
@@ -84,7 +89,7 @@ export function useData() {
|
||||
// 新增
|
||||
const openDialog = (title = "新增", rowData: any) => {
|
||||
addDialog({
|
||||
title: `${title}礼物分类`,
|
||||
title: `${title}礼物标签`,
|
||||
props: {
|
||||
formInline: {
|
||||
sort: rowData?.sort ?? 0,
|
||||
|
||||
@@ -33,11 +33,11 @@ onMounted(() => {
|
||||
<div class="main">
|
||||
<SearchForm class="pb-2" :LabelList="searchLabel" :formData="searchForm" @handleSearch="onSearch" />
|
||||
<div ref="contentRef" :class="['flex', deviceDetection() ? 'flex-wrap' : '']">
|
||||
<PureTableBar title="分类列表" :class="[isShow && !deviceDetection() ? '!w-[60vw]' : 'w-full']" :columns="tableLabel"
|
||||
<PureTableBar title="标签列表" :class="[isShow && !deviceDetection() ? '!w-[60vw]' : 'w-full']" :columns="tableLabel"
|
||||
@refresh="onSearch">
|
||||
<template #buttons>
|
||||
<el-button type="primary" :icon="useRenderIcon(AddFill)" @click="openDialog('新增', {})">
|
||||
新增分类
|
||||
新增礼物标签
|
||||
</el-button>
|
||||
</template>
|
||||
<template v-slot="{ size, dynamicColumns }">
|
||||
@@ -51,7 +51,7 @@ onMounted(() => {
|
||||
<el-button link type="primary" :size="size" @click="openDialog('编辑', row)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-popconfirm :title="`是否确认删除分类名称为${row.name}的这条数据`" @confirm="handleDelete(row)">
|
||||
<el-popconfirm :title="`是否确认删除标签名称为${row.name}的这条数据`" @confirm="handleDelete(row)">
|
||||
<template #reference>
|
||||
<el-button link type="primary" :size="size"> 删除 </el-button>
|
||||
</template>
|
||||
|
||||
@@ -54,9 +54,12 @@ const getTypeList = async () => {
|
||||
typeList.value = code ? data : []
|
||||
}
|
||||
const getLableList = async () => {
|
||||
const { data, code } = await getGiftTypeOrLabel({ type: 2 })
|
||||
const { data, code } = await getGiftTypeOrLabel({ type: 2, type_id: newFormInline.value.type || '' })
|
||||
labelList.value = code ? data : []
|
||||
}
|
||||
const changeType = () => {
|
||||
getLableList()
|
||||
}
|
||||
onMounted(() => {
|
||||
getTypeList()
|
||||
getLableList()
|
||||
@@ -70,12 +73,12 @@ defineExpose({ getRef });
|
||||
<el-input v-model="newFormInline.gift_name" clearable placeholder="请输入礼物名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="礼物类型" prop="type">
|
||||
<el-select v-model="newFormInline.type" placeholder="请选择礼物类型">
|
||||
<el-select v-model="newFormInline.type" placeholder="请选择礼物类型" @change="changeType">
|
||||
<el-option v-for="item in typeList" :key="item.id" :label="item.name" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="礼物标签" prop="label" v-if="newFormInline.type === 1">
|
||||
<el-form-item label="礼物标签" prop="label">
|
||||
<el-select v-model="newFormInline.label" placeholder="请选择礼物标签">
|
||||
<el-option v-for="item in labelList" :key="item.id" :label="item.name" :value="item.id">
|
||||
</el-option>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { ref, h } from "vue";
|
||||
import editForm from "./form.vue";
|
||||
import { message } from "@/utils/message";
|
||||
import { getGiftTypeOrLabel } from '@/api/modules/gift';
|
||||
import {
|
||||
queryGiftList,
|
||||
addGiftData,
|
||||
@@ -9,7 +10,15 @@ import {
|
||||
getGiftInfo
|
||||
} from "@/api/modules/gift";
|
||||
import { addDialog } from "@/components/ReDialog";
|
||||
|
||||
export function useData() {
|
||||
const getLableList = async () => {
|
||||
const { data, code } = await getGiftTypeOrLabel({ type: 2 })
|
||||
searchLabel.value[searchLabel.value.length - 1].optionList = code ? data.map(ele => {
|
||||
return { ...ele, label: ele.name, value: ele.id }
|
||||
}) : []
|
||||
}
|
||||
getLableList()
|
||||
const formRef = ref();
|
||||
const loading = ref(true);
|
||||
const tableList = ref([]);
|
||||
@@ -22,7 +31,22 @@ export function useData() {
|
||||
});
|
||||
const searchLabel = ref([
|
||||
{ label: "礼物ID", prop: "search_gift_id", type: "input" },
|
||||
{ label: "礼物名称", prop: "search_gift_name", type: "input" }
|
||||
{ label: "礼物名称", prop: "search_gift_name", type: "input" },
|
||||
{
|
||||
label: "礼物分类", prop: "search_gift_type", type: "select", optionList: [
|
||||
{
|
||||
value: 1,
|
||||
label: '普通礼物'
|
||||
}, {
|
||||
value: 2,
|
||||
label: '盲盒礼物'
|
||||
}, {
|
||||
value: 3,
|
||||
label: '礼包礼物'
|
||||
}
|
||||
]
|
||||
},
|
||||
{ label: "礼物标签", prop: "search_gift_label", type: "select", optionList: [] }
|
||||
]);
|
||||
const pagination = ref({
|
||||
total: 0,
|
||||
|
||||
@@ -13,7 +13,10 @@ const formRules = ref({
|
||||
auxiliary_color: [
|
||||
{ required: true, message: "请选择辅助色值", trigger: "change" }
|
||||
],
|
||||
|
||||
file_url: [{ required: true, message: "请输入文件地址", trigger: "blur" }],
|
||||
times: [
|
||||
{ required: true, message: "请选择有效期", trigger: "change" }
|
||||
],
|
||||
theme_name: [{ required: true, message: "请输入主题名称", trigger: "blur" }],
|
||||
});
|
||||
const props = defineProps(["formInline"]);
|
||||
@@ -25,7 +28,8 @@ const newFormInline = ref(
|
||||
theme_color: "",
|
||||
auxiliary_color: "",
|
||||
file_url: "",
|
||||
is_active: 0
|
||||
is_active: 0,
|
||||
times: []
|
||||
}
|
||||
);
|
||||
function getRef() {
|
||||
@@ -34,10 +38,10 @@ function getRef() {
|
||||
function chanageEditorValue(val) {
|
||||
newFormInline.value.content = val
|
||||
}
|
||||
function onExceed () {
|
||||
function onExceed() {
|
||||
message("最多上传1个文件,请先删除在上传");
|
||||
};
|
||||
function handleFileSuccess ({ data, code }, file, fileList) {
|
||||
function handleFileSuccess({ data, code }, file, fileList) {
|
||||
// console.log(file)
|
||||
// console.log(fileList)
|
||||
// debugger
|
||||
@@ -65,20 +69,12 @@ defineExpose({ getRef });
|
||||
<el-color-picker v-model="newFormInline.auxiliary_color"></el-color-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="文件地址" prop="file_url">
|
||||
<el-upload
|
||||
class="upload-demo"
|
||||
drag
|
||||
:limit="1"
|
||||
name="files"
|
||||
accept=".zip"
|
||||
:headers="{ Authorization: getToken().accessToken }"
|
||||
action="/adminapi/UploadFile/file_upload"
|
||||
:on-exceed="onExceed"
|
||||
:on-success="handleFileSuccess"
|
||||
>
|
||||
<i class="el-icon-upload"></i>
|
||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||
</el-upload>
|
||||
<el-input v-model="newFormInline.file_url" placeholder="请输入文件地址"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="有效期" prop="times">
|
||||
<el-date-picker format="YYYY-MM-DD" value-format="YYYY-MM-DD" v-model="newFormInline.times" type="daterange"
|
||||
range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="使用状态" prop="is_active">
|
||||
<el-radio-group v-model="newFormInline.is_active">
|
||||
|
||||
@@ -109,7 +109,8 @@ export function useData() {
|
||||
theme_color: rowData?.theme_color ?? "",
|
||||
auxiliary_color: rowData?.auxiliary_color ?? "",
|
||||
file_url: rowData?.file_url ?? "",
|
||||
is_active: rowData?.is_active ?? ""
|
||||
is_active: rowData?.is_active ?? "",
|
||||
times: [rowData?.begin_time ?? "", rowData?.end_time ?? ""]
|
||||
}
|
||||
},
|
||||
width: "40%",
|
||||
@@ -143,14 +144,15 @@ export function useData() {
|
||||
};
|
||||
FormRef.validate(valid => {
|
||||
if (valid) {
|
||||
console.log("curData", curData);
|
||||
let formData = { ...curData, begin_time: curData.times.length ? curData.times[0] : '', end_time: curData.times.length ? curData.times[1] : '' }
|
||||
delete formData.times
|
||||
// 表单规则校验通过
|
||||
if (title === "新增") {
|
||||
// 实际开发先调用新增接口,再进行下面操作
|
||||
saveData(curData);
|
||||
saveData(formData);
|
||||
} else {
|
||||
// 实际开发先调用修改接口,再进行下面操作
|
||||
updateData(curData);
|
||||
updateData(formData);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -45,11 +45,11 @@ onMounted(() => {
|
||||
color: 'var(--el-text-color-primary)'
|
||||
}" @page-current-change="handleCurrentChange" @page-size-change="handleSizeChange">
|
||||
<template #operation="{ row }">
|
||||
<el-popconfirm :title="`是否应用这条主题`" @confirm="handleDelete(row)">
|
||||
<el-popconfirm :title="`是否应用这条主题`" @confirm="useTheme(row)">
|
||||
<template #reference>
|
||||
<el-button link v-if="row.is_active === 0" type="primary" :size="size" @click="useTheme(row)">
|
||||
应用
|
||||
</el-button>
|
||||
<el-button link v-if="row.is_active === 0" type="primary" :size="size">
|
||||
应用
|
||||
</el-button>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
|
||||
|
||||
@@ -26,8 +26,10 @@ export default ({ mode }: ConfigEnv): UserConfigExport => {
|
||||
// 本地跨域代理 https://cn.vitejs.dev/config/server-options.html#server-proxy
|
||||
proxy: {
|
||||
"/adminapi": {
|
||||
// 这里填写后端地址
|
||||
target: "https://chat.qxmier.com",
|
||||
// 这里填写后端地址、
|
||||
// http://chat.qxmier.com 正式
|
||||
// http://vschat.qxmier.com 测试
|
||||
target: "http://vschat.qxmier.com",
|
||||
changeOrigin: true
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user