未验证 提交 fde318d3 编写于 作者: Mr.奇淼('s avatar Mr.奇淼( 提交者: GitHub

优化配置 提升新手友好度

优化配置 提升新手友好度
整理代码结构
``` lua
web
├── api/v1 -- 主要API
| ├── sys_initdb.go -- ico
| └── sys_user.go --
├── config -- 配置文件 设定操作的结构体
| ├── auto_code.go -- ico captcha.go
| ├── ... -- ico captcha.go
| └── zap.go -- core
├── core -- 主要结构代码
| ├── server_other.go -- ico captcha.go
| ├── ... -- ico captcha.go
| └── zap.go --
├── docs -- 文档系统
| ├── docs.go -- ico captcha.go
| ├── swagger.json -- json
| └── swagger.yaml -- yaml
├── global -- global
├── initialize -- initialize
├── middleware -- 中间键
├── model -- global
├── request -- 所有请求model结构体
| | ├── common.go
| | ├── ...
| | └── sys_user.go -- yaml
| ├── response -- 返回数据
| | ├── common.go
| | ├── ...
| | └── sys_user.go -- yaml
├── packfile -- 文件写入
├── resource -- 资源文件
├── router -- 路由
├── service -- service层
├── source -- 文件目录操作
├── utils
├── config.yaml --
├── Dockerfile -- docker配置
├── go.mod -- mod 配置
├── go.sum -- sum
├── latest_log -- vue-cli 配置
└── main.go -- package.json
```
\ No newline at end of file
......@@ -7,6 +7,7 @@ import (
"gin-vue-admin/model/response"
"gin-vue-admin/service"
"gin-vue-admin/utils"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
......@@ -100,7 +101,7 @@ func GetApiById(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
err, api := service.GetApiById(idInfo.Id)
err, api := service.GetApiById(idInfo.ID)
if err != nil {
global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
response.FailWithMessage("获取失败", c)
......
......@@ -7,6 +7,7 @@ import (
"gin-vue-admin/model/response"
"gin-vue-admin/service"
"gin-vue-admin/utils"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
......@@ -132,7 +133,7 @@ func DeleteBaseMenu(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
if err := service.DeleteBaseMenu(menu.Id); err != nil {
if err := service.DeleteBaseMenu(menu.ID); err != nil {
global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
response.FailWithMessage("删除失败", c)
} else {
......@@ -182,7 +183,7 @@ func GetBaseMenuById(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
if err, menu := service.GetBaseMenuById(idInfo.Id); err != nil {
if err, menu := service.GetBaseMenuById(idInfo.ID); err != nil {
global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
response.FailWithMessage("获取失败", c)
} else {
......
......@@ -8,11 +8,12 @@ import (
"gin-vue-admin/model/response"
"gin-vue-admin/service"
"gin-vue-admin/utils"
"time"
"github.com/dgrijalva/jwt-go"
"github.com/gin-gonic/gin"
"github.com/go-redis/redis"
"go.uber.org/zap"
"time"
)
// @Tags Base
......@@ -217,11 +218,11 @@ func DeleteUser(c *gin.Context) {
return
}
jwtId := getUserID(c)
if jwtId == uint(reqId.Id) {
if jwtId == uint(reqId.ID) {
response.FailWithMessage("删除失败, 自杀失败", c)
return
}
if err := service.DeleteUser(reqId.Id); err != nil {
if err := service.DeleteUser(reqId.ID); err != nil {
global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
response.FailWithMessage("删除失败", c)
} else {
......
......@@ -8,7 +8,7 @@ type PageInfo struct {
// Find by id structure
type GetById struct {
Id float64 `json:"id" form:"id"` // 主键ID
ID float64 `json:"id" form:"id"`
}
type IdsReq struct {
......
ENV = 'development'
VUE_APP_BASE_API = '/api'
\ No newline at end of file
VUE_APP_CLI_PORT = '8080'
VUE_APP_SERVER_PORT = '8888'
VUE_APP_BASE_API = '/api'
VUE_APP_BASE_PATH = 'http://127.0.0.1'
ENV = 'production'
VUE_APP_BASE_API = '/api'
\ No newline at end of file
VUE_APP_CLI_PORT = '8080'
VUE_APP_SERVER_PORT = '8888'
VUE_APP_BASE_API = '/api'
#下方修改为你的线上ip
VUE_APP_BASE_PATH = 'http://8.141.61.63'
\ No newline at end of file
......@@ -27,3 +27,52 @@ npm run lint
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
整理代码结构
``` lua
web
├── public -- public
| ├── favicon.ico -- ico
| └── index.html -- index
├── src -- 源代码
├── api -- 所有请求
├── assets -- 主题 字体等静态资源
| ├── components -- components组件
| ├── directive -- 公用方法
| ├── mixins -- 公用方法
| ├── router -- 路由权限
| ├── store -- store
| | ├── modules -- modules
| | | ├── dictionary.js -- 动态路由
| | | ├── router.js -- 路由
| | | └── user.js -- 用户权限菜单过滤
| | ├── getters.js -- getters
| | └── index.js -- index
| ├── styles -- css
| ├── utils -- utils 组件
| ├── view -- 主要view代码
| | ├── about -- 关于我们
| | ├── dashboard -- 面板
| | ├── error -- 错误
| | ├── example --上传案例
| | ├── iconList -- icon列表
| | ├── init -- 初始化数据
| | ├── layout -- layout约束页面
| | | ├── aside --
| | | ├── bottomInfo -- bottomInfo
| | | ├── screenfull -- 全屏设置
| | | └── index.vue -- base 约束
| | ├── login --结算单管理
| | ├── person --结算单管理
| | ├── superAdmin -- 超级管理员操作
| | └── home.vue -- page 入口页面
├── App.vue -- 入口页面
├── main.js -- 入口文件 加载组件 初始化等
└── permission.js -- 跳转
├── build.config.js -- 环境变量build配置
├── openDocument.js -- 商用代码公司自用产品无需授权
├── .babelrc -- babel-loader 配置
├── .travis.yml -- 自动化CI配置
├── vue.config.js -- vue-cli 配置
└── package.json -- package.json
```
\ No newline at end of file
......@@ -2,6 +2,8 @@
module.exports = {
title: 'GIN-VUE-ADMIN1',
vueClientPort: 8080,
goServerPort: 8888,
baseCdnUrl: '//cdn.staticfile.org',
cdns: [
/**
......
......@@ -151,7 +151,7 @@ console.log(`
欢迎使用 Gin-Vue-Admin
当前版本:V2.4.1
加群方式:微信:shouzi_1994 QQ群:622360840
默认自动化文档地址:http://127.0.0.1%s/swagger/index.html
默认前端文件运行地址:http://127.0.0.1:8080
默认自动化文档地址:http://127.0.0.1:` + process.env.VUE_APP_SERVER_PORT + `/swagger/index.html
默认前端文件运行地址:http://127.0.0.1:`+ process.env.VUE_APP_CLI_PORT`
如果项目让您获得了收益,希望您能请团队喝杯可乐:https://www.gin-vue-admin.com/docs/coffee
`)
\ No newline at end of file
......@@ -236,10 +236,10 @@ export default {
openDialog(type) {
switch (type) {
case "addApi":
this.dialogTitlethis = "新增Api";
this.dialogTitle = "新增Api";
break;
case "edit":
this.dialogTitlethis = "编辑Api";
this.dialogTitle = "编辑Api";
break;
default:
break;
......
<template>
<div style="height:80vh">
<iframe width="100%" height="100%" :src="'http://127.0.0.1:8888/form-generator/#/'" frameborder="0"></iframe>
<iframe width="100%" height="100%" :src="basePath+':8888/form-generator/#/'" frameborder="0"></iframe>
</div>
</template>
<script>
var path = process.env.VUE_APP_BASE_API
var path = process.env.VUE_APP_BASE_PATH
export default {
name:"FormGenerator",
data(){
......
......@@ -15,7 +15,7 @@ module.exports = {
lintOnSave: process.env.NODE_ENV === 'development',
productionSourceMap: false,
devServer: {
port: 8080,
port: process.env.VUE_APP_CLI_PORT,
open: true,
overlay: {
warnings: false,
......@@ -25,7 +25,7 @@ module.exports = {
// 把key的路径代理到target位置
// detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: { //需要代理的路径 例如 '/api'
target: `http://127.0.0.1:8888/`, //代理到 目标路径
target: `${process.env.VUE_APP_BASE_PATH}:${process.env.VUE_APP_SERVER_PORT}/`, //代理到 目标路径
changeOrigin: true,
pathRewrite: { // 修改路径数据
['^' + process.env.VUE_APP_BASE_API]: '' // 举例 '^/api:""' 把路径中的/api字符串删除
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册