From f5aeb5cbcd8cbcae32d9408c603c930d7e1e6a67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Mon, 8 Nov 2021 20:52:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E8=B4=AD=E4=B9=B0=E5=A5=97?= =?UTF-8?q?=E9=A4=90/=E7=BB=AD=E8=B4=B9=E5=A5=97=E9=A4=90/=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E8=B4=A6=E6=88=B7=E6=93=8D=E4=BD=9C=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/rpc/rpc_client.go | 12 +++++++ internal/web/helpers/user_must_auth.go | 34 +++++++++++++++---- .../finance/finance-user-selector.js | 33 ++++++++++++++++++ .../js/components/plans/plan-user-selector.js | 5 +++ web/public/js/components/users/user-link.js | 16 +++++++++ web/views/@default/finance/income/@menu.html | 6 ++++ 6 files changed, 99 insertions(+), 7 deletions(-) create mode 100644 web/public/js/components/finance/finance-user-selector.js create mode 100644 web/public/js/components/users/user-link.js create mode 100644 web/views/@default/finance/income/@menu.html diff --git a/internal/rpc/rpc_client.go b/internal/rpc/rpc_client.go index 5e29ff0e..920b9df5 100644 --- a/internal/rpc/rpc_client.go +++ b/internal/rpc/rpc_client.go @@ -380,6 +380,18 @@ func (this *RPCClient) UserBillRPC() pb.UserBillServiceClient { return pb.NewUserBillServiceClient(this.pickConn()) } +func (this *RPCClient) UserAccountRPC() pb.UserAccountServiceClient { + return pb.NewUserAccountServiceClient(this.pickConn()) +} + +func (this *RPCClient) UserAccountLogRPC() pb.UserAccountLogServiceClient { + return pb.NewUserAccountLogServiceClient(this.pickConn()) +} + +func (this *RPCClient) UserAccountDailyStatRPC() pb.UserAccountDailyStatServiceClient { + return pb.NewUserAccountDailyStatServiceClient(this.pickConn()) +} + func (this *RPCClient) UserAccessKeyRPC() pb.UserAccessKeyServiceClient { return pb.NewUserAccessKeyServiceClient(this.pickConn()) } diff --git a/internal/web/helpers/user_must_auth.go b/internal/web/helpers/user_must_auth.go index d3291e0b..93f50bc0 100644 --- a/internal/web/helpers/user_must_auth.go +++ b/internal/web/helpers/user_must_auth.go @@ -12,6 +12,7 @@ import ( "github.com/iwind/TeaGo/maps" "net" "net/http" + "net/url" "reflect" "strings" ) @@ -368,12 +369,31 @@ func (this *userMustAuth) modules(actionPtr actions.ActionWrapper, adminId int64 "icon": "users", }, { - "code": "finance", - "module": configloaders.AdminModuleCodeFinance, - "name": "财务管理", - "icon": "yen sign", - "isOn": teaconst.IsPlus, - "subItems": []maps.Map{}, + "code": "finance", + "module": configloaders.AdminModuleCodeFinance, + "name": "财务管理", + "icon": "yen sign", + "isOn": teaconst.IsPlus, + "subItems": []maps.Map{ + { + "name": "用户账户", + "url": "/finance/accounts", + "code": "accounts", + "isOn": teaconst.IsPlus, + }, + { + "name": "操作记录", + "url": "/finance/logs", + "code": "logs", + "isOn": teaconst.IsPlus, + }, + { + "name": "收支报表", + "url": "/finance/income", + "code": "income", + "isOn": teaconst.IsPlus, + }, + }, }, { "code": "plans", @@ -443,5 +463,5 @@ func (this *userMustAuth) modules(actionPtr actions.ActionWrapper, adminId int64 // 跳转到登录页 func (this *userMustAuth) login(action *actions.ActionObject) { - action.RedirectURL("/") + action.RedirectURL("/?from=" + url.QueryEscape(action.Request.RequestURI)) } diff --git a/web/public/js/components/finance/finance-user-selector.js b/web/public/js/components/finance/finance-user-selector.js new file mode 100644 index 00000000..50f83323 --- /dev/null +++ b/web/public/js/components/finance/finance-user-selector.js @@ -0,0 +1,33 @@ +Vue.component("finance-user-selector", { + mounted: function () { + let that = this + + Tea.action("/finance/users/options") + .post() + .success(function (resp) { + that.users = resp.data.users + }) + }, + props: ["v-user-id"], + data: function () { + let userId = this.vUserId + if (userId == null) { + userId = 0 + } + return { + users: [], + userId: userId + } + }, + watch: { + userId: function (v) { + this.$emit("change", v) + } + }, + template: `
+ +
` +}) \ No newline at end of file diff --git a/web/public/js/components/plans/plan-user-selector.js b/web/public/js/components/plans/plan-user-selector.js index 836a13eb..95811cc9 100644 --- a/web/public/js/components/plans/plan-user-selector.js +++ b/web/public/js/components/plans/plan-user-selector.js @@ -19,6 +19,11 @@ Vue.component("plan-user-selector", { userId: userId } }, + watch: { + userId: function (v) { + this.$emit("change", v) + } + }, template: `