Browse Source

批量充值输入精网号的优化

Hongxilin
hongxilin 4 months ago
parent
commit
a795fd4c7e
  1. 2
      vue/gold-system/src/router/index.js
  2. 2
      vue/gold-system/src/views/login.vue
  3. 92
      vue/gold-system/src/views/recharge/addRecharge.vue
  4. 181
      vue/gold-system/src/views/z.vue

2
vue/gold-system/src/router/index.js

@ -4,7 +4,7 @@ const router=createRouter({
history:createWebHashHistory(),
routes:[
{path:'/login', name:"login", component:()=>import("../views/login.vue")},
{path:'/',redirect:"/workspace"},
{path:'/',redirect:"/login"},
{path:'/test',component:()=>import("../views/z.vue")},
{
meta:{requireAuth:true},

2
vue/gold-system/src/views/login.vue

@ -21,7 +21,7 @@ const login = async function () {
);
if (result.data.code == 200) {
localStorage.setItem("token", result.data.msg);
router.push("/");
router.push("/workspace");
ElMessage.success("登录成功");
console.log("请求成功", result);
} else {

92
vue/gold-system/src/views/recharge/addRecharge.vue

@ -373,48 +373,68 @@ const addLine = function () {
};
const loading = ref(false);
//
// const addLines = async function () {
// try {
// for (let j = 0; j < addLineObj.value; j++) {
// batchData.value.unshift({
// line: ++i.value,
// showInput: true,
// });
// }
// ElMessage.success("");
// } catch (error) {
// console.log("", error);
// ElMessage.error("");
// }
// }
//
const addLines = async function () {
try {
// loading.value = true; // loadingtrue
// console.log(loading.value, "loading.value");
loading.value = true; // loadingtrue
console.log(loading.value, "loading.value")
const newItems = Array.from({ length: addLineObj.value }, (_, index) => reactive({
line: ++i.value,
showInput: true,
isInputInvalid: false,
inputErrorMessage: '',
freeGold: "0",
rechargeGold: "0",
paidGold: "0",
}));
batchData.value = [...newItems, ...batchData.value];
await new Promise(resolve => setTimeout(resolve, 100)); //
for (let j = 0; j < addLineObj.value; j++) {
batchData.value.unshift({
line: ++i.value,
showInput: true,
isInputInvalid: false,
inputErrorMessage: '',
freeGold: "0",
rechargeGold: "0",
paidGold: "0",
});
}
ElMessage.success("添加成功");
// loading.value = false; // loadingfalse
console.log(batchData.value, "batchData.value");
} catch (error) {
console.log("添加失败", error);
ElMessage.error("添加失败");
//
// loading.value = false;
} finally {
loading.value = false;
console.log(loading.value, "loading.value")
}
};
}
//
// const addLines = async function () {
// try {
// loading.value = true; // loadingtrue
// console.log(loading.value, "loading.value")
// await new Promise(resolve => setTimeout(resolve, 100)); //
// const newItems = Array.from({ length: addLineObj.value }, (_, index) => reactive({
// line: ++i.value,
// showInput: true,
// isInputInvalid: false,
// inputErrorMessage: '',
// freeGold: "0",
// rechargeGold: "0",
// paidGold: "0",
// }));
// batchData.value = [...newItems, ...batchData.value];
// ElMessage.success("");
// console.log(batchData.value, "batchData.value");
// loading.value = false;
// console.log(loading.value, "loading.value")
// } catch (error) {
// console.log("", error);
// ElMessage.error("");
// //
// loading.value = false;
// }
// };
// 使 _.throttle trailing false
const throttledAddLines = _.throttle(addLines, 500, { trailing: false });
// excelref
const uploadRefMap = ref({});
// excel
@ -967,7 +987,7 @@ onMounted(async function () {
<span>添加</span>
<el-input-number min="1" style="width: 100px;" controls-position="right" v-model="addLineObj"></el-input-number>
<span></span>
<el-button type="primary" @click="addLines" style="margin-right: 10px">添加</el-button>
<el-button type="primary" @click="throttledAddLines" style="margin-right: 10px">添加</el-button>
</div>
<el-button type="warning" @click="batchSettingInit()" style="margin-right: 10px">批量设置</el-button>
<!-- <el-upload :ref="(el) => handleSetUploadRefMap(el)" action="" :http-request="httpExcelRequest" :limit="1" :show-file-list="false"
@ -977,8 +997,8 @@ onMounted(async function () {
<el-button type="danger" plain @click="batchDel()" style="margin-right: 10px; width: 130px">批量删除</el-button>
</el-row>
<el-row>
<el-table :data="batchData" border max-height="540px" style="height: 540px"
@selection-change="handleSelectionChangebatch">
<el-table id="batchTable" v-loading="loading" :data="batchData" border
max-height="540px" style="height: 540px" @selection-change="handleSelectionChangebatch">
<el-table-column type="selection" width="50px" />
<el-table-column property="index" label="序号" width="55px">
<template #default="scope">
@ -1200,7 +1220,7 @@ p {
<style>
.error-message {
color: red;
font-size: 12px;
font-size: 8px;
}
.is-invalid .el-input__inner {

181
vue/gold-system/src/views/z.vue

@ -1,107 +1,130 @@
<script setup>
import { all } from 'axios';
import * as echarts from 'echarts';
import { ref, onMounted, reactive, computed } from "vue";
import { VscInfo } from 'vue-icons-plus/vsc'
import { Bs1CircleFill, Bs2CircleFill, Bs3CircleFill, Bs4Circle, Bs5Circle, Bs6Circle, Bs7Circle, Bs8Circle } from 'vue-icons-plus/bs'
import axios from 'axios';
import { ref, onMounted, reactive, computed, nextTick } from "vue";
//
const option4Data = ref([]);
const a1=ref(1000);
const a2=ref(2000);
const a3=ref(3000);
const a4=ref(4000);
let allData = []
let tableData = []
let elTableHeight = 0 //el-table
let theadHeight = 0 //
let contentHeight = 0 //
let showRowCount = 0 //
let falseBox = 0 //
let scollBoxHeight = 0 //
let scrollTopRowCount = 0 //
//
onMounted(async function () {
option4Data.value = [
{ value: a1.value, name: '1000金币' },
{ value: a2.value, name: '2000金币' },
{ value: a3.value, name: '3000金币' },
{ value: a4.value, name: '4000金币' },
];
// domecharts
var rechargeBar = echarts.init(document.getElementById('main'));
const option = {
tooltip: {
trigger: 'item'
},
legend: {
bottom: '-2%',
left: 'center',
orient: 'vertical'
},
grid: {
top: '0%', // 10%使
},
series: [
{
name: '全年累计消耗金币数(个)\n10000',
type: 'pie',
radius: ['80%', '60%'],
avoidLabelOverlap: false,
label: {
show: true,
position: 'center',
formatter: '{a}',
fontSize: 15,
fontWeight: 'bold'
},
labelLine: {
show: false
},
data: option4Data.value,
color: ['#57a5ff', '#7f29ff', '#f2d113']
}
]
};
// 使
rechargeBar.setOption(option);
})
allData = [];
for (let i = 0; i < 10000; i++) {
allData.push({
name: '张三' + i,
age: 20 + i,
address: '北京市海淀区' + i,
salary: 50000 + i,
date: '2022-01-01'
})
}
scollBoxHeight = 45 * allData.length + 45; //
await new Promise(resolve => setTimeout(resolve, 100)); //
nextTick(() => {
elTableHeight = document.querySelector('.table-box .el-table').offsetHeight;
theadHeight = document.querySelector('.table-box .el-table__header-wrapper').offsetHeight;
contentHeight = elTableHeight - theadHeight;
showRowCount = Math.floor(contentHeight / 45);
// <showRowCount>
tableData = JSON.parse(JSON.stringify(allData)).splice(0, showRowCount);
})
falseBox = document.querySelector('.false-box');
falseBox.addEventListener('scroll', function (e) {
scrollTopRowCount = Math.ceil(e.target.scrollTop / 45);
// <scrollTopRowCount> <showRowCount>
tableData = JSON.parse(JSON.stringify(allData)).splice(scrollTopRowCount, showRowCount);
});
console.log(allData)
console.log(elTableHeight)
console.log(theadHeight)
console.log(contentHeight)
console.log(showRowCount)
console.log(falseBox)
console.log(scollBoxHeight)
console.log(tableData)
const imgrule = ref('..\assets\韩信.png');
})
</script>
<template>
<div>
<el-image :preview-src-list="[imgrule]" preview-teleported="true" src="..\assets\动漫美女.png" alt="美女" style="width: 50px; height: 50px" />
<div class="box" style="width: 1000px; height: 500px; overflow: hidden; position: relative;">
<!-- false-box这是一个用来显示滚动条的方法 -->
<div class="false-box" style="width: 100%; height: 100%; position: absolute; top: 0%; left: 0%; overflow: auto;">
<div class="scroll-box" :style="{ 'height': scollBoxHeight + 'px' }">
<!-- scroll-box是用来撑起盒子的方法 -->
</div>
</div>
<div class="table-box">
<el-table :data="tableData" style="width: 100%">
<el-table-column prop="name" label="姓名" width="180">
</el-table-column>
<el-table-column prop="age" label="年龄" width="180">
</el-table-column>
<el-table-column prop="address" label="地址">
</el-table-column>
<el-table-column prop="salary" label="薪资" width="180">
</el-table-column>
<el-table-column prop="date" label="日期" width="180">
</el-table-column>
</el-table>
</div>
</div>
<div id="main" style="width: 600px;height:400px;"></div>
</template>
<style scoped>
.comparedWithYesterday {
display: flex;
.box {
width: 1000px;
height: 500px;
overflow: hidden;
position: relative;
}
.ranking-item {
margin-bottom: 10px;
.box .false-box {
width: 100%;
height: 100%;
position: absolute;
top: 0%;
left: 0%;
overflow: auto;
}
.ranking-header {
margin-bottom: 10px;
display: flex;
.box .false-box .scroll-box {
width: 100%;
height: 1000px;
position: absolute;
top: 0%;
left: 0%;
}
.goldCategory {
margin-right: 20px;
display: flex;
.box .table-box {
width: calc(100% - 20px);
height: 100%;
position: absolute;
top: 0%;
left: 0%;
}
.bar {
display: flex;
}
.pie {
display: flex;
::v-deep .el-table {
width: 100%;
height: 100%;
}
.el-row {
margin-bottom: 20px;
.el-table .el-table__row {
height: 45px;
}
.el-radio-button {
border: 1px solid grey;
.el-table .el-table__row td {
padding: 0px
}
</style>
Loading…
Cancel
Save