Browse Source

10.30

master
lichong 5 months ago
parent
commit
c4b8f4ce1e
  1. 2
      package.json
  2. 2
      src/renderer/src/App.vue
  3. 4
      src/renderer/src/assets/js/db.js
  4. 78
      src/renderer/src/views/shujucal.vue
  5. 1
      src/renderer/src/views/shujudui.vue

2
package.json

@ -1,6 +1,6 @@
{
"name": "electron",
"version": "1.0.1",
"version": "1.0.3",
"description": "An Electron application with Vue",
"main": "./out/main/index.js",
"author": "lichong",

2
src/renderer/src/App.vue

@ -40,7 +40,7 @@ export default {
methods: {
},
async mounted() {
let fiveDay = dayjs('2024-11-7T00:00:00').valueOf()
let fiveDay = dayjs('2024-11-15T00:00:00').valueOf()
if (!this.isVip) {
if (dayjs().valueOf() > fiveDay) {
this.isVip = false

4
src/renderer/src/assets/js/db.js

@ -3,6 +3,6 @@ import Dexie from 'dexie';
export const myDatabase = new Dexie('myDatabase');
// 定义数据库版本
myDatabase.version(1).stores({
shujudui: '++id, name, data, note, create_at, update_at',
myDatabase.version(2).stores({
shujudui: '++id, name, &data, note, create_at, update_at',
});

78
src/renderer/src/views/shujucal.vue

@ -8,6 +8,23 @@
<el-button type="primary" @click="calNumber">计算</el-button>
<el-button type="primary" @click="clearNumber">清空</el-button>
</el-col>
<!-- <el-col :span="24" style="margin-top: 8px;">
<el-row>
<el-col :span="4">输入随机数: </el-col>
<el-col :span="20">
<el-input v-model="genDataStr" disabled />
</el-col>
</el-row>
</el-col>
<el-col :span="24" style="margin-top: 8px;">
<el-row>
<el-col :span="4">输入随机数记录</el-col>
<el-col :span="20">
<el-input v-model="genDataHistoryStr" disabled :autosize="{ minRows: 2, maxRows: 8 }" type="textarea"
id="textareaInput" />
</el-col>
</el-row>
</el-col> -->
</el-row>
<el-row style="height: calc(100vh - 50px);overflow-y: auto;display: block;">
<el-col v-for="(item, index) in calList" :key="index" style="margin: 8px 0;">
@ -35,6 +52,8 @@ export default {
dataInputLIst: [],
allList: [],
calList: [],
genDataStr: "",
genDataHistoryStr: "",
}
},
methods: {
@ -88,14 +107,17 @@ export default {
}
}
}
let newListTemp = _.cloneDeep(newList)
let newListTemp = JSON.parse(JSON.stringify(newList))
let newListTempLocal = []
for (let i = 0; i < newListTemp.length; i++) {
let element = newListTemp[i];
for (let j = 0; j < this.allList.length; j++) {
let item = this.allList[j];
// let element = newListTemp[i];
let element = {}
for (let s = this.allList.length - 1; s >= 0; s--) {
let item = JSON.parse(JSON.stringify(this.allList[s]))
element["numlable"] = newListTemp[i].numlable
element["id"] = item.id
element["name"] = item.name
element["data"] = item.data
element["data"] = [...item.data]
element["dataStr"] = item.data.join("_")
element["note"] = item.note
element["create_at"] = item.create_at
@ -105,9 +127,10 @@ export default {
} else {
element["has"] = false
}
newListTempLocal.push({ ...element })
}
}
let allGroup = _.groupBy(_.filter(newListTemp, { has: false }), "dataStr")
let allGroup = _.groupBy(_.filter(newListTempLocal, { has: false }), "dataStr")
let allListTemp = []
for (let key in allGroup) {
let value = allGroup[key]
@ -127,7 +150,6 @@ export default {
allListTemp.push(textObj)
}
let allListGroup = _.groupBy(allListTemp, "str")
console.log(111, allListGroup);
this.calList = []
for (let key in allListGroup) {
let value = allListGroup[key];
@ -144,17 +166,59 @@ export default {
}
}
}
mergedData = _.filter(mergedData, o => o.num > 5)
if (mergedData.length) {
this.calList.push({
data: mergedData,
str: key
})
}
}
for (let i = 0; i < this.calList.length; i++) {
let element = this.calList[i];
let eleItem = _.find(this.allList, { str: element.data })
if (eleItem) {
element["id"] = eleItem.id
}
}
this.calList = _.sortBy(this.calList, "id").reverse()
this.genData()
this.genDataHistory()
},
clearNumber() {
this.dataInput = ""
this.dataInputLIst = []
this.calList = []
this.genData()
this.genDataHistory()
},
genData() {
let newList = ""
for (let i = 0; i < this.dataInput.length; i++) {
for (let j = i + 1; j < this.dataInput.length; j++) {
newList += `${this.dataInput[i]}${this.dataInput[j]} `
}
}
this.genDataStr = newList
},
genDataHistory() {
let that = this
let item = ""
for (let s = 0; s < this.dataInputLIst.length; s++) {
let dataInputItem = this.dataInputLIst[s];
let currentList = dataInputItem.split("")
item += `${s + 1}: `
for (let i = 0; i < currentList.length; i++) {
for (let j = i + 1; j < currentList.length; j++) {
item += `${currentList[i]}${currentList[j]} `
}
}
item += `\n`
}
this.genDataHistoryStr = item
let textareaItem = document.getElementById("textareaInput");
textareaItem.scrollTop = textareaItem.scrollHeight
}
},
async mounted() {

1
src/renderer/src/views/shujudui.vue

@ -161,6 +161,7 @@ export default {
formData[element.prop] = dayjs().valueOf()
}
}
formData["create_at"] = dayjs().valueOf()
this.dialogFrom = {
visible: true,
title: "新增",

Loading…
Cancel
Save