bug修改完成

main
qinzhenpen 2 years ago
parent 2f9a85d7ee
commit 6debff7909

@ -23,6 +23,7 @@ export const addload = (formData) => {
data:formData,
headers: {
'Content-Type': 'multipart/form-data; '
}
},
})
}

@ -59,10 +59,10 @@
</el-form-item>
<div class="dialog-inline" style="display: flex;">
<el-form-item label="止损:" >
<el-input v-model.number="tradinglist.stopLoss"></el-input>
<el-input placeholder="请输入" v-model="tradinglist.stopLoss"></el-input>
</el-form-item>
<el-form-item label="止盈:" >
<el-input v-model.number="tradinglist.stopWin"></el-input>
<el-input placeholder="请输入" v-model="tradinglist.stopWin"></el-input>
</el-form-item>
</div>
</el-form>
@ -72,7 +72,6 @@
</span>
</el-dialog>
<!-- 平仓 -->
<el-dialog
title="平仓"
:visible.sync="colseDialogVisible"
@ -263,7 +262,7 @@
watch:{
//
localStorageValue(val){
if(val == 'FINISHED'){
if(val == 'FINISHED' || val == 'NOT_STARTED'){
console.log('监听本地缓存');
clearInterval(this.timer)
}

@ -7,7 +7,6 @@ Vue.use(Router)
/* Layout */
import Layout from '@/layout'
/**
* Note: 路由配置项
*
@ -278,7 +277,7 @@ export const dynamicRoutes = [{
]
// 教师端路由
export const teacher = [
{
{
path: '/teacher',
component: Layout,
redirect: 'ageIssue',
@ -330,7 +329,7 @@ export const teacher = [
path: 'testreport',
component: () => 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' }
}
]
},

@ -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)

@ -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;
}

@ -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)
}
}
)

@ -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}`)
}
}
}

@ -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;

@ -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()

@ -20,7 +20,7 @@
</div>
<div class="right">
<el-form-item>
<el-button type="success" size="mini" >排行榜</el-button>
<el-button size="mini" icon="el-icon-arrow-left" @click="back"></el-button>
</el-form-item>
</div>
@ -119,7 +119,9 @@
this.$tab.openPage('交易记录', `/teacher/transactionRecords/index?id=${data.trainingId}`)
},
back() {
this.$router.back()
}
}
}

@ -21,13 +21,13 @@
<div class="index">
<el-form ref="queryForm" size="small" :inline="true" :model="queryParams">
<el-form-item label="实训任务" prop="title" class="formIpt">
<el-select placeholder="选择任务" clearable type="image" v-model="queryParams.trainingName">
<el-select placeholder="选择任务" clearable type="image" v-model="queryParams.trainingName" @change="chooseTraining">
<el-option v-for="item in tasklist" :key="item.training_id" :label="item.training_name" :value="item.training_name"/>
</el-select>
</el-form-item>
<el-form-item label="班级" prop="content" class="formIpt">
<el-select placeholder="选择分类" clearable type="image" v-model="queryParams.classGrade">
<el-option v-for="item in classeslist" :key="item" :label="item" :value="item"/>
<el-select placeholder="选择班级" clearable type="image" v-model="queryParams.classGrade">
<el-option v-for="item in classeslist" :key="item" :label="item.class_grade" :value="item.class_grade"/>
</el-select>
</el-form-item>
<el-form-item label="日期" prop="cateId">
@ -89,6 +89,7 @@
<script>
import * as home from '@/api/index.js'
import { setmemberId } from '@/utils/auth'
import * as teacher from '@/api/teacher/index.js'
export default {
name: 'Index',
data() {
@ -106,14 +107,15 @@ export default {
tasklist:null,
classeslist:null,
transactionlist:[],
total:0
total:0,
practicalId:null
}
},
computed: {},
created() {
this.getlist()
this.taskname()
this.classGrade()
},
methods: {
getlist() {
@ -136,9 +138,9 @@ export default {
})
},
classGrade() {
home.getClassGrade().then((res) => {
teacher.getClass({trainingId:this.practicalId}).then((res) => {
if(res.code !== 200) return
this.classeslist=res.data
this.classeslist=res.data
})
},
trade(data) {
@ -151,6 +153,15 @@ export default {
},
skip() {
this.$tab.openPage('练习专区', `/student/PracticeZone/homepagege?id=${'999999999'}`)
},
chooseTraining(){
this.tasklist.forEach((item)=>{
if(item.training_name == this.queryParams.trainingName){
this.practicalId=item.training_id
}
})
this.queryParams.classGrade=""
this.classGrade()
}
}
}

@ -136,7 +136,7 @@ export default {
queryParams: {
className:'',
keyword:'',
markStatus:null,
markStatus:0,
trainingName:'',
index: 1,
size: 10,
@ -179,8 +179,8 @@ export default {
score:0
}
],
experimentalReportScore:0,
simulationTradingProfitScore:0
experimentalReportScore:60,
simulationTradingProfitScore:40
},
scoring:[
{
@ -253,7 +253,7 @@ export default {
},
//
downLoad(){
window.open(`http://118.31.7.2:8800/api/member/exportMembers?TOKEN=${getToken()}&className=${this.queryParams.className}&keyword=${this.queryParams.keyword}&markStatus=${this.queryParams.markStatus}&trainingName=${this.queryParams.trainingName}`, '_blank')
window.open(`http://118.31.7.2:8801/api/member/exportMembers?TOKEN=${getToken()}&className=${this.queryParams.className}&keyword=${this.queryParams.keyword}&markStatus=${this.queryParams.markStatus}&trainingName=${this.queryParams.trainingName}`, '_blank')
},
//
addweightfun(){

@ -76,7 +76,8 @@
import Cookies from "js-cookie";
import { encrypt, decrypt } from "@/utils/jsencrypt";
import { getRouters } from "@/api/menu";
import { getroleId } from "@/utils/auth";
import { getroleId ,getname} from "@/utils/auth";
import { useWebSocket } from '@/utils/index'
export default {
name: "Login",
data() {
@ -166,6 +167,8 @@ export default {
this.$store
.dispatch("Login", loginForm)
.then(() => {
console.log("loginForm", loginForm);
// this.getRouterList();
getRouters().then((res) => {
@ -175,6 +178,8 @@ export default {
this.$router.push({
path: this.redirect || "/student/index",
});
this.createsocket()
} else {
this.$router.push({ path: this.redirect || "/teacher/index" });
}
@ -192,6 +197,9 @@ export default {
}
});
},
createsocket() {
useWebSocket('ws://192.168.2.14:8800/webSocket/' + getname())
},
},
};
</script>

@ -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");
}
}
}

@ -1,9 +1,8 @@
<template>
<div class="app-container">
<div class="overview-title" v-show="activeName !== 'tabs2'">
<el-button :disabled="status == 'FINISHED'" size="medium" @click="carryout"></el-button>
<el-button :disabled="status == 'FINISHED' || status == 'NOT_STARTED'" size="medium" @click="carryout"></el-button>
</div>
<div class="overview-title-right" v-show="activeName !== 'tabs1'">
<el-button type="primary" @click="hsbmit()" > </el-button>
<el-button type="warning" onclick="upload.click()"> </el-button>
@ -62,6 +61,7 @@ export default {
};
},
created() {
localStorage.removeItem('Type')
this.id = this.$route.query.id;
this.status = localStorage.getItem("status");
console.log(this.id, "this.id");
@ -74,7 +74,7 @@ export default {
: (this.nowName = tab.name);
},
carryout(){
this.$tab.openPage("进行中", "/student/trade/index",{id:this.id} );
this.$tab.openPage("进行中", `/student/trade/index?id=${this.id}`);
},
//
hsbmit(){
@ -91,11 +91,16 @@ export default {
// console.log(file, "file");
testreport.uploadReport(formData).then((res) => {
if (res.code == 200) {
this.planParams.file = res.data;
this.$message.success("上传成功");
// this.planParams.file = res.data;
}
});
},
},
beforeDestroy() {
//
localStorage.removeItem('Type')
},
};
</script>
<style lang='scss' scoped>
@ -132,6 +137,7 @@ export default {
background-color: transparent;
border-radius: 4px;
margin-right: 10px;
background: #E8EBEE;
&.is-active {
background-color: #3c9cf5;
color: #fff;

@ -35,7 +35,7 @@
</div></el-col>
<el-col :span="6"
><div class="grid-content rmb">
<span>收益率:<i>{{ datalist.yield == null ? 0 :datalist.yield }}</i><em v-if="datalist.yield!==null">%</em> </span>
<span>收益率:<i>{{ datalist.yield == null ? 0 :datalist.yield * 100}}</i><em v-if="datalist.yield!==null">%</em> </span>
<span>总资产人民币:<i>{{ datalist.reportScore == null ? '--' : datalist.reportScore }}</i><em v-if="datalist.reportScore !== null"></em> </span>
</div></el-col>
</el-row>
@ -114,7 +114,7 @@ export default {
watch:{
//
localStorageValue(val){
if(val == 'FINISHED'){
if(val == 'FINISHED' || val == 'NOT_STARTED'){
clearInterval(this.time)
}
}

@ -88,6 +88,7 @@ export default {
},
//
dialogVisible: false,
isaddvalidate: false,
rulesreport : {
tradingPlan: [
{ required: true, message: "请输入交易计划", trigger: "blur" },
@ -120,30 +121,32 @@ export default {
// getroleId() !== "3"? this.dialogVisible = false : this.dialogVisible = true
if(getroleId() !== "3") {
this.dialogVisible = false
this.getreportPDF()
}else{
this.dialogVisible = true
this.getreportPDF()
}
},
computed: {},
methods: {
//
submitReport() {
if(this.isaddvalidate === true) return this.$modal.msgError("已提交过实验报告,请勿重复提交")
//
this.$refs.reportref.validate((valid) => {
if (!valid) return;
testreport.getExperiment(this.reportdata).then((res) => {
if (res.code !== 200) return
this.isaddvalidate = true
this.$modal.msgSuccess("提交成功");
this.$refs.reportref.resetFields();
})
});
},
// pdf
getreportPDF() {
// this.$route.query.memberId
testreport.getReport({memberId: this.$route.query.memberId}).then((res) => {
const id = this.$route.query.memberId || this.reportdata.memberId
testreport.getReport({memberId:id}).then((res) => {
if (res.code !== 200) return
this.scoringData.id=res.data.id
this.reportName=res.data.fileName
@ -169,7 +172,7 @@ export default {
this.$router.back()
},
load(){
window.open(`http://118.31.7.2:8800/api/report/download?id=${this.scoringData.id}&TOKEN=${getToken()}`)
window.open(`http://118.31.7.2:8801/api/report/download?id=${this.scoringData.id}&TOKEN=${getToken()}`)
}
}
};
@ -213,6 +216,10 @@ export default {
min-height: 160px !important;
border-color: transparent;
background: #f6f7f8;
color: #333333;
font-size: 14px;
font-family: Microsoft YaHei;
font-weight: 400;
}
}
.report-tilte{

@ -17,8 +17,8 @@
<!-- -->
<el-table :data="tableData" style="width:100%">
<el-table-column type="index" label="序号" align="center" width="200" />
<el-table-column prop="name" label="姓名" align="center" />
<el-table-column label="地址" align="center" width="300">
<el-table-column prop="name" label="资源名称" align="center" />
<el-table-column label="操作" align="center" width="300">
<template slot-scope="scope">
<el-button type="primary" size="mini" @click="down(scope.row)"></el-button>
<el-button v-if="isCollapse" type="danger" size="mini" @click="del(scope.row)"></el-button>
@ -36,7 +36,7 @@
>
<el-form :inline="true" :rules="rulesform" :model="planParams" ref="ruleForm">
<el-form-item label="资源名称" prop="name">
<el-input v-model="planParams.name" placeholder="请选择"></el-input>
<el-input v-model="planParams.name" placeholder="资源名称"></el-input>
</el-form-item>
<el-form-item >
<el-button icon="el-icon-plus" type="warning" plain onclick="upload.click()" >资源文件</el-button>
@ -55,6 +55,7 @@
import{getroleId} from '@/utils/auth.js'
import * as teachingpan from '@/api/teachingpan.js'
import {getToken} from '@/utils/auth.js'
import axios from 'axios'
export default {
name: '',
data() {
@ -76,7 +77,8 @@ export default {
name: [
{ required: true, message: '请输入资源名称', trigger: 'blur' }
],
}
},
uploadProgress: 0
}
},
computed: {},
@ -94,7 +96,7 @@ export default {
},
//
down(data){
window.open(`http://118.31.7.2:8800/api/trainingLessonPlan/download?id=${data.id}&TOKEN=${getToken()}`)
window.open(`http://118.31.7.2:8801/api/trainingLessonPlan/download?id=${data.id}&TOKEN=${getToken()}`)
},
del(list){
teachingpan.deleteload({id:list.id}).then(res=>{
@ -115,8 +117,9 @@ export default {
return;
}
this.planParams.file =file
this.planParams.name = file.name
},
load(){
load(e){
let formData = new FormData();
formData.append("file",this.planParams.file);
formData.append("name",this.planParams.name);
@ -126,12 +129,15 @@ export default {
//
teachingpan.addload(formData).then(res=>{
if(res.code !== 200) return
this.$modal.msgSuccess("新增成功");
this.$modal.msgSuccess("新增教案成功");
this.dialogVisible = false
this.gitlist()
this.planParams.name = ''
})
});
}
},
}
}
</script>

@ -1,11 +1,6 @@
<template>
<div class="trade-cdeposit">
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleSendButton()"
>新增</el-button>
<el-table
:data="[userlistData]"
style="width: 100%"
@ -18,8 +13,16 @@
/>
<el-table-column prop="name" label="姓名" width="140" align="center" />
<el-table-column label="已用保证金" prop="marginUsed" align="center"/>
<el-table-column prop="netValue" label="净值" align="center" />
<el-table-column label="保证金水平" align="center" prop="isdelete" />
<el-table-column label="净值" align="center" >
<template slot-scope="scope">
<span> {{toDecimal2(scope.row.netValue)}}</span>
</template>
</el-table-column>
<el-table-column label="保证金水平" align="center" >
<template slot-scope="scope">
<span> {{toDecimal2(scope.row.marginLevel) }}</span>
</template>
</el-table-column>
<el-table-column prop="warningLevel" label="保证金报警水平" align="center" />
<el-table-column label="状态" align="center">
<template slot-scope="scope">
@ -35,8 +38,8 @@
</el-table-column>
<el-table-column label="操作" align="center" width="200">
<template slot-scope="scope">
<el-button size="mini" v-if="scope.row.status > 0" type="primary' " @click="start(scope.row)"> </el-button>
<el-button size="mini" v-else type="danger " @click="start(scope.row)"></el-button>
<el-button size="mini" v-if="scope.row.status <= 0" type="primary" @click="start(scope.row)"> </el-button>
<el-button size="mini" v-else type="danger" @click="start(scope.row)"></el-button>
</template>
</el-table-column>
</el-table>
@ -47,8 +50,8 @@
<el-table :data="tableData" style="width: 100%">
<el-table-column prop="account" label="账号" width="100" align="center" />
<el-table-column prop="name" label="姓名" width="400" align="center" />
<el-table-column prop="marginUsed" label="保证金报警水平" align="center" />
<el-table-column prop="warningLevel" label="预警水平" align="center" />
<el-table-column prop="warningLevel" label="保证金报警水平" align="center" />
<el-table-column prop="earlyWarningLevel" label="预警水平" align="center" />
<el-table-column prop="warningTime" label="预警时间" align="center" >
<template slot-scope="scope">
<span> {{ parseTime(scope.row.warningTime, "{y}-{m}-{d} {h}:{i}:{s}")}}</span>
@ -69,6 +72,7 @@
<script>
import * as forewarning from '@/api/forewarning'
import { getname ,getToken} from '@/utils/auth'
import {useWebSocket} from '@/utils/index.js'
export default {
data() {
return {
@ -100,7 +104,7 @@ export default {
this.getlist()
this.record()
// websocket
this.createWebSocket()
},
methods:{
getlist(){
@ -121,53 +125,48 @@ export default {
},
//
start(data){
// console.log(data,'data');
let statusis =null
if( data.status == 1){
statusis= 0
}else{
statusis= 1
}
forewarning.setMarginWarningStatus({id:data.id,status:statusis}).then(res => {
let params = {
id:data.id,
status:data.status === 0 ? 1 : 0
}
forewarning.setMarginWarningStatus(params).then(res => {
// res.code200
if(res.code !== 200) return
this.userlistData=res.data
this.$modal.msgSuccess(res.msg);
this.$message({ message:data.status == 1 ? '关闭成功' : '启用成功' ,type: 'success'})
this.getlist()
})
},
//
del(id){
forewarning.deleteMarginWarningRecord({id:id}).then(res => {
// if(res.code !== 200) return
// res.code200
this.$modal.msgSuccess('删除成功');
this.record()
})
},
// websocket
createWebSocket() {
// ziyuancookie
let websocket = new WebSocket('ws://192.168.2.14:8800/webSocket/' + getname())
//
websocket.onopen = () => {
// websocket.send('hello')
}
websocket.onmessage = event => {
// event.data
console.log(event.data)
}
websocket.onclose = function () {
console.log('关闭了')
}
// websocket
this.$router.afterEach(function () {
websocket.close()
})
// websocketserver
window.onbeforeunload = function () {
websocket.close()
}
}
//
toDecimal2(x) {
var f = parseFloat(x);
if (isNaN(f)) {
return 0;
}
var f = Math.round(x * 100) / 100;
var s = f.toString();
var rs = s.indexOf('.');
if (rs < 0) {
rs = s.length;
s += '.';
}
while (s.length <= rs + 2) {
s += '0';
}
return s;
},
},
}

@ -8,42 +8,78 @@
width="100"
align="center"
/>
<el-table-column label="预警时长" align="center" prop="wariningHoldDuration" />
<el-table-column label="预警持仓时长" align="center" prop="wariningHoldDuration" >
<template slot-scope="scope">
<span> {{ scope.row.wariningHoldDuration}}</span>
</template>
</el-table-column>
<el-table-column prop="status" label="状态" align="center" >
<template slot-scope="scope">
<el-tag v-if="scope.row.status > 0" type="danger"></el-tag>
<el-tag v-else type="info">已停用</el-tag>
</template>
</el-table-column>
<el-table-column prop="setTime" label="设置时间" align="center" />
<el-table-column prop="setTime" label="设置时间" align="center" >
<template slot-scope="scope">
<span> {{ parseTime(scope.row.setTime, "{y}-{m}-{d} {h}:{i}:{s}")}}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="200">
<template slot-scope="scope">
<el-button type="danger" size="mini" @click="del(scope.row.id)"></el-button>
<el-button size="mini" type="primary" @click="start(scope.row)"></el-button>
<el-button v-if="scope.row.status <= 0" size="mini" type="primary" @click="start(scope.row)"></el-button>
<el-button size="mini" v-else type="danger" @click="start(scope.row)"></el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<pagination :total="10" />
<pagination v-show="holdTimeTotal >0" :total="holdTimeTotal"
:page.sync="holdTimeParams.index"
:limit.sync="holdTimeParams.size"
@pagination="getWarninglist"
/>
<el-row>
<el-col :span="24"><div class="record"><svg-icon icon-class="EarlyWarning" />预警记录:</div></el-col>
</el-row>
<!-- 行情预警记录 -->
<el-table :data="holdTimeRecordData" style="width: 100%">
<el-table-column prop="symbol" label="交易品种" width="100" align="center" />
<el-table-column prop="direction" label="买卖方向" width="300" align="center" />
<el-table-column prop="tradingHour" label="交易时间" align="center" />
<el-table-column prop="holdDuration" label="持仓时长" align="center" />
<el-table-column prop="wariningHoldDuration" label="预警持仓时长" align="center" />
<el-table-column prop="wariningTime" label="预警时间" align="center" />
<el-table-column prop="direction" label="买卖方向" width="300" align="center" >
<template slot-scope="scope">
<el-tag v-if="scope.row.direction == 'buy'" type="danger"></el-tag>
<el-tag v-else></el-tag>
</template>
</el-table-column>
<el-table-column prop="tradingHour" label="交易时间" align="center" >
<template slot-scope="scope">
<span> {{ parseTime(scope.row.tradingHour, "{y}-{m}-{d} {h}:{i}:{s}")}}</span>
</template>
</el-table-column>
<el-table-column prop="holdDuration" label="持仓时长" align="center" >
</el-table-column>
<el-table-column prop="wariningHoldDuration" label="预警持仓时长" align="center" >
<template slot-scope="scope">
<span> {{ scope.row.wariningHoldDuration}}</span>
</template>
</el-table-column>
<el-table-column prop="wariningTime" label="预警时间" align="center" >
<template slot-scope="scope">
<span> {{ parseTime(scope.row.wariningTime, "{y}-{m}-{d} {h}:{i}:{s}")}}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="200">
<template slot-scope="scope">
<el-button type="danger" size="mini" @click="delrecord(scope.row.id)"></el-button>
</template>
</el-table-column>
</el-table>
<pagination :total="10" />
<pagination v-show="holdTimeRecordTotal > 0" :total="holdTimeRecordTotal"
:page.sync="holdTimeParams.index"
:limit.sync="holdTimeParams.size"
@pagination="getrecord"
/>
</div>
</template>
<script>
@ -52,63 +88,7 @@ export default {
data() {
return {
tableData: [
{
ranking: 'euresd',
class: '1612167713',
name: 1,
StudentID: '2003001',
profit: '+20000',
income: '50%',
number: '8',
Simulation: '80',
experiment: '70'
},
{
ranking: 'euresd',
class: '1612167713',
name: 1,
StudentID: '2003001',
profit: '+20000',
income: '50%',
number: '8',
Simulation: '80',
experiment: '70'
},
{
ranking: 'euresd',
class: '1612167713',
name: 0,
StudentID: '2003001',
profit: '+20000',
income: '20%',
number: '-8',
Simulation: '80',
experiment: '70'
},
{
ranking: 'euresd',
class: '1612167713',
name: 0,
StudentID: '2003001',
profit: '+20000',
income: '20%',
number: '8',
Simulation: '80',
experiment: '-70'
},
{
ranking: 'euresd',
class: '1612167713',
name: 1,
StudentID: '2003001',
profit: '+20000',
income: '20%',
number: '-8',
Simulation: '80',
experiment: '70'
}
],
socket : null,
// parsma
holdTimeParams:{
@ -119,9 +99,12 @@ export default {
},
//
holdTimeData:null,
// total
holdTimeTotal:0,
//
holdTimeRecordData:null,
// total
holdTimeRecordTotal:0,
}
},
created(){
@ -134,18 +117,21 @@ export default {
forewarning.getHoldTimeWarning(this.holdTimeParams).then(res=>{
// console.log(res)
if(res.code !== 200) return
this.holdTimeData = res.data
this.holdTimeData = res.data.list
this.holdTimeTotal = res.data.total
})
},
//
getrecord(){
forewarning.getHoldTimeWarningRecord(this.holdTimeParams).then(res=>{
if(res.code !== 200) return
this.holdTimeRecordData=res.data
this.holdTimeRecordData=res.data.list
this.holdTimeRecordTotal=res.data.total
})
},
//
del(id){
alert(id)
forewarning.deleteHoldTimeWarning({id:id}).then(res=>{
// if(res.code !== 200) return
this.$message({
@ -174,10 +160,7 @@ export default {
}
forewarning.setHoldTimeWarning(params).then(res=>{
// if(res.code !== 200) return
this.$message({
message: '操作成功',
type: 'success'
})
this.$message({ message:row.status == 1 ? '关闭成功' : '启用成功' ,type: 'success'})
this.getWarninglist()
})
},

@ -32,13 +32,19 @@
<el-table-column label="操作" align="center" width="200">
<template slot-scope="scope">
<el-button type="danger" size="mini" @click="delWarning(scope.row.id)"></el-button>
<el-button size="mini" type="primary" @click="closeWarning(scope.row)"></el-button>
<el-button size="mini" v-if="scope.row.status <= 0" type="primary" @click="closeWarning(scope.row)"></el-button>
<el-button size="mini" v-else type="danger" @click="closeWarning(scope.row)"></el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<pagination :total="10" />
<pagination v-show="markettotal>0" :total="markettotal"
:page.sync="marketParams.index"
:limit.sync="marketParams.size"
@pagination="getlist"
/>
<el-row>
<el-col :span="24"><div class="record"><svg-icon icon-class="EarlyWarning" />预警记录:</div></el-col>
</el-row>
@ -56,7 +62,11 @@
</template>
</el-table-column>
</el-table>
<pagination :total="10" />
<pagination v-show="earlytotal > 0" :total="earlytotal"
:page.sync="marketParams.index"
:limit.sync="marketParams.size"
@pagination="getcaution"
/>
</div>
</template>
<script>
@ -64,72 +74,22 @@ import * as forewarning from '@/api/forewarning'
export default {
data() {
return {
tableData: [
{
ranking: 'euresd',
class: '1612167713',
name: 1,
StudentID: '2003001',
profit: '+20000',
income: '50%',
number: '8',
Simulation: '80',
experiment: '70'
},
{
ranking: 'euresd',
class: '1612167713',
name: 1,
StudentID: '2003001',
profit: '+20000',
income: '50%',
number: '8',
Simulation: '80',
experiment: '70'
},
{
ranking: 'euresd',
class: '1612167713',
name: 0,
StudentID: '2003001',
profit: '+20000',
income: '20%',
number: '-8',
Simulation: '80',
experiment: '70'
},
{
ranking: 'euresd',
class: '1612167713',
name: 0,
StudentID: '2003001',
profit: '+20000',
income: '20%',
number: '8',
Simulation: '80',
experiment: '-70'
},
{
ranking: 'euresd',
class: '1612167713',
name: 1,
StudentID: '2003001',
profit: '+20000',
income: '20%',
number: '-8',
Simulation: '80',
experiment: '70'
}
],
// params
marketParams: {
memberId: this.$store.state.user.memberId,
trainingId: this.$route.query.id,
index: 1,
size: 5
},
//
marketData: null,
// TOTAL
markettotal: null,
//
earlyData: null,
// TOTAL
earlytotal: null
}
},
created() {
@ -139,13 +99,17 @@ export default {
methods:{
getlist(){
forewarning.getTransactionNumberWarning(this.marketParams).then(res => {
this.marketData = res.data
if(res.code !== 200) return
this.marketData = res.data.list
this.markettotal = res.data.total
})
},
//
getcaution(){
forewarning.getTransactionNumberWarningRecord(this.marketParams).then(res => {
this.earlyData = res.data
if(res.code !== 200) return
this.earlyData = res.data.list
this.earlytotal = res.data.total
})
},
//
@ -157,11 +121,15 @@ export default {
},
//
closeWarning(row){
console.log(row,'row');
// forewarning.closeTransactionNumberWarning(this.marketParams).then(res => {
// this.$message({ message: '',type: 'success'})
// this.getlist()
// })
// console.log(row,'row');
const params = {
id: row.id,
status: row.status == 1 ? 0 : 1
}
forewarning.setTransactionNumberWarning(params).then(res => {
this.$message({ message:row.status == 1 ? '关闭成功' : '启用成功' ,type: 'success'})
this.getlist()
})
},
//
delWarningRecord(id){

@ -26,8 +26,10 @@
</el-table-column>
<el-table-column label="操作" align="center" width="200">
<template slot-scope="scope">
<el-button type="danger" size="mini" @click="cancel(scope.row.id)"></el-button>
<el-button size="mini" type="primary" @click="start(scope.row)"></el-button>
<el-button type="danger" size="mini" @click="cancel(scope.row.id)"></el-button>
<el-button size="mini" v-if="scope.row.status <= 0" type="primary" @click="start(scope.row)"></el-button>
<el-button size="mini" v-else type="danger" @click="start(scope.row)"></el-button>
</template>
</el-table-column>
</el-table>
@ -87,8 +89,6 @@ export default {
warningtotal:0,
warningRecordtotal:0
// total
}
},
created(){
@ -123,6 +123,7 @@ export default {
status:row.status !== 0 ? 0 : 1
}
forewarning.setMarketWarning(params).then(request=>{
this.$message({ message:row.status == 1 ? '关闭成功' : '启用成功' ,type: 'success'})
this.getmarketlist()
})
},
@ -132,7 +133,7 @@ export default {
this.$modal.msgSuccess('删除成功');
this.getcaution()
})
}
},
}
}
</script>

@ -175,15 +175,27 @@ export default {
},
created(){
this.getlist()
//
// window.addEventListener('storage', (e) => {
// if (e.key === 'Type') {
// this.tradingVolume.transactionType = e.newValue
// }
// })
},
mounted(){
if(localStorage.getItem('Type') !== 'gdkc' || localStorage.getItem('Type') == ''){
this.tradingVolume.transactionType=localStorage.getItem('Type') || 'sjkc'
this.RegistrationVisible = false
}else{
this.tradingVolume.transactionType=localStorage.getItem('Type')
this.RegistrationVisible = true
}
//datalist,使gitlist datalist
this.localStorageValue=localStorage.getItem('status')
this.timer=setInterval(()=>{
this.getlist()
},16000)
},
methods: {
getlist(){
this.loading = true
@ -237,7 +249,7 @@ export default {
return this.$modal.msgError('止损只能输入数字')
}
}
localStorage.setItem('Type',this.tradingVolume.transactionType)
Simulated.transactionMarketQuotation(this.tradingVolume).then((res)=>{
// console.log(res,'res');
if(res.code !==200 ) return this.$modal.msgError(res.msg);
@ -245,14 +257,15 @@ export default {
this.$modal.msgSuccess(res.msg);
this.$refs.child[0].getlist()
this.$refs.ruleForm.resetFields()
this.tradingVolume.transactionType= localStorage.getItem('Type')
})
})
}
},
beforeDestroy() {
//
clearInterval(this.timer)
// localStorage.removeItem('Type')
},
watch:{
//
@ -260,7 +273,8 @@ export default {
if(val == 'FINISHED'){
clearInterval(this.timer)
}
}
},
}
}
</script>

@ -151,6 +151,7 @@ import tabs2 from './components/quotation.vue'
import tabs4 from './components/numberTransactions.vue'
import * as forewarning from '@/api/forewarning.js'
import * as home from '@/api/index.js'
import {getname} from '@/utils/auth.js'
export default {
components: {
tabs1,
@ -326,6 +327,7 @@ export default {
},
//
setDeposit() {
if(!this.deposit.warningLevel) return this.$modal.msgWarning('请选择保证金预警水平');
forewarning.addMarginWarning(this.deposit).then(res => {
if(res.code !== 200) return
this.$modal.msgSuccess('保证金预警水平修改成功');
@ -390,6 +392,31 @@ export default {
})
})
},
createWebSocket() {
// // ziyuancookie
// let websocket = new WebSocket('ws://192.168.2.14:8800/webSocket/' + getname())
// //
// websocket.onopen = () => {
// websocket.send('hello')
// console.log('');
// }
// websocket.onmessage = event => {
// // event.data
// console.log(event.data)
// this.$modal.msgSuccess(event.data);
// }
// websocket.onclose = function () {
// console.log('')
// }
// // websocket
// this.$router.afterEach(function () {
// websocket.close()
// })
// // websocketserver
// window.onbeforeunload = function () {
// websocket.close()
// }
}
}
}
</script>

@ -9,11 +9,14 @@
<div class="grid-content" v-if="item.status == 'ONGOING'">
<div class="titles">
<span>{{ item.trainingName }}</span>
<el-tag type="success" >进行中</el-tag>
<el-tag >进行中</el-tag>
</div>
<div class="centern">起止时间
{{ parseTime(item.startTime, "{y}-{m}-{d} {h}:{i}:{s}")}} -
{{ parseTime(item.endTime, "{y}-{m}-{d} {h}:{i}:{s}")}}
</div>
<div class="centern">起止时间{{ parseTime(item.startTime )}}</div>
<div class="grid-footer">
<el-button type="primary" @click="progress(item)"></el-button>
<el-button type="primary" size="small" @click="progress(item)"></el-button>
</div>
</div>
<div class="grid-content1" v-else-if="item.status == 'NOT_STARTED'">
@ -21,9 +24,12 @@
<span>{{ item.trainingName }}</span>
<el-tag type="warning">未开始</el-tag>
</div>
<div class="centern">起止时间{{ parseTime(item.startTime)}}</div>
<div class="centern">起止时间 :
{{ parseTime(item.startTime, "{y}-{m}-{d} {h}:{i}:{s}")}} -
{{ parseTime(item.endTime, "{y}-{m}-{d} {h}:{i}:{s}")}}
</div>
<div class="grid-footer">
<el-button type="primary" @click="progress(item)"></el-button>
<el-button type="warning" size="small" plain @click="progress(item)"></el-button>
</div>
</div>
<div class="grid-content2" v-else>
@ -31,9 +37,12 @@
<span>{{ item.trainingName }}</span>
<el-tag type="info" >已结束</el-tag>
</div>
<div class="centern">起止时间{{ parseTime(item.startTime)}}</div>
<div class="centern">起止时间
{{ parseTime(item.startTime, "{y}-{m}-{d} {h}:{i}:{s}")}} -
{{ parseTime(item.endTime, "{y}-{m}-{d} {h}:{i}:{s}")}}
</div>
<div class="grid-footer">
<el-button type="primary" @click="progress(item)"></el-button>
<el-button type="info" size="small" @click="progress(item)"></el-button>
</div>
</div>
</el-col>

Loading…
Cancel
Save