@pangu-backend-ui/user-core 0.0.10 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defineComponent as U, ref as h, inject as C, resolveComponent as c, openBlock as _, createElementBlock as T, Fragment as I, createTextVNode as m, toDisplayString as g, createBlock as w, withCtx as t, createVNode as e, createCommentVNode as k, watch as E, computed as $, resolveDirective as z, withDirectives as O, renderList as B, resolveDynamicComponent as F, createElementVNode as x, unref as H, pushScopeId as A, popScopeId as Y } from "vue";
1
+ import { defineComponent as U, ref as h, inject as S, resolveComponent as p, openBlock as _, createElementBlock as T, Fragment as I, createTextVNode as m, toDisplayString as g, createBlock as w, withCtx as t, createVNode as e, createCommentVNode as k, watch as E, computed as $, resolveDirective as z, withDirectives as O, renderList as B, resolveDynamicComponent as F, createElementVNode as x, unref as H, pushScopeId as A, popScopeId as Y } from "vue";
2
2
  import { defineStore as j } from "pinia";
3
3
  import { PgTable as G } from "@pangu-backend-ui/common";
4
4
  const W = {
@@ -20,7 +20,7 @@ const W = {
20
20
  const o = a, l = h({
21
21
  plainMobile: null,
22
22
  loading: !1
23
- }), r = C("http");
23
+ }), r = S("http");
24
24
  function v() {
25
25
  l.value.plainMobile == null && (l.value.loading = !0, r == null || r.get(`/api/user/${o.userId}/plainmobile`).then((s) => {
26
26
  l.value.plainMobile = s.data, l.value.loading = !1;
@@ -28,8 +28,8 @@ const W = {
28
28
  l.value.loading = !1;
29
29
  }));
30
30
  }
31
- return (s, p) => {
32
- const u = c("View"), b = c("el-icon"), y = c("Loading");
31
+ return (s, c) => {
32
+ const u = p("View"), b = p("el-icon"), y = p("Loading");
33
33
  return o.maskMobile != null ? (_(), T("div", W, [
34
34
  l.value.plainMobile == null ? (_(), T(I, { key: 0 }, [
35
35
  m(g(o.maskMobile), 1)
@@ -64,13 +64,13 @@ const M = (a, o) => {
64
64
  for (const [r, v] of o)
65
65
  l[r] = v;
66
66
  return l;
67
- }, S = /* @__PURE__ */ M(q, [["__scopeId", "data-v-76c9c9ae"]]), J = {
67
+ }, C = /* @__PURE__ */ M(q, [["__scopeId", "data-v-76c9c9ae"]]), J = {
68
68
  install: (a) => {
69
- a.component("PgUserMobile", S);
69
+ a.component("PgUserMobile", C);
70
70
  }
71
71
  };
72
72
  function K() {
73
- const a = C("http");
73
+ const a = S("http");
74
74
  function o(l) {
75
75
  return a == null ? void 0 : a.get(`/api/user/${l}`);
76
76
  }
@@ -87,15 +87,15 @@ const Q = /* @__PURE__ */ U({
87
87
  loginTimeStart: null,
88
88
  loginTimeEnd: null
89
89
  }), r = h([]);
90
- E(r, (p) => {
91
- p ? (l.value.loginTimeStart = p[0], l.value.loginTimeEnd = p[1]) : (l.value.loginTimeStart = null, l.value.loginTimeEnd = null), console.log(l.value.loginTimeStart, l.value.loginTimeEnd);
90
+ E(r, (c) => {
91
+ c ? (l.value.loginTimeStart = c[0], l.value.loginTimeEnd = c[1]) : (l.value.loginTimeStart = null, l.value.loginTimeEnd = null);
92
92
  });
93
93
  const v = h();
94
94
  function s() {
95
95
  v.value.search();
96
96
  }
97
- return (p, u) => {
98
- const b = c("el-date-picker"), y = c("el-button"), f = c("el-space"), i = c("el-table-column"), d = c("el-tag"), V = c("pg-table");
97
+ return (c, u) => {
98
+ const b = p("el-date-picker"), y = p("el-button"), f = p("el-space"), i = p("el-table-column"), d = p("el-tag"), V = p("pg-table");
99
99
  return _(), T(I, null, [
100
100
  e(f, null, {
101
101
  default: t(() => [
@@ -232,20 +232,20 @@ const Q = /* @__PURE__ */ U({
232
232
  }), L = /* @__PURE__ */ U({
233
233
  __name: "UserDetailDialog",
234
234
  setup(a, { expose: o }) {
235
- const { getUserDetail: l } = K(), r = N(), v = h(!1), s = h(), p = h({
235
+ const { getUserDetail: l } = K(), r = N(), v = h(!1), s = h(), c = h({
236
236
  activeName: r.userDetailDialogTabs[0].code,
237
237
  tabs: []
238
238
  }), u = h(!1);
239
239
  function b(y, f) {
240
240
  var i;
241
241
  u.value = !0, (i = l(y)) == null || i.then((d) => {
242
- s.value = d.data, u.value = !1, v.value = !0, p.value.tabs.length = 0, p.value.tabs = p.value.tabs.concat(r.userDetailDialogTabs), f && (p.value.tabs = p.value.tabs.concat(f));
242
+ s.value = d.data, u.value = !1, v.value = !0, c.value.tabs.length = 0, c.value.tabs = c.value.tabs.concat(r.userDetailDialogTabs), f && (c.value.tabs = c.value.tabs.concat(f));
243
243
  });
244
244
  }
245
245
  return o({
246
246
  show: b
247
247
  }), (y, f) => {
248
- const i = c("el-descriptions-item"), d = c("el-descriptions"), V = c("el-tab-pane"), n = c("el-tabs"), P = c("el-dialog"), R = z("loading");
248
+ const i = p("el-descriptions-item"), d = p("el-descriptions"), V = p("el-tab-pane"), n = p("el-tabs"), P = p("el-dialog"), R = z("loading");
249
249
  return O((_(), w(P, {
250
250
  modelValue: v.value,
251
251
  "onUpdate:modelValue": f[1] || (f[1] = (D) => v.value = D),
@@ -269,7 +269,7 @@ const Q = /* @__PURE__ */ U({
269
269
  }),
270
270
  e(i, { label: "手机号码" }, {
271
271
  default: t(() => [
272
- (_(), w(S, {
272
+ (_(), w(C, {
273
273
  "mask-mobile": s.value.mobile,
274
274
  "user-id": s.value.id,
275
275
  key: s.value.id
@@ -323,13 +323,13 @@ const Q = /* @__PURE__ */ U({
323
323
  _: 1
324
324
  }),
325
325
  e(n, {
326
- modelValue: p.value.activeName,
327
- "onUpdate:modelValue": f[0] || (f[0] = (D) => p.value.activeName = D),
326
+ modelValue: c.value.activeName,
327
+ "onUpdate:modelValue": f[0] || (f[0] = (D) => c.value.activeName = D),
328
328
  style: { "margin-top": "10px" },
329
329
  type: "border-card"
330
330
  }, {
331
331
  default: t(() => [
332
- (_(!0), T(I, null, B(p.value.tabs, (D, se) => (_(), w(V, {
332
+ (_(!0), T(I, null, B(c.value.tabs, (D, se) => (_(), w(V, {
333
333
  label: D.name,
334
334
  name: D.code,
335
335
  key: `user_detail_dialog_${D.code}`
@@ -372,11 +372,11 @@ const Q = /* @__PURE__ */ U({
372
372
  l.value.search();
373
373
  }
374
374
  const v = h();
375
- function s(p) {
376
- v.value.show(p.id);
375
+ function s(c) {
376
+ v.value.show(c.id);
377
377
  }
378
- return (p, u) => {
379
- const b = c("el-input"), y = c("el-button"), f = c("el-space"), i = c("el-card"), d = c("el-table-column"), V = c("el-image");
378
+ return (c, u) => {
379
+ const b = p("el-input"), y = p("el-button"), f = p("el-space"), i = p("el-card"), d = p("el-table-column"), V = p("el-image");
380
380
  return _(), T(I, null, [
381
381
  x("div", le, [
382
382
  e(i, null, {
@@ -457,7 +457,7 @@ const Q = /* @__PURE__ */ U({
457
457
  "show-overflow-tooltip": ""
458
458
  }, {
459
459
  default: t((n) => [
460
- (_(), w(S, {
460
+ (_(), w(C, {
461
461
  "mask-mobile": n.row.mobile,
462
462
  "user-id": n.row.id,
463
463
  key: n.row.id
@@ -583,12 +583,13 @@ const ne = /* @__PURE__ */ M(ae, [["__scopeId", "data-v-391c43be"]]), ie = {
583
583
  for (let r of o.userDetailDialogTabs)
584
584
  l.userDetailDialogTabs.push(r);
585
585
  Z.forEach((r) => a.use(r)), a.use(ie, o);
586
- }, pe = {
586
+ }, ce = {
587
587
  install: re
588
588
  };
589
589
  export {
590
590
  X as UserDetailDialog,
591
591
  J as UserMobileComp,
592
- pe as default,
593
- re as install
592
+ ce as default,
593
+ re as install,
594
+ N as useUserCoreConfigStore
594
595
  };
package/index.umd.cjs CHANGED
@@ -1 +1 @@
1
- (function(m,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("pinia"),require("@pangu-backend-ui/common")):typeof define=="function"&&define.amd?define(["exports","vue","pinia","@pangu-backend-ui/common"],e):(m=typeof globalThis<"u"?globalThis:m||self,e(m["pg-user-core"]={},m.Vue,m.pinia,m.common))})(this,function(m,e,y,D){"use strict";const T={key:0,class:"container"},B=e.defineComponent({__name:"UserMobileComponent",props:{userId:{type:Number,default:null},maskMobile:{type:String,default:null}},setup(l){const o=l,t=e.ref({plainMobile:null,loading:!1}),i=e.inject("http");function p(){t.value.plainMobile==null&&(t.value.loading=!0,i==null||i.get(`/api/user/${o.userId}/plainmobile`).then(r=>{t.value.plainMobile=r.data,t.value.loading=!1}).finally(()=>{t.value.loading=!1}))}return(r,d)=>{const c=e.resolveComponent("View"),_=e.resolveComponent("el-icon"),g=e.resolveComponent("Loading");return o.maskMobile!=null?(e.openBlock(),e.createElementBlock("div",T,[t.value.plainMobile==null?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(o.maskMobile),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(t.value.plainMobile),1)],64)),t.value.plainMobile==null&&!t.value.loading&&o.userId!=null?(e.openBlock(),e.createBlock(_,{key:2,class:"view-icon",onClick:p},{default:e.withCtx(()=>[e.createVNode(c)]),_:1})):e.createCommentVNode("",!0),t.value.loading?(e.openBlock(),e.createBlock(_,{key:3,class:"is-loading view-icon"},{default:e.withCtx(()=>[e.createVNode(g)]),_:1})):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)}}}),q="",w=(l,o)=>{const t=l.__vccOpts||l;for(const[i,p]of o)t[i]=p;return t},V=w(B,[["__scopeId","data-v-76c9c9ae"]]),u={install:l=>{l.component("PgUserMobile",V)}};function S(){const l=e.inject("http");function o(t){return l==null?void 0:l.get(`/api/user/${t}`)}return{getUserDetail:o}}const I=e.defineComponent({__name:"LoginHistory",props:["userId"],setup(l){const o=l,t=e.ref({userId:o.userId,loginTimeStart:null,loginTimeEnd:null}),i=e.ref([]);e.watch(i,d=>{d?(t.value.loginTimeStart=d[0],t.value.loginTimeEnd=d[1]):(t.value.loginTimeStart=null,t.value.loginTimeEnd=null),console.log(t.value.loginTimeStart,t.value.loginTimeEnd)});const p=e.ref();function r(){p.value.search()}return(d,c)=>{const _=e.resolveComponent("el-date-picker"),g=e.resolveComponent("el-button"),f=e.resolveComponent("el-space"),n=e.resolveComponent("el-table-column"),s=e.resolveComponent("el-tag"),h=e.resolveComponent("pg-table");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(f,null,{default:e.withCtx(()=>[e.createVNode(_,{modelValue:i.value,"onUpdate:modelValue":c[0]||(c[0]=a=>i.value=a),type:"datetimerange","range-separator":"-","start-placeholder":"登录开始时间","end-placeholder":"登录结束时间",clearable:""},null,8,["modelValue"]),e.createVNode(g,{type:"primary",icon:"search",onClick:r},{default:e.withCtx(()=>[e.createTextVNode("搜索")]),_:1})]),_:1}),e.createVNode(h,{ref_key:"historiesTable",ref:p,style:{"margin-top":"10px"},"data-url":"/api/user/login-history",condition:t.value},{columns:e.withCtx(()=>[e.createVNode(n,{prop:"createdTime",label:"登录时间",align:"center","show-overflow-tooltip":""}),e.createVNode(n,{prop:"ip",label:"登录IP",align:"center","show-overflow-tooltip":""}),e.createVNode(n,{prop:"runtimeName",label:"运行容器",align:"center","show-overflow-tooltip":""}),e.createVNode(n,{label:"登录方式",align:"center","show-overflow-tooltip":""},{default:e.withCtx(({row:a})=>[a.method==="SMS"?(e.openBlock(),e.createBlock(s,{key:0,type:"primary",size:"small"},{default:e.withCtx(()=>[e.createTextVNode("短信登录")]),_:1})):e.createCommentVNode("",!0),a.method==="THIRD_PLATFORM"?(e.openBlock(),e.createBlock(s,{key:1,type:"primary",size:"small"},{default:e.withCtx(()=>[e.createTextVNode("第三方平台")]),_:1})):e.createCommentVNode("",!0),a.method==="UNIVERIFY"?(e.openBlock(),e.createBlock(s,{key:2,type:"primary",size:"small"},{default:e.withCtx(()=>[e.createTextVNode("一键登录")]),_:1})):e.createCommentVNode("",!0),a.method==="PASSWORD"?(e.openBlock(),e.createBlock(s,{key:3,type:"primary",size:"small"},{default:e.withCtx(()=>[e.createTextVNode("帐号密码")]),_:1})):e.createCommentVNode("",!0)]),_:1}),e.createVNode(n,{prop:"thirdPlatformName",label:"第三方登录",align:"center","show-overflow-tooltip":""}),e.createVNode(n,{prop:"versionCode",label:"版本代码",align:"center","show-overflow-tooltip":""}),e.createVNode(n,{prop:"versionName",label:"版本名称",align:"center","show-overflow-tooltip":""})]),_:1},8,["condition"])],64)}}}),N=y.defineStore("pg-user-core-config-store",()=>{const l=[];return l.push({name:"登录历史",code:"LOGIN_HISTORY",component:I}),{userDetailDialogTabs:e.computed(()=>l)}}),C=e.defineComponent({__name:"UserDetailDialog",setup(l,{expose:o}){const{getUserDetail:t}=S(),i=N(),p=e.ref(!1),r=e.ref(),d=e.ref({activeName:i.userDetailDialogTabs[0].code,tabs:[]}),c=e.ref(!1);function _(g,f){var n;c.value=!0,(n=t(g))==null||n.then(s=>{r.value=s.data,c.value=!1,p.value=!0,d.value.tabs.length=0,d.value.tabs=d.value.tabs.concat(i.userDetailDialogTabs),f&&(d.value.tabs=d.value.tabs.concat(f))})}return o({show:_}),(g,f)=>{const n=e.resolveComponent("el-descriptions-item"),s=e.resolveComponent("el-descriptions"),h=e.resolveComponent("el-tab-pane"),a=e.resolveComponent("el-tabs"),z=e.resolveComponent("el-dialog"),j=e.resolveDirective("loading");return e.withDirectives((e.openBlock(),e.createBlock(z,{modelValue:p.value,"onUpdate:modelValue":f[1]||(f[1]=b=>p.value=b),title:"用户详情",width:"1300"},{default:e.withCtx(()=>[e.createVNode(s,{border:""},{default:e.withCtx(()=>[e.createVNode(n,{label:"用户编号"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.value.id),1)]),_:1}),e.createVNode(n,{label:"用户昵称"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.value.nickname),1)]),_:1}),e.createVNode(n,{label:"手机号码"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(V,{"mask-mobile":r.value.mobile,"user-id":r.value.id,key:r.value.id},null,8,["mask-mobile","user-id"]))]),_:1}),e.createVNode(n,{label:"邀请编码"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.value.inviteCode),1)]),_:1}),e.createVNode(n,{label:"活动时间"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.value.touchTime),1)]),_:1}),e.createVNode(n,{label:"注册时间"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.value.createdTime),1)]),_:1}),e.createVNode(n,{label:"最后登陆"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.value.lastLoginTime),1)]),_:1}),e.createVNode(n,{label:"最后更新"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.value.updatedTime),1)]),_:1}),e.createVNode(n,{label:"上级用户"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.value.parentId),1)]),_:1}),e.createVNode(n,{label:"邀请关系"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.value.relationPath),1)]),_:1})]),_:1}),e.createVNode(a,{modelValue:d.value.activeName,"onUpdate:modelValue":f[0]||(f[0]=b=>d.value.activeName=b),style:{"margin-top":"10px"},type:"border-card"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value.tabs,(b,A)=>(e.openBlock(),e.createBlock(h,{label:b.name,name:b.code,key:`user_detail_dialog_${b.code}`},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(b.component),{userId:r.value.id},null,8,["userId"]))]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"])),[[j,c.value]])}}}),k={install:l=>{l.component("PgUserDetailDialog",C)}},U=[u,k],M=l=>(e.pushScopeId("data-v-391c43be"),l=l(),e.popScopeId(),l),E={class:"page-layout"},L={style:{"margin-top":"10px"}},P=M(()=>e.createElementVNode("template",{"slot-scope":"{row}"},null,-1)),R=e.defineComponent({__name:"list",setup(l){const o=e.ref({id:null,parentId:null,phone:null,nicekname:null,inviteCode:null}),t=e.ref(null);function i(){t.value.search()}const p=e.ref();function r(d){p.value.show(d.id)}return(d,c)=>{const _=e.resolveComponent("el-input"),g=e.resolveComponent("el-button"),f=e.resolveComponent("el-space"),n=e.resolveComponent("el-card"),s=e.resolveComponent("el-table-column"),h=e.resolveComponent("el-image");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",E,[e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(f,null,{default:e.withCtx(()=>[e.createVNode(_,{modelValue:o.value.id,"onUpdate:modelValue":c[0]||(c[0]=a=>o.value.id=a),placeholder:"ID",style:{width:"100px"},clearable:""},null,8,["modelValue"]),e.createVNode(_,{modelValue:o.value.parentId,"onUpdate:modelValue":c[1]||(c[1]=a=>o.value.parentId=a),placeholder:"父用户ID",style:{width:"100px"},clearable:""},null,8,["modelValue"]),e.createVNode(_,{modelValue:o.value.phone,"onUpdate:modelValue":c[2]||(c[2]=a=>o.value.phone=a),placeholder:"手机号",style:{width:"120px"},clearable:""},null,8,["modelValue"]),e.createVNode(_,{modelValue:o.value.nicekname,"onUpdate:modelValue":c[3]||(c[3]=a=>o.value.nicekname=a),placeholder:"昵称",style:{width:"150px"},clearable:""},null,8,["modelValue"]),e.createVNode(_,{modelValue:o.value.inviteCode,"onUpdate:modelValue":c[4]||(c[4]=a=>o.value.inviteCode=a),placeholder:"邀请码",style:{width:"100px"},clearable:""},null,8,["modelValue"]),e.createVNode(g,{type:"primary",icon:"search",onClick:i},{default:e.withCtx(()=>[e.createTextVNode("搜索")]),_:1})]),_:1})]),_:1}),e.createElementVNode("div",L,[e.createVNode(e.unref(D.PgTable),{ref_key:"userTable",ref:t,"data-url":"/api/user/page",condition:o.value,onRowDbClick:c[5]||(c[5]=a=>r(a))},{columns:e.withCtx(()=>[e.createVNode(s,{prop:"id",label:"UID",width:"80",align:"center"}),e.createVNode(s,{prop:"mobile",label:"手机",width:"115",align:"left","show-overflow-tooltip":""},{default:e.withCtx(a=>[(e.openBlock(),e.createBlock(V,{"mask-mobile":a.row.mobile,"user-id":a.row.id,key:a.row.id},null,8,["mask-mobile","user-id"]))]),_:1}),e.createVNode(s,{prop:"username",label:"用户名",width:"110",align:"left","show-overflow-tooltip":""}),e.createVNode(s,{prop:"nickname",label:"昵称",width:"110",align:"left","show-overflow-tooltip":""}),e.createVNode(s,{prop:"inviteCode",label:"邀请码",width:"90",align:"center","show-overflow-tooltip":""}),e.createVNode(s,{prop:"avatar",label:"头像",width:"60",align:"center","show-overflow-tooltip":""},{default:e.withCtx(a=>[e.createVNode(h,{fit:"cover",size:30,src:a.row.avatar,"preview-teleported":"","preview-src-list":[a.row.avatar]},null,8,["src","preview-src-list"])]),_:1}),e.createVNode(s,{prop:"parentId",label:"上级ID",width:"80",align:"left","show-overflow-tooltip":""}),e.createVNode(s,{prop:"relationPath",label:"邀请关系","min-width":"150",align:"left","show-overflow-tooltip":""}),e.createVNode(s,{prop:"blackUnlockTime",label:"黑名单解锁",width:"145",align:"left","show-overflow-tooltip":""}),e.createVNode(s,{prop:"lastLoginTime",label:"最后登录时间",width:"145",align:"center","show-overflow-tooltip":""}),e.createVNode(s,{prop:"createdTime",label:"创建时间",width:"145",align:"center","show-overflow-tooltip":""}),e.createVNode(s,{label:"操作",width:"220",fixed:"right"},{default:e.withCtx(()=>[P]),_:1})]),_:1},8,["condition"])])]),e.createVNode(C,{ref_key:"userDetailDialog",ref:p},null,512)],64)}}}),H="",F=w(R,[["__scopeId","data-v-391c43be"]]),$={install:(l,o)=>{let t=o.router,i=t.getRoutes().find(p=>p.path=="/");i&&i.meta&&t.addRoute({path:"/user",name:"User",redirect:"/user/list",component:i.meta.commonLayout,children:[{path:"list",name:"UserList",component:F}]})}},x=(l,o)=>{const t=N();if(o.userDetailDialogTabs&&o.userDetailDialogTabs.length)for(let i of o.userDetailDialogTabs)t.userDetailDialogTabs.push(i);U.forEach(i=>l.use(i)),l.use($,o)},O={install:x};m.UserDetailDialog=k,m.UserMobileComp=u,m.default=O,m.install=x,Object.defineProperties(m,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(m,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("pinia"),require("@pangu-backend-ui/common")):typeof define=="function"&&define.amd?define(["exports","vue","pinia","@pangu-backend-ui/common"],e):(m=typeof globalThis<"u"?globalThis:m||self,e(m["pg-user-core"]={},m.Vue,m.pinia,m.common))})(this,function(m,e,y,D){"use strict";const T={key:0,class:"container"},B=e.defineComponent({__name:"UserMobileComponent",props:{userId:{type:Number,default:null},maskMobile:{type:String,default:null}},setup(l){const t=l,o=e.ref({plainMobile:null,loading:!1}),i=e.inject("http");function p(){o.value.plainMobile==null&&(o.value.loading=!0,i==null||i.get(`/api/user/${t.userId}/plainmobile`).then(r=>{o.value.plainMobile=r.data,o.value.loading=!1}).finally(()=>{o.value.loading=!1}))}return(r,d)=>{const c=e.resolveComponent("View"),_=e.resolveComponent("el-icon"),g=e.resolveComponent("Loading");return t.maskMobile!=null?(e.openBlock(),e.createElementBlock("div",T,[o.value.plainMobile==null?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(t.maskMobile),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(o.value.plainMobile),1)],64)),o.value.plainMobile==null&&!o.value.loading&&t.userId!=null?(e.openBlock(),e.createBlock(_,{key:2,class:"view-icon",onClick:p},{default:e.withCtx(()=>[e.createVNode(c)]),_:1})):e.createCommentVNode("",!0),o.value.loading?(e.openBlock(),e.createBlock(_,{key:3,class:"is-loading view-icon"},{default:e.withCtx(()=>[e.createVNode(g)]),_:1})):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)}}}),q="",N=(l,t)=>{const o=l.__vccOpts||l;for(const[i,p]of t)o[i]=p;return o},V=N(B,[["__scopeId","data-v-76c9c9ae"]]),u={install:l=>{l.component("PgUserMobile",V)}};function S(){const l=e.inject("http");function t(o){return l==null?void 0:l.get(`/api/user/${o}`)}return{getUserDetail:t}}const U=e.defineComponent({__name:"LoginHistory",props:["userId"],setup(l){const t=l,o=e.ref({userId:t.userId,loginTimeStart:null,loginTimeEnd:null}),i=e.ref([]);e.watch(i,d=>{d?(o.value.loginTimeStart=d[0],o.value.loginTimeEnd=d[1]):(o.value.loginTimeStart=null,o.value.loginTimeEnd=null)});const p=e.ref();function r(){p.value.search()}return(d,c)=>{const _=e.resolveComponent("el-date-picker"),g=e.resolveComponent("el-button"),f=e.resolveComponent("el-space"),n=e.resolveComponent("el-table-column"),s=e.resolveComponent("el-tag"),h=e.resolveComponent("pg-table");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(f,null,{default:e.withCtx(()=>[e.createVNode(_,{modelValue:i.value,"onUpdate:modelValue":c[0]||(c[0]=a=>i.value=a),type:"datetimerange","range-separator":"-","start-placeholder":"登录开始时间","end-placeholder":"登录结束时间",clearable:""},null,8,["modelValue"]),e.createVNode(g,{type:"primary",icon:"search",onClick:r},{default:e.withCtx(()=>[e.createTextVNode("搜索")]),_:1})]),_:1}),e.createVNode(h,{ref_key:"historiesTable",ref:p,style:{"margin-top":"10px"},"data-url":"/api/user/login-history",condition:o.value},{columns:e.withCtx(()=>[e.createVNode(n,{prop:"createdTime",label:"登录时间",align:"center","show-overflow-tooltip":""}),e.createVNode(n,{prop:"ip",label:"登录IP",align:"center","show-overflow-tooltip":""}),e.createVNode(n,{prop:"runtimeName",label:"运行容器",align:"center","show-overflow-tooltip":""}),e.createVNode(n,{label:"登录方式",align:"center","show-overflow-tooltip":""},{default:e.withCtx(({row:a})=>[a.method==="SMS"?(e.openBlock(),e.createBlock(s,{key:0,type:"primary",size:"small"},{default:e.withCtx(()=>[e.createTextVNode("短信登录")]),_:1})):e.createCommentVNode("",!0),a.method==="THIRD_PLATFORM"?(e.openBlock(),e.createBlock(s,{key:1,type:"primary",size:"small"},{default:e.withCtx(()=>[e.createTextVNode("第三方平台")]),_:1})):e.createCommentVNode("",!0),a.method==="UNIVERIFY"?(e.openBlock(),e.createBlock(s,{key:2,type:"primary",size:"small"},{default:e.withCtx(()=>[e.createTextVNode("一键登录")]),_:1})):e.createCommentVNode("",!0),a.method==="PASSWORD"?(e.openBlock(),e.createBlock(s,{key:3,type:"primary",size:"small"},{default:e.withCtx(()=>[e.createTextVNode("帐号密码")]),_:1})):e.createCommentVNode("",!0)]),_:1}),e.createVNode(n,{prop:"thirdPlatformName",label:"第三方登录",align:"center","show-overflow-tooltip":""}),e.createVNode(n,{prop:"versionCode",label:"版本代码",align:"center","show-overflow-tooltip":""}),e.createVNode(n,{prop:"versionName",label:"版本名称",align:"center","show-overflow-tooltip":""})]),_:1},8,["condition"])],64)}}}),w=y.defineStore("pg-user-core-config-store",()=>{const l=[];return l.push({name:"登录历史",code:"LOGIN_HISTORY",component:U}),{userDetailDialogTabs:e.computed(()=>l)}}),C=e.defineComponent({__name:"UserDetailDialog",setup(l,{expose:t}){const{getUserDetail:o}=S(),i=w(),p=e.ref(!1),r=e.ref(),d=e.ref({activeName:i.userDetailDialogTabs[0].code,tabs:[]}),c=e.ref(!1);function _(g,f){var n;c.value=!0,(n=o(g))==null||n.then(s=>{r.value=s.data,c.value=!1,p.value=!0,d.value.tabs.length=0,d.value.tabs=d.value.tabs.concat(i.userDetailDialogTabs),f&&(d.value.tabs=d.value.tabs.concat(f))})}return t({show:_}),(g,f)=>{const n=e.resolveComponent("el-descriptions-item"),s=e.resolveComponent("el-descriptions"),h=e.resolveComponent("el-tab-pane"),a=e.resolveComponent("el-tabs"),z=e.resolveComponent("el-dialog"),j=e.resolveDirective("loading");return e.withDirectives((e.openBlock(),e.createBlock(z,{modelValue:p.value,"onUpdate:modelValue":f[1]||(f[1]=b=>p.value=b),title:"用户详情",width:"1300"},{default:e.withCtx(()=>[e.createVNode(s,{border:""},{default:e.withCtx(()=>[e.createVNode(n,{label:"用户编号"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.value.id),1)]),_:1}),e.createVNode(n,{label:"用户昵称"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.value.nickname),1)]),_:1}),e.createVNode(n,{label:"手机号码"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(V,{"mask-mobile":r.value.mobile,"user-id":r.value.id,key:r.value.id},null,8,["mask-mobile","user-id"]))]),_:1}),e.createVNode(n,{label:"邀请编码"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.value.inviteCode),1)]),_:1}),e.createVNode(n,{label:"活动时间"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.value.touchTime),1)]),_:1}),e.createVNode(n,{label:"注册时间"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.value.createdTime),1)]),_:1}),e.createVNode(n,{label:"最后登陆"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.value.lastLoginTime),1)]),_:1}),e.createVNode(n,{label:"最后更新"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.value.updatedTime),1)]),_:1}),e.createVNode(n,{label:"上级用户"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.value.parentId),1)]),_:1}),e.createVNode(n,{label:"邀请关系"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.value.relationPath),1)]),_:1})]),_:1}),e.createVNode(a,{modelValue:d.value.activeName,"onUpdate:modelValue":f[0]||(f[0]=b=>d.value.activeName=b),style:{"margin-top":"10px"},type:"border-card"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value.tabs,(b,A)=>(e.openBlock(),e.createBlock(h,{label:b.name,name:b.code,key:`user_detail_dialog_${b.code}`},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(b.component),{userId:r.value.id},null,8,["userId"]))]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"])),[[j,c.value]])}}}),k={install:l=>{l.component("PgUserDetailDialog",C)}},I=[u,k],M=l=>(e.pushScopeId("data-v-391c43be"),l=l(),e.popScopeId(),l),E={class:"page-layout"},L={style:{"margin-top":"10px"}},P=M(()=>e.createElementVNode("template",{"slot-scope":"{row}"},null,-1)),R=e.defineComponent({__name:"list",setup(l){const t=e.ref({id:null,parentId:null,phone:null,nicekname:null,inviteCode:null}),o=e.ref(null);function i(){o.value.search()}const p=e.ref();function r(d){p.value.show(d.id)}return(d,c)=>{const _=e.resolveComponent("el-input"),g=e.resolveComponent("el-button"),f=e.resolveComponent("el-space"),n=e.resolveComponent("el-card"),s=e.resolveComponent("el-table-column"),h=e.resolveComponent("el-image");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",E,[e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(f,null,{default:e.withCtx(()=>[e.createVNode(_,{modelValue:t.value.id,"onUpdate:modelValue":c[0]||(c[0]=a=>t.value.id=a),placeholder:"ID",style:{width:"100px"},clearable:""},null,8,["modelValue"]),e.createVNode(_,{modelValue:t.value.parentId,"onUpdate:modelValue":c[1]||(c[1]=a=>t.value.parentId=a),placeholder:"父用户ID",style:{width:"100px"},clearable:""},null,8,["modelValue"]),e.createVNode(_,{modelValue:t.value.phone,"onUpdate:modelValue":c[2]||(c[2]=a=>t.value.phone=a),placeholder:"手机号",style:{width:"120px"},clearable:""},null,8,["modelValue"]),e.createVNode(_,{modelValue:t.value.nicekname,"onUpdate:modelValue":c[3]||(c[3]=a=>t.value.nicekname=a),placeholder:"昵称",style:{width:"150px"},clearable:""},null,8,["modelValue"]),e.createVNode(_,{modelValue:t.value.inviteCode,"onUpdate:modelValue":c[4]||(c[4]=a=>t.value.inviteCode=a),placeholder:"邀请码",style:{width:"100px"},clearable:""},null,8,["modelValue"]),e.createVNode(g,{type:"primary",icon:"search",onClick:i},{default:e.withCtx(()=>[e.createTextVNode("搜索")]),_:1})]),_:1})]),_:1}),e.createElementVNode("div",L,[e.createVNode(e.unref(D.PgTable),{ref_key:"userTable",ref:o,"data-url":"/api/user/page",condition:t.value,onRowDbClick:c[5]||(c[5]=a=>r(a))},{columns:e.withCtx(()=>[e.createVNode(s,{prop:"id",label:"UID",width:"80",align:"center"}),e.createVNode(s,{prop:"mobile",label:"手机",width:"115",align:"left","show-overflow-tooltip":""},{default:e.withCtx(a=>[(e.openBlock(),e.createBlock(V,{"mask-mobile":a.row.mobile,"user-id":a.row.id,key:a.row.id},null,8,["mask-mobile","user-id"]))]),_:1}),e.createVNode(s,{prop:"username",label:"用户名",width:"110",align:"left","show-overflow-tooltip":""}),e.createVNode(s,{prop:"nickname",label:"昵称",width:"110",align:"left","show-overflow-tooltip":""}),e.createVNode(s,{prop:"inviteCode",label:"邀请码",width:"90",align:"center","show-overflow-tooltip":""}),e.createVNode(s,{prop:"avatar",label:"头像",width:"60",align:"center","show-overflow-tooltip":""},{default:e.withCtx(a=>[e.createVNode(h,{fit:"cover",size:30,src:a.row.avatar,"preview-teleported":"","preview-src-list":[a.row.avatar]},null,8,["src","preview-src-list"])]),_:1}),e.createVNode(s,{prop:"parentId",label:"上级ID",width:"80",align:"left","show-overflow-tooltip":""}),e.createVNode(s,{prop:"relationPath",label:"邀请关系","min-width":"150",align:"left","show-overflow-tooltip":""}),e.createVNode(s,{prop:"blackUnlockTime",label:"黑名单解锁",width:"145",align:"left","show-overflow-tooltip":""}),e.createVNode(s,{prop:"lastLoginTime",label:"最后登录时间",width:"145",align:"center","show-overflow-tooltip":""}),e.createVNode(s,{prop:"createdTime",label:"创建时间",width:"145",align:"center","show-overflow-tooltip":""}),e.createVNode(s,{label:"操作",width:"220",fixed:"right"},{default:e.withCtx(()=>[P]),_:1})]),_:1},8,["condition"])])]),e.createVNode(C,{ref_key:"userDetailDialog",ref:p},null,512)],64)}}}),H="",F=N(R,[["__scopeId","data-v-391c43be"]]),$={install:(l,t)=>{let o=t.router,i=o.getRoutes().find(p=>p.path=="/");i&&i.meta&&o.addRoute({path:"/user",name:"User",redirect:"/user/list",component:i.meta.commonLayout,children:[{path:"list",name:"UserList",component:F}]})}},x=(l,t)=>{const o=w();if(t.userDetailDialogTabs&&t.userDetailDialogTabs.length)for(let i of t.userDetailDialogTabs)o.userDetailDialogTabs.push(i);I.forEach(i=>l.use(i)),l.use($,t)},O={install:x};m.UserDetailDialog=k,m.UserMobileComp=u,m.default=O,m.install=x,m.useUserCoreConfigStore=w,Object.defineProperties(m,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pangu-backend-ui/user-core",
3
3
  "private": false,
4
- "version": "0.0.10",
4
+ "version": "0.0.11",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
7
7
  "unpkg": "index.umd.cjs",
package/types/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import type { App } from 'vue';
2
2
  export * from './components';
3
3
  export * from './model';
4
+ export * from './store/ConfigStore';
4
5
  import InstallOptions from './types/InstallOptions';
5
6
  export declare const install: (app: App, option: InstallOptions) => void;
6
7
  declare const _default: {
@@ -1,5 +1,5 @@
1
1
  import UserDetailDialogTabConfig from '../types/UserDetailDialogTabConfig';
2
- export declare const useConfigStore: import("pinia").StoreDefinition<"pg-user-core-config-store", import("pinia")._UnwrapAll<Pick<{
2
+ export declare const useUserCoreConfigStore: import("pinia").StoreDefinition<"pg-user-core-config-store", import("pinia")._UnwrapAll<Pick<{
3
3
  userDetailDialogTabs: import("vue").ComputedRef<UserDetailDialogTabConfig[]>;
4
4
  }, never>>, Pick<{
5
5
  userDetailDialogTabs: import("vue").ComputedRef<UserDetailDialogTabConfig[]>;
package/web-types.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "$schema": "http://json.schemastore.org/web-types",
3
3
  "framework": "vue",
4
- "name": "@pangu-backend-ui/common",
5
- "version": "0.0.6",
4
+ "name": "@pangu-backend-ui/user-core",
5
+ "version": "0.0.1",
6
6
  "js-types-syntax": "typescript",
7
7
  "description-markup": "markdown",
8
8
  "contributions": {