首页取数据指定字段

pull/23/head
taoshihan1991 4 years ago
parent ae81ce0f85
commit 777ea81517

@ -18,6 +18,18 @@ func FindAboutByPage(page interface{}) About {
DB.Where("page = ?", page).First(&a)
return a
}
func FindAboutByPageLanguage(page interface{}, lang string) About {
var a About
if lang == "" {
lang = "cn"
}
if lang == "en" {
DB.Select("css_js,title_en,keywords_en,desc_en,html_en").Where("page = ?", page).First(&a)
} else {
DB.Select("css_js,title_cn,keywords_cn,desc_cn,html_cn").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,

@ -1,43 +1,7 @@
*{padding:0;margin:0}
.floatRight{float: right;}
.clear{clear: both;}
::-webkit-scrollbar
{
width: 5px;
height: 110px;
background-color: #F5F5F5;
}
/*定义滚动条轨道 内阴影+圆角*/
::-webkit-scrollbar-track
{
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
border-radius: 10px;
background-color: #F5F5F5;
}
/*定义滑块 内阴影+圆角*/
::-webkit-scrollbar-thumb
{
border-radius: 10px;
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,.3);
background-color: #bdbdbd;
}
/*滑块效果*/
::-webkit-scrollbar-thumb:hover
{
border-radius: 5px;
-webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
background: rgba(0,0,0,0.4);
}
/*IE滚动条颜色*/
html {
scrollbar-face-color:#bfbfbf;/*滚动条颜色*/
scrollbar-highlight-color:#000;
scrollbar-3dlight-color:#000;
scrollbar-darkshadow-color:#000;
scrollbar-Shadow-color:#adadad;/*滑块边色*/
scrollbar-arrow-color:rgba(0,0,0,0.4);/*箭头颜色*/
scrollbar-track-color:#eeeeee;/*背景颜色*/
}
.h1, .h2, .h3, .h4, .h5, .h6, h1, h2, h3, h4, h5, h6 {
font-family: inherit;
font-weight: 500;

@ -0,0 +1,37 @@
::-webkit-scrollbar
{
width: 5px;
height: 110px;
background-color: #F5F5F5;
}
/*定义滚动条轨道 内阴影+圆角*/
::-webkit-scrollbar-track
{
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
border-radius: 10px;
background-color: #F5F5F5;
}
/*定义滑块 内阴影+圆角*/
::-webkit-scrollbar-thumb
{
border-radius: 10px;
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,.3);
background-color: #bdbdbd;
}
/*滑块效果*/
::-webkit-scrollbar-thumb:hover
{
border-radius: 5px;
-webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
background: rgba(0,0,0,0.4);
}
/*IE滚动条颜色*/
html {
scrollbar-face-color:#bfbfbf;/*滚动条颜色*/
scrollbar-highlight-color:#000;
scrollbar-3dlight-color:#000;
scrollbar-darkshadow-color:#000;
scrollbar-Shadow-color:#adadad;/*滑块边色*/
scrollbar-arrow-color:rgba(0,0,0,0.4);/*箭头颜色*/
scrollbar-track-color:#eeeeee;/*背景颜色*/
}

@ -12,14 +12,8 @@
<script src="https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js"></script>
<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.4.1/dist/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<link rel="stylesheet" href="/static/css/front.css?v=0.2.3" />
<link rel="stylesheet" href="/static/css/common.css?v=0.2.3" />
<style>
body {
background: #fff;
min-height: 530px;
}
</style>
</head>
<body>
<div id="app" class="chatCenter">

@ -48,7 +48,7 @@ func (obj *CommonHtml) Display(file string, data interface{}) {
func PageIndex(c *gin.Context) {
lang, _ := c.Get("lang")
language := config.CreateLanguage(lang.(string))
about := models.FindAboutByPage("index")
about := models.FindAboutByPageLanguage("index", lang.(string))
cssJs := html.UnescapeString(about.CssJs)
title := about.TitleCn
keywords := about.KeywordsCn
@ -61,15 +61,7 @@ func PageIndex(c *gin.Context) {
content = html.UnescapeString(about.HtmlEn)
}
c.HTML(http.StatusOK, "index.html", gin.H{
"Copyright": language.WebCopyRight,
"WebDesc": language.MainIntro,
"SubIntro": language.IndexSubIntro,
"Document": language.IndexDocument,
"VisitorBtn": language.IndexVisitors,
"AgentBtn": language.IndexAgent,
"OnlineChat": language.IndexOnlineChat,
"IndexSend": language.Send,
"Maintech": language.Maintech,
"Notice": language.Notice,
"NowAsk": language.NowAsk,
"LaterAsk": language.LaterAsk,

Loading…
Cancel
Save