mirror of
https://gitee.com/dromara/electron-egg.git
synced 2026-05-23 22:38:10 +08:00
demo db
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import storage from 'store2'
|
||||
import request from '@/utils/request'
|
||||
import storage from 'store2'
|
||||
|
||||
/**
|
||||
* 路由定义(主进程与渲染进程通信频道定义)
|
||||
@@ -9,7 +9,7 @@ const ipcApiRoute = {
|
||||
test: 'controller.example.test',
|
||||
checkForUpdater: 'controller.framework.checkForUpdater',
|
||||
downloadApp: 'controller.framework.downloadApp',
|
||||
dbOperation: 'controller.framework.dbOperation',
|
||||
jsondbOperation: 'controller.framework.jsondbOperation',
|
||||
sqlitedbOperation: 'controller.framework.sqlitedbOperation',
|
||||
uploadFile: 'controller.framework.uploadFile',
|
||||
checkHttpServer: 'controller.framework.checkHttpServer',
|
||||
@@ -82,7 +82,6 @@ const requestHttp = (uri, parameter) => {
|
||||
}
|
||||
|
||||
export {
|
||||
ipcApiRoute,
|
||||
specialIpcRoute,
|
||||
requestHttp,
|
||||
ipcApiRoute, requestHttp, specialIpcRoute
|
||||
}
|
||||
|
||||
|
||||
@@ -37,9 +37,9 @@ const constantRouterMap = [
|
||||
component: () => import('@/views/framework/socket/SocketServer.vue')
|
||||
},
|
||||
{
|
||||
path: '/framework/db/index',
|
||||
name: 'FrameworkDBIndex',
|
||||
component: () => import('@/views/framework/db/Index.vue')
|
||||
path: '/framework/jsondb/index',
|
||||
name: 'FrameworkJsonDBIndex',
|
||||
component: () => import('@/views/framework/jsondb/Index.vue')
|
||||
},
|
||||
{
|
||||
path: '/framework/sqlitedb/index',
|
||||
|
||||
@@ -24,7 +24,7 @@ export default {
|
||||
'menu_103' : {
|
||||
icon: 'profile',
|
||||
title: 'json数据库',
|
||||
pageName: 'FrameworkDBIndex',
|
||||
pageName: 'FrameworkJsonDBIndex',
|
||||
params: {}
|
||||
},
|
||||
'menu_104' : {
|
||||
|
||||
@@ -156,7 +156,7 @@ export default {
|
||||
const params = {
|
||||
action: 'all',
|
||||
}
|
||||
ipc.invoke(ipcApiRoute.dbOperation, params).then(res => {
|
||||
ipc.invoke(ipcApiRoute.jsondbOperation, params).then(res => {
|
||||
console.log('res:', res);
|
||||
if (res.all_list.length == 0) {
|
||||
return false;
|
||||
@@ -179,7 +179,7 @@ export default {
|
||||
if (ac == 'add' && this.name.length == 0) {
|
||||
this.$message.error(`请填写数据`);
|
||||
}
|
||||
ipc.invoke(ipcApiRoute.dbOperation, params).then(res => {
|
||||
ipc.invoke(ipcApiRoute.jsondbOperation, params).then(res => {
|
||||
console.log('res:', res);
|
||||
if (ac == 'get') {
|
||||
if (res.result.length == 0) {
|
||||
@@ -175,7 +175,7 @@ export default {
|
||||
},
|
||||
mounted () {
|
||||
this.init();
|
||||
this.getAllTestData();
|
||||
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
@@ -183,7 +183,13 @@ export default {
|
||||
action: 'getDataDir',
|
||||
}
|
||||
ipc.invoke(ipcApiRoute.sqlitedbOperation, params).then(res => {
|
||||
if (res.code == -1) {
|
||||
this.$message.error('请检查sqlite数据库是否');
|
||||
return
|
||||
}
|
||||
|
||||
this.data_dir = res.result;
|
||||
this.getAllTestData();
|
||||
})
|
||||
},
|
||||
getAllTestData () {
|
||||
|
||||
Reference in New Issue
Block a user