web

package
v0.0.0-...-a3600d7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CreateApiHandler handler.HandlerTablesFunc = func(table []*common.Table) {
	beego.Debug("CreateApiHandler")
	info := ApiInfo{}
	info.SetUp()
	info.Package = "api"
	info.Tables = table
	createWebSrcFile("api/api.js", "api.y", info)
}
View Source
var CreateDirHandler handler.HandlerTablesFunc = func(table []*common.Table) {

	beego.Debug("CreateDirHandler")

	filemode := os.ModePerm

	os.MkdirAll(cfg.Cfg.GetWebTempPath(), filemode)

}
View Source
var CreateEnvHandler handler.HandlerTablesFunc = func(table []*common.Table) {
	beego.Debug("CreateEnvHandler")
	info := EnvInfo{}
	info.SetUp()
	info.Tables = table
	createWebSrcFile("config/env.js", "env.y", info)
}
View Source
var CreateHomeHandler handler.HandlerTablesFunc = func(table []*common.Table) {
	beego.Debug("CreateHomeHandler")
	info := HomeInfo{}
	info.SetUp()
	info.Tables = table
	createWebSrcFile("pages/home.vue", "home.y", info)
}
View Source
var CreateMainHandler handler.HandlerTablesFunc = func(table []*common.Table) {
	beego.Debug("CreateMainHandler")
	info := MainInfo{}
	info.SetUp()
	info.Tables = table
	createWebSrcFile("pages/main.vue", "main.y", info)
}
View Source
var CreatePageHandler handler.HandlerOneTableFunc = func(table *common.Table, columns []*common.Column) {
	beego.Debug("CreatePageHandler")
	info := PageInfo{}
	info.SetUp()

	info.TableNameLow = strings.ToLower(table.Name)
	info.TableNameUpper = strings.ToUpper(table.Name)
	info.FirstColumnName = columns[0].Name
	if len(columns) > 1 {
		info.SecondColumnName = columns[1].Name
	} else {
		info.SecondColumnName = "y" + columns[0].Name
	}

	info.Columns = columns
	info.Table = table

	createWebSrcFile("pages/"+strings.ToLower(table.Name)+".vue", "page.y", info)
}
View Source
var CreateRouterHandler handler.HandlerTablesFunc = func(table []*common.Table) {
	beego.Debug("CreateRouterHandler")
	info := RouterInfo{}
	info.SetUp()
	info.Tables = table

	createWebSrcFile("router/index.js", "router.y", info)
}
View Source
var DownloadBaseProjectHandler handler.HandlerTablesFunc = func(table []*common.Table) {

	beego.Debug("DownloadHandler")

	filemode := os.ModePerm
	now := common.GetNowTimeYYYYMMDDhhmmss()
	tempdir := cfg.Cfg.GetWebTempPath() + now + "/"
	e := os.MkdirAll(tempdir, filemode)
	if e != nil {
		panic(e)
	}
	savefilepath := tempdir + "daminghu-web.zip"
	if common.CmdParam.Jsondata == "" {
		handler.DownloadFile(common.WebBasProZipUrl, savefilepath)
	} else {
		handler.DownloadFile(common.WebBasProNoChromeZipUrl, savefilepath)
	}

	handler.Unzip(savefilepath, tempdir)

	if _, err := os.Stat(cfg.Cfg.GetWebProjcetPath()); os.IsExist(err) {

		os.Rename(cfg.Cfg.GetWebProjcetPath(), cfg.Cfg.GetWebProjcetPath()+"bak")
	}
	os.Rename(tempdir+"daminghu-web", cfg.Cfg.GetWebProjcetPath())
}
View Source
var DownloadTemplateHandler handler.HandlerTablesFunc = func(table []*common.Table) {

	beego.Debug("DownloadTemplateHandler")

	filemode := os.ModePerm
	now := common.GetNowTimeYYYYMMDDhhmmss()
	tempdir := cfg.Cfg.GetWebTempPath() + now + "/"
	e := os.MkdirAll(tempdir, filemode)
	if e != nil {
		panic(e)
	}
	savefilepath := tempdir + "web.zip"
	handler.DownloadFile(common.WebTemplateZipUrl, savefilepath)

	handler.Unzip(savefilepath, tempdir)

	cfg.Cfg.WebTemplatePath = tempdir + "web/"
}

Functions

This section is empty.

Types

type ApiInfo

type ApiInfo struct {
	handler.BaseInfo
}

type EnvInfo

type EnvInfo struct {
	handler.BaseInfo
}

type HomeInfo

type HomeInfo struct {
	handler.BaseInfo
}

type MainInfo

type MainInfo struct {
	handler.BaseInfo
}

type PageInfo

type PageInfo struct {
	handler.BaseInfo
}

type RouterInfo

type RouterInfo struct {
	handler.BaseInfo
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL