diff --git a/config/language.go b/config/language.go index 2645079..83117fa 100644 --- a/config/language.go +++ b/config/language.go @@ -4,7 +4,7 @@ type Language struct { WebCopyRight string MainIntro string Send string - Notice, Maintech string + Notice, Maintech, NowAsk, LaterAsk string IndexSubIntro, IndexVisitors, IndexAgent, IndexDocument, IndexOnlineChat string } @@ -23,6 +23,8 @@ func CreateLanguage(lang string) *Language { Send: "Send", Notice: "Hello and welcome to go-fly - how can we help?", Maintech: "Main technical architecture", + NowAsk: "Start Chat", + LaterAsk: "Chat Later", } } if lang == "cn" { @@ -33,10 +35,12 @@ func CreateLanguage(lang string) *Language { IndexVisitors: "访客入口", IndexAgent: "客服入口", IndexDocument: "接口文档", - IndexOnlineChat: "在线咨询", + IndexOnlineChat: "真人在线-点击与我交流", Send: "发送", Notice: "欢迎您访问go-fly!有什么我能帮助您的?", Maintech: "主要技术架构", + NowAsk: "现在咨询", + LaterAsk: "稍后再说", } } return language diff --git a/controller/about.go b/controller/about.go index 2866aca..ba9e6ea 100644 --- a/controller/about.go +++ b/controller/about.go @@ -17,3 +17,28 @@ func GetAbout(c *gin.Context) { "result": about, }) } +func PostAbout(c *gin.Context) { + title_cn := c.PostForm("title_cn") + title_en := c.PostForm("title_en") + keywords_cn := c.PostForm("keywords_cn") + keywords_en := c.PostForm("keywords_en") + desc_cn := c.PostForm("desc_cn") + desc_en := c.PostForm("desc_en") + css_js := c.PostForm("css_js") + html_cn := c.PostForm("html_cn") + html_en := c.PostForm("html_en") + if title_cn == "" || title_en == "" || html_cn == "" || html_en == "" { + c.JSON(200, gin.H{ + "code": 400, + "msg": "error", + }) + return + } + models.UpdateAbout("index", title_cn, title_en, keywords_cn, keywords_en, desc_cn, desc_en, css_js, html_cn, html_en) + + c.JSON(200, gin.H{ + "code": 200, + "msg": "ok", + "result": "", + }) +} diff --git a/controller/index.go b/controller/index.go index bdbcf4c..03ca685 100644 --- a/controller/index.go +++ b/controller/index.go @@ -7,7 +7,7 @@ import ( ) func Index(c *gin.Context) { - c.Redirect(302, "/index/en") + c.Redirect(302, "/index_en") } //首页跳转 diff --git a/models/abouts.go b/models/abouts.go index eec333e..0f9541a 100644 --- a/models/abouts.go +++ b/models/abouts.go @@ -18,3 +18,18 @@ func FindAboutByPage(page interface{}) About { DB.Where("page = ?", page).First(&a) return a } +func UpdateAbout(page string, title_cn string, title_en string, keywords_cn string, keywords_en string, desc_cn string, desc_en string, css_js string, html_cn string, html_en string) { + c := &About{ + TitleCn: title_cn, + TitleEn: title_en, + KeywordsCn: keywords_cn, + KeywordsEn: keywords_en, + DescCn: desc_cn, + DescEn: desc_en, + CssJs: css_js, + HtmlCn: html_cn, + HtmlEn: html_en, + } + DB.Model(c).Where("page = ?", page).Update(c) + InitConfig() +} diff --git a/router/api.go b/router/api.go index f640fb1..a22d2c7 100644 --- a/router/api.go +++ b/router/api.go @@ -50,6 +50,7 @@ func InitApiRouter(engine *gin.Engine) { engine.GET("/statistics", middleware.JwtApiMiddleware, controller.GetStatistics) //前台接口 engine.GET("/about", controller.GetAbout) + engine.POST("/about", middleware.JwtApiMiddleware, middleware.RbacAuth, controller.PostAbout) engine.GET("/notice", middleware.SetLanguage, controller.GetNotice) engine.POST("/notice", middleware.JwtApiMiddleware, controller.PostNotice) engine.DELETE("/notice", middleware.JwtApiMiddleware, controller.DelNotice) diff --git a/router/view.go b/router/view.go index a4dfbd8..df3d002 100644 --- a/router/view.go +++ b/router/view.go @@ -7,7 +7,7 @@ import ( ) func InitViewRouter(engine *gin.Engine) { - engine.GET("/index/:lang", middleware.SetLanguage, tmpl.PageIndex) + engine.GET("/index_:lang", middleware.SetLanguage, tmpl.PageIndex) engine.GET("/login", tmpl.PageLogin) engine.GET("/chat_page", middleware.SetLanguage, tmpl.PageChat) engine.GET("/chatIndex", middleware.SetLanguage, tmpl.PageChat) diff --git a/static/css/common.css b/static/css/common.css index 8b0e4f4..f8c8912 100644 --- a/static/css/common.css +++ b/static/css/common.css @@ -293,7 +293,7 @@ html { /*margin-bottom: 80px;*/ } .chatVisitorPage .chatBox{ - min-height: 530px; + min-height: 540px; } .chatBox .el-col{margin:10px 0;} .chatUser{ diff --git a/static/html/index.html b/static/html/index.html index 1c1c701..d134cfe 100644 --- a/static/html/index.html +++ b/static/html/index.html @@ -12,9 +12,9 @@
-

GO-FLY

- English (United States) - 中文版 (简体) +

GO-FLY

+ English (United States) + 中文版 (简体) Github {{.AgentBtn}} {{.Document}} @@ -36,32 +36,87 @@ + + +
+
+
{{.Notice}}
+ +
+
+ \ No newline at end of file diff --git a/static/images/inviteColorBack1.png b/static/images/inviteColorBack1.png new file mode 100644 index 0000000..a8c8b47 Binary files /dev/null and b/static/images/inviteColorBack1.png differ diff --git a/static/js/gofly-front.js b/static/js/gofly-front.js index 03324b2..4bc93d6 100644 --- a/static/js/gofly-front.js +++ b/static/js/gofly-front.js @@ -54,6 +54,35 @@ function clickBtn(){ document.title = originTitle; }); } +function showKefu(){ + if (launchButtonFlag) return; + var width=$(window).width(); + if(width<768){ + window.open(GOFLY_URL+'/chatIndex?kefu_id='+GOFLY_KEFU_ID+'&refer='+window.document.title); + return; + } + layer.open({ + type: 2, + title: GOFLY_BTN_TEXT, + closeBtn: 1, //不显示关闭按钮 + shade: [0], + area: ['520px', '530px'], + offset: 'rb', //右下角弹出 + anim: 2, + content: [GOFLY_URL+'/chatIndex?kefu_id='+GOFLY_KEFU_ID+'&refer='+window.document.title, 'yes'], //iframe的url,no代表不显示滚动条 + end: function(){ + launchButtonFlag=false; + $(".launchButton").show(); + } + }); + launchButtonFlag=true; + $(".launchButton").hide(); + + $("body").click(function () { + clearTimeout(titleTimer); + document.title = originTitle; + }); +} function dynamicLoadCss(url) { var head = document.getElementsByTagName('head')[0]; var link = document.createElement('link'); diff --git a/tmpl/common.go b/tmpl/common.go index bae2f4f..4828115 100644 --- a/tmpl/common.go +++ b/tmpl/common.go @@ -70,6 +70,9 @@ func PageIndex(c *gin.Context) { "OnlineChat": language.IndexOnlineChat, "IndexSend": language.Send, "Maintech": language.Maintech, + "Notice": language.Notice, + "NowAsk": language.NowAsk, + "LaterAsk": language.LaterAsk, "Lang": lang, "Title": title, "Keywords": keywords,