Browse Source

管理后台-权限管理接口域名

panyong 3 years ago
parent
commit
5b79637f7a

+ 1 - 1
htmldev/manage/src/api/index.js

@@ -7,7 +7,7 @@ import { envDomain } from '@/utils/.env.domain'
 
 // axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8'
 
-axios.defaults.baseURL = (process.env.VUE_APP_ISPROXY * 1 ? '' : envDomain.API_AUTH) + '/api'
+axios.defaults.baseURL = process.env.VUE_APP_ISPROXY * 1 ? '' : envDomain.API_AUTH
 axios.defaults.timeout = 20000
 
 axios.interceptors.request.use(config => {

+ 1 - 1
htmldev/manage/src/components/_dialog/exampleDialog.vue

@@ -43,7 +43,7 @@ export default {
   },
   methods: {
     async handleSubmit () {
-      const data = await this.$fetch('/recharge_query', { ...this.form })
+      const data = await this.$fetch('/api/auth/recharge_query', { ...this.form })
       if (data.code === 200) {
         this.$message.success('提交成功')
         this.$emit('success')

+ 1 - 1
htmldev/manage/src/components/_dialog/modPassword.vue

@@ -38,7 +38,7 @@ export default {
     async handleSubmit () {
       this.$refs.form.validate(async valid => {
         if (valid) {
-          const data = await this.$fetch('/user/set_me_password', this.form)
+          const data = await this.$fetch('/api/auth/user/set_me_password', this.form)
           if (data.code == 200) {
             await this.$store.dispatch('user/logout')
             this.$router.push(`/login`)

+ 1 - 1
htmldev/manage/src/mixin/page.js

@@ -20,7 +20,7 @@ export default {
         }
       })
       this.tableLoading = true
-      const { code, data } = await this.$fetch(this.tableUrl, {
+      const { code, data } = await this.$fetch('/api/auth' + this.tableUrl, {
         page: this.page,
         page_size: this.page_size,
         ...this.searchForm

+ 3 - 3
htmldev/manage/src/store/modules/common.js

@@ -22,19 +22,19 @@ const mutations = {
 const actions = {
   async setProjectArr ({ commit }) {
     if (!getToken()) return
-    const data = await fetch('/project/get_list', {}, 'get')
+    const data = await fetch('/api/auth/project/get_list', {}, 'get')
     if (data.code == 200) {
       commit('SET_PROJECTARR', data.data)
     }
   },
   async setDepartmentArr ({ commit }) {
-    const data = await fetch('/department/get_department_list', {}, 'get')
+    const data = await fetch('/api/auth/department/get_department_list', {}, 'get')
     if (data.code == 200) {
       commit('SET_DEPARTMENTARR', data.data)
     }
   },
   async setRoleArr ({ commit }) {
-    const data = await fetch('/role/get_role_list', {}, 'get')
+    const data = await fetch('/api/auth/role/get_role_list', {}, 'get')
     if (data.code == 200) {
       commit('SET_ROLEARR', data.data)
     }

+ 1 - 1
htmldev/manage/src/store/modules/user.js

@@ -32,7 +32,7 @@ const actions = {
   // get user info
   getInfo ({ commit, state }) {
     return new Promise(async (resolve, reject) => {
-      const data = await fetch('/userGetInfo', { token: getToken() }, 'get')
+      const data = await fetch('/api/auth/userGetInfo', { token: getToken() }, 'get')
       // const data = {code: 0, data: {username: 'admin'}}
       if (data.code == 200) {
         commit('SET_NAME', data.data.user_name)

+ 1 - 1
htmldev/manage/src/views/department/details.vue

@@ -58,7 +58,7 @@ export default {
   methods: {
     async handleSubmit () {
       let url = this.exData.id ? '/department/edit' : '/department/add'
-      const data = await this.$fetch(url, { ...this.form })
+      const data = await this.$fetch('/api/auth' + url, { ...this.form })
       if (data.code === 200) {
         this.$message.success('提交成功')
         this.$emit('success')

+ 1 - 1
htmldev/manage/src/views/department/index.vue

@@ -90,7 +90,7 @@ export default {
         cancelButtonText: '取消',
         type: 'warning'
       }).then(async () => {
-        const data = await this.$fetch('/department/del', { id: row.id })
+        const data = await this.$fetch('/api/auth/department/del', { id: row.id })
         if (data.code == 200) {
           this.$message.success('删除成功')
           this.init()

+ 1 - 1
htmldev/manage/src/views/login/index.vue

@@ -84,7 +84,7 @@ export default {
         if (valid) {
           this.loading = true
 
-          const data = await this.$fetch('/user/login', this.loginForm)
+          const data = await this.$fetch('/api/auth/user/login', this.loginForm)
 
           if (data.code == 200) {
             this.$store.commit('user/SET_TOKEN', data.data.token)

+ 1 - 1
htmldev/manage/src/views/project/components/filterAdd.vue

@@ -51,7 +51,7 @@ export default {
       this.$refs.form.validate(async valid => {
         if (valid) {
           let url = this.exData.id ? '/method/edit' : '/method/add'
-          const data = await this.$fetch(url, { ...this.form })
+          const data = await this.$fetch('/api/auth' + url, { ...this.form })
           if (data.code === 200) {
             this.$message.success('提交成功')
             this.$emit('success')

+ 1 - 1
htmldev/manage/src/views/project/details.vue

@@ -57,7 +57,7 @@ export default {
   methods: {
     async handleSubmit () {
       let url = this.exData.id ? '/project/edit' : '/project/add'
-      const data = await this.$fetch(url, { ...this.form })
+      const data = await this.$fetch('/api/auth' + url, { ...this.form })
       if (data.code === 200) {
         this.$message.success('提交成功')
         this.$emit('success')

+ 1 - 1
htmldev/manage/src/views/project/filterPath.vue

@@ -88,7 +88,7 @@ export default {
         cancelButtonText: '取消',
         type: 'warning'
       }).then(async () => {
-        const data = await this.$fetch('/method/del', { id: row.id })
+        const data = await this.$fetch('/api/auth/method/del', { id: row.id })
         if (data.code == 200) {
           this.$message.success('删除成功')
           this.init()

+ 3 - 3
htmldev/manage/src/views/project/index.vue

@@ -96,7 +96,7 @@ export default {
         cancelButtonText: '取消',
         type: 'warning'
       }).then(async () => {
-        const data = await this.$fetch('/project/set_status', { id: row.id })
+        const data = await this.$fetch('/api/auth/project/set_status', { id: row.id })
         if (data.code == 200) {
           this.getList()
         }
@@ -109,7 +109,7 @@ export default {
         cancelButtonText: '取消',
         type: 'warning'
       }).then(async () => {
-        const data = await this.$fetch('/project/del', { id: row.id })
+        const data = await this.$fetch('/api/auth/project/del', { id: row.id })
         if (data.code == 200) {
           this.$message.success('删除成功')
           this.init()
@@ -118,7 +118,7 @@ export default {
       }).catch(() => {})
     },
     async getList () {
-      const data = await this.$fetch('/project/list', {}, 'get')
+      const data = await this.$fetch('/api/auth/project/list', {}, 'get')
       if (data.code == 200) {
         this.projectList = data.data
       }

+ 2 - 2
htmldev/manage/src/views/project/permissions.vue

@@ -129,14 +129,14 @@ export default {
       this.dialog = false
     },
     async delNode (id) {
-      const data = await this.$fetch('/rule/del', { id })
+      const data = await this.$fetch('/api/auth/rule/del', { id })
       if (data.code == 200) {
         this.getPermissionsTree()
       }
     },
     async getPermissionsTree () {
       this.loading = true
-      const data = await this.$fetch('/rule/list', { project_id: this.exData.id }, 'get')
+      const data = await this.$fetch('/api/auth/rule/list', { project_id: this.exData.id }, 'get')
       if (data.code == 200) {
         this.treeData = [...data.data, { append: 'new' }]
       }

+ 1 - 1
htmldev/manage/src/views/project/ruleDialog.vue

@@ -67,7 +67,7 @@ export default {
       this.$refs.form.validate(async valid => {
         if (valid) {
           let url = this.exData.id ? '/rule/edit' : '/rule/add'
-          const data = await this.$fetch(url, { ...this.form })
+          const data = await this.$fetch('/api/auth' + url, { ...this.form })
           if (data.code === 200) {
             this.$message.success('提交成功')
             this.$emit('success')

+ 2 - 2
htmldev/manage/src/views/roles/details.vue

@@ -66,7 +66,7 @@ export default {
   methods: {
     async handleSubmit () {
       let url = this.exData.id ? '/role/set_role_info' : '/role/add'
-      const data = await this.$fetch(url, { ...this.form })
+      const data = await this.$fetch('/api/auth' + url, { ...this.form })
       if (data.code === 200) {
         this.$message.success('提交成功')
         this.$emit('success')
@@ -74,7 +74,7 @@ export default {
       }
     },
     async getDepartmentArr (project_id) {
-      const data = await this.$fetch('/department/get_department_list', { project_id }, 'get')
+      const data = await this.$fetch('/api/auth/department/get_department_list', { project_id }, 'get')
       if (data.code == 200) {
         this.departmentArr = data.data
       }

+ 1 - 1
htmldev/manage/src/views/roles/index.vue

@@ -100,7 +100,7 @@ export default {
         cancelButtonText: '取消',
         type: 'warning'
       }).then(async () => {
-        const data = await this.$fetch('/role/del', { id: row.id })
+        const data = await this.$fetch('/api/auth/role/del', { id: row.id })
         if (data.code == 200) {
           this.$message.success('删除成功')
           this.init()

+ 2 - 2
htmldev/manage/src/views/roles/permissions.vue

@@ -104,7 +104,7 @@ export default {
     },
     async handleSubmit () {
       let rule_id = this.$refs.tree.getCheckedKeys()
-      const data = await this.$fetch('/role/set_role_rule', { id: this.exData.id, rule_id })
+      const data = await this.$fetch('/api/auth/role/set_role_rule', { id: this.exData.id, rule_id })
       if (data.code == 200) {
         this.$message.success('修改成功')
         this.$emit('success')
@@ -112,7 +112,7 @@ export default {
       }
     },
     async getPermissionsTree () {
-      const data = await this.$fetch('/role/get_role_rule', { id: this.exData.id }, 'get')
+      const data = await this.$fetch('/api/auth/role/get_role_rule', { id: this.exData.id }, 'get')
       if (data.code == 200) {
         this.treeData = data.data.setting_rule
         // this.treeData.flatMap( x => [x, ...x.son]).forEach(item => {

+ 3 - 3
htmldev/manage/src/views/user/details.vue

@@ -94,7 +94,7 @@ export default {
     async handleSubmit () {
       let url = this.exData.id ? '/user/edit' : '/user/add'
       this.form.user_phone = this.form.user_phone.replace(/ /g, '')
-      const data = await this.$fetch(url, { ...this.form })
+      const data = await this.$fetch('/api/auth' + url, { ...this.form })
       if (data.code === 200) {
         this.$message.success('提交成功')
         this.$emit('success')
@@ -102,13 +102,13 @@ export default {
       }
     },
     async getDepartmentArr (project_id) {
-      const data = await this.$fetch('/department/get_department_list', { project_id }, 'get')
+      const data = await this.$fetch('/api/auth/department/get_department_list', { project_id }, 'get')
       if (data.code == 200) {
         this.departmentArr = data.data
       }
     },
     async getRoleArr (department_id) {
-      const data = await this.$fetch('/role/get_role_list', { department_id }, 'get')
+      const data = await this.$fetch('/api/auth/role/get_role_list', { department_id }, 'get')
       if (data.code == 200) {
         this.roleArr = data.data
       }

+ 2 - 2
htmldev/manage/src/views/user/index.vue

@@ -103,7 +103,7 @@ export default {
         },
         inputErrorMessage: '至少输入6位'
       }).then(async ({ value }) => {
-        const data = await this.$fetch('/user/set_user_password', { user_password: value, id: row.id })
+        const data = await this.$fetch('/api/auth/user/set_user_password', { user_password: value, id: row.id })
         if (data.code == 200) {
           this.$message.success('修改成功')
         }
@@ -115,7 +115,7 @@ export default {
         cancelButtonText: '取消',
         type: 'warning'
       }).then(async () => {
-        const data = await this.$fetch('/user/del', { id: row.id })
+        const data = await this.$fetch('/api/auth/user/del', { id: row.id })
         if (data.code == 200) {
           this.$message.success('删除成功')
           this.init()

+ 3 - 3
htmldev/manage/vue.config.js

@@ -32,11 +32,11 @@ module.exports = {
     },
     // before: require('./mock/mock-server.js')
     proxy: {
-      '/api': {
-        target: 'http://auth-api.codedreamit.com',
+      '/api/auth': {
+        target: 'http://tingbang-auth.codedreamit.com',
         changeOrigin: true,
         pathRewrite: {
-          '^/api': 'api'
+          '^/api/auth': '/api/auth'
         }
       }
     }