单页列表

pull/23/head
630892807@qq.com 4 years ago
parent 704f96d2de
commit 63f173095c

@ -17,6 +17,14 @@ func GetAbout(c *gin.Context) {
"result": about,
})
}
func GetAbouts(c *gin.Context) {
about := models.FindAbouts()
c.JSON(200, gin.H{
"code": 200,
"msg": "ok",
"result": about,
})
}
func PostAbout(c *gin.Context) {
title_cn := c.PostForm("title_cn")
title_en := c.PostForm("title_en")

@ -11,6 +11,13 @@ type About struct {
CssJs string `json:"css_js"`
HtmlCn string `json:"html_cn"`
HtmlEn string `json:"html_en"`
Page string `json:"page"`
}
func FindAbouts() []About {
var a []About
DB.Select("id,title_cn,page").Find(&a)
return a
}
func FindAboutByPage(page interface{}) About {

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

@ -94,6 +94,7 @@
html_cn: "",
html_en: "",
},
aboutpages:[],
modifyPass:{
old_pass:"",
new_pass:"",
@ -231,6 +232,11 @@
_this.pageindex=result;
});
}
if(ACTION=="setting_indexpages"){
this.sendAjax("/aboutpages","get",{},function(result){
_this.aboutpages=result;
});
}
if(ACTION=="setting_avator"){
this.sendAjax("/kefuinfo","get",{},function(result){
_this.avatarUrl=result.avator;

@ -1,7 +1,31 @@
{{template "header" }}
<div id="app" style="width:100%">
<template>
正在开发...
<el-main class="mainMain">
<el-button style="margin-bottom: 10px;" @click="" type="primary" size="small">添加单页</el-button>
<el-table
:data="aboutpages"
border
style="width: 100%">
<el-table-column
prop="title_cn"
label="标题">
</el-table-column>
<el-table-column
prop="page"
label="页面标识">
</el-table-column>
<el-table-column
prop="id"
label="操作">
<template slot-scope="scope">
<el-button @click="" type="primary" size="small" plain>编辑</el-button>
<el-button @click="" type="primary" size="small" plain>删除</el-button>
</template>
</el-table-column>
</el-table>
</el-main>
</template>
</div>

Loading…
Cancel
Save