commit 387d78522ebdd7e1b5ba7af1ef16eb4d55753cd9
Author: vine_liutk <961510893@qq.com>
Date: Mon May 29 15:43:54 2023 +0800
初始化
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..8f0de65
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,18 @@
+root = true
+
+[*]
+charset = utf-8
+end_of_line = lf
+indent_size = 4
+indent_style = space
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[*.md]
+trim_trailing_whitespace = false
+
+[*.{yml,yaml}]
+indent_size = 2
+
+[docker-compose.yml]
+indent_size = 4
diff --git a/.env.example b/.env.example
new file mode 100644
index 0000000..478972c
--- /dev/null
+++ b/.env.example
@@ -0,0 +1,58 @@
+APP_NAME=Laravel
+APP_ENV=local
+APP_KEY=
+APP_DEBUG=true
+APP_URL=http://localhost
+
+LOG_CHANNEL=stack
+LOG_DEPRECATIONS_CHANNEL=null
+LOG_LEVEL=debug
+
+DB_CONNECTION=mysql
+DB_HOST=127.0.0.1
+DB_PORT=3306
+DB_DATABASE=laravel
+DB_USERNAME=root
+DB_PASSWORD=
+
+BROADCAST_DRIVER=log
+CACHE_DRIVER=file
+FILESYSTEM_DISK=local
+QUEUE_CONNECTION=sync
+SESSION_DRIVER=file
+SESSION_LIFETIME=120
+
+MEMCACHED_HOST=127.0.0.1
+
+REDIS_HOST=127.0.0.1
+REDIS_PASSWORD=null
+REDIS_PORT=6379
+
+MAIL_MAILER=smtp
+MAIL_HOST=mailpit
+MAIL_PORT=1025
+MAIL_USERNAME=null
+MAIL_PASSWORD=null
+MAIL_ENCRYPTION=null
+MAIL_FROM_ADDRESS="hello@example.com"
+MAIL_FROM_NAME="${APP_NAME}"
+
+AWS_ACCESS_KEY_ID=
+AWS_SECRET_ACCESS_KEY=
+AWS_DEFAULT_REGION=us-east-1
+AWS_BUCKET=
+AWS_USE_PATH_STYLE_ENDPOINT=false
+
+PUSHER_APP_ID=
+PUSHER_APP_KEY=
+PUSHER_APP_SECRET=
+PUSHER_HOST=
+PUSHER_PORT=443
+PUSHER_SCHEME=https
+PUSHER_APP_CLUSTER=mt1
+
+VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
+VITE_PUSHER_HOST="${PUSHER_HOST}"
+VITE_PUSHER_PORT="${PUSHER_PORT}"
+VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
+VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..fcb21d3
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,11 @@
+* text=auto eol=lf
+
+*.blade.php diff=html
+*.css diff=css
+*.html diff=html
+*.md diff=markdown
+*.php diff=php
+
+/.github export-ignore
+CHANGELOG.md export-ignore
+.styleci.yml export-ignore
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..7fe978f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,19 @@
+/.phpunit.cache
+/node_modules
+/public/build
+/public/hot
+/public/storage
+/storage/*.key
+/vendor
+.env
+.env.backup
+.env.production
+.phpunit.result.cache
+Homestead.json
+Homestead.yaml
+auth.json
+npm-debug.log
+yarn-error.log
+/.fleet
+/.idea
+/.vscode
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..4d39dc0
--- /dev/null
+++ b/README.md
@@ -0,0 +1,4 @@
+1. composer install 安装依赖包
+2. php artisan key:g 生成唯一key
+3. php artisan admin:install
+4. php artisan db:seed
\ No newline at end of file
diff --git a/app/Admin/Components.php b/app/Admin/Components.php
new file mode 100644
index 0000000..ea688ff
--- /dev/null
+++ b/app/Admin/Components.php
@@ -0,0 +1,183 @@
+TreeSelectControl()
+ ->name($name)->label($label)
+ ->showIcon(false)
+ ->labelField($labelField)
+ ->valueField($valueField)->source($apiUrl);
+ }
+
+ /**
+ * 排序字段
+ */
+ public function sortControl($name ='sort', $label = '排序'){
+ return amisMake()->NumberControl()
+ ->name($name)->label($label)
+ ->displayMode('enhance')
+ ->value(0)
+ ->min(0);
+ }
+
+ /**
+ * 2位小数输入框
+ */
+ public function decimalControl($name ='decimal', $label = '数值'){
+ return amisMake()->NumberControl()
+ ->name($name)->label($label)
+ ->kilobitSeparator(true)
+ ->percision(2)
+ ->step(0.01)
+ ->value(0.00)
+ ->min(0);
+ }
+
+ /**
+ * 富文本编辑器
+ */
+ public function fuEditorControl($name ='content', $label = '内容', $uploadUrl = ''){
+ return amisMake()->RichTextControl()->vendor('tinymce')
+ ->options([
+ "menubar" => false,
+ "min_height" => 500,
+ "plugins" => 'image link table lists charmap emoticons code table fullscreen',
+ "toolbar" => "undo redo | bold italic underline strikethrough | fontfamily fontsize blocks | alignleft aligncenter alignright alignjustify | image link | outdent indent | numlist bullist table | forecolor backcolor removeformat | charmap emoticons | code fullscreen",
+ "toolbar_mode" => "wrap",
+ "help_tabs" => [],
+ "convert_urls" => false,
+ // "quickbars_selection_toolbar" => "fontsize forecolor backcolor",
+ // "quickbars_insert_toolbar" => false,
+ ])
+ ->receiver(admin_url('upload_rich'))
+ ->name($name)
+ ->label($label);
+
+ //froala去除授权提示;(但是保存会有额外内容,需要处理)
+ //
+ }
+
+ public function enableControl($name = 'is_enable', $label= '状态', $mode = 'horizontal'){
+ return amisMake()->SwitchControl()
+ ->name($name)->label($label)
+ ->mode($mode)
+ ->onText(__('admin.extensions.status_map.enabled'))->offText(__('admin.extensions.status_map.disabled'));
+ }
+
+ public function keywordsTagControl($name = 'tags', $label= '标签', $typeKey = ''){
+ return amisMake()->TagControl()
+ ->name($name)->label($label)
+ ->options(Keyword::getByParentKey($typeKey)->pluck('name', 'id')->toArray());
+ }
+
+ public function keywordsTag($label = '标签'){
+ return amisMake()->Tag()->label($label)->displayMode('rounded')->color('inactive');
+ }
+
+ /**
+ * 生成统计图config
+ * 折线图或者柱状图
+ */
+ public function chartLineBarConfig($title = '', array $x , array $y){
+ $yAxisData = [];
+ $seriesData = [];
+ if(!isset($y[0])){
+ $_y = $y;
+ $y = [0=>$_y];
+ }
+ $i = 0;
+ $tips = '{b0}';
+ foreach($y as $item) {
+ //tips
+ $tips.= '
{a'.$i.'}: {c'.$i.'}'.($item['unit'] ?? '');
+ //纵坐标
+ $yAxisData[] = [
+ 'name'=>$item['name'].($item['unit'] ?? ''),
+ 'type' =>'value',
+ 'axisTick' => true,
+ 'alignTicks' => true,
+ 'axisLine' => [
+ 'show' => true,
+ 'lineStyle' => [
+ 'color' => $item['color'] ?? ''
+ ]
+ ],
+ 'axisLabel'=> [
+ 'formatter'=>'{value} '.($item['unit'] ?? '')
+ ]
+ ];
+ //数据
+ $_series = [
+ 'name' => $item['name'] ?? '',
+ 'data' => $item['data'] ?? [],
+ 'type' => $item['type'] ?? 'line',
+ 'yAxisIndex' => $i,
+ ];
+ switch($item['type']){
+ case 'line':
+ $_series = array_merge($_series, [
+ 'smooth'=> true,
+ 'symbol'=> 'none',
+ 'lineStyle' => [
+ 'color' => $item['color'] ?? ''
+ ],
+ 'areaStyle' => [
+ 'color' => $item['color'] ?? ''
+ ],
+ ]);
+ break;
+ case 'bar':
+ break;
+ }
+ $seriesData[] = $_series;
+ $i++;
+ }
+
+ return [
+ 'title' => [
+ 'text' => $title,
+ ],
+ "tooltip" => [//提示
+ 'trigger'=>'axis',//坐标轴触发
+ 'axisPointer' => [
+ 'type' => 'cross'
+ ],
+ // 'formatter' => $tips
+ ],
+ 'grid' => [
+ 'left' => '8%',
+ 'right' => '8%',
+ ],
+ 'xAxis' => [
+ 'type' => 'category',
+ 'data' => $x,
+ ],
+ 'yAxis' => $yAxisData,
+ 'series' => $seriesData
+ ];
+ }
+
+ /**
+ * 生成饼状图config
+ * -todo
+ */
+ public function chartPieConfig(){
+ return ;
+ }
+}
\ No newline at end of file
diff --git a/app/Admin/Controllers/AuthController.php b/app/Admin/Controllers/AuthController.php
new file mode 100644
index 0000000..594631f
--- /dev/null
+++ b/app/Admin/Controllers/AuthController.php
@@ -0,0 +1,10 @@
+basePage()->css($this->css())->body([
+ Grid::make()->columns([
+ $this->frameworkInfo()->md(5),
+ Flex::make()->items([
+ $this->pieChart(),
+ $this->cube(),
+ ]),
+ ]),
+ Grid::make()->columns([
+ $this->lineChart()->md(8),
+ Flex::make()->className('h-full')->items([
+ $this->clock(),
+ $this->hitokoto(),
+ ])->direction('column'),
+ ]),
+ ]);
+
+ return $this->response()->success($page);
+ }
+
+ /**
+ * 一言
+ */
+ public function hitokoto()
+ {
+ return Card::make()
+ ->className('h-full clear-card-mb')
+ ->body(
+ Custom::make()->html(<<
+
"+V(t[n].content)+`
+`};B.fence=function(t,n,r,o,e){var s=t[n],i=s.info?HM(s.info).trim():"",c="",a="",l,u,p,h,f;return i&&(p=i.split(/(\s+)/g),c=p[0],a=p.slice(2).join("")),r.highlight?l=r.highlight(s.content,c,a)||V(s.content):l=V(s.content),l.indexOf(""+l+`
+`):""+l+`
+`};B.image=function(t,n,r,o,e){var s=t[n];return s.attrs[s.attrIndex("alt")][1]=e.renderInlineAsText(s.children,r,o),e.renderToken(t,n,r)};B.hardbreak=function(t,n,r){return r.xhtmlOut?`"u"&&(n.env.references={}),typeof n.env.references[h]>"u"&&(n.env.references[h]={title:y,href:l}),n.parentType=b,n.line=r+C+1),!0)},qN=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","section","source","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],fn={},DN="[a-zA-Z_:][a-zA-Z0-9:._-]*",EN="[^\"'=<>`\\x00-\\x20]+",SN="'[^']*'",FN='"[^"]*"',TN="(?:"+EN+"|"+SN+"|"+FN+")",RN="(?:\\s+"+DN+"(?:\\s*=\\s*"+TN+")?)",Mr="<[A-Za-z][A-Za-z0-9\\-]*"+RN+"*\\s*\\/?>",Nr="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",LN="|",zN="<[?][\\s\\S]*?[?]>",IN="]*>",BN="",MN=new RegExp("^(?:"+Mr+"|"+Nr+"|"+LN+"|"+zN+"|"+IN+"|"+BN+")"),NN=new RegExp("^(?:"+Mr+"|"+Nr+")");fn.HTML_TAG_RE=MN;fn.HTML_OPEN_CLOSE_TAG_RE=NN;var PN=qN,ON=fn.HTML_OPEN_CLOSE_TAG_RE,H=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^/,!0],[/^<\?/,/\?>/,!0],[/^/,!0],[/^/,!0],[new RegExp("^?("+PN.join("|")+")(?=(\\s|/?>|$))","i"),/^$/,!0],[new RegExp(ON.source+"\\s*$"),/^$/,!1]],UN=function(n,r,o,e){var s,i,c,a,l=n.bMarks[r]+n.tShift[r],u=n.eMarks[r];if(n.sCount[r]-n.blkIndent>=4||!n.md.options.html||n.src.charCodeAt(l)!==60)return!1;for(a=n.src.slice(l,u),s=0;s .fr-command, .fr-more-toolbar > .fr-command, .fr-btn-grp > .fr-btn-wrap > .fr-command, .fr-more-toolbar > .fr-btn-wrap > .fr-command").addClass("fr-hidden"),function(){for(var se=e.$tb.find(".fr-btn-grp, .fr-more-toolbar"),H=function(S){var L=s(se[S]);L.children().each(function(R,K){L.before(K)}),L.remove()},W=0;W=0;r--)o=n[r],!(o.marker!==95&&o.marker!==42)&&o.end!==-1&&(e=n[o.end],c=r>0&&n[r-1].end===o.end+1&&n[r-1].marker===o.marker&&n[r-1].token===o.token-1&&n[o.end+1].token===e.token+1,i=String.fromCharCode(o.marker),s=t.tokens[o.token],s.type=c?"strong_open":"em_open",s.tag=c?"strong":"em",s.nesting=1,s.markup=c?i+i:i,s.content="",s=t.tokens[e.token],s.type=c?"strong_close":"em_close",s.tag=c?"strong":"em",s.nesting=-1,s.markup=c?i+i:i,s.content="",c&&(t.tokens[n[r-1].token].content="",t.tokens[n[o.end+1].token].content="",r--))}gn.postProcess=function(n){var r,o=n.tokens_meta,e=n.tokens_meta.length;for(br(n,n.delimiters),r=0;r")},closeTagString:function(m){return"".concat(m.tagName.toLowerCase(),">")},isFirstSibling:function g(m,C){C===void 0&&(C=!0);for(var O=m.previousSibling;O&&C&&e.node.hasClass(O,"fr-marker");)O=O.previousSibling;return!O||O.nodeType===Node.TEXT_NODE&&O.textContent===""&&g(O)},isLastSibling:function g(m,C){C===void 0&&(C=!0);for(var O=m.nextSibling;O&&C&&e.node.hasClass(O,"fr-marker");)O=O.nextSibling;return!O||O.nodeType===Node.TEXT_NODE&&O.textContent===""&&g(O)},isList:function(m){return!!m&&0<=["UL","OL"].indexOf(m.tagName)},isLink:function(m){return!!m&&m.nodeType===Node.ELEMENT_NODE&&m.tagName.toLowerCase()==="a"},isElement:E,contents:s,isVoid:function(m){return m&&m.nodeType===Node.ELEMENT_NODE&&0<=t.VOID_ELEMENTS.indexOf((m.tagName||"").toLowerCase())},hasFocus:function(m){return m===e.doc.activeElement&&(!e.doc.hasFocus||e.doc.hasFocus())&&!!(E(m)||m.type||m.href||~m.tabIndex)},isEditable:function(m){return(!m.getAttribute||m.getAttribute("contenteditable")!=="false")&&["STYLE","SCRIPT"].indexOf(m.tagName)<0},isDeletable:function(m){return m&&m.nodeType===Node.ELEMENT_NODE&&m.getAttribute("class")&&0<=(m.getAttribute("class")||"").indexOf("fr-deletable")},hasClass:function(m,C){return m instanceof r&&(m=m.get(0)),m&&m.classList&&m.classList.contains(C)},filter:function(m){return e.browser.msie?m:{acceptNode:m}}}},Object.assign(t.DEFAULTS,{htmlAllowedTags:["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","br","button","canvas","caption","cite","code","col","colgroup","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meter","nav","noscript","object","ol","optgroup","option","output","p","param","pre","progress","queue","rp","rt","ruby","s","samp","script","style","section","select","small","source","span","strike","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","u","ul","var","video","wbr"],htmlRemoveTags:["script","style"],htmlAllowedAttrs:["accept","accept-charset","accesskey","action","align","allowfullscreen","allowtransparency","alt","async","autocomplete","autofocus","autoplay","autosave","background","bgcolor","border","charset","cellpadding","cellspacing","checked","cite","class","color","cols","colspan","content","contenteditable","contextmenu","controls","coords","data","data-.*","datetime","default","defer","dir","dirname","disabled","download","draggable","dropzone","enctype","for","form","formaction","frameborder","headers","height","hidden","high","href","hreflang","http-equiv","icon","id","ismap","itemprop","keytype","kind","label","lang","language","list","loop","low","max","maxlength","media","method","min","mozallowfullscreen","multiple","muted","name","novalidate","open","optimum","pattern","ping","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","reversed","rows","rowspan","sandbox","scope","scoped","scrolling","seamless","selected","shape","size","sizes","span","src","srcdoc","srclang","srcset","start","step","summary","spellcheck","style","tabindex","target","title","type","translate","usemap","value","valign","webkitallowfullscreen","width","wrap"],htmlAllowedStyleProps:[".*"],htmlAllowComments:!0,htmlUntouched:!1,fullPage:!1}),t.HTML5Map={B:"STRONG",I:"EM",STRIKE:"S"},t.MODULES.clean=function(e){var r,s,d,u,b=e.$;function E(x){if(x.nodeType===Node.ELEMENT_NODE&&x.getAttribute("class")&&0<=x.getAttribute("class").indexOf("fr-marker"))return!1;var v,A=e.node.contents(x),l=[];for(v=0;v
${dZ(s.translate(t))}
`)}]}]}),gW=t=>vc.parts.footer({dom:{tag:"div",classes:["tox-dialog__footer"]},components:t}),pW=(t,s)=>[Ud.sketch({dom:{tag:"div",classes:["tox-dialog__footer-start"]},components:t}),Ud.sketch({dom:{tag:"div",classes:["tox-dialog__footer-end"]},components:s})],UU=t=>{const s="tox-dialog",a=s+"-wrap",i=a+"__backdrop",d=s+"__disable-scroll";return vc.sketch({lazySink:t.lazySink,onEscape:g=>(t.onEscape(g),E.some(!0)),useTabstopAt:g=>!Dw(g),firstTabstop:t.firstTabstop,dom:{tag:"div",classes:[s].concat(t.extraClasses),styles:{position:"relative",...t.extraStyles}},components:[t.header,t.body,...t.footer.toArray()],parts:{blocker:{dom:Xg(``),components:[{dom:{tag:"div",classes:fZ?[i,i+"--opaque"]:[i]}}]}},dragBlockClass:a,modalBehaviours:Ht([fo.config({}),Po("dialog-events",t.dialogEvents.concat([iu(rm(),(g,h)=>{Gn.focusIn(g)})])),Po("scroll-lock",[Xr(()=>{Js(yr(),d)}),$i(()=>{ha(yr(),d)})]),...t.extraBehaviours]),eventOrder:{[ir()]:["dialog-events"],[Sd()]:["scroll-lock","dialog-events","alloy.base.behaviour"],[mf()]:["alloy.base.behaviour","dialog-events","scroll-lock"],...t.eventOrder}})},hW=t=>Jc.sketch({dom:{tag:"button",classes:["tox-button","tox-button--icon","tox-button--naked"],attributes:{type:"button","aria-label":t.translate("Close"),title:t.translate("Close")}},buttonBehaviours:Ht([la.config({})]),components:[qu("close",{tag:"div",classes:["tox-icon"]},t.icons)],action:s=>{Ds(s,$b)}}),bW=(t,s,a,i)=>{const d=g=>[Br(i.translate(g.title))];return{dom:{tag:"div",classes:["tox-dialog__title"],attributes:{...a.map(g=>({id:g})).getOr({})}},components:[],behaviours:Ht([or.config({channel:`${w5}-${s}`,initialData:t,renderComponents:d})])}},yW=()=>({dom:Xg('')}),mZ=(t,s,a,i)=>Ud.sketch({dom:Xg(''),components:[bW(t,s,E.some(a),i),yW(),hW(i)],containerBehaviours:Ht([Jb.config({mode:"mouse",blockerClass:"blocker",getTarget:d=>Ed(d,'[role="dialog"]').getOrDie(),snaps:{getSnapPoints:()=>[],leftAttr:"data-drag-left",topAttr:"data-drag-top"}})])}),gZ=(t,s,a)=>{const i=vc.parts.title(bW(t,s,E.none(),a)),d=vc.parts.draghandle(yW()),g=vc.parts.close(hW(a)),h=[i].concat(t.draggable?[d]:[]).concat([g]);return Ud.sketch({dom:Xg(''),components:h})},vW=(t,s,a)=>gZ({title:a.shared.providers.translate(t),draggable:a.dialog.isDraggableModal()},s,a.shared.providers),kW=(t,s,a)=>({dom:{tag:"div",classes:["tox-dialog__busy-spinner"],attributes:{"aria-label":a.translate(t)},styles:{left:"0px",right:"0px",bottom:"0px",top:"0px",position:"absolute"}},behaviours:s,components:[{dom:Xg('{for(let p=0,y=l.length;p p.maxRow||me(go(l,(y,S)=>{p=f(p,y,S)}),p),Te=(l,f,p)=>(Ye(l,(y,S)=>{p=f(p,y,S)}),p),lt=(l,f,p)=>{for(let y=0,S=l.length;ylt(l,f,zt),Io=(l,f)=>{for(let p=0,y=l.length;p{const p=ze.call(l,0);return p.sort(f),p},Ae=(l,f)=>f>=0&&fIt(l,(p,y)=>({k:y,v:f(p,y)})),It=(l,f)=>{const p={};return he(l,(y,S)=>{const O=f(y,S);p[O.k]=O.v}),p},Vn=l=>(f,p)=>{l[p]=f},uo=(l,f,p,y)=>{he(l,(S,O)=>{(f(S,O)?p:y)(S,O)})},$n=(l,f)=>{const p={};return uo(l,f,Vn(p),Pe),p},wn=(l,f)=>{const p=[];return he(l,(y,S)=>{p.push(f(y,S))}),p},Ln=l=>wn(l,dt),Ro=(l,f)=>no(l,f)?ce.from(l[f]):ce.none(),no=(l,f)=>ke.call(l,f),Nn=(l,f)=>no(l,f)&&l[f]!==void 0&&l[f]!==null,Jn=l=>{for(const f in l)if(ke.call(l,f))return!1;return!0},Yn=typeof window<"u"?window:Function("return this;")(),Lo=(l,f)=>{let p=f??Yn;for(let y=0;yP&&(P=nn),Yt{const P=mt(S.cells,(j,Q)=>{if(p[O][Q]===!1){const me=nT(l,O,Q,f);return y(O,Q,me.rowspan,me.colspan),[W(j.element,me.rowspan,me.colspan,j.isNew)]}else return[]});return ot(S.element,P,S.section,S.isNew)})},Cp=(l,f,p)=>{const y=[];Ye(l.colgroups,S=>{const O=[];for(let P=0;P