This commit is contained in:
pengxiaolong
2025-07-02 15:01:23 +08:00
parent ec8bffa6f0
commit b2346c856a
6 changed files with 102 additions and 72 deletions

View File

@@ -9,7 +9,7 @@
<title>
<%= webpackConfig.name %>
</title>
<script src="qrc:///qtwebchannel/qwebchannel.js"></script>
<!-- <script src="qrc:///qtwebchannel/qwebchannel.js"></script> -->
</head>
<body>

View File

@@ -29,9 +29,7 @@ if (process.env.NODE_ENV === 'development') {
// 请求拦截器
axios.interceptors.request.use((config) => {
console.log("config", config)
const url = sliceUrl(config.url)
console.log("url", url)
// if (!(config.url == 'templateList' || config.url == 'languageList')) {
// config.headers['vvtoken'] = getToken();
// }
@@ -48,9 +46,7 @@ axios.interceptors.request.use((config) => {
// 响应拦截器
axios.interceptors.response.use((response) => {
console.log("```````````````response```````````````````", response.data)
if (response.data.code == '200') {
console.log("response", response.data.data)
return response.data.data
} else {
router.push('/')
@@ -83,9 +79,6 @@ export function getAxios({ url, params }) {
// axios的post请求
export function postAxios({ url, data }) {
return new Promise((resolve, reject) => {
console.log("```````````````data```````````````", data);
console.log("````````````````url````````````````", url);
axios.post(
url,
data,
@@ -104,8 +97,6 @@ export const downFile = async (urlstr, data) => {
// 获取文件名(如果后端设置了 Content-Disposition
const contentDisposition = response.headers['content-disposition'];
let fileName = 'default-file-name'; // 默认文件名
console.log(contentDisposition)
console.log(response)
if (contentDisposition) {
// 从响应头中提取文件名
const fileNameMatch = contentDisposition.match(/filename="(.+)"/);
@@ -139,7 +130,6 @@ function cheekalive() {
}
}
).then(res => {
console.log(res.data)
if (res.data) {
} else {

View File

@@ -96,6 +96,7 @@ function languageSave() {
type: "success",
message: "修改成功",
});
getLanguageListData();
})
.catch(() => {
ElMessage({
@@ -112,6 +113,7 @@ function languageSave() {
type: "success",
message: "添加成功",
});
getLanguageListData();
})
.catch(() => {
ElMessage({
@@ -132,6 +134,7 @@ function handleDelete(index, row) {
type: "success",
message: "删除成功",
});
getLanguageListData();
})
.catch(() => {
ElMessage({
@@ -142,21 +145,27 @@ function handleDelete(index, row) {
})
.catch(() => {});
}
function getLanguageListData() {
// 获取语言列表
getLanguageList()
.then((res) => {
console.log(res);
tableData.value = res;
}).catch(() => {
ElMessage({
type: "error",
message: "获取语言列表失败",
});
});
}
watch(refname, async (newQuestion, oldQuestion) => {
// 变化后执行
});
onMounted(() => {
// // 组件挂载完成后执行
// // 获取语言列表
// getLanguageList()
// .then((res) => {
// tableData.value = res.data;
// }).catch(() => {
// ElMessage({
// type: "error",
// message: "获取语言列表失败",
// });
// });
getLanguageListData();
// 组件挂载完成后执行
});
onUpdated(() => {
// 组件更新后执行

View File

@@ -73,7 +73,14 @@
<el-drawer v-model="wordsAddStatus" :with-header="false">
<div class="dialog-content">
<div class="dialog-title">话术编辑</div>
<el-select v-model="wordsAddData.language" placeholder="请选择语言"></el-select>
<el-select v-model="wordsAddData.language" placeholder="请选择语言">
<el-option
v-for="item in LanguageData"
:key="item.language"
:label="item.language"
:value="item.language"
/>
</el-select>
<el-input
v-model="wordsAddData.content"
style="width: 100%; margin-top: 20px"
@@ -90,7 +97,13 @@
</template>
<script setup>
import { getDialogList, getLanguageList, editDialog, deleteDialog,addDialog} from "@/api/account";
import {
getDialogList,
getLanguageList,
editDialog,
deleteDialog,
addDialog,
} from "@/api/account";
import { ElMessage, ElMessageBox } from "element-plus";
import {
ref, // 响应式基础
@@ -115,28 +128,28 @@ const handleClick = (e) => {
};
//数据处理
function groupContentByLanguage(arr1, arr2) {
return arr2.map((item) => {
// 过滤出对应语言的内容
const contents = arr1
.filter(({ language }) => language === item.language)
// 按 id 排序
.sort((a, b) => a.id - b.id)
// 转换为所需格式
.map(({ id, content }) => ({ id, content }));
function mergeArrays(arr1, arr2) {
const result = [];
const languages = new Set([...arr1.map(i => i.language), ...arr2.map(i => i.language)]);
for (const lang of languages) {
const contents = arr1.filter(item => item.language === lang)
.map(item => ({ id: item.id, content: item.content }));
result.push({
language: lang,
content: contents
});
}
return {
id: item.id,
language: item.language,
content: contents,
};
});
return result;
}
const dialogVisible = ref(false);
const handletextareadeta = ref({});
//添加话术
function handleSaveWordsAdd() {
console.log("handleSaveWordsAdd",wordsAddData.value);
if (wordsAddData.value.language === "" || wordsAddData.value.content === "") {
ElMessage({
type: "error",
@@ -151,12 +164,9 @@ function handleSaveWordsAdd() {
message: "添加成功",
});
wordsAddStatus.value = false;
getDialogListData.value = getDialogList();
LanguageData.value = groupContentByLanguage(
getDialogListData.value,
getLanguageListData.value
);
}).catch(() => {
getLanguageListDataFn();
})
.catch(() => {
ElMessage({
type: "error",
message: "添加失败",
@@ -180,6 +190,8 @@ function handleSave() {
type: "success",
message: "保存成功",
});
getLanguageListDataFn();
dialogVisible.value = false;
})
.catch(() => {
ElMessage({
@@ -187,8 +199,6 @@ function handleSave() {
message: "保存失败",
});
});
dialogVisible.value = false;
getDialogListData.value = getDialogList();
}
// 删除
function handleDelete(id) {
@@ -200,7 +210,7 @@ function handleDelete(id) {
type: "success",
message: "删除成功",
});
getDialogListData.value = getDialogList();
getLanguageListDataFn();
})
.catch(() => {
ElMessage({
@@ -211,17 +221,24 @@ function handleDelete(id) {
})
.catch(() => {});
}
function getLanguageListDataFn() {
getDialogList().then((res) => {
getDialogListData.value = res;
});
getLanguageList().then((res) => {
getLanguageListData.value = res;
LanguageData.value = mergeArrays(
getDialogListData.value,
getLanguageListData.value
);
console.log("LanguageData", LanguageData.value);
});
}
watch(refname, async (newQuestion, oldQuestion) => {
// 变化后执行
});
onMounted(() => {
// getDialogListData.value = getDialogList();
// console.log(getDialogListData.value);
// getLanguageListData.value = getLanguageList();
LanguageData.value = groupContentByLanguage(
getDialogListData.value,
getLanguageListData.value
);
getLanguageListDataFn();
});
onUpdated(() => {
// 组件更新后执行
@@ -280,7 +297,7 @@ onUnmounted(() => {
justify-content: center;
align-items: center;
}
.addwords:hover{
.addwords:hover {
background-color: rgb(214, 214, 214);
}
.addwordsimg {

View File

@@ -90,18 +90,7 @@ import {
onUnmounted, // 组件销毁前执行
} from "vue";
const refname = ref("");
const tableData = ref([
{
id: 1,
functionName: "登录",
functionValue: 10,
},
{
id: 2,
functionName: "分享",
functionValue: 20,
},
]);
const tableData = ref([]);
const dialogVisible = ref(false);
const miniIntegraldeta = ref({});
//保存积分配置
@@ -130,6 +119,7 @@ function miniIntegralAddSave() {
});
dialogVisible.value = false;
miniIntegraldeta.value = {};
getIntegralList()
})
.catch(() => {
ElMessage({
@@ -147,6 +137,7 @@ function miniIntegralAddSave() {
});
dialogVisible.value = false;
miniIntegraldeta.value = {};
getIntegralList()
})
.catch(() => {
ElMessage({
@@ -160,7 +151,6 @@ function miniIntegralAddSave() {
function miniIntegralEdit(index, row) {
dialogVisible.value = true;
miniIntegraldeta.value = row;
console.log(index, row);
}
//删除积分配置
function miniIntegralDelete(index, row) {
@@ -172,6 +162,7 @@ function miniIntegralDelete(index, row) {
type: "success",
message: "删除成功",
});
getIntegralList()
})
.catch(() => {
ElMessage({
@@ -182,11 +173,24 @@ function miniIntegralDelete(index, row) {
})
.catch(() => {});
}
// 获取积分配置列表
function getIntegralList() {
getWxConfigList()
.then((res) => {
tableData.value = res;
})
.catch(() => {
ElMessage({
type: "error",
message: "获取积分配置列表失败",
});
});
}
watch(refname, async (newQuestion, oldQuestion) => {
// 变化后执行
});
onMounted(() => {
// 组件挂载完成后执行
getIntegralList();
});
onUpdated(() => {
// 组件更新后执行

View File

@@ -70,7 +70,7 @@
<!-- 顶部 -->
<el-header class="header">
<el-breadcrumb :separator-icon="ArrowRight">
<el-breadcrumb-item :to="{ path: '/nav/Home' }">首页</el-breadcrumb-item>
<el-breadcrumb-item :to="{ path: '/nav/Home' }" @click="onBreadcrumbClick('/nav/Home')">首页</el-breadcrumb-item>
<el-breadcrumb-item
v-for="(item, index) in breadcrumbList"
:key="index"
@@ -129,7 +129,6 @@ function convertPathsToMenuItems(paths) {
}
//面包屑
function handleSelect(index, indexPath) {
console.log("select", convertPathsToMenuItems(indexPath));
breadcrumbList.value = convertPathsToMenuItems(indexPath);
}
//面包屑地址判断
@@ -140,6 +139,17 @@ function handleurl(indexPath) {
return indexPath;
}
}
//处理面包屑点击事件
function getPreviousObjects(arr, targetPath) {
// 找到匹配目标路径的第一个元素的索引
const index = arr.findIndex(item => item.path === targetPath);
// 如果找到匹配项,则返回从开始到该索引的子数组(包含自身)
return index !== -1 ? arr.slice(0, index + 1) : [];
}
function onBreadcrumbClick(path) {
breadcrumbList.value = getPreviousObjects(breadcrumbList.value, path)
}
//菜单展开
function toggleCollapse() {
asideWidth.value = isCollapse.value ? "10vw" : "4vw";