diff --git a/api/go/handler/admin/admin_handler.go b/api/go/handler/admin/admin_handler.go
index a59cad56..c69727ea 100644
--- a/api/go/handler/admin/admin_handler.go
+++ b/api/go/handler/admin/admin_handler.go
@@ -5,6 +5,7 @@ import (
"chatplus/core/types"
"chatplus/handler"
logger2 "chatplus/logger"
+ "chatplus/store/model"
"chatplus/utils"
"chatplus/utils/resp"
@@ -70,3 +71,37 @@ func (h *ManagerHandler) Session(c *gin.Context) {
resp.SUCCESS(c)
}
}
+
+// TestUser 修正用户配置数据接口
+// 将用户订阅角色的数据结构从 map 改成数组
+func (h *ManagerHandler) TestUser(c *gin.Context) {
+ var users []model.User
+ h.db.Find(&users)
+ for _, u := range users {
+ var m map[string]int
+ var roleKeys = make([]string, 0)
+ err := utils.JsonDecode(u.ChatRoles, &m)
+ if err != nil {
+ continue
+ }
+
+ for k, _ := range m {
+ roleKeys = append(roleKeys, k)
+ }
+ u.ChatRoles = utils.JsonEncode(roleKeys)
+ h.db.Updates(&u)
+
+ }
+ resp.SUCCESS(c, "SUCCESS")
+}
+
+// TestRole 修改角色图片,改成绝对路径
+func (h *ManagerHandler) TestRole(c *gin.Context) {
+ var roles []model.ChatRole
+ h.db.Find(&roles)
+ for _, r := range roles {
+ r.Icon = "/" + r.Icon
+ h.db.Updates(&r)
+ }
+ resp.SUCCESS(c, "SUCCESS")
+}
diff --git a/api/go/handler/admin/user_handler.go b/api/go/handler/admin/user_handler.go
index bbb8b90e..96a4b4ed 100644
--- a/api/go/handler/admin/user_handler.go
+++ b/api/go/handler/admin/user_handler.go
@@ -143,20 +143,3 @@ func (h *UserHandler) LoginLog(c *gin.Context) {
resp.SUCCESS(c, vo.NewPage(total, page, pageSize, logs))
}
-
-func (h *UserHandler) InitUser(c *gin.Context) {
- var users []model.User
- h.db.Find(&users)
- for _, u := range users {
- var m map[string]int
- var roleKeys = make([]string, 0)
- utils.JsonDecode(u.ChatRoles, &m)
- for k, _ := range m {
- roleKeys = append(roleKeys, k)
- }
- u.ChatRoles = utils.JsonEncode(roleKeys)
- h.db.Updates(&u)
-
- }
- resp.SUCCESS(c, "SUCCESS")
-}
diff --git a/api/go/handler/chat_handler.go b/api/go/handler/chat_handler.go
index 4e9f1898..b24dca29 100644
--- a/api/go/handler/chat_handler.go
+++ b/api/go/handler/chat_handler.go
@@ -125,19 +125,19 @@ func (h *ChatHandler) sendMessage(ctx context.Context, session types.ChatSession
if userVo.Status == false {
replyMessage(ws, "您的账号已经被禁用,如果疑问,请联系管理员!")
- replyMessage(ws, "")
+ replyMessage(ws, "")
return nil
}
if userVo.Calls <= 0 {
replyMessage(ws, "您的对话次数已经用尽,请联系管理员充值!")
- replyMessage(ws, "")
+ replyMessage(ws, "")
return nil
}
if userVo.ExpiredTime > 0 && userVo.ExpiredTime <= time.Now().Unix() {
replyMessage(ws, "您的账号已经过期,请联系管理员!")
- replyMessage(ws, "")
+ replyMessage(ws, "")
return nil
}
var req = types.ApiRequest{
@@ -189,7 +189,7 @@ func (h *ChatHandler) sendMessage(ctx context.Context, session types.ChatSession
}
replyMessage(ws, ErrorMsg)
- replyMessage(ws, "")
+ replyMessage(ws, "")
return err
} else {
defer response.Body.Close()
@@ -221,7 +221,7 @@ func (h *ChatHandler) sendMessage(ctx context.Context, session types.ChatSession
if err != nil { // 数据解析出错
logger.Error(err, line)
replyMessage(ws, ErrorMsg)
- replyMessage(ws, "")
+ replyMessage(ws, "")
break
}
diff --git a/api/go/main.go b/api/go/main.go
index 9d43fc3f..7b8cf8f7 100644
--- a/api/go/main.go
+++ b/api/go/main.go
@@ -125,6 +125,8 @@ func main() {
group.POST("login", h.Login)
group.GET("logout", h.Logout)
group.GET("session", h.Session)
+ group.GET("test/user", h.TestUser)
+ group.GET("test/role", h.TestRole)
}),
fx.Invoke(func(s *core.AppServer, h *admin.ApiKeyHandler) {
group := s.Engine.Group("/api/admin/apikey/")
@@ -138,7 +140,6 @@ func main() {
group.POST("update", h.Update)
group.GET("remove", h.Remove)
group.GET("loginLog", h.LoginLog)
- group.GET("test", h.InitUser)
}),
fx.Invoke(func(s *core.AppServer, h *admin.ChatRoleHandler) {
group := s.Engine.Group("/api/admin/role/")
diff --git a/web/src/assets/css/color-dark.css b/web/src/assets/css/color-dark.css
index 7f322765..e02e7a62 100644
--- a/web/src/assets/css/color-dark.css
+++ b/web/src/assets/css/color-dark.css
@@ -1,23 +1,22 @@
-.header{
- background-color: #242f42;
-}
-.login-wrap{
- background: #324157;
-}
-.plugins-tips{
- background: #eef1f6;
-}
-.plugins-tips a{
- color: #20a0ff;
-}
-
-.tags-li.active {
- border: 1px solid #409EFF;
- background-color: #409EFF;
-}
-.message-title{
- color: #20a0ff;
-}
-.collapse-btn:hover{
- background: rgb(40,52,70);
-}
\ No newline at end of file
+.admin-home .header {
+ background-color: #242f42;
+}
+.admin-home .login-wrap {
+ background: #324157;
+}
+.admin-home .plugins-tips {
+ background: #eef1f6;
+}
+.admin-home .plugins-tips a {
+ color: #20a0ff;
+}
+.admin-home .tags-li.active {
+ border: 1px solid #409eff;
+ background-color: #409eff;
+}
+.admin-home .message-title {
+ color: #20a0ff;
+}
+.admin-home .collapse-btn:hover {
+ background: #283446;
+}
diff --git a/web/src/assets/css/color-dark.styl b/web/src/assets/css/color-dark.styl
new file mode 100644
index 00000000..a6677788
--- /dev/null
+++ b/web/src/assets/css/color-dark.styl
@@ -0,0 +1,30 @@
+.admin-home {
+ .header {
+ background-color: #242f42;
+ }
+
+ .login-wrap {
+ background: #324157;
+ }
+
+ .plugins-tips {
+ background: #eef1f6;
+ }
+
+ .plugins-tips a {
+ color: #20a0ff;
+ }
+
+ .tags-li.active {
+ border: 1px solid #409EFF;
+ background-color: #409EFF;
+ }
+
+ .message-title {
+ color: #20a0ff;
+ }
+
+ .collapse-btn:hover {
+ background: rgb(40, 52, 70);
+ }
+}
\ No newline at end of file
diff --git a/web/src/assets/css/main.css b/web/src/assets/css/main.css
index 6b2241c9..46646e31 100644
--- a/web/src/assets/css/main.css
+++ b/web/src/assets/css/main.css
@@ -1,138 +1,118 @@
* {
- margin: 0;
- padding: 0;
+ margin: 0;
+ padding: 0;
}
-
html,
body,
#app,
.wrapper {
- width: 100%;
- height: 100%;
- overflow: hidden;
+ width: 100%;
+ height: 100%;
+ overflow: hidden;
}
-
body {
- font-family: 'PingFang SC', "Helvetica Neue", Helvetica, "microsoft yahei", arial, STHeiTi, sans-serif;
+ font-family: 'PingFang SC', "Helvetica Neue", Helvetica, "microsoft yahei", arial, STHeiTi, sans-serif;
}
-
-a {
- text-decoration: none
+.admin-home a {
+ text-decoration: none;
}
-
-
-.content-box {
- position: absolute;
- left: 250px;
- right: 0;
- top: 70px;
- bottom: 0;
- padding-bottom: 30px;
- -webkit-transition: left .3s ease-in-out;
- transition: left .3s ease-in-out;
- background: #f0f0f0;
+.admin-home .content-box {
+ position: absolute;
+ left: 250px;
+ right: 0;
+ top: 70px;
+ bottom: 0;
+ padding-bottom: 30px;
+ -webkit-transition: left 0.3s ease-in-out;
+ transition: left 0.3s ease-in-out;
+ background: #f0f0f0;
}
-
-.content {
- width: auto;
- height: 100%;
- padding: 10px;
- overflow-y: scroll;
- box-sizing: border-box;
-}
-
-.content-collapse {
- left: 65px;
-}
-
-.container {
- padding: 30px;
- background: #fff;
- border: 1px solid #ddd;
- border-radius: 5px;
-}
-
-.crumbs {
- margin: 10px 0;
-}
-
-.el-table th {
- background-color: #f5f7fa !important;
-}
-
-.pagination {
- margin: 20px 0;
- text-align: right;
-}
-
-.plugins-tips {
- padding: 20px 10px;
- margin-bottom: 20px;
-}
-
-.el-button + .el-tooltip {
- margin-left: 10px;
-}
-
-.el-table tr:hover {
- background: #f6faff;
-}
-
-.mgb20 {
- margin-bottom: 20px;
-}
-
-.move-enter-active,
-.move-leave-active {
- transition: opacity .1s ease;
-}
-
-.move-enter-from,
-.move-leave-to {
- opacity: 0;
-}
-
+.admin-home .content-box .content {
+ width: auto;
+ height: 100%;
+ padding: 10px;
+ overflow-y: scroll;
+ box-sizing: border-box;
/*BaseForm*/
-
-.form-box {
- width: 600px;
}
-
-.form-box .line {
- text-align: center;
+.admin-home .content-box .content .container {
+ padding: 30px;
+ background: #fff;
+ border: 1px solid #ddd;
+ border-radius: 5px;
}
-
-.el-time-panel__content::after,
-.el-time-panel__content::before {
- margin-top: -7px;
+.admin-home .content-box .content .container .handle-box {
+ margin-bottom: 20px;
}
-
-.el-time-spinner__wrapper .el-scrollbar__wrap:not(.el-scrollbar__wrap--hidden-default) {
- padding-bottom: 0;
+.admin-home .content-box .content .crumbs {
+ margin: 10px 0;
}
-
-
-[class*=" el-icon-"], [class^=el-icon-] {
- speak: none;
- font-style: normal;
- font-weight: 400;
- font-variant: normal;
- text-transform: none;
- line-height: 1;
- vertical-align: baseline;
- display: inline-block;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
+.admin-home .content-box .content .el-table th {
+ background-color: #f5f7fa !important;
}
-
-.el-sub-menu [class^=el-icon-] {
- vertical-align: middle;
- margin-right: 5px;
- width: 24px;
- text-align: center;
- font-size: 18px;
+.admin-home .content-box .content .pagination {
+ margin: 20px 0;
+ display: flex;
+ justify-content: center;
+ width: 100%;
+}
+.admin-home .content-box .content .plugins-tips {
+ padding: 20px 10px;
+ margin-bottom: 20px;
+}
+.admin-home .content-box .content .el-button + .el-tooltip {
+ margin-left: 10px;
+}
+.admin-home .content-box .content .el-table tr:hover {
+ background: #f6faff;
+}
+.admin-home .content-box .content .mgb20 {
+ margin-bottom: 20px;
+}
+.admin-home .content-box .content .move-enter-active,
+.admin-home .content-box .content .move-leave-active {
+ transition: opacity 0.1s ease;
+}
+.admin-home .content-box .content .move-enter-from,
+.admin-home .content-box .content .move-leave-to {
+ opacity: 0;
+}
+.admin-home .content-box .content .form-box {
+ width: 600px;
+}
+.admin-home .content-box .content .form-box .line {
+ text-align: center;
+}
+.admin-home .content-box .content .el-time-panel__content::after,
+.admin-home .content-box .content .el-time-panel__content::before {
+ margin-top: -7px;
+}
+.admin-home .content-box .content .el-time-spinner__wrapper .el-scrollbar__wrap:not(.el-scrollbar__wrap--hidden-default) {
+ padding-bottom: 0;
+}
+.admin-home .content-box .content [class*=" el-icon-"],
+.admin-home .content-box .content [class^=el-icon-] {
+ speak: none;
+ font-style: normal;
+ font-weight: 400;
+ font-variant: normal;
+ text-transform: none;
+ line-height: 1;
+ vertical-align: baseline;
+ display: inline-block;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+}
+.admin-home .content-box .content .el-sub-menu [class^=el-icon-] {
+ vertical-align: middle;
+ margin-right: 5px;
+ width: 24px;
+ text-align: center;
+ font-size: 18px;
+}
+.admin-home .content-box .content [hidden] {
+ display: none !important;
+}
+.admin-home .content-collapse {
+ left: 65px;
}
-
-[hidden] {
- display: none !important;
-}
\ No newline at end of file
diff --git a/web/src/assets/css/main.styl b/web/src/assets/css/main.styl
new file mode 100644
index 00000000..6d7e7169
--- /dev/null
+++ b/web/src/assets/css/main.styl
@@ -0,0 +1,149 @@
+* {
+ margin: 0;
+ padding: 0;
+}
+
+html,
+body,
+#app,
+.wrapper {
+ width: 100%;
+ height: 100%;
+ overflow: hidden;
+}
+
+body {
+ font-family: 'PingFang SC', "Helvetica Neue", Helvetica, "microsoft yahei", arial, STHeiTi, sans-serif;
+}
+
+.admin-home {
+ a {
+ text-decoration: none
+ }
+
+ .content-box {
+ position: absolute;
+ left: 250px;
+ right: 0;
+ top: 70px;
+ bottom: 0;
+ padding-bottom: 30px;
+ -webkit-transition: left .3s ease-in-out;
+ transition: left .3s ease-in-out;
+ background: #f0f0f0;
+
+ .content {
+ width: auto;
+ height: 100%;
+ padding: 10px;
+ overflow-y: scroll;
+ box-sizing: border-box;
+
+ .container {
+ padding: 30px;
+ background: #fff;
+ border: 1px solid #ddd;
+ border-radius: 5px;
+
+ .handle-box {
+ margin-bottom: 20px;
+ }
+ }
+
+ .crumbs {
+ margin: 10px 0;
+ }
+
+ .el-table th {
+ background-color: #f5f7fa !important;
+ }
+
+ .pagination {
+ margin: 20px 0;
+ display: flex;
+ justify-content: center;
+ width: 100%;
+ }
+
+ .plugins-tips {
+ padding: 20px 10px;
+ margin-bottom: 20px;
+ }
+
+ .el-button + .el-tooltip {
+ margin-left: 10px;
+ }
+
+ .el-table tr:hover {
+ background: #f6faff;
+ }
+
+ .mgb20 {
+ margin-bottom: 20px;
+ }
+
+ .move-enter-active,
+ .move-leave-active {
+ transition: opacity .1s ease;
+ }
+
+ .move-enter-from,
+ .move-leave-to {
+ opacity: 0;
+ }
+
+ /*BaseForm*/
+
+ .form-box {
+ width: 600px;
+ }
+
+ .form-box .line {
+ text-align: center;
+ }
+
+ .el-time-panel__content::after,
+ .el-time-panel__content::before {
+ margin-top: -7px;
+ }
+
+ .el-time-spinner__wrapper .el-scrollbar__wrap:not(.el-scrollbar__wrap--hidden-default) {
+ padding-bottom: 0;
+ }
+
+
+ [class*=" el-icon-"], [class^=el-icon-] {
+ speak: none;
+ font-style: normal;
+ font-weight: 400;
+ font-variant: normal;
+ text-transform: none;
+ line-height: 1;
+ vertical-align: baseline;
+ display: inline-block;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+ }
+
+ .el-sub-menu [class^=el-icon-] {
+ vertical-align: middle;
+ margin-right: 5px;
+ width: 24px;
+ text-align: center;
+ font-size: 18px;
+ }
+
+ [hidden] {
+ display: none !important;
+ }
+ }
+ }
+
+ .content-collapse {
+ left: 65px;
+ }
+}
+
+
+
+
diff --git a/web/src/assets/iconfont/iconfont.css b/web/src/assets/iconfont/iconfont.css
index a996e61d..faf6be13 100644
--- a/web/src/assets/iconfont/iconfont.css
+++ b/web/src/assets/iconfont/iconfont.css
@@ -1,8 +1,8 @@
@font-face {
font-family: "iconfont"; /* Project id 4125778 */
- src: url('iconfont.woff2?t=1687330009953') format('woff2'),
- url('iconfont.woff?t=1687330009953') format('woff'),
- url('iconfont.ttf?t=1687330009953') format('truetype');
+ src: url('iconfont.woff2?t=1687341905766') format('woff2'),
+ url('iconfont.woff?t=1687341905766') format('woff'),
+ url('iconfont.ttf?t=1687341905766') format('truetype');
}
.iconfont {
@@ -13,6 +13,10 @@
-moz-osx-font-smoothing: grayscale;
}
+.icon-sub-menu:before {
+ content: "\e86b";
+}
+
.icon-wechat-pay:before {
content: "\e639";
}
diff --git a/web/src/assets/iconfont/iconfont.js b/web/src/assets/iconfont/iconfont.js
index 8ae4572f..264aa565 100644
--- a/web/src/assets/iconfont/iconfont.js
+++ b/web/src/assets/iconfont/iconfont.js
@@ -1 +1 @@
-window._iconfont_svg_string_4125778='',function(a){var l=(l=document.getElementsByTagName("script"))[l.length-1],c=l.getAttribute("data-injectcss"),l=l.getAttribute("data-disable-injectsvg");if(!l){var t,o,i,e,h,n=function(l,c){c.parentNode.insertBefore(l,c)};if(c&&!a.__iconfont__svg__cssinject__){a.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(l){console&&console.log(l)}}t=function(){var l,c=document.createElement("div");c.innerHTML=a._iconfont_svg_string_4125778,(c=c.getElementsByTagName("svg")[0])&&(c.setAttribute("aria-hidden","true"),c.style.position="absolute",c.style.width=0,c.style.height=0,c.style.overflow="hidden",c=c,(l=document.body).firstChild?n(c,l.firstChild):l.appendChild(c))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(t,0):(o=function(){document.removeEventListener("DOMContentLoaded",o,!1),t()},document.addEventListener("DOMContentLoaded",o,!1)):document.attachEvent&&(i=t,e=a.document,h=!1,d(),e.onreadystatechange=function(){"complete"==e.readyState&&(e.onreadystatechange=null,s())})}function s(){h||(h=!0,i())}function d(){try{e.documentElement.doScroll("left")}catch(l){return void setTimeout(d,50)}s()}}(window);
\ No newline at end of file
+window._iconfont_svg_string_4125778='',function(a){var l=(l=document.getElementsByTagName("script"))[l.length-1],c=l.getAttribute("data-injectcss"),l=l.getAttribute("data-disable-injectsvg");if(!l){var t,o,i,e,h,s=function(l,c){c.parentNode.insertBefore(l,c)};if(c&&!a.__iconfont__svg__cssinject__){a.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(l){console&&console.log(l)}}t=function(){var l,c=document.createElement("div");c.innerHTML=a._iconfont_svg_string_4125778,(c=c.getElementsByTagName("svg")[0])&&(c.setAttribute("aria-hidden","true"),c.style.position="absolute",c.style.width=0,c.style.height=0,c.style.overflow="hidden",c=c,(l=document.body).firstChild?s(c,l.firstChild):l.appendChild(c))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(t,0):(o=function(){document.removeEventListener("DOMContentLoaded",o,!1),t()},document.addEventListener("DOMContentLoaded",o,!1)):document.attachEvent&&(i=t,e=a.document,h=!1,d(),e.onreadystatechange=function(){"complete"==e.readyState&&(e.onreadystatechange=null,n())})}function n(){h||(h=!0,i())}function d(){try{e.documentElement.doScroll("left")}catch(l){return void setTimeout(d,50)}n()}}(window);
\ No newline at end of file
diff --git a/web/src/assets/iconfont/iconfont.json b/web/src/assets/iconfont/iconfont.json
index 93b5ee4d..56a70d2f 100644
--- a/web/src/assets/iconfont/iconfont.json
+++ b/web/src/assets/iconfont/iconfont.json
@@ -5,6 +5,13 @@
"css_prefix_text": "icon-",
"description": "",
"glyphs": [
+ {
+ "icon_id": "6343824",
+ "name": "menu",
+ "font_class": "sub-menu",
+ "unicode": "e86b",
+ "unicode_decimal": 59499
+ },
{
"icon_id": "1487626",
"name": "微信支付",
diff --git a/web/src/assets/iconfont/iconfont.ttf b/web/src/assets/iconfont/iconfont.ttf
index 22a40db8..70a94037 100644
Binary files a/web/src/assets/iconfont/iconfont.ttf and b/web/src/assets/iconfont/iconfont.ttf differ
diff --git a/web/src/assets/iconfont/iconfont.woff b/web/src/assets/iconfont/iconfont.woff
index b18e8505..23aaf951 100644
Binary files a/web/src/assets/iconfont/iconfont.woff and b/web/src/assets/iconfont/iconfont.woff differ
diff --git a/web/src/assets/iconfont/iconfont.woff2 b/web/src/assets/iconfont/iconfont.woff2
index 14c7e098..43e38e0b 100644
Binary files a/web/src/assets/iconfont/iconfont.woff2 and b/web/src/assets/iconfont/iconfont.woff2 differ
diff --git a/web/src/components/admin/AdminHeader.vue b/web/src/components/admin/AdminHeader.vue
index 765f7a6f..819274aa 100644
--- a/web/src/components/admin/AdminHeader.vue
+++ b/web/src/components/admin/AdminHeader.vue
@@ -1,5 +1,9 @@
-