Skip to content

Commit

Permalink
[U]
Browse files Browse the repository at this point in the history
  • Loading branch information
zxysilent committed Jul 18, 2021
1 parent ce30fe4 commit 1f0ea83
Show file tree
Hide file tree
Showing 13 changed files with 590 additions and 188 deletions.
2 changes: 1 addition & 1 deletion conf/conf.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ orm_open = 8
# 显示sql
orm_show = true
# 同步表结构
orm_sync = false
orm_sync = true
# 是否使用orm缓存
orm_cache_use = false
# orm缓存数量
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

// @Title Blog’s Api文档
// @Version 1.0
// @Description token传递方式包括[get/post]token、[header]Authorization=token
// @Description token传递方式包括[get/post]token、[header]Authorization
// @Description 数据传递方式包括json、formData推荐使用json
// @Description 使用json时token请使用[header]
// @Description /api/* 公共访问
Expand Down
12 changes: 5 additions & 7 deletions router/router_adm.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,11 @@ func admRouter(adm *echo.Group) {

// sysctl
{ // role
adm.GET("/role/get", sysctl.RoleGet) // 单条角色
adm.GET("/role/all", sysctl.RoleAll) // 所有角色
adm.POST("/role/drop", sysctl.RoleDrop) // 角色分页
adm.POST("/role/add", sysctl.RoleAdd) // 添加角色
adm.POST("/role/edit", sysctl.RoleEdit) // 编辑角色
adm.GET("/role/menu/all", sysctl.RoleMenuAll) // 所有角色菜单导航 // role-menu
adm.POST("/role/menu/edit", sysctl.RoleMenuEdit) // 编辑角色菜单导航
adm.GET("/role/get", sysctl.RoleGet) // 单条角色
adm.GET("/role/all", sysctl.RoleAll) // 所有角色
adm.POST("/role/drop", sysctl.RoleDrop) // 角色分页
adm.POST("/role/add", sysctl.RoleAdd) // 添加角色
adm.POST("/role/edit", sysctl.RoleEdit) // 编辑角色
}
{ // menu
adm.GET("/menu/get", sysctl.MenuGet) // 单条菜单导航
Expand Down
3 changes: 0 additions & 3 deletions vue/.browserslistrc

This file was deleted.

2 changes: 1 addition & 1 deletion vue/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
presets: ["@vue/cli-plugin-babel/preset"]
presets: ["@vue/app"]
};
29 changes: 18 additions & 11 deletions vue/package.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,34 @@
{
"name": "blog",
"version": "0.1.0",
"name": "zxysilent-blog",
"version": "0.2.0",
"description": "A template about Vue and iView By zxysilent. https://github.com/zxysilent",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build"
},
"dependencies": {
"axios": "^0.21.1",
"js-md5": "^0.7.3",
"cropperjs": "^1.5.1",
"mavon-editor": "^2.9.1",
"view-design": "^4.1.2",
"vue": "^2.6.11",
"vue-router": "^3.1.5",
"js-md5": "^0.7.3",
"tinymce": "^5.8.0",
"view-design": "^4.5.0",
"vue": "^2.6.12",
"vue-router": "3.4.1",
"vuex": "^3.6.2"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.2.0",
"@vue/cli-plugin-router": "~4.2.0",
"@vue/cli-plugin-vuex": "~4.2.0",
"@vue/cli-service": "~4.2.0",
"core-js": "^3.6.4",
"less": "^3.0.4",
"less-loader": "^5.0.0",
"vue-template-compiler": "^2.6.11"
}
"less": "^4.1.1",
"less-loader": "^7.0.0",
"vue-template-compiler": "^2.6.12"
},
"browserslist": [
"> 1%",
"last 2 versions"
]
}
Empty file added vue/src/api/home.js
Empty file.
21 changes: 5 additions & 16 deletions vue/src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const initRouter = [
path: "/home",
meta: { title: "管理主页" },
name: "home",
component: () => import("@/views/home/home.vue")
component: () => import("@/views/home/index.vue")
},
{
path: "/auth/self",
Expand All @@ -56,19 +56,8 @@ export const initRouter = [
}
]
},
{
path: "/jwt",
name: "errjwt",
meta: { title: "jwt-重新登录" },
component: () => import("@/views/errors/jwt.vue")
},
{
path: "/401",
name: "err401",
meta: { title: "401-没有权限" },
component: () => import("@/views/errors/401.vue")
},
{ path: "/50x", name: "err50x", meta: { title: "50x-服务异常" }, component: () => import("@/views/errors/50x.vue") }
{ path: "/500", name: "500", meta: { title: "500-异常" }, component: () => import("@/components/errors/500.vue") },
{ path: "/*", name: "404", meta: { title: "404-没发现" }, component: () => import("@/components/errors/404.vue") }
];

const toTitle = title => {
Expand All @@ -88,8 +77,8 @@ router.beforeEach(async (to, from, next) => {
ViewUI.LoadingBar.start();
toTitle(to.meta.title);
const token = getToken();
console.log("token",token)
console.log("to.name",to.name)
console.log("token", token);
console.log("to.name", to.name);
// 去不需要登录的地方
if (noAuth.indexOf(to.name) > -1) {
if (token) {
Expand Down
154 changes: 154 additions & 0 deletions vue/src/views/home/global.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@

<template>
<Card :bordered="false" dis-hover>
<p slot="title">
<Icon type="ios-cog-outline" /> 配置中心
</p>
<div style="max-width:520px">
<Form ref="dataForm" :model="dataForm" :label-width="120" label-colon label-position="right" :rules="dataRules">
<FormItem label="小程序图" prop="mpg_cover">
<Poptip v-if="denyEdit" trigger="hover" placement="right-start">
<div slot="content">
<img :src="dataForm.mpg_cover" style="max-height:300px" alt="加载失败">
</div>
<img :src="dataForm.mpg_cover" width="102" height="102" style="border-radius: 4px;" alt="加载失败">
</Poptip>
<uimage v-else v-model="dataForm.mpg_cover"></uimage>
</FormItem>
<FormItem label="小程序标题" prop="mpg_title">
<Input :disabled="denyEdit" v-model="dataForm.mpg_title" maxlength="20" show-word-limit placeholder="请填写小程序标题"></Input>
</FormItem>
<FormItem label="报名限制" prop="app_allow">
<InputNumber :disabled="denyEdit" v-model="dataForm.app_allow" style="width:120px" :max="1000" :min="1" :step="1" placeholder="请填写报名限制"></InputNumber>&nbsp;通过年龄限制(有效信息填写人数)
</FormItem>
<FormItem label="录取限制" prop="app_limit">
<InputNumber :disabled="denyEdit" v-model="dataForm.app_limit" style="width:120px" :max="1000" :min="1" :step="1" placeholder="请填写录取限制"></InputNumber>&nbsp;填报完后筛选(最终需要的人数)
</FormItem>
<FormItem label="一批次">
<FormItem label="开始日期" prop="one_min">
<DatePicker :disabled="denyEdit" type="date" v-model="dataForm.one_min" :editable="false" :clearable="false" placeholder="开始日期"></DatePicker>&nbsp;0点开始
</FormItem>
<FormItem label="结束日期" prop="one_max">
<DatePicker :disabled="denyEdit" type="date" v-model="dataForm.one_max" :editable="false" :clearable="false" placeholder="结束日期"></DatePicker>&nbsp;0点之前
</FormItem>
</FormItem>
<FormItem label="二批次">
<FormItem label="开始日期" prop="two_min">
<DatePicker :disabled="denyEdit" type="date" v-model="dataForm.two_min" :editable="false" :clearable="false" placeholder="开始日期"></DatePicker>&nbsp;0点开始
</FormItem>
<FormItem label="结束日期" prop="two_max">
<DatePicker :disabled="denyEdit" type="date" v-model="dataForm.two_max" :editable="false" :clearable="false" placeholder="结束日期"></DatePicker>&nbsp;0点之前
</FormItem>
</FormItem>
<FormItem label="报名通过人数" prop="app_count">
<span>{{ dataForm.app_count}}</span>
</FormItem>
<FormItem label="系统状态" prop="show">
<i-Switch :disabled="denyEdit" size="large" v-model="dataForm.state"><span slot="open">开启</span>
<span slot="close">关闭</span>
</i-Switch>
</FormItem>
<FormItem label="关闭提示信息" prop="close_msg">
<Input :disabled="denyEdit" v-model="dataForm.close_msg" maxlength="20" show-word-limit placeholder="请填写关闭提示信息"></Input>
</FormItem>
<FormItem>
<Button type="success" @click="emitReset">取消刷新</Button>
<Button v-auth="'global_edit'" type="info" @click="denyEdit=false" style="margin-left: 5px">开启编辑</Button>
<Poptip v-auth="'global_edit'" confirm title="确定要修改吗?" @on-ok="emitEdit" @on-cancel="emitReset">
<Button type="warning" :loading="loading" :disabled="denyEdit" style="margin-left: 5px" @click="">提交保存</Button>
</Poptip>
<Poptip v-auth="'global_clear'" confirm title="确定要清理数据吗?" @on-ok="emitClear">
<Button type="error" :disabled="denyEdit" style="margin-left: 5px">清理数据</Button>
</Poptip>
</FormItem>
</Form>
</div>
</Card>
</template>
<script>
import { apiGlobalGet, admGlobalEdit, admGlobalClear } from "@/api/home";
import Uimage from "@/components/upload/Uimage.vue";
export default {
components: { Uimage },
data() {
return {
loading: false,
denyEdit: true,
dataForm: {
id: 0,
mpg_cover: "",
mpg_title: "",
app_allow: 0,
app_limit: 0,
app_count: 0,
one_min: new Date(),
one_max: new Date(),
two_min: new Date(),
two_max: new Date(),
state: true,
close_msg: ""
},
dataRules: {
mpg_cover: [{ required: true, message: "请填写小程序图", trigger: "blur", max: 200 }],
mpg_title: [{ required: true, message: "请填写小程序标题", trigger: "blur", max: 200 }],
app_allow: [{ type: "number", required: true, message: "请填写报名限制", trigger: "change", min: 1 }],
app_limit: [{ type: "number", required: true, message: "请填写录取限制", trigger: "change", min: 1 }],
close_msg: [{ required: true, message: "请填写小程序提示信息", trigger: "blur", max: 200 }]
}
};
},
methods: {
init() {
apiGlobalGet().then((resp) => {
this.denyEdit = true;
if (resp.code == 200) {
this.dataForm = resp.data;
} else {
this.$Message.error({ content: resp.msg, duration: 3 });
}
});
},
emitReset() {
this.init();
},
emitClear() {
admGlobalClear().then((resp) => {
if (resp.code == 200) {
this.$Message.success({
content: "清理成功",
onClose: () => {
this.init();
}
});
} else {
this.$Message.error({ content: resp.msg, duration: 3 });
}
});
},
emitEdit() {
this.$refs.dataForm.validate((valid) => {
if (valid) {
this.loading = true;
admGlobalEdit(this.dataForm).then((resp) => {
this.loading = false;
if (resp.code == 200) {
this.$Message.success({
content: "修改成功",
onClose: () => {
this.init();
}
});
} else {
this.$Message.error({ content: resp.msg, duration: 3 });
}
});
}
});
}
},
mounted() {
this.dataForm.id = parseInt(this.$route.params.id, 10);
this.init();
}
};
</script>
11 changes: 0 additions & 11 deletions vue/src/views/home/home.less

This file was deleted.

Loading

0 comments on commit 1f0ea83

Please sign in to comment.