diff --git a/ruoyi-ui/package.json b/ruoyi-ui/package.json index ecceeb0..3157d8b 100644 --- a/ruoyi-ui/package.json +++ b/ruoyi-ui/package.json @@ -71,6 +71,7 @@ "connect": "3.6.6", "eslint": "7.15.0", "eslint-plugin-vue": "7.2.0", + "image-webpack-loader": "^8.1.0", "lint-staged": "10.5.3", "runjs": "4.4.2", "sass": "1.32.13", @@ -78,7 +79,8 @@ "script-ext-html-webpack-plugin": "2.1.5", "svg-sprite-loader": "5.1.1", "uglifyjs-webpack-plugin": "^2.2.0", - "vue-template-compiler": "2.6.12" + "vue-template-compiler": "2.6.12", + "webpack-bundle-analyzer": "^4.9.0" }, "engines": { "node": ">=8.9", diff --git a/ruoyi-ui/public/index.html b/ruoyi-ui/public/index.html index 925455c..ee2e359 100644 --- a/ruoyi-ui/public/index.html +++ b/ruoyi-ui/public/index.html @@ -8,6 +8,7 @@ <link rel="icon" href="<%= BASE_URL %>favicon.ico"> <title><%= webpackConfig.name %></title> <!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]--> + <style> html, body, @@ -204,5 +205,8 @@ <div class="load_title">正在加载系统资源,请耐心等待</div> </div> </div> + <!-- <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.min.js"></script> + <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script> + <script src="https://cdn.jsdelivr.net/npm/elm/umd/elm.min.js"></script> --> </body> </html> diff --git a/ruoyi-ui/src/assets/images/2_slices.zip b/ruoyi-ui/src/assets/images/2_slices.zip deleted file mode 100644 index 3e167f8..0000000 Binary files a/ruoyi-ui/src/assets/images/2_slices.zip and /dev/null differ diff --git a/ruoyi-ui/src/utils/request.js b/ruoyi-ui/src/utils/request.js index f0d8e4e..463659e 100644 --- a/ruoyi-ui/src/utils/request.js +++ b/ruoyi-ui/src/utils/request.js @@ -54,7 +54,7 @@ service.interceptors.request.use(config => { const interval = 1000 // 间隔时间(ms),小于此时间视为重复提交 if (s_data === requestObj.data && requestObj.time - s_time < interval && s_url === requestObj.url) { const message = '数据正在处理,请勿重复提交' - console.warn(`[${s_url}]: ` + message) + Message({ message:message, type: 'error' }) return Promise.reject(new Error(message)) } else { cache.session.setJSON('sessionObj', requestObj) diff --git a/ruoyi-ui/src/views/quotation/index.vue b/ruoyi-ui/src/views/quotation/index.vue index 190380a..c67fb1d 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("https://www.mql5.com/zh"); + window.open("https://mt4-mt5.com/mt4Download"); } } } diff --git a/ruoyi-ui/src/views/task/overview.vue b/ruoyi-ui/src/views/task/overview.vue index 4f8ee41..4547cc0 100644 --- a/ruoyi-ui/src/views/task/overview.vue +++ b/ruoyi-ui/src/views/task/overview.vue @@ -35,7 +35,7 @@ </div></el-col> <el-col :span="6" ><div class="grid-content rmb"> - <span>收益率:<i>{{ datalist.yield == null ? 0 :datalist.yield * 100}}</i><em v-if="datalist.yield!==null">%</em> </span> + <span>收益率:<i>{{ datalist.yield == null ? 0 : accMul(datalist.yield) }}</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> @@ -107,6 +107,11 @@ export default { handleClick(tab) { this.nowName = tab.name == "tabs1" ? tab.name : tab.name; }, + // 解决js精度问题 + accMul(num) { + const m = (num * 100).toFixed(4) + return m + } }, beforeDestroy() { clearInterval(this.time) diff --git a/ruoyi-ui/src/views/task/report.vue b/ruoyi-ui/src/views/task/report.vue index 5b1aa4a..b71f514 100644 --- a/ruoyi-ui/src/views/task/report.vue +++ b/ruoyi-ui/src/views/task/report.vue @@ -131,10 +131,16 @@ export default { methods: { // 提交实验报告 submitReport() { - if(this.isaddvalidate === true) return this.$modal.msgError("已提交过实验报告,请勿重复提交") + // if(this.isaddvalidate === true) return this.$modal.msgError("已提交过实验报告,请勿重复提交") // 表单效验 this.$refs.reportref.validate((valid) => { if (!valid) return; + // 判断如果this.reportdata中每一个属性都有值的话就不能提交了 + for (let key in this.reportdata) { + if (this.reportdata[key] !== "") { + return this.$modal.msgError("已提交过实验报告,请勿重复提交") + } + } testreport.getExperiment(this.reportdata).then((res) => { if (res.code !== 200) return this.isaddvalidate = true @@ -162,6 +168,7 @@ export default { this.$modal.msgError("请填写评分") return } + testreport.uploadScore(this.scoringData).then((res) => { if (res.code !== 200) return this.$modal.msgSuccess("评分成功") diff --git a/ruoyi-ui/src/views/teachingpan/index.vue b/ruoyi-ui/src/views/teachingpan/index.vue index 4b524de..0754963 100644 --- a/ruoyi-ui/src/views/teachingpan/index.vue +++ b/ruoyi-ui/src/views/teachingpan/index.vue @@ -40,7 +40,7 @@ </el-form-item> <el-form-item > <el-button icon="el-icon-plus" type="warning" plain onclick="upload.click()" >资源文件</el-button> - <input type="file" ref="fileInput" @change="getFilePDF" name="upload" id="upload" style="display: none;" accept=".ppt, .pptx, .doc, .docx, .pdf" /> + <input type="file" ref="fileInput" @change="getFilePDF" name="upload" id="upload" style="display: none;" accept=".ppt, .pptx, .doc, .docx, .pdf ,.rar" /> </el-form-item> </el-form> @@ -111,7 +111,16 @@ export default { }, getFilePDF(){ const file = this.$refs.fileInput.files[0]; - console.log("file",file); + console.log("file",file.size); + // 文件大小限制超过500m提示 + if(file.size > 500*1024){ + this.$message({ + message: '文件大小超过500M', + type: 'warning' + }); + return; + } + if (!file) { alert('请选择文件!'); return; diff --git a/ruoyi-ui/src/views/trade/components/Deposit.vue b/ruoyi-ui/src/views/trade/components/Deposit.vue index bb0b812..64ecd57 100644 --- a/ruoyi-ui/src/views/trade/components/Deposit.vue +++ b/ruoyi-ui/src/views/trade/components/Deposit.vue @@ -38,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" :type=" scope.row.status <= 0 ? 'primary':'danger'" @click="start(scope.row)"> {{ scope.row.status <= 0 ? '启用':'关闭' }}</el-button> + <!-- <el-button size="mini" v-else type="danger" @click="start(scope.row)">关闭</el-button> --> </template> </el-table-column> </el-table> diff --git a/ruoyi-ui/src/views/trade/components/deals.vue b/ruoyi-ui/src/views/trade/components/deals.vue index 8743294..e0e405c 100644 --- a/ruoyi-ui/src/views/trade/components/deals.vue +++ b/ruoyi-ui/src/views/trade/components/deals.vue @@ -26,7 +26,7 @@ </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 type="danger" size="mini" @click="del(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> @@ -130,9 +130,13 @@ export default { }) }, // 删除持仓时长预警 - del(id){ - alert(id) - forewarning.deleteHoldTimeWarning({id:id}).then(res=>{ + del(val){ + // 删除传给后端的参数 + let params = { + symbol:val.symbol, + warningHoldDuration : val.wariningHoldDuration, + } + forewarning.deleteHoldTimeWarning(params).then(res=>{ // if(res.code !== 200) return this.$message({ message: '删除成功', @@ -155,8 +159,9 @@ export default { // 启用或关闭持仓时长预警 start(row){ let params = { - id:row.id, - status:row.status === 0 ? 1 : 0 + status:row.status === 0 ? 1 : 0, + symbol: row.symbol, + warningHoldDuration : row.wariningHoldDuration, } forewarning.setHoldTimeWarning(params).then(res=>{ // if(res.code !== 200) return diff --git a/ruoyi-ui/src/views/trade/components/numberTransactions.vue b/ruoyi-ui/src/views/trade/components/numberTransactions.vue index 80b1a53..8c2de91 100644 --- a/ruoyi-ui/src/views/trade/components/numberTransactions.vue +++ b/ruoyi-ui/src/views/trade/components/numberTransactions.vue @@ -40,7 +40,9 @@ </el-table-column> </el-table> <!-- 分页 --> - <pagination v-show="markettotal>0" :total="markettotal" + <pagination + v-show="markettotal >0" + :total="markettotal" :page.sync="marketParams.index" :limit.sync="marketParams.size" @pagination="getlist" @@ -52,9 +54,21 @@ <el-table :data="earlyData" style="width: 100%"> <el-table-column prop="trainingName" label="实训任务名称" width="100" align="center" /> <el-table-column prop="warningCount" label="预警交易次数" width="300" align="center" /> - <el-table-column prop="trainingStartTime" label="实训开始时间" align="center" /> - <el-table-column prop="trainingStartTime" label="实训结束时间" align="center" /> - <el-table-column prop="warningTime" label="预警时间" align="center" /> + <el-table-column prop="trainingStartTime" label="实训开始时间" align="center" > + <template slot-scope="scope"> + <span> {{ parseTime(scope.row.trainingStartTime, "{y}-{m}-{d} {h}:{i}:{s}")}}</span> + </template> + </el-table-column> + <el-table-column prop="trainingStartTime" label="实训结束时间" align="center" > + <template slot-scope="scope"> + <span> {{ parseTime(scope.row.trainingEndTime, "{y}-{m}-{d} {h}:{i}:{s}")}}</span> + </template> + </el-table-column> + <el-table-column prop="warningTime" label="预警时间" align="center" > + <template slot-scope="scope"> + <span> {{ parseTime(scope.row.warningTime, "{y}-{m}-{d} {h}:{i}:{s}")}}</span> + </template> + </el-table-column> <el-table-column prop="warningingCount" label="预警时交易次数" align="center" /> <el-table-column label="操作" align="center" width="200"> <template slot-scope="scope"> @@ -85,11 +99,11 @@ export default { // 行情预警列表 marketData: null, // 交易次数预警TOTAL - markettotal: null, + markettotal: 0, // 交易次数预警记录 earlyData: null, // 交易次数预警记录TOTAL - earlytotal: null + earlytotal: 0 } }, created() { diff --git a/ruoyi-ui/src/views/trade/holding.vue b/ruoyi-ui/src/views/trade/holding.vue index 69ebee2..a279c38 100644 --- a/ruoyi-ui/src/views/trade/holding.vue +++ b/ruoyi-ui/src/views/trade/holding.vue @@ -14,7 +14,6 @@ </template> </el-table-column> </el-table> - <pagination :total="10" /> <el-tabs v-model="activeName" class="tabs" @tab-click="handleClick"> <el-tab-pane @@ -260,7 +259,8 @@ export default { this.tradingVolume.transactionType= localStorage.getItem('Type') }) }) - } + }, + }, beforeDestroy() { // 销毁定时器 diff --git a/ruoyi-ui/src/views/trade/strike.vue b/ruoyi-ui/src/views/trade/strike.vue index f731363..2704a59 100644 --- a/ruoyi-ui/src/views/trade/strike.vue +++ b/ruoyi-ui/src/views/trade/strike.vue @@ -15,8 +15,8 @@ </el-tab-pane> </el-tabs> <div class="setchfprm" v-if="activeName == 'tabs1'"> - <el-form :inline="true" :model="deposit" class="form"> - <el-form-item label="保证金报警水平" prop="status"> + <el-form :inline="true" ref="deposit" :model="deposit" class="form" :rules="depositrules"> + <el-form-item label="保证金报警水平" prop="warningLevel"> <el-input v-model="deposit.warningLevel" placeholder="%" clearable /> </el-form-item> <el-form-item> @@ -124,18 +124,7 @@ <el-date-picker v-model="alertDeal.warningTime" value-format="timestamp" type="date" placeholder="选择日期" style="width: 100%;"> </el-date-picker> </el-form-item> - <el-row :gutter="20" type="flex" justify="space-between"> - <el-col :span="6"> - <el-form-item label="开始时间:" prop="trainingStartTime" label-width="120px"> - <el-date-picker v-model="alertDeal.trainingStartTime" value-format="timestamp" type="date" placeholder="选择日期"> - </el-date-picker> - </el-form-item></el-col> - <el-col :span="13"> - <el-form-item label="结束时间:" prop="trainingEndTime" label-width="120px"> - <el-date-picker v-model="alertDeal.trainingEndTime" value-format="timestamp" type="date" placeholder="选择日期"> - </el-date-picker> - </el-form-item></el-col> - </el-row> + </el-form> <span slot="footer" class="dialog-footer"> <el-button @click="dealVisible = false">取 消</el-button> @@ -151,7 +140,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, @@ -219,25 +208,20 @@ export default { trainingName: '', warningCount:null, warningTime:'', - trainingStartTime:'', - trainingEndTime:'', + trainingStartTime:localStorage.getItem('startTime'), + trainingEndTime:localStorage.getItem('endTime'), }, dealrules: { trainingName: [ { required: true, message: '请选择实训任务名称', trigger: 'blur' } ], warningCount: [ - { required: true, message: '请输入预警交易次数', trigger: 'blur' } + { required: true, message: '请输入预警交易次数', trigger: 'blur' }, + { pattern: /^[0-9]*$/, message: '请输入数字', trigger: 'blur' } ], warningTime: [ { required: true, message: '请选择预警时间', trigger: 'blur' } ], - trainingStartTime: [ - { required: true, message: '请选择开始时间', trigger: 'blur' } - ], - trainingEndTime: [ - { required: true, message: '请选择结束时间', trigger: 'blur' } - ], }, // 实训任务下拉框 trainingList:null, @@ -249,10 +233,12 @@ export default { { required: true, message: '请选择买卖方向', trigger: 'blur' } ], upperBreakPrice: [ - { required: true, message: '请输入上破价', trigger: 'blur' } + { required: true, message: '请输入上破价', trigger: 'blur' }, + { pattern: /^[0-9]*$/, message: '请输入数字', trigger: 'blur' } ], lowerBreakPrice: [ - { required: true, message: '请输入下破价', trigger: 'blur' } + { required: true, message: '请输入下破价', trigger: 'blur' }, + { pattern: /^[0-9]*$/, message: '请输入整数', trigger: 'blur' } ], }, wariningHoldDurationrules: { @@ -260,7 +246,15 @@ export default { { required: true, message: '请选择交易品种', trigger: 'blur' } ], wariningHoldDuration: [ - { required: true, message: '请输入持仓时长', trigger: 'blur' } + { required: true, message: '请输入持仓时长', trigger: 'blur' }, + { pattern: /^[0-9]*$/, message: '请输入数字', trigger: 'blur' } + ], + }, + // 保证金预警 + depositrules: { + warningLevel: [ + { required: true, message: '请选择预警水平', trigger: 'blur' }, + { pattern: /^[0-9]*$/, message: '请输入整数', trigger: 'blur' } ], }, // 交易品种列表 @@ -327,8 +321,11 @@ export default { }, // 新增保证金报警水平 setDeposit() { - if(!this.deposit.warningLevel) return this.$modal.msgWarning('请选择保证金预警水平'); - forewarning.addMarginWarning(this.deposit).then(res => { + // if(!this.deposit.warningLevel) return this.$modal.msgWarning('请选择保证金预警水平'); + // 表单效验 + this.$refs.deposit.validate((valid) => { + if (!valid) return this.$modal.msgWarning('请选择保证金预警水平'); + forewarning.addMarginWarning(this.deposit).then(res => { if(res.code !== 200) return this.$modal.msgSuccess('保证金预警水平修改成功'); this.$refs.child[0].getlist() @@ -337,6 +334,8 @@ export default { this.deposit.warningLevel = '' } ) + }) + }, taskname() { // 转换日期格式 @@ -376,6 +375,7 @@ export default { // if(res.code !== 200) return this.$modal.msgSuccess('持仓时长预警新增成功'); this.$refs.child[0].getWarninglist() + this.$refs.child[0].getrecord() this.wariningHoldDurationVisible=false }) }) @@ -388,6 +388,7 @@ export default { // if(res.code !== 200) return this.$modal.msgSuccess('交易次数预警新增成功'); this.$refs.child[0].getlist() + this.$refs.child[0].getcaution() this.dealVisible=false }) }) @@ -417,6 +418,11 @@ export default { // websocket.close() // } } +}, +mounted() { + if(this.$route.query.id == '999999999'){ + this.tabsArr.splice(3,1) + } } } </script> diff --git a/ruoyi-ui/src/views/training/index.vue b/ruoyi-ui/src/views/training/index.vue index 82aa5c6..5a73bb1 100644 --- a/ruoyi-ui/src/views/training/index.vue +++ b/ruoyi-ui/src/views/training/index.vue @@ -94,15 +94,17 @@ export default { training.findTrainingList(this.recordlist).then((res)=>{ if(res.code == 200){ this.characterslist = res.data.list + this.total = res.data.total this.loading = false } }) }, progress(data) { - // console.log(id,"id"); this.$tab.openPage("进行中", `/student/task/homepageage?id=${data.trainingId}`); localStorage.setItem("status",data.status) + localStorage.setItem("startTime",data.startTime) + localStorage.setItem("endTime",data.endTime) // this.$router.push({path:'/student/task/homepageage/',{id:id}}) // this.$tab.openPage("进行中", "/student/task/homepageage"); diff --git a/ruoyi-ui/vue.config.js b/ruoyi-ui/vue.config.js index aa378cc..43b8f07 100644 --- a/ruoyi-ui/vue.config.js +++ b/ruoyi-ui/vue.config.js @@ -7,6 +7,8 @@ function resolve(dir) { const CompressionPlugin = require('compression-webpack-plugin') + + const name = process.env.VUE_APP_TITLE || '外汇模拟交易' // 网页标题 const port = process.env.port || process.env.npm_config_port || 81 // 端口 @@ -61,14 +63,17 @@ module.exports = { } }, plugins: [ + // http://doc.ruoyi.vip/ruoyi-vue/other/faq.html#使用gzip解压缩静态文件 new CompressionPlugin({ - cache: false, // 不启用文件缓存 + cache: true, // 不启用文件缓存 test: /\.(js|css|html)?$/i, //压缩文件格式 filename: '[path].gz[query]', // 压缩后的文件名 algorithm: 'gzip', // 使用gzip压缩 + threshold: 10240, // 最小文件开启压缩 minRatio: 0.8 // 压缩率小于1才会压缩 - }) + }), + ], optimization: { @@ -81,8 +86,8 @@ module.exports = { } }) ] - }, - }, + } +}, chainWebpack(config) { config.plugins.delete('preload') // TODO: need test config.plugins.delete('prefetch') // TODO: need test