| src/views/account/components/Position.vue | ●●●●● patch | view | raw | blame | history | |
| src/views/home/components/HomeLb.vue | ●●●●● patch | view | raw | blame | history | |
| src/views/home/components/HomeLtr.vue | ●●●●● patch | view | raw | blame | history |
src/views/account/components/Position.vue
@@ -1,35 +1,17 @@ <template> <el-drawer :title="$t('hj2')" :visible.sync="dialogVisible" direction="rtl" :before-close="onClose" size="980px" > <el-drawer :title="$t('hj2')" :visible.sync="dialogVisible" direction="rtl" :before-close="onClose" size="980px"> <div class="drawer-content"> <el-table height="100%" :data="tableData" style="width: 100%; flex: 1" empty-text="No Data" > <el-table height="100%" :data="tableData" style="width: 100%; flex: 1" empty-text="No Data"> <el-table-column prop="stockSpell" :label="$t('hj313')"> <template slot-scope="scope"> <el-tag :type="scope.row.stockGid != $mc ? 'success' : ''" size="small" style="margin-right: 8px" > <el-tag :type="scope.row.stockGid != $mc ? 'success' : ''" size="small" style="margin-right: 8px"> {{ scope.row.stockGid }} </el-tag> <span>{{ scope.row.stockName }}</span> </template> </el-table-column> <el-table-column prop="positionType" :label="`${$t('hj313')} ${$t('類型')}`" > <el-table-column prop="positionType" :label="`${$t('hj313')} ${$t('類型')}`"> <template slot-scope="scope"> <el-tag type="warning"> {{ dictionary.gplx[scope.row.positionType] }} @@ -49,15 +31,12 @@ <el-table-column prop="profitAndLoseParent" :label="$t('Profit')"> <template slot-scope="scope"> <span :class="`${ scope.row.profitAndLose < 0 ? 'r_c' : scope.row.profitAndLose > 0 <span :class="`${scope.row.profitAndLose < 0 ? 'r_c' : scope.row.profitAndLose > 0 ? 'lc_c' : '' }`" > }`"> {{ scope.row.profitAndLose }} ({{ scope.row.profitAndLoseParent }}) @@ -95,14 +74,8 @@ </el-table> <div class="pagination flex-end"> <el-pagination background layout="prev, pager, next" :total="total" :current-page="pageNum" :page-size="pageSize" @current-change="handleCurrentChange" > <el-pagination background layout="prev, pager, next" :total="total" :current-page="pageNum" :page-size="pageSize" @current-change="handleCurrentChange"> </el-pagination> </div> </div> @@ -110,6 +83,7 @@ </template> <script> let times = null; // 计时器 import mixins from "@/mixins/myMixins"; // 混入 import * as api from "@/axios/api"; export default { @@ -135,6 +109,11 @@ this.opt.stockType = this.type; this.apiInterface = api.getchicang; // 赋值接口 this.init(); // 获取记录列表 this.stopTimer() times = setInterval(() => { this.getList() }, 3000) }, methods: { // 关闭弹窗 @@ -142,6 +121,12 @@ this.$emit("update:dialogVisible", false); this.$emit("onClose"); // 关闭弹窗时,通知父组件 }, stopTimer() { if (times) { clearInterval(times); times = null; } }, }, }; </script> src/views/home/components/HomeLb.vue
@@ -8,31 +8,18 @@ </div> <div class="order_list" v-if="activeName == '0'"> <el-table height="100%" :data="tableData" style="width: 100%" size="small" empty-text="No Data" @row-click="Choice" > <el-table height="100%" :data="tableData" style="width: 100%" size="small" empty-text="No Data" @row-click="Choice"> <el-table-column prop="stockSpell" :label="$t('hj313')"> <template slot-scope="scope"> <el-tag :type="scope.row.stockGid != $mc ? 'success' : ''" size="small" style="margin-right: 8px" > <el-tag :type="scope.row.stockGid != $mc ? 'success' : ''" size="small" style="margin-right: 8px"> {{ scope.row.stockGid }} </el-tag> <span>{{ scope.row.stockName }}</span> </template> </el-table-column> <el-table-column prop="positionType" :label="`${$t('hj313')} ${$t('類型')}`" > <el-table-column prop="positionType" :label="`${$t('hj313')} ${$t('類型')}`"> <template slot-scope="scope"> <el-tag type="warning"> {{ dictionary.gplx[scope.row.positionType] }} @@ -52,15 +39,12 @@ <el-table-column prop="profitAndLoseParent" :label="$t('Profit')"> <template slot-scope="scope"> <span :class="`${ scope.row.profitAndLose < 0 ? 'r_c' : scope.row.profitAndLose > 0 ? 'lc_c' : '' }`" > <span :class="`${scope.row.profitAndLose < 0 ? 'r_c' : scope.row.profitAndLose > 0 ? 'lc_c' : '' }`"> {{ scope.row.profitAndLose }} ({{ scope.row.profitAndLoseParent }}) @@ -99,14 +83,8 @@ </div> <div class="order_list" v-else-if="activeName == '1'"> <el-table :data="tableData" style="width: 100%" height="100%" size="small" empty-text="No Data" @row-click="Choice" > <el-table :data="tableData" style="width: 100%" height="100%" size="small" empty-text="No Data" @row-click="Choice"> <el-table-column prop="stockCode" :label="$t('sc')" width="130"> </el-table-column> @@ -115,22 +93,14 @@ <el-table-column prop="stockSpell" :label="$t('hj313')" min-width="150"> <template slot-scope="scope"> <el-tag :type="scope.row.stockGid != $mc ? 'success' : ''" size="small" style="margin-right: 8px" > <el-tag :type="scope.row.stockGid != $mc ? 'success' : ''" size="small" style="margin-right: 8px"> {{ scope.row.stockGid }} </el-tag> <span>{{ scope.row.stockName }}</span> </template> </el-table-column> <el-table-column prop="positionType" :label="`${$t('hj313')} ${$t('類型')}`" width="150" > <el-table-column prop="positionType" :label="`${$t('hj313')} ${$t('類型')}`" width="150"> <template slot-scope="scope"> <el-tag type="warning"> {{ dictionary.gplx[scope.row.positionType] }} @@ -139,27 +109,16 @@ 1 </el-table-column> <el-table-column prop="orderNum" :label="$t('sl')" width="100" ></el-table-column> <el-table-column prop="orderNum" :label="$t('sl')" width="100"></el-table-column> <el-table-column prop="profitAndLoseParent" :label="$t('Profit')" width="130" > <el-table-column prop="profitAndLoseParent" :label="$t('Profit')" width="130"> <template slot-scope="scope"> <span :class="`${ scope.row.profitAndLose < 0 ? 'r_c' : scope.row.profitAndLose > 0 ? 'lc_c' : '' }`" > <span :class="`${scope.row.profitAndLose < 0 ? 'r_c' : scope.row.profitAndLose > 0 ? 'lc_c' : '' }`"> {{ scope.row.profitAndLose }} ({{ scope.row.profitAndLoseParent }}) @@ -214,20 +173,15 @@ </div> <div class="pagination_box"> <el-pagination background layout="prev, pager, next" :total="total" :current-page="pageNum" :page-size="pageSize" @current-change="handleCurrentChange" > <el-pagination background layout="prev, pager, next" :total="total" :current-page="pageNum" :page-size="pageSize" @current-change="handleCurrentChange"> </el-pagination> </div> </div> </template> <script> let times = null; // 计时器 import mixins from "@/mixins/myMixins"; // 混入 import * as api from "@/axios/api"; export default { @@ -243,17 +197,37 @@ this.opt.state = this.activeName; this.apiInterface = api.getchicang; this.init(); this.stopTimer() times = setInterval(() => { this.getList() }, 3000) }, beforeDestroy() { this.stopTimer() }, methods: { handleClick() { this.opt.state = this.activeName; this.tableData = []; this.init(); this.stopTimer() if (this.activeName == 1) return // 如果是平仓则不轮询 times = setInterval(() => { this.getList() }, 3000) }, // 股票选择 Choice(val) { this.$emit("choice", val.stockCode, val.positionSn); console.log("1"); }, stopTimer() { if (times) { clearInterval(times); times = null; } }, }, }; @@ -266,6 +240,7 @@ justify-content: flex-end; padding: 10px; } .order_list { height: 0; flex: 1; src/views/home/components/HomeLtr.vue
@@ -2,10 +2,7 @@ <div class="home_ltr"> <div class="meta_box"> <div> <div class="code" :class="{ lc_c: obj.hcrate > 0, r_c: obj.hcrate < 0 }" > <div class="code" :class="{ lc_c: obj.hcrate > 0, r_c: obj.hcrate < 0 }"> {{ obj.spell }} </div> <div class="name">{{ obj.name }}</div> @@ -42,33 +39,20 @@ <div class="tabs_box"> <el-tabs @tab-click="handleClick"> <el-tab-pane :label="item.Name" :Id="item.ID" v-for="item in KLinePeriodMenu" :key="item.ID" ></el-tab-pane> <el-tab-pane :label="item.Name" :Id="item.ID" v-for="item in KLinePeriodMenu" :key="item.ID"></el-tab-pane> </el-tabs> </div> <div ref="rightContent" class="map_box"> <div class="hqchart" id="hqchart_minute" ref="kline" v-show="chartType == 'minute'" ></div> <div class="hqchart" id="hqchart_kline" ref="kline2" v-show="chartType == 'kline'" ></div> <div class="hqchart" id="hqchart_minute" ref="kline" v-show="chartType == 'minute'"></div> <div class="hqchart" id="hqchart_kline" ref="kline2" v-show="chartType == 'kline'"></div> </div> </div> </template> <script> let timerss1 = [] let timerss2 = [] import HQChart from "hqchart"; import "hqchart/src/jscommon/umychart.resource/css/tools.css"; import "hqchart/src/jscommon/umychart.resource/font/iconfont.css"; @@ -79,7 +63,7 @@ HQChart.Chart.MARKET_SUFFIX_NAME.GetMarketStatus = function (symbol) { return 2; }; // 一直交易 function DefaultData() {} function DefaultData() { } DefaultData.GetMinuteOption = function () { var option = { @@ -1112,7 +1096,7 @@ props: { obj: { type: Object, default: () => {}, default: () => { }, }, }, data() { @@ -1126,8 +1110,6 @@ chartType: "kline", KLineChart: null, // 图形控件 K线图 Chart: null, // 图形控件 分时图 timerss1: null, timerss2: null, isShow: false, MinuteDayMenu: DefaultData.GetMinuteDayMenu(), KLineRightMenu: DefaultData.GetKLineRightMenu(), @@ -1154,14 +1136,6 @@ this.init(); }, beforeDestroy() { this.KLineChart.ChartDestory(); this.Chart.ChartDestory(); if (this.timerss1) { clearInterval(this.timerss1); } if (this.timerss2) { clearInterval(this.timerss2); } this.clearTime(); }, methods: { @@ -1172,13 +1146,10 @@ }, // 清除所有定时器 clearTime() { // 创建一个额外的定时器以获取当前最大定时器 ID let lastIntervalId = setInterval(() => {}, 1000); // 遍历并清除所有定时器 for (let i = 1; i <= lastIntervalId; i++) { clearInterval(i); clearTimeout(i); } timerss1.forEach(id => clearInterval(id)); timerss1 = []; timerss2.forEach(id => clearInterval(id)); timerss2 = []; }, init() { this.OnSize(); @@ -1274,9 +1245,11 @@ EastMoney.HQData.Log("[HQChartDemo::NetworkFilter] data", data); EastMoney.HQData.NetworkFilter(data, callback); this.timerss1 = setInterval(() => { let timeId = setInterval(() => { EastMoney.HQData.NetworkFilter(data, callback); }, 2000); timerss1.push(timeId); }, NetworkFilter2( @@ -1285,14 +1258,10 @@ ) { EastMoney.HQData.Log("[HQChartDemo::NetworkFilter] data", data); if (this.timerss2) { clearInterval(this.timerss2); this.timerss2 = null; } this.timerss2 = setInterval(() => { let timeId = setInterval(() => { EastMoney.HQData.NetworkFilter(data, callback); console.log("另一个的数据", data); }, 2000); timerss2.push(timeId); }, }, }; @@ -1337,19 +1306,23 @@ gap: 16px; align-items: center; padding: 10px 16px 6px; .attr_item { font-size: 14px; display: flex; flex-direction: column; text-align: right; margin-left: 10px; .label { color: #999; } .value { color: #333; } } .price { display: flex; align-items: center; @@ -1364,10 +1337,12 @@ margin-left: 10px; } } .name { font-size: 12px; color: #999; } .code { font-size: 20px; }