diff --git a/ruoyi-ui/src/api/teachingpan.js b/ruoyi-ui/src/api/teachingpan.js index 321a4f7..69d3ab2 100644 --- a/ruoyi-ui/src/api/teachingpan.js +++ b/ruoyi-ui/src/api/teachingpan.js @@ -23,6 +23,7 @@ export const addload = (formData) => { data:formData, headers: { 'Content-Type': 'multipart/form-data; ' - } + }, + }) } diff --git a/ruoyi-ui/src/components/current/index.vue b/ruoyi-ui/src/components/current/index.vue index f9dc80f..1fb2503 100644 --- a/ruoyi-ui/src/components/current/index.vue +++ b/ruoyi-ui/src/components/current/index.vue @@ -59,10 +59,10 @@
- + - +
@@ -72,7 +72,6 @@ - import('@/views/task/report.vue'), name: 'testreport', - meta: { icon: 'teachingplan', affix: true } + meta: { icon: 'teachingplan', affix: true ,activeMenu: '/teacher/index'} } ] }, @@ -344,7 +343,7 @@ export const teacher = [ path: 'index', component: () => import('@/views/transactionRecords/index'), name: 'transactionRecords', - meta: { title: '交易记录', icon: 'null', affix: true, activeMenu: '/student/index' } + meta: { title: '交易记录', icon: 'null', affix: true, activeMenu: '/teacher/studenttrainingReportBullet/reportBullet' } } ] }, diff --git a/ruoyi-ui/src/store/modules/user.js b/ruoyi-ui/src/store/modules/user.js index 835e163..ae1644d 100644 --- a/ruoyi-ui/src/store/modules/user.js +++ b/ruoyi-ui/src/store/modules/user.js @@ -46,6 +46,7 @@ const user = { const passwordEncode = userInfo.passwordEncode return new Promise((resolve, reject) => { login(username, passwordEncode).then(res => { + cookie.setToken(res.data.accessToken) cookie.setname(res.data.name) cookie.setschoolId(res.data.schoolId) @@ -55,7 +56,7 @@ const user = { commit('SET_NAME', res.data.name) commit('SET_AVATAR', res.data.classId) commit('SET_SCHOOLID', res.data.schoolId) - + resolve() }).catch(error => { reject(error) diff --git a/ruoyi-ui/src/utils/index.js b/ruoyi-ui/src/utils/index.js index dc0c91f..998fd68 100644 --- a/ruoyi-ui/src/utils/index.js +++ b/ruoyi-ui/src/utils/index.js @@ -1,5 +1,5 @@ import { parseTime } from './ruoyi' - +import { Message } from 'element-ui' /** * 表格时间格式化 */ @@ -388,3 +388,48 @@ export function isNumberStr(str) { return /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g.test(str) } +// 启用websocket +// 启用websocket +export function useWebSocket(url) { + let ws = null; + let reconnectInterval = 5000; // 重连间隔时间,单位:毫秒 + let maxReconnectAttempts = 10; // 最大重连尝试次数 + let reconnectAttempts = 0; // 当前重连尝试次数 + + function createWebSocket() { + ws = new WebSocket(url); + + // 连接成功提示 + ws.onopen = function () { + console.log('连接成功'); + reconnectAttempts = 0; // 重置重连尝试次数 + }; + + // 接收消息 + ws.onmessage = function (e) { + // onMessage(e) + // Message.(e.data); + Message({ message: e.data, type: 'error' }); + }; + + // 连接关闭 + ws.onclose = function () { + console.log('连接关闭'); + if (reconnectAttempts < maxReconnectAttempts) { + reconnectAttempts++; + setTimeout(() => createWebSocket(), reconnectInterval); + } else { + console.log('达到最大重连尝试次数,连接失败'); + } + }; + // 发生错误 + ws.onerror = function () { + console.log('连接错误'); + ws.close(); // 关闭连接,以触发 onclose 事件 + }; + } + + createWebSocket(); // 初始化 WebSocket + + return ws; +} diff --git a/ruoyi-ui/src/utils/request.js b/ruoyi-ui/src/utils/request.js index 31a6652..f0d8e4e 100644 --- a/ruoyi-ui/src/utils/request.js +++ b/ruoyi-ui/src/utils/request.js @@ -14,18 +14,12 @@ axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8' // 创建axios实例 const service = axios.create({ // axios中请求配置有baseURL选项,表示请求URL公共部分 -<<<<<<< HEAD - baseURL: 'http://118.31.7.2:8801', -======= - // baseURL: 'http://118.31.7.2:8800', - baseURL: 'http://localhost:8800', ->>>>>>> f4500c5f3ef4b43105701541dffcdc560100371a - // baseURL: 'http://192.168.2.14:8800', + // baseURL: 'http://118.31.7.2:8801', + baseURL: 'http://192.168.2.14:8800', // baseURL:"http://192.168.2.17:8801", // baseURL: process.env.VUE_APP_BASE_API, // 超时 timeout: 200000 - }) // request拦截器 service.interceptors.request.use(config => { @@ -75,14 +69,9 @@ service.interceptors.request.use(config => { // 响应拦截器 service.interceptors.response.use(res => { -<<<<<<< HEAD -// console.log(res, 'res'); -======= - // console.log(res, 'res1'); - debugger ->>>>>>> f4500c5f3ef4b43105701541dffcdc560100371a + console.log(res.data, 'res'); // 未设置状态码则默认成功状态 - const code = res.status || 200 + const code = res.data.code || 200 // 获取错误信息 const msg = errorCode[code] || res.data.msg || errorCode['default'] // 二进制数据则直接返回 @@ -94,9 +83,9 @@ service.interceptors.response.use(res => { isRelogin.show = true MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' }).then(() => { isRelogin.show = false - // store.dispatch('LogOut').then(() => { - // location.href = '/index'; - // }) + store.dispatch('LogOut').then(() => { + location.href = '/login'; + }) }).catch(() => { isRelogin.show = false }) @@ -117,55 +106,39 @@ service.interceptors.response.use(res => { }, error => { let { message } = error -<<<<<<< HEAD - if(error.response.data.code == '400'){ - Message({ message: error.response.data.msg, type: 'error' }) - } else if (message == 'Network Error') { -======= - // debugger - if (message == 'Network Error') { ->>>>>>> f4500c5f3ef4b43105701541dffcdc560100371a - message = '后端接口连接异常' - } else if (message.includes('timeout')) { - message = '系统接口请求超时' -<<<<<<< HEAD - } else if (error.response.status == '401') { -======= - } else if (error.response.status=="401") { ->>>>>>> f4500c5f3ef4b43105701541dffcdc560100371a + if(error.response.status === 400){ + console.log('error1',error.response.data.code) + Message({ message: error.response.data.msg, type: 'error' }) + } else if (error.response.status === 401) { + console.log('error1',error.response.data.code) if (!isRelogin.show) { isRelogin.show = true MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' }).then(() => { isRelogin.show = false -<<<<<<< HEAD store.dispatch('FedLogOut').then(() => { location.href = '/login'; }) -======= - document.cookie = 'Admin-Token=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;'; - // store.dispatch('LogOut').then(() => { - location.href = '/login'; - // }) ->>>>>>> f4500c5f3ef4b43105701541dffcdc560100371a }).catch(() => { isRelogin.show = false }) } return Promise.reject('无效的会话,或者会话已过期,请重新登录。') -<<<<<<< HEAD - } -======= + } + else if (message == 'Network Error') { + if (message == 'Network Error') { + message = '后端接口连接异常' + } else if (message.includes('timeout')) { + message = '系统接口请求超时' + } } ->>>>>>> f4500c5f3ef4b43105701541dffcdc560100371a else if (message.includes('Request failed with status code')) { message = '系统接口' + message.substr(message.length - 3) + '1221231异常' }else{ Message({ message: message, type: 'error', duration: 5 * 1000 }) return Promise.reject(error) } - } ) diff --git a/ruoyi-ui/src/views/PracticeZone/index.vue b/ruoyi-ui/src/views/PracticeZone/index.vue index dd6aa83..eea34c7 100644 --- a/ruoyi-ui/src/views/PracticeZone/index.vue +++ b/ruoyi-ui/src/views/PracticeZone/index.vue @@ -57,7 +57,7 @@ export default { : (this.nowName = tab.name) }, progress() { - this.$tab.openPage('进行中', '/student/trade/index') + this.$tab.openPage('进行中', `/student/trade/index?id=${999999999}`) } } } diff --git a/ruoyi-ui/src/views/StudentTrainingReportBullet/components/member.vue b/ruoyi-ui/src/views/StudentTrainingReportBullet/components/member.vue index 73dfc49..98f0703 100644 --- a/ruoyi-ui/src/views/StudentTrainingReportBullet/components/member.vue +++ b/ruoyi-ui/src/views/StudentTrainingReportBullet/components/member.vue @@ -156,6 +156,7 @@ export default { this.memberparams.trainingId = this.practicalid; console.log(this.distinguish,'this.distinguish'); this.studentlist=[]; + if(this.memberparams.trainingId == '') return PracticalTraining.listMembersByTrainingId(this.memberparams).then(res=>{ // 循环遍历res.data.list this.membertotal = res.data.total; diff --git a/ruoyi-ui/src/views/StudentTrainingReportBullet/index.vue b/ruoyi-ui/src/views/StudentTrainingReportBullet/index.vue index 42663b9..c6ca7a3 100644 --- a/ruoyi-ui/src/views/StudentTrainingReportBullet/index.vue +++ b/ruoyi-ui/src/views/StudentTrainingReportBullet/index.vue @@ -285,10 +285,10 @@ }, // 成员管理 management(data){ + // debugger this.memberDialogVisible=true this.grabble=false - if(data.trainingId == "") return - + if(data.trainingId == '') return this.trainingId=data.trainingId this.$nextTick(()=>{ this.$refs.child.getMemberList() diff --git a/ruoyi-ui/src/views/inProgress/index.vue b/ruoyi-ui/src/views/inProgress/index.vue index a4b85c5..677733d 100644 --- a/ruoyi-ui/src/views/inProgress/index.vue +++ b/ruoyi-ui/src/views/inProgress/index.vue @@ -20,7 +20,7 @@
- 排行榜 + 返回
@@ -119,7 +119,9 @@ this.$tab.openPage('交易记录', `/teacher/transactionRecords/index?id=${data.trainingId}`) }, - + back() { + this.$router.back() + } } } diff --git a/ruoyi-ui/src/views/index.vue b/ruoyi-ui/src/views/index.vue index 4f0e7bf..a2dcc95 100644 --- a/ruoyi-ui/src/views/index.vue +++ b/ruoyi-ui/src/views/index.vue @@ -21,13 +21,13 @@
- + - - + + @@ -89,6 +89,7 @@ diff --git a/ruoyi-ui/src/views/quotation/index.vue b/ruoyi-ui/src/views/quotation/index.vue index d107986..190380a 100644 --- a/ruoyi-ui/src/views/quotation/index.vue +++ b/ruoyi-ui/src/views/quotation/index.vue @@ -58,7 +58,7 @@ export default { } else if(type==3){ window.open("http://www.csrc.gov.cn/"); } else if(type==4){ - window.open("http://www.u2008.com/"); + window.open("https://www.mql5.com/zh"); } } } diff --git a/ruoyi-ui/src/views/task/index.vue b/ruoyi-ui/src/views/task/index.vue index 688f434..a8eb7a5 100644 --- a/ruoyi-ui/src/views/task/index.vue +++ b/ruoyi-ui/src/views/task/index.vue @@ -1,9 +1,8 @@