Modify login process
This commit is contained in:
@@ -1 +1 @@
|
|||||||
import{E as e}from"./index.ec680239.js";import{l as s}from"./index.715e6999.js";const t={"Content-Type":"application/json;charsetset=UTF-8"},u=r=>e({url:"/auth/api/v1/reader/blogs",method:"GET",params:r,paramsSerializer:a=>s.stringify(a,{arrayFormat:"repeat"})}),i=()=>e({url:"/auth/api/v1/reader/blog_type",method:"GET",headers:t}),p=r=>e({url:"/auth/api/v1/reader/blog/"+r,method:"GET",headers:t}),n=()=>e({url:"/auth/api/v1/reader/blogs/publish/all",method:"GET"}),h=r=>e({url:"/auth/api/v1/reader/blogs/publish/"+r,method:"GET"});export{i as a,h as b,p as c,u as g,n as p};
|
import{E as e}from"./index.7e79e86a.js";import{l as s}from"./index.376e6601.js";const t={"Content-Type":"application/json;charsetset=UTF-8"},u=r=>e({url:"/auth/api/v1/reader/blogs",method:"GET",params:r,paramsSerializer:a=>s.stringify(a,{arrayFormat:"repeat"})}),i=()=>e({url:"/auth/api/v1/reader/blog_type",method:"GET",headers:t}),p=r=>e({url:"/auth/api/v1/reader/blog/"+r,method:"GET",headers:t}),n=()=>e({url:"/auth/api/v1/reader/blogs/publish/all",method:"GET"}),h=r=>e({url:"/auth/api/v1/reader/blogs/publish/"+r,method:"GET"});export{i as a,h as b,p as c,u as g,n as p};
|
||||||
BIN
Binary file not shown.
File diff suppressed because one or more lines are too long
BIN
Binary file not shown.
@@ -1 +1 @@
|
|||||||
import{_ as e,o as _,c as a}from"./index.ec680239.js";const c={},n={class:"dashboard"};function r(s,t){return _(),a("div",n,"\u611F\u609F\u8FD9\u4E2A\u4E1C\u897F\uFF0C\u6682\u65F6\u6CA1\u6709\u4EC0\u4E48\u592A\u591A\u60F3\u6CD5\uFF0C\u4EE5\u540E\u4F1A\u88AB\u5220\u6389\u628A")}var d=e(c,[["render",r]]);export{d as default};
|
import{_ as e,o as _,c as a}from"./index.7e79e86a.js";const c={},n={class:"dashboard"};function r(s,t){return _(),a("div",n,"\u611F\u609F\u8FD9\u4E2A\u4E1C\u897F\uFF0C\u6682\u65F6\u6CA1\u6709\u4EC0\u4E48\u592A\u591A\u60F3\u6CD5\uFF0C\u4EE5\u540E\u4F1A\u88AB\u5220\u6389\u628A")}var d=e(c,[["render",r]]);export{d as default};
|
||||||
@@ -1 +1 @@
|
|||||||
import{d as S,C as b,r as u,o as i,c as r,a as e,u as s,g as l,F as y,j as k,h as w,k as $,e as p,t as B,f as m,D as q}from"./index.ec680239.js";import{g,a as A,p as T,b as G}from"./blogView.d2987280.js";import"./index.715e6999.js";const H=p("span",null,"\u5206\u7C7B\u641C\u7D22",-1),J=p("span",{class:"text-gray-500"},"-",-1),K=m("\u641C\u7D22"),M=m("\u521B\u4F5C"),O=m("\u5168\u90E8\u91CD\u65B0\u53D1\u5E03"),P={class:"blog_list"},Q=["onClick"],R={style:{display:"flex","justify-content":"space-between","align-items":"center"}},W={style:{"font-size":"12px",height:"16px","line-height":"16px",overflow:"hidden","text-overflow":"ellipsis"}},X=m("\u91CD\u65B0\u53D1\u5E03 "),oe=S({setup(Y){const a=b({key_word:"",btId:"",start_day:"",end_day:""}),_=b([]),h=b([]),v=()=>{g({}).then(n=>{n.data.forEach(t=>{_.push(t)})}),A().then(n=>{h.push({btId:"",btName:"\u9009\u62E9\u5206\u7C7B"}),n.data.forEach(t=>{const f={btId:t.btId,btName:t.btName};h.push(f)})})},x=()=>{g(a).then(n=>{_.splice(0,_.length),n.data.forEach(t=>{_.push(t)})})},V=n=>{q.set("bid",n);const{href:t}=w.resolve({path:"/view",query:{bid:n}});window.open(t,"_blank")},E=()=>{const{href:n}=w.resolve({path:"/write/"});window.open(n,"_blank")},F=()=>{T()},D=n=>{G(n)};return v(),(n,t)=>{const f=u("el-input"),d=u("el-col"),N=u("el-option"),I=u("el-select"),C=u("el-form-item"),U=u("el-date-picker"),j=u("el-time-picker"),c=u("el-button"),z=u("el-form");return i(),r(y,null,[e(z,{model:s(a),"label-width":"120px"},{default:l(()=>[e(C,{label:"\u5173\u952E\u5B57\u641C\u7D22"},{default:l(()=>[e(d,{span:7},{default:l(()=>[e(f,{modelValue:s(a).key_word,"onUpdate:modelValue":t[0]||(t[0]=o=>s(a).key_word=o)},null,8,["modelValue"])]),_:1}),e(d,{span:1}),e(d,{span:10},{default:l(()=>[H,e(I,{modelValue:s(a).btId,"onUpdate:modelValue":t[1]||(t[1]=o=>s(a).btId=o),placeholder:"\u9009\u62E9\u5206\u7C7B"},{default:l(()=>[(i(!0),r(y,null,k(s(h),o=>(i(),$(N,{key:o.btId,label:o.btName,value:o.btId},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),e(C,{label:"\u521B\u4F5C\u65F6\u95F4"},{default:l(()=>[e(d,{span:7},{default:l(()=>[e(U,{modelValue:s(a).start_day,"onUpdate:modelValue":t[2]||(t[2]=o=>s(a).start_day=o),type:"date",placeholder:"\u5F00\u59CB\u65F6\u95F4",style:{width:"100%"}},null,8,["modelValue"])]),_:1}),e(d,{span:2,class:"text-center"},{default:l(()=>[J]),_:1}),e(d,{span:7},{default:l(()=>[e(j,{modelValue:s(a).end_day,"onUpdate:modelValue":t[3]||(t[3]=o=>s(a).end_day=o),placeholder:"\u7ED3\u675F\u65F6\u95F4",style:{width:"100%"}},null,8,["modelValue"])]),_:1}),e(d,{span:6,style:{"text-align":"center"}},{default:l(()=>[e(c,{type:"primary",onClick:x},{default:l(()=>[K]),_:1})]),_:1})]),_:1})]),_:1},8,["model"]),e(c,{onClick:E},{default:l(()=>[M]),_:1}),e(c,{onClick:F},{default:l(()=>[O]),_:1}),(i(!0),r(y,null,k(s(_),o=>(i(),r("div",P,[p("h3",{style:{cursor:"pointer",width:"min-content","white-space":"nowrap"},onClick:L=>V(o.bid)},B(o.title),9,Q),p("div",R,[p("p",W,B(o.content),1),e(c,{size:"small",type:"success",onClick:L=>D(o.bid)},{default:l(()=>[X]),_:2},1032,["onClick"])])]))),256))],64)}}});export{oe as default};
|
import{d as S,C as b,r as u,o as i,c as r,a as e,u as s,g as l,F as y,j as k,h as w,k as $,e as p,t as B,f as m,D as q}from"./index.7e79e86a.js";import{g,a as A,p as T,b as G}from"./blogView.48abb2a7.js";import"./index.376e6601.js";const H=p("span",null,"\u5206\u7C7B\u641C\u7D22",-1),J=p("span",{class:"text-gray-500"},"-",-1),K=m("\u641C\u7D22"),M=m("\u521B\u4F5C"),O=m("\u5168\u90E8\u91CD\u65B0\u53D1\u5E03"),P={class:"blog_list"},Q=["onClick"],R={style:{display:"flex","justify-content":"space-between","align-items":"center"}},W={style:{"font-size":"12px",height:"16px","line-height":"16px",overflow:"hidden","text-overflow":"ellipsis"}},X=m("\u91CD\u65B0\u53D1\u5E03 "),oe=S({setup(Y){const a=b({key_word:"",btId:"",start_day:"",end_day:""}),_=b([]),h=b([]),v=()=>{g({}).then(n=>{n.data.forEach(t=>{_.push(t)})}),A().then(n=>{h.push({btId:"",btName:"\u9009\u62E9\u5206\u7C7B"}),n.data.forEach(t=>{const f={btId:t.btId,btName:t.btName};h.push(f)})})},x=()=>{g(a).then(n=>{_.splice(0,_.length),n.data.forEach(t=>{_.push(t)})})},V=n=>{q.set("bid",n);const{href:t}=w.resolve({path:"/view",query:{bid:n}});window.open(t,"_blank")},E=()=>{const{href:n}=w.resolve({path:"/write/"});window.open(n,"_blank")},F=()=>{T()},D=n=>{G(n)};return v(),(n,t)=>{const f=u("el-input"),d=u("el-col"),N=u("el-option"),I=u("el-select"),C=u("el-form-item"),U=u("el-date-picker"),j=u("el-time-picker"),c=u("el-button"),z=u("el-form");return i(),r(y,null,[e(z,{model:s(a),"label-width":"120px"},{default:l(()=>[e(C,{label:"\u5173\u952E\u5B57\u641C\u7D22"},{default:l(()=>[e(d,{span:7},{default:l(()=>[e(f,{modelValue:s(a).key_word,"onUpdate:modelValue":t[0]||(t[0]=o=>s(a).key_word=o)},null,8,["modelValue"])]),_:1}),e(d,{span:1}),e(d,{span:10},{default:l(()=>[H,e(I,{modelValue:s(a).btId,"onUpdate:modelValue":t[1]||(t[1]=o=>s(a).btId=o),placeholder:"\u9009\u62E9\u5206\u7C7B"},{default:l(()=>[(i(!0),r(y,null,k(s(h),o=>(i(),$(N,{key:o.btId,label:o.btName,value:o.btId},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),e(C,{label:"\u521B\u4F5C\u65F6\u95F4"},{default:l(()=>[e(d,{span:7},{default:l(()=>[e(U,{modelValue:s(a).start_day,"onUpdate:modelValue":t[2]||(t[2]=o=>s(a).start_day=o),type:"date",placeholder:"\u5F00\u59CB\u65F6\u95F4",style:{width:"100%"}},null,8,["modelValue"])]),_:1}),e(d,{span:2,class:"text-center"},{default:l(()=>[J]),_:1}),e(d,{span:7},{default:l(()=>[e(j,{modelValue:s(a).end_day,"onUpdate:modelValue":t[3]||(t[3]=o=>s(a).end_day=o),placeholder:"\u7ED3\u675F\u65F6\u95F4",style:{width:"100%"}},null,8,["modelValue"])]),_:1}),e(d,{span:6,style:{"text-align":"center"}},{default:l(()=>[e(c,{type:"primary",onClick:x},{default:l(()=>[K]),_:1})]),_:1})]),_:1})]),_:1},8,["model"]),e(c,{onClick:E},{default:l(()=>[M]),_:1}),e(c,{onClick:F},{default:l(()=>[O]),_:1}),(i(!0),r(y,null,k(s(_),o=>(i(),r("div",P,[p("h3",{style:{cursor:"pointer",width:"min-content","white-space":"nowrap"},onClick:L=>V(o.bid)},B(o.title),9,Q),p("div",R,[p("p",W,B(o.content),1),e(c,{size:"small",type:"success",onClick:L=>D(o.bid)},{default:l(()=>[X]),_:2},1032,["onClick"])])]))),256))],64)}}});export{oe as default};
|
||||||
Vendored
BIN
Binary file not shown.
@@ -1 +1 @@
|
|||||||
import{_ as e,o as c,c as o}from"./index.ec680239.js";const r={},s={class:"dashboard"};function a(t,n){return c(),o("div",s,"\u4E2A\u4EBA\u4E91\u7F51\u76D8\uFF0C\u5178\u578B\u7684\u6743\u9650\uFF0C\u521D\u671F\u6253\u7B97\u53EA\u6709\u6700\u9AD8\u6743\u9650\u7684\u6211\u81EA\u5DF1\u4F7F\u7528")}var d=e(r,[["render",a]]);export{d as default};
|
import{_ as e,o as c,c as o}from"./index.7e79e86a.js";const r={},s={class:"dashboard"};function a(t,n){return c(),o("div",s,"\u4E2A\u4EBA\u4E91\u7F51\u76D8\uFF0C\u5178\u578B\u7684\u6743\u9650\uFF0C\u521D\u671F\u6253\u7B97\u53EA\u6709\u6700\u9AD8\u6743\u9650\u7684\u6211\u81EA\u5DF1\u4F7F\u7528")}var d=e(r,[["render",a]]);export{d as default};
|
||||||
Vendored
BIN
Binary file not shown.
File diff suppressed because one or more lines are too long
Vendored
BIN
Binary file not shown.
File diff suppressed because one or more lines are too long
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
+11
-11
File diff suppressed because one or more lines are too long
Vendored
BIN
Binary file not shown.
@@ -1 +1 @@
|
|||||||
import{_ as e,o as _,c as o}from"./index.ec680239.js";const a={},c={class:"dashboard"};function r(s,t){return _(),o("div",c," \u521D\u671F\u8BBE\u60F3\uFF0C\u4F5C\u4E3A\u767B\u5F55\u7528\u6237\u7684\u529F\u80FD\u4E4B\u4E00\uFF0C\u53EF\u9009\u62E9\u5F0F\u7684\u6570\u636E\u62BD\u53D6 \u5305\u62EC\u7528\u6237\u76F8\u5173\u8D44\u6599\u7684\u5168\u90E8\u53D6\u56DE\u64CD\u4F5C\u3002 bookmark blog study cloud \u7B49\u7B49\u3002\u5E76\u6CA1\u6709\u6253\u7B97\u5728\u6BCF\u4E2A\u6A21\u5757\u4E0B\u63D0\u4F9B\u4E0B\u8F7D\u5DE5\u7A0B\uFF0C\u56E0\u4E3A\u6211\u8FD9\u4E2A\u4E0D\u662F\u9762\u5411\u4E1A\u52A1\u7684\u3002\u63D0\u4F9B\u4E0B\u8F7D\u5DE5\u7A0B\u65E0\u975E\u662F\u6015\u6570\u636E\u4E22\u5931\u800C\u5DF2\uFF0C\u4EC5\u9650\u4E8E\u6B64 ")}var d=e(a,[["render",r]]);export{d as default};
|
import{_ as e,o as _,c as o}from"./index.7e79e86a.js";const a={},c={class:"dashboard"};function r(s,t){return _(),o("div",c," \u521D\u671F\u8BBE\u60F3\uFF0C\u4F5C\u4E3A\u767B\u5F55\u7528\u6237\u7684\u529F\u80FD\u4E4B\u4E00\uFF0C\u53EF\u9009\u62E9\u5F0F\u7684\u6570\u636E\u62BD\u53D6 \u5305\u62EC\u7528\u6237\u76F8\u5173\u8D44\u6599\u7684\u5168\u90E8\u53D6\u56DE\u64CD\u4F5C\u3002 bookmark blog study cloud \u7B49\u7B49\u3002\u5E76\u6CA1\u6709\u6253\u7B97\u5728\u6BCF\u4E2A\u6A21\u5757\u4E0B\u63D0\u4F9B\u4E0B\u8F7D\u5DE5\u7A0B\uFF0C\u56E0\u4E3A\u6211\u8FD9\u4E2A\u4E0D\u662F\u9762\u5411\u4E1A\u52A1\u7684\u3002\u63D0\u4F9B\u4E0B\u8F7D\u5DE5\u7A0B\u65E0\u975E\u662F\u6015\u6570\u636E\u4E22\u5931\u800C\u5DF2\uFF0C\u4EC5\u9650\u4E8E\u6B64 ")}var d=e(a,[["render",r]]);export{d as default};
|
||||||
Vendored
BIN
Binary file not shown.
File diff suppressed because one or more lines are too long
Vendored
BIN
Binary file not shown.
@@ -1,4 +1,4 @@
|
|||||||
import{d as ZL,b as XL,B as qL,o as KL,c as QL}from"./index.ec680239.js";/*! *****************************************************************************
|
import{d as ZL,b as XL,B as qL,o as KL,c as QL}from"./index.7e79e86a.js";/*! *****************************************************************************
|
||||||
Copyright (c) Microsoft Corporation.
|
Copyright (c) Microsoft Corporation.
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
Binary file not shown.
Vendored
BIN
Binary file not shown.
@@ -1 +1 @@
|
|||||||
import{_ as e,o as _,c as a}from"./index.ec680239.js";const c={},n={class:"dashboard"};function r(s,t){return _(),a("div",n,"\u8FD9\u91CC\u6211\u60F3\u5206\u4EAB\u7684\u4E00\u4E9B\u4E1C\u897F\uFF0C\u65E0\u8BBA\u662F\u751F\u6D3B\u8FD8\u662F\u5DE5\u4F5C\uFF0C\u8FD8\u662F\u5B66\u79D1")}var d=e(c,[["render",r]]);export{d as default};
|
import{_ as e,o as _,c as a}from"./index.7e79e86a.js";const c={},n={class:"dashboard"};function r(s,t){return _(),a("div",n,"\u8FD9\u91CC\u6211\u60F3\u5206\u4EAB\u7684\u4E00\u4E9B\u4E1C\u897F\uFF0C\u65E0\u8BBA\u662F\u751F\u6D3B\u8FD8\u662F\u5DE5\u4F5C\uFF0C\u8FD8\u662F\u5B66\u79D1")}var d=e(c,[["render",r]]);export{d as default};
|
||||||
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
@@ -1 +1 @@
|
|||||||
import{_ as x,r as t,o as r,c as m,a as e,d as D,b as C,e as _,f as l,t as b,u as p,w,v as A,g as u,F as k,h as E,i as $,j as V,k as H,n as M,p as I,l as N}from"./index.ec680239.js";import{h as y}from"./moment.a9f98195.js";import{u as L}from"./user.0a83e69f.js";const U={},j={class:"section-main",style:{height:"100%"}};function z(a,s){const n=t("router-view");return r(),m("section",j,[e(n)])}var T=x(U,[["render",z]]);const q={class:"nav-main"},G=_("span",null,"\u8BBA\u4E00\u4E2A\u7A0B\u5E8F\u5458\u7684\u5BC2\u5BDE\u4E0E\u5FE7\u4F24",-1),J=l("profile"),K=l("\u9000\u51FA"),O=_("span",null,"\u786E\u8BA4\u4F60\u7684\u767B\u51FA\u64CD\u4F5C\u4E48\uFF1F",-1),P={class:"dialog-footer"},Q=l("\u53D6\u6D88"),R=l("\u786E\u8BA4"),W=D({setup(a){const s=L();s.reflush();const n=C(!1);let c=C(y().format("YYYY\u5E74MM\u6708DD\u65E5 HH:mm:ss"));setInterval(()=>{c.value=y().format("YYYY\u5E74MM\u6708DD\u65E5 HH:mm:ss")},1e3);const F=()=>{E.push({path:"/login"})},d=()=>{n.value=!1,s.logout(),E.push({path:"/home"})};return(f,o)=>{const v=t("el-avatar"),i=t("el-dropdown-item"),h=t("el-dropdown-menu"),S=t("el-dropdown"),g=t("el-button"),Y=t("el-dialog");return r(),m(k,null,[_("div",q,[l(" \u5F53\u524D\u65F6\u95F4\uFF1A"+b(p(c))+" ",1),G,w(e(S,{trigger:"click"},{dropdown:u(()=>[e(h,null,{default:u(()=>[e(i,null,{default:u(()=>[J]),_:1}),e(i,{onClick:o[0]||(o[0]=B=>n.value=!0)},{default:u(()=>[K]),_:1})]),_:1})]),default:u(()=>[e(v,{src:"https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png"})]),_:1},512),[[A,p(s).owner]]),w(_("span",{onClick:F},"\u767B\u5F55",512),[[A,!p(s).owner]])]),e(Y,{modelValue:n.value,"onUpdate:modelValue":o[2]||(o[2]=B=>n.value=B),title:"\u63D0\u793A",width:"30%"},{footer:u(()=>[_("span",P,[e(g,{onClick:o[1]||(o[1]=B=>n.value=!1)},{default:u(()=>[Q]),_:1}),e(g,{type:"primary",onClick:d},{default:u(()=>[R]),_:1})])]),default:u(()=>[O]),_:1},8,["modelValue"])],64)}}});const X=D({setup(a){let s=E.options.routes[0].children,n=C("");return $(()=>{n.value=window.innerHeight+"px"}),(c,F)=>{const d=t("el-menu-item"),f=t("el-menu");return r(),m("div",null,[e(f,{router:"",class:"side_Style",style:M({height:p(n)})},{default:u(()=>[(r(!0),m(k,null,V(p(s),(o,v)=>{var i;return r(),H(d,{key:v,index:o.path,title:(i=o.meta)==null?void 0:i.name},{default:u(()=>{var h;return[l(b((h=o.meta)==null?void 0:h.name),1)]}),_:2},1032,["index","title"])}),128))]),_:1},8,["style"])])}}});const Z=a=>(I("data-v-7c0e872a"),a=a(),N(),a),ee={class:"4444"},ue=Z(()=>_("span",null,[l(" \u672C\u7F51\u7AD9\u4E0D\u6D89\u53CA\u8272\u60C5\uFF0C\u8D4C\u535A\uFF0C\u6BD2\u54C1\u548C\u653F\u6CBB\u5B97\u6559\u7B49\u5185\u5BB9\uFF0C\u6682\u65F6\u4E3A\u4E2A\u4EBA\u5B66\u4E60\u7528\u9014\u3002 \u8003\u8651\u5230\u6CD5\u5F8B\u98CE\u9669\uFF0C\u9488\u5BF9\u6709\u654F\u611F\u8BCD\u6C47\u8FD8\u8BBE\u6709\u8FC7\u6EE4\u529F\u80FD\uFF0C\u6240\u4EE5\u6682\u65F6\u4E0D\u5BF9\u5916\u63D0\u4F9B\u4E00\u5207\u529F\u80FD\u3002 "),_("br"),l(" \u518D\u6B21\u91CD\u7533\uFF0C\u672C\u7F51\u7AD9\u53EA\u4F5C\u4E3A\u5B66\u4E60\u7F51\u7AD9\u3002\u3002\u3002\u3002\u3002\u3002 ")],-1)),te=D({setup(a){return(s,n)=>{const c=t("el-aside"),F=t("el-header"),d=t("el-main"),f=t("el-footer"),o=t("el-container");return r(),m("div",ee,[e(o,null,{default:u(()=>[e(c,{width:"150px"},{default:u(()=>[e(X)]),_:1}),e(o,null,{default:u(()=>[e(F,{style:{"border-bottom-style":"solid","border-bottom-width":"0.5px","border-bottom-color":"rgba(151, 151, 151, 0.3)"}},{default:u(()=>[e(W)]),_:1}),e(d,null,{default:u(()=>[e(T)]),_:1}),e(f,null,{default:u(()=>[ue]),_:1})]),_:1})]),_:1})])}}});var le=x(te,[["__scopeId","data-v-7c0e872a"]]);export{le as default};
|
import{_ as x,r as t,o as r,c as m,a as e,d as D,b as C,e as _,f as l,t as b,u as p,w,v as A,g as u,F as k,h as E,i as $,j as V,k as H,n as M,p as I,l as N}from"./index.7e79e86a.js";import{h as y}from"./moment.a9f98195.js";import{u as L}from"./user.56b1cdd8.js";const U={},j={class:"section-main",style:{height:"100%"}};function z(a,s){const n=t("router-view");return r(),m("section",j,[e(n)])}var T=x(U,[["render",z]]);const q={class:"nav-main"},G=_("span",null,"\u8BBA\u4E00\u4E2A\u7A0B\u5E8F\u5458\u7684\u5BC2\u5BDE\u4E0E\u5FE7\u4F24",-1),J=l("profile"),K=l("\u9000\u51FA"),O=_("span",null,"\u786E\u8BA4\u4F60\u7684\u767B\u51FA\u64CD\u4F5C\u4E48\uFF1F",-1),P={class:"dialog-footer"},Q=l("\u53D6\u6D88"),R=l("\u786E\u8BA4"),W=D({setup(a){const s=L();s.reflush();const n=C(!1);let c=C(y().format("YYYY\u5E74MM\u6708DD\u65E5 HH:mm:ss"));setInterval(()=>{c.value=y().format("YYYY\u5E74MM\u6708DD\u65E5 HH:mm:ss")},1e3);const F=()=>{E.push({path:"/login"})},d=()=>{n.value=!1,s.logout(),E.push({path:"/home"})};return(f,o)=>{const v=t("el-avatar"),i=t("el-dropdown-item"),h=t("el-dropdown-menu"),S=t("el-dropdown"),g=t("el-button"),Y=t("el-dialog");return r(),m(k,null,[_("div",q,[l(" \u5F53\u524D\u65F6\u95F4\uFF1A"+b(p(c))+" ",1),G,w(e(S,{trigger:"click"},{dropdown:u(()=>[e(h,null,{default:u(()=>[e(i,null,{default:u(()=>[J]),_:1}),e(i,{onClick:o[0]||(o[0]=B=>n.value=!0)},{default:u(()=>[K]),_:1})]),_:1})]),default:u(()=>[e(v,{src:"https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png"})]),_:1},512),[[A,p(s).owner]]),w(_("span",{onClick:F},"\u767B\u5F55",512),[[A,!p(s).owner]])]),e(Y,{modelValue:n.value,"onUpdate:modelValue":o[2]||(o[2]=B=>n.value=B),title:"\u63D0\u793A",width:"30%"},{footer:u(()=>[_("span",P,[e(g,{onClick:o[1]||(o[1]=B=>n.value=!1)},{default:u(()=>[Q]),_:1}),e(g,{type:"primary",onClick:d},{default:u(()=>[R]),_:1})])]),default:u(()=>[O]),_:1},8,["modelValue"])],64)}}});const X=D({setup(a){let s=E.options.routes[0].children,n=C("");return $(()=>{n.value=window.innerHeight+"px"}),(c,F)=>{const d=t("el-menu-item"),f=t("el-menu");return r(),m("div",null,[e(f,{router:"",class:"side_Style",style:M({height:p(n)})},{default:u(()=>[(r(!0),m(k,null,V(p(s),(o,v)=>{var i;return r(),H(d,{key:v,index:o.path,title:(i=o.meta)==null?void 0:i.name},{default:u(()=>{var h;return[l(b((h=o.meta)==null?void 0:h.name),1)]}),_:2},1032,["index","title"])}),128))]),_:1},8,["style"])])}}});const Z=a=>(I("data-v-7c0e872a"),a=a(),N(),a),ee={class:"4444"},ue=Z(()=>_("span",null,[l(" \u672C\u7F51\u7AD9\u4E0D\u6D89\u53CA\u8272\u60C5\uFF0C\u8D4C\u535A\uFF0C\u6BD2\u54C1\u548C\u653F\u6CBB\u5B97\u6559\u7B49\u5185\u5BB9\uFF0C\u6682\u65F6\u4E3A\u4E2A\u4EBA\u5B66\u4E60\u7528\u9014\u3002 \u8003\u8651\u5230\u6CD5\u5F8B\u98CE\u9669\uFF0C\u9488\u5BF9\u6709\u654F\u611F\u8BCD\u6C47\u8FD8\u8BBE\u6709\u8FC7\u6EE4\u529F\u80FD\uFF0C\u6240\u4EE5\u6682\u65F6\u4E0D\u5BF9\u5916\u63D0\u4F9B\u4E00\u5207\u529F\u80FD\u3002 "),_("br"),l(" \u518D\u6B21\u91CD\u7533\uFF0C\u672C\u7F51\u7AD9\u53EA\u4F5C\u4E3A\u5B66\u4E60\u7F51\u7AD9\u3002\u3002\u3002\u3002\u3002\u3002 ")],-1)),te=D({setup(a){return(s,n)=>{const c=t("el-aside"),F=t("el-header"),d=t("el-main"),f=t("el-footer"),o=t("el-container");return r(),m("div",ee,[e(o,null,{default:u(()=>[e(c,{width:"150px"},{default:u(()=>[e(X)]),_:1}),e(o,null,{default:u(()=>[e(F,{style:{"border-bottom-style":"solid","border-bottom-width":"0.5px","border-bottom-color":"rgba(151, 151, 151, 0.3)"}},{default:u(()=>[e(W)]),_:1}),e(d,null,{default:u(()=>[e(T)]),_:1}),e(f,null,{default:u(()=>[ue]),_:1})]),_:1})]),_:1})])}}});var le=x(te,[["__scopeId","data-v-7c0e872a"]]);export{le as default};
|
||||||
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
File diff suppressed because one or more lines are too long
Vendored
BIN
Binary file not shown.
@@ -1 +1 @@
|
|||||||
import{E as n}from"./style.843d539d.js";import{d as u,b as l,N as i,o as m,k as p,u as r,I as d}from"./index.ec680239.js";import{c}from"./blogView.d2987280.js";import"./index.715e6999.js";const g=u({setup(f){let e=l("");const s=i().query;return(()=>{c(s.bid).then(t=>{e.value=t.data.content})})(),(t,o)=>(m(),p(r(n),{modelValue:r(e),"onUpdate:modelValue":o[0]||(o[0]=a=>d(e)?e.value=a:e=a),previewOnly:""},null,8,["modelValue"]))}});export{g as default};
|
import{E as n}from"./style.a85979ed.js";import{d as u,b as l,N as i,o as m,k as p,u as r,I as d}from"./index.7e79e86a.js";import{c}from"./blogView.48abb2a7.js";import"./index.376e6601.js";const g=u({setup(f){let e=l("");const s=i().query;return(()=>{c(s.bid).then(t=>{e.value=t.data.content})})(),(t,o)=>(m(),p(r(n),{modelValue:r(e),"onUpdate:modelValue":o[0]||(o[0]=a=>d(e)?e.value=a:e=a),previewOnly:""},null,8,["modelValue"]))}});export{g as default};
|
||||||
Vendored
BIN
Binary file not shown.
File diff suppressed because one or more lines are too long
Vendored
BIN
Binary file not shown.
@@ -1 +1 @@
|
|||||||
var m=Object.defineProperty,h=Object.defineProperties;var d=Object.getOwnPropertyDescriptors;var a=Object.getOwnPropertySymbols;var f=Object.prototype.hasOwnProperty,g=Object.prototype.propertyIsEnumerable;var o=(t,s,e)=>s in t?m(t,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[s]=e,n=(t,s)=>{for(var e in s||(s={}))f.call(s,e)&&o(t,e,s[e]);if(a)for(var e of a(s))g.call(s,e)&&o(t,e,s[e]);return t},r=(t,s)=>h(t,d(s));import{m as k,q as l,s as p,x as w,y,z as i,A as z}from"./index.ec680239.js";const U=k({id:"user",state:()=>({name:"",token:"",owner:!1}),getters:{},actions:{logout(){this.$patch({name:"",token:"",owner:!1}),l()},async login(t,s){const e=await p({user_id:t,user_password:s});return e.data.token&&(this.$patch(r(n({name:t},e.data),{owner:!0})),w(e.data.token),y(e),console.log("authorize success!")),new Promise((c,u)=>{e.data.message?u(e.data.message):c(e.data)})},async reflush(){if(i()){const t=JSON.parse(z()),s=i();this.$patch({name:t.id,token:s,owner:!0})}}}});export{U as u};
|
var m=Object.defineProperty,h=Object.defineProperties;var d=Object.getOwnPropertyDescriptors;var a=Object.getOwnPropertySymbols;var f=Object.prototype.hasOwnProperty,g=Object.prototype.propertyIsEnumerable;var o=(t,s,e)=>s in t?m(t,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[s]=e,n=(t,s)=>{for(var e in s||(s={}))f.call(s,e)&&o(t,e,s[e]);if(a)for(var e of a(s))g.call(s,e)&&o(t,e,s[e]);return t},r=(t,s)=>h(t,d(s));import{m as k,q as l,s as p,x as w,y,z as i,A as z}from"./index.7e79e86a.js";const U=k({id:"user",state:()=>({name:"",token:"",owner:!1}),getters:{},actions:{logout(){this.$patch({name:"",token:"",owner:!1}),l()},async login(t,s){const e=await p({user_id:t,user_password:s});return e.data.token&&(this.$patch(r(n({name:t},e.data),{owner:!0})),w(e.data.token),y(e),console.log("authorize success!")),new Promise((c,u)=>{e.data.message?u(e.data.message):c(e.data)})},async reflush(){if(i()){const t=JSON.parse(z()),s=i();this.$patch({name:t.id,token:s,owner:!0})}}}});export{U as u};
|
||||||
Vendored
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
<link rel="icon" href="/favicon.ico" />
|
<link rel="icon" href="/favicon.ico" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>violin-home-manage</title>
|
<title>violin-home-manage</title>
|
||||||
<script type="module" crossorigin src="/assets/index.ec680239.js"></script>
|
<script type="module" crossorigin src="/assets/index.7e79e86a.js"></script>
|
||||||
<link rel="stylesheet" href="/assets/index.c85c68cc.css">
|
<link rel="stylesheet" href="/assets/index.c85c68cc.css">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -7,7 +7,8 @@ const headers = {
|
|||||||
const listAll = () => {
|
const listAll = () => {
|
||||||
return request({
|
return request({
|
||||||
url: '/auth/api/v1/author/blog/list',
|
url: '/auth/api/v1/author/blog/list',
|
||||||
method: 'GET'
|
method: 'GET',
|
||||||
|
headers: headers
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-5
@@ -3,7 +3,7 @@ import request from '../utils/request'
|
|||||||
const get_notes = (params: Object) => {
|
const get_notes = (params: Object) => {
|
||||||
return request({
|
return request({
|
||||||
url: '/auth/api/v1/one_note',
|
url: '/auth/api/v1/one_note',
|
||||||
method: 'get',
|
method: 'GET',
|
||||||
params: params
|
params: params
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -11,7 +11,7 @@ const get_notes = (params: Object) => {
|
|||||||
const update_page = (params: Object) => {
|
const update_page = (params: Object) => {
|
||||||
return request({
|
return request({
|
||||||
url: '/auth/api/v1/one_note/update_page',
|
url: '/auth/api/v1/one_note/update_page',
|
||||||
method: 'post',
|
method: 'POST',
|
||||||
data: params
|
data: params
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -19,7 +19,7 @@ const update_page = (params: Object) => {
|
|||||||
const update_section = (params: Object) => {
|
const update_section = (params: Object) => {
|
||||||
return request({
|
return request({
|
||||||
url: '/auth/api/v1/one_note/update_section',
|
url: '/auth/api/v1/one_note/update_section',
|
||||||
method: 'post',
|
method: 'POST',
|
||||||
data: params
|
data: params
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -27,14 +27,14 @@ const update_section = (params: Object) => {
|
|||||||
const insert_section = () => {
|
const insert_section = () => {
|
||||||
return request({
|
return request({
|
||||||
url: '/auth/api/v1/one_note/insert_section',
|
url: '/auth/api/v1/one_note/insert_section',
|
||||||
method: 'put'
|
method: 'PUT'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const insert_page = (params: Object) => {
|
const insert_page = (params: Object) => {
|
||||||
return request({
|
return request({
|
||||||
url: '/auth/one_note/insert_page',
|
url: '/auth/one_note/insert_page',
|
||||||
method: 'put',
|
method: 'PUT',
|
||||||
data: params
|
data: params
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-1
@@ -15,4 +15,12 @@ const obtainUserInfo = (token: string) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export { authorize, obtainUserInfo }
|
const logout = (id: string) => {
|
||||||
|
return request({
|
||||||
|
url: '/auth/api/v1/logout/' + id,
|
||||||
|
method: 'GET'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export { authorize, obtainUserInfo, logout }
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<template>
|
||||||
|
<span class="dialog-footer">
|
||||||
|
当你看到了,这个页面,这表示了,你通过百度扫描登陆了我的秘密基地,但是很遗憾的告诉你,我们将以非法登录的方式处理你的请求,88
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.dashboard {
|
||||||
|
background-color: beige;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
<div class="nav-main">
|
<div class="nav-main">
|
||||||
当前时间:{{ time }}
|
当前时间:{{ time }}
|
||||||
<span>论一个程序员的寂寞与忧伤</span>
|
<span>论一个程序员的寂寞与忧伤</span>
|
||||||
<el-dropdown trigger="click" v-show="user.owner">
|
<el-dropdown trigger="click" v-show="tenant.account">
|
||||||
<el-avatar src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png" />
|
<el-avatar src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png" />
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<el-dropdown-menu>
|
<el-dropdown-menu>
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
<span @click="doLogin" v-show="!user.owner">登录</span>
|
<span @click="doLogin" v-show="!tenant.account">登录</span>
|
||||||
</div>
|
</div>
|
||||||
<el-dialog v-model="dialogVisible" title="提示" width="30%">
|
<el-dialog v-model="dialogVisible" title="提示" width="30%">
|
||||||
<span>确认你的登出操作么?</span>
|
<span>确认你的登出操作么?</span>
|
||||||
@@ -28,10 +28,11 @@
|
|||||||
import $moment from "moment";
|
import $moment from "moment";
|
||||||
import { reactive, ref } from "vue";
|
import { reactive, ref } from "vue";
|
||||||
import router from '../../router'
|
import router from '../../router'
|
||||||
import { useUserStore } from '../../store/user'
|
import { useTenantStore } from '../../store/tenant'
|
||||||
|
import { logout } from '../../api/user'
|
||||||
// obtain user infomation
|
// obtain user infomation
|
||||||
const user = useUserStore()
|
const tenant = useTenantStore()
|
||||||
user.reflush()
|
tenant.reflush()
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
|
|
||||||
// show time
|
// show time
|
||||||
@@ -48,9 +49,11 @@ const doLogin = () => {
|
|||||||
}
|
}
|
||||||
const doLogout = () => {
|
const doLogout = () => {
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
user.logout()
|
logout(tenant.id).then(() => {
|
||||||
router.push({
|
tenant.logout()
|
||||||
path: '/home'
|
router.push({
|
||||||
|
path: '/login'
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -34,15 +34,15 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { reactive, ref } from 'vue'
|
import { reactive, ref } from 'vue'
|
||||||
import type { FormInstance } from 'element-plus'
|
import type { FormInstance } from 'element-plus'
|
||||||
import { useUserStore } from '../../store/user'
|
import { useTenantStore } from '../../store/tenant'
|
||||||
import router from '../../router'
|
import router from '../../router'
|
||||||
import baiduCloudImage from "../../assets/baiducloud.png"
|
import baiduCloudImage from "../../assets/baiducloud.png"
|
||||||
import config from '../../const/config'
|
import config from '../../const/config'
|
||||||
import { getQrCode } from '../../api/login'
|
|
||||||
|
|
||||||
let qrcode = config.BAIDU_CLOUD_URL + config.RESPONSE_TYPE + config.CLIENT_ID + config.REDIRECT_URI + config.SCOPE + config.DEVICE_ID + config.QR_CODE + config.DISPLAY
|
let qrcode = config.BAIDU_CLOUD_URL + config.RESPONSE_TYPE + config.CLIENT_ID + config.REDIRECT_URI + config.SCOPE + config.DEVICE_ID + config.QR_CODE + config.DISPLAY
|
||||||
|
|
||||||
const user = useUserStore()
|
const tenant = useTenantStore()
|
||||||
|
|
||||||
const ruleFormRef = ref<FormInstance>()
|
const ruleFormRef = ref<FormInstance>()
|
||||||
const loginForm = reactive({
|
const loginForm = reactive({
|
||||||
@@ -50,13 +50,6 @@ const loginForm = reactive({
|
|||||||
password: ''
|
password: ''
|
||||||
})
|
})
|
||||||
|
|
||||||
const loginWithBaiDu = () => {
|
|
||||||
window.open("", "11");
|
|
||||||
// getQrCode().then((response) => {
|
|
||||||
|
|
||||||
// })
|
|
||||||
}
|
|
||||||
|
|
||||||
const validateUserName = (rule: any, value: string, callback: Function) => {
|
const validateUserName = (rule: any, value: string, callback: Function) => {
|
||||||
if (!value) {
|
if (!value) {
|
||||||
callback(new Error("请输入的用户名"))
|
callback(new Error("请输入的用户名"))
|
||||||
@@ -83,7 +76,7 @@ const dologin = (form: any) => {
|
|||||||
return
|
return
|
||||||
form.validate((valid: any) => {
|
form.validate((valid: any) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
user.login(loginForm.user_id, loginForm.password).then(res => {
|
tenant.login(loginForm.user_id, loginForm.password).then(res => {
|
||||||
console.log(1)
|
console.log(1)
|
||||||
router.push({
|
router.push({
|
||||||
path: '/home'
|
path: '/home'
|
||||||
|
|||||||
+3
-3
@@ -1,6 +1,6 @@
|
|||||||
type User = {
|
type Tenant = {
|
||||||
id: string,
|
id: string,
|
||||||
username: string
|
account: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export { User }
|
export { Tenant }
|
||||||
|
|||||||
+25
-11
@@ -12,8 +12,8 @@ let app = createApp(App)
|
|||||||
app.use(router)
|
app.use(router)
|
||||||
app.use(ElementPlus)
|
app.use(ElementPlus)
|
||||||
app.use(store)
|
app.use(store)
|
||||||
import { getToken, getUser, setToken, setUser } from './utils/auth'
|
import { getToken, getTenant, setToken, setTenant } from './utils/auth'
|
||||||
import { User } from './entity/index'
|
import { Tenant } from './entity/index'
|
||||||
import Cookies from 'js-cookie'
|
import Cookies from 'js-cookie'
|
||||||
import { obtainUserInfo } from './api/user'
|
import { obtainUserInfo } from './api/user'
|
||||||
const whiteList = ['/login']
|
const whiteList = ['/login']
|
||||||
@@ -21,13 +21,29 @@ let url = window.location.href
|
|||||||
|
|
||||||
async function checktoken(url: string) {
|
async function checktoken(url: string) {
|
||||||
if (url.search("token") != -1) {
|
if (url.search("token") != -1) {
|
||||||
let authorizeToken = url.split("token=")[1]
|
|
||||||
setToken(authorizeToken)
|
const list = url.split("?token=")
|
||||||
|
|
||||||
|
let base_url = list[0]
|
||||||
|
let authorizeToken = list[1]
|
||||||
|
if (list.length < 2 || authorizeToken.length == 0) {
|
||||||
|
router.push({
|
||||||
|
path: '/illustration',
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
await obtainUserInfo(authorizeToken).then(response => {
|
await obtainUserInfo(authorizeToken).then(response => {
|
||||||
setUser(response.data)
|
|
||||||
|
if (response.status == 200) {
|
||||||
|
const tenant = {
|
||||||
|
id: response.data.id,
|
||||||
|
account: response.data.account
|
||||||
|
}
|
||||||
|
setToken(authorizeToken)
|
||||||
|
setTenant(tenant)
|
||||||
|
window.open(base_url, "_self")
|
||||||
|
}
|
||||||
})
|
})
|
||||||
let base_url = url.split("?token=")[0]
|
|
||||||
window.open(base_url, "_self")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
checktoken(url)
|
checktoken(url)
|
||||||
@@ -52,7 +68,7 @@ router.beforeEach((to, from, next) => {
|
|||||||
next('/')
|
next('/')
|
||||||
break;
|
break;
|
||||||
case '/':
|
case '/':
|
||||||
const user = <User>(JSON.parse(getUser() as string))
|
const tenant = <Tenant>(JSON.parse(getTenant() as string))
|
||||||
if (url.search("write") != -1) {
|
if (url.search("write") != -1) {
|
||||||
next('/BlogEditer')
|
next('/BlogEditer')
|
||||||
} else if (url.search("view") != -1) {
|
} else if (url.search("view") != -1) {
|
||||||
@@ -61,12 +77,10 @@ router.beforeEach((to, from, next) => {
|
|||||||
path: '/BlogViewer',
|
path: '/BlogViewer',
|
||||||
query: { bid: bid }
|
query: { bid: bid }
|
||||||
})
|
})
|
||||||
// next('/BlogViewer')
|
|
||||||
console.log(1)
|
|
||||||
} else {
|
} else {
|
||||||
router.push({
|
router.push({
|
||||||
path: '/home',
|
path: '/home',
|
||||||
query: user
|
query: tenant
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
+5
-1
@@ -78,7 +78,11 @@ const routes: Array<RouteRecordRaw> = [
|
|||||||
{
|
{
|
||||||
path: "/login",
|
path: "/login",
|
||||||
component: () => import('../components/login/login.vue')
|
component: () => import('../components/login/login.vue')
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
path: "/illustration",
|
||||||
|
component: () => import('../components/illustration/index.vue')
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,81 @@
|
|||||||
|
import { defineStore, acceptHMRUpdate } from 'pinia'
|
||||||
|
import { authorize } from '../api/user'
|
||||||
|
import { getToken, setToken, resetToken, setTenant, getTenant } from '../utils/auth'
|
||||||
|
import { Tenant } from '../entity/index'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simulate a login
|
||||||
|
* @param {string} a
|
||||||
|
* @param {string} p
|
||||||
|
*/
|
||||||
|
// function apiLogin(a, p) {
|
||||||
|
// if (a === 'ed' && p === 'ed') return Promise.resolve({ isAdmin: true })
|
||||||
|
// if (p === 'ed') return Promise.resolve({ isAdmin: false })
|
||||||
|
// return Promise.reject(new Error('invalid credentials'))
|
||||||
|
// }
|
||||||
|
|
||||||
|
export const useTenantStore = defineStore({
|
||||||
|
id: 'tenant',
|
||||||
|
state: () => ({
|
||||||
|
account: '',
|
||||||
|
token: '',
|
||||||
|
id: ''
|
||||||
|
}),
|
||||||
|
|
||||||
|
getters: {
|
||||||
|
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
logout() {
|
||||||
|
this.$patch({
|
||||||
|
account: '',
|
||||||
|
token: '',
|
||||||
|
id: ''
|
||||||
|
})
|
||||||
|
resetToken()
|
||||||
|
// we could do other stuff like redirecting the user
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempt to login a user
|
||||||
|
* @param {string} user_id
|
||||||
|
* @param {string} user_password
|
||||||
|
*/
|
||||||
|
// async login(user_id: string, user_password: string) {
|
||||||
|
// const userData = await authorize({ user_id, user_password })
|
||||||
|
// if (userData.data.token) {
|
||||||
|
// this.$patch({
|
||||||
|
// account: user_id,
|
||||||
|
|
||||||
|
// ...userData.data,
|
||||||
|
// id: 'true'
|
||||||
|
// })
|
||||||
|
// setToken(userData.data.token)
|
||||||
|
// setTenant(userData)
|
||||||
|
// console.log('authorize success!')
|
||||||
|
// }
|
||||||
|
// return new Promise((resolve, reject) => {
|
||||||
|
// if (userData.data.message) {
|
||||||
|
// reject(userData.data.message)
|
||||||
|
// } else {
|
||||||
|
// resolve(userData.data)
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// },
|
||||||
|
async reflush() {
|
||||||
|
if (getToken()) {
|
||||||
|
const tenant = <Tenant>(JSON.parse(getTenant() as string))
|
||||||
|
const token = <string>getToken()
|
||||||
|
this.$patch({
|
||||||
|
account: tenant.account,
|
||||||
|
token: token,
|
||||||
|
id: tenant.id
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
if (import.meta.hot) {
|
||||||
|
import.meta.hot.accept(acceptHMRUpdate(useTenantStore, import.meta.hot))
|
||||||
|
}
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
import { defineStore, acceptHMRUpdate } from 'pinia'
|
|
||||||
import { authorize } from '../api/user'
|
|
||||||
import { getToken, setToken, resetToken, setUser, getUser } from '../utils/auth'
|
|
||||||
import { User } from '../entity/index'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Simulate a login
|
|
||||||
* @param {string} a
|
|
||||||
* @param {string} p
|
|
||||||
*/
|
|
||||||
// function apiLogin(a, p) {
|
|
||||||
// if (a === 'ed' && p === 'ed') return Promise.resolve({ isAdmin: true })
|
|
||||||
// if (p === 'ed') return Promise.resolve({ isAdmin: false })
|
|
||||||
// return Promise.reject(new Error('invalid credentials'))
|
|
||||||
// }
|
|
||||||
|
|
||||||
export const useUserStore = defineStore({
|
|
||||||
id: 'user',
|
|
||||||
state: () => ({
|
|
||||||
name: '',
|
|
||||||
token: '',
|
|
||||||
owner: false
|
|
||||||
}),
|
|
||||||
|
|
||||||
getters: {
|
|
||||||
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
logout() {
|
|
||||||
this.$patch({
|
|
||||||
name: '',
|
|
||||||
token: '',
|
|
||||||
owner: false
|
|
||||||
})
|
|
||||||
resetToken()
|
|
||||||
// we could do other stuff like redirecting the user
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Attempt to login a user
|
|
||||||
* @param {string} user_id
|
|
||||||
* @param {string} user_password
|
|
||||||
*/
|
|
||||||
async login(user_id: string, user_password: string) {
|
|
||||||
const userData = await authorize({ user_id, user_password })
|
|
||||||
if (userData.data.token) {
|
|
||||||
this.$patch({
|
|
||||||
name: user_id,
|
|
||||||
|
|
||||||
...userData.data,
|
|
||||||
owner: true
|
|
||||||
})
|
|
||||||
setToken(userData.data.token)
|
|
||||||
setUser(userData)
|
|
||||||
console.log('authorize success!')
|
|
||||||
}
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
if (userData.data.message) {
|
|
||||||
reject(userData.data.message)
|
|
||||||
} else {
|
|
||||||
resolve(userData.data)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
async reflush() {
|
|
||||||
if (getToken()) {
|
|
||||||
const user = <User>(JSON.parse(getUser() as string))
|
|
||||||
const token = <string>getToken()
|
|
||||||
this.$patch({
|
|
||||||
name: user.id,
|
|
||||||
token: token,
|
|
||||||
owner: true
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
if (import.meta.hot) {
|
|
||||||
import.meta.hot.accept(acceptHMRUpdate(useUserStore, import.meta.hot))
|
|
||||||
}
|
|
||||||
+6
-6
@@ -8,17 +8,17 @@ const setToken = (token: String) => {
|
|||||||
Cookies.set('token', token)
|
Cookies.set('token', token)
|
||||||
}
|
}
|
||||||
|
|
||||||
const setUser = (user: object) => {
|
const setTenant = (tenant: object) => {
|
||||||
Cookies.set('user', JSON.stringify(user))
|
Cookies.set('tenant', JSON.stringify(tenant))
|
||||||
}
|
}
|
||||||
|
|
||||||
const getUser = () => {
|
const getTenant = () => {
|
||||||
return Cookies.get('user')
|
return Cookies.get('tenant')
|
||||||
}
|
}
|
||||||
|
|
||||||
const resetToken = () => {
|
const resetToken = () => {
|
||||||
Cookies.remove('token')
|
Cookies.remove('token')
|
||||||
Cookies.remove('user')
|
Cookies.remove('tenant')
|
||||||
}
|
}
|
||||||
|
|
||||||
export { getToken, setToken, resetToken, setUser, getUser }
|
export { getToken, setToken, resetToken, setTenant, getTenant }
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { getToken } from '../utils/auth'
|
import { getToken, getTenant } from '../utils/auth'
|
||||||
|
|
||||||
const service = axios.create(
|
const service = axios.create(
|
||||||
{
|
{
|
||||||
@@ -13,6 +13,11 @@ service.interceptors.request.use(
|
|||||||
if (typeof getToken() === 'string') {
|
if (typeof getToken() === 'string') {
|
||||||
(config as any).headers['Authorization'] = 'Bearer' + getToken()
|
(config as any).headers['Authorization'] = 'Bearer' + getToken()
|
||||||
}
|
}
|
||||||
|
const tenant = getTenant()
|
||||||
|
if (typeof tenant === 'string') {
|
||||||
|
(config as any).headers['id'] = JSON.parse(tenant).id
|
||||||
|
}
|
||||||
|
|
||||||
return config
|
return config
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div class="create_dialog">
|
<div class="create_dialog">
|
||||||
<el-button type="primary" @click="handleInsert" v-show="user.owner">新建</el-button>
|
<el-button type="primary" @click="handleInsert" v-show="Tenant.account">新建</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-table ref="multipleTableRef" :data="tableData" @selection-change="handleSelectionChange" style="width: 100%">
|
<el-table ref="multipleTableRef" :data="tableData" @selection-change="handleSelectionChange" style="width: 100%">
|
||||||
@@ -36,9 +36,11 @@
|
|||||||
<el-icon :size="20" @click="copyNumber(scope.row)" class="click-icon">
|
<el-icon :size="20" @click="copyNumber(scope.row)" class="click-icon">
|
||||||
<CopyDocument />
|
<CopyDocument />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<el-button class="click-icon" size="small" @click="handleEdit(scope.$index, scope.row)" v-show="user.owner">编辑
|
<el-button class="click-icon" size="small" @click="handleEdit(scope.$index, scope.row)"
|
||||||
|
v-show="Tenant.account">编辑
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button size="small" type="danger" @click="handleDelete(scope.$index, scope.row)" v-show="user.owner">删除
|
<el-button size="small" type="danger" @click="handleDelete(scope.$index, scope.row)" v-show="Tenant.account">
|
||||||
|
删除
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@@ -70,9 +72,9 @@ import { CopyDocument } from "@element-plus/icons-vue";
|
|||||||
import { ElNotification } from 'element-plus'
|
import { ElNotification } from 'element-plus'
|
||||||
import copy from 'copy-to-clipboard';
|
import copy from 'copy-to-clipboard';
|
||||||
import { h } from 'vue'
|
import { h } from 'vue'
|
||||||
import { useUserStore } from '../../store/user'
|
import { useTenantStore } from '../../store/tenant'
|
||||||
// obtain user infomation
|
// obtain user infomation
|
||||||
const user = useUserStore()
|
const Tenant = useTenantStore()
|
||||||
|
|
||||||
const bookmark_types = reactive<any[]>([])
|
const bookmark_types = reactive<any[]>([])
|
||||||
bookmark_type().then(response => {
|
bookmark_type().then(response => {
|
||||||
|
|||||||
Reference in New Issue
Block a user