cc-ui-vue3
Version:
This template should help get you started developing with Vue 3 in Vite.
326 lines (325 loc) • 13 kB
JavaScript
var z = (e, t, o) => new Promise((r, a) => {
var n = (p) => {
try {
u(o.next(p));
} catch (C) {
a(C);
}
}, d = (p) => {
try {
u(o.throw(p));
} catch (C) {
a(C);
}
}, u = (p) => p.done ? r(p.value) : Promise.resolve(p.value).then(n, d);
u((o = o.apply(e, t)).next());
});
import { ref as I, resolveComponent as G, createBlock as V, openBlock as x, withCtx as J, createElementVNode as m, normalizeClass as $, toDisplayString as ge, defineComponent as ye, resolveDirective as be, withDirectives as me, createElementBlock as b, Fragment as _e, renderList as ve, createCommentVNode as U, createVNode as Ae } from "vue";
import { createRouter as Ce, createWebHashHistory as we } from "vue-router";
import Z from "axios";
import { ElMessage as k } from "element-plus";
const _ = {
__name: "CcText",
props: {
text: {
type: String,
required: !0
},
textClass: {
type: String,
default: ""
}
},
setup(e) {
const t = e, o = I(!1), r = I(null);
function a() {
const n = r.value;
n && (n.clientWidth < n.scrollWidth ? o.value = !0 : o.value = !1);
}
return (n, d) => {
const u = G("el-tooltip");
return x(), V(u, {
content: t.text.toString(),
disabled: !o.value,
effect: "dark",
placement: "top",
"popper-class": "max-w-600px"
}, {
default: J(() => [
m("div", {
onMouseover: d[0] || (d[0] = (p) => a()),
ref_key: "divRef",
ref: r,
class: $([t.textClass, "w-min whitespace-nowrap max-w-100% overflow-hidden text-ellipsis"])
}, ge(t.text), 35)
]),
_: 1
}, 8, ["content", "disabled"]);
};
}
};
Ce({
history: we("/"),
routes: [
{
path: "/",
redirect: "/home"
},
{
path: "/home",
component: () => import("./HomeView-C8kkGq5a.js")
}
]
});
const K = "3.7.7", Fe = K, A = typeof Buffer == "function", M = typeof TextDecoder == "function" ? new TextDecoder() : void 0, W = typeof TextEncoder == "function" ? new TextEncoder() : void 0, Be = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", B = Array.prototype.slice.call(Be), S = ((e) => {
let t = {};
return e.forEach((o, r) => t[o] = r), t;
})(B), Ie = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/, c = String.fromCharCode.bind(String), H = typeof Uint8Array.from == "function" ? Uint8Array.from.bind(Uint8Array) : (e) => new Uint8Array(Array.prototype.slice.call(e, 0)), Q = (e) => e.replace(/=/g, "").replace(/[+\/]/g, (t) => t == "+" ? "-" : "_"), X = (e) => e.replace(/[^A-Za-z0-9\+\/]/g, ""), Y = (e) => {
let t, o, r, a, n = "";
const d = e.length % 3;
for (let u = 0; u < e.length; ) {
if ((o = e.charCodeAt(u++)) > 255 || (r = e.charCodeAt(u++)) > 255 || (a = e.charCodeAt(u++)) > 255)
throw new TypeError("invalid character found");
t = o << 16 | r << 8 | a, n += B[t >> 18 & 63] + B[t >> 12 & 63] + B[t >> 6 & 63] + B[t & 63];
}
return d ? n.slice(0, d - 3) + "===".substring(d) : n;
}, O = typeof btoa == "function" ? (e) => btoa(e) : A ? (e) => Buffer.from(e, "binary").toString("base64") : Y, j = A ? (e) => Buffer.from(e).toString("base64") : (e) => {
let o = [];
for (let r = 0, a = e.length; r < a; r += 4096)
o.push(c.apply(null, e.subarray(r, r + 4096)));
return O(o.join(""));
}, T = (e, t = !1) => t ? Q(j(e)) : j(e), Ue = (e) => {
if (e.length < 2) {
var t = e.charCodeAt(0);
return t < 128 ? e : t < 2048 ? c(192 | t >>> 6) + c(128 | t & 63) : c(224 | t >>> 12 & 15) + c(128 | t >>> 6 & 63) + c(128 | t & 63);
} else {
var t = 65536 + (e.charCodeAt(0) - 55296) * 1024 + (e.charCodeAt(1) - 56320);
return c(240 | t >>> 18 & 7) + c(128 | t >>> 12 & 63) + c(128 | t >>> 6 & 63) + c(128 | t & 63);
}
}, ke = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g, ee = (e) => e.replace(ke, Ue), L = A ? (e) => Buffer.from(e, "utf8").toString("base64") : W ? (e) => j(W.encode(e)) : (e) => O(ee(e)), v = (e, t = !1) => t ? Q(L(e)) : L(e), q = (e) => v(e, !0), Se = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g, Te = (e) => {
switch (e.length) {
case 4:
var t = (7 & e.charCodeAt(0)) << 18 | (63 & e.charCodeAt(1)) << 12 | (63 & e.charCodeAt(2)) << 6 | 63 & e.charCodeAt(3), o = t - 65536;
return c((o >>> 10) + 55296) + c((o & 1023) + 56320);
case 3:
return c((15 & e.charCodeAt(0)) << 12 | (63 & e.charCodeAt(1)) << 6 | 63 & e.charCodeAt(2));
default:
return c((31 & e.charCodeAt(0)) << 6 | 63 & e.charCodeAt(1));
}
}, te = (e) => e.replace(Se, Te), oe = (e) => {
if (e = e.replace(/\s+/g, ""), !Ie.test(e))
throw new TypeError("malformed base64.");
e += "==".slice(2 - (e.length & 3));
let t, o = "", r, a;
for (let n = 0; n < e.length; )
t = S[e.charAt(n++)] << 18 | S[e.charAt(n++)] << 12 | (r = S[e.charAt(n++)]) << 6 | (a = S[e.charAt(n++)]), o += r === 64 ? c(t >> 16 & 255) : a === 64 ? c(t >> 16 & 255, t >> 8 & 255) : c(t >> 16 & 255, t >> 8 & 255, t & 255);
return o;
}, N = typeof atob == "function" ? (e) => atob(X(e)) : A ? (e) => Buffer.from(e, "base64").toString("binary") : oe, ne = A ? (e) => H(Buffer.from(e, "base64")) : (e) => H(N(e).split("").map((t) => t.charCodeAt(0))), re = (e) => ne(se(e)), Ee = A ? (e) => Buffer.from(e, "base64").toString("utf8") : M ? (e) => M.decode(ne(e)) : (e) => te(N(e)), se = (e) => X(e.replace(/[-_]/g, (t) => t == "-" ? "+" : "/")), D = (e) => Ee(se(e)), Re = (e) => {
if (typeof e != "string")
return !1;
const t = e.replace(/\s+/g, "").replace(/={0,2}$/, "");
return !/[^\s0-9a-zA-Z\+/]/.test(t) || !/[^\s0-9a-zA-Z\-_]/.test(t);
}, ae = (e) => ({
value: e,
enumerable: !1,
writable: !0,
configurable: !0
}), le = function() {
const e = (t, o) => Object.defineProperty(String.prototype, t, ae(o));
e("fromBase64", function() {
return D(this);
}), e("toBase64", function(t) {
return v(this, t);
}), e("toBase64URI", function() {
return v(this, !0);
}), e("toBase64URL", function() {
return v(this, !0);
}), e("toUint8Array", function() {
return re(this);
});
}, ie = function() {
const e = (t, o) => Object.defineProperty(Uint8Array.prototype, t, ae(o));
e("toBase64", function(t) {
return T(this, t);
}), e("toBase64URI", function() {
return T(this, !0);
}), e("toBase64URL", function() {
return T(this, !0);
});
}, ze = () => {
le(), ie();
}, F = {
version: K,
VERSION: Fe,
atob: N,
atobPolyfill: oe,
btoa: O,
btoaPolyfill: Y,
fromBase64: D,
toBase64: v,
encode: v,
encodeURI: q,
encodeURL: q,
utob: ee,
btou: te,
decode: D,
isValid: Re,
fromUint8Array: T,
toUint8Array: re,
extendString: le,
extendUint8Array: ie,
extendBuiltins: ze
}, Ve = { class: "flex flex-col overflow-hidden" }, $e = {
key: 0,
class: "h-[358px] pt-36px grid grid-cols-4 gap-y-28px gap-x-24px overflow-y-auto overflow-x-hidden content-start"
}, je = ["onClick"], De = ["src"], Oe = { class: "flex-1 flex flex-col overflow-hidden" }, Ne = {
key: 0,
class: "iconfont-cc icon-cc-a-youjiantou c-[#0F47F5] transition-all duration-350 opacity-0 group-hover:opacity-100"
}, Pe = {
key: 1,
class: "flag c-[#FFF] text-12px line-height-12px"
}, Ze = {
key: 2,
class: "pos-absolute left-0 top-0 bottom-0 right-0 bg-[#ffffff] opacity-30"
}, Me = {
key: 1,
class: "h-[358px]"
}, We = /* @__PURE__ */ ye({
__name: "CcSystemSwitch",
props: {
currentId: {},
jumpType: {},
token: {},
userInfo: {},
baseUrl: {}
},
setup(e, { expose: t }) {
var P;
const o = e, r = (P = o.jumpType) != null ? P : "location", a = I(!1), n = I(!1), d = I([]), u = (l) => {
a.value = !0, n.value = !0, l && l.length ? (d.value = l != null ? l : [], n.value = !1) : p();
}, p = () => {
n.value = !0, Z({
url: o.baseUrl + "/core/sys/module/getByUserId",
method: "get",
headers: {
Authorization: o.token || ""
},
data: { menuType: 1 }
}).then((l) => {
const s = l.config ? l.data : l;
if ((s == null ? void 0 : s.code) === 200) {
const y = ((s == null ? void 0 : s.data) || []).filter(
(g) => g.moduleId !== "12" && g.moduleId !== "16" && g.moduleId !== "17"
);
d.value = y;
} else
k.error((s == null ? void 0 : s.msg) || "网络错误");
n.value = !1;
}).catch(() => {
n.value = !1, k.error("网络错误");
});
}, C = (l) => z(null, null, function* () {
var g;
let s = "";
const y = new FormData();
return y.append("buId", ((g = o.userInfo) == null ? void 0 : g.buId) + ""), y.append("moduleId", l.moduleId + ""), yield Z({
url: o.baseUrl + "/core/sys/auth/buildBuToken?lang=zh&langIndex=1",
method: "post",
headers: {
Authorization: o.token || ""
},
data: y
}).then((i) => {
var w, R;
const f = i.config ? i.data : i;
if ((f == null ? void 0 : f.code) === 200) {
const de = f == null ? void 0 : f.data.token, ue = F.encode(((w = o.userInfo) == null ? void 0 : w.buId) + ""), fe = F.encode("zh"), pe = F.encode(l.moduleId + ""), xe = F.encode(de + ""), he = F.encode(((R = o.userInfo) == null ? void 0 : R.loginType) + "");
s = `${l.systemUrl}/#/jumpLoading?buId=${ue}&i18n=${fe}&moduleId=${pe}&loginCode=${xe}&loginType=${he}`;
} else
k.error((f == null ? void 0 : f.msg) || "网络错误");
}).catch((i) => {
console.log(i, "error"), k.error("网络错误");
}), s;
}), h = (l) => l.moduleId === o.currentId, ce = (l) => z(null, null, function* () {
if (h(l)) return;
const s = yield C(l);
r === "location" ? window.location.href = s : window.open(s, "_blank"), a.value = !1;
});
return t({
openDialog: u
}), (l, s) => {
const y = G("el-dialog"), g = be("loading");
return x(), V(y, {
class: "!rounded-10px !p-36px !pb-0 !bg-cover !bg-center system-switch-dialog",
modelValue: a.value,
"onUpdate:modelValue": s[0] || (s[0] = (i) => a.value = i),
width: "1048px",
"show-close": !1,
"append-to-body": !0
}, {
default: J(() => [
m("div", Ve, [
s[1] || (s[1] = m("div", { class: "flex flex-col bg-cover bg-center bg-img gap-4px py-24px px-40px" }, [
m("div", { class: "text-32px font-bold c-[#FFF] line-height-48px" }, " 你好,请选择系统开启工作空间 "),
m("div", { class: "text-20px line-height-30px c-[#FFF]" }, " 选择目标,一键直达高效模式 ")
], -1)),
n.value || d.value.length ? me((x(), b("div", $e, [
(x(!0), b(_e, null, ve(d.value || [], (i, f) => {
var w;
return x(), b("div", {
key: f,
class: $(["group relative flex items-center p-20px rounded-8px bg-[#EDF2FA] cursor-pointer transition-all duration-350 hover:bg-[#FFF] pos-relative", h(i) ? "disabled" : ""]),
onClick: (R) => ce(i)
}, [
m("img", {
class: $(["w-[40px] h-[40px] mr-12px", h(i) ? "opacity-46" : ""]),
src: i.moduleIcon || "",
alt: ""
}, null, 10, De),
m("div", Oe, [
Ae(_, {
textClass: `text-16px line-height-20px transition-all duration-350 ${h(i) ? "c-[#172136] opacity-46" : "c-[#172136] translate-y-10px group-hover:translate-y-0"}`,
text: (w = i.moduleName) != null ? w : ""
}, null, 8, ["textClass", "text"]),
h(i) ? U("", !0) : (x(), V(_, {
key: 0,
textClass: "text-12px line-height-20px c-[#636977] transition-all transition-delay-100 duration-250 opacity-0 group-hover:opacity-100",
text: "点击进入系统"
}))
]),
h(i) ? U("", !0) : (x(), b("span", Ne)),
h(i) ? (x(), b("div", Pe, " 当前系统 ")) : U("", !0),
h(i) ? (x(), b("div", Ze)) : U("", !0)
], 10, je);
}), 128))
])), [
[g, n.value]
]) : (x(), b("div", Me))
])
]),
_: 1
}, 8, ["modelValue"]);
};
}
}), He = (e, t) => {
const o = e.__vccOpts || e;
for (const [r, a] of t)
o[r] = a;
return o;
}, E = /* @__PURE__ */ He(We, [["__scopeId", "data-v-94ecb745"]]);
E.install = (e) => {
e.component(E.__name, E);
};
_.install = (e) => {
e.component(_.__name, _);
};
const Le = (e) => {
e.use(E), e.use(_);
}, Xe = {
install: Le
};
export {
E as CcSystemSwitch,
_ as CcText,
Xe as default
};