refactor(xumu): 统一接口添加 /api 前缀
- 在多个组件中,将请求路径从 "/user/config/page" 修改为 "/api/user/config/page"- 将请求路径从 "/siteUser/querySiteByUserId" 修改为 "/api/siteUser/querySiteByUserId" - 将请求路径从 "/siteUser/del" 修改为 "/api/siteUser/del" -将请求路径从 "/siteUser/add" 修改为 "/api/siteUser/add" - 将请求路径从 "/user/auth/page" 修改为 "/api/user/auth/page" - 将请求路径从 "/user/auth/update" 修改为 "/api/user/auth/update" - 将请求路径从 "/user/update-status" 修改为 "/api/user/update-status" 通过添加 /api前缀,统一了接口请求路径的格式,提高了代码的一致性和可维护性。
This commit is contained in:
		| @@ -32,7 +32,7 @@ export default { | |||||||
|   }, |   }, | ||||||
|   methods: { |   methods: { | ||||||
|     getTableData() { |     getTableData() { | ||||||
|       this.instance.post("/user/config/page", null, { |       this.instance.post("/api/user/config/page", null, { | ||||||
|         params: {...this.page, ...this.search} |         params: {...this.page, ...this.search} | ||||||
|       }).then(res => { |       }).then(res => { | ||||||
|         if (res?.data) { |         if (res?.data) { | ||||||
| @@ -43,7 +43,7 @@ export default { | |||||||
|     }, |     }, | ||||||
|     getTreeData() { |     getTreeData() { | ||||||
|       const {userId} = this |       const {userId} = this | ||||||
|       this.instance.post("/siteUser/querySiteByUserId", null, {params: {userId}}).then(res => { |       this.instance.post("/api/siteUser/querySiteByUserId", null, {params: {userId}}).then(res => { | ||||||
|         if (res?.data) { |         if (res?.data) { | ||||||
|           this.treeData = res.data |           this.treeData = res.data | ||||||
|         } |         } | ||||||
| @@ -51,7 +51,7 @@ export default { | |||||||
|     }, |     }, | ||||||
|     handleDelete(node) { |     handleDelete(node) { | ||||||
|       this.$confirm("是否要删除该节点?").then(() => { |       this.$confirm("是否要删除该节点?").then(() => { | ||||||
|         this.instance.post("/siteUser/del", null, {params: {ids: node.id}}).then(res => { |         this.instance.post("/api/siteUser/del", null, {params: {ids: node.id}}).then(res => { | ||||||
|           if (res?.code == '0' && res?.data != 1) { |           if (res?.code == '0' && res?.data != 1) { | ||||||
|             this.$message.success("删除成功!") |             this.$message.success("删除成功!") | ||||||
|             this.getTreeData() |             this.getTreeData() | ||||||
| @@ -64,7 +64,7 @@ export default { | |||||||
|     createNode(data) { |     createNode(data) { | ||||||
|       this.$prompt("请输入名称").then(({value}) => { |       this.$prompt("请输入名称").then(({value}) => { | ||||||
|         const {userId} = this |         const {userId} = this | ||||||
|         this.instance.post("/siteUser/add", null, {params: {name: value, parentId: data.id, userId}}).then(res => { |         this.instance.post("/api/siteUser/add", null, {params: {name: value, parentId: data.id, userId}}).then(res => { | ||||||
|           if (res?.code == '0' && res?.data != 1) { |           if (res?.code == '0' && res?.data != 1) { | ||||||
|             this.$message.success("新增成功!") |             this.$message.success("新增成功!") | ||||||
|             this.getTreeData() |             this.getTreeData() | ||||||
|   | |||||||
| @@ -25,7 +25,7 @@ export default { | |||||||
|   methods: { |   methods: { | ||||||
|     getDetail() { |     getDetail() { | ||||||
|       const {id} = this.$route.query |       const {id} = this.$route.query | ||||||
|       this.instance.post("/user/auth/page", null, {params: {id}}).then(res => { |       this.instance.post("/api/user/auth/page", null, {params: {id}}).then(res => { | ||||||
|         if (res?.data) { |         if (res?.data) { | ||||||
|           this.detail = res.data|| {} |           this.detail = res.data|| {} | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -36,7 +36,7 @@ export default { | |||||||
|   }, |   }, | ||||||
|   methods: { |   methods: { | ||||||
|     getTableData() { |     getTableData() { | ||||||
|       this.instance.post("/user/auth/page", null, { |       this.instance.post("/api/user/auth/page", null, { | ||||||
|         params: {...this.page, ...this.search} |         params: {...this.page, ...this.search} | ||||||
|       }).then(res => { |       }).then(res => { | ||||||
|         if (res?.data) { |         if (res?.data) { | ||||||
| @@ -50,7 +50,7 @@ export default { | |||||||
|     }, |     }, | ||||||
|     handleConfirm() { |     handleConfirm() { | ||||||
|       this.$refs.form.validate().then(() => { |       this.$refs.form.validate().then(() => { | ||||||
|         this.instance.post("/user/auth/update", this.form).then(res => { |         this.instance.post("/api/user/auth/update", this.form).then(res => { | ||||||
|           if (res?.code == '0' && res?.data != 1) { |           if (res?.code == '0' && res?.data != 1) { | ||||||
|             this.dialog = false |             this.dialog = false | ||||||
|             this.$message.success("提交成功!") |             this.$message.success("提交成功!") | ||||||
|   | |||||||
| @@ -208,7 +208,7 @@ export default { | |||||||
|     changeEnable(row) { |     changeEnable(row) { | ||||||
|       const {status, id} = row |       const {status, id} = row | ||||||
|       this.$confirm(`是否要${status == 1 ? '禁用' : '启用'}该账号?`).then(() => { |       this.$confirm(`是否要${status == 1 ? '禁用' : '启用'}该账号?`).then(() => { | ||||||
|         this.instance.post("/user/update-status", null, {params: {id}}).then(res => { |         this.instance.post("/api/user/update-status", null, {params: {id}}).then(res => { | ||||||
|           if (res?.code == 0) { |           if (res?.code == 0) { | ||||||
|             this.$message.success(`${status == 1 ? '禁用' : '启用'}成功!`) |             this.$message.success(`${status == 1 ? '禁用' : '启用'}成功!`) | ||||||
|             this.getTableData() |             this.getTableData() | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user