表情管理-新增 表情包管理 ,表情包Tab管理
This commit is contained in:
58
src/api/EmojiManagement/EmojiManagement.js
Normal file
58
src/api/EmojiManagement/EmojiManagement.js
Normal file
@@ -0,0 +1,58 @@
|
||||
import request from '@/utils/request';
|
||||
// 表情包Tab列表
|
||||
export const getFaceTabNewList = query => {
|
||||
return request({
|
||||
url: '/faceTabNew/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
// Tab保存编辑
|
||||
export const saveOrUpdateFaceTabNew = query => {
|
||||
return request({
|
||||
url: '/faceTabNew/saveOrUpdate',
|
||||
method: 'post',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
// Tab删除
|
||||
export const deleteFaceTabNew = query => {
|
||||
return request({
|
||||
url: '/faceTabNew/delete',
|
||||
method: 'post',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
|
||||
// 表情包列表
|
||||
export const getFaceNewList = query => {
|
||||
return request({
|
||||
url: '/faceNew/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
// 保存编辑
|
||||
export const saveOrUpdateFaceNew = query => {
|
||||
return request({
|
||||
url: '/faceNew/saveOrUpdate',
|
||||
method: 'post',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
// 表情包tab列表
|
||||
export const getFaceNewTabList = query => {
|
||||
return request({
|
||||
url: '/faceNew/tab/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
// 删除表情包
|
||||
export const deleteFaceNew = query => {
|
||||
return request({
|
||||
url: '/faceNew/delete',
|
||||
method: 'DELETE',
|
||||
params: query
|
||||
});
|
||||
};
|
384
src/views/face/EmojiManagement.vue
Normal file
384
src/views/face/EmojiManagement.vue
Normal file
@@ -0,0 +1,384 @@
|
||||
<template>
|
||||
<div class="box">
|
||||
<div class="inquire">
|
||||
<span>表情ID:</span>
|
||||
<el-input v-model="formData.id" placeholder="" class="input" />
|
||||
</div>
|
||||
<div class="inquire">
|
||||
<span>Tab名字:</span>
|
||||
<el-select v-model="formData.tabId" placeholder="请选择">
|
||||
<el-option v-for="item in TabData" :key="item.id" :label="item.tabName" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="inquire">
|
||||
<span>状态</span>
|
||||
<el-select v-model="formData.status" placeholder="请选择">
|
||||
<el-option label="全部" :value="-1"></el-option>
|
||||
<el-option label="不展示" :value="0"></el-option>
|
||||
<el-option label="展示" :value="1"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<el-button style="" type="primary" @click="getData()">查询</el-button>
|
||||
<el-button style="" type="primary" @click="resetFormData()">重置</el-button>
|
||||
<el-button style="" type="primary" @click="addDialog = true;resetaddFormData()">新增</el-button>
|
||||
<!-- 表格数据 -->
|
||||
<el-table v-loading="tableData.loading" :data="tableData.data" ref="multipleTable"
|
||||
@selection-change="handleSelectionChange" border style="width: 100%; margin-top: 25px">
|
||||
<el-table-column prop="tabId" align="center" label="TabID" />
|
||||
<el-table-column prop="tabName" align="center" label="Tab名字" />
|
||||
<el-table-column prop="id" align="center" label="表情ID" />
|
||||
<el-table-column prop="faceName" align="center" label="表情名字" />
|
||||
<el-table-column prop="faceIndex" align="center" label="表情包封面">
|
||||
<template v-slot="scope">
|
||||
<el-image style="width: 100px; height: 100px" :src="scope.row.faceIndex" :zoom-rate="1.1"
|
||||
:preview-src-list="[scope.row.faceIndex]" fit="scale-down" preview-teleported="true"
|
||||
hide-on-click-modal="true" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="seqNo" align="center" label="排序" />
|
||||
<el-table-column prop="showTimes" align="center" label="展示次数" />
|
||||
<el-table-column prop="status" align="center" label="状态">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.status == 1 ? '展示' : '不展示' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="操作" width="300">
|
||||
<template v-slot="scope">
|
||||
<el-button class="primary" type="primary" @click="
|
||||
detailPageFun(scope.row);
|
||||
" size="default">编辑</el-button>
|
||||
<el-button class="primary" type="danger" @click="
|
||||
deletePageFun(scope.row);
|
||||
" size="default">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<el-pagination style="margin-top: 10px" class="paginationClass" :current-page="formData.pageNo"
|
||||
:page-size="formData.pageSize" :page-sizes="[10, 20, 50, 100, 200]" layout="sizes, prev, pager, next"
|
||||
:total="tableData.total" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
|
||||
<el-dialog v-model="addDialog" :title="addFormData.id == '' ? '新增' : '编辑'" width="28%" center>
|
||||
<div style="margin-bottom: 25px">
|
||||
<span style="display: inline-block; margin-right: 20px; width: 100px"
|
||||
class="col-sm-2 control-label">Tab名字:</span>
|
||||
<el-select v-model="addFormData.tabId" placeholder="请选择">
|
||||
<el-option v-for="item in TabData" :key="item.id" :label="item.tabName" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div style="margin-bottom: 25px">
|
||||
<span style="display: inline-block; margin-right: 20px; width: 100px"
|
||||
class="col-sm-2 control-label">表情名字</span>
|
||||
<el-input v-model="addFormData.faceName" style="width: 50%" class="input"></el-input>
|
||||
</div>
|
||||
<div class="selectBox selectBoxImg">
|
||||
<span class="left" style="margin-right: 35px;padding-left: 15px;">表情包封面</span>
|
||||
<!-- action="/admin/tencent/cos/upload/file" -->
|
||||
<el-upload class="avatar-uploader" action="/admin/tencent/cos/upload/file" :show-file-list="false"
|
||||
:on-success="handleAvatarSuccess" :before-upload="beforeAvatarUpload" :on-error="handleAvatarError">
|
||||
<img v-if="addFormData.faceIndex" :src="addFormData.faceIndex" class="avatar" />
|
||||
<el-icon v-else class="avatar-uploader-icon">
|
||||
<Plus />
|
||||
</el-icon>
|
||||
</el-upload>
|
||||
</div>
|
||||
<div class="selectBox selectBoxImg">
|
||||
<span class="left" style="margin-right: 65px;padding-left: 15px;">表情包</span>
|
||||
<!-- action="/admin/tencent/cos/upload/file" -->
|
||||
<el-upload class="avatar-uploader" action="/admin/tencent/cos/upload/file" :show-file-list="false"
|
||||
:on-success="handleAvatarSuccess2" :before-upload="beforeAvatarUploadSvga"
|
||||
:on-error="handleAvatarError">
|
||||
<img v-if="addFormData.faceUrl" :src="addFormData.faceUrl" />
|
||||
<el-icon v-else class="avatar-uploader-icon">
|
||||
<Plus />
|
||||
</el-icon>
|
||||
</el-upload>
|
||||
</div>
|
||||
<div style="margin-bottom: 25px">
|
||||
<span style="display: inline-block; margin-right: 20px; width: 100px"
|
||||
class="col-sm-2 control-label">排序</span>
|
||||
<el-input v-model="addFormData.seqNo" style="width: 50%" class="input"></el-input>
|
||||
</div>
|
||||
<div style="margin-bottom: 25px">
|
||||
<span style="display: inline-block; margin-right: 20px; width: 100px"
|
||||
class="col-sm-2 control-label">展示次数</span>
|
||||
<el-input v-model="addFormData.showTimes" style="width: 50%" class="input"></el-input>
|
||||
</div>
|
||||
<div style="margin-bottom: 25px">
|
||||
<span style="display: inline-block; margin-right: 20px; width: 100px"
|
||||
class="col-sm-2 control-label">状态</span>
|
||||
<el-select v-model="addFormData.status" placeholder="请选择">
|
||||
<el-option label="不展示" :value="0"></el-option>
|
||||
<el-option label="展示" :value="1"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="addDialog = false">取消</el-button>
|
||||
<el-button type="primary" @click="addFun()"> 确认 </el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref, onMounted, reactive, computed } from 'vue'
|
||||
import { getFaceNewList, saveOrUpdateFaceNew, getFaceNewTabList, deleteFaceNew } from '@/api/EmojiManagement/EmojiManagement'
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
export default {
|
||||
name: 'EmojiManagement',
|
||||
setup() {
|
||||
const formData = reactive({
|
||||
id: '',
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
tabId: '',
|
||||
status: -1
|
||||
})
|
||||
const addFormData = reactive({
|
||||
seqNo: '',
|
||||
id: '',
|
||||
status: 1,
|
||||
showTimes: '',
|
||||
tabId: '',
|
||||
faceName: '',
|
||||
faceIndex: '',
|
||||
faceUrl: ''
|
||||
})
|
||||
const tableData = reactive({
|
||||
data: [],
|
||||
total: 0,
|
||||
loading: false,
|
||||
})
|
||||
const ediObj = reactive({
|
||||
imageUrl2: ''
|
||||
})
|
||||
const TabData = ref([])
|
||||
const addDialog = ref(false)
|
||||
const getData = () => {
|
||||
tableData.loading = true;
|
||||
getFaceNewList(formData).then(res => {
|
||||
if (res.code == 200) {
|
||||
tableData.data = res.data.rows
|
||||
tableData.loading = false;
|
||||
tableData.total = res.data.total
|
||||
|
||||
} else {
|
||||
tableData.loading = false;
|
||||
ElMessage.error(res.message);
|
||||
}
|
||||
})
|
||||
};
|
||||
// 增加
|
||||
const addFun = () => {
|
||||
saveOrUpdateFaceNew(addFormData).then(res => {
|
||||
if (res.code == 200) {
|
||||
ElMessage.success('添加成功');
|
||||
Object.assign(addFormData, {
|
||||
seqNo: '',
|
||||
id: '',
|
||||
status: 1,
|
||||
showTimes: '',
|
||||
tabId: '',
|
||||
faceName: '',
|
||||
faceIndex: '',
|
||||
faceUrl: ''
|
||||
});
|
||||
addDialog.value = false
|
||||
getData()
|
||||
} else {
|
||||
ElMessage.error(res.message);
|
||||
addDialog.value = false
|
||||
}
|
||||
})
|
||||
}
|
||||
//重置
|
||||
const resetFormData = () => {
|
||||
Object.assign(formData, {
|
||||
partitionId: 1,
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
erbanNo: '',
|
||||
});
|
||||
|
||||
};
|
||||
const resetaddFormData = () => {
|
||||
Object.assign(addFormData, {
|
||||
seqNo: '',
|
||||
id: '',
|
||||
status: 1,
|
||||
showTimes: '',
|
||||
tabId: '',
|
||||
faceName: '',
|
||||
faceIndex: '',
|
||||
faceUrl: ''
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
// 编辑
|
||||
const detailPageFun = (row) => {
|
||||
addFormData.id = row.id;
|
||||
addFormData.faceIndex = row.faceIndex;
|
||||
addFormData.faceName = row.faceName;
|
||||
addFormData.faceUrl = row.faceUrl;
|
||||
addFormData.seqNo = row.seqNo;
|
||||
addFormData.showTimes = row.showTimes;
|
||||
addFormData.status = row.status;
|
||||
addFormData.tabId = row.tabId;
|
||||
addDialog.value = true
|
||||
}
|
||||
// 删除
|
||||
const deletePageFun = (row) => {
|
||||
ElMessageBox.confirm('确定要删除吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
deleteFaceNew({ id: row.id }).then(res => {
|
||||
if (res.code == 200) {
|
||||
ElMessage.success('删除成功')
|
||||
getData()
|
||||
} else {
|
||||
ElMessage.error(res.message)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
const beforeAvatarUpload = () => {
|
||||
ElMessage({
|
||||
showClose: true,
|
||||
message: "上传中~",
|
||||
type: "warning",
|
||||
});
|
||||
};
|
||||
|
||||
const handleAvatarError = () => {
|
||||
ElMessage({
|
||||
showClose: true,
|
||||
message: "上传失败!",
|
||||
type: "error",
|
||||
});
|
||||
};
|
||||
const handleAvatarSuccess = (res, file) => {
|
||||
addFormData.faceIndex = file.response.data;
|
||||
ElMessage({
|
||||
showClose: true,
|
||||
message: "上传成功!",
|
||||
type: "success",
|
||||
});
|
||||
};
|
||||
const beforeAvatarUploadSvga = (file) => {
|
||||
const dotIndex = (file.name).indexOf('.'); // 找到 '.' 的位置
|
||||
if (dotIndex !== -1) {
|
||||
const result = (file.name).substring(dotIndex + 1); // 从 '.' 之后开始截取
|
||||
if (result == 'svga') {
|
||||
ElMessage({
|
||||
showClose: true,
|
||||
message: "上传中~",
|
||||
type: "warning",
|
||||
});
|
||||
return true;
|
||||
} else {
|
||||
ElMessage.error('请上传svga格式文件');
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
ElMessage.error('请上传svga格式文件');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
const handleAvatarSuccess2 = (res, file) => {
|
||||
addFormData.faceUrl = file.response.data;
|
||||
ElMessage({
|
||||
showClose: true,
|
||||
message: "上传成功!",
|
||||
type: "success",
|
||||
});
|
||||
};
|
||||
const handleSizeChange = (val) => {
|
||||
formData.pageSize = val;
|
||||
getData();
|
||||
};
|
||||
const handleCurrentChange = (val) => {
|
||||
formData.pageNo = val;
|
||||
getData();
|
||||
};
|
||||
onMounted(() => {
|
||||
getFaceNewTabList().then(res => {
|
||||
TabData.value = res.data
|
||||
})
|
||||
})
|
||||
return {
|
||||
formData,
|
||||
addFormData,
|
||||
tableData,
|
||||
addDialog,
|
||||
getData,
|
||||
addFun,
|
||||
resetFormData,
|
||||
handleSizeChange,
|
||||
handleCurrentChange,
|
||||
beforeAvatarUpload,
|
||||
handleAvatarError,
|
||||
handleAvatarSuccess,
|
||||
ediObj,
|
||||
TabData,
|
||||
handleAvatarSuccess2,
|
||||
beforeAvatarUploadSvga,
|
||||
detailPageFun,
|
||||
deletePageFun,
|
||||
resetaddFormData
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.box {
|
||||
padding-top: 20px;
|
||||
background: #ecf0f5;
|
||||
|
||||
.inquire {
|
||||
display: inline-block;
|
||||
margin-right: 20px;
|
||||
|
||||
span {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.input {
|
||||
width: 180px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.dialogTableVisibleBut {
|
||||
display: block;
|
||||
margin: 30px 0 0 830px;
|
||||
}
|
||||
|
||||
.paginationClass {
|
||||
margin: 15px 0 5px 0px;
|
||||
}
|
||||
}
|
||||
|
||||
.selectBox {
|
||||
display: flex;
|
||||
height: 35px;
|
||||
line-height: 35px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.selectBoxImg {
|
||||
height: 150px;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 178px;
|
||||
height: 178px;
|
||||
display: block;
|
||||
}
|
||||
</style>
|
329
src/views/face/EmojiTabManagement.vue
Normal file
329
src/views/face/EmojiTabManagement.vue
Normal file
@@ -0,0 +1,329 @@
|
||||
<template>
|
||||
<div class="box">
|
||||
<div class="inquire">
|
||||
<span>TabID:</span>
|
||||
<el-input v-model="formData.id" placeholder="" class="input" />
|
||||
</div>
|
||||
<div class="inquire">
|
||||
<span>类型</span>
|
||||
<el-select v-model="formData.useVip" placeholder="请选择">
|
||||
<el-option label="全部" :value="-1"></el-option>
|
||||
<el-option label="普通" :value="0"></el-option>
|
||||
<el-option label="贵族" :value="1"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="inquire">
|
||||
<span>状态</span>
|
||||
<el-select v-model="formData.status" placeholder="请选择">
|
||||
<el-option label="全部" :value="-1"></el-option>
|
||||
<el-option label="不展示" :value="0"></el-option>
|
||||
<el-option label="展示" :value="1"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<el-button style="" type="primary" @click="getData()">查询</el-button>
|
||||
<el-button style="" type="primary" @click="resetFormData()">重置</el-button>
|
||||
<el-button style="" type="primary" @click="addDialog = true; resetaddFormData()">新增</el-button>
|
||||
<!-- 表格数据 -->
|
||||
<el-table v-loading="tableData.loading" :data="tableData.data" ref="multipleTable"
|
||||
@selection-change="handleSelectionChange" border style="width: 100%; margin-top: 25px">
|
||||
<el-table-column prop="id" align="center" label="ID" />
|
||||
<el-table-column prop="tabName" align="center" label="Tab名字" />
|
||||
<el-table-column prop="tabUrl" align="center" label="Tab封面">
|
||||
<template v-slot="scope">
|
||||
<el-image style="width: 100px; height: 100px" :src="scope.row.tabUrl" :zoom-rate="1.1"
|
||||
:preview-src-list="[scope.row.tabUrl]" fit="scale-down" preview-teleported="true"
|
||||
hide-on-click-modal="true" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="useVip" align="center" label="表情类型">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.useVip == 1 ? '贵族' : '普通' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="status" align="center" label="状态">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.status == 1 ? '展示' : '不展示' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="tabSeq" align="center" label="排序" />
|
||||
<el-table-column align="center" label="操作" width="300">
|
||||
<template v-slot="scope">
|
||||
<el-button class="primary" type="primary" @click="
|
||||
detailPageFun(scope.row);
|
||||
" size="default">编辑</el-button>
|
||||
<!-- <el-button class="primary" type="danger" @click="
|
||||
deletePageFun(scope.row);
|
||||
" size="default">删除</el-button> -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<el-pagination style="margin-top: 10px" class="paginationClass" :current-page="formData.pageNo"
|
||||
:page-size="formData.pageSize" :page-sizes="[10, 20, 50, 100, 200]" layout="sizes, prev, pager, next"
|
||||
:total="tableData.total" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
|
||||
<el-dialog v-model="addDialog" :title="addFormData.id == '' ? '新增' : '编辑'" width="28%" center>
|
||||
<!-- <div style="margin-bottom: 25px" v-if="addFormData.id != ''">
|
||||
<span style="display: inline-block; margin-right: 20px; width: 100px"
|
||||
class="col-sm-2 control-label">表情TabID</span>
|
||||
<el-input v-model="addFormData.id" style="width: 50%" class="input" disabled></el-input>
|
||||
</div> -->
|
||||
<div style="margin-bottom: 25px">
|
||||
<span style="display: inline-block; margin-right: 20px; width: 100px"
|
||||
class="col-sm-2 control-label">表情Tab名字</span>
|
||||
<el-input v-model="addFormData.tabName" style="width: 50%" class="input"></el-input>
|
||||
</div>
|
||||
<div style="margin-bottom: 25px">
|
||||
<span style="display: inline-block; margin-right: 20px; width: 100px"
|
||||
class="col-sm-2 control-label">表情类型</span>
|
||||
<el-select v-model="addFormData.useVip" placeholder="请选择">
|
||||
<el-option label="普通" :value="0"></el-option>
|
||||
<el-option label="贵族" :value="1"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="selectBox selectBoxImg">
|
||||
<span class="left" style="margin-right: 75px;padding-left: 15px;">Tab图</span>
|
||||
<!-- action="/admin/tencent/cos/upload/file" -->
|
||||
<el-upload class="avatar-uploader" action="/admin/tencent/cos/upload/file" :show-file-list="false"
|
||||
:on-success="handleAvatarSuccess" :before-upload="beforeAvatarUpload" :on-error="handleAvatarError">
|
||||
<img v-if="addFormData.tabUrl" :src="addFormData.tabUrl" class="avatar" />
|
||||
<el-icon v-else class="avatar-uploader-icon">
|
||||
<Plus />
|
||||
</el-icon>
|
||||
</el-upload>
|
||||
</div>
|
||||
<div style="margin-bottom: 25px">
|
||||
<span style="display: inline-block; margin-right: 20px; width: 100px"
|
||||
class="col-sm-2 control-label">排序</span>
|
||||
<el-input v-model="addFormData.tabSeq" style="width: 50%" class="input"></el-input>
|
||||
</div>
|
||||
<div style="margin-bottom: 25px">
|
||||
<span style="display: inline-block; margin-right: 20px; width: 100px"
|
||||
class="col-sm-2 control-label">状态</span>
|
||||
<el-select v-model="addFormData.status" placeholder="请选择">
|
||||
<el-option label="不展示" :value="0"></el-option>
|
||||
<el-option label="展示" :value="1"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="addDialog = false">取消</el-button>
|
||||
<el-button type="primary" @click="addFun()"> 确认 </el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref, onMounted, reactive, computed } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import { getFaceTabNewList, saveOrUpdateFaceTabNew, deleteFaceTabNew } from '@/api/EmojiManagement/EmojiManagement'
|
||||
export default {
|
||||
name: 'EmojiTabManagement',
|
||||
setup() {
|
||||
const formData = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
useVip: -1,
|
||||
status: -1,
|
||||
id: ''
|
||||
})
|
||||
const addFormData = reactive({
|
||||
id: '',
|
||||
useVip: 0,
|
||||
tabUrl: '',
|
||||
status: 1,
|
||||
tabSeq: '',
|
||||
tabName: ''
|
||||
})
|
||||
const tableData = reactive({
|
||||
data: [],
|
||||
total: 0,
|
||||
loading: false,
|
||||
})
|
||||
const addDialog = ref(false)
|
||||
const getData = () => {
|
||||
tableData.loading = true;
|
||||
getFaceTabNewList(formData).then(res => {
|
||||
if (res.code == 200) {
|
||||
tableData.data = res.data.records
|
||||
tableData.loading = false;
|
||||
tableData.total = res.data.total
|
||||
|
||||
} else {
|
||||
tableData.loading = false;
|
||||
ElMessage.error(res.message);
|
||||
}
|
||||
})
|
||||
};
|
||||
// 增加
|
||||
const addFun = () => {
|
||||
saveOrUpdateFaceTabNew(addFormData).then(res => {
|
||||
if (res.code == 200) {
|
||||
ElMessage.success('添加成功');
|
||||
Object.assign(addFormData, {
|
||||
id: '',
|
||||
useVip: 0,
|
||||
tabUrl: '',
|
||||
status: 1,
|
||||
tabSeq: '',
|
||||
tabName: ''
|
||||
});
|
||||
addDialog.value = false
|
||||
getData()
|
||||
} else {
|
||||
ElMessage.error(res.message);
|
||||
addDialog.value = false
|
||||
}
|
||||
})
|
||||
}
|
||||
// 编辑
|
||||
const detailPageFun = (row) => {
|
||||
addFormData.id = row.id;
|
||||
addFormData.useVip = row.useVip;
|
||||
addFormData.tabUrl = row.tabUrl;
|
||||
addFormData.status = row.status;
|
||||
addFormData.tabSeq = row.tabSeq;
|
||||
addFormData.tabName = row.tabName || '';
|
||||
addDialog.value = true
|
||||
}
|
||||
// 删除
|
||||
const deletePageFun = (row) => {
|
||||
ElMessageBox.confirm('确定要删除吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
deleteFaceTabNew({ id: row.id }).then(res => {
|
||||
if (res.code == 200) {
|
||||
ElMessage.success('删除成功')
|
||||
getData()
|
||||
} else {
|
||||
ElMessage.error(res.message)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
//重置
|
||||
const resetFormData = () => {
|
||||
Object.assign(formData, {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
useVip: -1,
|
||||
status: -1,
|
||||
id: ''
|
||||
});
|
||||
|
||||
};
|
||||
const resetaddFormData = () => {
|
||||
Object.assign(addFormData, {
|
||||
id: '',
|
||||
useVip: 0,
|
||||
tabUrl: '',
|
||||
status: 1,
|
||||
tabSeq: '',
|
||||
tabName: ''
|
||||
});
|
||||
|
||||
};
|
||||
const beforeAvatarUpload = () => {
|
||||
ElMessage({
|
||||
showClose: true,
|
||||
message: "上传中~",
|
||||
type: "warning",
|
||||
});
|
||||
};
|
||||
const handleAvatarError = () => {
|
||||
ElMessage({
|
||||
showClose: true,
|
||||
message: "上传失败!",
|
||||
type: "error",
|
||||
});
|
||||
};
|
||||
const handleAvatarSuccess = (res, file) => {
|
||||
addFormData.tabUrl = file.response.data;
|
||||
ElMessage({
|
||||
showClose: true,
|
||||
message: "上传成功!",
|
||||
type: "success",
|
||||
});
|
||||
};
|
||||
const handleSizeChange = (val) => {
|
||||
formData.pageSize = val;
|
||||
getData();
|
||||
};
|
||||
const handleCurrentChange = (val) => {
|
||||
formData.pageNo = val;
|
||||
getData();
|
||||
};
|
||||
onMounted(() => {
|
||||
getData();
|
||||
|
||||
})
|
||||
return {
|
||||
formData,
|
||||
addFormData,
|
||||
tableData,
|
||||
addDialog,
|
||||
getData,
|
||||
addFun,
|
||||
resetFormData,
|
||||
handleSizeChange,
|
||||
handleCurrentChange,
|
||||
beforeAvatarUpload,
|
||||
handleAvatarError,
|
||||
handleAvatarSuccess,
|
||||
detailPageFun,
|
||||
deletePageFun,
|
||||
resetaddFormData
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.box {
|
||||
padding-top: 20px;
|
||||
background: #ecf0f5;
|
||||
|
||||
.inquire {
|
||||
display: inline-block;
|
||||
margin-right: 20px;
|
||||
|
||||
span {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.input {
|
||||
width: 180px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.dialogTableVisibleBut {
|
||||
display: block;
|
||||
margin: 30px 0 0 830px;
|
||||
}
|
||||
|
||||
.paginationClass {
|
||||
margin: 15px 0 5px 0px;
|
||||
}
|
||||
}
|
||||
|
||||
.selectBox {
|
||||
display: flex;
|
||||
height: 35px;
|
||||
line-height: 35px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.selectBoxImg {
|
||||
height: 150px;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 178px;
|
||||
height: 178px;
|
||||
display: block;
|
||||
}
|
||||
</style>
|
Reference in New Issue
Block a user