首页弹窗修改

pull/23/head
taoshihan1991 4 years ago
parent a64754c1f1
commit 9f48f26213

@ -4,7 +4,7 @@ type Language struct {
WebCopyRight string WebCopyRight string
MainIntro string MainIntro string
Send string Send string
Notice, Maintech string Notice, Maintech, NowAsk, LaterAsk string
IndexSubIntro, IndexVisitors, IndexAgent, IndexDocument, IndexOnlineChat string IndexSubIntro, IndexVisitors, IndexAgent, IndexDocument, IndexOnlineChat string
} }
@ -23,6 +23,8 @@ func CreateLanguage(lang string) *Language {
Send: "Send", Send: "Send",
Notice: "Hello and welcome to go-fly - how can we help?", Notice: "Hello and welcome to go-fly - how can we help?",
Maintech: "Main technical architecture", Maintech: "Main technical architecture",
NowAsk: "Start Chat",
LaterAsk: "Chat Later",
} }
} }
if lang == "cn" { if lang == "cn" {
@ -33,10 +35,12 @@ func CreateLanguage(lang string) *Language {
IndexVisitors: "访客入口", IndexVisitors: "访客入口",
IndexAgent: "客服入口", IndexAgent: "客服入口",
IndexDocument: "接口文档", IndexDocument: "接口文档",
IndexOnlineChat: "在线咨询", IndexOnlineChat: "真人在线-点击与我交流",
Send: "发送", Send: "发送",
Notice: "欢迎您访问go-fly有什么我能帮助您的", Notice: "欢迎您访问go-fly有什么我能帮助您的",
Maintech: "主要技术架构", Maintech: "主要技术架构",
NowAsk: "现在咨询",
LaterAsk: "稍后再说",
} }
} }
return language return language

@ -17,3 +17,28 @@ func GetAbout(c *gin.Context) {
"result": about, "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": "",
})
}

@ -7,7 +7,7 @@ import (
) )
func Index(c *gin.Context) { func Index(c *gin.Context) {
c.Redirect(302, "/index/en") c.Redirect(302, "/index_en")
} }
//首页跳转 //首页跳转

@ -18,3 +18,18 @@ func FindAboutByPage(page interface{}) About {
DB.Where("page = ?", page).First(&a) DB.Where("page = ?", page).First(&a)
return 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()
}

@ -50,6 +50,7 @@ func InitApiRouter(engine *gin.Engine) {
engine.GET("/statistics", middleware.JwtApiMiddleware, controller.GetStatistics) engine.GET("/statistics", middleware.JwtApiMiddleware, controller.GetStatistics)
//前台接口 //前台接口
engine.GET("/about", controller.GetAbout) engine.GET("/about", controller.GetAbout)
engine.POST("/about", middleware.JwtApiMiddleware, middleware.RbacAuth, controller.PostAbout)
engine.GET("/notice", middleware.SetLanguage, controller.GetNotice) engine.GET("/notice", middleware.SetLanguage, controller.GetNotice)
engine.POST("/notice", middleware.JwtApiMiddleware, controller.PostNotice) engine.POST("/notice", middleware.JwtApiMiddleware, controller.PostNotice)
engine.DELETE("/notice", middleware.JwtApiMiddleware, controller.DelNotice) engine.DELETE("/notice", middleware.JwtApiMiddleware, controller.DelNotice)

@ -7,7 +7,7 @@ import (
) )
func InitViewRouter(engine *gin.Engine) { 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("/login", tmpl.PageLogin)
engine.GET("/chat_page", middleware.SetLanguage, tmpl.PageChat) engine.GET("/chat_page", middleware.SetLanguage, tmpl.PageChat)
engine.GET("/chatIndex", middleware.SetLanguage, tmpl.PageChat) engine.GET("/chatIndex", middleware.SetLanguage, tmpl.PageChat)

@ -293,7 +293,7 @@ html {
/*margin-bottom: 80px;*/ /*margin-bottom: 80px;*/
} }
.chatVisitorPage .chatBox{ .chatVisitorPage .chatBox{
min-height: 530px; min-height: 540px;
} }
.chatBox .el-col{margin:10px 0;} .chatBox .el-col{margin:10px 0;}
.chatUser{ .chatUser{

@ -12,9 +12,9 @@
</head> </head>
<header class="header"> <header class="header">
<div class="container"> <div class="container">
<h1><a href="/index">GO-FLY</a></h1> <h1><a href="/">GO-FLY</a></h1>
<a class="navBtn" href="/index/en">English (United States)</a> <a class="navBtn" href="/index_en">English (United States)</a>
<a class="navBtn" href="/index/cn">中文版 (简体)</a> <a class="navBtn" href="/index_cn">中文版 (简体)</a>
<a class="navBtn" href="https://github.com/taoshihan1991/go-fly" target="_blank">Github</a> <a class="navBtn" href="https://github.com/taoshihan1991/go-fly" target="_blank">Github</a>
<a class="navBtn" href="/login">{{.AgentBtn}}</a> <a class="navBtn" href="/login">{{.AgentBtn}}</a>
<a class="navBtn" href="/docs/index.html" target="_blank">{{.Document}}</a> <a class="navBtn" href="/docs/index.html" target="_blank">{{.Document}}</a>
@ -36,32 +36,87 @@
<script> <script>
var GOFLY_URL=""; var GOFLY_URL="";
var GOFLY_KEFU_ID="kefu2"; var GOFLY_KEFU_ID="kefu2";
var GOFLY_BTN_TEXT="Chat with me"; var GOFLY_BTN_TEXT="{{.OnlineChat}}";
</script> </script>
<script src="/static/js/gofly-front.js"></script> <script src="/static/js/gofly-front.js"></script>
<!--//对接客服代码--> <!--//对接客服代码-->
<!--自动弹代码-->
<style>
/*自动弹出*/
.autoInvite{
width: 400px;
height: 162px;
position: fixed;
top:50%;
left: 50%;
margin-top: -81px;
margin-left: -200px;
background: url("/static/images/inviteColorBack1.png");
display: none;
}
.autoInvite .autoInviteNotice{
margin-top: 4px;
}
.autoInvite .autoInviteContent{
width: 220px;
height: 90px;
position: absolute;
top:55px;
right: 20px;
font-size: 13pt;
color: #fff;
word-break: break-all;
line-height: 25px;
}
.autoInvite .autoInviteBtns a{
display: inline-block;
width: 80px;
height: 32px;
line-height: 32px;
color: #fff;
text-align: center;
border: 1px solid #fff;
border-radius: 5px;
cursor: pointer;
font-size: 13px;
margin-right: 8px;
text-decoration: none;
}
.autoInvite .autoInviteBtns a.nowAsk{
color: #0085DA;
background-color: #fff;
}
</style>
<div class="autoInvite">
<div class="autoInviteContent">
<div class="autoInviteNotice">{{.Notice}}</div>
<div class="autoInviteBtns">
<a href="javascript:void(0)" id="noAsk">{{.LaterAsk}}</a>
<a href="javascript:void(0)" class="nowAsk">{{.NowAsk}}</a>
</div>
</div>
</div>
<script> <script>
var invite=false;
setTimeout(function(){ setTimeout(function(){
if (launchButtonFlag) return; if (invite) return;
layer.open({ $(".autoInvite").show();
type: 2, invite=true;
title: "Chat with me",
closeBtn: 1, //不显示关闭按钮 $("#noAsk").click(function(){
shade: [0], $(".autoInvite").hide();
area: ['510px', '520px'], invite=true;
offset: 'rb', //右下角弹出 });
anim: 2, $(".nowAsk").click(function(){
content: ['/chatIndex?kefu_id='+GOFLY_KEFU_ID+'&refer='+window.document.title, 'no'], //iframe的urlno代表不显示滚动条 $(".autoInvite").hide();
end: function(){ showKefu();
launchButtonFlag=false; invite=true;
$(".launchButton").show();
}
}); });
launchButtonFlag=true;
$(".launchButton").hide();
},8000); },8000);
</script> </script>
<!--自动弹代码-->
</html> </html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

@ -54,6 +54,35 @@ function clickBtn(){
document.title = originTitle; 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的urlno代表不显示滚动条
end: function(){
launchButtonFlag=false;
$(".launchButton").show();
}
});
launchButtonFlag=true;
$(".launchButton").hide();
$("body").click(function () {
clearTimeout(titleTimer);
document.title = originTitle;
});
}
function dynamicLoadCss(url) { function dynamicLoadCss(url) {
var head = document.getElementsByTagName('head')[0]; var head = document.getElementsByTagName('head')[0];
var link = document.createElement('link'); var link = document.createElement('link');

@ -70,6 +70,9 @@ func PageIndex(c *gin.Context) {
"OnlineChat": language.IndexOnlineChat, "OnlineChat": language.IndexOnlineChat,
"IndexSend": language.Send, "IndexSend": language.Send,
"Maintech": language.Maintech, "Maintech": language.Maintech,
"Notice": language.Notice,
"NowAsk": language.NowAsk,
"LaterAsk": language.LaterAsk,
"Lang": lang, "Lang": lang,
"Title": title, "Title": title,
"Keywords": keywords, "Keywords": keywords,

Loading…
Cancel
Save