diff --git a/.prettierrc b/.prettierrc index 5d99a5e..6c27243 100644 --- a/.prettierrc +++ b/.prettierrc @@ -2,4 +2,4 @@ { "htmlWhitespaceSensitivity": "ignore", "printWidth": 1000 - } \ No newline at end of file +} \ No newline at end of file diff --git a/dist.tar b/dist.tar index 819068d..66d9e6a 100644 Binary files a/dist.tar and b/dist.tar differ diff --git a/src/api/marketing-algorithm.js b/src/api/marketing-algorithm.js index b116a94..c45da97 100644 --- a/src/api/marketing-algorithm.js +++ b/src/api/marketing-algorithm.js @@ -2,7 +2,7 @@ * @Author: qinzhenpen qzp1807@126.com * @Date: 2024-08-16 10:14:59 * @LastEditors: qinzhenpen qzp1807@126.com - * @LastEditTime: 2024-08-19 15:07:27 + * @LastEditTime: 2024-08-22 11:40:05 * @FilePath: \vue3\src\api\marketing-algorithm.js * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ @@ -72,4 +72,12 @@ export function getMarketingAlgorithmSentiment(data) { method: "POST", data, }); -} \ No newline at end of file +} +// 情感倾向分析 +export function getMarketingAlgorithmSentimentAnalysis(data) { + return request({ + url: "/api/python/sentimentAnaly", + method: "POST", + data, + }); +} diff --git a/src/api/portraitModel.js b/src/api/portraitModel.js index d1097b2..9800b47 100644 --- a/src/api/portraitModel.js +++ b/src/api/portraitModel.js @@ -7,6 +7,14 @@ export function getUserTableData(data) { params: data, }); } +// 查询用户数据基本信息 +export function getUserTableInfo(params) { + return request({ + url: "/api/userprofile/getBaseInfo", + method: "get", + params, + }); +} //数据下载-RFM分析 export function downloadDataByRFM(data) { return request({ diff --git a/src/assets/styles/index.scss b/src/assets/styles/index.scss index 5d90c3a..7d4f2fe 100644 --- a/src/assets/styles/index.scss +++ b/src/assets/styles/index.scss @@ -135,7 +135,10 @@ aside { .pagination-container { margin-top: 30px; background-color: transparent !important; - .el-pagination__total,.el-pagination__goto,.el-pagination__classifier{ + + .el-pagination__total, + .el-pagination__goto, + .el-pagination__classifier { color: #ffffff !important; } } @@ -211,7 +214,8 @@ aside { .el-button--large.is-round { padding: 12px 20px 12px 40px !important; } - .el-button{ + + .el-button { width: 89px; height: 31px; padding: 12px 20px 12px 40px !important; @@ -223,36 +227,43 @@ aside { .app-container2 { margin: 10px; - box-shadow: 0px 0px 13px 0px #0452C6; - border-radius: 10px; - padding: 25px 25px 10px 25px; + // box-shadow: 0px 0px 13px 0px #0452C6; + border-radius: 10px; + // padding: 25px 25px 10px 25px; } -.dialogClass{ - background:url('@/assets/images/弹框.png') !important; + +.dialogClass { + background: url('@/assets/images/弹框.png') !important; background-size: 100% 100% !important; - .el-dialog__header{ - padding: 5px 0px; - margin-right: 5px !important; - .gbImg{ - cursor: pointer; - width: 51px; - height: 31px; - background-size: 100% 100%; - } + + .el-dialog__header { + padding: 5px 0px; + margin-right: 5px !important; + + .gbImg { + cursor: pointer; + width: 51px; + height: 31px; + background-size: 100% 100%; + } + } + + .xtImg { + margin-left: 18px; + width: 530px; } - .xtImg{ - margin-left: 18px; - width: 530px; -} } + .my-header { -display: flex; -flex-direction: row; -justify-content: space-between; -gap: 16px; -text-align: center; -span{ - color: #FFFFFF; - padding: 38px 20px 0; + display: flex; + flex-direction: row; + justify-content: space-between; + gap: 16px; + text-align: center; + + span { + color: #FFFFFF; + padding: 38px 20px 0; + } } -} \ No newline at end of file + diff --git a/src/store/modules/algorithm.js b/src/store/modules/algorithm.js index bd29ba5..6dcccd6 100644 --- a/src/store/modules/algorithm.js +++ b/src/store/modules/algorithm.js @@ -8,6 +8,7 @@ const useAlgorithmStore = defineStore("algorithm", { tableData: [], tableKey:[], userDataLabel:["用户属性表", "用户登录活跃表", "用户消费能力表", "用户行为表", "用户评论表"], //用户数据标签 + userDataLabel2:["用户属性表", "用户登录活跃表", "用户消费能力表", "用户行为表", "用户评论表"], indexLibrary: [], analysisData: [], }), diff --git a/src/utils/request.js b/src/utils/request.js index 41fd6da..61a6068 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -1,95 +1,102 @@ -import axios from 'axios' -import { ElNotification , ElMessageBox, ElMessage, ElLoading } from 'element-plus' -import { getToken } from '@/utils/auth' -import errorCode from '@/utils/errorCode' -import { tansParams, blobValidate } from '@/utils/ruoyi' -import cache from '@/plugins/cache' -import { saveAs } from 'file-saver' -import useUserStore from '@/store/modules/user' +import axios from "axios"; +import { ElNotification, ElMessageBox, ElMessage, ElLoading } from "element-plus"; +import { getToken } from "@/utils/auth"; +import errorCode from "@/utils/errorCode"; +import { tansParams, blobValidate } from "@/utils/ruoyi"; +import cache from "@/plugins/cache"; +import { saveAs } from "file-saver"; +import useUserStore from "@/store/modules/user"; let downloadLoadingInstance; // 是否显示重新登录 export let isRelogin = { show: false }; -axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8' +axios.defaults.headers["Content-Type"] = "application/json;charset=utf-8"; // 创建axios实例 const service = axios.create({ // axios中请求配置有baseURL选项,表示请求URL公共部分 // baseURL: import.meta.env.VITE_APP_BASE_API, - // baseURL:'http://118.31.7.2:9868/', - baseURL:'http://192.168.2.28:9868/', + // baseURL: "http://118.31.7.2:9868/", + baseURL: "http://192.168.2.4:9868/", // 超时 - timeout: 100000 -}) + timeout: 100000, +}); // request拦截器 -service.interceptors.request.use(config => { - // 是否需要设置 token - const isToken = (config.headers || {}).isToken === false - // 是否需要防止数据重复提交 - const isRepeatSubmit = (config.headers || {}).repeatSubmit === false - if (getToken() && !isToken) { - config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 - } - // get请求映射params参数 - if (config.method === 'get' && config.params) { - let url = config.url + '?' + tansParams(config.params); - url = url.slice(0, -1); - config.params = {}; - config.url = url; - } - if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put')) { - const requestObj = { - url: config.url, - data: typeof config.data === 'object' ? JSON.stringify(config.data) : config.data, - time: new Date().getTime() +service.interceptors.request.use( + (config) => { + // 是否需要设置 token + const isToken = (config.headers || {}).isToken === false; + // 是否需要防止数据重复提交 + const isRepeatSubmit = (config.headers || {}).repeatSubmit === false; + if (getToken() && !isToken) { + config.headers["Authorization"] = "Bearer " + getToken(); // 让每个请求携带自定义token 请根据实际情况自行修改 + } + // get请求映射params参数 + if (config.method === "get" && config.params) { + let url = config.url + "?" + tansParams(config.params); + url = url.slice(0, -1); + config.params = {}; + config.url = url; } - const sessionObj = cache.session.getJSON('sessionObj') + if (!isRepeatSubmit && (config.method === "post" || config.method === "put")) { + const requestObj = { + url: config.url, + data: typeof config.data === "object" ? JSON.stringify(config.data) : config.data, + time: new Date().getTime(), + }; + const sessionObj = cache.session.getJSON("sessionObj"); + } + return config; + }, + (error) => { + console.log(error); + Promise.reject(error); } - return config -}, error => { - console.log(error) - Promise.reject(error) -}) - +); // 响应拦截器 -service.interceptors.response.use(res => { +service.interceptors.response.use( + (res) => { // 未设置状态码则默认成功状态 const code = res.data.code || 200; // console.log(code); // 获取错误信息 - const msg = errorCode[code] || res.data.msg || errorCode['default'] + const msg = errorCode[code] || res.data.msg || errorCode["default"]; // 二进制数据则直接返回 - if (res.request.responseType === 'blob' || res.request.responseType === 'arraybuffer') { - return res.data + if (res.request.responseType === "blob" || res.request.responseType === "arraybuffer") { + return res.data; } if (code === 401) { if (!isRelogin.show) { isRelogin.show = true; - ElMessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' }).then(() => { - isRelogin.show = false; - useUserStore().logOut().then(() => { - location.href = '/index'; + ElMessageBox.confirm("登录状态已过期,您可以继续留在该页面,或者重新登录", "系统提示", { confirmButtonText: "重新登录", cancelButtonText: "取消", type: "warning" }) + .then(() => { + isRelogin.show = false; + useUserStore() + .logOut() + .then(() => { + location.href = "/index"; + }); }) - }).catch(() => { - isRelogin.show = false; - }); - } - return Promise.reject('无效的会话,或者会话已过期,请重新登录。') + .catch(() => { + isRelogin.show = false; + }); + } + return Promise.reject("无效的会话,或者会话已过期,请重新登录。"); } else if (code === 500) { - ElMessage({ message: msg, type: 'error' }) - return Promise.reject(new Error(msg)) + ElMessage({ message: msg, type: "error" }); + return Promise.reject(new Error(msg)); } else if (code === 601) { - ElMessage({ message: msg, type: 'warning' }) - return Promise.reject(new Error(msg)) + ElMessage({ message: msg, type: "warning" }); + return Promise.reject(new Error(msg)); } else if (code !== 200) { - ElNotification.error({ title: msg }) - return Promise.reject('error') + ElNotification.error({ title: msg }); + return Promise.reject("error"); } else { - return Promise.resolve(res.data) + return Promise.resolve(res.data); } }, - error => { - console.log('err' + error) + (error) => { + console.log("err" + error); let { message } = error; if (message == "Network Error") { message = "后端接口连接异常"; @@ -97,50 +104,61 @@ service.interceptors.response.use(res => { message = "系统接口请求超时"; } else if (message.includes("Request failed with status code")) { if (message.includes("401")) { - ElMessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' }).then(() => { - isRelogin.show = true; - useUserStore().logOut().then(() => { - location.href = '/login'; + ElMessageBox.confirm("登录状态已过期,您可以继续留在该页面,或者重新登录", "系统提示", { confirmButtonText: "重新登录", cancelButtonText: "取消", type: "warning" }) + .then(() => { + isRelogin.show = true; + useUserStore() + .logOut() + .then(() => { + location.href = "/login"; + }); }) - }).catch(() => { - isRelogin.show = false; - }); + .catch(() => { + isRelogin.show = false; + }); } else if (message.includes("code 400")) { // ElNotification.error({ title: error.response.data }) - ElMessage({ message: error.response.data.msg, type: 'error' }) + ElMessage({ message: error.response.data.msg, type: "error" }); } message = "系统接口" + message.substr(message.length - 3) + "异常"; } // ElMessage({ message: message, type: 'error', duration: 5 * 1000 }) - return Promise.reject(error) + return Promise.reject(error); } -) +); // 通用下载方法 export function download(url, params, filename, config) { - downloadLoadingInstance = ElLoading.service({ text: "正在下载数据,请稍候", background: "rgba(0, 0, 0, 0.7)", }) - return service.post(url, params, { - transformRequest: [(params) => { return tansParams(params) }], - headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, - responseType: 'blob', - ...config - }).then(async (data) => { - const isBlob = blobValidate(data); - if (isBlob) { - const blob = new Blob([data]) - saveAs(blob, filename) - } else { - const resText = await data.text(); - const rspObj = JSON.parse(resText); - const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default'] - ElMessage.error(errMsg); - } - downloadLoadingInstance.close(); - }).catch((r) => { - console.error(r) - ElMessage.error('下载文件出现错误,请联系管理员!') - downloadLoadingInstance.close(); - }) + downloadLoadingInstance = ElLoading.service({ text: "正在下载数据,请稍候", background: "rgba(0, 0, 0, 0.7)" }); + return service + .post(url, params, { + transformRequest: [ + (params) => { + return tansParams(params); + }, + ], + headers: { "Content-Type": "application/x-www-form-urlencoded" }, + responseType: "blob", + ...config, + }) + .then(async (data) => { + const isBlob = blobValidate(data); + if (isBlob) { + const blob = new Blob([data]); + saveAs(blob, filename); + } else { + const resText = await data.text(); + const rspObj = JSON.parse(resText); + const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode["default"]; + ElMessage.error(errMsg); + } + downloadLoadingInstance.close(); + }) + .catch((r) => { + console.error(r); + ElMessage.error("下载文件出现错误,请联系管理员!"); + downloadLoadingInstance.close(); + }); } -export default service +export default service; diff --git a/src/views/components/popModal.vue b/src/views/components/popModal.vue index eb544d1..2a7c7a3 100644 --- a/src/views/components/popModal.vue +++ b/src/views/components/popModal.vue @@ -1,20 +1,7 @@