mirror of https://github.com/go-sonic/sonic.git
fix: sqlite
parent
9fd1a0e167
commit
446c8b84d3
@ -1,7 +0,0 @@
|
|||||||
|
|
||||||
GENERATE_DIR="./cmd/generate"
|
|
||||||
|
|
||||||
cd $GENERATE_DIR || exit
|
|
||||||
|
|
||||||
echo "Start Generating"
|
|
||||||
go run .
|
|
@ -0,0 +1,90 @@
|
|||||||
|
package content
|
||||||
|
|
||||||
|
import (
|
||||||
|
"html"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
|
||||||
|
"github.com/go-sonic/sonic/consts"
|
||||||
|
"github.com/go-sonic/sonic/handler/binding"
|
||||||
|
"github.com/go-sonic/sonic/model/dto"
|
||||||
|
"github.com/go-sonic/sonic/model/param"
|
||||||
|
"github.com/go-sonic/sonic/model/property"
|
||||||
|
"github.com/go-sonic/sonic/service"
|
||||||
|
"github.com/go-sonic/sonic/service/assembler"
|
||||||
|
"github.com/go-sonic/sonic/template"
|
||||||
|
"github.com/go-sonic/sonic/util"
|
||||||
|
"github.com/go-sonic/sonic/util/xerr"
|
||||||
|
)
|
||||||
|
|
||||||
|
type SearchHandler struct {
|
||||||
|
PostAssembler assembler.PostAssembler
|
||||||
|
PostService service.PostService
|
||||||
|
OptionService service.OptionService
|
||||||
|
ThemeService service.ThemeService
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewSearchHandler(
|
||||||
|
postAssembler assembler.PostAssembler,
|
||||||
|
postService service.PostService,
|
||||||
|
optionService service.OptionService,
|
||||||
|
themeService service.ThemeService,
|
||||||
|
) *SearchHandler {
|
||||||
|
return &SearchHandler{
|
||||||
|
PostAssembler: postAssembler,
|
||||||
|
PostService: postService,
|
||||||
|
OptionService: optionService,
|
||||||
|
ThemeService: themeService,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (s *SearchHandler) Search(ctx *gin.Context, model template.Model) (string, error) {
|
||||||
|
return s.search(ctx, 0, model)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *SearchHandler) PageSearch(ctx *gin.Context, model template.Model) (string, error) {
|
||||||
|
page, err := util.ParamInt32(ctx, "page")
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
return s.search(ctx, int(page)-1, model)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *SearchHandler) search(ctx *gin.Context, pageNum int, model template.Model) (string, error) {
|
||||||
|
keyword, err := util.MustGetQueryString(ctx, "keyword")
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
sort := param.Sort{}
|
||||||
|
err = ctx.ShouldBindWith(&sort, binding.CustomFormBinding)
|
||||||
|
if err != nil {
|
||||||
|
return "", xerr.WithStatus(err, xerr.StatusBadRequest).WithMsg("Parameter error")
|
||||||
|
}
|
||||||
|
if len(sort.Fields) == 0 {
|
||||||
|
sort = s.OptionService.GetPostSort(ctx)
|
||||||
|
}
|
||||||
|
defaultPageSize := s.OptionService.GetIndexPageSize(ctx)
|
||||||
|
page := param.Page{
|
||||||
|
PageNum: pageNum,
|
||||||
|
PageSize: defaultPageSize,
|
||||||
|
}
|
||||||
|
postQuery := param.PostQuery{
|
||||||
|
Page: page,
|
||||||
|
Sort: &sort,
|
||||||
|
Keyword: &keyword,
|
||||||
|
Statuses: []*consts.PostStatus{consts.PostStatusPublished.Ptr()},
|
||||||
|
}
|
||||||
|
posts, total, err := s.PostService.Page(ctx, postQuery)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
postVOs, err := s.PostAssembler.ConvertToListVO(ctx, posts)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
model["is_search"] = true
|
||||||
|
model["keyword"] = html.EscapeString(keyword)
|
||||||
|
model["posts"] = dto.NewPage(postVOs, total, page)
|
||||||
|
model["meta_keywords"] = s.OptionService.GetOrByDefault(ctx, property.SeoKeywords)
|
||||||
|
model["meta_description"] = s.OptionService.GetOrByDefault(ctx, property.SeoDescription)
|
||||||
|
return s.ThemeService.Render(ctx, "search")
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
.list-group{min-height:20px}.list-group-item{cursor:move}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 11 KiB |
@ -1 +1 @@
|
|||||||
<!doctype html><html lang="zh-cmn-Hans"><head><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="renderer" content="webkit"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"/><meta name="robots" content="noindex,nofollow"/><meta name="generator" content="Halo 1.5.2"/><link rel="icon" href="/favicon.ico"/><title>Halo</title><style>body {height: 100%;background-color: #f5f5f5;}#loader{position:absolute;top:0;right:0;bottom:0;left:0;margin:auto;border:solid 3px #e5e5e5;border-top-color:#333;border-radius:50%;width:30px;height:30px;animation:spin .6s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}</style><script defer="defer" src="/js/chunk-vendors.a8aac3e6.js"></script><script defer="defer" src="/js/app.8eac304f.js"></script><link href="/css/chunk-vendors.b8f03799.css" rel="stylesheet"><link href="/css/app.807e04c6.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but halo admin client doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"><div id="loader"></div></div></body></html>
|
<!doctype html><html lang="cmn-Hans"><head><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="renderer" content="webkit"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"/><meta name="robots" content="noindex,nofollow"/><meta name="generator" content="Halo 1.6.0"/><link rel="icon" href="/favicon.ico"/><title>Halo</title><style>body {height: 100%;background-color: #f5f5f5;}#loader{position:absolute;top:0;right:0;bottom:0;left:0;margin:auto;border:solid 3px #e5e5e5;border-top-color:#333;border-radius:50%;width:30px;height:30px;animation:spin .6s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}</style><script defer="defer" src="/js/chunk-vendors.b06eab53.js"></script><script defer="defer" src="/js/app.b866d7e3.js"></script><link href="/css/chunk-vendors.b8f03799.css" rel="stylesheet"><link href="/css/app.487935a4.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but halo admin client doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"><div id="loader"></div></div></body></html>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
|||||||
"use strict";(self["webpackChunkhalo_admin"]=self["webpackChunkhalo_admin"]||[]).push([[359],{79359:function(t,e,a){a.r(e),a.d(e,{default:function(){return h}});var n=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("page-view",[a("a-card",{attrs:{bodyStyle:{padding:"16px"},bordered:!1}},[a("div",{staticClass:"table-operator"},[a("a-button",{attrs:{type:"danger"},on:{click:t.handleClearActionLogs}},[t._v("清空操作日志")])],1),a("div",{staticClass:"mt-4"},[a("a-table",{attrs:{columns:t.list.columns,dataSource:t.list.data,loading:t.list.loading,pagination:!1,rowKey:function(t){return t.id},scrollToFirstRowOnChange:!0},scopedSlots:t._u([{key:"type",fn:function(e){return[t._v(" "+t._s(t._f("typeConvert")(e))+" ")]}},{key:"ipAddress",fn:function(e){return[a("div",{staticClass:"blur hover:blur-none transition-all"},[t._v(t._s(e))])]}},{key:"createTime",fn:function(e){return[a("a-tooltip",{attrs:{placement:"top"}},[a("template",{slot:"title"},[t._v(" "+t._s(t._f("moment")(e))+" ")]),t._v(" "+t._s(t._f("timeAgo")(e))+" ")],2)]}}])}),a("div",{staticClass:"page-wrapper"},[a("a-pagination",{staticClass:"pagination",attrs:{current:t.pagination.page,defaultPageSize:t.pagination.size,pageSizeOptions:["10","20","50","100"],total:t.pagination.total,showLessItems:"",showSizeChanger:""},on:{change:t.handlePageChange,showSizeChange:t.handlePageSizeChange}})],1)],1)])],1)},i=[],s=a(46519),r=(a(41479),a(70315),a(71101)),o=a(18608),l=a(84707),c=[{title:"ID",dataIndex:"id"},{title:"类型",dataIndex:"type",scopedSlots:{customRender:"type"}},{title:"关键值",dataIndex:"logKey"},{title:"内容",dataIndex:"content"},{title:"IP",dataIndex:"ipAddress",scopedSlots:{customRender:"ipAddress"}},{title:"操作时间",dataIndex:"createTime",scopedSlots:{customRender:"createTime"}}],d={name:"ActionLog",components:{PageView:r.B4},data:function(){return{list:{columns:c,data:[],total:0,loading:!1,params:{page:0,size:50}}}},computed:{pagination:function(){return{page:this.list.params.page+1,size:this.list.params.size,total:this.list.total}}},created:function(){this.handleListActionLogs()},methods:{handleListActionLogs:function(){var t=this;return(0,s.Z)(regeneratorRuntime.mark((function e(){var a;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.prev=0,t.list.loading=!0,e.next=4,o.Z.log.list(t.list.params);case 4:a=e.sent,t.list.data=a.data.content,t.list.total=a.data.total,e.next=12;break;case 9:e.prev=9,e.t0=e["catch"](0),t.$log.error(e.t0);case 12:return e.prev=12,t.list.loading=!1,e.finish(12);case 15:case"end":return e.stop()}}),e,null,[[0,9,12,15]])})))()},handlePageChange:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;this.list.params.page=t-1,this.handleListActionLogs()},handlePageSizeChange:function(t,e){this.$log.debug("Current: ".concat(t,", PageSize: ").concat(e)),this.list.params.page=0,this.list.params.size=e,this.handleListActionLogs()},handleClearActionLogs:function(){var t=this;t.$confirm({title:"提示",maskClosable:!0,content:"是否确定要清空所有操作日志?",onOk:function(){return(0,s.Z)(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,o.Z.log.clear();case 3:e.next=8;break;case 5:e.prev=5,e.t0=e["catch"](0),t.$log.error("Failed to clear action logs.",e.t0);case 8:return e.prev=8,e.next=11,t.handleListActionLogs();case 11:return e.finish(8);case 12:case"end":return e.stop()}}),e,null,[[0,5,8,12]])})))()}})}},filters:{typeConvert:function(t){var e=l.Js[t];return e?e.text:t}}},u=d,p=a(42177),g=(0,p.Z)(u,n,i,!1,null,null,null),h=g.exports}}]);
|
"use strict";(self["webpackChunkhalo_admin"]=self["webpackChunkhalo_admin"]||[]).push([[163],{65163:function(t,e,a){a.r(e),a.d(e,{default:function(){return h}});var n=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("page-view",[a("a-card",{attrs:{bodyStyle:{padding:"16px"},bordered:!1}},[a("div",{staticClass:"table-operator"},[a("a-button",{attrs:{type:"danger"},on:{click:t.handleClearActionLogs}},[t._v("清空操作日志")])],1),a("div",{staticClass:"mt-4"},[a("a-table",{attrs:{columns:t.list.columns,dataSource:t.list.data,loading:t.list.loading,pagination:!1,rowKey:function(t){return t.id},scrollToFirstRowOnChange:!0},scopedSlots:t._u([{key:"type",fn:function(e){return[t._v(" "+t._s(t._f("typeConvert")(e))+" ")]}},{key:"ipAddress",fn:function(e){return[a("div",{staticClass:"blur hover:blur-none transition-all"},[t._v(t._s(e))])]}},{key:"createTime",fn:function(e){return[a("a-tooltip",{attrs:{placement:"top"}},[a("template",{slot:"title"},[t._v(" "+t._s(t._f("moment")(e))+" ")]),t._v(" "+t._s(t._f("timeAgo")(e))+" ")],2)]}}])}),a("div",{staticClass:"page-wrapper"},[a("a-pagination",{staticClass:"pagination",attrs:{current:t.pagination.page,defaultPageSize:t.pagination.size,pageSizeOptions:["10","20","50","100"],total:t.pagination.total,showLessItems:"",showSizeChanger:""},on:{change:t.handlePageChange,showSizeChange:t.handlePageSizeChange}})],1)],1)])],1)},i=[],s=a(54288),r=(a(41479),a(70315),a(53298)),o=a(36591),l=a(43376),c=[{title:"ID",dataIndex:"id"},{title:"类型",dataIndex:"type",scopedSlots:{customRender:"type"}},{title:"关键值",dataIndex:"logKey"},{title:"内容",dataIndex:"content"},{title:"IP",dataIndex:"ipAddress",scopedSlots:{customRender:"ipAddress"}},{title:"操作时间",dataIndex:"createTime",scopedSlots:{customRender:"createTime"}}],d={name:"ActionLog",components:{PageView:r.B4},data:function(){return{list:{columns:c,data:[],total:0,loading:!1,params:{page:0,size:50}}}},computed:{pagination:function(){return{page:this.list.params.page+1,size:this.list.params.size,total:this.list.total}}},created:function(){this.handleListActionLogs()},methods:{handleListActionLogs:function(){var t=this;return(0,s.Z)(regeneratorRuntime.mark((function e(){var a;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.prev=0,t.list.loading=!0,e.next=4,o.Z.log.list(t.list.params);case 4:a=e.sent,t.list.data=a.data.content,t.list.total=a.data.total,e.next=12;break;case 9:e.prev=9,e.t0=e["catch"](0),t.$log.error(e.t0);case 12:return e.prev=12,t.list.loading=!1,e.finish(12);case 15:case"end":return e.stop()}}),e,null,[[0,9,12,15]])})))()},handlePageChange:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;this.list.params.page=t-1,this.handleListActionLogs()},handlePageSizeChange:function(t,e){this.$log.debug("Current: ".concat(t,", PageSize: ").concat(e)),this.list.params.page=0,this.list.params.size=e,this.handleListActionLogs()},handleClearActionLogs:function(){var t=this;t.$confirm({title:"提示",maskClosable:!0,content:"是否确定要清空所有操作日志?",onOk:function(){return(0,s.Z)(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,o.Z.log.clear();case 3:e.next=8;break;case 5:e.prev=5,e.t0=e["catch"](0),t.$log.error("Failed to clear action logs.",e.t0);case 8:return e.prev=8,e.next=11,t.handleListActionLogs();case 11:return e.finish(8);case 12:case"end":return e.stop()}}),e,null,[[0,5,8,12]])})))()}})}},filters:{typeConvert:function(t){var e=l.Js[t];return e?e.text:t}}},u=d,p=a(70739),g=(0,p.Z)(u,n,i,!1,null,null,null),h=g.exports}}]);
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@
|
|||||||
|
"use strict";(self["webpackChunkhalo_admin"]=self["webpackChunkhalo_admin"]||[]).push([[336],{29336:function(e,t,n){n.r(t),n.d(t,{default:function(){return y}});var o=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("page-view",[n("a-row",[n("a-col",{attrs:{span:24}},[e.options.developer_mode?n("div",{staticClass:"card-container"},[n("a-tabs",{attrs:{type:"card"},model:{value:e.activeKey,callback:function(t){e.activeKey=t},expression:"activeKey"}},e._l(e.panes,(function(t){return n("a-tab-pane",{key:t.key},[n("span",{attrs:{slot:"tab"},slot:"tab"},[n("a-icon",{attrs:{type:t.icon}}),e._v(e._s(t.title)+" ")],1),n(t.component,{tag:"component"})],1)})),1)],1):n("a-alert",{attrs:{description:"当前没有启用开发者选项,请启用之后再访问该页面!",message:"提示",showIcon:"",type:"error"}})],1)],1)],1)},i=[],a=n(22373),r=(n(31875),n(29888),n(45107),n(98906)),c=n(53298),s={components:{PageView:c.B4},data:function(){var e=[{title:"运行环境",icon:"safety",component:function(){return n.e(355).then(n.bind(n,26355))},key:"environment"},{title:"实时日志",icon:"code",component:function(){return Promise.all([n.e(788),n.e(192),n.e(164),n.e(303)]).then(n.bind(n,57303))},key:"runtimeLogs"},{title:"系统变量",icon:"table",component:function(){return n.e(719).then(n.bind(n,99719))},key:"optionsList"},{title:"静态存储",icon:"cloud",component:function(){return Promise.all([n.e(788),n.e(773)]).then(n.bind(n,47773))},key:"staticStorage"},{title:"设置",icon:"setting",component:function(){return n.e(626).then(n.bind(n,22626))},key:"settings"}];return{activeKey:e[0].key,panes:e}},computed:(0,a.Z)({},(0,r.Se)(["options"])),beforeRouteEnter:function(e,t,n){var o=e.query.activeKey;n((function(e){o&&(e.activeKey=o)}))},watch:{activeKey:function(e){if(e){var t=this.$router.history.current.path;this.$router.push({path:t,query:{activeKey:e}}).catch((function(e){return e}))}}}},u=s,l=n(70739),p=(0,l.Z)(u,o,i,!1,null,null,null),y=p.exports}}]);
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@
|
|||||||
"use strict";(self["webpackChunkhalo_admin"]=self["webpackChunkhalo_admin"]||[]).push([[439],{68439:function(e,t,n){n.r(t),n.d(t,{default:function(){return y}});var o=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("page-view",[n("a-row",[n("a-col",{attrs:{span:24}},[e.options.developer_mode?n("div",{staticClass:"card-container"},[n("a-tabs",{attrs:{type:"card"},model:{value:e.activeKey,callback:function(t){e.activeKey=t},expression:"activeKey"}},e._l(e.panes,(function(t){return n("a-tab-pane",{key:t.key},[n("span",{attrs:{slot:"tab"},slot:"tab"},[n("a-icon",{attrs:{type:t.icon}}),e._v(e._s(t.title)+" ")],1),n(t.component,{tag:"component"})],1)})),1)],1):n("a-alert",{attrs:{description:"当前没有启用开发者选项,请启用之后再访问该页面!",message:"提示",showIcon:"",type:"error"}})],1)],1)],1)},i=[],a=n(92164),r=(n(31875),n(29888),n(45107),n(98906)),c=n(71101),s={components:{PageView:c.B4},data:function(){var e=[{title:"运行环境",icon:"safety",component:function(){return n.e(235).then(n.bind(n,2235))},key:"environment"},{title:"实时日志",icon:"code",component:function(){return Promise.all([n.e(807),n.e(192),n.e(164),n.e(793)]).then(n.bind(n,5793))},key:"runtimeLogs"},{title:"系统变量",icon:"table",component:function(){return n.e(674).then(n.bind(n,3674))},key:"optionsList"},{title:"静态存储",icon:"cloud",component:function(){return Promise.all([n.e(807),n.e(293)]).then(n.bind(n,88293))},key:"staticStorage"},{title:"设置",icon:"setting",component:function(){return n.e(728).then(n.bind(n,55988))},key:"settings"}];return{activeKey:e[0].key,panes:e}},computed:(0,a.Z)({},(0,r.Se)(["options"])),beforeRouteEnter:function(e,t,n){var o=e.query.activeKey;n((function(e){o&&(e.activeKey=o)}))},watch:{activeKey:function(e){if(e){var t=this.$router.history.current.path;this.$router.push({path:t,query:{activeKey:e}}).catch((function(e){return e}))}}}},u=s,l=n(42177),p=(0,l.Z)(u,o,i,!1,null,null,null),y=p.exports}}]);
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
|||||||
"use strict";(self["webpackChunkhalo_admin"]=self["webpackChunkhalo_admin"]||[]).push([[728],{55988:function(e,r,t){t.r(r),t.d(r,{default:function(){return v}});var n=function(){var e=this,r=e.$createElement,t=e._self._c||r;return t("a-form",{attrs:{wrapperCol:e.wrapperCol,layout:"vertical"}},[t("a-form-item",{attrs:{label:"开发者选项:"}},[t("a-switch",{model:{value:e.options.developer_mode,callback:function(r){e.$set(e.options,"developer_mode",r)},expression:"options.developer_mode"}})],1),t("a-form-item",[t("ReactiveButton",{attrs:{errored:e.errored,loading:e.saving,erroredText:"保存失败",loadedText:"保存成功",text:"保存",type:"primary"},on:{callback:function(r){e.errored=!1},click:e.handleSaveOptions}})],1)],1)},a=[],o=t(46519),s=t(92164),i=(t(30535),t(85018),t(70315),t(98906)),c=t(18608),l={name:"SettingsForm",data:function(){return{options:{},wrapperCol:{xl:{span:8},lg:{span:8},sm:{span:12},xs:{span:24}},saving:!1,errored:!1}},created:function(){this.handleListOptions()},methods:(0,s.Z)((0,s.Z)({},(0,i.nv)(["refreshOptionsCache"])),{},{handleListOptions:function(){var e=this;return(0,o.Z)(regeneratorRuntime.mark((function r(){var t,n;return regeneratorRuntime.wrap((function(r){while(1)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,c.Z.option.listAsMapViewByKeys(["developer_mode"]);case 3:t=r.sent,n=t.data,e.options=n,r.next=11;break;case 8:r.prev=8,r.t0=r["catch"](0),e.$log.error(r.t0);case 11:case"end":return r.stop()}}),r,null,[[0,8]])})))()},handleSaveOptions:function(){var e=this;return(0,o.Z)(regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){while(1)switch(r.prev=r.next){case 0:return r.prev=0,e.saving=!0,r.next=4,c.Z.option.saveMapView(e.options);case 4:r.next=10;break;case 6:r.prev=6,r.t0=r["catch"](0),e.errored=!1,e.$log.error(r.t0);case 10:return r.prev=10,setTimeout((function(){e.saving=!1}),400),r.next=14,e.handleListOptions();case 14:return r.next=16,e.refreshOptionsCache();case 16:if(e.options.developer_mode){r.next=19;break}return r.next=19,e.$router.replace({name:"ToolList"});case 19:return r.finish(10);case 20:case"end":return r.stop()}}),r,null,[[0,6,10,20]])})))()}})},p=l,u=t(42177),d=(0,u.Z)(p,n,a,!1,null,null,null),v=d.exports}}]);
|
"use strict";(self["webpackChunkhalo_admin"]=self["webpackChunkhalo_admin"]||[]).push([[626],{22626:function(e,r,t){t.r(r),t.d(r,{default:function(){return v}});var n=function(){var e=this,r=e.$createElement,t=e._self._c||r;return t("a-form",{attrs:{wrapperCol:e.wrapperCol,layout:"vertical"}},[t("a-form-item",{attrs:{label:"开发者选项:"}},[t("a-switch",{model:{value:e.options.developer_mode,callback:function(r){e.$set(e.options,"developer_mode",r)},expression:"options.developer_mode"}})],1),t("a-form-item",[t("ReactiveButton",{attrs:{errored:e.errored,loading:e.saving,erroredText:"保存失败",loadedText:"保存成功",text:"保存",type:"primary"},on:{callback:function(r){e.errored=!1},click:e.handleSaveOptions}})],1)],1)},a=[],o=t(54288),s=t(22373),i=(t(30535),t(85018),t(70315),t(98906)),c=t(36591),l={name:"SettingsForm",data:function(){return{options:{},wrapperCol:{xl:{span:8},lg:{span:8},sm:{span:12},xs:{span:24}},saving:!1,errored:!1}},created:function(){this.handleListOptions()},methods:(0,s.Z)((0,s.Z)({},(0,i.nv)(["refreshOptionsCache"])),{},{handleListOptions:function(){var e=this;return(0,o.Z)(regeneratorRuntime.mark((function r(){var t,n;return regeneratorRuntime.wrap((function(r){while(1)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,c.Z.option.listAsMapViewByKeys(["developer_mode"]);case 3:t=r.sent,n=t.data,e.options=n,r.next=11;break;case 8:r.prev=8,r.t0=r["catch"](0),e.$log.error(r.t0);case 11:case"end":return r.stop()}}),r,null,[[0,8]])})))()},handleSaveOptions:function(){var e=this;return(0,o.Z)(regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){while(1)switch(r.prev=r.next){case 0:return r.prev=0,e.saving=!0,r.next=4,c.Z.option.saveMapView(e.options);case 4:r.next=10;break;case 6:r.prev=6,r.t0=r["catch"](0),e.errored=!1,e.$log.error(r.t0);case 10:return r.prev=10,setTimeout((function(){e.saving=!1}),400),r.next=14,e.handleListOptions();case 14:return r.next=16,e.refreshOptionsCache();case 16:if(e.options.developer_mode){r.next=19;break}return r.next=19,e.$router.replace({name:"ToolList"});case 19:return r.finish(10);case 20:case"end":return r.stop()}}),r,null,[[0,6,10,20]])})))()}})},p=l,u=t(70739),d=(0,u.Z)(p,n,a,!1,null,null,null),v=d.exports}}]);
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue