Browse Source

Merge branch 'master' of https://github.com/flipped-aurora/gin-vue-admin into gva_gormv2_dev

main
pixel 3 years ago
parent
commit
e71e3b00a6
  1. 2
      server/core/server.go
  2. 2
      server/model/sys_casbin.go
  3. 3
      web/src/directive/auth.js
  4. 6
      web/src/main.js
  5. 2
      web/src/utils/request.js
  6. 1
      web/src/view/superAdmin/api/api.vue

2
server/core/server.go

@ -29,7 +29,7 @@ func RunWindowsServer() {
fmt.Printf(` fmt.Printf(`
欢迎使用 Gin-Vue-Admin 欢迎使用 Gin-Vue-Admin
当前版本:V2.4.0
当前版本:V2.4.1
加群方式:微信号shouzi_1994 QQ群622360840 加群方式:微信号shouzi_1994 QQ群622360840
默认自动化文档地址:http://127.0.0.1%s/swagger/index.html 默认自动化文档地址:http://127.0.0.1%s/swagger/index.html
默认前端文件运行地址:http://127.0.0.1:8080 默认前端文件运行地址:http://127.0.0.1:8080

2
server/model/sys_casbin.go

@ -1,7 +1,7 @@
package model package model
type CasbinModel struct { type CasbinModel struct {
Ptype string `json:"ptype" gorm:"column:p_type"`
Ptype string `json:"ptype" gorm:"column:ptype"`
AuthorityId string `json:"rolename" gorm:"column:v0"` AuthorityId string `json:"rolename" gorm:"column:v0"`
Path string `json:"path" gorm:"column:v1"` Path string `json:"path" gorm:"column:v1"`
Method string `json:"method" gorm:"column:v2"` Method string `json:"method" gorm:"column:v2"`

3
web/src/directive/auth.js

@ -1,10 +1,10 @@
// 权限按钮展示指令 // 权限按钮展示指令
import { store } from '@/store/index' import { store } from '@/store/index'
const userInfo = store.getters['user/userInfo']
export const auth = (Vue) => { export const auth = (Vue) => {
Vue.directive('auth', { Vue.directive('auth', {
// 当被绑定的元素插入到 DOM 中时…… // 当被绑定的元素插入到 DOM 中时……
bind: function (el, binding) { bind: function (el, binding) {
const userInfo = store.getters['user/userInfo']
let type = "" let type = ""
switch (Object.prototype.toString.call(binding.value)) { switch (Object.prototype.toString.call(binding.value)) {
case "[object Array]": case "[object Array]":
@ -27,7 +27,6 @@ export const auth = (Vue) => {
return return
} }
const waitUse = binding.value.toString().split(",") const waitUse = binding.value.toString().split(",")
let flag = waitUse.some(item=>item==userInfo.authorityId) let flag = waitUse.some(item=>item==userInfo.authorityId)
if (binding.modifiers.not) { if (binding.modifiers.not) {
flag = !flag flag = !flag

6
web/src/main.js

@ -52,7 +52,8 @@ import {
Steps, Steps,
Upload, Upload,
Progress, Progress,
MessageBox
MessageBox,
Image
} from 'element-ui'; } from 'element-ui';
Vue.use(Button); Vue.use(Button);
@ -103,6 +104,7 @@ Vue.use(Upload);
Vue.use(Progress); Vue.use(Progress);
Vue.use(Scrollbar); Vue.use(Scrollbar);
Vue.use(Loading.directive); Vue.use(Loading.directive);
Vue.use(Image)
Vue.prototype.$loading = Loading.service; Vue.prototype.$loading = Loading.service;
Vue.prototype.$message = Message; Vue.prototype.$message = Message;
@ -147,7 +149,7 @@ export default new Vue({
console.log(` console.log(`
欢迎使用 Gin-Vue-Admin 欢迎使用 Gin-Vue-Admin
当前版本:V2.4.0
当前版本:V2.4.1
加群方式:微信shouzi_1994 QQ群622360840 加群方式:微信shouzi_1994 QQ群622360840
默认自动化文档地址:http://127.0.0.1%s/swagger/index.html 默认自动化文档地址:http://127.0.0.1%s/swagger/index.html
默认前端文件运行地址:http://127.0.0.1:8080 默认前端文件运行地址:http://127.0.0.1:8080

2
web/src/utils/request.js

@ -66,7 +66,7 @@ service.interceptors.response.use(
store.commit('user/setToken', response.headers["new-token"]) store.commit('user/setToken', response.headers["new-token"])
} }
if(response.data.code == 0){ if(response.data.code == 0){
if(response.data.data.needInit){
if(response.data.data?.needInit){
Message({ Message({
type:"info", type:"info",
message:"您是第一次使用,请初始化" message:"您是第一次使用,请初始化"

1
web/src/view/superAdmin/api/api.vue

@ -193,7 +193,6 @@ export default {
}, },
async onDelete(){ async onDelete(){
const ids = this.apis.map(item=>item.ID) const ids = this.apis.map(item=>item.ID)
debugger
const res = await deleteApisByIds({ids}) const res = await deleteApisByIds({ids})
if(res.code==0){ if(res.code==0){
this.$message({ this.$message({

Loading…
Cancel
Save