设置项编辑首页获取数据

pull/23/head
taoshihan1991 4 years ago
parent 430eaed6f3
commit a64754c1f1

@ -0,0 +1,19 @@
package controller
import (
"github.com/gin-gonic/gin"
"github.com/taoshihan1991/imaptool/models"
)
func GetAbout(c *gin.Context) {
page := c.Query("page")
if page == "" {
page = "index"
}
about := models.FindAboutByPage(page)
c.JSON(200, gin.H{
"code": 200,
"msg": "ok",
"result": about,
})
}

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

@ -84,7 +84,15 @@
},
statistics:{},
pageindex: {
titlecn: "",
title_cn: "",
title_en: "",
keywords_cn: "",
keywords_en: "",
desc_cn: "",
desc_en: "",
css_js: "",
html_cn: "",
html_en: "",
},
},
methods: {
@ -212,7 +220,9 @@
});
}
if(ACTION=="setting_pageindex"){
this.sendAjax("/about","get",{},function(result){
_this.pageindex=result;
});
}
},
sendAjax(url,method,params,callback){

@ -6,34 +6,34 @@
<el-main class="mainMain">
<el-form ref="form" :model="pageindex" label-width="100px">
<el-form-item label="中文标题">
<el-input v-model="pageindex.titlecn"></el-input>
<el-input v-model="pageindex.title_cn"></el-input>
</el-form-item>
<el-form-item label="英文标题">
<el-input v-model="pageindex.titlecn"></el-input>
<el-input v-model="pageindex.title_en"></el-input>
</el-form-item>
<el-form-item label="中文关键词">
<el-input v-model="pageindex.titlecn"></el-input>
<el-input v-model="pageindex.keywords_cn"></el-input>
</el-form-item>
<el-form-item label="英文关键词">
<el-input v-model="pageindex.titlecn"></el-input>
<el-input v-model="pageindex.keywords_en"></el-input>
</el-form-item>
<el-form-item label="中文描述">
<el-input v-model="pageindex.titlecn"></el-input>
<el-input v-model="pageindex.desc_cn"></el-input>
</el-form-item>
<el-form-item label="英文描述">
<el-input v-model="pageindex.titlecn"></el-input>
<el-input v-model="pageindex.desc_en"></el-input>
</el-form-item>
<el-form-item label="JS&CSS">
<el-input v-model="pageindex.titlecn"></el-input>
<el-input :autosize="{ minRows: 2, maxRows: 6}" type="textarea" v-model="pageindex.css_js"></el-input>
</el-form-item>
<el-form-item label="中文内容">
<el-input type="textarea" v-model="pageindex.titlecn"></el-input>
<el-input :autosize="{ minRows: 2, maxRows: 8}" type="textarea" v-model="pageindex.html_cn"></el-input>
</el-form-item>
<el-form-item label="英文内容">
<el-input type="textarea" v-model="pageindex.titlecn"></el-input>
<el-input :autosize="{ minRows: 2, maxRows: 8}" type="textarea" v-model="pageindex.html_en"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">保存</el-button>
<el-button type="primary" @click="">保存</el-button>
<el-button>取消</el-button>
</el-form-item>
</el-form>

Loading…
Cancel
Save