frontend demo

This commit is contained in:
gaoshuaixing
2023-05-15 15:29:23 +08:00
parent 1e7e5e4ed9
commit a914951cb8
6 changed files with 24 additions and 31 deletions

View File

@@ -2,7 +2,7 @@
<div id="app-base-db">
<div class="one-block-1">
<span>
1. LowDB本地数据库
1. jsondb本地数据库
</span>
</div>
<div class="one-block-2">
@@ -152,7 +152,6 @@ export default {
},
methods: {
getAllTestData () {
const self = this;
const params = {
action: 'all',
}
@@ -161,11 +160,10 @@ export default {
if (res.all_list.length == 0) {
return false;
}
self.all_list = res.all_list;
this.all_list = res.all_list;
})
},
dbOperation (ac) {
const self = this;
const params = {
action: ac,
info: {
@@ -178,23 +176,23 @@ export default {
delete_name: this.delete_name,
}
if (ac == 'add' && this.name.length == 0) {
self.$message.error(`请填写数据`);
this.$message.error(`请填写数据`);
}
this.$ipc.invoke(ipcApiRoute.dbOperation, params).then(res => {
console.log('res:', res);
if (ac == 'get') {
if (res.result.length == 0) {
self.$message.error(`没有数据`);
this.$message.error(`没有数据`);
return;
}
self.userList = res.result;
this.userList = res.result;
}
if (res.all_list.length == 0) {
self.all_list = ['空'];
this.all_list = ['空'];
return;
}
self.all_list = res.all_list;
self.$message.success(`success`);
this.all_list = res.all_list;
this.$message.success(`success`);
})
},
}

View File

@@ -39,11 +39,10 @@ export default {
},
methods: {
init () {
const self = this;
this.$ipc.invoke(ipcApiRoute.checkHttpServer, {}).then(r => {
if (r.enable) {
self.currentStatus = '开启';
self.servicAddress = r.server;
this.currentStatus = '开启';
this.servicAddress = r.server;
storage.set('httpServiceConfig', r);
}
})

View File

@@ -25,7 +25,7 @@
</template>
<script>
import { io } from 'socket.io-client'
import { ipcApiRoute, requestHttp } from '@/api/main'
import { ipcApiRoute } from '@/api/main'
export default {
data() {
@@ -39,11 +39,10 @@ export default {
},
methods: {
init () {
const self = this;
this.socket = io(this.servicAddress);
this.socket.on('connect', () => {
console.log('connect!!!!!!!!');
self.currentStatus = '开启';
this.currentStatus = '开启';
});
},
sendRequest (id) {

View File

@@ -39,10 +39,9 @@ export default {
},
methods: {
openSoft (id) {
const self = this;
this.$ipc.invoke(ipcApiRoute.openSoftware, id).then(result => {
if (!result) {
self.$message.error('程序不存在');
this.$message.error('程序不存在');
}
})
},

View File

@@ -220,7 +220,6 @@ export default {
})
},
sqlitedbOperation (ac) {
const self = this;
const params = {
action: ac,
info: {
@@ -233,23 +232,23 @@ export default {
delete_name: this.delete_name,
}
if (ac == 'add' && this.name.length == 0) {
self.$message.error(`请填写数据`);
this.$message.error(`请填写数据`);
}
this.$ipc.invoke(ipcApiRoute.sqlitedbOperation, params).then(res => {
console.log('res:', res);
if (ac == 'get') {
if (res.result.length == 0) {
self.$message.error(`没有数据`);
this.$message.error(`没有数据`);
return;
}
self.userList = res.result;
this.userList = res.result;
}
if (res.all_list.length == 0) {
self.all_list = ['空'];
this.all_list = ['空'];
return;
}
self.all_list = res.all_list;
self.$message.success(`success`);
this.all_list = res.all_list;
this.$message.success(`success`);
})
},
}

View File

@@ -40,16 +40,15 @@ export default {
},
methods: {
init () {
const self = this;
this.$ipc.removeAllListeners(specialIpcRoute.appUpdater);
this.$ipc.on(specialIpcRoute.appUpdater, (event, result) => {
result = JSON.parse(result);
self.status = result.status;
this.status = result.status;
if (result.status == 3) {
self.progress = result.desc;
self.percentNumber = result.percentNumber;
this.progress = result.desc;
this.percentNumber = result.percentNumber;
} else {
self.$message.info(result.desc);
this.$message.info(result.desc);
}
})
},