cxc-szcx-uniapp/unpackage/dist/dev/app-plus/app-service.js

19623 lines
688 KiB
JavaScript
Raw Normal View History

2024-09-24 09:21:34 +00:00
if (typeof Promise !== "undefined" && !Promise.prototype.finally) {
Promise.prototype.finally = function(callback) {
const promise = this.constructor;
return this.then(
(value) => promise.resolve(callback()).then(() => value),
(reason) => promise.resolve(callback()).then(() => {
throw reason;
})
);
};
}
;
if (typeof uni !== "undefined" && uni && uni.requireGlobal) {
const global2 = uni.requireGlobal();
ArrayBuffer = global2.ArrayBuffer;
Int8Array = global2.Int8Array;
Uint8Array = global2.Uint8Array;
Uint8ClampedArray = global2.Uint8ClampedArray;
Int16Array = global2.Int16Array;
Uint16Array = global2.Uint16Array;
Int32Array = global2.Int32Array;
Uint32Array = global2.Uint32Array;
Float32Array = global2.Float32Array;
Float64Array = global2.Float64Array;
BigInt64Array = global2.BigInt64Array;
BigUint64Array = global2.BigUint64Array;
}
;
if (uni.restoreGlobal) {
uni.restoreGlobal(Vue, weex, plus, setTimeout, clearTimeout, setInterval, clearInterval);
}
(function(vue) {
"use strict";
const ON_SHOW = "onShow";
const ON_LAUNCH = "onLaunch";
const ON_LOAD = "onLoad";
const ON_REACH_BOTTOM = "onReachBottom";
const ON_PULL_DOWN_REFRESH = "onPullDownRefresh";
function formatAppLog(type, filename, ...args) {
if (uni.__log__) {
uni.__log__(type, filename, ...args);
} else {
console[type].apply(console, [...args, filename]);
}
}
function resolveEasycom(component, easycom) {
return typeof component === "string" ? easycom : component;
}
const createHook = (lifecycle) => (hook, target = vue.getCurrentInstance()) => {
!vue.isInSSRComponentSetup && vue.injectHook(lifecycle, hook, target);
};
const onShow = /* @__PURE__ */ createHook(ON_SHOW);
const onLaunch = /* @__PURE__ */ createHook(ON_LAUNCH);
const onLoad = /* @__PURE__ */ createHook(ON_LOAD);
const onReachBottom = /* @__PURE__ */ createHook(ON_REACH_BOTTOM);
const onPullDownRefresh = /* @__PURE__ */ createHook(ON_PULL_DOWN_REFRESH);
const _imports_0 = "/static/login/logo.png";
const _imports_1 = "/static/login/phone.png";
const _imports_2 = "/static/login/pwd.png";
const _imports_3 = "/static/login/eye.png";
const _imports_4 = "/static/login/eye-off.png";
const _imports_5 = "/static/login/nocheck.png";
const _imports_6 = "/static/login/checked.png";
2024-10-15 00:38:47 +00:00
let baseUrl$1 = "https://36.112.48.190/jeecg-boot";
2024-09-24 09:21:34 +00:00
let loading = false;
function https(config) {
if (loading)
return;
if (uni.getStorageSync("logintime") && uni.getStorageSync("logintime") + 36e5 <= Date.now()) {
loading = true;
formatAppLog("log", "at utils/http.js:11", "token超时");
uni.removeStorageSync("logintime");
uni.navigateTo({
url: "/pages/login/login"
});
loading = false;
return;
}
2024-09-26 04:06:47 +00:00
config.url = baseUrl$1 + config.url;
2024-09-24 09:21:34 +00:00
let token = uni.getStorageSync("token") || "";
config.header = {
//返回数据类型
"content-type": "application/json;charset=utf-8",
//设置用户访问的token信息
"X-Access-Token": token
};
let promise = new Promise(function(resolve, reject) {
uni.request(config).then((res) => {
wx.hideLoading();
if (res[0]) {
uni.showToast({
title: "数据获取失败",
icon: "none",
duration: 1500
});
resolve(false);
} else {
let data = res.data;
resolve(data);
if (loading)
return;
if (data.code == 500) {
uni.showToast({
title: data.message,
icon: "none",
duration: 1500
});
}
if (data.code == 510) {
loading = true;
uni.showToast({
title: data.message,
icon: "none",
duration: 1500
});
uni.removeStorageSync("token");
uni.removeStorageSync("user");
uni.removeStorageSync("role");
uni.navigateTo({
url: "/pages/login/login"
});
uni.removeStorageSync("logintime");
loading = false;
}
}
}).catch((error) => {
uni.hideLoading();
reject(error);
});
});
return promise;
}
2024-10-15 00:38:47 +00:00
function loginApi(config) {
2024-09-24 09:21:34 +00:00
return https({
2024-10-15 00:38:47 +00:00
url: "/sys/sinopecLogin",
2024-09-24 09:21:34 +00:00
method: "post",
data: config
});
}
function queryRoleApi(config) {
return https({
url: "/appConnet/app/queryRoleByRoleIds",
method: "get",
data: config
});
}
function getUserPermissionApi(config) {
return https({
url: "/sys/permission/getUserPermissionByToken",
method: "get",
data: config
});
}
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
function getDefaultExportFromCjs(x) {
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
}
var base64 = { exports: {} };
/*! https://mths.be/base64 v1.0.0 by @mathias | MIT license */
base64.exports;
(function(module, exports) {
(function(root) {
var freeExports = exports;
var freeModule = module && module.exports == freeExports && module;
var freeGlobal = typeof commonjsGlobal == "object" && commonjsGlobal;
if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
root = freeGlobal;
}
var InvalidCharacterError = function(message) {
this.message = message;
};
InvalidCharacterError.prototype = new Error();
InvalidCharacterError.prototype.name = "InvalidCharacterError";
var error = function(message) {
throw new InvalidCharacterError(message);
};
var TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var REGEX_SPACE_CHARACTERS = /[\t\n\f\r ]/g;
var decode = function(input) {
input = String(input).replace(REGEX_SPACE_CHARACTERS, "");
var length = input.length;
if (length % 4 == 0) {
input = input.replace(/==?$/, "");
length = input.length;
}
if (length % 4 == 1 || // http://whatwg.org/C#alphanumeric-ascii-characters
/[^+a-zA-Z0-9/]/.test(input)) {
error(
"Invalid character: the string to be decoded is not correctly encoded."
);
}
var bitCounter = 0;
var bitStorage;
var buffer;
var output = "";
var position = -1;
while (++position < length) {
buffer = TABLE.indexOf(input.charAt(position));
bitStorage = bitCounter % 4 ? bitStorage * 64 + buffer : buffer;
if (bitCounter++ % 4) {
output += String.fromCharCode(
255 & bitStorage >> (-2 * bitCounter & 6)
);
}
}
return output;
};
var encode = function(input) {
input = String(input);
if (/[^\0-\xFF]/.test(input)) {
error(
"The string to be encoded contains characters outside of the Latin1 range."
);
}
var padding = input.length % 3;
var output = "";
var position = -1;
var a2;
var b2;
var c2;
var buffer;
var length = input.length - padding;
while (++position < length) {
a2 = input.charCodeAt(position) << 16;
b2 = input.charCodeAt(++position) << 8;
c2 = input.charCodeAt(++position);
buffer = a2 + b2 + c2;
output += TABLE.charAt(buffer >> 18 & 63) + TABLE.charAt(buffer >> 12 & 63) + TABLE.charAt(buffer >> 6 & 63) + TABLE.charAt(buffer & 63);
}
if (padding == 2) {
a2 = input.charCodeAt(position) << 8;
b2 = input.charCodeAt(++position);
buffer = a2 + b2;
output += TABLE.charAt(buffer >> 10) + TABLE.charAt(buffer >> 4 & 63) + TABLE.charAt(buffer << 2 & 63) + "=";
} else if (padding == 1) {
buffer = input.charCodeAt(position);
output += TABLE.charAt(buffer >> 2) + TABLE.charAt(buffer << 4 & 63) + "==";
}
return output;
};
var base642 = {
"encode": encode,
"decode": decode,
"version": "1.0.0"
};
if (freeExports && !freeExports.nodeType) {
if (freeModule) {
freeModule.exports = base642;
} else {
for (var key in base642) {
base642.hasOwnProperty(key) && (freeExports[key] = base642[key]);
}
}
} else {
root.base64 = base642;
}
})(commonjsGlobal);
})(base64, base64.exports);
2024-09-29 02:44:16 +00:00
var base64Exports = base64.exports;
const Base64 = /* @__PURE__ */ getDefaultExportFromCjs(base64Exports);
2024-09-24 09:21:34 +00:00
var isVue2 = false;
function set(target, key, val) {
if (Array.isArray(target)) {
target.length = Math.max(target.length, key);
target.splice(key, 1, val);
return val;
}
target[key] = val;
return val;
}
function del(target, key) {
if (Array.isArray(target)) {
target.splice(key, 1);
return;
}
delete target[key];
}
function getDevtoolsGlobalHook() {
return getTarget().__VUE_DEVTOOLS_GLOBAL_HOOK__;
}
function getTarget() {
return typeof navigator !== "undefined" && typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {};
}
const isProxyAvailable = typeof Proxy === "function";
const HOOK_SETUP = "devtools-plugin:setup";
const HOOK_PLUGIN_SETTINGS_SET = "plugin:settings:set";
let supported;
let perf;
function isPerformanceSupported() {
var _a;
if (supported !== void 0) {
return supported;
}
if (typeof window !== "undefined" && window.performance) {
supported = true;
perf = window.performance;
} else if (typeof global !== "undefined" && ((_a = global.perf_hooks) === null || _a === void 0 ? void 0 : _a.performance)) {
supported = true;
perf = global.perf_hooks.performance;
} else {
supported = false;
}
return supported;
}
function now() {
return isPerformanceSupported() ? perf.now() : Date.now();
}
class ApiProxy {
constructor(plugin, hook) {
this.target = null;
this.targetQueue = [];
this.onQueue = [];
this.plugin = plugin;
this.hook = hook;
const defaultSettings = {};
if (plugin.settings) {
for (const id in plugin.settings) {
const item = plugin.settings[id];
defaultSettings[id] = item.defaultValue;
}
}
const localSettingsSaveId = `__vue-devtools-plugin-settings__${plugin.id}`;
let currentSettings = Object.assign({}, defaultSettings);
try {
const raw = localStorage.getItem(localSettingsSaveId);
const data = JSON.parse(raw);
Object.assign(currentSettings, data);
} catch (e2) {
}
this.fallbacks = {
getSettings() {
return currentSettings;
},
setSettings(value) {
try {
localStorage.setItem(localSettingsSaveId, JSON.stringify(value));
} catch (e2) {
}
currentSettings = value;
},
now() {
return now();
}
};
if (hook) {
hook.on(HOOK_PLUGIN_SETTINGS_SET, (pluginId, value) => {
if (pluginId === this.plugin.id) {
this.fallbacks.setSettings(value);
}
});
}
this.proxiedOn = new Proxy({}, {
get: (_target, prop) => {
if (this.target) {
return this.target.on[prop];
} else {
return (...args) => {
this.onQueue.push({
method: prop,
args
});
};
}
}
});
this.proxiedTarget = new Proxy({}, {
get: (_target, prop) => {
if (this.target) {
return this.target[prop];
} else if (prop === "on") {
return this.proxiedOn;
} else if (Object.keys(this.fallbacks).includes(prop)) {
return (...args) => {
this.targetQueue.push({
method: prop,
args,
resolve: () => {
}
});
return this.fallbacks[prop](...args);
};
} else {
return (...args) => {
return new Promise((resolve) => {
this.targetQueue.push({
method: prop,
args,
resolve
});
});
};
}
}
});
}
async setRealTarget(target) {
this.target = target;
for (const item of this.onQueue) {
this.target.on[item.method](...item.args);
}
for (const item of this.targetQueue) {
item.resolve(await this.target[item.method](...item.args));
}
}
}
function setupDevtoolsPlugin(pluginDescriptor, setupFn) {
const descriptor = pluginDescriptor;
const target = getTarget();
const hook = getDevtoolsGlobalHook();
const enableProxy = isProxyAvailable && descriptor.enableEarlyProxy;
if (hook && (target.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !enableProxy)) {
hook.emit(HOOK_SETUP, pluginDescriptor, setupFn);
} else {
const proxy = enableProxy ? new ApiProxy(descriptor, hook) : null;
const list = target.__VUE_DEVTOOLS_PLUGINS__ = target.__VUE_DEVTOOLS_PLUGINS__ || [];
list.push({
pluginDescriptor: descriptor,
setupFn,
proxy
});
if (proxy)
setupFn(proxy.proxiedTarget);
}
}
/*!
* pinia v2.1.7
* (c) 2023 Eduardo San Martin Morote
* @license MIT
*/
let activePinia;
const setActivePinia = (pinia2) => activePinia = pinia2;
const piniaSymbol = Symbol("pinia");
function isPlainObject(o2) {
return o2 && typeof o2 === "object" && Object.prototype.toString.call(o2) === "[object Object]" && typeof o2.toJSON !== "function";
}
var MutationType;
(function(MutationType2) {
MutationType2["direct"] = "direct";
MutationType2["patchObject"] = "patch object";
MutationType2["patchFunction"] = "patch function";
})(MutationType || (MutationType = {}));
const IS_CLIENT = typeof window !== "undefined";
const USE_DEVTOOLS = IS_CLIENT;
const _global = /* @__PURE__ */ (() => typeof window === "object" && window.window === window ? window : typeof self === "object" && self.self === self ? self : typeof global === "object" && global.global === global ? global : typeof globalThis === "object" ? globalThis : { HTMLElement: null })();
function bom(blob, { autoBom = false } = {}) {
if (autoBom && /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(blob.type)) {
return new Blob([String.fromCharCode(65279), blob], { type: blob.type });
}
return blob;
}
function download(url, name2, opts) {
const xhr = new XMLHttpRequest();
xhr.open("GET", url);
xhr.responseType = "blob";
xhr.onload = function() {
saveAs(xhr.response, name2, opts);
};
xhr.onerror = function() {
console.error("could not download file");
};
xhr.send();
}
function corsEnabled(url) {
const xhr = new XMLHttpRequest();
xhr.open("HEAD", url, false);
try {
xhr.send();
} catch (e2) {
}
return xhr.status >= 200 && xhr.status <= 299;
}
function click(node) {
try {
node.dispatchEvent(new MouseEvent("click"));
} catch (e2) {
const evt = document.createEvent("MouseEvents");
evt.initMouseEvent("click", true, true, window, 0, 0, 0, 80, 20, false, false, false, false, 0, null);
node.dispatchEvent(evt);
}
}
const _navigator = typeof navigator === "object" ? navigator : { userAgent: "" };
const isMacOSWebView = /* @__PURE__ */ (() => /Macintosh/.test(_navigator.userAgent) && /AppleWebKit/.test(_navigator.userAgent) && !/Safari/.test(_navigator.userAgent))();
const saveAs = !IS_CLIENT ? () => {
} : (
// Use download attribute first if possible (#193 Lumia mobile) unless this is a macOS WebView or mini program
typeof HTMLAnchorElement !== "undefined" && "download" in HTMLAnchorElement.prototype && !isMacOSWebView ? downloadSaveAs : (
// Use msSaveOrOpenBlob as a second approach
"msSaveOrOpenBlob" in _navigator ? msSaveAs : (
// Fallback to using FileReader and a popup
fileSaverSaveAs
)
)
);
function downloadSaveAs(blob, name2 = "download", opts) {
const a2 = document.createElement("a");
a2.download = name2;
a2.rel = "noopener";
if (typeof blob === "string") {
a2.href = blob;
if (a2.origin !== location.origin) {
if (corsEnabled(a2.href)) {
download(blob, name2, opts);
} else {
a2.target = "_blank";
click(a2);
}
} else {
click(a2);
}
} else {
a2.href = URL.createObjectURL(blob);
setTimeout(function() {
URL.revokeObjectURL(a2.href);
}, 4e4);
setTimeout(function() {
click(a2);
}, 0);
}
}
function msSaveAs(blob, name2 = "download", opts) {
if (typeof blob === "string") {
if (corsEnabled(blob)) {
download(blob, name2, opts);
} else {
const a2 = document.createElement("a");
a2.href = blob;
a2.target = "_blank";
setTimeout(function() {
click(a2);
});
}
} else {
navigator.msSaveOrOpenBlob(bom(blob, opts), name2);
}
}
function fileSaverSaveAs(blob, name2, opts, popup) {
popup = popup || open("", "_blank");
if (popup) {
popup.document.title = popup.document.body.innerText = "downloading...";
}
if (typeof blob === "string")
return download(blob, name2, opts);
const force = blob.type === "application/octet-stream";
const isSafari = /constructor/i.test(String(_global.HTMLElement)) || "safari" in _global;
const isChromeIOS = /CriOS\/[\d]+/.test(navigator.userAgent);
if ((isChromeIOS || force && isSafari || isMacOSWebView) && typeof FileReader !== "undefined") {
const reader = new FileReader();
reader.onloadend = function() {
let url = reader.result;
if (typeof url !== "string") {
popup = null;
throw new Error("Wrong reader.result type");
}
url = isChromeIOS ? url : url.replace(/^data:[^;]*;/, "data:attachment/file;");
if (popup) {
popup.location.href = url;
} else {
location.assign(url);
}
popup = null;
};
reader.readAsDataURL(blob);
} else {
const url = URL.createObjectURL(blob);
if (popup)
popup.location.assign(url);
else
location.href = url;
popup = null;
setTimeout(function() {
URL.revokeObjectURL(url);
}, 4e4);
}
}
function toastMessage(message, type) {
const piniaMessage = "🍍 " + message;
if (typeof __VUE_DEVTOOLS_TOAST__ === "function") {
__VUE_DEVTOOLS_TOAST__(piniaMessage, type);
} else if (type === "error") {
console.error(piniaMessage);
} else if (type === "warn") {
console.warn(piniaMessage);
} else {
console.log(piniaMessage);
}
}
function isPinia(o2) {
return "_a" in o2 && "install" in o2;
}
function checkClipboardAccess() {
if (!("clipboard" in navigator)) {
toastMessage(`Your browser doesn't support the Clipboard API`, "error");
return true;
}
}
function checkNotFocusedError(error) {
if (error instanceof Error && error.message.toLowerCase().includes("document is not focused")) {
toastMessage('You need to activate the "Emulate a focused page" setting in the "Rendering" panel of devtools.', "warn");
return true;
}
return false;
}
async function actionGlobalCopyState(pinia2) {
if (checkClipboardAccess())
return;
try {
await navigator.clipboard.writeText(JSON.stringify(pinia2.state.value));
toastMessage("Global state copied to clipboard.");
} catch (error) {
if (checkNotFocusedError(error))
return;
toastMessage(`Failed to serialize the state. Check the console for more details.`, "error");
console.error(error);
}
}
async function actionGlobalPasteState(pinia2) {
if (checkClipboardAccess())
return;
try {
loadStoresState(pinia2, JSON.parse(await navigator.clipboard.readText()));
toastMessage("Global state pasted from clipboard.");
} catch (error) {
if (checkNotFocusedError(error))
return;
toastMessage(`Failed to deserialize the state from clipboard. Check the console for more details.`, "error");
console.error(error);
}
}
async function actionGlobalSaveState(pinia2) {
try {
saveAs(new Blob([JSON.stringify(pinia2.state.value)], {
type: "text/plain;charset=utf-8"
}), "pinia-state.json");
} catch (error) {
toastMessage(`Failed to export the state as JSON. Check the console for more details.`, "error");
console.error(error);
}
}
let fileInput;
function getFileOpener() {
if (!fileInput) {
fileInput = document.createElement("input");
fileInput.type = "file";
fileInput.accept = ".json";
}
function openFile() {
return new Promise((resolve, reject) => {
fileInput.onchange = async () => {
const files = fileInput.files;
if (!files)
return resolve(null);
const file = files.item(0);
if (!file)
return resolve(null);
return resolve({ text: await file.text(), file });
};
fileInput.oncancel = () => resolve(null);
fileInput.onerror = reject;
fileInput.click();
});
}
return openFile;
}
async function actionGlobalOpenStateFile(pinia2) {
try {
const open2 = getFileOpener();
const result = await open2();
if (!result)
return;
const { text, file } = result;
loadStoresState(pinia2, JSON.parse(text));
toastMessage(`Global state imported from "${file.name}".`);
} catch (error) {
toastMessage(`Failed to import the state from JSON. Check the console for more details.`, "error");
console.error(error);
}
}
function loadStoresState(pinia2, state) {
for (const key in state) {
const storeState = pinia2.state.value[key];
if (storeState) {
Object.assign(storeState, state[key]);
} else {
pinia2.state.value[key] = state[key];
}
}
}
function formatDisplay(display) {
return {
_custom: {
display
}
};
}
const PINIA_ROOT_LABEL = "🍍 Pinia (root)";
const PINIA_ROOT_ID = "_root";
function formatStoreForInspectorTree(store) {
return isPinia(store) ? {
id: PINIA_ROOT_ID,
label: PINIA_ROOT_LABEL
} : {
id: store.$id,
label: store.$id
};
}
function formatStoreForInspectorState(store) {
if (isPinia(store)) {
const storeNames = Array.from(store._s.keys());
const storeMap = store._s;
const state2 = {
state: storeNames.map((storeId) => ({
editable: true,
key: storeId,
value: store.state.value[storeId]
})),
getters: storeNames.filter((id) => storeMap.get(id)._getters).map((id) => {
const store2 = storeMap.get(id);
return {
editable: false,
key: id,
value: store2._getters.reduce((getters, key) => {
getters[key] = store2[key];
return getters;
}, {})
};
})
};
return state2;
}
const state = {
state: Object.keys(store.$state).map((key) => ({
editable: true,
key,
value: store.$state[key]
}))
};
if (store._getters && store._getters.length) {
state.getters = store._getters.map((getterName) => ({
editable: false,
key: getterName,
value: store[getterName]
}));
}
if (store._customProperties.size) {
state.customProperties = Array.from(store._customProperties).map((key) => ({
editable: true,
key,
value: store[key]
}));
}
return state;
}
function formatEventData(events) {
if (!events)
return {};
if (Array.isArray(events)) {
return events.reduce((data, event) => {
data.keys.push(event.key);
data.operations.push(event.type);
data.oldValue[event.key] = event.oldValue;
data.newValue[event.key] = event.newValue;
return data;
}, {
oldValue: {},
keys: [],
operations: [],
newValue: {}
});
} else {
return {
operation: formatDisplay(events.type),
key: formatDisplay(events.key),
oldValue: events.oldValue,
newValue: events.newValue
};
}
}
function formatMutationType(type) {
switch (type) {
case MutationType.direct:
return "mutation";
case MutationType.patchFunction:
return "$patch";
case MutationType.patchObject:
return "$patch";
default:
return "unknown";
}
}
let isTimelineActive = true;
const componentStateTypes = [];
const MUTATIONS_LAYER_ID = "pinia:mutations";
const INSPECTOR_ID = "pinia";
const { assign: assign$1 } = Object;
const getStoreType = (id) => "🍍 " + id;
function registerPiniaDevtools(app, pinia2) {
setupDevtoolsPlugin({
id: "dev.esm.pinia",
label: "Pinia 🍍",
logo: "https://pinia.vuejs.org/logo.svg",
packageName: "pinia",
homepage: "https://pinia.vuejs.org",
componentStateTypes,
app
}, (api) => {
if (typeof api.now !== "function") {
toastMessage("You seem to be using an outdated version of Vue Devtools. Are you still using the Beta release instead of the stable one? You can find the links at https://devtools.vuejs.org/guide/installation.html.");
}
api.addTimelineLayer({
id: MUTATIONS_LAYER_ID,
label: `Pinia 🍍`,
color: 15064968
});
api.addInspector({
id: INSPECTOR_ID,
label: "Pinia 🍍",
icon: "storage",
treeFilterPlaceholder: "Search stores",
actions: [
{
icon: "content_copy",
action: () => {
actionGlobalCopyState(pinia2);
},
tooltip: "Serialize and copy the state"
},
{
icon: "content_paste",
action: async () => {
await actionGlobalPasteState(pinia2);
api.sendInspectorTree(INSPECTOR_ID);
api.sendInspectorState(INSPECTOR_ID);
},
tooltip: "Replace the state with the content of your clipboard"
},
{
icon: "save",
action: () => {
actionGlobalSaveState(pinia2);
},
tooltip: "Save the state as a JSON file"
},
{
icon: "folder_open",
action: async () => {
await actionGlobalOpenStateFile(pinia2);
api.sendInspectorTree(INSPECTOR_ID);
api.sendInspectorState(INSPECTOR_ID);
},
tooltip: "Import the state from a JSON file"
}
],
nodeActions: [
{
icon: "restore",
tooltip: 'Reset the state (with "$reset")',
action: (nodeId) => {
const store = pinia2._s.get(nodeId);
if (!store) {
toastMessage(`Cannot reset "${nodeId}" store because it wasn't found.`, "warn");
} else if (typeof store.$reset !== "function") {
toastMessage(`Cannot reset "${nodeId}" store because it doesn't have a "$reset" method implemented.`, "warn");
} else {
store.$reset();
toastMessage(`Store "${nodeId}" reset.`);
}
}
}
]
});
api.on.inspectComponent((payload, ctx) => {
const proxy = payload.componentInstance && payload.componentInstance.proxy;
if (proxy && proxy._pStores) {
const piniaStores = payload.componentInstance.proxy._pStores;
Object.values(piniaStores).forEach((store) => {
payload.instanceData.state.push({
type: getStoreType(store.$id),
key: "state",
editable: true,
value: store._isOptionsAPI ? {
_custom: {
value: vue.toRaw(store.$state),
actions: [
{
icon: "restore",
tooltip: "Reset the state of this store",
action: () => store.$reset()
}
]
}
} : (
// NOTE: workaround to unwrap transferred refs
Object.keys(store.$state).reduce((state, key) => {
state[key] = store.$state[key];
return state;
}, {})
)
});
if (store._getters && store._getters.length) {
payload.instanceData.state.push({
type: getStoreType(store.$id),
key: "getters",
editable: false,
value: store._getters.reduce((getters, key) => {
try {
getters[key] = store[key];
} catch (error) {
getters[key] = error;
}
return getters;
}, {})
});
}
});
}
});
api.on.getInspectorTree((payload) => {
if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
let stores = [pinia2];
stores = stores.concat(Array.from(pinia2._s.values()));
payload.rootNodes = (payload.filter ? stores.filter((store) => "$id" in store ? store.$id.toLowerCase().includes(payload.filter.toLowerCase()) : PINIA_ROOT_LABEL.toLowerCase().includes(payload.filter.toLowerCase())) : stores).map(formatStoreForInspectorTree);
}
});
api.on.getInspectorState((payload) => {
if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
const inspectedStore = payload.nodeId === PINIA_ROOT_ID ? pinia2 : pinia2._s.get(payload.nodeId);
if (!inspectedStore) {
return;
}
if (inspectedStore) {
payload.state = formatStoreForInspectorState(inspectedStore);
}
}
});
api.on.editInspectorState((payload, ctx) => {
if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
const inspectedStore = payload.nodeId === PINIA_ROOT_ID ? pinia2 : pinia2._s.get(payload.nodeId);
if (!inspectedStore) {
return toastMessage(`store "${payload.nodeId}" not found`, "error");
}
const { path } = payload;
if (!isPinia(inspectedStore)) {
if (path.length !== 1 || !inspectedStore._customProperties.has(path[0]) || path[0] in inspectedStore.$state) {
path.unshift("$state");
}
} else {
path.unshift("state");
}
isTimelineActive = false;
payload.set(inspectedStore, path, payload.state.value);
isTimelineActive = true;
}
});
api.on.editComponentState((payload) => {
if (payload.type.startsWith("🍍")) {
const storeId = payload.type.replace(/^🍍\s*/, "");
const store = pinia2._s.get(storeId);
if (!store) {
return toastMessage(`store "${storeId}" not found`, "error");
}
const { path } = payload;
if (path[0] !== "state") {
return toastMessage(`Invalid path for store "${storeId}":
${path}
Only state can be modified.`);
}
path[0] = "$state";
isTimelineActive = false;
payload.set(store, path, payload.state.value);
isTimelineActive = true;
}
});
});
}
function addStoreToDevtools(app, store) {
if (!componentStateTypes.includes(getStoreType(store.$id))) {
componentStateTypes.push(getStoreType(store.$id));
}
setupDevtoolsPlugin({
id: "dev.esm.pinia",
label: "Pinia 🍍",
logo: "https://pinia.vuejs.org/logo.svg",
packageName: "pinia",
homepage: "https://pinia.vuejs.org",
componentStateTypes,
app,
settings: {
logStoreChanges: {
label: "Notify about new/deleted stores",
type: "boolean",
defaultValue: true
}
// useEmojis: {
// label: 'Use emojis in messages ⚡️',
// type: 'boolean',
// defaultValue: true,
// },
}
}, (api) => {
const now2 = typeof api.now === "function" ? api.now.bind(api) : Date.now;
store.$onAction(({ after, onError, name: name2, args }) => {
const groupId = runningActionId++;
api.addTimelineEvent({
layerId: MUTATIONS_LAYER_ID,
event: {
time: now2(),
title: "🛫 " + name2,
subtitle: "start",
data: {
store: formatDisplay(store.$id),
action: formatDisplay(name2),
args
},
groupId
}
});
after((result) => {
activeAction = void 0;
api.addTimelineEvent({
layerId: MUTATIONS_LAYER_ID,
event: {
time: now2(),
title: "🛬 " + name2,
subtitle: "end",
data: {
store: formatDisplay(store.$id),
action: formatDisplay(name2),
args,
result
},
groupId
}
});
});
onError((error) => {
activeAction = void 0;
api.addTimelineEvent({
layerId: MUTATIONS_LAYER_ID,
event: {
time: now2(),
logType: "error",
title: "💥 " + name2,
subtitle: "end",
data: {
store: formatDisplay(store.$id),
action: formatDisplay(name2),
args,
error
},
groupId
}
});
});
}, true);
store._customProperties.forEach((name2) => {
vue.watch(() => vue.unref(store[name2]), (newValue, oldValue) => {
api.notifyComponentUpdate();
api.sendInspectorState(INSPECTOR_ID);
if (isTimelineActive) {
api.addTimelineEvent({
layerId: MUTATIONS_LAYER_ID,
event: {
time: now2(),
title: "Change",
subtitle: name2,
data: {
newValue,
oldValue
},
groupId: activeAction
}
});
}
}, { deep: true });
});
store.$subscribe(({ events, type }, state) => {
api.notifyComponentUpdate();
api.sendInspectorState(INSPECTOR_ID);
if (!isTimelineActive)
return;
const eventData = {
time: now2(),
title: formatMutationType(type),
data: assign$1({ store: formatDisplay(store.$id) }, formatEventData(events)),
groupId: activeAction
};
if (type === MutationType.patchFunction) {
eventData.subtitle = "⤵️";
} else if (type === MutationType.patchObject) {
eventData.subtitle = "🧩";
} else if (events && !Array.isArray(events)) {
eventData.subtitle = events.type;
}
if (events) {
eventData.data["rawEvent(s)"] = {
_custom: {
display: "DebuggerEvent",
type: "object",
tooltip: "raw DebuggerEvent[]",
value: events
}
};
}
api.addTimelineEvent({
layerId: MUTATIONS_LAYER_ID,
event: eventData
});
}, { detached: true, flush: "sync" });
const hotUpdate = store._hotUpdate;
store._hotUpdate = vue.markRaw((newStore) => {
hotUpdate(newStore);
api.addTimelineEvent({
layerId: MUTATIONS_LAYER_ID,
event: {
time: now2(),
title: "🔥 " + store.$id,
subtitle: "HMR update",
data: {
store: formatDisplay(store.$id),
info: formatDisplay(`HMR update`)
}
}
});
api.notifyComponentUpdate();
api.sendInspectorTree(INSPECTOR_ID);
api.sendInspectorState(INSPECTOR_ID);
});
const { $dispose } = store;
store.$dispose = () => {
$dispose();
api.notifyComponentUpdate();
api.sendInspectorTree(INSPECTOR_ID);
api.sendInspectorState(INSPECTOR_ID);
api.getSettings().logStoreChanges && toastMessage(`Disposed "${store.$id}" store 🗑`);
};
api.notifyComponentUpdate();
api.sendInspectorTree(INSPECTOR_ID);
api.sendInspectorState(INSPECTOR_ID);
api.getSettings().logStoreChanges && toastMessage(`"${store.$id}" store installed 🆕`);
});
}
let runningActionId = 0;
let activeAction;
function patchActionForGrouping(store, actionNames, wrapWithProxy) {
const actions = actionNames.reduce((storeActions, actionName) => {
storeActions[actionName] = vue.toRaw(store)[actionName];
return storeActions;
}, {});
for (const actionName in actions) {
store[actionName] = function() {
const _actionId = runningActionId;
const trackedStore = wrapWithProxy ? new Proxy(store, {
get(...args) {
activeAction = _actionId;
return Reflect.get(...args);
},
set(...args) {
activeAction = _actionId;
return Reflect.set(...args);
}
}) : store;
activeAction = _actionId;
const retValue = actions[actionName].apply(trackedStore, arguments);
activeAction = void 0;
return retValue;
};
}
}
function devtoolsPlugin({ app, store, options }) {
if (store.$id.startsWith("__hot:")) {
return;
}
store._isOptionsAPI = !!options.state;
patchActionForGrouping(store, Object.keys(options.actions), store._isOptionsAPI);
const originalHotUpdate = store._hotUpdate;
vue.toRaw(store)._hotUpdate = function(newStore) {
originalHotUpdate.apply(this, arguments);
patchActionForGrouping(store, Object.keys(newStore._hmrPayload.actions), !!store._isOptionsAPI);
};
addStoreToDevtools(
app,
// FIXME: is there a way to allow the assignment from Store<Id, S, G, A> to StoreGeneric?
store
);
}
function createPinia() {
const scope = vue.effectScope(true);
const state = scope.run(() => vue.ref({}));
let _p = [];
let toBeInstalled = [];
const pinia2 = vue.markRaw({
install(app) {
setActivePinia(pinia2);
{
pinia2._a = app;
app.provide(piniaSymbol, pinia2);
app.config.globalProperties.$pinia = pinia2;
if (USE_DEVTOOLS) {
registerPiniaDevtools(app, pinia2);
}
toBeInstalled.forEach((plugin) => _p.push(plugin));
toBeInstalled = [];
}
},
use(plugin) {
if (!this._a && !isVue2) {
toBeInstalled.push(plugin);
} else {
_p.push(plugin);
}
return this;
},
_p,
// it's actually undefined here
// @ts-expect-error
_a: null,
_e: scope,
_s: /* @__PURE__ */ new Map(),
state
});
if (USE_DEVTOOLS && typeof Proxy !== "undefined") {
pinia2.use(devtoolsPlugin);
}
return pinia2;
}
function patchObject(newState, oldState) {
for (const key in oldState) {
const subPatch = oldState[key];
if (!(key in newState)) {
continue;
}
const targetValue = newState[key];
if (isPlainObject(targetValue) && isPlainObject(subPatch) && !vue.isRef(subPatch) && !vue.isReactive(subPatch)) {
newState[key] = patchObject(targetValue, subPatch);
} else {
{
newState[key] = subPatch;
}
}
}
return newState;
}
const noop = () => {
};
function addSubscription(subscriptions, callback, detached, onCleanup = noop) {
subscriptions.push(callback);
const removeSubscription = () => {
const idx = subscriptions.indexOf(callback);
if (idx > -1) {
subscriptions.splice(idx, 1);
onCleanup();
}
};
if (!detached && vue.getCurrentScope()) {
vue.onScopeDispose(removeSubscription);
}
return removeSubscription;
}
function triggerSubscriptions(subscriptions, ...args) {
subscriptions.slice().forEach((callback) => {
callback(...args);
});
}
const fallbackRunWithContext = (fn) => fn();
function mergeReactiveObjects(target, patchToApply) {
if (target instanceof Map && patchToApply instanceof Map) {
patchToApply.forEach((value, key) => target.set(key, value));
}
if (target instanceof Set && patchToApply instanceof Set) {
patchToApply.forEach(target.add, target);
}
for (const key in patchToApply) {
if (!patchToApply.hasOwnProperty(key))
continue;
const subPatch = patchToApply[key];
const targetValue = target[key];
if (isPlainObject(targetValue) && isPlainObject(subPatch) && target.hasOwnProperty(key) && !vue.isRef(subPatch) && !vue.isReactive(subPatch)) {
target[key] = mergeReactiveObjects(targetValue, subPatch);
} else {
target[key] = subPatch;
}
}
return target;
}
const skipHydrateSymbol = Symbol("pinia:skipHydration");
function shouldHydrate(obj) {
return !isPlainObject(obj) || !obj.hasOwnProperty(skipHydrateSymbol);
}
const { assign } = Object;
function isComputed(o2) {
return !!(vue.isRef(o2) && o2.effect);
}
function createOptionsStore(id, options, pinia2, hot) {
const { state, actions, getters } = options;
const initialState = pinia2.state.value[id];
let store;
function setup() {
if (!initialState && !hot) {
{
pinia2.state.value[id] = state ? state() : {};
}
}
const localState = hot ? (
// use ref() to unwrap refs inside state TODO: check if this is still necessary
vue.toRefs(vue.ref(state ? state() : {}).value)
) : vue.toRefs(pinia2.state.value[id]);
return assign(localState, actions, Object.keys(getters || {}).reduce((computedGetters, name2) => {
if (name2 in localState) {
console.warn(`[🍍]: A getter cannot have the same name as another state property. Rename one of them. Found with "${name2}" in store "${id}".`);
}
computedGetters[name2] = vue.markRaw(vue.computed(() => {
setActivePinia(pinia2);
const store2 = pinia2._s.get(id);
return getters[name2].call(store2, store2);
}));
return computedGetters;
}, {}));
}
store = createSetupStore(id, setup, options, pinia2, hot, true);
return store;
}
function createSetupStore($id, setup, options = {}, pinia2, hot, isOptionsStore) {
let scope;
const optionsForPlugin = assign({ actions: {} }, options);
if (!pinia2._e.active) {
throw new Error("Pinia destroyed");
}
const $subscribeOptions = {
deep: true
// flush: 'post',
};
{
$subscribeOptions.onTrigger = (event) => {
if (isListening) {
debuggerEvents = event;
} else if (isListening == false && !store._hotUpdating) {
if (Array.isArray(debuggerEvents)) {
debuggerEvents.push(event);
} else {
console.error("🍍 debuggerEvents should be an array. This is most likely an internal Pinia bug.");
}
}
};
}
let isListening;
let isSyncListening;
let subscriptions = [];
let actionSubscriptions = [];
let debuggerEvents;
const initialState = pinia2.state.value[$id];
if (!isOptionsStore && !initialState && !hot) {
{
pinia2.state.value[$id] = {};
}
}
const hotState = vue.ref({});
let activeListener;
function $patch(partialStateOrMutator) {
let subscriptionMutation;
isListening = isSyncListening = false;
{
debuggerEvents = [];
}
if (typeof partialStateOrMutator === "function") {
partialStateOrMutator(pinia2.state.value[$id]);
subscriptionMutation = {
type: MutationType.patchFunction,
storeId: $id,
events: debuggerEvents
};
} else {
mergeReactiveObjects(pinia2.state.value[$id], partialStateOrMutator);
subscriptionMutation = {
type: MutationType.patchObject,
payload: partialStateOrMutator,
storeId: $id,
events: debuggerEvents
};
}
const myListenerId = activeListener = Symbol();
vue.nextTick().then(() => {
if (activeListener === myListenerId) {
isListening = true;
}
});
isSyncListening = true;
triggerSubscriptions(subscriptions, subscriptionMutation, pinia2.state.value[$id]);
}
const $reset = isOptionsStore ? function $reset2() {
const { state } = options;
const newState = state ? state() : {};
this.$patch(($state) => {
assign($state, newState);
});
} : (
/* istanbul ignore next */
() => {
throw new Error(`🍍: Store "${$id}" is built using the setup syntax and does not implement $reset().`);
}
);
function $dispose() {
scope.stop();
subscriptions = [];
actionSubscriptions = [];
pinia2._s.delete($id);
}
function wrapAction(name2, action) {
return function() {
setActivePinia(pinia2);
const args = Array.from(arguments);
const afterCallbackList = [];
const onErrorCallbackList = [];
function after(callback) {
afterCallbackList.push(callback);
}
function onError(callback) {
onErrorCallbackList.push(callback);
}
triggerSubscriptions(actionSubscriptions, {
args,
name: name2,
store,
after,
onError
});
let ret;
try {
ret = action.apply(this && this.$id === $id ? this : store, args);
} catch (error) {
triggerSubscriptions(onErrorCallbackList, error);
throw error;
}
if (ret instanceof Promise) {
return ret.then((value) => {
triggerSubscriptions(afterCallbackList, value);
return value;
}).catch((error) => {
triggerSubscriptions(onErrorCallbackList, error);
return Promise.reject(error);
});
}
triggerSubscriptions(afterCallbackList, ret);
return ret;
};
}
const _hmrPayload = /* @__PURE__ */ vue.markRaw({
actions: {},
getters: {},
state: [],
hotState
});
const partialStore = {
_p: pinia2,
// _s: scope,
$id,
$onAction: addSubscription.bind(null, actionSubscriptions),
$patch,
$reset,
$subscribe(callback, options2 = {}) {
const removeSubscription = addSubscription(subscriptions, callback, options2.detached, () => stopWatcher());
const stopWatcher = scope.run(() => vue.watch(() => pinia2.state.value[$id], (state) => {
if (options2.flush === "sync" ? isSyncListening : isListening) {
callback({
storeId: $id,
type: MutationType.direct,
events: debuggerEvents
}, state);
}
}, assign({}, $subscribeOptions, options2)));
return removeSubscription;
},
$dispose
};
const store = vue.reactive(assign(
{
_hmrPayload,
_customProperties: vue.markRaw(/* @__PURE__ */ new Set())
// devtools custom properties
},
partialStore
// must be added later
// setupStore
));
pinia2._s.set($id, store);
const runWithContext = pinia2._a && pinia2._a.runWithContext || fallbackRunWithContext;
const setupStore = runWithContext(() => pinia2._e.run(() => (scope = vue.effectScope()).run(setup)));
for (const key in setupStore) {
const prop = setupStore[key];
if (vue.isRef(prop) && !isComputed(prop) || vue.isReactive(prop)) {
if (hot) {
set(hotState.value, key, vue.toRef(setupStore, key));
} else if (!isOptionsStore) {
if (initialState && shouldHydrate(prop)) {
if (vue.isRef(prop)) {
prop.value = initialState[key];
} else {
mergeReactiveObjects(prop, initialState[key]);
}
}
{
pinia2.state.value[$id][key] = prop;
}
}
{
_hmrPayload.state.push(key);
}
} else if (typeof prop === "function") {
const actionValue = hot ? prop : wrapAction(key, prop);
{
setupStore[key] = actionValue;
}
{
_hmrPayload.actions[key] = prop;
}
optionsForPlugin.actions[key] = prop;
} else {
if (isComputed(prop)) {
_hmrPayload.getters[key] = isOptionsStore ? (
// @ts-expect-error
options.getters[key]
) : prop;
if (IS_CLIENT) {
const getters = setupStore._getters || // @ts-expect-error: same
(setupStore._getters = vue.markRaw([]));
getters.push(key);
}
}
}
}
{
assign(store, setupStore);
assign(vue.toRaw(store), setupStore);
}
Object.defineProperty(store, "$state", {
get: () => hot ? hotState.value : pinia2.state.value[$id],
set: (state) => {
if (hot) {
throw new Error("cannot set hotState");
}
$patch(($state) => {
assign($state, state);
});
}
});
{
store._hotUpdate = vue.markRaw((newStore) => {
store._hotUpdating = true;
newStore._hmrPayload.state.forEach((stateKey) => {
if (stateKey in store.$state) {
const newStateTarget = newStore.$state[stateKey];
const oldStateSource = store.$state[stateKey];
if (typeof newStateTarget === "object" && isPlainObject(newStateTarget) && isPlainObject(oldStateSource)) {
patchObject(newStateTarget, oldStateSource);
} else {
newStore.$state[stateKey] = oldStateSource;
}
}
set(store, stateKey, vue.toRef(newStore.$state, stateKey));
});
Object.keys(store.$state).forEach((stateKey) => {
if (!(stateKey in newStore.$state)) {
del(store, stateKey);
}
});
isListening = false;
isSyncListening = false;
pinia2.state.value[$id] = vue.toRef(newStore._hmrPayload, "hotState");
isSyncListening = true;
vue.nextTick().then(() => {
isListening = true;
});
for (const actionName in newStore._hmrPayload.actions) {
const action = newStore[actionName];
set(store, actionName, wrapAction(actionName, action));
}
for (const getterName in newStore._hmrPayload.getters) {
const getter = newStore._hmrPayload.getters[getterName];
const getterValue = isOptionsStore ? (
// special handling of options api
vue.computed(() => {
setActivePinia(pinia2);
return getter.call(store, store);
})
) : getter;
set(store, getterName, getterValue);
}
Object.keys(store._hmrPayload.getters).forEach((key) => {
if (!(key in newStore._hmrPayload.getters)) {
del(store, key);
}
});
Object.keys(store._hmrPayload.actions).forEach((key) => {
if (!(key in newStore._hmrPayload.actions)) {
del(store, key);
}
});
store._hmrPayload = newStore._hmrPayload;
store._getters = newStore._getters;
store._hotUpdating = false;
});
}
if (USE_DEVTOOLS) {
const nonEnumerable = {
writable: true,
configurable: true,
// avoid warning on devtools trying to display this property
enumerable: false
};
["_p", "_hmrPayload", "_getters", "_customProperties"].forEach((p2) => {
Object.defineProperty(store, p2, assign({ value: store[p2] }, nonEnumerable));
});
}
pinia2._p.forEach((extender) => {
if (USE_DEVTOOLS) {
const extensions = scope.run(() => extender({
store,
app: pinia2._a,
pinia: pinia2,
options: optionsForPlugin
}));
Object.keys(extensions || {}).forEach((key) => store._customProperties.add(key));
assign(store, extensions);
} else {
assign(store, scope.run(() => extender({
store,
app: pinia2._a,
pinia: pinia2,
options: optionsForPlugin
})));
}
});
if (store.$state && typeof store.$state === "object" && typeof store.$state.constructor === "function" && !store.$state.constructor.toString().includes("[native code]")) {
console.warn(`[🍍]: The "state" must be a plain object. It cannot be
state: () => new MyClass()
Found in store "${store.$id}".`);
}
if (initialState && isOptionsStore && options.hydrate) {
options.hydrate(store.$state, initialState);
}
isListening = true;
isSyncListening = true;
return store;
}
function defineStore(idOrOptions, setup, setupOptions) {
let id;
let options;
const isSetupStore = typeof setup === "function";
if (typeof idOrOptions === "string") {
id = idOrOptions;
options = isSetupStore ? setupOptions : setup;
} else {
options = idOrOptions;
id = idOrOptions.id;
if (typeof id !== "string") {
throw new Error(`[🍍]: "defineStore()" must be passed a store id as its first argument.`);
}
}
function useStore2(pinia2, hot) {
const hasContext = vue.hasInjectionContext();
pinia2 = // in test mode, ignore the argument provided as we can always retrieve a
// pinia instance with getActivePinia()
pinia2 || (hasContext ? vue.inject(piniaSymbol, null) : null);
if (pinia2)
setActivePinia(pinia2);
if (!activePinia) {
throw new Error(`[🍍]: "getActivePinia()" was called but there was no active Pinia. Are you trying to use a store before calling "app.use(pinia)"?
See https://pinia.vuejs.org/core-concepts/outside-component-usage.html for help.
This will fail in production.`);
}
pinia2 = activePinia;
if (!pinia2._s.has(id)) {
if (isSetupStore) {
createSetupStore(id, setup, options, pinia2);
} else {
createOptionsStore(id, options, pinia2);
}
{
useStore2._pinia = pinia2;
}
}
const store = pinia2._s.get(id);
if (hot) {
const hotId = "__hot:" + id;
const newStore = isSetupStore ? createSetupStore(hotId, setup, options, pinia2, true) : createOptionsStore(hotId, assign({}, options), pinia2, true);
hot._hotUpdate(newStore);
delete pinia2.state.value[hotId];
pinia2._s.delete(hotId);
}
if (IS_CLIENT) {
const currentInstance = vue.getCurrentInstance();
if (currentInstance && currentInstance.proxy && // avoid adding stores that are just built for hot module replacement
!hot) {
const vm = currentInstance.proxy;
const cache = "_pStores" in vm ? vm._pStores : vm._pStores = {};
cache[id] = store;
}
}
return store;
}
useStore2.$id = id;
return useStore2;
}
const useStore = defineStore("user", {
state: () => ({
userinfo: uni.getStorageSync("user") && JSON.parse(uni.getStorageSync("user")) || {},
token: uni.getStorageSync("token") || null,
role: uni.getStorageSync("role") || null,
allowPage: uni.getStorageSync("allowPage") || null,
position: uni.getStorageSync("position") || null,
positionSwitch: uni.getStorageSync("positionSwitch") || null,
wendu: uni.getStorageSync("wendu") || null,
wenduIcon: uni.getStorageSync("wenduIcon") || null,
isgray: uni.getStorageSync("isgray") || 0
//是否灰化
}),
getters: {
// uid: (state) => state.userinfo?.id
},
actions: {
setUserInfo(val) {
this.userinfo = val;
},
setToken(val) {
this.token = val;
},
setRole(val) {
this.role = val;
},
/**设置定位信息*/
setPosition(val) {
this.position = val;
},
/**设置定位开关*/
setPositionSwitch(val) {
this.positionSwitch = val;
},
/**设置天气*/
setWeather(wendu, wenduIcon) {
this.wendu = wendu;
this.wenduIcon = wenduIcon;
},
setAllowPage(val) {
this.allowPage = val;
},
setIsgray(val) {
this.isgray = val;
}
}
});
const _export_sfc = (sfc, props) => {
const target = sfc.__vccOpts || sfc;
for (const [key, val] of props) {
target[key] = val;
}
return target;
};
2024-10-14 07:22:41 +00:00
const _sfc_main$Q = {
2024-09-24 09:21:34 +00:00
__name: "login",
setup(__props) {
const store = useStore();
const {
proxy
} = vue.getCurrentInstance();
const showpwd = vue.ref(false);
const savePwd = () => {
let localObj = {
un: username.value
};
if (check.value) {
localObj.pw = password.value;
}
uni.setStorageSync("accountObj", JSON.stringify(localObj));
};
const check = vue.ref(true);
const username = vue.ref("");
const password = vue.ref("");
const login = () => {
if (!username.value.trim())
return proxy.$toast("请输入账号");
if (!password.value.trim())
return proxy.$toast("请输入密码");
2024-10-15 00:38:47 +00:00
let un = Base64.encode(encodeURIComponent(username.value));
let pw = Base64.encode(encodeURIComponent(password.value));
2024-09-24 09:21:34 +00:00
uni.showLoading({
title: "登录中..."
});
2024-10-15 00:38:47 +00:00
loginApi({
username: un,
password: pw,
ip: getDeviceIp()
/*生产环境 end */
/*开发环境 begin */
// localLoginApi({
// username: username.value,
// password: password.value,
// captcha: 'app'
2024-09-29 02:44:16 +00:00
/*开发环境 end */
2024-09-24 09:21:34 +00:00
}).then((loginres) => {
if (loginres.success) {
uni.setStorageSync("token", loginres.result.token);
store.setToken(loginres.result.token);
savePwd();
queryRoleApi({
roles: loginres.result.userInfo.roles
}).then((roleres) => {
uni.setStorageSync("logintime", Date.now());
uni.setStorageSync("role", roleres);
store.setRole(roleres);
uni.setStorageSync("user", JSON.stringify(loginres.result.userInfo));
store.setUserInfo(loginres.result.userInfo);
uni.switchTab({
url: "/pages/tab/index"
});
});
}
}).catch((err) => {
2024-10-10 07:32:42 +00:00
formatAppLog("log", "at pages/login/login.vue:130", err);
2024-09-24 09:21:34 +00:00
});
};
vue.ref([]);
onLoad(() => {
if (uni.getStorageSync("accountObj")) {
let obj = JSON.parse(uni.getStorageSync("accountObj"));
username.value = obj.un ? obj.un : "";
password.value = obj.pw ? obj.pw : "";
}
});
2024-10-15 00:38:47 +00:00
function getDeviceIp() {
let deviceIp;
if (plus.os.name == "Android") {
let Context = plus.android.importClass("android.content.Context");
let main = plus.android.runtimeMainActivity();
let cm = main.getSystemService(Context.CONNECTIVITY_SERVICE);
plus.android.importClass(cm);
let linkProperties = cm.getLinkProperties(cm.getActiveNetwork());
let linkAddrs = plus.android.invoke(linkProperties, "getLinkAddresses");
plus.android.importClass(linkAddrs);
for (var i2 = 0; i2 < linkAddrs.size(); i2++) {
let inetAddr = plus.android.invoke(linkAddrs.get(i2), "getAddress");
deviceIp = plus.android.invoke(inetAddr, "getHostAddress");
}
if (deviceIp == "") {
var wifiManager = plus.android.runtimeMainActivity().getSystemService(Context.WIFI_SERVICE);
var wifiInfo = plus.android.invoke(wifiManager, "getConnectionInfo");
var ipAddress = plus.android.invoke(wifiInfo, "getIpAddress");
if (ipAddress != 0) {
deviceIp = (ipAddress & 255) + "." + (ipAddress >> 8 & 255) + "." + (ipAddress >> 16 & 255) + "." + (ipAddress >> 24 & 255);
}
}
}
return deviceIp;
}
2024-09-24 09:21:34 +00:00
return (_ctx, _cache) => {
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass({ "gray": vue.unref(store).isgray == 1 })
},
[
vue.createElementVNode("view", { class: "logo f-col aic" }, [
vue.createElementVNode("image", { src: _imports_0 })
]),
vue.createElementVNode("view", { class: "form f-col aic" }, [
vue.createElementVNode("view", { class: "box f-row aic" }, [
vue.createElementVNode("image", { src: _imports_1 }),
vue.withDirectives(vue.createElementVNode(
"input",
{
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => username.value = $event),
type: "text",
placeholder: "请输入统一身份认证",
"placeholder-style": "font-size: 28rpx;color: #999999;"
},
null,
512
/* NEED_PATCH */
), [
[vue.vModelText, username.value]
])
]),
vue.createElementVNode("view", { class: "box f-row aic" }, [
vue.createElementVNode("image", { src: _imports_2 }),
vue.withDirectives(vue.createElementVNode("input", {
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => password.value = $event),
type: !showpwd.value ? "password" : "text",
placeholder: "请输入密码",
"placeholder-style": "font-size: 28rpx;color: #999999;"
}, null, 8, ["type"]), [
[vue.vModelDynamic, password.value]
]),
showpwd.value ? (vue.openBlock(), vue.createElementBlock("image", {
key: 0,
src: _imports_3,
onClick: _cache[2] || (_cache[2] = ($event) => showpwd.value = !showpwd.value)
})) : (vue.openBlock(), vue.createElementBlock("image", {
key: 1,
src: _imports_4,
onClick: _cache[3] || (_cache[3] = ($event) => showpwd.value = !showpwd.value)
}))
])
]),
vue.createElementVNode("view", { class: "pwd f-row aic" }, [
vue.createElementVNode("view", {
style: { "display": "inline-block" },
onClick: _cache[4] || (_cache[4] = ($event) => check.value = !check.value)
}, [
vue.createElementVNode("view", { class: "f-row aic" }, [
!check.value ? (vue.openBlock(), vue.createElementBlock("image", {
key: 0,
src: _imports_5
})) : (vue.openBlock(), vue.createElementBlock("image", {
key: 1,
src: _imports_6
})),
vue.createElementVNode("text", null, "记住密码")
])
])
]),
vue.createElementVNode("view", { class: "login f-col aic" }, [
vue.createElementVNode("view", { onClick: login }, " 登录 ")
])
],
2
/* CLASS */
);
};
}
};
2024-10-14 07:22:41 +00:00
const PagesLoginLogin = /* @__PURE__ */ _export_sfc(_sfc_main$Q, [["__scopeId", "data-v-e4e4508d"], ["__file", "D:/projects/cxc-szcx-uniapp/pages/login/login.vue"]]);
2024-09-24 09:21:34 +00:00
const fontData = [
{
"font_class": "arrow-down",
"unicode": ""
},
{
"font_class": "arrow-left",
"unicode": ""
},
{
"font_class": "arrow-right",
"unicode": ""
},
{
"font_class": "arrow-up",
"unicode": ""
},
{
"font_class": "auth",
"unicode": ""
},
{
"font_class": "auth-filled",
"unicode": ""
},
{
"font_class": "back",
"unicode": ""
},
{
"font_class": "bars",
"unicode": ""
},
{
"font_class": "calendar",
"unicode": ""
},
{
"font_class": "calendar-filled",
"unicode": ""
},
{
"font_class": "camera",
"unicode": ""
},
{
"font_class": "camera-filled",
"unicode": ""
},
{
"font_class": "cart",
"unicode": ""
},
{
"font_class": "cart-filled",
"unicode": ""
},
{
"font_class": "chat",
"unicode": ""
},
{
"font_class": "chat-filled",
"unicode": ""
},
{
"font_class": "chatboxes",
"unicode": ""
},
{
"font_class": "chatboxes-filled",
"unicode": ""
},
{
"font_class": "chatbubble",
"unicode": ""
},
{
"font_class": "chatbubble-filled",
"unicode": ""
},
{
"font_class": "checkbox",
"unicode": ""
},
{
"font_class": "checkbox-filled",
"unicode": ""
},
{
"font_class": "checkmarkempty",
"unicode": ""
},
{
"font_class": "circle",
"unicode": ""
},
{
"font_class": "circle-filled",
"unicode": ""
},
{
"font_class": "clear",
"unicode": ""
},
{
"font_class": "close",
"unicode": ""
},
{
"font_class": "closeempty",
"unicode": ""
},
{
"font_class": "cloud-download",
"unicode": ""
},
{
"font_class": "cloud-download-filled",
"unicode": ""
},
{
"font_class": "cloud-upload",
"unicode": ""
},
{
"font_class": "cloud-upload-filled",
"unicode": ""
},
{
"font_class": "color",
"unicode": ""
},
{
"font_class": "color-filled",
"unicode": ""
},
{
"font_class": "compose",
"unicode": ""
},
{
"font_class": "contact",
"unicode": ""
},
{
"font_class": "contact-filled",
"unicode": ""
},
{
"font_class": "down",
"unicode": ""
},
{
"font_class": "bottom",
"unicode": ""
},
{
"font_class": "download",
"unicode": ""
},
{
"font_class": "download-filled",
"unicode": ""
},
{
"font_class": "email",
"unicode": ""
},
{
"font_class": "email-filled",
"unicode": ""
},
{
"font_class": "eye",
"unicode": ""
},
{
"font_class": "eye-filled",
"unicode": ""
},
{
"font_class": "eye-slash",
"unicode": ""
},
{
"font_class": "eye-slash-filled",
"unicode": ""
},
{
"font_class": "fire",
"unicode": ""
},
{
"font_class": "fire-filled",
"unicode": ""
},
{
"font_class": "flag",
"unicode": ""
},
{
"font_class": "flag-filled",
"unicode": ""
},
{
"font_class": "folder-add",
"unicode": ""
},
{
"font_class": "folder-add-filled",
"unicode": ""
},
{
"font_class": "font",
"unicode": ""
},
{
"font_class": "forward",
"unicode": ""
},
{
"font_class": "gear",
"unicode": ""
},
{
"font_class": "gear-filled",
"unicode": ""
},
{
"font_class": "gift",
"unicode": ""
},
{
"font_class": "gift-filled",
"unicode": ""
},
{
"font_class": "hand-down",
"unicode": ""
},
{
"font_class": "hand-down-filled",
"unicode": ""
},
{
"font_class": "hand-up",
"unicode": ""
},
{
"font_class": "hand-up-filled",
"unicode": ""
},
{
"font_class": "headphones",
"unicode": ""
},
{
"font_class": "heart",
"unicode": ""
},
{
"font_class": "heart-filled",
"unicode": ""
},
{
"font_class": "help",
"unicode": ""
},
{
"font_class": "help-filled",
"unicode": ""
},
{
"font_class": "home",
"unicode": ""
},
{
"font_class": "home-filled",
"unicode": ""
},
{
"font_class": "image",
"unicode": ""
},
{
"font_class": "image-filled",
"unicode": ""
},
{
"font_class": "images",
"unicode": ""
},
{
"font_class": "images-filled",
"unicode": ""
},
{
"font_class": "info",
"unicode": ""
},
{
"font_class": "info-filled",
"unicode": ""
},
{
"font_class": "left",
"unicode": ""
},
{
"font_class": "link",
"unicode": ""
},
{
"font_class": "list",
"unicode": ""
},
{
"font_class": "location",
"unicode": ""
},
{
"font_class": "location-filled",
"unicode": ""
},
{
"font_class": "locked",
"unicode": ""
},
{
"font_class": "locked-filled",
"unicode": ""
},
{
"font_class": "loop",
"unicode": ""
},
{
"font_class": "mail-open",
"unicode": ""
},
{
"font_class": "mail-open-filled",
"unicode": ""
},
{
"font_class": "map",
"unicode": ""
},
{
"font_class": "map-filled",
"unicode": ""
},
{
"font_class": "map-pin",
"unicode": ""
},
{
"font_class": "map-pin-ellipse",
"unicode": ""
},
{
"font_class": "medal",
"unicode": ""
},
{
"font_class": "medal-filled",
"unicode": ""
},
{
"font_class": "mic",
"unicode": ""
},
{
"font_class": "mic-filled",
"unicode": ""
},
{
"font_class": "micoff",
"unicode": ""
},
{
"font_class": "micoff-filled",
"unicode": ""
},
{
"font_class": "minus",
"unicode": ""
},
{
"font_class": "minus-filled",
"unicode": ""
},
{
"font_class": "more",
"unicode": ""
},
{
"font_class": "more-filled",
"unicode": ""
},
{
"font_class": "navigate",
"unicode": ""
},
{
"font_class": "navigate-filled",
"unicode": ""
},
{
"font_class": "notification",
"unicode": ""
},
{
"font_class": "notification-filled",
"unicode": ""
},
{
"font_class": "paperclip",
"unicode": ""
},
{
"font_class": "paperplane",
"unicode": ""
},
{
"font_class": "paperplane-filled",
"unicode": ""
},
{
"font_class": "person",
"unicode": ""
},
{
"font_class": "person-filled",
"unicode": ""
},
{
"font_class": "personadd",
"unicode": ""
},
{
"font_class": "personadd-filled",
"unicode": ""
},
{
"font_class": "personadd-filled-copy",
"unicode": ""
},
{
"font_class": "phone",
"unicode": ""
},
{
"font_class": "phone-filled",
"unicode": ""
},
{
"font_class": "plus",
"unicode": ""
},
{
"font_class": "plus-filled",
"unicode": ""
},
{
"font_class": "plusempty",
"unicode": ""
},
{
"font_class": "pulldown",
"unicode": ""
},
{
"font_class": "pyq",
"unicode": ""
},
{
"font_class": "qq",
"unicode": ""
},
{
"font_class": "redo",
"unicode": ""
},
{
"font_class": "redo-filled",
"unicode": ""
},
{
"font_class": "refresh",
"unicode": ""
},
{
"font_class": "refresh-filled",
"unicode": ""
},
{
"font_class": "refreshempty",
"unicode": ""
},
{
"font_class": "reload",
"unicode": ""
},
{
"font_class": "right",
"unicode": ""
},
{
"font_class": "scan",
"unicode": ""
},
{
"font_class": "search",
"unicode": ""
},
{
"font_class": "settings",
"unicode": ""
},
{
"font_class": "settings-filled",
"unicode": ""
},
{
"font_class": "shop",
"unicode": ""
},
{
"font_class": "shop-filled",
"unicode": ""
},
{
"font_class": "smallcircle",
"unicode": ""
},
{
"font_class": "smallcircle-filled",
"unicode": ""
},
{
"font_class": "sound",
"unicode": ""
},
{
"font_class": "sound-filled",
"unicode": ""
},
{
"font_class": "spinner-cycle",
"unicode": ""
},
{
"font_class": "staff",
"unicode": ""
},
{
"font_class": "staff-filled",
"unicode": ""
},
{
"font_class": "star",
"unicode": ""
},
{
"font_class": "star-filled",
"unicode": ""
},
{
"font_class": "starhalf",
"unicode": ""
},
{
"font_class": "trash",
"unicode": ""
},
{
"font_class": "trash-filled",
"unicode": ""
},
{
"font_class": "tune",
"unicode": ""
},
{
"font_class": "tune-filled",
"unicode": ""
},
{
"font_class": "undo",
"unicode": ""
},
{
"font_class": "undo-filled",
"unicode": ""
},
{
"font_class": "up",
"unicode": ""
},
{
"font_class": "top",
"unicode": ""
},
{
"font_class": "upload",
"unicode": ""
},
{
"font_class": "upload-filled",
"unicode": ""
},
{
"font_class": "videocam",
"unicode": ""
},
{
"font_class": "videocam-filled",
"unicode": ""
},
{
"font_class": "vip",
"unicode": ""
},
{
"font_class": "vip-filled",
"unicode": ""
},
{
"font_class": "wallet",
"unicode": ""
},
{
"font_class": "wallet-filled",
"unicode": ""
},
{
"font_class": "weibo",
"unicode": ""
},
{
"font_class": "weixin",
"unicode": ""
}
];
const getVal = (val) => {
const reg = /^[0-9]*$/g;
return typeof val === "number" || reg.test(val) ? val + "px" : val;
};
2024-10-14 07:22:41 +00:00
const _sfc_main$P = {
2024-09-24 09:21:34 +00:00
name: "UniIcons",
emits: ["click"],
props: {
type: {
type: String,
default: ""
},
color: {
type: String,
default: "#333333"
},
size: {
type: [Number, String],
default: 16
},
customPrefix: {
type: String,
default: ""
},
fontFamily: {
type: String,
default: ""
}
},
data() {
return {
icons: fontData
};
},
computed: {
unicode() {
let code = this.icons.find((v2) => v2.font_class === this.type);
if (code) {
return code.unicode;
}
return "";
},
iconSize() {
return getVal(this.size);
},
styleObj() {
if (this.fontFamily !== "") {
return `color: ${this.color}; font-size: ${this.iconSize}; font-family: ${this.fontFamily};`;
}
return `color: ${this.color}; font-size: ${this.iconSize};`;
}
},
methods: {
_onClick() {
this.$emit("click");
}
}
};
2024-10-14 07:22:41 +00:00
function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
2024-09-24 09:21:34 +00:00
return vue.openBlock(), vue.createElementBlock(
"text",
{
style: vue.normalizeStyle($options.styleObj),
class: vue.normalizeClass(["uni-icons", ["uniui-" + $props.type, $props.customPrefix, $props.customPrefix ? $props.type : ""]]),
onClick: _cache[0] || (_cache[0] = (...args) => $options._onClick && $options._onClick(...args))
},
[
vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
],
6
/* CLASS, STYLE */
);
}
2024-10-14 07:22:41 +00:00
const __easycom_1$1 = /* @__PURE__ */ _export_sfc(_sfc_main$P, [["render", _sfc_render$e], ["__scopeId", "data-v-d31e1c47"], ["__file", "D:/projects/cxc-szcx-uniapp/uni_modules/uni-icons/components/uni-icons/uni-icons.vue"]]);
2024-09-24 09:21:34 +00:00
let Calendar$1 = class Calendar {
constructor({
selected,
startDate,
endDate,
range
} = {}) {
this.date = this.getDateObj(/* @__PURE__ */ new Date());
this.selected = selected || [];
this.startDate = startDate;
this.endDate = endDate;
this.range = range;
this.cleanMultipleStatus();
this.weeks = {};
this.lastHover = false;
}
/**
* 设置日期
* @param {Object} date
*/
setDate(date) {
const selectDate = this.getDateObj(date);
this.getWeeks(selectDate.fullDate);
}
/**
* 清理多选状态
*/
cleanMultipleStatus() {
this.multipleStatus = {
before: "",
after: "",
data: []
};
}
setStartDate(startDate) {
this.startDate = startDate;
}
setEndDate(endDate) {
this.endDate = endDate;
}
getPreMonthObj(date) {
date = fixIosDateFormat(date);
date = new Date(date);
const oldMonth = date.getMonth();
date.setMonth(oldMonth - 1);
const newMonth = date.getMonth();
if (oldMonth !== 0 && newMonth - oldMonth === 0) {
date.setMonth(newMonth - 1);
}
return this.getDateObj(date);
}
getNextMonthObj(date) {
date = fixIosDateFormat(date);
date = new Date(date);
const oldMonth = date.getMonth();
date.setMonth(oldMonth + 1);
const newMonth = date.getMonth();
if (newMonth - oldMonth > 1) {
date.setMonth(newMonth - 1);
}
return this.getDateObj(date);
}
/**
* 获取指定格式Date对象
*/
getDateObj(date) {
date = fixIosDateFormat(date);
date = new Date(date);
return {
fullDate: getDate(date),
year: date.getFullYear(),
month: addZero(date.getMonth() + 1),
date: addZero(date.getDate()),
day: date.getDay()
};
}
/**
* 获取上一个月日期集合
*/
getPreMonthDays(amount, dateObj) {
const result = [];
for (let i2 = amount - 1; i2 >= 0; i2--) {
const month = dateObj.month - 1;
result.push({
date: new Date(dateObj.year, month, -i2).getDate(),
month,
disable: true
});
}
return result;
}
/**
* 获取本月日期集合
*/
getCurrentMonthDays(amount, dateObj) {
const result = [];
const fullDate = this.date.fullDate;
for (let i2 = 1; i2 <= amount; i2++) {
const currentDate = `${dateObj.year}-${dateObj.month}-${addZero(i2)}`;
const isToday = fullDate === currentDate;
const info = this.selected && this.selected.find((item) => {
if (this.dateEqual(currentDate, item.date)) {
return item;
}
});
if (this.startDate) {
dateCompare(this.startDate, currentDate);
}
if (this.endDate) {
dateCompare(currentDate, this.endDate);
}
let multiples = this.multipleStatus.data;
let multiplesStatus = -1;
if (this.range && multiples) {
multiplesStatus = multiples.findIndex((item) => {
return this.dateEqual(item, currentDate);
});
}
const checked = multiplesStatus !== -1;
result.push({
fullDate: currentDate,
year: dateObj.year,
date: i2,
multiple: this.range ? checked : false,
beforeMultiple: this.isLogicBefore(currentDate, this.multipleStatus.before, this.multipleStatus.after),
afterMultiple: this.isLogicAfter(currentDate, this.multipleStatus.before, this.multipleStatus.after),
month: dateObj.month,
disable: this.startDate && !dateCompare(this.startDate, currentDate) || this.endDate && !dateCompare(
currentDate,
this.endDate
),
isToday,
userChecked: false,
extraInfo: info
});
}
return result;
}
/**
* 获取下一个月日期集合
*/
_getNextMonthDays(amount, dateObj) {
const result = [];
const month = dateObj.month + 1;
for (let i2 = 1; i2 <= amount; i2++) {
result.push({
date: i2,
month,
disable: true
});
}
return result;
}
/**
* 获取当前日期详情
* @param {Object} date
*/
getInfo(date) {
if (!date) {
date = /* @__PURE__ */ new Date();
}
return this.calendar.find((item) => item.fullDate === this.getDateObj(date).fullDate);
}
/**
* 比较时间是否相等
*/
dateEqual(before, after) {
before = new Date(fixIosDateFormat(before));
after = new Date(fixIosDateFormat(after));
return before.valueOf() === after.valueOf();
}
/**
* 比较真实起始日期
*/
isLogicBefore(currentDate, before, after) {
let logicBefore = before;
if (before && after) {
logicBefore = dateCompare(before, after) ? before : after;
}
return this.dateEqual(logicBefore, currentDate);
}
isLogicAfter(currentDate, before, after) {
let logicAfter = after;
if (before && after) {
logicAfter = dateCompare(before, after) ? after : before;
}
return this.dateEqual(logicAfter, currentDate);
}
/**
* 获取日期范围内所有日期
* @param {Object} begin
* @param {Object} end
*/
geDateAll(begin, end) {
var arr = [];
var ab = begin.split("-");
var ae2 = end.split("-");
var db = /* @__PURE__ */ new Date();
db.setFullYear(ab[0], ab[1] - 1, ab[2]);
var de2 = /* @__PURE__ */ new Date();
de2.setFullYear(ae2[0], ae2[1] - 1, ae2[2]);
var unixDb = db.getTime() - 24 * 60 * 60 * 1e3;
var unixDe = de2.getTime() - 24 * 60 * 60 * 1e3;
for (var k = unixDb; k <= unixDe; ) {
k = k + 24 * 60 * 60 * 1e3;
arr.push(this.getDateObj(new Date(parseInt(k))).fullDate);
}
return arr;
}
/**
* 获取多选状态
*/
setMultiple(fullDate) {
if (!this.range)
return;
let {
before,
after
} = this.multipleStatus;
if (before && after) {
if (!this.lastHover) {
this.lastHover = true;
return;
}
this.multipleStatus.before = fullDate;
this.multipleStatus.after = "";
this.multipleStatus.data = [];
this.multipleStatus.fulldate = "";
this.lastHover = false;
} else {
if (!before) {
this.multipleStatus.before = fullDate;
this.multipleStatus.after = void 0;
this.lastHover = false;
} else {
this.multipleStatus.after = fullDate;
if (dateCompare(this.multipleStatus.before, this.multipleStatus.after)) {
this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus.after);
} else {
this.multipleStatus.data = this.geDateAll(this.multipleStatus.after, this.multipleStatus.before);
}
this.lastHover = true;
}
}
this.getWeeks(fullDate);
}
/**
* 鼠标 hover 更新多选状态
*/
setHoverMultiple(fullDate) {
if (!this.range || this.lastHover)
return;
const {
before
} = this.multipleStatus;
if (!before) {
this.multipleStatus.before = fullDate;
} else {
this.multipleStatus.after = fullDate;
if (dateCompare(this.multipleStatus.before, this.multipleStatus.after)) {
this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus.after);
} else {
this.multipleStatus.data = this.geDateAll(this.multipleStatus.after, this.multipleStatus.before);
}
}
this.getWeeks(fullDate);
}
/**
* 更新默认值多选状态
*/
setDefaultMultiple(before, after) {
this.multipleStatus.before = before;
this.multipleStatus.after = after;
if (before && after) {
if (dateCompare(before, after)) {
this.multipleStatus.data = this.geDateAll(before, after);
this.getWeeks(after);
} else {
this.multipleStatus.data = this.geDateAll(after, before);
this.getWeeks(before);
}
}
}
/**
* 获取每周数据
* @param {Object} dateData
*/
getWeeks(dateData) {
const {
year,
month
} = this.getDateObj(dateData);
const preMonthDayAmount = new Date(year, month - 1, 1).getDay();
const preMonthDays = this.getPreMonthDays(preMonthDayAmount, this.getDateObj(dateData));
const currentMonthDayAmount = new Date(year, month, 0).getDate();
const currentMonthDays = this.getCurrentMonthDays(currentMonthDayAmount, this.getDateObj(dateData));
const nextMonthDayAmount = 42 - preMonthDayAmount - currentMonthDayAmount;
const nextMonthDays = this._getNextMonthDays(nextMonthDayAmount, this.getDateObj(dateData));
const calendarDays = [...preMonthDays, ...currentMonthDays, ...nextMonthDays];
const weeks = new Array(6);
for (let i2 = 0; i2 < calendarDays.length; i2++) {
const index = Math.floor(i2 / 7);
if (!weeks[index]) {
weeks[index] = new Array(7);
}
weeks[index][i2 % 7] = calendarDays[i2];
}
this.calendar = calendarDays;
this.weeks = weeks;
}
};
function getDateTime(date, hideSecond) {
return `${getDate(date)} ${getTime$1(date, hideSecond)}`;
}
function getDate(date) {
date = fixIosDateFormat(date);
date = new Date(date);
const year = date.getFullYear();
const month = date.getMonth() + 1;
const day = date.getDate();
return `${year}-${addZero(month)}-${addZero(day)}`;
}
function getTime$1(date, hideSecond) {
date = fixIosDateFormat(date);
date = new Date(date);
const hour = date.getHours();
const minute = date.getMinutes();
const second = date.getSeconds();
return hideSecond ? `${addZero(hour)}:${addZero(minute)}` : `${addZero(hour)}:${addZero(minute)}:${addZero(second)}`;
}
function addZero(num) {
if (num < 10) {
num = `0${num}`;
}
return num;
}
function getDefaultSecond(hideSecond) {
return hideSecond ? "00:00" : "00:00:00";
}
function dateCompare(startDate, endDate) {
startDate = new Date(fixIosDateFormat(startDate));
endDate = new Date(fixIosDateFormat(endDate));
return startDate <= endDate;
}
function checkDate(date) {
const dateReg = /((19|20)\d{2})(-|\/)\d{1,2}(-|\/)\d{1,2}/g;
return date.match(dateReg);
}
const dateTimeReg = /^\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])( [0-5]?[0-9]:[0-5]?[0-9](:[0-5]?[0-9])?)?$/;
function fixIosDateFormat(value) {
if (typeof value === "string" && dateTimeReg.test(value)) {
value = value.replace(/-/g, "/");
}
return value;
}
2024-10-14 07:22:41 +00:00
const _sfc_main$O = {
2024-09-24 09:21:34 +00:00
props: {
weeks: {
type: Object,
default() {
return {};
}
},
calendar: {
type: Object,
default: () => {
return {};
}
},
selected: {
type: Array,
default: () => {
return [];
}
},
checkHover: {
type: Boolean,
default: false
}
},
methods: {
choiceDate(weeks) {
this.$emit("change", weeks);
},
handleMousemove(weeks) {
this.$emit("handleMouse", weeks);
}
}
};
2024-10-14 07:22:41 +00:00
function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
2024-09-24 09:21:34 +00:00
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass(["uni-calendar-item__weeks-box", {
"uni-calendar-item--disable": $props.weeks.disable,
"uni-calendar-item--before-checked-x": $props.weeks.beforeMultiple,
"uni-calendar-item--multiple": $props.weeks.multiple,
"uni-calendar-item--after-checked-x": $props.weeks.afterMultiple
}]),
onClick: _cache[0] || (_cache[0] = ($event) => $options.choiceDate($props.weeks)),
onMouseenter: _cache[1] || (_cache[1] = ($event) => $options.handleMousemove($props.weeks))
},
[
vue.createElementVNode(
"view",
{
class: vue.normalizeClass(["uni-calendar-item__weeks-box-item", {
"uni-calendar-item--checked": $props.calendar.fullDate === $props.weeks.fullDate && ($props.calendar.userChecked || !$props.checkHover),
"uni-calendar-item--checked-range-text": $props.checkHover,
"uni-calendar-item--before-checked": $props.weeks.beforeMultiple,
"uni-calendar-item--multiple": $props.weeks.multiple,
"uni-calendar-item--after-checked": $props.weeks.afterMultiple,
"uni-calendar-item--disable": $props.weeks.disable
}])
},
[
$props.selected && $props.weeks.extraInfo ? (vue.openBlock(), vue.createElementBlock("text", {
key: 0,
class: "uni-calendar-item__weeks-box-circle"
})) : vue.createCommentVNode("v-if", true),
vue.createElementVNode(
"text",
{ class: "uni-calendar-item__weeks-box-text uni-calendar-item__weeks-box-text-disable uni-calendar-item--checked-text" },
vue.toDisplayString($props.weeks.date),
1
/* TEXT */
)
],
2
/* CLASS */
),
vue.createElementVNode(
"view",
{
class: vue.normalizeClass({ "uni-calendar-item--today": $props.weeks.isToday })
},
null,
2
/* CLASS */
)
],
34
/* CLASS, NEED_HYDRATION */
);
}
2024-10-14 07:22:41 +00:00
const calendarItem = /* @__PURE__ */ _export_sfc(_sfc_main$O, [["render", _sfc_render$d], ["__scopeId", "data-v-3c762a01"], ["__file", "D:/projects/cxc-szcx-uniapp/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar-item.vue"]]);
2024-09-24 09:21:34 +00:00
const isObject = (val) => val !== null && typeof val === "object";
const defaultDelimiters = ["{", "}"];
class BaseFormatter {
constructor() {
this._caches = /* @__PURE__ */ Object.create(null);
}
interpolate(message, values, delimiters = defaultDelimiters) {
if (!values) {
return [message];
}
let tokens = this._caches[message];
if (!tokens) {
tokens = parse(message, delimiters);
this._caches[message] = tokens;
}
return compile(tokens, values);
}
}
const RE_TOKEN_LIST_VALUE = /^(?:\d)+/;
const RE_TOKEN_NAMED_VALUE = /^(?:\w)+/;
function parse(format, [startDelimiter, endDelimiter]) {
const tokens = [];
let position = 0;
let text = "";
while (position < format.length) {
let char = format[position++];
if (char === startDelimiter) {
if (text) {
tokens.push({ type: "text", value: text });
}
text = "";
let sub = "";
char = format[position++];
while (char !== void 0 && char !== endDelimiter) {
sub += char;
char = format[position++];
}
const isClosed = char === endDelimiter;
const type = RE_TOKEN_LIST_VALUE.test(sub) ? "list" : isClosed && RE_TOKEN_NAMED_VALUE.test(sub) ? "named" : "unknown";
tokens.push({ value: sub, type });
} else {
text += char;
}
}
text && tokens.push({ type: "text", value: text });
return tokens;
}
function compile(tokens, values) {
const compiled = [];
let index = 0;
const mode = Array.isArray(values) ? "list" : isObject(values) ? "named" : "unknown";
if (mode === "unknown") {
return compiled;
}
while (index < tokens.length) {
const token = tokens[index];
switch (token.type) {
case "text":
compiled.push(token.value);
break;
case "list":
compiled.push(values[parseInt(token.value, 10)]);
break;
case "named":
if (mode === "named") {
compiled.push(values[token.value]);
} else {
{
console.warn(`Type of token '${token.type}' and format of value '${mode}' don't match!`);
}
}
break;
case "unknown":
{
console.warn(`Detect 'unknown' type of token!`);
}
break;
}
index++;
}
return compiled;
}
const LOCALE_ZH_HANS = "zh-Hans";
const LOCALE_ZH_HANT = "zh-Hant";
const LOCALE_EN = "en";
const LOCALE_FR = "fr";
const LOCALE_ES = "es";
const hasOwnProperty = Object.prototype.hasOwnProperty;
const hasOwn = (val, key) => hasOwnProperty.call(val, key);
const defaultFormatter = new BaseFormatter();
function include(str, parts) {
return !!parts.find((part) => str.indexOf(part) !== -1);
}
function startsWith(str, parts) {
return parts.find((part) => str.indexOf(part) === 0);
}
function normalizeLocale(locale, messages2) {
if (!locale) {
return;
}
locale = locale.trim().replace(/_/g, "-");
if (messages2 && messages2[locale]) {
return locale;
}
locale = locale.toLowerCase();
if (locale === "chinese") {
return LOCALE_ZH_HANS;
}
if (locale.indexOf("zh") === 0) {
if (locale.indexOf("-hans") > -1) {
return LOCALE_ZH_HANS;
}
if (locale.indexOf("-hant") > -1) {
return LOCALE_ZH_HANT;
}
if (include(locale, ["-tw", "-hk", "-mo", "-cht"])) {
return LOCALE_ZH_HANT;
}
return LOCALE_ZH_HANS;
}
let locales = [LOCALE_EN, LOCALE_FR, LOCALE_ES];
if (messages2 && Object.keys(messages2).length > 0) {
locales = Object.keys(messages2);
}
const lang = startsWith(locale, locales);
if (lang) {
return lang;
}
}
class I18n {
constructor({ locale, fallbackLocale, messages: messages2, watcher, formater: formater2 }) {
this.locale = LOCALE_EN;
this.fallbackLocale = LOCALE_EN;
this.message = {};
this.messages = {};
this.watchers = [];
if (fallbackLocale) {
this.fallbackLocale = fallbackLocale;
}
this.formater = formater2 || defaultFormatter;
this.messages = messages2 || {};
this.setLocale(locale || LOCALE_EN);
if (watcher) {
this.watchLocale(watcher);
}
}
setLocale(locale) {
const oldLocale = this.locale;
this.locale = normalizeLocale(locale, this.messages) || this.fallbackLocale;
if (!this.messages[this.locale]) {
this.messages[this.locale] = {};
}
this.message = this.messages[this.locale];
if (oldLocale !== this.locale) {
this.watchers.forEach((watcher) => {
watcher(this.locale, oldLocale);
});
}
}
getLocale() {
return this.locale;
}
watchLocale(fn) {
const index = this.watchers.push(fn) - 1;
return () => {
this.watchers.splice(index, 1);
};
}
add(locale, message, override = true) {
const curMessages = this.messages[locale];
if (curMessages) {
if (override) {
Object.assign(curMessages, message);
} else {
Object.keys(message).forEach((key) => {
if (!hasOwn(curMessages, key)) {
curMessages[key] = message[key];
}
});
}
} else {
this.messages[locale] = message;
}
}
f(message, values, delimiters) {
return this.formater.interpolate(message, values, delimiters).join("");
}
t(key, locale, values) {
let message = this.message;
if (typeof locale === "string") {
locale = normalizeLocale(locale, this.messages);
locale && (message = this.messages[locale]);
} else {
values = locale;
}
if (!hasOwn(message, key)) {
console.warn(`Cannot translate the value of keypath ${key}. Use the value of keypath as default.`);
return key;
}
return this.formater.interpolate(message[key], values).join("");
}
}
function watchAppLocale(appVm, i18n) {
if (appVm.$watchLocale) {
appVm.$watchLocale((newLocale) => {
i18n.setLocale(newLocale);
});
} else {
appVm.$watch(() => appVm.$locale, (newLocale) => {
i18n.setLocale(newLocale);
});
}
}
function getDefaultLocale() {
if (typeof uni !== "undefined" && uni.getLocale) {
return uni.getLocale();
}
if (typeof global !== "undefined" && global.getLocale) {
return global.getLocale();
}
return LOCALE_EN;
}
function initVueI18n(locale, messages2 = {}, fallbackLocale, watcher) {
if (typeof locale !== "string") {
[locale, messages2] = [
messages2,
locale
];
}
if (typeof locale !== "string") {
locale = getDefaultLocale();
}
if (typeof fallbackLocale !== "string") {
fallbackLocale = typeof __uniConfig !== "undefined" && __uniConfig.fallbackLocale || LOCALE_EN;
}
const i18n = new I18n({
locale,
fallbackLocale,
messages: messages2,
watcher
});
let t2 = (key, values) => {
if (typeof getApp !== "function") {
t2 = function(key2, values2) {
return i18n.t(key2, values2);
};
} else {
let isWatchedAppLocale = false;
t2 = function(key2, values2) {
const appVm = getApp().$vm;
if (appVm) {
appVm.$locale;
if (!isWatchedAppLocale) {
isWatchedAppLocale = true;
watchAppLocale(appVm, i18n);
}
}
return i18n.t(key2, values2);
};
}
return t2(key, values);
};
return {
i18n,
f(message, values, delimiters) {
return i18n.f(message, values, delimiters);
},
t(key, values) {
return t2(key, values);
},
add(locale2, message, override = true) {
return i18n.add(locale2, message, override);
},
watch(fn) {
return i18n.watchLocale(fn);
},
getLocale() {
return i18n.getLocale();
},
setLocale(newLocale) {
return i18n.setLocale(newLocale);
}
};
}
const en$1 = {
"uni-datetime-picker.selectDate": "select date",
"uni-datetime-picker.selectTime": "select time",
"uni-datetime-picker.selectDateTime": "select date and time",
"uni-datetime-picker.startDate": "start date",
"uni-datetime-picker.endDate": "end date",
"uni-datetime-picker.startTime": "start time",
"uni-datetime-picker.endTime": "end time",
"uni-datetime-picker.ok": "ok",
"uni-datetime-picker.clear": "clear",
"uni-datetime-picker.cancel": "cancel",
"uni-datetime-picker.year": "-",
"uni-datetime-picker.month": "",
"uni-calender.MON": "MON",
"uni-calender.TUE": "TUE",
"uni-calender.WED": "WED",
"uni-calender.THU": "THU",
"uni-calender.FRI": "FRI",
"uni-calender.SAT": "SAT",
"uni-calender.SUN": "SUN",
"uni-calender.confirm": "confirm"
};
const zhHans$1 = {
"uni-datetime-picker.selectDate": "选择日期",
"uni-datetime-picker.selectTime": "选择时间",
"uni-datetime-picker.selectDateTime": "选择日期时间",
"uni-datetime-picker.startDate": "开始日期",
"uni-datetime-picker.endDate": "结束日期",
"uni-datetime-picker.startTime": "开始时间",
"uni-datetime-picker.endTime": "结束时间",
"uni-datetime-picker.ok": "确定",
"uni-datetime-picker.clear": "清除",
"uni-datetime-picker.cancel": "取消",
"uni-datetime-picker.year": "年",
"uni-datetime-picker.month": "月",
"uni-calender.SUN": "日",
"uni-calender.MON": "一",
"uni-calender.TUE": "二",
"uni-calender.WED": "三",
"uni-calender.THU": "四",
"uni-calender.FRI": "五",
"uni-calender.SAT": "六",
"uni-calender.confirm": "确认"
};
const zhHant$1 = {
"uni-datetime-picker.selectDate": "選擇日期",
"uni-datetime-picker.selectTime": "選擇時間",
"uni-datetime-picker.selectDateTime": "選擇日期時間",
"uni-datetime-picker.startDate": "開始日期",
"uni-datetime-picker.endDate": "結束日期",
"uni-datetime-picker.startTime": "開始时间",
"uni-datetime-picker.endTime": "結束时间",
"uni-datetime-picker.ok": "確定",
"uni-datetime-picker.clear": "清除",
"uni-datetime-picker.cancel": "取消",
"uni-datetime-picker.year": "年",
"uni-datetime-picker.month": "月",
"uni-calender.SUN": "日",
"uni-calender.MON": "一",
"uni-calender.TUE": "二",
"uni-calender.WED": "三",
"uni-calender.THU": "四",
"uni-calender.FRI": "五",
"uni-calender.SAT": "六",
"uni-calender.confirm": "確認"
};
const i18nMessages = {
en: en$1,
"zh-Hans": zhHans$1,
"zh-Hant": zhHant$1
};
const {
t: t$3
} = initVueI18n(i18nMessages);
2024-10-14 07:22:41 +00:00
const _sfc_main$N = {
2024-09-24 09:21:34 +00:00
name: "UniDatetimePicker",
data() {
return {
indicatorStyle: `height: 50px;`,
visible: false,
fixNvueBug: {},
dateShow: true,
timeShow: true,
title: "日期和时间",
// 输入框当前时间
time: "",
// 当前的年月日时分秒
year: 1920,
month: 0,
day: 0,
hour: 0,
minute: 0,
second: 0,
// 起始时间
startYear: 1920,
startMonth: 1,
startDay: 1,
startHour: 0,
startMinute: 0,
startSecond: 0,
// 结束时间
endYear: 2120,
endMonth: 12,
endDay: 31,
endHour: 23,
endMinute: 59,
endSecond: 59
};
},
options: {
virtualHost: true
},
props: {
type: {
type: String,
default: "datetime"
},
value: {
type: [String, Number],
default: ""
},
modelValue: {
type: [String, Number],
default: ""
},
start: {
type: [Number, String],
default: ""
},
end: {
type: [Number, String],
default: ""
},
returnType: {
type: String,
default: "string"
},
disabled: {
type: [Boolean, String],
default: false
},
border: {
type: [Boolean, String],
default: true
},
hideSecond: {
type: [Boolean, String],
default: false
}
},
watch: {
modelValue: {
handler(newVal) {
if (newVal) {
this.parseValue(fixIosDateFormat(newVal));
this.initTime(false);
} else {
this.time = "";
this.parseValue(Date.now());
}
},
immediate: true
},
type: {
handler(newValue) {
if (newValue === "date") {
this.dateShow = true;
this.timeShow = false;
this.title = "日期";
} else if (newValue === "time") {
this.dateShow = false;
this.timeShow = true;
this.title = "时间";
} else {
this.dateShow = true;
this.timeShow = true;
this.title = "日期和时间";
}
},
immediate: true
},
start: {
handler(newVal) {
this.parseDatetimeRange(fixIosDateFormat(newVal), "start");
},
immediate: true
},
end: {
handler(newVal) {
this.parseDatetimeRange(fixIosDateFormat(newVal), "end");
},
immediate: true
},
// 月、日、时、分、秒可选范围变化后,检查当前值是否在范围内,不在则当前值重置为可选范围第一项
months(newVal) {
this.checkValue("month", this.month, newVal);
},
days(newVal) {
this.checkValue("day", this.day, newVal);
},
hours(newVal) {
this.checkValue("hour", this.hour, newVal);
},
minutes(newVal) {
this.checkValue("minute", this.minute, newVal);
},
seconds(newVal) {
this.checkValue("second", this.second, newVal);
}
},
computed: {
// 当前年、月、日、时、分、秒选择范围
years() {
return this.getCurrentRange("year");
},
months() {
return this.getCurrentRange("month");
},
days() {
return this.getCurrentRange("day");
},
hours() {
return this.getCurrentRange("hour");
},
minutes() {
return this.getCurrentRange("minute");
},
seconds() {
return this.getCurrentRange("second");
},
// picker 当前值数组
ymd() {
return [this.year - this.minYear, this.month - this.minMonth, this.day - this.minDay];
},
hms() {
return [this.hour - this.minHour, this.minute - this.minMinute, this.second - this.minSecond];
},
// 当前 date 是 start
currentDateIsStart() {
return this.year === this.startYear && this.month === this.startMonth && this.day === this.startDay;
},
// 当前 date 是 end
currentDateIsEnd() {
return this.year === this.endYear && this.month === this.endMonth && this.day === this.endDay;
},
// 当前年、月、日、时、分、秒的最小值和最大值
minYear() {
return this.startYear;
},
maxYear() {
return this.endYear;
},
minMonth() {
if (this.year === this.startYear) {
return this.startMonth;
} else {
return 1;
}
},
maxMonth() {
if (this.year === this.endYear) {
return this.endMonth;
} else {
return 12;
}
},
minDay() {
if (this.year === this.startYear && this.month === this.startMonth) {
return this.startDay;
} else {
return 1;
}
},
maxDay() {
if (this.year === this.endYear && this.month === this.endMonth) {
return this.endDay;
} else {
return this.daysInMonth(this.year, this.month);
}
},
minHour() {
if (this.type === "datetime") {
if (this.currentDateIsStart) {
return this.startHour;
} else {
return 0;
}
}
if (this.type === "time") {
return this.startHour;
}
},
maxHour() {
if (this.type === "datetime") {
if (this.currentDateIsEnd) {
return this.endHour;
} else {
return 23;
}
}
if (this.type === "time") {
return this.endHour;
}
},
minMinute() {
if (this.type === "datetime") {
if (this.currentDateIsStart && this.hour === this.startHour) {
return this.startMinute;
} else {
return 0;
}
}
if (this.type === "time") {
if (this.hour === this.startHour) {
return this.startMinute;
} else {
return 0;
}
}
},
maxMinute() {
if (this.type === "datetime") {
if (this.currentDateIsEnd && this.hour === this.endHour) {
return this.endMinute;
} else {
return 59;
}
}
if (this.type === "time") {
if (this.hour === this.endHour) {
return this.endMinute;
} else {
return 59;
}
}
},
minSecond() {
if (this.type === "datetime") {
if (this.currentDateIsStart && this.hour === this.startHour && this.minute === this.startMinute) {
return this.startSecond;
} else {
return 0;
}
}
if (this.type === "time") {
if (this.hour === this.startHour && this.minute === this.startMinute) {
return this.startSecond;
} else {
return 0;
}
}
},
maxSecond() {
if (this.type === "datetime") {
if (this.currentDateIsEnd && this.hour === this.endHour && this.minute === this.endMinute) {
return this.endSecond;
} else {
return 59;
}
}
if (this.type === "time") {
if (this.hour === this.endHour && this.minute === this.endMinute) {
return this.endSecond;
} else {
return 59;
}
}
},
/**
* for i18n
*/
selectTimeText() {
return t$3("uni-datetime-picker.selectTime");
},
okText() {
return t$3("uni-datetime-picker.ok");
},
clearText() {
return t$3("uni-datetime-picker.clear");
},
cancelText() {
return t$3("uni-datetime-picker.cancel");
}
},
mounted() {
},
methods: {
/**
* @param {Object} item
* 小于 10 在前面加个 0
*/
lessThanTen(item) {
return item < 10 ? "0" + item : item;
},
/**
* 解析时分秒字符串例如00:00:00
* @param {String} timeString
*/
parseTimeType(timeString) {
if (timeString) {
let timeArr = timeString.split(":");
this.hour = Number(timeArr[0]);
this.minute = Number(timeArr[1]);
this.second = Number(timeArr[2]);
}
},
/**
* 解析选择器初始值类型可以是字符串时间戳例如2000-10-02'08:30:00' 1610695109000
* @param {String | Number} datetime
*/
initPickerValue(datetime) {
let defaultValue = null;
if (datetime) {
defaultValue = this.compareValueWithStartAndEnd(datetime, this.start, this.end);
} else {
defaultValue = Date.now();
defaultValue = this.compareValueWithStartAndEnd(defaultValue, this.start, this.end);
}
this.parseValue(defaultValue);
},
/**
* 初始值规则
* - 用户设置初始值 value
* - 设置了起始时间 start终止时间 end start < value < end初始值为 value 否则初始值为 start
* - 只设置了起始时间 start start < value初始值为 value否则初始值为 start
* - 只设置了终止时间 end value < end初始值为 value否则初始值为 end
* - 无起始终止时间则初始值为 value
* - 无初始值 value则初始值为当前本地时间 Date.now()
* @param {Object} value
* @param {Object} dateBase
*/
compareValueWithStartAndEnd(value, start, end) {
let winner = null;
value = this.superTimeStamp(value);
start = this.superTimeStamp(start);
end = this.superTimeStamp(end);
if (start && end) {
if (value < start) {
winner = new Date(start);
} else if (value > end) {
winner = new Date(end);
} else {
winner = new Date(value);
}
} else if (start && !end) {
winner = start <= value ? new Date(value) : new Date(start);
} else if (!start && end) {
winner = value <= end ? new Date(value) : new Date(end);
} else {
winner = new Date(value);
}
return winner;
},
/**
* 转换为可比较的时间戳接受日期时分秒时间戳
* @param {Object} value
*/
superTimeStamp(value) {
let dateBase = "";
if (this.type === "time" && value && typeof value === "string") {
const now2 = /* @__PURE__ */ new Date();
const year = now2.getFullYear();
const month = now2.getMonth() + 1;
const day = now2.getDate();
dateBase = year + "/" + month + "/" + day + " ";
}
if (Number(value)) {
value = parseInt(value);
dateBase = 0;
}
return this.createTimeStamp(dateBase + value);
},
/**
* 解析默认值 value字符串时间戳
* @param {Object} defaultTime
*/
parseValue(value) {
if (!value) {
return;
}
if (this.type === "time" && typeof value === "string") {
this.parseTimeType(value);
} else {
let defaultDate = null;
defaultDate = new Date(value);
if (this.type !== "time") {
this.year = defaultDate.getFullYear();
this.month = defaultDate.getMonth() + 1;
this.day = defaultDate.getDate();
}
if (this.type !== "date") {
this.hour = defaultDate.getHours();
this.minute = defaultDate.getMinutes();
this.second = defaultDate.getSeconds();
}
}
if (this.hideSecond) {
this.second = 0;
}
},
/**
* 解析可选择时间范围 startend年月日字符串时间戳
* @param {Object} defaultTime
*/
parseDatetimeRange(point, pointType) {
if (!point) {
if (pointType === "start") {
this.startYear = 1920;
this.startMonth = 1;
this.startDay = 1;
this.startHour = 0;
this.startMinute = 0;
this.startSecond = 0;
}
if (pointType === "end") {
this.endYear = 2120;
this.endMonth = 12;
this.endDay = 31;
this.endHour = 23;
this.endMinute = 59;
this.endSecond = 59;
}
return;
}
if (this.type === "time") {
const pointArr = point.split(":");
this[pointType + "Hour"] = Number(pointArr[0]);
this[pointType + "Minute"] = Number(pointArr[1]);
this[pointType + "Second"] = Number(pointArr[2]);
} else {
if (!point) {
pointType === "start" ? this.startYear = this.year - 60 : this.endYear = this.year + 60;
return;
}
if (Number(point)) {
point = parseInt(point);
}
const hasTime = /[0-9]:[0-9]/;
if (this.type === "datetime" && pointType === "end" && typeof point === "string" && !hasTime.test(
point
)) {
point = point + " 23:59:59";
}
const pointDate = new Date(point);
this[pointType + "Year"] = pointDate.getFullYear();
this[pointType + "Month"] = pointDate.getMonth() + 1;
this[pointType + "Day"] = pointDate.getDate();
if (this.type === "datetime") {
this[pointType + "Hour"] = pointDate.getHours();
this[pointType + "Minute"] = pointDate.getMinutes();
this[pointType + "Second"] = pointDate.getSeconds();
}
}
},
// 获取 年、月、日、时、分、秒 当前可选范围
getCurrentRange(value) {
const range = [];
for (let i2 = this["min" + this.capitalize(value)]; i2 <= this["max" + this.capitalize(value)]; i2++) {
range.push(i2);
}
return range;
},
// 字符串首字母大写
capitalize(str) {
return str.charAt(0).toUpperCase() + str.slice(1);
},
// 检查当前值是否在范围内,不在则当前值重置为可选范围第一项
checkValue(name2, value, values) {
if (values.indexOf(value) === -1) {
this[name2] = values[0];
}
},
// 每个月的实际天数
daysInMonth(year, month) {
return new Date(year, month, 0).getDate();
},
/**
* 生成时间戳
* @param {Object} time
*/
createTimeStamp(time) {
if (!time)
return;
if (typeof time === "number") {
return time;
} else {
time = time.replace(/-/g, "/");
if (this.type === "date") {
time = time + " 00:00:00";
}
return Date.parse(time);
}
},
/**
* 生成日期或时间的字符串
*/
createDomSting() {
const yymmdd = this.year + "-" + this.lessThanTen(this.month) + "-" + this.lessThanTen(this.day);
let hhmmss = this.lessThanTen(this.hour) + ":" + this.lessThanTen(this.minute);
if (!this.hideSecond) {
hhmmss = hhmmss + ":" + this.lessThanTen(this.second);
}
if (this.type === "date") {
return yymmdd;
} else if (this.type === "time") {
return hhmmss;
} else {
return yymmdd + " " + hhmmss;
}
},
/**
* 初始化返回值并抛出 change 事件
*/
initTime(emit = true) {
this.time = this.createDomSting();
if (!emit)
return;
if (this.returnType === "timestamp" && this.type !== "time") {
this.$emit("change", this.createTimeStamp(this.time));
this.$emit("input", this.createTimeStamp(this.time));
this.$emit("update:modelValue", this.createTimeStamp(this.time));
} else {
this.$emit("change", this.time);
this.$emit("input", this.time);
this.$emit("update:modelValue", this.time);
}
},
/**
* 用户选择日期或时间更新 data
* @param {Object} e
*/
bindDateChange(e2) {
const val = e2.detail.value;
this.year = this.years[val[0]];
this.month = this.months[val[1]];
this.day = this.days[val[2]];
},
bindTimeChange(e2) {
const val = e2.detail.value;
this.hour = this.hours[val[0]];
this.minute = this.minutes[val[1]];
this.second = this.seconds[val[2]];
},
/**
* 初始化弹出层
*/
initTimePicker() {
if (this.disabled)
return;
const value = fixIosDateFormat(this.time);
this.initPickerValue(value);
this.visible = !this.visible;
},
/**
* 触发或关闭弹框
*/
tiggerTimePicker(e2) {
this.visible = !this.visible;
},
/**
* 用户点击清空按钮清空当前值
*/
clearTime() {
this.time = "";
this.$emit("change", this.time);
this.$emit("input", this.time);
this.$emit("update:modelValue", this.time);
this.tiggerTimePicker();
},
/**
* 用户点击确定按钮
*/
setTime() {
this.initTime();
this.tiggerTimePicker();
}
}
};
2024-10-14 07:22:41 +00:00
function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
2024-09-24 09:21:34 +00:00
return vue.openBlock(), vue.createElementBlock("view", { class: "uni-datetime-picker" }, [
vue.createElementVNode("view", {
onClick: _cache[0] || (_cache[0] = (...args) => $options.initTimePicker && $options.initTimePicker(...args))
}, [
vue.renderSlot(_ctx.$slots, "default", {}, () => [
vue.createElementVNode(
"view",
{
class: vue.normalizeClass(["uni-datetime-picker-timebox-pointer", { "uni-datetime-picker-disabled": $props.disabled, "uni-datetime-picker-timebox": $props.border }])
},
[
vue.createElementVNode(
"text",
{ class: "uni-datetime-picker-text" },
vue.toDisplayString($data.time),
1
/* TEXT */
),
!$data.time ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "uni-datetime-picker-time"
}, [
vue.createElementVNode(
"text",
{ class: "uni-datetime-picker-text" },
vue.toDisplayString($options.selectTimeText),
1
/* TEXT */
)
])) : vue.createCommentVNode("v-if", true)
],
2
/* CLASS */
)
], true)
]),
$data.visible ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
id: "mask",
class: "uni-datetime-picker-mask",
onClick: _cache[1] || (_cache[1] = (...args) => $options.tiggerTimePicker && $options.tiggerTimePicker(...args))
})) : vue.createCommentVNode("v-if", true),
$data.visible ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 1,
class: vue.normalizeClass(["uni-datetime-picker-popup", [$data.dateShow && $data.timeShow ? "" : "fix-nvue-height"]]),
style: vue.normalizeStyle($data.fixNvueBug)
},
[
vue.createElementVNode("view", { class: "uni-title" }, [
vue.createElementVNode(
"text",
{ class: "uni-datetime-picker-text" },
vue.toDisplayString($options.selectTimeText),
1
/* TEXT */
)
]),
$data.dateShow ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "uni-datetime-picker__container-box"
}, [
vue.createElementVNode("picker-view", {
class: "uni-datetime-picker-view",
"indicator-style": $data.indicatorStyle,
value: $options.ymd,
onChange: _cache[2] || (_cache[2] = (...args) => $options.bindDateChange && $options.bindDateChange(...args))
}, [
vue.createElementVNode("picker-view-column", null, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList($options.years, (item, index) => {
return vue.openBlock(), vue.createElementBlock("view", {
class: "uni-datetime-picker-item",
key: index
}, [
vue.createElementVNode(
"text",
{ class: "uni-datetime-picker-item" },
vue.toDisplayString($options.lessThanTen(item)),
1
/* TEXT */
)
]);
}),
128
/* KEYED_FRAGMENT */
))
]),
vue.createElementVNode("picker-view-column", null, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList($options.months, (item, index) => {
return vue.openBlock(), vue.createElementBlock("view", {
class: "uni-datetime-picker-item",
key: index
}, [
vue.createElementVNode(
"text",
{ class: "uni-datetime-picker-item" },
vue.toDisplayString($options.lessThanTen(item)),
1
/* TEXT */
)
]);
}),
128
/* KEYED_FRAGMENT */
))
]),
vue.createElementVNode("picker-view-column", null, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList($options.days, (item, index) => {
return vue.openBlock(), vue.createElementBlock("view", {
class: "uni-datetime-picker-item",
key: index
}, [
vue.createElementVNode(
"text",
{ class: "uni-datetime-picker-item" },
vue.toDisplayString($options.lessThanTen(item)),
1
/* TEXT */
)
]);
}),
128
/* KEYED_FRAGMENT */
))
])
], 40, ["indicator-style", "value"]),
vue.createCommentVNode(" 兼容 nvue 不支持伪类 "),
vue.createElementVNode("text", { class: "uni-datetime-picker-sign sign-left" }, "-"),
vue.createElementVNode("text", { class: "uni-datetime-picker-sign sign-right" }, "-")
])) : vue.createCommentVNode("v-if", true),
$data.timeShow ? (vue.openBlock(), vue.createElementBlock("view", {
key: 1,
class: "uni-datetime-picker__container-box"
}, [
vue.createElementVNode("picker-view", {
class: vue.normalizeClass(["uni-datetime-picker-view", [$props.hideSecond ? "time-hide-second" : ""]]),
"indicator-style": $data.indicatorStyle,
value: $options.hms,
onChange: _cache[3] || (_cache[3] = (...args) => $options.bindTimeChange && $options.bindTimeChange(...args))
}, [
vue.createElementVNode("picker-view-column", null, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList($options.hours, (item, index) => {
return vue.openBlock(), vue.createElementBlock("view", {
class: "uni-datetime-picker-item",
key: index
}, [
vue.createElementVNode(
"text",
{ class: "uni-datetime-picker-item" },
vue.toDisplayString($options.lessThanTen(item)),
1
/* TEXT */
)
]);
}),
128
/* KEYED_FRAGMENT */
))
]),
vue.createElementVNode("picker-view-column", null, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList($options.minutes, (item, index) => {
return vue.openBlock(), vue.createElementBlock("view", {
class: "uni-datetime-picker-item",
key: index
}, [
vue.createElementVNode(
"text",
{ class: "uni-datetime-picker-item" },
vue.toDisplayString($options.lessThanTen(item)),
1
/* TEXT */
)
]);
}),
128
/* KEYED_FRAGMENT */
))
]),
!$props.hideSecond ? (vue.openBlock(), vue.createElementBlock("picker-view-column", { key: 0 }, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList($options.seconds, (item, index) => {
return vue.openBlock(), vue.createElementBlock("view", {
class: "uni-datetime-picker-item",
key: index
}, [
vue.createElementVNode(
"text",
{ class: "uni-datetime-picker-item" },
vue.toDisplayString($options.lessThanTen(item)),
1
/* TEXT */
)
]);
}),
128
/* KEYED_FRAGMENT */
))
])) : vue.createCommentVNode("v-if", true)
], 42, ["indicator-style", "value"]),
vue.createCommentVNode(" 兼容 nvue 不支持伪类 "),
vue.createElementVNode(
"text",
{
class: vue.normalizeClass(["uni-datetime-picker-sign", [$props.hideSecond ? "sign-center" : "sign-left"]])
},
":",
2
/* CLASS */
),
!$props.hideSecond ? (vue.openBlock(), vue.createElementBlock("text", {
key: 0,
class: "uni-datetime-picker-sign sign-right"
}, ":")) : vue.createCommentVNode("v-if", true)
])) : vue.createCommentVNode("v-if", true),
vue.createElementVNode("view", { class: "uni-datetime-picker-btn" }, [
vue.createElementVNode("view", {
onClick: _cache[4] || (_cache[4] = (...args) => $options.clearTime && $options.clearTime(...args))
}, [
vue.createElementVNode(
"text",
{ class: "uni-datetime-picker-btn-text" },
vue.toDisplayString($options.clearText),
1
/* TEXT */
)
]),
vue.createElementVNode("view", { class: "uni-datetime-picker-btn-group" }, [
vue.createElementVNode("view", {
class: "uni-datetime-picker-cancel",
onClick: _cache[5] || (_cache[5] = (...args) => $options.tiggerTimePicker && $options.tiggerTimePicker(...args))
}, [
vue.createElementVNode(
"text",
{ class: "uni-datetime-picker-btn-text" },
vue.toDisplayString($options.cancelText),
1
/* TEXT */
)
]),
vue.createElementVNode("view", {
onClick: _cache[6] || (_cache[6] = (...args) => $options.setTime && $options.setTime(...args))
}, [
vue.createElementVNode(
"text",
{ class: "uni-datetime-picker-btn-text" },
vue.toDisplayString($options.okText),
1
/* TEXT */
)
])
])
])
],
6
/* CLASS, STYLE */
)) : vue.createCommentVNode("v-if", true)
]);
}
2024-10-14 07:22:41 +00:00
const TimePicker = /* @__PURE__ */ _export_sfc(_sfc_main$N, [["render", _sfc_render$c], ["__scopeId", "data-v-1d532b70"], ["__file", "D:/projects/cxc-szcx-uniapp/uni_modules/uni-datetime-picker/components/uni-datetime-picker/time-picker.vue"]]);
2024-09-24 09:21:34 +00:00
const {
t: t$2
} = initVueI18n(i18nMessages);
2024-10-14 07:22:41 +00:00
const _sfc_main$M = {
2024-09-24 09:21:34 +00:00
components: {
calendarItem,
timePicker: TimePicker
},
options: {
virtualHost: true
},
props: {
date: {
type: String,
default: ""
},
defTime: {
type: [String, Object],
default: ""
},
selectableTimes: {
type: [Object],
default() {
return {};
}
},
selected: {
type: Array,
default() {
return [];
}
},
startDate: {
type: String,
default: ""
},
endDate: {
type: String,
default: ""
},
startPlaceholder: {
type: String,
default: ""
},
endPlaceholder: {
type: String,
default: ""
},
range: {
type: Boolean,
default: false
},
hasTime: {
type: Boolean,
default: false
},
insert: {
type: Boolean,
default: true
},
showMonth: {
type: Boolean,
default: true
},
clearDate: {
type: Boolean,
default: true
},
checkHover: {
type: Boolean,
default: true
},
hideSecond: {
type: [Boolean],
default: false
},
pleStatus: {
type: Object,
default() {
return {
before: "",
after: "",
data: [],
fulldate: ""
};
}
},
defaultValue: {
type: [String, Object, Array],
default: ""
}
},
data() {
return {
show: false,
weeks: [],
calendar: {},
nowDate: {},
aniMaskShow: false,
firstEnter: true,
time: "",
timeRange: {
startTime: "",
endTime: ""
},
tempSingleDate: "",
tempRange: {
before: "",
after: ""
}
};
},
watch: {
date: {
immediate: true,
handler(newVal) {
if (!this.range) {
this.tempSingleDate = newVal;
setTimeout(() => {
this.init(newVal);
}, 100);
}
}
},
defTime: {
immediate: true,
handler(newVal) {
if (!this.range) {
this.time = newVal;
} else {
this.timeRange.startTime = newVal.start;
this.timeRange.endTime = newVal.end;
}
}
},
startDate(val) {
if (!this.cale) {
return;
}
this.cale.setStartDate(val);
this.cale.setDate(this.nowDate.fullDate);
this.weeks = this.cale.weeks;
},
endDate(val) {
if (!this.cale) {
return;
}
this.cale.setEndDate(val);
this.cale.setDate(this.nowDate.fullDate);
this.weeks = this.cale.weeks;
},
selected(newVal) {
if (!this.cale) {
return;
}
this.cale.setSelectInfo(this.nowDate.fullDate, newVal);
this.weeks = this.cale.weeks;
},
pleStatus: {
immediate: true,
handler(newVal) {
const {
before,
after,
fulldate,
which
} = newVal;
this.tempRange.before = before;
this.tempRange.after = after;
setTimeout(() => {
if (fulldate) {
this.cale.setHoverMultiple(fulldate);
if (before && after) {
this.cale.lastHover = true;
if (this.rangeWithinMonth(after, before))
return;
this.setDate(before);
} else {
this.cale.setMultiple(fulldate);
this.setDate(this.nowDate.fullDate);
this.calendar.fullDate = "";
this.cale.lastHover = false;
}
} else {
if (!this.cale) {
return;
}
this.cale.setDefaultMultiple(before, after);
if (which === "left" && before) {
this.setDate(before);
this.weeks = this.cale.weeks;
} else if (after) {
this.setDate(after);
this.weeks = this.cale.weeks;
}
this.cale.lastHover = true;
}
}, 16);
}
}
},
computed: {
timepickerStartTime() {
const activeDate = this.range ? this.tempRange.before : this.calendar.fullDate;
return activeDate === this.startDate ? this.selectableTimes.start : "";
},
timepickerEndTime() {
const activeDate = this.range ? this.tempRange.after : this.calendar.fullDate;
return activeDate === this.endDate ? this.selectableTimes.end : "";
},
/**
* for i18n
*/
selectDateText() {
return t$2("uni-datetime-picker.selectDate");
},
startDateText() {
return this.startPlaceholder || t$2("uni-datetime-picker.startDate");
},
endDateText() {
return this.endPlaceholder || t$2("uni-datetime-picker.endDate");
},
okText() {
return t$2("uni-datetime-picker.ok");
},
yearText() {
return t$2("uni-datetime-picker.year");
},
monthText() {
return t$2("uni-datetime-picker.month");
},
MONText() {
return t$2("uni-calender.MON");
},
TUEText() {
return t$2("uni-calender.TUE");
},
WEDText() {
return t$2("uni-calender.WED");
},
THUText() {
return t$2("uni-calender.THU");
},
FRIText() {
return t$2("uni-calender.FRI");
},
SATText() {
return t$2("uni-calender.SAT");
},
SUNText() {
return t$2("uni-calender.SUN");
},
confirmText() {
return t$2("uni-calender.confirm");
}
},
created() {
this.cale = new Calendar$1({
selected: this.selected,
startDate: this.startDate,
endDate: this.endDate,
range: this.range
});
this.init(this.date);
},
methods: {
leaveCale() {
this.firstEnter = true;
},
handleMouse(weeks) {
if (weeks.disable)
return;
if (this.cale.lastHover)
return;
let {
before,
after
} = this.cale.multipleStatus;
if (!before)
return;
this.calendar = weeks;
this.cale.setHoverMultiple(this.calendar.fullDate);
this.weeks = this.cale.weeks;
if (this.firstEnter) {
this.$emit("firstEnterCale", this.cale.multipleStatus);
this.firstEnter = false;
}
},
rangeWithinMonth(A2, B2) {
const [yearA, monthA] = A2.split("-");
const [yearB, monthB] = B2.split("-");
return yearA === yearB && monthA === monthB;
},
// 蒙版点击事件
maskClick() {
this.close();
this.$emit("maskClose");
},
clearCalender() {
if (this.range) {
this.timeRange.startTime = "";
this.timeRange.endTime = "";
this.tempRange.before = "";
this.tempRange.after = "";
this.cale.multipleStatus.before = "";
this.cale.multipleStatus.after = "";
this.cale.multipleStatus.data = [];
this.cale.lastHover = false;
} else {
this.time = "";
this.tempSingleDate = "";
}
this.calendar.fullDate = "";
this.setDate(/* @__PURE__ */ new Date());
},
bindDateChange(e2) {
const value = e2.detail.value + "-1";
this.setDate(value);
},
/**
* 初始化日期显示
* @param {Object} date
*/
init(date) {
if (!this.cale) {
return;
}
this.cale.setDate(date || /* @__PURE__ */ new Date());
this.weeks = this.cale.weeks;
this.nowDate = this.cale.getInfo(date);
this.calendar = {
...this.nowDate
};
if (!date) {
this.calendar.fullDate = "";
if (this.defaultValue && !this.range) {
const defaultDate = new Date(this.defaultValue);
const fullDate = getDate(defaultDate);
const year = defaultDate.getFullYear();
const month = defaultDate.getMonth() + 1;
const date2 = defaultDate.getDate();
const day = defaultDate.getDay();
this.calendar = {
fullDate,
year,
month,
date: date2,
day
}, this.tempSingleDate = fullDate;
this.time = getTime$1(defaultDate, this.hideSecond);
}
}
},
/**
* 打开日历弹窗
*/
open() {
if (this.clearDate && !this.insert) {
this.cale.cleanMultipleStatus();
this.init(this.date);
}
this.show = true;
this.$nextTick(() => {
setTimeout(() => {
this.aniMaskShow = true;
}, 50);
});
},
/**
* 关闭日历弹窗
*/
close() {
this.aniMaskShow = false;
this.$nextTick(() => {
setTimeout(() => {
this.show = false;
this.$emit("close");
}, 300);
});
},
/**
* 确认按钮
*/
confirm() {
this.setEmit("confirm");
this.close();
},
/**
* 变化触发
*/
change(isSingleChange) {
if (!this.insert && !isSingleChange)
return;
this.setEmit("change");
},
/**
* 选择月份触发
*/
monthSwitch() {
let {
year,
month
} = this.nowDate;
this.$emit("monthSwitch", {
year,
month: Number(month)
});
},
/**
* 派发事件
* @param {Object} name
*/
setEmit(name2) {
if (!this.range) {
if (!this.calendar.fullDate) {
this.calendar = this.cale.getInfo(/* @__PURE__ */ new Date());
this.tempSingleDate = this.calendar.fullDate;
}
if (this.hasTime && !this.time) {
this.time = getTime$1(/* @__PURE__ */ new Date(), this.hideSecond);
}
}
let {
year,
month,
date,
fullDate,
extraInfo
} = this.calendar;
this.$emit(name2, {
range: this.cale.multipleStatus,
year,
month,
date,
time: this.time,
timeRange: this.timeRange,
fulldate: fullDate,
extraInfo: extraInfo || {}
});
},
/**
* 选择天触发
* @param {Object} weeks
*/
choiceDate(weeks) {
if (weeks.disable)
return;
this.calendar = weeks;
this.calendar.userChecked = true;
this.cale.setMultiple(this.calendar.fullDate, true);
this.weeks = this.cale.weeks;
this.tempSingleDate = this.calendar.fullDate;
const beforeDate = new Date(this.cale.multipleStatus.before).getTime();
const afterDate = new Date(this.cale.multipleStatus.after).getTime();
if (beforeDate > afterDate && afterDate) {
this.tempRange.before = this.cale.multipleStatus.after;
this.tempRange.after = this.cale.multipleStatus.before;
} else {
this.tempRange.before = this.cale.multipleStatus.before;
this.tempRange.after = this.cale.multipleStatus.after;
}
this.change(true);
},
changeMonth(type) {
let newDate;
if (type === "pre") {
newDate = this.cale.getPreMonthObj(this.nowDate.fullDate).fullDate;
} else if (type === "next") {
newDate = this.cale.getNextMonthObj(this.nowDate.fullDate).fullDate;
}
this.setDate(newDate);
this.monthSwitch();
},
/**
* 设置日期
* @param {Object} date
*/
setDate(date) {
this.cale.setDate(date);
this.weeks = this.cale.weeks;
this.nowDate = this.cale.getInfo(date);
}
}
};
2024-10-14 07:22:41 +00:00
function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
2024-09-24 09:21:34 +00:00
const _component_calendar_item = vue.resolveComponent("calendar-item");
const _component_time_picker = vue.resolveComponent("time-picker");
const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_1$1);
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: "uni-calendar",
onMouseleave: _cache[8] || (_cache[8] = (...args) => $options.leaveCale && $options.leaveCale(...args))
},
[
!$props.insert && $data.show ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 0,
class: vue.normalizeClass(["uni-calendar__mask", { "uni-calendar--mask-show": $data.aniMaskShow }]),
onClick: _cache[0] || (_cache[0] = (...args) => $options.maskClick && $options.maskClick(...args))
},
null,
2
/* CLASS */
)) : vue.createCommentVNode("v-if", true),
$props.insert || $data.show ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 1,
class: vue.normalizeClass(["uni-calendar__content", { "uni-calendar--fixed": !$props.insert, "uni-calendar--ani-show": $data.aniMaskShow, "uni-calendar__content-mobile": $data.aniMaskShow }])
},
[
vue.createElementVNode(
"view",
{
class: vue.normalizeClass(["uni-calendar__header", { "uni-calendar__header-mobile": !$props.insert }])
},
[
vue.createElementVNode("view", {
class: "uni-calendar__header-btn-box",
onClick: _cache[1] || (_cache[1] = vue.withModifiers(($event) => $options.changeMonth("pre"), ["stop"]))
}, [
vue.createElementVNode("view", { class: "uni-calendar__header-btn uni-calendar--left" })
]),
vue.createElementVNode("picker", {
mode: "date",
value: $props.date,
fields: "month",
onChange: _cache[2] || (_cache[2] = (...args) => $options.bindDateChange && $options.bindDateChange(...args))
}, [
vue.createElementVNode(
"text",
{ class: "uni-calendar__header-text" },
vue.toDisplayString(($data.nowDate.year || "") + $options.yearText + ($data.nowDate.month || "") + $options.monthText),
1
/* TEXT */
)
], 40, ["value"]),
vue.createElementVNode("view", {
class: "uni-calendar__header-btn-box",
onClick: _cache[3] || (_cache[3] = vue.withModifiers(($event) => $options.changeMonth("next"), ["stop"]))
}, [
vue.createElementVNode("view", { class: "uni-calendar__header-btn uni-calendar--right" })
]),
!$props.insert ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "dialog-close",
onClick: _cache[4] || (_cache[4] = (...args) => $options.maskClick && $options.maskClick(...args))
}, [
vue.createElementVNode("view", {
class: "dialog-close-plus",
"data-id": "close"
}),
vue.createElementVNode("view", {
class: "dialog-close-plus dialog-close-rotate",
"data-id": "close"
})
])) : vue.createCommentVNode("v-if", true)
],
2
/* CLASS */
),
vue.createElementVNode("view", { class: "uni-calendar__box" }, [
$props.showMonth ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "uni-calendar__box-bg"
}, [
vue.createElementVNode(
"text",
{ class: "uni-calendar__box-bg-text" },
vue.toDisplayString($data.nowDate.month),
1
/* TEXT */
)
])) : vue.createCommentVNode("v-if", true),
vue.createElementVNode("view", {
class: "uni-calendar__weeks",
style: { "padding-bottom": "7px" }
}, [
vue.createElementVNode("view", { class: "uni-calendar__weeks-day" }, [
vue.createElementVNode(
"text",
{ class: "uni-calendar__weeks-day-text" },
vue.toDisplayString($options.SUNText),
1
/* TEXT */
)
]),
vue.createElementVNode("view", { class: "uni-calendar__weeks-day" }, [
vue.createElementVNode(
"text",
{ class: "uni-calendar__weeks-day-text" },
vue.toDisplayString($options.MONText),
1
/* TEXT */
)
]),
vue.createElementVNode("view", { class: "uni-calendar__weeks-day" }, [
vue.createElementVNode(
"text",
{ class: "uni-calendar__weeks-day-text" },
vue.toDisplayString($options.TUEText),
1
/* TEXT */
)
]),
vue.createElementVNode("view", { class: "uni-calendar__weeks-day" }, [
vue.createElementVNode(
"text",
{ class: "uni-calendar__weeks-day-text" },
vue.toDisplayString($options.WEDText),
1
/* TEXT */
)
]),
vue.createElementVNode("view", { class: "uni-calendar__weeks-day" }, [
vue.createElementVNode(
"text",
{ class: "uni-calendar__weeks-day-text" },
vue.toDisplayString($options.THUText),
1
/* TEXT */
)
]),
vue.createElementVNode("view", { class: "uni-calendar__weeks-day" }, [
vue.createElementVNode(
"text",
{ class: "uni-calendar__weeks-day-text" },
vue.toDisplayString($options.FRIText),
1
/* TEXT */
)
]),
vue.createElementVNode("view", { class: "uni-calendar__weeks-day" }, [
vue.createElementVNode(
"text",
{ class: "uni-calendar__weeks-day-text" },
vue.toDisplayString($options.SATText),
1
/* TEXT */
)
])
]),
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList($data.weeks, (item, weekIndex) => {
return vue.openBlock(), vue.createElementBlock("view", {
class: "uni-calendar__weeks",
key: weekIndex
}, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(item, (weeks, weeksIndex) => {
return vue.openBlock(), vue.createElementBlock("view", {
class: "uni-calendar__weeks-item",
key: weeksIndex
}, [
vue.createVNode(_component_calendar_item, {
class: "uni-calendar-item--hook",
weeks,
calendar: $data.calendar,
selected: $props.selected,
checkHover: $props.range,
onChange: $options.choiceDate,
onHandleMouse: $options.handleMouse
}, null, 8, ["weeks", "calendar", "selected", "checkHover", "onChange", "onHandleMouse"])
]);
}),
128
/* KEYED_FRAGMENT */
))
]);
}),
128
/* KEYED_FRAGMENT */
))
]),
!$props.insert && !$props.range && $props.hasTime ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "uni-date-changed uni-calendar--fixed-top",
style: { "padding": "0 80px" }
}, [
vue.createElementVNode(
"view",
{ class: "uni-date-changed--time-date" },
vue.toDisplayString($data.tempSingleDate ? $data.tempSingleDate : $options.selectDateText),
1
/* TEXT */
),
vue.createVNode(_component_time_picker, {
type: "time",
start: $options.timepickerStartTime,
end: $options.timepickerEndTime,
modelValue: $data.time,
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => $data.time = $event),
disabled: !$data.tempSingleDate,
border: false,
"hide-second": $props.hideSecond,
class: "time-picker-style"
}, null, 8, ["start", "end", "modelValue", "disabled", "hide-second"])
])) : vue.createCommentVNode("v-if", true),
!$props.insert && $props.range && $props.hasTime ? (vue.openBlock(), vue.createElementBlock("view", {
key: 1,
class: "uni-date-changed uni-calendar--fixed-top"
}, [
vue.createElementVNode("view", { class: "uni-date-changed--time-start" }, [
vue.createElementVNode(
"view",
{ class: "uni-date-changed--time-date" },
vue.toDisplayString($data.tempRange.before ? $data.tempRange.before : $options.startDateText),
1
/* TEXT */
),
vue.createVNode(_component_time_picker, {
type: "time",
start: $options.timepickerStartTime,
modelValue: $data.timeRange.startTime,
"onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => $data.timeRange.startTime = $event),
border: false,
"hide-second": $props.hideSecond,
disabled: !$data.tempRange.before,
class: "time-picker-style"
}, null, 8, ["start", "modelValue", "hide-second", "disabled"])
]),
vue.createElementVNode("view", { style: { "line-height": "50px" } }, [
vue.createVNode(_component_uni_icons, {
type: "arrowthinright",
color: "#999"
})
]),
vue.createElementVNode("view", { class: "uni-date-changed--time-end" }, [
vue.createElementVNode(
"view",
{ class: "uni-date-changed--time-date" },
vue.toDisplayString($data.tempRange.after ? $data.tempRange.after : $options.endDateText),
1
/* TEXT */
),
vue.createVNode(_component_time_picker, {
type: "time",
end: $options.timepickerEndTime,
modelValue: $data.timeRange.endTime,
"onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => $data.timeRange.endTime = $event),
border: false,
"hide-second": $props.hideSecond,
disabled: !$data.tempRange.after,
class: "time-picker-style"
}, null, 8, ["end", "modelValue", "hide-second", "disabled"])
])
])) : vue.createCommentVNode("v-if", true),
!$props.insert ? (vue.openBlock(), vue.createElementBlock("view", {
key: 2,
class: "uni-date-changed uni-date-btn--ok"
}, [
vue.createCommentVNode(' <view class="uni-datetime-picker--btn" @click="confirm">{{confirmText}}</view>by xxl ')
])) : vue.createCommentVNode("v-if", true)
],
2
/* CLASS */
)) : vue.createCommentVNode("v-if", true)
],
32
/* NEED_HYDRATION */
);
}
2024-10-14 07:22:41 +00:00
const Calendar = /* @__PURE__ */ _export_sfc(_sfc_main$M, [["render", _sfc_render$b], ["__scopeId", "data-v-1d379219"], ["__file", "D:/projects/cxc-szcx-uniapp/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar.vue"]]);
const _sfc_main$L = {
2024-09-24 09:21:34 +00:00
name: "UniDatetimePicker",
options: {
virtualHost: true
},
components: {
Calendar,
TimePicker
},
data() {
return {
isRange: false,
hasTime: false,
displayValue: "",
inputDate: "",
calendarDate: "",
pickerTime: "",
calendarRange: {
startDate: "",
startTime: "",
endDate: "",
endTime: ""
},
displayRangeValue: {
startDate: "",
endDate: ""
},
tempRange: {
startDate: "",
startTime: "",
endDate: "",
endTime: ""
},
// 左右日历同步数据
startMultipleStatus: {
before: "",
after: "",
data: [],
fulldate: ""
},
endMultipleStatus: {
before: "",
after: "",
data: [],
fulldate: ""
},
pickerVisible: false,
pickerPositionStyle: null,
isEmitValue: false,
isPhone: false,
isFirstShow: true,
i18nT: () => {
}
};
},
props: {
type: {
type: String,
default: "datetime"
},
value: {
type: [String, Number, Array, Date],
default: ""
},
modelValue: {
type: [String, Number, Array, Date],
default: ""
},
start: {
type: [Number, String],
default: ""
},
end: {
type: [Number, String],
default: ""
},
returnType: {
type: String,
default: "string"
},
placeholder: {
type: String,
default: ""
},
startPlaceholder: {
type: String,
default: ""
},
endPlaceholder: {
type: String,
default: ""
},
rangeSeparator: {
type: String,
default: "-"
},
border: {
type: [Boolean],
default: true
},
disabled: {
type: [Boolean],
default: false
},
clearIcon: {
type: [Boolean],
default: true
},
hideSecond: {
type: [Boolean],
default: false
},
defaultValue: {
type: [String, Object, Array],
default: ""
}
},
watch: {
type: {
immediate: true,
handler(newVal) {
this.hasTime = newVal.indexOf("time") !== -1;
this.isRange = newVal.indexOf("range") !== -1;
}
},
modelValue: {
immediate: true,
handler(newVal) {
if (this.isEmitValue) {
this.isEmitValue = false;
return;
}
this.initPicker(newVal);
}
},
start: {
immediate: true,
handler(newVal) {
if (!newVal)
return;
this.calendarRange.startDate = getDate(newVal);
if (this.hasTime) {
this.calendarRange.startTime = getTime$1(newVal);
}
}
},
end: {
immediate: true,
handler(newVal) {
if (!newVal)
return;
this.calendarRange.endDate = getDate(newVal);
if (this.hasTime) {
this.calendarRange.endTime = getTime$1(newVal, this.hideSecond);
}
}
}
},
computed: {
timepickerStartTime() {
const activeDate = this.isRange ? this.tempRange.startDate : this.inputDate;
return activeDate === this.calendarRange.startDate ? this.calendarRange.startTime : "";
},
timepickerEndTime() {
const activeDate = this.isRange ? this.tempRange.endDate : this.inputDate;
return activeDate === this.calendarRange.endDate ? this.calendarRange.endTime : "";
},
mobileCalendarTime() {
const timeRange = {
start: this.tempRange.startTime,
end: this.tempRange.endTime
};
return this.isRange ? timeRange : this.pickerTime;
},
mobSelectableTime() {
return {
start: this.calendarRange.startTime,
end: this.calendarRange.endTime
};
},
datePopupWidth() {
return this.isRange ? 653 : 301;
},
/**
* for i18n
*/
singlePlaceholderText() {
return this.placeholder || (this.type === "date" ? this.selectDateText : this.selectDateTimeText);
},
startPlaceholderText() {
return this.startPlaceholder || this.startDateText;
},
endPlaceholderText() {
return this.endPlaceholder || this.endDateText;
},
selectDateText() {
return this.i18nT("uni-datetime-picker.selectDate");
},
selectDateTimeText() {
return this.i18nT("uni-datetime-picker.selectDateTime");
},
selectTimeText() {
return this.i18nT("uni-datetime-picker.selectTime");
},
startDateText() {
return this.startPlaceholder || this.i18nT("uni-datetime-picker.startDate");
},
startTimeText() {
return this.i18nT("uni-datetime-picker.startTime");
},
endDateText() {
return this.endPlaceholder || this.i18nT("uni-datetime-picker.endDate");
},
endTimeText() {
return this.i18nT("uni-datetime-picker.endTime");
},
okText() {
return this.i18nT("uni-datetime-picker.ok");
},
clearText() {
return this.i18nT("uni-datetime-picker.clear");
},
showClearIcon() {
return this.clearIcon && !this.disabled && (this.displayValue || this.displayRangeValue.startDate && this.displayRangeValue.endDate);
}
},
created() {
this.initI18nT();
this.platform();
},
methods: {
initI18nT() {
const vueI18n = initVueI18n(i18nMessages);
this.i18nT = vueI18n.t;
},
initPicker(newVal) {
if (!newVal && !this.defaultValue || Array.isArray(newVal) && !newVal.length) {
this.$nextTick(() => {
this.clear(false);
});
return;
}
if (!Array.isArray(newVal) && !this.isRange) {
if (newVal) {
this.displayValue = this.inputDate = this.calendarDate = getDate(newVal);
if (this.hasTime) {
this.pickerTime = getTime$1(newVal, this.hideSecond);
this.displayValue = `${this.displayValue} ${this.pickerTime}`;
}
} else if (this.defaultValue) {
this.inputDate = this.calendarDate = getDate(this.defaultValue);
if (this.hasTime) {
this.pickerTime = getTime$1(this.defaultValue, this.hideSecond);
}
}
} else {
const [before, after] = newVal;
if (!before && !after)
return;
const beforeDate = getDate(before);
const beforeTime = getTime$1(before, this.hideSecond);
const afterDate = getDate(after);
const afterTime = getTime$1(after, this.hideSecond);
const startDate = beforeDate;
const endDate = afterDate;
this.displayRangeValue.startDate = this.tempRange.startDate = startDate;
this.displayRangeValue.endDate = this.tempRange.endDate = endDate;
if (this.hasTime) {
this.displayRangeValue.startDate = `${beforeDate} ${beforeTime}`;
this.displayRangeValue.endDate = `${afterDate} ${afterTime}`;
this.tempRange.startTime = beforeTime;
this.tempRange.endTime = afterTime;
}
const defaultRange = {
before: beforeDate,
after: afterDate
};
this.startMultipleStatus = Object.assign({}, this.startMultipleStatus, defaultRange, {
which: "right"
});
this.endMultipleStatus = Object.assign({}, this.endMultipleStatus, defaultRange, {
which: "left"
});
}
},
updateLeftCale(e2) {
const left = this.$refs.left;
left.cale.setHoverMultiple(e2.after);
left.setDate(this.$refs.left.nowDate.fullDate);
},
updateRightCale(e2) {
const right = this.$refs.right;
right.cale.setHoverMultiple(e2.after);
right.setDate(this.$refs.right.nowDate.fullDate);
},
platform() {
if (typeof navigator !== "undefined") {
this.isPhone = navigator.userAgent.toLowerCase().indexOf("mobile") !== -1;
return;
}
const {
windowWidth
} = uni.getSystemInfoSync();
this.isPhone = windowWidth <= 500;
this.windowWidth = windowWidth;
},
show() {
this.$emit("show");
if (this.disabled) {
return;
}
this.platform();
if (this.isPhone) {
setTimeout(() => {
this.$refs.mobile.open();
}, 0);
return;
}
this.pickerPositionStyle = {
top: "10px"
};
const dateEditor = uni.createSelectorQuery().in(this).select(".uni-date-editor");
dateEditor.boundingClientRect((rect) => {
if (this.windowWidth - rect.left < this.datePopupWidth) {
this.pickerPositionStyle.right = 0;
}
}).exec();
setTimeout(() => {
this.pickerVisible = !this.pickerVisible;
if (!this.isPhone && this.isRange && this.isFirstShow) {
this.isFirstShow = false;
const {
startDate,
endDate
} = this.calendarRange;
if (startDate && endDate) {
if (this.diffDate(startDate, endDate) < 30) {
this.$refs.right.changeMonth("pre");
}
} else {
if (this.isPhone) {
this.$refs.right.cale.lastHover = false;
}
}
}
}, 50);
},
close() {
setTimeout(() => {
this.pickerVisible = false;
this.$emit("maskClick", this.value);
this.$refs.mobile && this.$refs.mobile.close();
}, 20);
},
setEmit(value) {
if (this.returnType === "timestamp" || this.returnType === "date") {
if (!Array.isArray(value)) {
if (!this.hasTime) {
value = value + " 00:00:00";
}
value = this.createTimestamp(value);
if (this.returnType === "date") {
value = new Date(value);
}
} else {
if (!this.hasTime) {
value[0] = value[0] + " 00:00:00";
value[1] = value[1] + " 00:00:00";
}
value[0] = this.createTimestamp(value[0]);
value[1] = this.createTimestamp(value[1]);
if (this.returnType === "date") {
value[0] = new Date(value[0]);
value[1] = new Date(value[1]);
}
}
}
this.$emit("update:modelValue", value);
this.$emit("input", value);
this.$emit("change", value);
this.isEmitValue = true;
},
createTimestamp(date) {
date = fixIosDateFormat(date);
return Date.parse(new Date(date));
},
singleChange(e2) {
this.calendarDate = this.inputDate = e2.fulldate;
if (this.hasTime)
return;
this.confirmSingleChange();
},
confirmSingleChange() {
if (!checkDate(this.inputDate)) {
const now2 = /* @__PURE__ */ new Date();
this.calendarDate = this.inputDate = getDate(now2);
this.pickerTime = getTime$1(now2, this.hideSecond);
}
let startLaterInputDate = false;
let startDate, startTime;
if (this.start) {
let startString = this.start;
if (typeof this.start === "number") {
startString = getDateTime(this.start, this.hideSecond);
}
[startDate, startTime] = startString.split(" ");
if (this.start && !dateCompare(startDate, this.inputDate)) {
startLaterInputDate = true;
this.inputDate = startDate;
}
}
let endEarlierInputDate = false;
let endDate, endTime;
if (this.end) {
let endString = this.end;
if (typeof this.end === "number") {
endString = getDateTime(this.end, this.hideSecond);
}
[endDate, endTime] = endString.split(" ");
if (this.end && !dateCompare(this.inputDate, endDate)) {
endEarlierInputDate = true;
this.inputDate = endDate;
}
}
if (this.hasTime) {
if (startLaterInputDate) {
this.pickerTime = startTime || getDefaultSecond(this.hideSecond);
}
if (endEarlierInputDate) {
this.pickerTime = endTime || getDefaultSecond(this.hideSecond);
}
if (!this.pickerTime) {
this.pickerTime = getTime$1(Date.now(), this.hideSecond);
}
this.displayValue = `${this.inputDate} ${this.pickerTime}`;
} else {
this.displayValue = this.inputDate;
}
this.setEmit(this.displayValue);
this.pickerVisible = false;
},
leftChange(e2) {
const {
before,
after
} = e2.range;
this.rangeChange(before, after);
const obj = {
before: e2.range.before,
after: e2.range.after,
data: e2.range.data,
fulldate: e2.fulldate
};
this.startMultipleStatus = Object.assign({}, this.startMultipleStatus, obj);
this.$emit("calendarClick", e2);
},
rightChange(e2) {
const {
before,
after
} = e2.range;
this.rangeChange(before, after);
const obj = {
before: e2.range.before,
after: e2.range.after,
data: e2.range.data,
fulldate: e2.fulldate
};
this.endMultipleStatus = Object.assign({}, this.endMultipleStatus, obj);
this.$emit("calendarClick", e2);
},
mobileChange(e2) {
if (this.isRange) {
const {
before,
after
} = e2.range;
if (!before) {
return;
}
this.handleStartAndEnd(before, after, true);
if (this.hasTime) {
const {
startTime,
endTime
} = e2.timeRange;
this.tempRange.startTime = startTime;
this.tempRange.endTime = endTime;
}
this.confirmRangeChange();
} else {
if (this.hasTime) {
this.displayValue = e2.fulldate + " " + e2.time;
} else {
this.displayValue = e2.fulldate;
}
this.setEmit(this.displayValue);
}
this.$refs.mobile.close();
},
rangeChange(before, after) {
if (!(before && after))
return;
this.handleStartAndEnd(before, after, true);
if (this.hasTime)
return;
this.confirmRangeChange();
},
confirmRangeChange() {
if (!this.tempRange.startDate || !this.tempRange.endDate) {
this.pickerVisible = false;
return;
}
if (!checkDate(this.tempRange.startDate)) {
this.tempRange.startDate = getDate(Date.now());
}
if (!checkDate(this.tempRange.endDate)) {
this.tempRange.endDate = getDate(Date.now());
}
let start, end;
let startDateLaterRangeStartDate = false;
let startDateLaterRangeEndDate = false;
let startDate, startTime;
if (this.start) {
let startString = this.start;
if (typeof this.start === "number") {
startString = getDateTime(this.start, this.hideSecond);
}
[startDate, startTime] = startString.split(" ");
if (this.start && !dateCompare(this.start, this.tempRange.startDate)) {
startDateLaterRangeStartDate = true;
this.tempRange.startDate = startDate;
}
if (this.start && !dateCompare(this.start, this.tempRange.endDate)) {
startDateLaterRangeEndDate = true;
this.tempRange.endDate = startDate;
}
}
let endDateEarlierRangeStartDate = false;
let endDateEarlierRangeEndDate = false;
let endDate, endTime;
if (this.end) {
let endString = this.end;
if (typeof this.end === "number") {
endString = getDateTime(this.end, this.hideSecond);
}
[endDate, endTime] = endString.split(" ");
if (this.end && !dateCompare(this.tempRange.startDate, this.end)) {
endDateEarlierRangeStartDate = true;
this.tempRange.startDate = endDate;
}
if (this.end && !dateCompare(this.tempRange.endDate, this.end)) {
endDateEarlierRangeEndDate = true;
this.tempRange.endDate = endDate;
}
}
if (!this.hasTime) {
start = this.displayRangeValue.startDate = this.tempRange.startDate;
end = this.displayRangeValue.endDate = this.tempRange.endDate;
} else {
if (startDateLaterRangeStartDate) {
this.tempRange.startTime = startTime || getDefaultSecond(this.hideSecond);
} else if (endDateEarlierRangeStartDate) {
this.tempRange.startTime = endTime || getDefaultSecond(this.hideSecond);
}
if (!this.tempRange.startTime) {
this.tempRange.startTime = getTime$1(Date.now(), this.hideSecond);
}
if (startDateLaterRangeEndDate) {
this.tempRange.endTime = startTime || getDefaultSecond(this.hideSecond);
} else if (endDateEarlierRangeEndDate) {
this.tempRange.endTime = endTime || getDefaultSecond(this.hideSecond);
}
if (!this.tempRange.endTime) {
this.tempRange.endTime = getTime$1(Date.now(), this.hideSecond);
}
start = this.displayRangeValue.startDate = `${this.tempRange.startDate} ${this.tempRange.startTime}`;
end = this.displayRangeValue.endDate = `${this.tempRange.endDate} ${this.tempRange.endTime}`;
}
if (!dateCompare(start, end)) {
[start, end] = [end, start];
}
this.displayRangeValue.startDate = start;
this.displayRangeValue.endDate = end;
const displayRange = [start, end];
this.setEmit(displayRange);
this.pickerVisible = false;
},
handleStartAndEnd(before, after, temp = false) {
if (!before)
return;
if (!after)
after = before;
const type = temp ? "tempRange" : "range";
const isStartEarlierEnd = dateCompare(before, after);
this[type].startDate = isStartEarlierEnd ? before : after;
this[type].endDate = isStartEarlierEnd ? after : before;
},
/**
* 比较时间大小
*/
dateCompare(startDate, endDate) {
startDate = new Date(startDate.replace("-", "/").replace("-", "/"));
endDate = new Date(endDate.replace("-", "/").replace("-", "/"));
return startDate <= endDate;
},
/**
* 比较时间差
*/
diffDate(startDate, endDate) {
startDate = new Date(startDate.replace("-", "/").replace("-", "/"));
endDate = new Date(endDate.replace("-", "/").replace("-", "/"));
const diff = (endDate - startDate) / (24 * 60 * 60 * 1e3);
return Math.abs(diff);
},
clear(needEmit = true) {
if (!this.isRange) {
this.displayValue = "";
this.inputDate = "";
this.pickerTime = "";
if (this.isPhone) {
this.$refs.mobile && this.$refs.mobile.clearCalender();
} else {
this.$refs.pcSingle && this.$refs.pcSingle.clearCalender();
}
if (needEmit) {
this.$emit("change", "");
this.$emit("input", "");
this.$emit("update:modelValue", "");
}
} else {
this.displayRangeValue.startDate = "";
this.displayRangeValue.endDate = "";
this.tempRange.startDate = "";
this.tempRange.startTime = "";
this.tempRange.endDate = "";
this.tempRange.endTime = "";
if (this.isPhone) {
this.$refs.mobile && this.$refs.mobile.clearCalender();
} else {
this.$refs.left && this.$refs.left.clearCalender();
this.$refs.right && this.$refs.right.clearCalender();
this.$refs.right && this.$refs.right.changeMonth("next");
}
if (needEmit) {
this.$emit("change", []);
this.$emit("input", []);
this.$emit("update:modelValue", []);
}
}
},
calendarClick(e2) {
this.$emit("calendarClick", e2);
}
}
};
2024-10-14 07:22:41 +00:00
function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
2024-09-24 09:21:34 +00:00
const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_1$1);
const _component_time_picker = vue.resolveComponent("time-picker");
const _component_Calendar = vue.resolveComponent("Calendar");
return vue.openBlock(), vue.createElementBlock("view", { class: "uni-date" }, [
vue.createElementVNode("view", {
class: "uni-date-editor",
onClick: _cache[1] || (_cache[1] = (...args) => $options.show && $options.show(...args))
}, [
vue.renderSlot(_ctx.$slots, "default", {}, () => [
vue.createElementVNode(
"view",
{
class: vue.normalizeClass(["uni-date-editor--x", { "uni-date-editor--x__disabled": $props.disabled, "uni-date-x--border": $props.border }])
},
[
!$data.isRange ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "uni-date-x uni-date-single"
}, [
vue.createVNode(_component_uni_icons, {
class: "icon-calendar",
type: "calendar",
color: "#c0c4cc",
size: "22"
}),
vue.createElementVNode(
"view",
{ class: "uni-date__x-input" },
vue.toDisplayString($data.displayValue || $options.singlePlaceholderText),
1
/* TEXT */
)
])) : (vue.openBlock(), vue.createElementBlock("view", {
key: 1,
class: "uni-date-x uni-date-range"
}, [
vue.createVNode(_component_uni_icons, {
class: "icon-calendar",
type: "calendar",
color: "#c0c4cc",
size: "22"
}),
vue.createElementVNode(
"view",
{ class: "uni-date__x-input text-center" },
vue.toDisplayString($data.displayRangeValue.startDate || $options.startPlaceholderText),
1
/* TEXT */
),
vue.createElementVNode(
"view",
{ class: "range-separator" },
vue.toDisplayString($props.rangeSeparator),
1
/* TEXT */
),
vue.createElementVNode(
"view",
{ class: "uni-date__x-input text-center" },
vue.toDisplayString($data.displayRangeValue.endDate || $options.endPlaceholderText),
1
/* TEXT */
)
])),
$options.showClearIcon ? (vue.openBlock(), vue.createElementBlock("view", {
key: 2,
class: "uni-date__icon-clear",
onClick: _cache[0] || (_cache[0] = vue.withModifiers((...args) => $options.clear && $options.clear(...args), ["stop"]))
}, [
vue.createVNode(_component_uni_icons, {
type: "clear",
color: "#c0c4cc",
size: "22"
})
])) : vue.createCommentVNode("v-if", true)
],
2
/* CLASS */
)
], true)
]),
vue.withDirectives(vue.createElementVNode(
"view",
{
class: "uni-date-mask--pc",
onClick: _cache[2] || (_cache[2] = (...args) => $options.close && $options.close(...args))
},
null,
512
/* NEED_PATCH */
), [
[vue.vShow, $data.pickerVisible]
]),
!$data.isPhone ? vue.withDirectives((vue.openBlock(), vue.createElementBlock(
"view",
{
key: 0,
ref: "datePicker",
class: "uni-date-picker__container"
},
[
!$data.isRange ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 0,
class: "uni-date-single--x",
style: vue.normalizeStyle($data.pickerPositionStyle)
},
[
vue.createElementVNode("view", { class: "uni-popper__arrow" }),
$data.hasTime ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "uni-date-changed popup-x-header"
}, [
vue.withDirectives(vue.createElementVNode("input", {
class: "uni-date__input text-center",
type: "text",
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => $data.inputDate = $event),
placeholder: $options.selectDateText
}, null, 8, ["placeholder"]), [
[vue.vModelText, $data.inputDate]
]),
vue.createVNode(_component_time_picker, {
type: "time",
modelValue: $data.pickerTime,
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => $data.pickerTime = $event),
border: false,
disabled: !$data.inputDate,
start: $options.timepickerStartTime,
end: $options.timepickerEndTime,
hideSecond: $props.hideSecond,
style: { "width": "100%" }
}, {
default: vue.withCtx(() => [
vue.withDirectives(vue.createElementVNode("input", {
class: "uni-date__input text-center",
type: "text",
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => $data.pickerTime = $event),
placeholder: $options.selectTimeText,
disabled: !$data.inputDate
}, null, 8, ["placeholder", "disabled"]), [
[vue.vModelText, $data.pickerTime]
])
]),
_: 1
/* STABLE */
}, 8, ["modelValue", "disabled", "start", "end", "hideSecond"])
])) : vue.createCommentVNode("v-if", true),
vue.createVNode(_component_Calendar, {
ref: "pcSingle",
showMonth: false,
"start-date": $data.calendarRange.startDate,
"end-date": $data.calendarRange.endDate,
date: $data.calendarDate,
onChange: $options.singleChange,
"default-value": $props.defaultValue,
style: { "padding": "0 8px" }
}, null, 8, ["start-date", "end-date", "date", "onChange", "default-value"]),
$data.hasTime ? (vue.openBlock(), vue.createElementBlock("view", {
key: 1,
class: "popup-x-footer"
}, [
vue.createElementVNode(
"text",
{
class: "confirm-text",
onClick: _cache[6] || (_cache[6] = (...args) => $options.confirmSingleChange && $options.confirmSingleChange(...args))
},
vue.toDisplayString($options.okText),
1
/* TEXT */
)
])) : vue.createCommentVNode("v-if", true)
],
4
/* STYLE */
)) : (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 1,
class: "uni-date-range--x",
style: vue.normalizeStyle($data.pickerPositionStyle)
},
[
vue.createElementVNode("view", { class: "uni-popper__arrow" }),
$data.hasTime ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "popup-x-header uni-date-changed"
}, [
vue.createElementVNode("view", { class: "popup-x-header--datetime" }, [
vue.withDirectives(vue.createElementVNode("input", {
class: "uni-date__input uni-date-range__input",
type: "text",
"onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => $data.tempRange.startDate = $event),
placeholder: $options.startDateText
}, null, 8, ["placeholder"]), [
[vue.vModelText, $data.tempRange.startDate]
]),
vue.createVNode(_component_time_picker, {
type: "time",
modelValue: $data.tempRange.startTime,
"onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => $data.tempRange.startTime = $event),
start: $options.timepickerStartTime,
border: false,
disabled: !$data.tempRange.startDate,
hideSecond: $props.hideSecond
}, {
default: vue.withCtx(() => [
vue.withDirectives(vue.createElementVNode("input", {
class: "uni-date__input uni-date-range__input",
type: "text",
"onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => $data.tempRange.startTime = $event),
placeholder: $options.startTimeText,
disabled: !$data.tempRange.startDate
}, null, 8, ["placeholder", "disabled"]), [
[vue.vModelText, $data.tempRange.startTime]
])
]),
_: 1
/* STABLE */
}, 8, ["modelValue", "start", "disabled", "hideSecond"])
]),
vue.createVNode(_component_uni_icons, {
type: "arrowthinright",
color: "#999",
style: { "line-height": "40px" }
}),
vue.createElementVNode("view", { class: "popup-x-header--datetime" }, [
vue.withDirectives(vue.createElementVNode("input", {
class: "uni-date__input uni-date-range__input",
type: "text",
"onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => $data.tempRange.endDate = $event),
placeholder: $options.endDateText
}, null, 8, ["placeholder"]), [
[vue.vModelText, $data.tempRange.endDate]
]),
vue.createVNode(_component_time_picker, {
type: "time",
modelValue: $data.tempRange.endTime,
"onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => $data.tempRange.endTime = $event),
end: $options.timepickerEndTime,
border: false,
disabled: !$data.tempRange.endDate,
hideSecond: $props.hideSecond
}, {
default: vue.withCtx(() => [
vue.withDirectives(vue.createElementVNode("input", {
class: "uni-date__input uni-date-range__input",
type: "text",
"onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => $data.tempRange.endTime = $event),
placeholder: $options.endTimeText,
disabled: !$data.tempRange.endDate
}, null, 8, ["placeholder", "disabled"]), [
[vue.vModelText, $data.tempRange.endTime]
])
]),
_: 1
/* STABLE */
}, 8, ["modelValue", "end", "disabled", "hideSecond"])
])
])) : vue.createCommentVNode("v-if", true),
vue.createElementVNode("view", { class: "popup-x-body" }, [
vue.createVNode(_component_Calendar, {
ref: "left",
showMonth: false,
"start-date": $data.calendarRange.startDate,
"end-date": $data.calendarRange.endDate,
range: true,
pleStatus: $data.endMultipleStatus,
onChange: $options.leftChange,
onFirstEnterCale: $options.updateRightCale,
style: { "padding": "0 8px" }
}, null, 8, ["start-date", "end-date", "pleStatus", "onChange", "onFirstEnterCale"]),
vue.createVNode(_component_Calendar, {
ref: "right",
showMonth: false,
"start-date": $data.calendarRange.startDate,
"end-date": $data.calendarRange.endDate,
range: true,
onChange: $options.rightChange,
pleStatus: $data.startMultipleStatus,
onFirstEnterCale: $options.updateLeftCale,
style: { "padding": "0 8px", "border-left": "1px solid #F1F1F1" }
}, null, 8, ["start-date", "end-date", "onChange", "pleStatus", "onFirstEnterCale"])
]),
$data.hasTime ? (vue.openBlock(), vue.createElementBlock("view", {
key: 1,
class: "popup-x-footer"
}, [
vue.createElementVNode(
"text",
{
onClick: _cache[13] || (_cache[13] = (...args) => $options.clear && $options.clear(...args))
},
vue.toDisplayString($options.clearText),
1
/* TEXT */
),
vue.createElementVNode(
"text",
{
class: "confirm-text",
onClick: _cache[14] || (_cache[14] = (...args) => $options.confirmRangeChange && $options.confirmRangeChange(...args))
},
vue.toDisplayString($options.okText),
1
/* TEXT */
)
])) : vue.createCommentVNode("v-if", true)
],
4
/* STYLE */
))
],
512
/* NEED_PATCH */
)), [
[vue.vShow, $data.pickerVisible]
]) : vue.createCommentVNode("v-if", true),
$data.isPhone ? (vue.openBlock(), vue.createBlock(_component_Calendar, {
key: 1,
ref: "mobile",
clearDate: false,
date: $data.calendarDate,
defTime: $options.mobileCalendarTime,
"start-date": $data.calendarRange.startDate,
"end-date": $data.calendarRange.endDate,
selectableTimes: $options.mobSelectableTime,
startPlaceholder: $props.startPlaceholder,
endPlaceholder: $props.endPlaceholder,
"default-value": $props.defaultValue,
pleStatus: $data.endMultipleStatus,
showMonth: false,
range: $data.isRange,
hasTime: $data.hasTime,
insert: false,
hideSecond: $props.hideSecond,
onConfirm: $options.mobileChange,
onMaskClose: $options.close,
onChange: $options.calendarClick
}, null, 8, ["date", "defTime", "start-date", "end-date", "selectableTimes", "startPlaceholder", "endPlaceholder", "default-value", "pleStatus", "range", "hasTime", "hideSecond", "onConfirm", "onMaskClose", "onChange"])) : vue.createCommentVNode("v-if", true)
]);
}
2024-10-14 07:22:41 +00:00
const __easycom_0$4 = /* @__PURE__ */ _export_sfc(_sfc_main$L, [["render", _sfc_render$a], ["__scopeId", "data-v-9802168a"], ["__file", "D:/projects/cxc-szcx-uniapp/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue"]]);
const _sfc_main$K = {
2024-09-24 09:21:34 +00:00
name: "UniDrawer",
components: {},
emits: ["change"],
props: {
/**
* 显示模式只在初始化生效
*/
mode: {
type: String,
default: ""
},
/**
* 蒙层显示状态
*/
mask: {
type: Boolean,
default: true
},
/**
* 遮罩是否可点击关闭
*/
maskClick: {
type: Boolean,
default: true
},
/**
* 抽屉宽度
*/
width: {
type: Number,
default: 220
}
},
data() {
return {
visibleSync: false,
showDrawer: false,
rightMode: false,
watchTimer: null,
drawerWidth: 220
};
},
created() {
this.drawerWidth = this.width;
this.rightMode = this.mode === "right";
},
methods: {
clear() {
},
close(type) {
if (type === "mask" && !this.maskClick || !this.visibleSync)
return;
this._change("showDrawer", "visibleSync", false);
},
open() {
if (this.visibleSync)
return;
this._change("visibleSync", "showDrawer", true);
},
_change(param1, param2, status) {
this[param1] = status;
if (this.watchTimer) {
clearTimeout(this.watchTimer);
}
this.watchTimer = setTimeout(() => {
this[param2] = status;
this.$emit("change", status);
}, status ? 50 : 300);
}
}
};
2024-10-14 07:22:41 +00:00
function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
2024-09-24 09:21:34 +00:00
return $data.visibleSync ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 0,
class: vue.normalizeClass([{ "uni-drawer--visible": $data.showDrawer }, "uni-drawer"]),
onTouchmove: _cache[1] || (_cache[1] = vue.withModifiers((...args) => $options.clear && $options.clear(...args), ["stop", "prevent"]))
},
[
vue.createElementVNode(
"view",
{
class: vue.normalizeClass(["uni-drawer__mask", { "uni-drawer__mask--visible": $data.showDrawer && $props.mask }]),
onClick: _cache[0] || (_cache[0] = ($event) => $options.close("mask"))
},
null,
2
/* CLASS */
),
vue.createElementVNode(
"view",
{
class: vue.normalizeClass(["uni-drawer__content", { "uni-drawer--right": $data.rightMode, "uni-drawer--left": !$data.rightMode, "uni-drawer__content--visible": $data.showDrawer }]),
style: vue.normalizeStyle({ width: $data.drawerWidth + "px" })
},
[
vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
],
6
/* CLASS, STYLE */
)
],
34
/* CLASS, NEED_HYDRATION */
)) : vue.createCommentVNode("v-if", true);
}
2024-10-14 07:22:41 +00:00
const __easycom_2$1 = /* @__PURE__ */ _export_sfc(_sfc_main$K, [["render", _sfc_render$9], ["__scopeId", "data-v-f7c32d22"], ["__file", "D:/projects/cxc-szcx-uniapp/uni_modules/uni-drawer/components/uni-drawer/uni-drawer.vue"]]);
2024-09-24 09:21:34 +00:00
function taskListApi(config) {
return https({
url: "/act/task/list",
method: "get",
data: config
});
}
function taskGroupListApi(config) {
return https({
url: "/act/task/taskGroupList",
method: "get",
data: config
});
}
function taskHistoryListApi(config) {
return https({
url: "/act/task/taskHistoryList",
method: "get",
data: config
});
}
function myApplyProcessListApi(config) {
return https({
url: "/act/task/myApplyProcessList",
method: "get",
data: config
});
}
function taskEntrustApi(config) {
return https({
url: "/act/task/taskEntrust",
method: "put",
data: config
});
}
function getProcessNodeInfoApi(config) {
return https({
url: "/process/extActProcessNode/getProcessNodeInfo",
method: "get",
data: config
});
}
function getHisProcessNodeInfoApi(config) {
return https({
url: "/process/extActProcessNode/getHisProcessNodeInfo",
method: "get",
data: config
});
}
function queryMyDeptTreeListApi(config) {
return https({
url: "/sys/sysDepart/queryTreeList",
method: "get",
data: config
});
}
function queryUserByDepIdApi(config) {
return https({
url: "/sys/user/queryUserByDepId",
method: "get",
data: config
});
}
function indexChartScdtDataApi(config) {
return https({
url: "/scdt.cxcscdtjldrb/cxcScdtJldRb/indexChartScdtData",
method: "get",
data: config
});
}
function bpmlistApi(config) {
return https({
2024-09-26 04:06:47 +00:00
url: "/cxcoagwfb/cxcOaGwfb/bpmlist",
2024-09-24 09:21:34 +00:00
method: "get",
data: config
});
}
function gonggaolistApi(config) {
return https({
url: "/cxctz/cxcTz/list",
method: "get",
data: config
});
}
function zhibanQueryApi(config) {
return https({
url: "/zhgl_zbgl/zhglZbglZbb/list",
method: "get",
data: config
});
}
function zhibanApi(config) {
return https({
url: "/zhgl_zbgl/zhglZbglZbb/homepageList",
method: "get",
data: config
});
}
function faguiApi(config) {
return https({
url: "/cxcoaflgf/cxcOaFlgf/zslist",
method: "get",
data: config
});
}
function cjzhiduApi(config) {
return https({
url: "/cxcjyglsjzdgl/cxcJyglSjzdgl/zslist",
method: "get",
data: config
});
}
function zhiduApi(config) {
return https({
url: "/cxczd/cxcZdgl/list",
method: "get",
data: config
});
}
function huiyiDetailApi(config) {
return https({
url: "/zhgl_hygl/zhglHyglHyyc/listbymainid",
method: "get",
data: config
});
}
function userEditApi(config) {
return https({
2024-09-29 02:44:16 +00:00
url: "/sys/user/editApp",
2024-09-24 09:21:34 +00:00
method: "PUT",
data: config
});
}
function extActFlowDataApi(config) {
return https({
url: "/process/extActFlowData/getProcessInfo",
method: "get",
data: config
});
}
function processHistoryListApi(config) {
return https({
url: "/act/task/processHistoryList",
method: "get",
data: config
});
}
function startMutilProcessApi(config) {
return https({
url: "/process/extActProcess/startMutilProcess",
method: "post",
data: config
});
}
function processCompleteApi(config) {
return https({
url: "/act/task/processComplete",
method: "post",
data: config
});
}
function getCategoryItemsApi(pid) {
return https({
url: "/sys/category/findtree",
method: "get",
data: {
pid
}
});
}
function getProcessTaskTransInfoApi(config) {
return https({
url: "/act/task/getProcessTaskTransInfo",
method: "get",
data: config
});
}
function upDateAppApi(config) {
return https({
url: "/sys/common/upDateApp",
method: "get",
data: config
});
}
function cxcDapingApi(config) {
return https({
url: "/CxcDaping/cxcDaping/list",
method: "get",
data: config
});
}
function dbSxxqQueryByIdApi(config) {
return https({
url: "/cxcdbxt/dbSxxq/queryById",
method: "get",
data: config
});
}
function dbJbxxQueryByIdApi(config) {
return https({
url: "/cxcdbxt/dbJbxx/queryById",
method: "get",
data: config
});
}
function claimApi(config) {
return https({
url: "/act/task/claim",
method: "put",
data: config
});
}
function cxcJurisdictionApi(config) {
return https({
url: "/CxcJurisdiction/cxcJurisdiction/queryById",
method: "get",
data: config
});
}
2024-10-14 07:22:41 +00:00
const _sfc_main$J = {
2024-09-24 09:21:34 +00:00
__name: "customNav",
setup(__props) {
vue.useCssVars((_ctx) => ({
"420daeb5-cusnavbarheight": cusnavbarheight
}));
const res = wx.getSystemInfoSync();
const statusHeight = res.statusBarHeight;
const cusnavbarheight = statusHeight + 44 + "px";
return (_ctx, _cache) => {
return vue.openBlock(), vue.createElementBlock("view", { class: "" }, [
vue.createElementVNode("view", { class: "nav" }, [
vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
]),
vue.createElementVNode("view", { class: "place" })
]);
};
}
};
2024-10-14 07:22:41 +00:00
const customNav = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["__scopeId", "data-v-420daeb5"], ["__file", "D:/projects/cxc-szcx-uniapp/bpm/customNav.vue"]]);
2024-10-15 00:38:47 +00:00
const baseurl = "https://36.112.48.190/jeecg-boot/sys/common/static/";
2024-09-24 09:21:34 +00:00
const toast = (title, icon, duration) => {
uni.showToast({
title,
icon: icon || "none",
duration: duration || 2e3
});
};
const beforeJump = (url, callback) => {
const store = useStore();
getUserPermissionApi({
token: store.token,
type: "mobile"
}).then((res) => {
var _a;
if (res.success) {
let page = handleAllowPage(((_a = res.result) == null ? void 0 : _a.menu) || []);
if (page.some((item) => url.indexOf(item) !== -1)) {
callback();
} else {
toast("无查看权限!");
}
}
}).catch((err) => {
2024-09-26 04:06:47 +00:00
formatAppLog("log", "at utils/index.js:35", "err@", err);
2024-09-24 09:21:34 +00:00
});
};
const handleAllowPage = (menu, arr = []) => {
if (!menu.length) {
return [];
}
menu.forEach((item) => {
if (item.children) {
arr.push(...handleAllowPage(item.children));
}
arr.push(item.path);
});
return arr;
};
const hasNewVersion = (version, isWgt = false) => {
return new Promise((resolve) => {
const transfer = (str) => str.replace(/\./g, "");
if (isWgt) {
plus.runtime.getProperty(plus.runtime.appid, (widgetInfo) => {
const currentVersion = widgetInfo.version;
resolve(+transfer(version) > +transfer(currentVersion));
});
} else {
const currentVersion = plus.runtime.version;
resolve(+transfer(version) > +transfer(currentVersion));
}
});
};
function downloadApp(url) {
2024-09-26 04:06:47 +00:00
formatAppLog("log", "at utils/index.js:78", "url", url);
2024-09-24 09:21:34 +00:00
var dtask = plus.downloader.createDownload(url, {
filename: `_downloads/wgt-${Date.now()}.wgt`
//利用保存路径,实现下载文件的重命名
}, function(d2, status) {
if (status == 200) {
var fileSaveUrl = plus.io.convertLocalFileSystemURL(d2.filename);
2024-09-26 04:06:47 +00:00
formatAppLog("log", "at utils/index.js:86", "fileSaveUrl", fileSaveUrl);
2024-09-24 09:21:34 +00:00
installApp(fileSaveUrl);
} else {
plus.downloader.clear();
uni.showToast({
title: "App下载失败",
icon: "error"
});
}
});
let showLoading = plus.nativeUI.showWaiting("正在下載");
dtask.start();
dtask.addEventListener("statechanged", (task, status) => {
switch (task.state) {
case 1:
showLoading.setTitle("正在下载");
break;
case 2:
showLoading.setTitle("已连接到服务器");
break;
case 3:
parseInt(
parseFloat(task.downloadedSize) / parseFloat(task.totalSize) * 100
);
showLoading.setTitle(" 正在下载");
break;
case 4:
plus.nativeUI.closeWaiting();
break;
}
});
}
function installApp(tempFilePath) {
plus.runtime.install(
tempFilePath,
{
force: true
},
() => {
uni.showModal({
title: "更新",
content: "更新成功,请点击确认后重启",
showCancel: false,
success(res) {
if (res.confirm) {
plus.runtime.restart();
}
}
});
},
() => uni.showToast({
title: "安装失败!",
icon: "error"
})
);
}
function onClickUpdate(updateType, url) {
if (updateType != "wgt")
plus.runtime.openURL(url.apkUrl);
else
downloadApp(url.wgtUrl);
}
const getTime = () => {
let date = /* @__PURE__ */ new Date();
(/* @__PURE__ */ new Date()).getTime();
let y2 = date.getFullYear();
let m2 = (date.getMonth() + 1).toString().padStart(2, 0);
let d2 = date.getDate().toString().padStart(2, 0);
return `${y2}-${m2}-${d2}`;
};
const getLocation = () => {
const store = useStore();
uni.getLocation({
type: "wgs84",
success: function(position) {
uni.request({
url: "http://api.tianditu.gov.cn/geocoder",
method: "GET",
data: {
postStr: JSON.stringify({
lon: position.longitude,
lat: position.latitude,
ver: 1
}),
type: "geocode",
tk: "30fe0f0c1b2320e112bde797f3ddaff4"
},
success: function(res) {
let data = res.data;
if (data.status == 0) {
const obj = data.result.addressComponent;
let info = obj.city ? obj.city : obj.province;
uni.setStorageSync("position", info);
store.setPosition(info);
getWeather(position.latitude, position.longitude);
} else {
2024-09-26 04:06:47 +00:00
formatAppLog("log", "at utils/index.js:224", data.message);
2024-09-24 09:21:34 +00:00
}
},
fail: function(err) {
toast("获取定位失败");
2024-09-26 04:06:47 +00:00
formatAppLog("log", "at utils/index.js:229", "地址解析失败" + err);
2024-09-24 09:21:34 +00:00
}
});
}
});
};
const getWeather = (lat, lon) => {
useStore();
let params = {};
params.lat = lat;
params.lon = lon;
weatherRequest(params);
};
const weatherRequest = (params) => {
const store = useStore();
uni.request({
url: "https://api.openweathermap.org/data/2.5/weather",
method: "GET",
data: {
...params,
appid: "600a60694b0e453dfbaafa862f1d1482",
lang: "zh_cn"
},
success: function(res) {
uni.setStorageSync("wendu", Math.round(res.data.main.temp - 273.15));
uni.setStorageSync("wenduIcon", res.data.weather[0].icon);
store.setWeather(Math.round(res.data.main.temp - 273.15), res.data.weather[0].icon);
},
fail: function(err) {
toast("天气获取失败");
2024-09-26 04:06:47 +00:00
formatAppLog("log", "at utils/index.js:270", "天气获取失败" + err);
2024-09-24 09:21:34 +00:00
}
});
};
const opendocument = (url) => {
uni.downloadFile({
2024-09-26 04:06:47 +00:00
url: baseurl + url,
2024-09-24 09:21:34 +00:00
success: function(res) {
var filePath = res.tempFilePath;
uni.openDocument({
filePath,
showMenu: true,
2024-10-10 08:52:10 +00:00
fail: function(err) {
toast(err.errMsg);
2024-09-24 09:21:34 +00:00
}
});
2024-10-10 08:52:10 +00:00
},
fail: function(err) {
formatAppLog("error", "at utils/index.js:289", "文件下载失败", err);
2024-09-24 09:21:34 +00:00
}
});
};
const imgUrl = (url) => {
2024-09-26 04:06:47 +00:00
return baseurl + `/${url}`;
2024-09-24 09:21:34 +00:00
};
2024-10-14 07:22:41 +00:00
const _sfc_main$I = {
2024-09-24 09:21:34 +00:00
__name: "index",
setup(__props) {
vue.useCssVars((_ctx) => ({
"ae0729d5-cusnavbarheight": cusnavbarheight
}));
2024-10-15 00:38:47 +00:00
const baseurl2 = "https://36.112.48.190/jeecg-boot";
2024-09-24 09:21:34 +00:00
const store = useStore();
onShow(() => {
cxcDaping();
zhiban();
getlist();
});
const banner = vue.ref([]);
const cxcDaping = () => {
cxcDapingApi({
zslb: 6
}).then((res2) => {
if (res2.success) {
let arr = res2.result.records[0].wenjian.split(",");
banner.value = arr.map((item) => {
2024-09-26 04:06:47 +00:00
return baseurl2 + "/sys/common/static/" + item;
2024-09-24 09:21:34 +00:00
});
}
});
};
const current = vue.ref(0);
const current_zhidu = vue.ref(0);
const tabArr = ["公文", "公告", "制度", "法规"];
const changeTab = (i2) => {
current.value = i2;
pageNo = 1;
loading2 = false;
list.value = [];
getlist();
};
const changeZhidu = (i2) => {
current_zhidu.value = i2;
pageNo = 1;
loading2 = false;
list.value = [];
zhidu();
};
const res = wx.getSystemInfoSync();
const statusHeight = res.statusBarHeight;
const cusnavbarheight = statusHeight + 44 + "px";
const showLeft = vue.ref(null);
const showDrawer = (e2) => {
showLeft.value.open();
};
const closeDrawer = (e2) => {
showLeft.value.close();
};
const totask = (url) => {
closeDrawer();
jump(url);
};
const jump = (url, type, item, page) => {
if (type && type == 1 && page == "detail")
return;
if (type && type == 3 && item) {
return opendocument(item.mingcheng);
}
if (type && type == 2) {
url = url + `&zhiduid=${current_zhidu.value}`;
}
beforeJump(url, () => {
uni.navigateTo({
url
});
});
};
const menu = vue.ref([{
text: "我的任务",
path: "/pages/task/index?id=0"
}, {
text: "组任务",
path: "/pages/task/index?id=1"
}, {
text: "历史任务",
path: "/pages/task/index?id=2"
}]);
let pageNo = 1;
let pageSize = 15;
let loading2 = false;
const list = vue.ref([]);
const bpmlist = () => {
loading2 = true;
bpmlistApi({
pageNo,
pageSize
}).then((res2) => {
if (res2.success) {
list.value = [...list.value, ...formatObj(res2.result.records, "fwbt", "fwtime", null)];
}
loading2 = false;
}).catch((err) => {
2024-09-29 02:44:16 +00:00
formatAppLog("log", "at pages/tab/index.vue:276", "err", err);
2024-09-24 09:21:34 +00:00
});
};
const gonggaolist = () => {
loading2 = true;
gonggaolistApi({
pageNo,
pageSize
}).then((res2) => {
if (res2.success) {
list.value = [...list.value, ...formatObj(res2.result.records, "neirong", "fbdw", "createTime")];
}
loading2 = false;
}).catch((err) => {
2024-09-29 02:44:16 +00:00
formatAppLog("log", "at pages/tab/index.vue:291", "err", err);
2024-09-24 09:21:34 +00:00
});
};
const zhibanArr = vue.ref([]);
const zhiban = () => {
zhibanApi().then((res2) => {
if (res2.success) {
zhibanArr.value = res2.result.records.slice(0, 2);
}
}).catch((err) => {
2024-09-29 02:44:16 +00:00
formatAppLog("log", "at pages/tab/index.vue:302", "err", err);
2024-09-24 09:21:34 +00:00
});
};
const fagui = () => {
loading2 = true;
faguiApi({
pageNo,
pageSize
}).then((res2) => {
if (res2.success) {
list.value = [...list.value, ...formatObj(res2.result.records, "flfgmc", "ssbm", null)];
}
loading2 = false;
}).catch((err) => {
2024-09-29 02:44:16 +00:00
formatAppLog("log", "at pages/tab/index.vue:318", "err", err);
2024-09-24 09:21:34 +00:00
});
};
const zhidu = () => {
loading2 = true;
let getzhidu = current_zhidu.value == 0 ? zhiduApi : cjzhiduApi;
getzhidu({
pageNo,
pageSize
}).then((res2) => {
if (res2.success) {
let str = current_zhidu.value == 0 ? "zbbm_dictText" : "sbbm";
list.value = [...list.value, ...formatObj(res2.result.records, "zdmc", str, null)];
}
loading2 = false;
}).catch((err) => {
2024-09-29 02:44:16 +00:00
formatAppLog("log", "at pages/tab/index.vue:335", "err", err);
2024-09-24 09:21:34 +00:00
});
};
const formatObj = (arr, title, time, depart) => {
arr.map((item) => {
item["_title"] = item[title];
item["_time"] = item[time];
item["_depart"] = item[depart];
});
return arr;
};
onPullDownRefresh(() => {
pageNo = 1;
loading2 = false;
list.value = [];
cxcDaping();
zhiban();
getlist();
uni.stopPullDownRefresh();
});
const getlist = () => {
if (current.value == 0) {
bpmlist();
} else if (current.value == 1) {
gonggaolist();
} else if (current.value == 2) {
zhidu();
} else if (current.value == 3) {
fagui();
}
};
onReachBottom(() => {
if (loading2)
return;
pageNo++;
getlist();
});
return (_ctx, _cache) => {
2024-10-14 07:22:41 +00:00
const _component_uni_datetime_picker = resolveEasycom(vue.resolveDynamicComponent("uni-datetime-picker"), __easycom_0$4);
2024-09-24 09:21:34 +00:00
const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_1$1);
const _component_uni_drawer = resolveEasycom(vue.resolveDynamicComponent("uni-drawer"), __easycom_2$1);
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass(["content", { "gray": vue.unref(store).isgray == 1 }])
},
[
vue.createElementVNode("view", { class: "nav" }, [
vue.createElementVNode("view", { class: "nav_box f-row aic jcb" }, [
vue.createElementVNode("view", {
class: "menu",
onClick: _cache[0] || (_cache[0] = ($event) => showDrawer())
}, [
vue.createElementVNode("image", {
src: "/static/index/menu.png",
mode: ""
})
]),
vue.createElementVNode("view", { class: "weather_calender f-row aic" }, [
vue.createElementVNode("view", { class: "position f-row aic" }, [
vue.createElementVNode("image", {
src: "/static/index/position.png",
mode: ""
}),
vue.createElementVNode(
"text",
null,
vue.toDisplayString(!vue.unref(store).position ? "暂未定位" : vue.unref(store).position),
1
/* TEXT */
)
]),
vue.createElementVNode("view", { class: "position f-row aic" }, [
vue.createElementVNode("image", {
style: { "height": "80rpx", "width": "80rpx" },
src: `http://openweathermap.org/img/w/${vue.unref(store).wenduIcon}.png`,
mode: ""
}, null, 8, ["src"]),
vue.createElementVNode(
"text",
null,
vue.toDisplayString(vue.unref(store).wendu) + "℃",
1
/* TEXT */
)
]),
vue.createVNode(_component_uni_datetime_picker, { type: "date" }, {
default: vue.withCtx(() => [
vue.createElementVNode("view", { class: "position f-row aic" }, [
vue.createElementVNode("image", {
src: "/static/index/calendar.png",
mode: ""
}),
vue.createElementVNode(
"text",
null,
vue.toDisplayString(vue.unref(getTime)()),
1
/* TEXT */
)
])
]),
_: 1
/* STABLE */
})
])
])
]),
vue.createElementVNode("view", { class: "f-col aic" }, [
vue.createElementVNode("swiper", {
class: "swiper",
autoplay: ""
}, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(banner.value, (item, i2) => {
return vue.openBlock(), vue.createElementBlock("swiper-item", {
key: i2,
class: "swiper-item"
}, [
vue.createElementVNode("image", {
src: item,
mode: "aspectFill"
}, null, 8, ["src"])
]);
}),
128
/* KEYED_FRAGMENT */
))
])
]),
vue.createElementVNode("view", { class: "wrapper f-col aic" }, [
vue.createElementVNode("view", { class: "onduty" }, [
vue.createElementVNode("view", { class: "title f-row aic jcb" }, [
vue.createTextVNode(" 值班信息 "),
vue.createElementVNode("view", {
class: "more",
onClick: _cache[1] || (_cache[1] = ($event) => jump(`/pages/zhiban/index`))
}, [
vue.createTextVNode(" 查看更多 "),
vue.createElementVNode("image", {
src: "/static/index/back.png",
mode: ""
})
])
]),
vue.createElementVNode("view", { class: "info" }, [
vue.createElementVNode("view", { class: "info_title f-row aic" }, [
vue.createElementVNode("view", { class: "" }, " 日期 "),
vue.createElementVNode("view", { class: "" }, " 带班领导 "),
vue.createElementVNode("view", { class: "" }, " 值班领导 "),
vue.createElementVNode("view", { class: "" }, " 值班干部 ")
]),
vue.createElementVNode("view", { class: "data_box" }, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(zhibanArr.value, (item, i2) => {
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass(["data", " f-row", "aic", { "first": i2 == 0 }])
},
[
vue.createElementVNode(
"view",
{ class: "" },
vue.toDisplayString(item.date),
1
/* TEXT */
),
vue.createElementVNode(
"view",
{ class: "" },
vue.toDisplayString(item.dbld_dictText),
1
/* TEXT */
),
vue.createElementVNode(
"view",
{ class: "" },
vue.toDisplayString(item.zbld_dictText),
1
/* TEXT */
),
vue.createElementVNode(
"view",
{ class: "" },
vue.toDisplayString(item.zbgbrealname),
1
/* TEXT */
)
],
2
/* CLASS */
);
}),
256
/* UNKEYED_FRAGMENT */
))
])
])
]),
vue.createElementVNode("view", { class: "list_wrapper" }, [
vue.createElementVNode("view", { class: "" }, [
vue.createElementVNode("view", { class: "list_title f-row aic jca" }, [
(vue.openBlock(), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(tabArr, (item, i2) => {
return vue.createElementVNode("view", {
class: vue.normalizeClass({ "active": current.value == i2 }),
onClick: ($event) => changeTab(i2)
}, vue.toDisplayString(item), 11, ["onClick"]);
}),
64
/* STABLE_FRAGMENT */
))
]),
current.value == 2 ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "f-row aic zhidu"
}, [
vue.createElementVNode(
"view",
{
class: vue.normalizeClass({ "active": current_zhidu.value == 0 }),
onClick: _cache[2] || (_cache[2] = ($event) => changeZhidu(0))
},
" 厂级制度 ",
2
/* CLASS */
),
vue.createElementVNode(
"view",
{
class: vue.normalizeClass({ "active": current_zhidu.value == 1 }),
onClick: _cache[3] || (_cache[3] = ($event) => changeZhidu(1))
},
" 上级制度 ",
2
/* CLASS */
)
])) : vue.createCommentVNode("v-if", true)
]),
vue.createElementVNode("view", {
style: { "padding-top": "24rpx" },
class: "more",
onClick: _cache[4] || (_cache[4] = ($event) => jump(`/pages/document/index?id=${current.value}`, current.value))
}, [
vue.createTextVNode(" 查看更多 "),
vue.createElementVNode("image", {
src: "/static/index/back.png",
mode: ""
})
]),
vue.createElementVNode("view", { class: "list_box" }, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(list.value, (item, i2) => {
return vue.openBlock(), vue.createElementBlock("view", {
class: "list",
key: i2,
onClick: ($event) => jump(`/pages/document/detail?data=${JSON.stringify(item)}&id=${current.value}`, current.value, item, "detail")
}, [
vue.createElementVNode(
"view",
{ class: "topic" },
vue.toDisplayString(item._title),
1
/* TEXT */
),
item._time || item._depart ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "time_Box f-row aic"
}, [
item._time ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 0,
class: "time"
},
vue.toDisplayString(item._time),
1
/* TEXT */
)) : vue.createCommentVNode("v-if", true),
item._depart ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 1,
class: "look f-row aic"
},
vue.toDisplayString(item._depart),
1
/* TEXT */
)) : vue.createCommentVNode("v-if", true)
])) : vue.createCommentVNode("v-if", true)
], 8, ["onClick"]);
}),
128
/* KEYED_FRAGMENT */
))
])
])
]),
vue.createVNode(
_component_uni_drawer,
{
ref_key: "showLeft",
ref: showLeft,
mode: "left",
width: 156
},
{
default: vue.withCtx(() => [
vue.createElementVNode("view", { class: "menu_list" }, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(menu.value, (item, i2) => {
return vue.openBlock(), vue.createElementBlock("view", {
class: "f-row aic jcb",
key: i2,
onClick: ($event) => totask(item.path)
}, [
vue.createElementVNode(
"text",
null,
vue.toDisplayString(item.text),
1
/* TEXT */
),
vue.createVNode(_component_uni_icons, {
type: "right",
size: "20",
color: "#333333"
})
], 8, ["onClick"]);
}),
128
/* KEYED_FRAGMENT */
))
])
]),
_: 1
/* STABLE */
},
512
/* NEED_PATCH */
)
],
2
/* CLASS */
);
};
}
};
2024-10-14 07:22:41 +00:00
const PagesTabIndex = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["__scopeId", "data-v-ae0729d5"], ["__file", "D:/projects/cxc-szcx-uniapp/pages/tab/index.vue"]]);
const _sfc_main$H = {
2024-09-24 09:21:34 +00:00
__name: "office",
setup(__props) {
vue.useCssVars((_ctx) => ({
"305a3c9f-cusnavbarheight": cusnavbarheight
}));
const store = useStore();
new Array(7).fill(0).map((v2, i2) => i2);
2024-09-29 02:44:16 +00:00
vue.ref([]);
2024-09-24 09:21:34 +00:00
const res = wx.getSystemInfoSync();
const statusHeight = res.statusBarHeight;
const cusnavbarheight = statusHeight + 44 + "px";
const jump = (url) => {
beforeJump(url, () => {
uni.navigateTo({
url
});
});
};
onLoad(() => {
getUserPermission();
});
const arr = vue.ref([]);
const listorder = vue.ref([]);
const listtitle = vue.ref([]);
const getUserPermission = () => {
getUserPermissionApi({
token: store.token,
type: "mobile"
}).then((res2) => {
var _a, _b, _c;
if (res2.success) {
let data = res2.result.menu;
data.map((item) => item.children = item == null ? void 0 : item.children.filter((e2) => {
var _a2;
return (_a2 = e2 == null ? void 0 : e2.meta) == null ? void 0 : _a2.icon;
}));
data = data.filter((item) => {
var _a2;
return (_a2 = item == null ? void 0 : item.children) == null ? void 0 : _a2.length;
});
listtitle.value = (_b = (_a = data[0]) == null ? void 0 : _a.meta) == null ? void 0 : _b.title;
2024-09-29 02:44:16 +00:00
arr.value = data;
2024-09-24 09:21:34 +00:00
listorder.value = (_c = data.slice(0, 1)[0]) == null ? void 0 : _c.children;
}
}).catch((err) => {
2024-09-29 02:44:16 +00:00
formatAppLog("log", "at pages/tab/office.vue:103", err);
2024-09-24 09:21:34 +00:00
});
};
return (_ctx, _cache) => {
2024-09-29 02:44:16 +00:00
var _a, _b, _c;
2024-09-24 09:21:34 +00:00
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass({ "gray": vue.unref(store).isgray == 1 })
},
[
vue.createElementVNode("view", { class: "nav" }),
vue.createElementVNode("view", { class: "placeholder" }),
2024-09-29 02:44:16 +00:00
vue.createCommentVNode(' <view class="drag" v-if="listorder?.length"> //20240929 yzq 注释 这部分是拖拽组件\r\n <view class="title">\r\n {{ listtitle}}\r\n </view>\r\n <l-drag :list="listorder" @change="change" :column="4" gridHeight="100px">\r\n <template #grid="{active, content}">\r\n <view class="inner f-col aic" :class="{\'active\': active}" @click="jump(content.path)">\r\n <view class="img f-row aic">\r\n <image :src="`../../static/office/${content.meta.icon}.png`" mode=""></image>\r\n </view>\r\n <view class="text">\r\n {{content?.meta.title}}\r\n </view>\r\n </view>\r\n </template>\r\n </l-drag>\r\n </view> '),
!((_a = listorder.value) == null ? void 0 : _a.length) && !((_b = arr.value) == null ? void 0 : _b.length) ? (vue.openBlock(), vue.createElementBlock("view", {
2024-09-24 09:21:34 +00:00
key: 0,
class: "title f-col aic",
style: { "padding-top": "30rpx" }
}, " 暂无权限,请联系管理员! ")) : vue.createCommentVNode("v-if", true),
vue.createElementVNode("view", { class: "content" }, [
2024-09-29 02:44:16 +00:00
((_c = arr.value) == null ? void 0 : _c.length) ? (vue.openBlock(), vue.createElementBlock("view", {
2024-09-24 09:21:34 +00:00
key: 0,
class: "list"
}, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(arr.value, (item, i2) => {
return vue.openBlock(), vue.createElementBlock("view", {
class: "item",
key: i2
}, [
vue.createElementVNode(
"view",
{ class: "title" },
vue.toDisplayString(item.meta.title),
1
/* TEXT */
),
vue.createElementVNode("view", { class: "info_box f-row aic" }, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(item.children, (e2, i3) => {
return vue.openBlock(), vue.createElementBlock("view", {
class: "info f-col aic",
onClick: ($event) => jump(e2.path),
key: i3
}, [
vue.createElementVNode("view", { class: "img f-row aic" }, [
vue.createElementVNode("image", {
2024-09-29 02:44:16 +00:00
src: `../../static/office/${e2.meta.icon}.png`
2024-09-24 09:21:34 +00:00
}, null, 8, ["src"])
]),
vue.createElementVNode(
"view",
{ class: "text" },
vue.toDisplayString(e2.meta.title),
1
/* TEXT */
)
], 8, ["onClick"]);
}),
128
/* KEYED_FRAGMENT */
))
])
]);
}),
128
/* KEYED_FRAGMENT */
))
])) : vue.createCommentVNode("v-if", true)
])
],
2
/* CLASS */
);
};
}
};
2024-10-14 07:22:41 +00:00
const PagesTabOffice = /* @__PURE__ */ _export_sfc(_sfc_main$H, [["__scopeId", "data-v-305a3c9f"], ["__file", "D:/projects/cxc-szcx-uniapp/pages/tab/office.vue"]]);
const _sfc_main$G = {
2024-09-24 09:21:34 +00:00
__name: "dataCom",
props: {
title: {
type: String,
default: ""
},
list: {
type: Array,
default: function() {
return [];
}
}
},
setup(__props) {
vue.useCssVars((_ctx) => ({
"92a54120-moreHeight": moreHeight.value
}));
const props = __props;
const open2 = vue.ref(false);
const moreHeight = vue.ref(null);
vue.watch(() => props.list, () => {
vue.nextTick(() => {
uni.createSelectorQuery().select(".data_box").boundingClientRect((data) => {
moreHeight.value = ((data == null ? void 0 : data.height) || 0) + "px";
}).exec();
});
}, {
immediate: true
});
return (_ctx, _cache) => {
const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_1$1);
return vue.openBlock(), vue.createElementBlock("view", { class: "" }, [
vue.createElementVNode("view", { class: "info" }, [
vue.createElementVNode("view", { class: "item_box" }, [
vue.createElementVNode("view", { class: "item" }, [
vue.createElementVNode("view", { class: "title_box f-row aic jcb" }, [
vue.createElementVNode(
"view",
{ class: "title" },
vue.toDisplayString(__props.title),
1
/* TEXT */
),
__props.list.length > 6 ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "f-row aic more",
onClick: _cache[0] || (_cache[0] = ($event) => open2.value = !open2.value)
}, [
vue.createElementVNode(
"text",
null,
vue.toDisplayString(!open2.value ? "展开" : "收起"),
1
/* TEXT */
),
!open2.value ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
key: 0,
type: "down",
color: "#999999"
})) : (vue.openBlock(), vue.createBlock(_component_uni_icons, {
key: 1,
type: "up",
color: "#999999"
}))
])) : vue.createCommentVNode("v-if", true)
]),
vue.createElementVNode(
"view",
{
class: vue.normalizeClass(["data_wrapper", { "close": __props.list.length > 6 && open2.value }])
},
[
vue.createElementVNode("view", { class: "data_box f-row aic" }, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(__props.list, (item, i2) => {
return vue.openBlock(), vue.createElementBlock("view", { class: "data f-col aic" }, [
vue.createElementVNode(
"view",
{ class: "" },
vue.toDisplayString(item == null ? void 0 : item.dailyVolume),
1
/* TEXT */
),
vue.createElementVNode(
"text",
null,
vue.toDisplayString(item.gas),
1
/* TEXT */
)
]);
}),
256
/* UNKEYED_FRAGMENT */
))
])
],
2
/* CLASS */
)
])
])
])
]);
};
}
};
2024-10-14 07:22:41 +00:00
const dataCom = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__scopeId", "data-v-92a54120"], ["__file", "D:/projects/cxc-szcx-uniapp/bpm/dataCom.vue"]]);
const _sfc_main$F = {
2024-09-24 09:21:34 +00:00
__name: "product",
setup(__props) {
vue.useCssVars((_ctx) => ({
"6ccf0546-cusnavbarheight": cusnavbarheight
}));
const store = useStore();
const shishiArr = [{
gas: "今日进气总量",
dailyVolume: "28392"
}, {
gas: "今日进气总量",
dailyVolume: "28392"
}, {
gas: "今日输差百分数",
dailyVolume: "0.32"
}, {
gas: "实时进气总量",
dailyVolume: "28392"
}, {
gas: "实时进气总量",
dailyVolume: "28392"
}, {
gas: "实时输差百分数",
dailyVolume: "0.32"
}];
const productArr = vue.ref([]);
let otherArr;
onLoad(() => {
indexChartScdtData();
});
const res = wx.getSystemInfoSync();
const statusHeight = res.statusBarHeight;
const cusnavbarheight = statusHeight + 44 + "px";
const indexChartScdtData = () => {
indexChartScdtDataApi().then((res2) => {
if (res2.success) {
productArr.value = handleData(res2.result.today);
otherArr = [{
text: "安全管理",
img: "../../static/tab/anquan.png",
path: "/pages/safe/manage"
}, {
text: "生产数据",
img: "../../static/tab/product.png",
path: `/pages/product/index?shishi=${JSON.stringify(shishiArr)}&product=${JSON.stringify(productArr.value)}`
}, {
text: "运输管理",
img: "../../static/tab/yunshu.png",
path: ""
}, {
text: "设备台账",
img: "../../static/tab/taizhang.png",
path: ""
}, {
text: "车辆派遣",
img: "../../static/tab/cheliang.png",
path: ""
}, {
text: "事项审批",
img: "../../static/tab/shenpi.png",
path: ""
}];
}
}).catch((err) => {
formatAppLog("log", "at pages/tab/product.vue:112", err);
});
};
const handleData = (arr) => {
let arrMap = /* @__PURE__ */ new Map();
arr.forEach((el) => {
if (arrMap.has(el.gas)) {
let obj = arrMap.get(el.gas);
arrMap.set(el.gas, {
...el,
dailyVolume: Number(el.dailyVolume + +obj.dailyVolume).toFixed(4)
});
} else {
arrMap.set(el.gas, el);
}
});
return [...arrMap.values()];
};
const jump = (url) => {
beforeJump(url, () => {
if (!url)
return;
uni.navigateTo({
url
});
});
};
return (_ctx, _cache) => {
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass({ "gray": vue.unref(store).isgray == 1 })
},
[
vue.createElementVNode("view", { class: "nav" }),
vue.createElementVNode("view", { class: "content" }, [
vue.createElementVNode("view", { class: "info f-col aic" }, [
vue.createElementVNode("view", { class: "item_box" }, [
vue.createVNode(dataCom, {
title: "实时输差",
list: shishiArr
}),
vue.createVNode(dataCom, {
title: "偏远计量点",
list: shishiArr
}),
vue.createVNode(dataCom, {
title: "生产实时数据",
list: productArr.value
}, null, 8, ["list"]),
vue.createElementVNode("view", { class: "item" }, [
vue.createElementVNode("view", { class: "title_box other f-row aic jcb" }, [
vue.createElementVNode("view", { class: "title" }, " 其他信息 ")
]),
vue.createElementVNode("view", { class: "other_box f-row aic" }, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(vue.unref(otherArr), (other, i2) => {
return vue.openBlock(), vue.createElementBlock("view", {
class: "data",
key: i2,
onClick: ($event) => jump(other.path)
}, [
vue.createElementVNode("view", { class: "f-col aic" }, [
vue.createElementVNode("image", {
src: other.img,
mode: ""
}, null, 8, ["src"]),
vue.createElementVNode(
"view",
{ class: "" },
vue.toDisplayString(other.text),
1
/* TEXT */
)
])
], 8, ["onClick"]);
}),
128
/* KEYED_FRAGMENT */
))
])
])
])
])
])
],
2
/* CLASS */
);
};
}
};
2024-10-14 07:22:41 +00:00
const PagesTabProduct = /* @__PURE__ */ _export_sfc(_sfc_main$F, [["__scopeId", "data-v-6ccf0546"], ["__file", "D:/projects/cxc-szcx-uniapp/pages/tab/product.vue"]]);
2024-09-24 09:21:34 +00:00
const { registerUTSInterface, initUTSProxyClass, initUTSProxyFunction, initUTSPackageName, initUTSIndexClassName, initUTSClassName } = uni;
const name = "wuwxStepCounter";
const moduleName = "计步器兼容Android和iOS";
const moduleType = "";
const errMsg = ``;
const is_uni_modules = true;
const pkg = /* @__PURE__ */ initUTSPackageName(name, is_uni_modules);
const cls = /* @__PURE__ */ initUTSIndexClassName(name, is_uni_modules);
const startStepCountingUpdates = /* @__PURE__ */ initUTSProxyFunction(false, { moduleName, moduleType, errMsg, main: true, package: pkg, class: cls, name: "startStepCountingUpdatesByJs", params: [{ "name": "options", "type": "UTSSDKModulesWuwxStepCounterStartStepCountingUpdatesOptionsJSONObject" }], return: "" });
2024-10-14 07:22:41 +00:00
const _sfc_main$E = {
2024-09-24 09:21:34 +00:00
__name: "my",
setup(__props) {
const store = useStore();
const step = vue.ref(0);
startStepCountingUpdates({
handler: (numberOfSteps, timestamp, error) => {
step.value = numberOfSteps;
}
});
const currentVersion = vue.ref(plus.runtime.version);
const arr = vue.ref([
// {
// img: '../../static/my/biao.png',
// text: '值班表查询',
// path: '/pages/zhiban/index'
// },
{
img: "../../static/my/xiaoxi.png",
text: "接受消息推送",
path: ""
}
// , {
// img: '../../static/my/dingwei.png',
// text: '开启定位',
// path: ''
// }, {
// img: '../../static/my/shengji.png',
// text: '软件升级',
// path: ''
// },
]);
const messageSwitch = vue.ref(false);
const positionSwitch = vue.ref(store.positionSwitch);
const jump = (url) => {
if (!url)
return;
beforeJump(url, () => {
uni.navigateTo({
url
});
});
};
const toProfile = (url) => {
uni.navigateTo({
url
});
};
const position = () => {
positionSwitch.value = !positionSwitch.value;
uni.setStorageSync("positionSwitch", positionSwitch.value);
store.setPositionSwitch(positionSwitch.value);
if (!positionSwitch.value) {
toast("定位已关闭");
}
getLocation();
};
const scan = () => {
uni.scanCode({
success: function(res) {
2024-09-29 02:44:16 +00:00
formatAppLog("log", "at pages/tab/my.vue:169", "扫码结果", res);
2024-09-24 09:21:34 +00:00
}
});
};
onShow(() => {
taskList();
});
const todoNum = vue.ref(0);
const taskList = () => {
taskListApi({
pageNo: 1,
pageSize: 4,
_t: (/* @__PURE__ */ new Date()).getTime()
}).then((res) => {
if (res.success) {
todoNum.value = res.result.total;
}
});
};
return (_ctx, _cache) => {
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass({ "gray": vue.unref(store).isgray == 1 })
},
[
vue.createElementVNode("view", { class: "nav" }, [
vue.createElementVNode("view", { class: "user f-row aic" }, [
vue.createElementVNode("view", { class: "avatar" }, [
vue.createElementVNode("image", {
onClick: _cache[0] || (_cache[0] = ($event) => toProfile("/pages/useredit/useredit")),
src: vue.unref(imgUrl)(vue.unref(store).userinfo.avatar),
mode: ""
}, null, 8, ["src"])
]),
vue.createElementVNode("view", { class: "f-row aic jcb right" }, [
vue.createElementVNode("view", {
class: "name_job",
onClick: _cache[1] || (_cache[1] = ($event) => toProfile("/pages/useredit/useredit"))
}, [
vue.createElementVNode("view", { class: "f-row aic" }, [
vue.createElementVNode(
"view",
{ class: "name" },
vue.toDisplayString(vue.unref(store).userinfo.realname),
1
/* TEXT */
2024-09-29 02:44:16 +00:00
)
2024-09-24 09:21:34 +00:00
]),
vue.createElementVNode(
"view",
{ class: "job" },
vue.toDisplayString(vue.unref(store).role),
1
/* TEXT */
)
]),
vue.createElementVNode("view", { class: "shezhi" }, [
vue.createElementVNode("image", {
onClick: scan,
style: { "width": "50rpx", "height": "50rpx", "margin-right": "20rpx" },
2024-09-29 02:44:16 +00:00
src: "/static/tab/scan.png"
2024-09-24 09:21:34 +00:00
}),
2024-09-29 02:44:16 +00:00
vue.createCommentVNode(` <image src="../../static/my/shezhi.png" mode="" @click="toProfile('/pages/useredit/useredit')">\r
</image> `)
2024-09-24 09:21:34 +00:00
])
])
]),
vue.createElementVNode("view", { class: "f-col aic" }, [
vue.createElementVNode("view", { class: "msg f-row aic jca" }, [
vue.createElementVNode("view", {
class: "box f-col aic",
2024-09-29 02:44:16 +00:00
onClick: _cache[2] || (_cache[2] = ($event) => jump("/pages/task/todotask"))
2024-09-24 09:21:34 +00:00
}, [
vue.createElementVNode(
"view",
{ class: "num" },
vue.toDisplayString(todoNum.value),
1
/* TEXT */
),
vue.createElementVNode("text", null, "今日待办任务")
]),
vue.createElementVNode("view", { class: "box f-col aic" }, [
vue.createElementVNode(
"view",
{ class: "num" },
vue.toDisplayString(step.value),
1
/* TEXT */
),
vue.createElementVNode("text", null, "步数")
]),
vue.createElementVNode("view", {
class: "box f-col aic",
2024-09-29 02:44:16 +00:00
onClick: _cache[3] || (_cache[3] = ($event) => jump("/pages/useredit/addressbook"))
2024-09-24 09:21:34 +00:00
}, [
vue.createElementVNode("view", { class: "num" }, " 34 "),
vue.createElementVNode("text", null, "通讯录")
])
])
])
]),
vue.createElementVNode("view", { class: "operate" }, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(arr.value, (item, i2) => {
return vue.openBlock(), vue.createElementBlock("view", {
class: "f-row aic jcb item",
key: i2,
onClick: ($event) => jump(item.path)
}, [
vue.createElementVNode("view", { class: "left f-row aic" }, [
vue.createElementVNode("image", {
src: item.img,
mode: ""
}, null, 8, ["src"]),
vue.createElementVNode(
"text",
null,
vue.toDisplayString(item.text),
1
/* TEXT */
)
]),
vue.createElementVNode("view", { class: "right f-row aic" }, [
vue.createCommentVNode(' <view class="" v-show="i==0">\r\n <uni-icons type="right" color="#2C2C2C"></uni-icons>\r\n </view> '),
vue.withDirectives(vue.createElementVNode(
"view",
{
class: "switch",
2024-09-29 02:44:16 +00:00
onClick: _cache[4] || (_cache[4] = ($event) => messageSwitch.value = !messageSwitch.value)
2024-09-24 09:21:34 +00:00
},
[
vue.withDirectives(vue.createElementVNode(
"image",
{
src: "/static/my/open.png",
mode: ""
},
null,
512
/* NEED_PATCH */
), [
[vue.vShow, messageSwitch.value]
]),
vue.withDirectives(vue.createElementVNode(
"image",
{
src: "/static/my/close.png",
mode: ""
},
null,
512
/* NEED_PATCH */
), [
[vue.vShow, !messageSwitch.value]
])
],
512
/* NEED_PATCH */
), [
[vue.vShow, i2 == 0]
]),
vue.withDirectives(vue.createElementVNode(
"view",
{
class: "switch",
onClick: position
},
[
vue.withDirectives(vue.createElementVNode(
"image",
{
src: "/static/my/open.png",
mode: ""
},
null,
512
/* NEED_PATCH */
), [
[vue.vShow, positionSwitch.value]
]),
vue.withDirectives(vue.createElementVNode(
"image",
{
src: "/static/my/close.png",
mode: ""
},
null,
512
/* NEED_PATCH */
), [
[vue.vShow, !positionSwitch.value]
])
],
512
/* NEED_PATCH */
), [
[vue.vShow, i2 == 2]
]),
vue.withDirectives(vue.createElementVNode(
"view",
{ class: "version" },
" 当前版本v" + vue.toDisplayString(currentVersion.value),
513
/* TEXT, NEED_PATCH */
), [
[vue.vShow, i2 == 3]
])
])
], 8, ["onClick"]);
}),
128
/* KEYED_FRAGMENT */
))
])
],
2
/* CLASS */
);
};
}
};
2024-10-14 07:22:41 +00:00
const PagesTabMy = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["__scopeId", "data-v-2086c871"], ["__file", "D:/projects/cxc-szcx-uniapp/pages/tab/my.vue"]]);
const _sfc_main$D = {
2024-09-24 09:21:34 +00:00
__name: "tasklistCom",
props: {
taskArr: {
type: Array,
default: () => []
},
currentIndex: {
type: Number,
default: 0
}
},
emits: ["jump"],
setup(__props, { emit: __emit }) {
const emit = __emit;
const tojump = (url) => {
emit("jump", url);
};
return (_ctx, _cache) => {
return vue.openBlock(), vue.createElementBlock("view", { class: "list_box" }, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(__props.taskArr, (item, i2) => {
return vue.openBlock(), vue.createElementBlock("view", {
class: "list",
key: i2,
onClick: ($event) => tojump(`/pages/task/handle?info=${JSON.stringify(item)}&type=${__props.currentIndex}`)
}, [
vue.createElementVNode("view", { class: "title f-row aic jcb" }, [
vue.createElementVNode("view", { class: "" }, [
vue.createElementVNode(
"view",
{ class: "" },
vue.toDisplayString(item.processApplyUserName) + "的" + vue.toDisplayString(item.processDefinitionName),
1
/* TEXT */
)
]),
vue.createElementVNode(
"text",
null,
vue.toDisplayString(item.durationStr),
1
/* TEXT */
)
]),
vue.createElementVNode("view", { class: "info" }, [
vue.createElementVNode(
"view",
{ class: "" },
" 申请理由:" + vue.toDisplayString(item.bpmBizTitle),
1
/* TEXT */
),
vue.createElementVNode(
"view",
{ class: "" },
" 当前环节:" + vue.toDisplayString(item.taskName),
1
/* TEXT */
),
vue.createElementVNode(
"view",
{ class: "" },
" 流程名称:" + vue.toDisplayString(item.processDefinitionName),
1
/* TEXT */
),
vue.createElementVNode(
"view",
{ class: "" },
" 发起人:" + vue.toDisplayString(item.processApplyUserName),
1
/* TEXT */
),
vue.createElementVNode(
"view",
{ class: "" },
" 开始时间:" + vue.toDisplayString(item.taskBeginTime),
1
/* TEXT */
)
]),
vue.withDirectives(vue.createElementVNode(
"view",
{ class: "btn f-row aic jcb" },
[
vue.createElementVNode("view", {
class: "entrust",
onClick: vue.withModifiers(($event) => tojump(`/pages/userlist/index?isradio=1&id=${item.id}`), ["stop"])
}, " 委托 ", 8, ["onClick"]),
vue.createElementVNode("view", {
class: "handle",
onClick: ($event) => tojump(`/pages/task/handle?info=${JSON.stringify(item)}&type=${__props.currentIndex}`)
}, " 办理 ", 8, ["onClick"])
],
512
/* NEED_PATCH */
), [
[vue.vShow, __props.currentIndex != 2]
])
], 8, ["onClick"]);
}),
128
/* KEYED_FRAGMENT */
))
]);
};
}
};
2024-10-14 07:22:41 +00:00
const tasklistCom = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__scopeId", "data-v-a83f61d7"], ["__file", "D:/projects/cxc-szcx-uniapp/bpm/tasklistCom.vue"]]);
const _sfc_main$C = {
2024-09-24 09:21:34 +00:00
__name: "index",
setup(__props) {
const store = useStore();
let processDefinitionName = "";
onLoad((options) => {
currentIndex.value = +options.id;
processDefinitionName = options.title;
});
onShow(() => {
taskArr.value = [];
pageNo = 1;
pageSize = 10;
loading2 = false;
taskList();
});
const tabArr = vue.ref([{
text: "我的任务",
id: 0
}, {
text: "组任务",
id: 1
}, {
text: "历史任务",
id: 2
}]);
vue.ref("");
const currentIndex = vue.ref(0);
let pageNo = 1;
let pageSize = 10;
let loading2 = false;
const taskArr = vue.ref([]);
const taskList = () => {
loading2 = true;
uni.showLoading({
title: "加载中..."
});
let getlist = currentIndex.value == 0 ? taskListApi : currentIndex.value == 1 ? taskGroupListApi : taskHistoryListApi;
getlist({
// createTime: date.value ? date.value + ' 00:00:00' : '',
pageNo,
pageSize,
_t: (/* @__PURE__ */ new Date()).getTime(),
processDefinitionName
}).then((res) => {
var _a;
if (res.success) {
if (!res.result.records.length)
return toast("没有更多了~");
taskArr.value = [...taskArr.value, ...((_a = res == null ? void 0 : res.result) == null ? void 0 : _a.records) || []];
loading2 = false;
}
}).catch((err) => {
formatAppLog("log", "at pages/task/index.vue:91", err);
});
};
const change = (i2) => {
taskArr.value = [];
pageNo = 1;
pageSize = 10;
loading2 = false;
currentIndex.value = i2;
taskList();
};
onReachBottom(() => {
if (loading2)
return;
pageNo++;
taskList();
});
onPullDownRefresh(() => {
pageNo = 1;
pageSize = 10;
loading2 = false;
taskArr.value = [];
taskList();
uni.stopPullDownRefresh();
});
const jump = (url) => {
beforeJump(url, () => {
uni.navigateTo({
url
});
});
};
return (_ctx, _cache) => {
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass({ "gray": vue.unref(store).isgray == 1 })
},
[
vue.createElementVNode("view", { class: "nav" }, [
vue.createElementVNode("view", { class: "tab_box f-row aic jca" }, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(tabArr.value, (item, i2) => {
return vue.openBlock(), vue.createElementBlock("view", {
class: vue.normalizeClass({ "active": i2 == currentIndex.value }),
key: i2,
onClick: ($event) => change(i2)
}, vue.toDisplayString(item.text), 11, ["onClick"]);
}),
128
/* KEYED_FRAGMENT */
))
])
]),
vue.createElementVNode("view", { class: "tasklist" }, [
vue.createVNode(tasklistCom, {
onJump: jump,
taskArr: taskArr.value,
currentIndex: currentIndex.value
}, null, 8, ["taskArr", "currentIndex"])
])
],
2
/* CLASS */
);
};
}
};
2024-10-14 07:22:41 +00:00
const PagesTaskIndex = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-3dabfb60"], ["__file", "D:/projects/cxc-szcx-uniapp/pages/task/index.vue"]]);
2024-09-24 09:21:34 +00:00
class MPAnimation {
constructor(options, _this) {
this.options = options;
this.animation = uni.createAnimation({
...options
});
this.currentStepAnimates = {};
this.next = 0;
this.$ = _this;
}
_nvuePushAnimates(type, args) {
let aniObj = this.currentStepAnimates[this.next];
let styles = {};
if (!aniObj) {
styles = {
styles: {},
config: {}
};
} else {
styles = aniObj;
}
if (animateTypes1.includes(type)) {
if (!styles.styles.transform) {
styles.styles.transform = "";
}
let unit = "";
if (type === "rotate") {
unit = "deg";
}
styles.styles.transform += `${type}(${args + unit}) `;
} else {
styles.styles[type] = `${args}`;
}
this.currentStepAnimates[this.next] = styles;
}
_animateRun(styles = {}, config = {}) {
let ref = this.$.$refs["ani"].ref;
if (!ref)
return;
return new Promise((resolve, reject) => {
nvueAnimation.transition(ref, {
styles,
...config
}, (res) => {
resolve();
});
});
}
_nvueNextAnimate(animates, step = 0, fn) {
let obj = animates[step];
if (obj) {
let {
styles,
config
} = obj;
this._animateRun(styles, config).then(() => {
step += 1;
this._nvueNextAnimate(animates, step, fn);
});
} else {
this.currentStepAnimates = {};
typeof fn === "function" && fn();
this.isEnd = true;
}
}
step(config = {}) {
this.animation.step(config);
return this;
}
run(fn) {
this.$.animationData = this.animation.export();
this.$.timer = setTimeout(() => {
typeof fn === "function" && fn();
}, this.$.durationTime);
}
}
const animateTypes1 = [
"matrix",
"matrix3d",
"rotate",
"rotate3d",
"rotateX",
"rotateY",
"rotateZ",
"scale",
"scale3d",
"scaleX",
"scaleY",
"scaleZ",
"skew",
"skewX",
"skewY",
"translate",
"translate3d",
"translateX",
"translateY",
"translateZ"
];
const animateTypes2 = ["opacity", "backgroundColor"];
const animateTypes3 = ["width", "height", "left", "right", "top", "bottom"];
animateTypes1.concat(animateTypes2, animateTypes3).forEach((type) => {
MPAnimation.prototype[type] = function(...args) {
this.animation[type](...args);
return this;
};
});
function createAnimation(option, _this) {
if (!_this)
return;
clearTimeout(_this.timer);
return new MPAnimation(option, _this);
}
2024-10-14 07:22:41 +00:00
const _sfc_main$B = {
2024-09-24 09:21:34 +00:00
name: "uniTransition",
emits: ["click", "change"],
props: {
show: {
type: Boolean,
default: false
},
modeClass: {
type: [Array, String],
default() {
return "fade";
}
},
duration: {
type: Number,
default: 300
},
styles: {
type: Object,
default() {
return {};
}
},
customClass: {
type: String,
default: ""
},
onceRender: {
type: Boolean,
default: false
}
},
data() {
return {
isShow: false,
transform: "",
opacity: 1,
animationData: {},
durationTime: 300,
config: {}
};
},
watch: {
show: {
handler(newVal) {
if (newVal) {
this.open();
} else {
if (this.isShow) {
this.close();
}
}
},
immediate: true
}
},
computed: {
// 生成样式数据
stylesObject() {
let styles = {
...this.styles,
"transition-duration": this.duration / 1e3 + "s"
};
let transform = "";
for (let i2 in styles) {
let line = this.toLine(i2);
transform += line + ":" + styles[i2] + ";";
}
return transform;
},
// 初始化动画条件
transformStyles() {
return "transform:" + this.transform + ";opacity:" + this.opacity + ";" + this.stylesObject;
}
},
created() {
this.config = {
duration: this.duration,
timingFunction: "ease",
transformOrigin: "50% 50%",
delay: 0
};
this.durationTime = this.duration;
},
methods: {
/**
* ref 触发 初始化动画
*/
init(obj = {}) {
if (obj.duration) {
this.durationTime = obj.duration;
}
this.animation = createAnimation(Object.assign(this.config, obj), this);
},
/**
* 点击组件触发回调
*/
onClick() {
this.$emit("click", {
detail: this.isShow
});
},
/**
* ref 触发 动画分组
* @param {Object} obj
*/
step(obj, config = {}) {
if (!this.animation)
return;
for (let i2 in obj) {
try {
if (typeof obj[i2] === "object") {
this.animation[i2](...obj[i2]);
} else {
this.animation[i2](obj[i2]);
}
} catch (e2) {
formatAppLog("error", "at uni_modules/uni-transition/components/uni-transition/uni-transition.vue:148", `方法 ${i2} 不存在`);
}
}
this.animation.step(config);
return this;
},
/**
* ref 触发 执行动画
*/
run(fn) {
if (!this.animation)
return;
this.animation.run(fn);
},
// 开始过度动画
open() {
clearTimeout(this.timer);
this.transform = "";
this.isShow = true;
let { opacity, transform } = this.styleInit(false);
if (typeof opacity !== "undefined") {
this.opacity = opacity;
}
this.transform = transform;
this.$nextTick(() => {
this.timer = setTimeout(() => {
this.animation = createAnimation(this.config, this);
this.tranfromInit(false).step();
this.animation.run();
this.$emit("change", {
detail: this.isShow
});
}, 20);
});
},
// 关闭过度动画
close(type) {
if (!this.animation)
return;
this.tranfromInit(true).step().run(() => {
this.isShow = false;
this.animationData = null;
this.animation = null;
let { opacity, transform } = this.styleInit(false);
this.opacity = opacity || 1;
this.transform = transform;
this.$emit("change", {
detail: this.isShow
});
});
},
// 处理动画开始前的默认样式
styleInit(type) {
let styles = {
transform: ""
};
let buildStyle = (type2, mode) => {
if (mode === "fade") {
styles.opacity = this.animationType(type2)[mode];
} else {
styles.transform += this.animationType(type2)[mode] + " ";
}
};
if (typeof this.modeClass === "string") {
buildStyle(type, this.modeClass);
} else {
this.modeClass.forEach((mode) => {
buildStyle(type, mode);
});
}
return styles;
},
// 处理内置组合动画
tranfromInit(type) {
let buildTranfrom = (type2, mode) => {
let aniNum = null;
if (mode === "fade") {
aniNum = type2 ? 0 : 1;
} else {
aniNum = type2 ? "-100%" : "0";
if (mode === "zoom-in") {
aniNum = type2 ? 0.8 : 1;
}
if (mode === "zoom-out") {
aniNum = type2 ? 1.2 : 1;
}
if (mode === "slide-right") {
aniNum = type2 ? "100%" : "0";
}
if (mode === "slide-bottom") {
aniNum = type2 ? "100%" : "0";
}
}
this.animation[this.animationMode()[mode]](aniNum);
};
if (typeof this.modeClass === "string") {
buildTranfrom(type, this.modeClass);
} else {
this.modeClass.forEach((mode) => {
buildTranfrom(type, mode);
});
}
return this.animation;
},
animationType(type) {
return {
fade: type ? 0 : 1,
"slide-top": `translateY(${type ? "0" : "-100%"})`,
"slide-right": `translateX(${type ? "0" : "100%"})`,
"slide-bottom": `translateY(${type ? "0" : "100%"})`,
"slide-left": `translateX(${type ? "0" : "-100%"})`,
"zoom-in": `scaleX(${type ? 1 : 0.8}) scaleY(${type ? 1 : 0.8})`,
"zoom-out": `scaleX(${type ? 1 : 1.2}) scaleY(${type ? 1 : 1.2})`
};
},
// 内置动画类型与实际动画对应字典
animationMode() {
return {
fade: "opacity",
"slide-top": "translateY",
"slide-right": "translateX",
"slide-bottom": "translateY",
"slide-left": "translateX",
"zoom-in": "scale",
"zoom-out": "scale"
};
},
// 驼峰转中横线
toLine(name2) {
return name2.replace(/([A-Z])/g, "-$1").toLowerCase();
}
}
};
2024-10-14 07:22:41 +00:00
function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
2024-09-24 09:21:34 +00:00
return vue.withDirectives((vue.openBlock(), vue.createElementBlock("view", {
ref: "ani",
animation: $data.animationData,
class: vue.normalizeClass($props.customClass),
style: vue.normalizeStyle($options.transformStyles),
onClick: _cache[0] || (_cache[0] = (...args) => $options.onClick && $options.onClick(...args))
}, [
vue.renderSlot(_ctx.$slots, "default")
], 14, ["animation"])), [
[vue.vShow, $data.isShow]
]);
}
2024-10-14 07:22:41 +00:00
const __easycom_0$3 = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["render", _sfc_render$8], ["__file", "D:/projects/cxc-szcx-uniapp/uni_modules/uni-transition/components/uni-transition/uni-transition.vue"]]);
const _sfc_main$A = {
2024-09-24 09:21:34 +00:00
name: "uniPopup",
components: {},
emits: ["change", "maskClick"],
props: {
// 开启动画
animation: {
type: Boolean,
default: true
},
// 弹出层类型可选值top: 顶部弹出层bottom底部弹出层center全屏弹出层
// message: 消息提示 ; dialog : 对话框
type: {
type: String,
default: "center"
},
// maskClick
isMaskClick: {
type: Boolean,
default: null
},
// TODO 2 个版本后废弃属性 ,使用 isMaskClick
maskClick: {
type: Boolean,
default: null
},
backgroundColor: {
type: String,
default: "none"
},
safeArea: {
type: Boolean,
default: true
},
maskBackgroundColor: {
type: String,
default: "rgba(0, 0, 0, 0.4)"
},
borderRadius: {
type: String
}
},
watch: {
/**
* 监听type类型
*/
type: {
handler: function(type) {
if (!this.config[type])
return;
this[this.config[type]](true);
},
immediate: true
},
isDesktop: {
handler: function(newVal) {
if (!this.config[newVal])
return;
this[this.config[this.type]](true);
},
immediate: true
},
/**
* 监听遮罩是否可点击
* @param {Object} val
*/
maskClick: {
handler: function(val) {
this.mkclick = val;
},
immediate: true
},
isMaskClick: {
handler: function(val) {
this.mkclick = val;
},
immediate: true
},
// H5 下禁止底部滚动
showPopup(show) {
}
},
data() {
return {
duration: 300,
ani: [],
showPopup: false,
showTrans: false,
popupWidth: 0,
popupHeight: 0,
config: {
top: "top",
bottom: "bottom",
center: "center",
left: "left",
right: "right",
message: "top",
dialog: "center",
share: "bottom"
},
maskClass: {
position: "fixed",
bottom: 0,
top: 0,
left: 0,
right: 0,
backgroundColor: "rgba(0, 0, 0, 0.4)"
},
transClass: {
backgroundColor: "transparent",
borderRadius: this.borderRadius || "0",
position: "fixed",
left: 0,
right: 0
},
maskShow: true,
mkclick: true,
popupstyle: "top"
};
},
computed: {
getStyles() {
let res = { backgroundColor: this.bg };
if (this.borderRadius || "0") {
res = Object.assign(res, { borderRadius: this.borderRadius });
}
return res;
},
isDesktop() {
return this.popupWidth >= 500 && this.popupHeight >= 500;
},
bg() {
if (this.backgroundColor === "" || this.backgroundColor === "none") {
return "transparent";
}
return this.backgroundColor;
}
},
mounted() {
const fixSize = () => {
const {
windowWidth,
windowHeight,
windowTop,
safeArea,
screenHeight,
safeAreaInsets
} = uni.getSystemInfoSync();
this.popupWidth = windowWidth;
this.popupHeight = windowHeight + (windowTop || 0);
if (safeArea && this.safeArea) {
this.safeAreaInsets = safeAreaInsets.bottom;
} else {
this.safeAreaInsets = 0;
}
};
fixSize();
},
// TODO vue3
unmounted() {
this.setH5Visible();
},
activated() {
this.setH5Visible(!this.showPopup);
},
deactivated() {
this.setH5Visible(true);
},
created() {
if (this.isMaskClick === null && this.maskClick === null) {
this.mkclick = true;
} else {
this.mkclick = this.isMaskClick !== null ? this.isMaskClick : this.maskClick;
}
if (this.animation) {
this.duration = 300;
} else {
this.duration = 0;
}
this.messageChild = null;
this.clearPropagation = false;
this.maskClass.backgroundColor = this.maskBackgroundColor;
},
methods: {
setH5Visible(visible = true) {
},
/**
* 公用方法不显示遮罩层
*/
closeMask() {
this.maskShow = false;
},
/**
* 公用方法遮罩层禁止点击
*/
disableMask() {
this.mkclick = false;
},
// TODO nvue 取消冒泡
clear(e2) {
e2.stopPropagation();
this.clearPropagation = true;
},
open(direction) {
if (this.showPopup) {
return;
}
let innerType = ["top", "center", "bottom", "left", "right", "message", "dialog", "share"];
if (!(direction && innerType.indexOf(direction) !== -1)) {
direction = this.type;
}
if (!this.config[direction]) {
formatAppLog("error", "at uni_modules/uni-popup/components/uni-popup/uni-popup.vue:298", "缺少类型:", direction);
return;
}
this[this.config[direction]]();
this.$emit("change", {
show: true,
type: direction
});
},
close(type) {
this.showTrans = false;
this.$emit("change", {
show: false,
type: this.type
});
clearTimeout(this.timer);
this.timer = setTimeout(() => {
this.showPopup = false;
}, 300);
},
// TODO 处理冒泡事件,头条的冒泡事件有问题 ,先这样兼容
touchstart() {
this.clearPropagation = false;
},
onTap() {
if (this.clearPropagation) {
this.clearPropagation = false;
return;
}
this.$emit("maskClick");
if (!this.mkclick)
return;
this.close();
},
/**
* 顶部弹出样式处理
*/
top(type) {
this.popupstyle = this.isDesktop ? "fixforpc-top" : "top";
this.ani = ["slide-top"];
this.transClass = {
position: "fixed",
left: 0,
right: 0,
backgroundColor: this.bg,
borderRadius: this.borderRadius || "0"
};
if (type)
return;
this.showPopup = true;
this.showTrans = true;
this.$nextTick(() => {
if (this.messageChild && this.type === "message") {
this.messageChild.timerClose();
}
});
},
/**
* 底部弹出样式处理
*/
bottom(type) {
this.popupstyle = "bottom";
this.ani = ["slide-bottom"];
this.transClass = {
position: "fixed",
left: 0,
right: 0,
bottom: 0,
paddingBottom: this.safeAreaInsets + "px",
backgroundColor: this.bg,
borderRadius: this.borderRadius || "0"
};
if (type)
return;
this.showPopup = true;
this.showTrans = true;
},
/**
* 中间弹出样式处理
*/
center(type) {
this.popupstyle = "center";
this.ani = ["zoom-out", "fade"];
this.transClass = {
position: "fixed",
display: "flex",
flexDirection: "column",
bottom: 0,
left: 0,
right: 0,
top: 0,
justifyContent: "center",
alignItems: "center",
borderRadius: this.borderRadius || "0"
};
if (type)
return;
this.showPopup = true;
this.showTrans = true;
},
left(type) {
this.popupstyle = "left";
this.ani = ["slide-left"];
this.transClass = {
position: "fixed",
left: 0,
bottom: 0,
top: 0,
backgroundColor: this.bg,
borderRadius: this.borderRadius || "0",
display: "flex",
flexDirection: "column"
};
if (type)
return;
this.showPopup = true;
this.showTrans = true;
},
right(type) {
this.popupstyle = "right";
this.ani = ["slide-right"];
this.transClass = {
position: "fixed",
bottom: 0,
right: 0,
top: 0,
backgroundColor: this.bg,
borderRadius: this.borderRadius || "0",
display: "flex",
flexDirection: "column"
};
if (type)
return;
this.showPopup = true;
this.showTrans = true;
}
}
};
2024-10-14 07:22:41 +00:00
function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
const _component_uni_transition = resolveEasycom(vue.resolveDynamicComponent("uni-transition"), __easycom_0$3);
2024-09-24 09:21:34 +00:00
return $data.showPopup ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 0,
class: vue.normalizeClass(["uni-popup", [$data.popupstyle, $options.isDesktop ? "fixforpc-z-index" : ""]])
},
[
vue.createElementVNode(
"view",
{
onTouchstart: _cache[1] || (_cache[1] = (...args) => $options.touchstart && $options.touchstart(...args))
},
[
$data.maskShow ? (vue.openBlock(), vue.createBlock(_component_uni_transition, {
key: "1",
name: "mask",
"mode-class": "fade",
styles: $data.maskClass,
duration: $data.duration,
show: $data.showTrans,
onClick: $options.onTap
}, null, 8, ["styles", "duration", "show", "onClick"])) : vue.createCommentVNode("v-if", true),
vue.createVNode(_component_uni_transition, {
key: "2",
"mode-class": $data.ani,
name: "content",
styles: $data.transClass,
duration: $data.duration,
show: $data.showTrans,
onClick: $options.onTap
}, {
default: vue.withCtx(() => [
vue.createElementVNode(
"view",
{
class: vue.normalizeClass(["uni-popup__wrapper", [$data.popupstyle]]),
style: vue.normalizeStyle($options.getStyles),
onClick: _cache[0] || (_cache[0] = (...args) => $options.clear && $options.clear(...args))
},
[
vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
],
6
/* CLASS, STYLE */
)
]),
_: 3
/* FORWARDED */
}, 8, ["mode-class", "styles", "duration", "show", "onClick"])
],
32
/* NEED_HYDRATION */
)
],
2
/* CLASS */
)) : vue.createCommentVNode("v-if", true);
}
2024-10-14 07:22:41 +00:00
const __easycom_2 = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["render", _sfc_render$7], ["__scopeId", "data-v-4dd3c44b"], ["__file", "D:/projects/cxc-szcx-uniapp/uni_modules/uni-popup/components/uni-popup/uni-popup.vue"]]);
const _sfc_main$z = {
2024-09-24 09:21:34 +00:00
__name: "handle",
setup(__props) {
const store = useStore();
const {
proxy
} = vue.getCurrentInstance();
const popup = vue.ref(null);
2024-10-14 07:46:55 +00:00
const reason = vue.ref("同意");
2024-09-24 09:21:34 +00:00
const status = vue.ref(null);
const openpop = (val) => {
status.value = val;
popup.value.open();
};
const closepop = () => {
popup.value.close();
};
const comp = vue.ref(null);
const dataId = vue.ref("");
const getProcessNodeInfo = (taskId) => {
getProcessNodeInfoApi({
taskId
}).then((res) => {
if (res.success) {
dataId.value = res.result.dataId;
comp.value = res.result.formUrlMobile;
}
});
};
const back = () => {
uni.navigateBack();
};
const chooseNextPerson = vue.ref(false);
let nextnode = null;
const handleProcess = () => {
if (!reason.value.trim())
return proxy.$toast("请输入审批意见");
let params = {};
if (status.value == 1) {
if (currentnode.value == null)
return proxy.$toast("请选择驳回节点");
params.processModel = 3;
params.rejectModelNode = stepNode.value[currentnode.value].TASK_DEF_KEY_;
processComplete(params);
} else {
if (chooseNextPerson.value) {
beforeJump("/pages/userlist/index", () => {
closepop();
uni.navigateTo({
url: `/pages/userlist/index?id=${taskInfo.value.id}&isradio=1&nextnode=${JSON.stringify(nextnode)}&reason=${reason.value}`
});
});
} else {
params.processModel = 1;
processComplete(params);
}
}
};
const processComplete = (params) => {
processCompleteApi({
taskId: taskInfo.value.id,
reason: reason.value,
...params
}).then((res) => {
if (res.success) {
proxy.$toast(res.message);
setTimeout(() => {
uni.navigateBack();
}, 2e3);
}
});
};
const claim = () => {
claimApi({
taskId: taskInfo.value.id
}).then((res) => {
if (res.success) {
proxy.$toast(res.message);
setTimeout(() => {
uni.navigateBack();
}, 2e3);
}
});
};
const stepNode = vue.ref([]);
const currentnode = vue.ref(null);
const nodeChange = (e2) => {
currentnode.value = e2.detail.value;
};
const getProcessTaskTransInfo = (e2) => {
getProcessTaskTransInfoApi({
taskId: taskInfo.value.id
}).then((res) => {
if (res.success) {
stepNode.value = res.result.histListNode;
nextnode = res.result.transitionList;
}
});
};
const getHisProcessNodeInfo = (procInstId) => {
getHisProcessNodeInfoApi({
procInstId
}).then((res) => {
if (res.success) {
dataId.value = res.result.dataId;
comp.value = res.result.formUrlMobile;
}
});
};
const taskInfo = vue.ref(null);
let type = null;
onLoad((options) => {
taskInfo.value = JSON.parse(options.info);
type = options.type;
if (type == 2) {
return getHisProcessNodeInfo(taskInfo.value.processInstanceId);
}
getProcessNodeInfo(taskInfo.value.id);
getProcessTaskTransInfo();
});
return (_ctx, _cache) => {
const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_1$1);
const _component_uni_popup = resolveEasycom(vue.resolveDynamicComponent("uni-popup"), __easycom_2);
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass(["content", { "gray": vue.unref(store).isgray == 1 }])
},
[
vue.createVNode(customNav, null, {
default: vue.withCtx(() => [
vue.createElementVNode("view", { class: "f-row aic box" }, [
vue.createElementVNode("view", {
class: "back",
onClick: back
}, [
vue.createVNode(_component_uni_icons, {
type: "left",
size: "20",
color: "#fff"
})
]),
vue.createElementVNode("view", { class: "avatar" }, [
vue.createElementVNode("image", {
src: vue.unref(imgUrl)(vue.unref(store).userinfo.avatar),
mode: ""
}, null, 8, ["src"])
]),
vue.createElementVNode(
"view",
{ class: "name" },
vue.toDisplayString(taskInfo.value.processApplyUserName) + "的" + vue.toDisplayString(taskInfo.value.processDefinitionName),
1
/* TEXT */
),
vue.unref(type) != 2 ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "status"
}, " 待审批 ")) : (vue.openBlock(), vue.createElementBlock("view", {
key: 1,
class: "status",
style: { "background-color": "#7AC756" }
}, " 已处理 "))
])
]),
_: 1
/* STABLE */
}),
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(comp.value), { dataId: dataId.value }, null, 8, ["dataId"])),
vue.unref(type) != 2 && taskInfo.value.taskAssigneeName ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "btn f-row aic jcb"
}, [
vue.createElementVNode("view", {
class: "refuse",
onClick: _cache[0] || (_cache[0] = ($event) => openpop(1))
}, " 拒绝 "),
vue.createElementVNode("view", {
class: "agree",
onClick: _cache[1] || (_cache[1] = ($event) => openpop(2))
}, " 同意 ")
])) : vue.createCommentVNode("v-if", true),
vue.unref(type) != 2 && !taskInfo.value.taskAssigneeName ? (vue.openBlock(), vue.createElementBlock("view", {
key: 1,
class: "btn f-row aic jcb"
}, [
vue.createElementVNode("view", { class: "" }),
vue.createElementVNode("view", {
class: "agree",
onClick: claim
}, " 签收 ")
])) : vue.createCommentVNode("v-if", true),
vue.createVNode(
_component_uni_popup,
{
ref_key: "popup",
ref: popup,
type: "center"
},
{
default: vue.withCtx(() => [
vue.createElementVNode("view", { class: "popup" }, [
vue.createElementVNode("view", { class: "title" }, " 审批意见 "),
vue.createElementVNode("view", { class: "f-col aic" }, [
vue.createElementVNode("view", { class: "input f-col" }, [
vue.withDirectives(vue.createElementVNode(
"textarea",
{
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => reason.value = $event),
name: "",
id: "",
maxlength: "200",
placeholder: "请输入"
},
null,
512
/* NEED_PATCH */
), [
[vue.vModelText, reason.value]
]),
vue.createElementVNode(
"view",
{ class: "" },
vue.toDisplayString(reason.value.length) + "/200 ",
1
/* TEXT */
)
])
]),
status.value == 2 ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "agree_operate f-row aic",
onClick: _cache[3] || (_cache[3] = ($event) => chooseNextPerson.value = !chooseNextPerson.value)
}, [
chooseNextPerson.value ? (vue.openBlock(), vue.createElementBlock("image", {
key: 0,
src: "/static/login/checked.png",
mode: ""
})) : (vue.openBlock(), vue.createElementBlock("image", {
key: 1,
src: "/static/login/nocheck.png",
mode: ""
})),
vue.createElementVNode("view", { class: "" }, " 指定下一步操作人 ")
])) : (vue.openBlock(), vue.createElementBlock("view", {
key: 1,
class: ""
}, [
vue.createElementVNode("picker", {
value: currentnode.value,
range: stepNode.value,
"range-key": "NAME_",
onChange: nodeChange
}, [
vue.createElementVNode(
"view",
{ class: "node" },
vue.toDisplayString(currentnode.value != null ? stepNode.value[currentnode.value].NAME_ : "请选择驳回节点"),
1
/* TEXT */
)
], 40, ["value", "range"])
])),
vue.createElementVNode("view", { class: "popbtn f-row aic" }, [
vue.createElementVNode("view", {
class: "cancel",
onClick: closepop
}, " 取消 "),
vue.createElementVNode("view", {
class: "confirm",
onClick: handleProcess
}, " 确定 ")
])
])
]),
_: 1
/* STABLE */
},
512
/* NEED_PATCH */
)
],
2
/* CLASS */
);
};
}
};
2024-10-14 07:22:41 +00:00
const PagesTaskHandle = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["__scopeId", "data-v-aeec6874"], ["__file", "D:/projects/cxc-szcx-uniapp/pages/task/handle.vue"]]);
const _sfc_main$y = {
2024-09-24 09:21:34 +00:00
__name: "message_list",
setup(__props) {
const store = useStore();
const jump = (url) => {
beforeJump(url, () => {
uni.navigateTo({
url
});
});
};
return (_ctx, _cache) => {
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass({ "gray": vue.unref(store).isgray == 1 })
},
[
vue.createElementVNode("view", { class: "list" }, [
vue.createElementVNode("view", { class: "item f-row aic" }, [
vue.createElementVNode("view", { class: "f-row aic" }, [
vue.createElementVNode("image", {
src: "/static/system.png",
mode: ""
})
]),
vue.createElementVNode("view", { class: "name_info" }, [
vue.createElementVNode("view", { class: "name_time f-row aic jcb" }, [
vue.createElementVNode("view", { class: "name" }, " 系统通知 "),
vue.createElementVNode("view", { class: "time" }, " 1分钟前 ")
]),
vue.createElementVNode("view", { class: "info" }, " 关于年假通知关于年假通知关于年假通知关于年假通知关于年假通知关于年假通知关于年假通知 ")
])
]),
(vue.openBlock(), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(5, (item, i2) => {
return vue.createElementVNode("view", {
class: "item f-row aic",
key: i2,
onClick: _cache[0] || (_cache[0] = ($event) => jump("/pages/talk/conversation"))
}, [
vue.createElementVNode("view", { class: "f-row aic" }, [
vue.createElementVNode("image", {
src: "",
mode: ""
})
]),
vue.createElementVNode("view", { class: "name_info" }, [
vue.createElementVNode("view", { class: "name_time f-row aic jcb" }, [
vue.createElementVNode("view", { class: "name" }, " 系统通知 "),
vue.createElementVNode("view", { class: "time" }, " 1分钟前 ")
]),
vue.createElementVNode("view", { class: "info" }, " 关于年假通知 ")
])
]);
}),
64
/* STABLE_FRAGMENT */
))
])
],
2
/* CLASS */
);
};
}
};
2024-10-14 07:22:41 +00:00
const PagesTalkMessage_list = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["__scopeId", "data-v-e2a9a302"], ["__file", "D:/projects/cxc-szcx-uniapp/pages/talk/message_list.vue"]]);
const _sfc_main$x = {
2024-09-24 09:21:34 +00:00
__name: "conversation",
setup(__props) {
const store = useStore();
return (_ctx, _cache) => {
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass(["content", { "gray": vue.unref(store).isgray == 1 }])
},
[
vue.createElementVNode("view", { class: "list" }, [
(vue.openBlock(), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(14, (item, i2) => {
return vue.createElementVNode("view", {
class: "item",
key: i2
}, [
vue.withDirectives(vue.createElementVNode(
"view",
{ class: "left f-row aic" },
[
vue.createElementVNode("view", { class: "avatar f-row aic" }, [
vue.createElementVNode("image", {
src: "/static/system.png",
mode: ""
})
]),
vue.createElementVNode("view", { class: "content" }, " 你今天在干嘛呢?为什么这么久不回我信息,真的生气了 ")
],
512
/* NEED_PATCH */
), [
[vue.vShow, i2 % 2 == 0]
]),
vue.withDirectives(vue.createElementVNode(
"view",
{ class: "right f-row aic" },
[
vue.createElementVNode("view", { class: "content" }, " 请问如何退款? "),
vue.createElementVNode("view", { class: "avatar f-row aic" }, [
vue.createElementVNode("image", {
src: "",
mode: ""
})
])
],
512
/* NEED_PATCH */
), [
[vue.vShow, i2 % 2 != 0]
])
]);
}),
64
/* STABLE_FRAGMENT */
))
]),
vue.createElementVNode("view", { class: "input_box f-row aic jce" }, [
vue.createElementVNode("input", {
type: "text",
placeholder: "请输入内容......",
"placeholder-style": "font-size: 28rpx;color: #999999;"
}),
vue.createElementVNode("view", { class: "send" }, " 发送 ")
])
],
2
/* CLASS */
);
};
}
};
2024-10-14 07:22:41 +00:00
const PagesTalkConversation = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["__scopeId", "data-v-696a96aa"], ["__file", "D:/projects/cxc-szcx-uniapp/pages/talk/conversation.vue"]]);
const _sfc_main$w = {
2024-09-24 09:21:34 +00:00
__name: "system",
setup(__props) {
const store = useStore();
return (_ctx, _cache) => {
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass(["content", { "gray": vue.unref(store).isgray == 1 }])
},
[
vue.createElementVNode("view", { class: "list" }, [
(vue.openBlock(), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(3, (item, i2) => {
return vue.createElementVNode("view", {
class: "item",
key: i2
}, [
vue.createElementVNode("view", { class: "left f-row aic" }, [
vue.createElementVNode("view", { class: "avatar f-row aic" }, [
vue.createElementVNode("image", {
src: "/static/system.png",
mode: ""
})
]),
vue.createElementVNode("view", { class: "content" }, " 你今天在干嘛呢?为什么这么久不回我信息,真的生气了 ")
])
]);
}),
64
/* STABLE_FRAGMENT */
))
])
],
2
/* CLASS */
);
};
}
};
2024-10-14 07:22:41 +00:00
const PagesTalkSystem = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["__scopeId", "data-v-5621beca"], ["__file", "D:/projects/cxc-szcx-uniapp/pages/talk/system.vue"]]);
const _sfc_main$v = {
2024-09-24 09:21:34 +00:00
__name: "index",
setup(__props) {
vue.useCssVars((_ctx) => ({
"ae7a950b-cusnavbarheight": _ctx.cusnavbarheight
}));
const store = useStore();
const showicon = vue.ref(true);
const searchKey = vue.ref("");
const list = vue.ref([]);
let pageNo = 1;
let pageSize = 15;
let loading2 = false;
const bpmlist = () => {
loading2 = true;
bpmlistApi({
pageNo,
pageSize,
fwbt: formatSearchkey()
}).then((res) => {
if (res.success) {
list.value = [...list.value, ...formatObj(res.result.records, "fwbt", "fwtime", null)];
}
loading2 = false;
}).catch((err) => {
formatAppLog("log", "at pages/document/index.vue:89", "err", err);
});
};
const zhidu = () => {
loading2 = true;
let getzhidu = zhiduid == 0 ? zhiduApi : cjzhiduApi;
getzhidu({
pageNo,
pageSize,
zdmc: formatSearchkey()
}).then((res) => {
if (res.success) {
let str = zhiduid == 0 ? "zbbm_dictText" : "sbbm";
list.value = [...list.value, ...formatObj(res.result.records, "zdmc", str, null)];
}
loading2 = false;
}).catch((err) => {
formatAppLog("log", "at pages/document/index.vue:108", "err", err);
});
};
const fagui = () => {
loading2 = true;
faguiApi({
pageNo,
pageSize,
flfgmc: formatSearchkey()
}).then((res) => {
if (res.success) {
list.value = [...list.value, ...formatObj(res.result.records, "flfgmc", "ssbm", null)];
}
loading2 = false;
}).catch((err) => {
formatAppLog("log", "at pages/document/index.vue:125", "err", err);
});
};
const gonggaolist = () => {
loading2 = true;
gonggaolistApi({
pageNo,
pageSize,
neirong: formatSearchkey()
}).then((res) => {
if (res.success) {
list.value = [...list.value, ...formatObj(res.result.records, "neirong", "fbdw", "createTime")];
}
loading2 = false;
}).catch((err) => {
formatAppLog("log", "at pages/document/index.vue:142", "err", err);
});
};
const formatObj = (arr, title, time, depart) => {
arr.map((item) => {
item["_title"] = item[title];
item["_time"] = item[time];
item["_depart"] = item[depart];
});
return arr;
};
const formatSearchkey = () => {
if (searchKey.value.trim()) {
return "*" + searchKey.value + "*";
}
};
const search = () => {
pageNo = 1;
loading2 = false;
list.value = [];
getlist();
};
vue.watch(searchKey, (nval, oval) => {
if (!nval.trim()) {
getlist();
}
});
const back = () => {
uni.navigateBack();
};
const jump = (url, item) => {
if (id.value == 3) {
return opendocument(item.mingcheng);
}
beforeJump(url, () => {
uni.navigateTo({
url
});
});
};
const id = vue.ref(null);
let zhiduid = null;
onLoad((options) => {
id.value = options.id;
zhiduid = options.zhiduid;
getlist();
});
const getlist = () => {
if (id.value == 0) {
bpmlist();
} else if (id.value == 1) {
gonggaolist();
} else if (id.value == 2) {
zhidu();
} else if (id.value == 3) {
fagui();
}
};
onPullDownRefresh(() => {
pageNo = 1;
loading2 = false;
list.value = [];
getlist();
uni.stopPullDownRefresh();
});
onReachBottom(() => {
if (loading2)
return;
pageNo++;
getlist();
});
return (_ctx, _cache) => {
const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_1$1);
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass(["content", { "gray": vue.unref(store).isgray == 1 }])
},
[
vue.createVNode(customNav, null, {
default: vue.withCtx(() => [
vue.createElementVNode("view", { class: "nav_box f-row aic jcb" }, [
vue.createElementVNode("view", {
class: "back f-row aic",
onClick: back
}, [
vue.createVNode(_component_uni_icons, {
type: "left",
size: "20",
color: "#fff"
})
]),
vue.createElementVNode("view", { class: "search f-row aic" }, [
vue.withDirectives(vue.createElementVNode(
"input",
{
type: "text",
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchKey.value = $event),
onConfirm: search,
onBlur: _cache[1] || (_cache[1] = ($event) => showicon.value = !searchKey.value),
onFocus: _cache[2] || (_cache[2] = ($event) => showicon.value = false)
},
null,
544
/* NEED_HYDRATION, NEED_PATCH */
), [
[vue.vModelText, searchKey.value]
]),
showicon.value ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "f-row aic"
}, [
vue.createElementVNode("image", {
src: "/static/search.png",
mode: ""
}),
vue.createElementVNode("text", null, "搜索")
])) : vue.createCommentVNode("v-if", true)
])
])
]),
_: 1
/* STABLE */
}),
vue.createElementVNode("view", { class: "list" }, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(list.value, (item, i2) => {
return vue.openBlock(), vue.createElementBlock("view", {
class: "item",
key: i2,
onClick: ($event) => jump(`/pages/document/detail?data=${JSON.stringify(item)}&id=${id.value}`, item)
}, [
vue.createCommentVNode(' <view class="dot">\r\n \r\n </view> '),
vue.createElementVNode(
"view",
{ class: "title" },
vue.toDisplayString(item._title),
1
/* TEXT */
),
vue.createElementVNode("view", { class: "time_box f-row aic" }, [
vue.createElementVNode(
"view",
{ class: "time" },
vue.toDisplayString(item._time),
1
/* TEXT */
),
item._depart ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 0,
class: "look f-row aic"
},
vue.toDisplayString(item._depart),
1
/* TEXT */
)) : vue.createCommentVNode("v-if", true),
vue.createCommentVNode(' <view class="look f-row aic">\r\n <image src="../../static/index/eye.png" mode=""></image>\r\n 999+\r\n </view> ')
])
], 8, ["onClick"]);
}),
128
/* KEYED_FRAGMENT */
))
])
],
2
/* CLASS */
);
};
}
};
2024-10-14 07:22:41 +00:00
const PagesDocumentIndex = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["__scopeId", "data-v-ae7a950b"], ["__file", "D:/projects/cxc-szcx-uniapp/pages/document/index.vue"]]);
const _sfc_main$u = {
2024-09-24 09:21:34 +00:00
__name: "detail",
setup(__props) {
const store = useStore();
const detail = vue.ref({});
onLoad((options) => {
detail.value = JSON.parse(options.data);
if (options.id == 0) {
detail.value.pdf = detail.value.wjbt;
} else if (options.id == 2) {
if (detail.value.jdwj) {
detail.value.pdf = detail.value.jdwj + "," + detail.value.sszd;
} else {
detail.value.pdf = detail.value.sszd;
}
} else if (options.id == 3) {
detail.value.pdf = detail.value.mingcheng;
}
});
return (_ctx, _cache) => {
var _a, _b;
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass(["content", { "gray": vue.unref(store).isgray == 1 }])
},
[
vue.createElementVNode("view", { class: "title_box" }, [
vue.createElementVNode(
"view",
{ class: "title" },
vue.toDisplayString(detail.value._title),
1
/* TEXT */
),
vue.createElementVNode(
"view",
{ class: "time" },
vue.toDisplayString(detail.value._time),
1
/* TEXT */
)
]),
vue.createElementVNode("view", { class: "document f-row" }, [
vue.createElementVNode("text", { class: "" }, " 附件: "),
vue.createElementVNode("view", { class: "f-col" }, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList((_b = (_a = detail.value) == null ? void 0 : _a.pdf) == null ? void 0 : _b.split(","), (item, i2) => {
return vue.openBlock(), vue.createElementBlock("view", {
class: "",
style: { "padding": "5rpx 0" },
onClick: ($event) => vue.unref(opendocument)(item)
}, vue.toDisplayString(item), 9, ["onClick"]);
}),
256
/* UNKEYED_FRAGMENT */
))
])
])
],
2
/* CLASS */
);
};
}
};
2024-10-14 07:22:41 +00:00
const PagesDocumentDetail = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__scopeId", "data-v-2c024c80"], ["__file", "D:/projects/cxc-szcx-uniapp/pages/document/detail.vue"]]);
const _sfc_main$t = {
2024-09-24 09:21:34 +00:00
__name: "index",
setup(__props) {
const store = useStore();
const showicon = vue.ref(true);
const searchKey = vue.ref("");
onLoad(() => {
});
const jump = (url) => {
beforeJump(url, () => {
uni.navigateTo({
url
});
});
};
const back = () => {
uni.navigateBack();
};
return (_ctx, _cache) => {
const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_1$1);
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass({ "gray": vue.unref(store).isgray == 1 })
},
[
vue.createVNode(customNav, null, {
default: vue.withCtx(() => [
vue.createElementVNode("view", { class: "nav_box f-row aic jcb" }, [
vue.createElementVNode("view", {
class: "back f-row aic",
onClick: back
}, [
vue.createVNode(_component_uni_icons, {
type: "left",
size: "20",
color: "#fff"
})
]),
vue.createElementVNode("view", { class: "search f-row aic" }, [
vue.withDirectives(vue.createElementVNode(
"input",
{
type: "text",
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchKey.value = $event),
onConfirm: _cache[1] || (_cache[1] = (...args) => _ctx.search && _ctx.search(...args)),
onBlur: _cache[2] || (_cache[2] = ($event) => showicon.value = !searchKey.value),
onFocus: _cache[3] || (_cache[3] = ($event) => showicon.value = false)
},
null,
544
/* NEED_HYDRATION, NEED_PATCH */
), [
[vue.vModelText, searchKey.value]
]),
showicon.value ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "f-row aic"
}, [
vue.createElementVNode("image", {
src: "/static/search.png",
mode: ""
}),
vue.createElementVNode("text", null, "搜索")
])) : vue.createCommentVNode("v-if", true)
])
])
]),
_: 1
/* STABLE */
}),
vue.createElementVNode("view", { class: "list_box" }, [
(vue.openBlock(), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(3, (item, i2) => {
return vue.createElementVNode("view", {
class: "list",
key: i2,
onClick: _cache[4] || (_cache[4] = ($event) => jump(`/pages/meeting/detail?id=1`))
}, [
vue.createElementVNode("view", { class: "title f-row aic jcb" }, [
vue.createElementVNode("view", { class: "" }, " 年度部门讨论会议 "),
vue.createElementVNode("text", null, "1分钟前")
]),
vue.createElementVNode("view", { class: "info" }, [
vue.createElementVNode("view", { class: "f-row aic jcb" }, [
vue.createElementVNode("view", { class: "" }, " 发起人: "),
vue.createElementVNode("text", null, "周如意")
]),
vue.createElementVNode("view", { class: "f-row aic jcb" }, [
vue.createElementVNode("view", { class: "" }, " 会议日期: "),
vue.createElementVNode("text", null, "周如意")
]),
vue.createElementVNode("view", { class: "f-row aic jcb" }, [
vue.createElementVNode("view", { class: "" }, " 会议地点: "),
vue.createElementVNode("text", null, "周如意")
]),
vue.createElementVNode("view", { class: "f-row aic jcb" }, [
vue.createElementVNode("view", { class: "" }, " 会议内容: "),
vue.createElementVNode("text", null, "周如意")
])
]),
vue.createCommentVNode(' <view class="btn f-row aic jcb">\r\n <view class="entrust">\r\n 拒绝\r\n </view>\r\n <view class="handle">\r\n 同意\r\n </view>\r\n </view> '),
vue.createElementVNode("view", { class: "handled f-row" }, [
vue.createElementVNode("view", { class: "refused" }, " 已拒绝 "),
vue.createCommentVNode(' <view class="agreed">\r\n 已同意\r\n </view> ')
])
]);
}),
64
/* STABLE_FRAGMENT */
))
])
],
2
/* CLASS */
);
};
}
};
2024-10-14 07:22:41 +00:00
const PagesMeetingIndex = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["__scopeId", "data-v-f3707b27"], ["__file", "D:/projects/cxc-szcx-uniapp/pages/meeting/index.vue"]]);
const _sfc_main$s = {
2024-09-24 09:21:34 +00:00
__name: "detail",
setup(__props) {
const store = useStore();
onLoad(() => {
huiyiDetail();
});
const huiyiDetail = () => {
huiyiDetailApi({
mainid: 1
}).then((res) => {
if (res.success)
;
}).catch((err) => {
formatAppLog("log", "at pages/meeting/detail.vue:94", err);
});
};
return (_ctx, _cache) => {
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass(["content", { "gray": vue.unref(store).isgray == 1 }])
},
[
vue.createElementVNode("view", { class: "list_box" }, [
vue.createElementVNode("view", { class: "list" }, [
vue.createElementVNode("view", { class: "title f-row aic jcb" }, [
vue.createElementVNode("view", { class: "" }, " 年度部门讨论会议 "),
vue.createElementVNode("text", null, "1分钟前")
]),
vue.createElementVNode("view", { class: "info" }, [
vue.createElementVNode("view", { class: "f-row aic jcb" }, [
vue.createElementVNode("view", { class: "" }, " 会议状态: "),
vue.createElementVNode("text", null, "待开始/已开始/已结束")
]),
vue.createElementVNode("view", { class: "f-row aic jcb" }, [
vue.createElementVNode("view", { class: "" }, " 发起人: "),
vue.createElementVNode("text", null, "周如意")
]),
vue.createElementVNode("view", { class: "f-row aic jcb" }, [
vue.createElementVNode("view", { class: "" }, " 会议日期: "),
vue.createElementVNode("text", null, "周如意")
]),
vue.createElementVNode("view", { class: "f-row aic jcb" }, [
vue.createElementVNode("view", { class: "" }, " 会议地点: "),
vue.createElementVNode("text", null, "周如意")
]),
vue.createElementVNode("view", { class: "f-row aic jcb" }, [
vue.createElementVNode("view", { class: "" }, " 会议内容: "),
vue.createElementVNode("text", null, "周如意")
]),
vue.createElementVNode("view", { class: "" }, [
vue.createElementVNode("view", { class: "" }, " 参与人员: "),
vue.createElementVNode("view", { class: "person f-row aic" }, [
(vue.openBlock(), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(7, (item, i2) => {
return vue.createElementVNode("view", {
class: "item f-col aic",
key: i2
}, [
vue.createElementVNode("image", {
src: "",
mode: ""
}),
vue.createElementVNode("view", { class: "name" }, " 周如意 ")
]);
}),
64
/* STABLE_FRAGMENT */
))
])
])
])
])
]),
vue.createElementVNode("view", { class: "btn f-row aic jcb" }, [
vue.createElementVNode("view", { class: "refuse" }, " 拒绝 "),
vue.createElementVNode("view", {
class: "agree",
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.openpop && _ctx.openpop(...args))
}, " 同意 ")
])
],
2
/* CLASS */
);
};
}
};
2024-10-14 07:22:41 +00:00
const PagesMeetingDetail = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["__scopeId", "data-v-ee2c785f"], ["__file", "D:/projects/cxc-szcx-uniapp/pages/meeting/detail.vue"]]);
const pages = [
{
path: "pages/login/login",
style: {
navigationStyle: "custom"
2024-10-12 00:53:10 +00:00
}
2024-10-14 07:22:41 +00:00
},
{
path: "pages/tab/index",
style: {
navigationStyle: "custom",
enablePullDownRefresh: true
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
},
{
path: "pages/tab/office",
style: {
navigationStyle: "custom"
2024-09-24 09:21:34 +00:00
}
},
2024-10-14 07:22:41 +00:00
{
path: "pages/tab/product",
style: {
navigationStyle: "custom"
}
2024-09-24 09:21:34 +00:00
},
2024-10-14 07:22:41 +00:00
{
path: "pages/tab/my",
style: {
navigationStyle: "custom"
2024-09-24 09:21:34 +00:00
}
},
2024-10-14 07:22:41 +00:00
{
path: "pages/task/index",
style: {
enablePullDownRefresh: true,
"app-plus": {
titleNView: {
titleText: "我的任务",
titleColor: "#fff"
}
2024-09-24 09:21:34 +00:00
}
}
},
2024-10-14 07:22:41 +00:00
{
path: "pages/task/handle",
style: {
navigationStyle: "custom"
2024-09-24 09:21:34 +00:00
}
},
2024-10-14 07:22:41 +00:00
{
path: "pages/talk/message_list",
style: {
navigationBarTitleText: "消息",
enablePullDownRefresh: true,
navigationBarTextStyle: "white"
2024-09-24 09:21:34 +00:00
}
},
2024-10-14 07:22:41 +00:00
{
path: "pages/talk/conversation",
style: {
navigationBarTitleText: "昵称",
enablePullDownRefresh: true,
navigationBarTextStyle: "white"
2024-09-24 09:21:34 +00:00
}
},
2024-10-14 07:22:41 +00:00
{
path: "pages/talk/system",
style: {
navigationBarTitleText: "系统通知",
enablePullDownRefresh: true,
navigationBarTextStyle: "white"
}
2024-09-24 09:21:34 +00:00
},
2024-10-14 07:22:41 +00:00
{
path: "pages/document/index",
style: {
navigationStyle: "custom",
enablePullDownRefresh: true
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
},
{
path: "pages/document/detail",
style: {
navigationBarTitleText: "详情",
navigationBarTextStyle: "white"
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
},
{
path: "pages/meeting/index",
style: {
navigationStyle: "custom"
2024-09-24 09:21:34 +00:00
}
},
2024-10-14 07:22:41 +00:00
{
path: "pages/meeting/detail",
style: {
navigationBarTitleText: "详情",
enablePullDownRefresh: false,
navigationBarTextStyle: "white"
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
},
{
path: "pages/leave/application",
style: {
navigationBarTitleText: "请假申请",
enablePullDownRefresh: false,
navigationBarTextStyle: "white"
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
},
{
path: "pages/checkin/index",
style: {
navigationStyle: "custom"
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
},
{
path: "pages/useredit/useredit",
style: {
navigationBarTitleText: "资料编辑",
navigationBarTextStyle: "white"
}
},
{
path: "pages/useredit/address",
style: {
navigationBarTitleText: "地址",
enablePullDownRefresh: false,
navigationBarTextStyle: "white"
}
},
{
path: "pages/useredit/add_address",
style: {
navigationBarTitleText: "添加地址",
enablePullDownRefresh: false,
navigationBarTextStyle: "white"
}
},
{
path: "pages/useredit/addressbook",
style: {
navigationBarTitleText: "通讯录",
enablePullDownRefresh: false,
navigationBarTextStyle: "white"
}
},
{
path: "pages/task/todotask",
style: {
navigationBarTitleText: "今日待办任务",
enablePullDownRefresh: false,
navigationBarTextStyle: "white"
}
},
{
path: "pages/safe/manage",
style: {
navigationStyle: "custom"
}
},
{
path: "pages/product/index",
style: {
navigationBarTitleText: "生产数据",
enablePullDownRefresh: false,
navigationBarTextStyle: "white"
}
},
{
path: "pages/userlist/index",
style: {
navigationBarTitleText: "",
navigationBarTextStyle: "white"
}
},
{
path: "pages/safe/detail",
style: {
navigationStyle: "custom"
}
},
{
path: "pages/zhiban/index",
style: {
navigationBarTitleText: "值班信息",
navigationBarTextStyle: "white"
}
},
{
path: "pages/task/self",
style: {
navigationBarTitleText: "本人发起",
navigationBarTextStyle: "white"
2024-09-24 09:21:34 +00:00
}
}
2024-10-14 07:22:41 +00:00
];
const tabBar = {
color: "#333333",
selectedColor: "#01508B",
borderStyle: "black",
backgroundColor: "#FFFFFF",
list: [
{
text: "首页",
pagePath: "pages/tab/index",
iconPath: "static/tab/index1.png",
selectedIconPath: "static/tab/index2.png"
2024-09-24 09:21:34 +00:00
},
2024-10-14 07:22:41 +00:00
{
text: "办公",
pagePath: "pages/tab/office",
iconPath: "static/tab/office1.png",
selectedIconPath: "static/tab/office2.png"
2024-09-24 09:21:34 +00:00
},
2024-10-14 07:22:41 +00:00
{
text: "生产",
pagePath: "pages/tab/product",
iconPath: "static/tab/product1.png",
selectedIconPath: "static/tab/product2.png"
2024-09-24 09:21:34 +00:00
},
2024-10-14 07:22:41 +00:00
{
text: "我的",
pagePath: "pages/tab/my",
iconPath: "static/tab/user1.png",
selectedIconPath: "static/tab/user2.png"
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
],
midButton: {
width: "65px",
height: "75px",
text: "",
iconPath: "static/tab/todo.png",
iconWidth: "50px"
}
};
const globalStyle = {
"app-plus": {
titleNView: {
backgroundImage: "linear-gradient(to left , #256FBC, #044D87)"
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
}
};
const uniIdRouter = {};
const e = {
pages,
tabBar,
globalStyle,
uniIdRouter
};
var define_process_env_UNI_SECURE_NETWORK_CONFIG_default = [];
function t$1(e2) {
return e2 && e2.__esModule && Object.prototype.hasOwnProperty.call(e2, "default") ? e2.default : e2;
}
function n(e2, t2, n2) {
return e2(n2 = { path: t2, exports: {}, require: function(e3, t3) {
return function() {
throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs");
}(null == t3 && n2.path);
} }, n2.exports), n2.exports;
}
var s = n(function(e2, t2) {
var n2;
e2.exports = (n2 = n2 || function(e3, t3) {
var n3 = Object.create || /* @__PURE__ */ function() {
function e4() {
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
return function(t4) {
var n4;
return e4.prototype = t4, n4 = new e4(), e4.prototype = null, n4;
};
}(), s2 = {}, r2 = s2.lib = {}, i2 = r2.Base = { extend: function(e4) {
var t4 = n3(this);
return e4 && t4.mixIn(e4), t4.hasOwnProperty("init") && this.init !== t4.init || (t4.init = function() {
t4.$super.init.apply(this, arguments);
}), t4.init.prototype = t4, t4.$super = this, t4;
}, create: function() {
var e4 = this.extend();
return e4.init.apply(e4, arguments), e4;
}, init: function() {
}, mixIn: function(e4) {
for (var t4 in e4)
e4.hasOwnProperty(t4) && (this[t4] = e4[t4]);
e4.hasOwnProperty("toString") && (this.toString = e4.toString);
}, clone: function() {
return this.init.prototype.extend(this);
} }, o2 = r2.WordArray = i2.extend({ init: function(e4, n4) {
e4 = this.words = e4 || [], this.sigBytes = n4 != t3 ? n4 : 4 * e4.length;
}, toString: function(e4) {
return (e4 || c2).stringify(this);
}, concat: function(e4) {
var t4 = this.words, n4 = e4.words, s3 = this.sigBytes, r3 = e4.sigBytes;
if (this.clamp(), s3 % 4)
for (var i3 = 0; i3 < r3; i3++) {
var o3 = n4[i3 >>> 2] >>> 24 - i3 % 4 * 8 & 255;
t4[s3 + i3 >>> 2] |= o3 << 24 - (s3 + i3) % 4 * 8;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
else
for (i3 = 0; i3 < r3; i3 += 4)
t4[s3 + i3 >>> 2] = n4[i3 >>> 2];
return this.sigBytes += r3, this;
}, clamp: function() {
var t4 = this.words, n4 = this.sigBytes;
t4[n4 >>> 2] &= 4294967295 << 32 - n4 % 4 * 8, t4.length = e3.ceil(n4 / 4);
}, clone: function() {
var e4 = i2.clone.call(this);
return e4.words = this.words.slice(0), e4;
}, random: function(t4) {
for (var n4, s3 = [], r3 = function(t5) {
t5 = t5;
var n5 = 987654321, s4 = 4294967295;
return function() {
var r4 = ((n5 = 36969 * (65535 & n5) + (n5 >> 16) & s4) << 16) + (t5 = 18e3 * (65535 & t5) + (t5 >> 16) & s4) & s4;
return r4 /= 4294967296, (r4 += 0.5) * (e3.random() > 0.5 ? 1 : -1);
2024-09-24 09:21:34 +00:00
};
2024-10-14 07:22:41 +00:00
}, i3 = 0; i3 < t4; i3 += 4) {
var a3 = r3(4294967296 * (n4 || e3.random()));
n4 = 987654071 * a3(), s3.push(4294967296 * a3() | 0);
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
return new o2.init(s3, t4);
} }), a2 = s2.enc = {}, c2 = a2.Hex = { stringify: function(e4) {
for (var t4 = e4.words, n4 = e4.sigBytes, s3 = [], r3 = 0; r3 < n4; r3++) {
var i3 = t4[r3 >>> 2] >>> 24 - r3 % 4 * 8 & 255;
s3.push((i3 >>> 4).toString(16)), s3.push((15 & i3).toString(16));
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
return s3.join("");
}, parse: function(e4) {
for (var t4 = e4.length, n4 = [], s3 = 0; s3 < t4; s3 += 2)
n4[s3 >>> 3] |= parseInt(e4.substr(s3, 2), 16) << 24 - s3 % 8 * 4;
return new o2.init(n4, t4 / 2);
} }, u2 = a2.Latin1 = { stringify: function(e4) {
for (var t4 = e4.words, n4 = e4.sigBytes, s3 = [], r3 = 0; r3 < n4; r3++) {
var i3 = t4[r3 >>> 2] >>> 24 - r3 % 4 * 8 & 255;
s3.push(String.fromCharCode(i3));
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
return s3.join("");
}, parse: function(e4) {
for (var t4 = e4.length, n4 = [], s3 = 0; s3 < t4; s3++)
n4[s3 >>> 2] |= (255 & e4.charCodeAt(s3)) << 24 - s3 % 4 * 8;
return new o2.init(n4, t4);
} }, h2 = a2.Utf8 = { stringify: function(e4) {
try {
return decodeURIComponent(escape(u2.stringify(e4)));
} catch (e5) {
throw new Error("Malformed UTF-8 data");
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
}, parse: function(e4) {
return u2.parse(unescape(encodeURIComponent(e4)));
} }, l2 = r2.BufferedBlockAlgorithm = i2.extend({ reset: function() {
this._data = new o2.init(), this._nDataBytes = 0;
}, _append: function(e4) {
"string" == typeof e4 && (e4 = h2.parse(e4)), this._data.concat(e4), this._nDataBytes += e4.sigBytes;
}, _process: function(t4) {
var n4 = this._data, s3 = n4.words, r3 = n4.sigBytes, i3 = this.blockSize, a3 = r3 / (4 * i3), c3 = (a3 = t4 ? e3.ceil(a3) : e3.max((0 | a3) - this._minBufferSize, 0)) * i3, u3 = e3.min(4 * c3, r3);
if (c3) {
for (var h3 = 0; h3 < c3; h3 += i3)
this._doProcessBlock(s3, h3);
var l3 = s3.splice(0, c3);
n4.sigBytes -= u3;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
return new o2.init(l3, u3);
}, clone: function() {
var e4 = i2.clone.call(this);
return e4._data = this._data.clone(), e4;
}, _minBufferSize: 0 });
r2.Hasher = l2.extend({ cfg: i2.extend(), init: function(e4) {
this.cfg = this.cfg.extend(e4), this.reset();
}, reset: function() {
l2.reset.call(this), this._doReset();
}, update: function(e4) {
return this._append(e4), this._process(), this;
}, finalize: function(e4) {
return e4 && this._append(e4), this._doFinalize();
}, blockSize: 16, _createHelper: function(e4) {
return function(t4, n4) {
return new e4.init(n4).finalize(t4);
};
}, _createHmacHelper: function(e4) {
return function(t4, n4) {
return new d2.HMAC.init(e4, n4).finalize(t4);
};
} });
var d2 = s2.algo = {};
return s2;
}(Math), n2);
}), r = s, i = (n(function(e2, t2) {
var n2;
e2.exports = (n2 = r, function(e3) {
var t3 = n2, s2 = t3.lib, r2 = s2.WordArray, i2 = s2.Hasher, o2 = t3.algo, a2 = [];
!function() {
for (var t4 = 0; t4 < 64; t4++)
a2[t4] = 4294967296 * e3.abs(e3.sin(t4 + 1)) | 0;
}();
var c2 = o2.MD5 = i2.extend({ _doReset: function() {
this._hash = new r2.init([1732584193, 4023233417, 2562383102, 271733878]);
}, _doProcessBlock: function(e4, t4) {
for (var n3 = 0; n3 < 16; n3++) {
var s3 = t4 + n3, r3 = e4[s3];
e4[s3] = 16711935 & (r3 << 8 | r3 >>> 24) | 4278255360 & (r3 << 24 | r3 >>> 8);
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
var i3 = this._hash.words, o3 = e4[t4 + 0], c3 = e4[t4 + 1], p2 = e4[t4 + 2], f2 = e4[t4 + 3], g2 = e4[t4 + 4], m2 = e4[t4 + 5], y2 = e4[t4 + 6], _2 = e4[t4 + 7], w2 = e4[t4 + 8], v2 = e4[t4 + 9], I2 = e4[t4 + 10], S2 = e4[t4 + 11], b2 = e4[t4 + 12], k2 = e4[t4 + 13], A2 = e4[t4 + 14], P2 = e4[t4 + 15], T2 = i3[0], C2 = i3[1], x2 = i3[2], O2 = i3[3];
T2 = u2(T2, C2, x2, O2, o3, 7, a2[0]), O2 = u2(O2, T2, C2, x2, c3, 12, a2[1]), x2 = u2(x2, O2, T2, C2, p2, 17, a2[2]), C2 = u2(C2, x2, O2, T2, f2, 22, a2[3]), T2 = u2(T2, C2, x2, O2, g2, 7, a2[4]), O2 = u2(O2, T2, C2, x2, m2, 12, a2[5]), x2 = u2(x2, O2, T2, C2, y2, 17, a2[6]), C2 = u2(C2, x2, O2, T2, _2, 22, a2[7]), T2 = u2(T2, C2, x2, O2, w2, 7, a2[8]), O2 = u2(O2, T2, C2, x2, v2, 12, a2[9]), x2 = u2(x2, O2, T2, C2, I2, 17, a2[10]), C2 = u2(C2, x2, O2, T2, S2, 22, a2[11]), T2 = u2(T2, C2, x2, O2, b2, 7, a2[12]), O2 = u2(O2, T2, C2, x2, k2, 12, a2[13]), x2 = u2(x2, O2, T2, C2, A2, 17, a2[14]), T2 = h2(T2, C2 = u2(C2, x2, O2, T2, P2, 22, a2[15]), x2, O2, c3, 5, a2[16]), O2 = h2(O2, T2, C2, x2, y2, 9, a2[17]), x2 = h2(x2, O2, T2, C2, S2, 14, a2[18]), C2 = h2(C2, x2, O2, T2, o3, 20, a2[19]), T2 = h2(T2, C2, x2, O2, m2, 5, a2[20]), O2 = h2(O2, T2, C2, x2, I2, 9, a2[21]), x2 = h2(x2, O2, T2, C2, P2, 14, a2[22]), C2 = h2(C2, x2, O2, T2, g2, 20, a2[23]), T2 = h2(T2, C2, x2, O2, v2, 5, a2[24]), O2 = h2(O2, T2, C2, x2, A2, 9, a2[25]), x2 = h2(x2, O2, T2, C2, f2, 14, a2[26]), C2 = h2(C2, x2, O2, T2, w2, 20, a2[27]), T2 = h2(T2, C2, x2, O2, k2, 5, a2[28]), O2 = h2(O2, T2, C2, x2, p2, 9, a2[29]), x2 = h2(x2, O2, T2, C2, _2, 14, a2[30]), T2 = l2(T2, C2 = h2(C2, x2, O2, T2, b2, 20, a2[31]), x2, O2, m2, 4, a2[32]), O2 = l2(O2, T2, C2, x2, w2, 11, a2[33]), x2 = l2(x2, O2, T2, C2, S2, 16, a2[34]), C2 = l2(C2, x2, O2, T2, A2, 23, a2[35]), T2 = l2(T2, C2, x2, O2, c3, 4, a2[36]), O2 = l2(O2, T2, C2, x2, g2, 11, a2[37]), x2 = l2(x2, O2, T2, C2, _2, 16, a2[38]), C2 = l2(C2, x2, O2, T2, I2, 23, a2[39]), T2 = l2(T2, C2, x2, O2, k2, 4, a2[40]), O2 = l2(O2, T2, C2, x2, o3, 11, a2[41]), x2 = l2(x2, O2, T2, C2, f2, 16, a2[42]), C2 = l2(C2, x2, O2, T2, y2, 23, a2[43]), T2 = l2(T2, C2, x2, O2, v2, 4, a2[44]), O2 = l2(O2, T2, C2, x2, b2, 11, a2[45]), x2 = l2(x2, O2, T2, C2, P2, 16, a2[46]), T2 = d2(T2, C2 = l2(C2, x2, O2, T2, p2, 23, a2[47]), x2, O2, o3, 6, a2[48]), O2 = d2(O2, T2, C2, x2, _2, 10, a2[49]), x2 = d2(x2, O2, T2, C2, A2, 15, a2[50]), C2 = d2(C2, x2, O2, T2, m2, 21, a2[51]), T2 = d2(T2, C2, x2, O2, b2, 6, a2[52]), O2 = d2(O2, T2, C2, x2, f2, 10, a2[53]), x2 = d2(x2, O2, T2, C2, I2, 15, a2[54]), C2 = d2(C2, x2, O2, T2, c3, 21, a2[55]), T2 = d2(T2, C2, x2, O2, w2, 6, a2[56]), O2 = d2(O2, T2, C2, x2, P2, 10, a2[57]), x2 = d2(x2, O2, T2, C2, y2, 15, a2[58]), C2 = d2(C2, x2, O2, T2, k2, 21, a2[59]), T2 = d2(T2, C2, x2, O2, g2, 6, a2[60]), O2 = d2(O2, T2, C2, x2, S2, 10, a2[61]), x2 = d2(x2, O2, T2, C2, p2, 15, a2[62]), C2 = d2(C2, x2, O2, T2, v2, 21, a2[63]), i3[0] = i3[0] + T2 | 0, i3[1] = i3[1] + C2 | 0, i3[2] = i3[2] + x2 | 0, i3[3] = i3[3] + O2 | 0;
}, _doFinalize: function() {
var t4 = this._data, n3 = t4.words, s3 = 8 * this._nDataBytes, r3 = 8 * t4.sigBytes;
n3[r3 >>> 5] |= 128 << 24 - r3 % 32;
var i3 = e3.floor(s3 / 4294967296), o3 = s3;
n3[15 + (r3 + 64 >>> 9 << 4)] = 16711935 & (i3 << 8 | i3 >>> 24) | 4278255360 & (i3 << 24 | i3 >>> 8), n3[14 + (r3 + 64 >>> 9 << 4)] = 16711935 & (o3 << 8 | o3 >>> 24) | 4278255360 & (o3 << 24 | o3 >>> 8), t4.sigBytes = 4 * (n3.length + 1), this._process();
for (var a3 = this._hash, c3 = a3.words, u3 = 0; u3 < 4; u3++) {
var h3 = c3[u3];
c3[u3] = 16711935 & (h3 << 8 | h3 >>> 24) | 4278255360 & (h3 << 24 | h3 >>> 8);
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
return a3;
}, clone: function() {
var e4 = i2.clone.call(this);
return e4._hash = this._hash.clone(), e4;
} });
function u2(e4, t4, n3, s3, r3, i3, o3) {
var a3 = e4 + (t4 & n3 | ~t4 & s3) + r3 + o3;
return (a3 << i3 | a3 >>> 32 - i3) + t4;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
function h2(e4, t4, n3, s3, r3, i3, o3) {
var a3 = e4 + (t4 & s3 | n3 & ~s3) + r3 + o3;
return (a3 << i3 | a3 >>> 32 - i3) + t4;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
function l2(e4, t4, n3, s3, r3, i3, o3) {
var a3 = e4 + (t4 ^ n3 ^ s3) + r3 + o3;
return (a3 << i3 | a3 >>> 32 - i3) + t4;
}
function d2(e4, t4, n3, s3, r3, i3, o3) {
var a3 = e4 + (n3 ^ (t4 | ~s3)) + r3 + o3;
return (a3 << i3 | a3 >>> 32 - i3) + t4;
}
t3.MD5 = i2._createHelper(c2), t3.HmacMD5 = i2._createHmacHelper(c2);
}(Math), n2.MD5);
}), n(function(e2, t2) {
var n2;
e2.exports = (n2 = r, void function() {
var e3 = n2, t3 = e3.lib.Base, s2 = e3.enc.Utf8;
e3.algo.HMAC = t3.extend({ init: function(e4, t4) {
e4 = this._hasher = new e4.init(), "string" == typeof t4 && (t4 = s2.parse(t4));
var n3 = e4.blockSize, r2 = 4 * n3;
t4.sigBytes > r2 && (t4 = e4.finalize(t4)), t4.clamp();
for (var i2 = this._oKey = t4.clone(), o2 = this._iKey = t4.clone(), a2 = i2.words, c2 = o2.words, u2 = 0; u2 < n3; u2++)
a2[u2] ^= 1549556828, c2[u2] ^= 909522486;
i2.sigBytes = o2.sigBytes = r2, this.reset();
}, reset: function() {
var e4 = this._hasher;
e4.reset(), e4.update(this._iKey);
}, update: function(e4) {
return this._hasher.update(e4), this;
}, finalize: function(e4) {
var t4 = this._hasher, n3 = t4.finalize(e4);
return t4.reset(), t4.finalize(this._oKey.clone().concat(n3));
} });
}());
}), n(function(e2, t2) {
e2.exports = r.HmacMD5;
})), o = n(function(e2, t2) {
e2.exports = r.enc.Utf8;
}), a = n(function(e2, t2) {
var n2;
e2.exports = (n2 = r, function() {
var e3 = n2, t3 = e3.lib.WordArray;
function s2(e4, n3, s3) {
for (var r2 = [], i2 = 0, o2 = 0; o2 < n3; o2++)
if (o2 % 4) {
var a2 = s3[e4.charCodeAt(o2 - 1)] << o2 % 4 * 2, c2 = s3[e4.charCodeAt(o2)] >>> 6 - o2 % 4 * 2;
r2[i2 >>> 2] |= (a2 | c2) << 24 - i2 % 4 * 8, i2++;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
return t3.create(r2, i2);
}
e3.enc.Base64 = { stringify: function(e4) {
var t4 = e4.words, n3 = e4.sigBytes, s3 = this._map;
e4.clamp();
for (var r2 = [], i2 = 0; i2 < n3; i2 += 3)
for (var o2 = (t4[i2 >>> 2] >>> 24 - i2 % 4 * 8 & 255) << 16 | (t4[i2 + 1 >>> 2] >>> 24 - (i2 + 1) % 4 * 8 & 255) << 8 | t4[i2 + 2 >>> 2] >>> 24 - (i2 + 2) % 4 * 8 & 255, a2 = 0; a2 < 4 && i2 + 0.75 * a2 < n3; a2++)
r2.push(s3.charAt(o2 >>> 6 * (3 - a2) & 63));
var c2 = s3.charAt(64);
if (c2)
for (; r2.length % 4; )
r2.push(c2);
return r2.join("");
}, parse: function(e4) {
var t4 = e4.length, n3 = this._map, r2 = this._reverseMap;
if (!r2) {
r2 = this._reverseMap = [];
for (var i2 = 0; i2 < n3.length; i2++)
r2[n3.charCodeAt(i2)] = i2;
}
var o2 = n3.charAt(64);
if (o2) {
var a2 = e4.indexOf(o2);
-1 !== a2 && (t4 = a2);
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
return s2(e4, t4, r2);
}, _map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" };
}(), n2.enc.Base64);
});
const c = "FUNCTION", u = "OBJECT", h = "CLIENT_DB", l = "pending", d = "fulfilled", p = "rejected";
function f(e2) {
return Object.prototype.toString.call(e2).slice(8, -1).toLowerCase();
}
function g(e2) {
return "object" === f(e2);
}
function m(e2) {
return "function" == typeof e2;
}
function y(e2) {
return function() {
try {
return e2.apply(e2, arguments);
} catch (e3) {
console.error(e3);
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
};
}
const _ = "REJECTED", w = "NOT_PENDING";
class v {
constructor({ createPromise: e2, retryRule: t2 = _ } = {}) {
this.createPromise = e2, this.status = null, this.promise = null, this.retryRule = t2;
}
get needRetry() {
if (!this.status)
return true;
switch (this.retryRule) {
case _:
return this.status === p;
case w:
return this.status !== l;
2024-09-24 09:21:34 +00:00
}
}
2024-10-14 07:22:41 +00:00
exec() {
return this.needRetry ? (this.status = l, this.promise = this.createPromise().then((e2) => (this.status = d, Promise.resolve(e2)), (e2) => (this.status = p, Promise.reject(e2))), this.promise) : this.promise;
}
}
function I(e2) {
return e2 && "string" == typeof e2 ? JSON.parse(e2) : e2;
}
const S = true, b = "app", A = I(define_process_env_UNI_SECURE_NETWORK_CONFIG_default), P = b, T = I(""), C = I("[]") || [];
let O = "";
try {
O = "__UNI__F0AFD30";
} catch (e2) {
}
let E = {};
function L(e2, t2 = {}) {
var n2, s2;
return n2 = E, s2 = e2, Object.prototype.hasOwnProperty.call(n2, s2) || (E[e2] = t2), E[e2];
}
E = uni._globalUniCloudObj ? uni._globalUniCloudObj : uni._globalUniCloudObj = {};
const R = ["invoke", "success", "fail", "complete"], U = L("_globalUniCloudInterceptor");
function N(e2, t2) {
U[e2] || (U[e2] = {}), g(t2) && Object.keys(t2).forEach((n2) => {
R.indexOf(n2) > -1 && function(e3, t3, n3) {
let s2 = U[e3][t3];
s2 || (s2 = U[e3][t3] = []), -1 === s2.indexOf(n3) && m(n3) && s2.push(n3);
}(e2, n2, t2[n2]);
});
}
function D(e2, t2) {
U[e2] || (U[e2] = {}), g(t2) ? Object.keys(t2).forEach((n2) => {
R.indexOf(n2) > -1 && function(e3, t3, n3) {
const s2 = U[e3][t3];
if (!s2)
return;
const r2 = s2.indexOf(n3);
r2 > -1 && s2.splice(r2, 1);
}(e2, n2, t2[n2]);
}) : delete U[e2];
}
function M(e2, t2) {
return e2 && 0 !== e2.length ? e2.reduce((e3, n2) => e3.then(() => n2(t2)), Promise.resolve()) : Promise.resolve();
}
function q(e2, t2) {
return U[e2] && U[e2][t2] || [];
}
function F(e2) {
N("callObject", e2);
}
const K = L("_globalUniCloudListener"), j = "response", $ = "needLogin", B = "refreshToken", W = "clientdb", H = "cloudfunction", z = "cloudobject";
function J(e2) {
return K[e2] || (K[e2] = []), K[e2];
}
function G(e2, t2) {
const n2 = J(e2);
n2.includes(t2) || n2.push(t2);
}
function V(e2, t2) {
const n2 = J(e2), s2 = n2.indexOf(t2);
-1 !== s2 && n2.splice(s2, 1);
}
function Y(e2, t2) {
const n2 = J(e2);
for (let e3 = 0; e3 < n2.length; e3++) {
(0, n2[e3])(t2);
}
}
let Q, X = false;
function Z() {
return Q || (Q = new Promise((e2) => {
X && e2(), function t2() {
if ("function" == typeof getCurrentPages) {
const t3 = getCurrentPages();
t3 && t3[0] && (X = true, e2());
}
X || setTimeout(() => {
t2();
}, 30);
}();
}), Q);
}
function ee(e2) {
const t2 = {};
for (const n2 in e2) {
const s2 = e2[n2];
m(s2) && (t2[n2] = y(s2));
}
return t2;
}
class te extends Error {
constructor(e2) {
super(e2.message), this.errMsg = e2.message || e2.errMsg || "unknown system error", this.code = this.errCode = e2.code || e2.errCode || "SYSTEM_ERROR", this.errSubject = this.subject = e2.subject || e2.errSubject, this.cause = e2.cause, this.requestId = e2.requestId;
}
toJson(e2 = 0) {
if (!(e2 >= 10))
return e2++, { errCode: this.errCode, errMsg: this.errMsg, errSubject: this.errSubject, cause: this.cause && this.cause.toJson ? this.cause.toJson(e2) : this.cause };
}
}
var ne = { request: (e2) => uni.request(e2), uploadFile: (e2) => uni.uploadFile(e2), setStorageSync: (e2, t2) => uni.setStorageSync(e2, t2), getStorageSync: (e2) => uni.getStorageSync(e2), removeStorageSync: (e2) => uni.removeStorageSync(e2), clearStorageSync: () => uni.clearStorageSync() };
function se(e2) {
return e2 && se(e2.__v_raw) || e2;
}
function re() {
return { token: ne.getStorageSync("uni_id_token") || ne.getStorageSync("uniIdToken"), tokenExpired: ne.getStorageSync("uni_id_token_expired") };
}
function ie({ token: e2, tokenExpired: t2 } = {}) {
e2 && ne.setStorageSync("uni_id_token", e2), t2 && ne.setStorageSync("uni_id_token_expired", t2);
}
let oe, ae;
function ce() {
return oe || (oe = uni.getSystemInfoSync()), oe;
}
function ue() {
let e2, t2;
try {
if (uni.getLaunchOptionsSync) {
if (uni.getLaunchOptionsSync.toString().indexOf("not yet implemented") > -1)
return;
const { scene: n2, channel: s2 } = uni.getLaunchOptionsSync();
e2 = s2, t2 = n2;
}
} catch (e3) {
}
return { channel: e2, scene: t2 };
}
function he() {
const e2 = uni.getLocale && uni.getLocale() || "en";
if (ae)
return { ...ae, locale: e2, LOCALE: e2 };
const t2 = ce(), { deviceId: n2, osName: s2, uniPlatform: r2, appId: i2 } = t2, o2 = ["pixelRatio", "brand", "model", "system", "language", "version", "platform", "host", "SDKVersion", "swanNativeVersion", "app", "AppPlatform", "fontSizeSetting"];
for (let e3 = 0; e3 < o2.length; e3++) {
delete t2[o2[e3]];
}
return ae = { PLATFORM: r2, OS: s2, APPID: i2, DEVICEID: n2, ...ue(), ...t2 }, { ...ae, locale: e2, LOCALE: e2 };
}
var le = { sign: function(e2, t2) {
let n2 = "";
return Object.keys(e2).sort().forEach(function(t3) {
e2[t3] && (n2 = n2 + "&" + t3 + "=" + e2[t3]);
}), n2 = n2.slice(1), i(n2, t2).toString();
}, wrappedRequest: function(e2, t2) {
return new Promise((n2, s2) => {
t2(Object.assign(e2, { complete(e3) {
e3 || (e3 = {});
const t3 = e3.data && e3.data.header && e3.data.header["x-serverless-request-id"] || e3.header && e3.header["request-id"];
if (!e3.statusCode || e3.statusCode >= 400) {
const n3 = e3.data && e3.data.error && e3.data.error.code || "SYS_ERR", r3 = e3.data && e3.data.error && e3.data.error.message || e3.errMsg || "request:fail";
return s2(new te({ code: n3, message: r3, requestId: t3 }));
}
const r2 = e3.data;
if (r2.error)
return s2(new te({ code: r2.error.code, message: r2.error.message, requestId: t3 }));
r2.result = r2.data, r2.requestId = t3, delete r2.data, n2(r2);
} }));
});
}, toBase64: function(e2) {
return a.stringify(o.parse(e2));
} };
var de = class {
constructor(e2) {
["spaceId", "clientSecret"].forEach((t2) => {
if (!Object.prototype.hasOwnProperty.call(e2, t2))
throw new Error(`${t2} required`);
}), this.config = Object.assign({}, { endpoint: 0 === e2.spaceId.indexOf("mp-") ? "https://api.next.bspapp.com" : "https://api.bspapp.com" }, e2), this.config.provider = "aliyun", this.config.requestUrl = this.config.endpoint + "/client", this.config.envType = this.config.envType || "public", this.config.accessTokenKey = "access_token_" + this.config.spaceId, this.adapter = ne, this._getAccessTokenPromiseHub = new v({ createPromise: () => this.requestAuth(this.setupRequest({ method: "serverless.auth.user.anonymousAuthorize", params: "{}" }, "auth")).then((e3) => {
if (!e3.result || !e3.result.accessToken)
throw new te({ code: "AUTH_FAILED", message: "获取accessToken失败" });
this.setAccessToken(e3.result.accessToken);
}), retryRule: w });
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
get hasAccessToken() {
return !!this.accessToken;
}
setAccessToken(e2) {
this.accessToken = e2;
}
requestWrapped(e2) {
return le.wrappedRequest(e2, this.adapter.request);
}
requestAuth(e2) {
return this.requestWrapped(e2);
}
request(e2, t2) {
return Promise.resolve().then(() => this.hasAccessToken ? t2 ? this.requestWrapped(e2) : this.requestWrapped(e2).catch((t3) => new Promise((e3, n2) => {
!t3 || "GATEWAY_INVALID_TOKEN" !== t3.code && "InvalidParameter.InvalidToken" !== t3.code ? n2(t3) : e3();
}).then(() => this.getAccessToken()).then(() => {
const t4 = this.rebuildRequest(e2);
return this.request(t4, true);
})) : this.getAccessToken().then(() => {
const t3 = this.rebuildRequest(e2);
return this.request(t3, true);
}));
}
rebuildRequest(e2) {
const t2 = Object.assign({}, e2);
return t2.data.token = this.accessToken, t2.header["x-basement-token"] = this.accessToken, t2.header["x-serverless-sign"] = le.sign(t2.data, this.config.clientSecret), t2;
}
setupRequest(e2, t2) {
const n2 = Object.assign({}, e2, { spaceId: this.config.spaceId, timestamp: Date.now() }), s2 = { "Content-Type": "application/json" };
return "auth" !== t2 && (n2.token = this.accessToken, s2["x-basement-token"] = this.accessToken), s2["x-serverless-sign"] = le.sign(n2, this.config.clientSecret), { url: this.config.requestUrl, method: "POST", data: n2, dataType: "json", header: s2 };
}
getAccessToken() {
return this._getAccessTokenPromiseHub.exec();
}
async authorize() {
await this.getAccessToken();
}
callFunction(e2) {
const t2 = { method: "serverless.function.runtime.invoke", params: JSON.stringify({ functionTarget: e2.name, functionArgs: e2.data || {} }) };
return this.request(this.setupRequest(t2));
}
getOSSUploadOptionsFromPath(e2) {
const t2 = { method: "serverless.file.resource.generateProximalSign", params: JSON.stringify(e2) };
return this.request(this.setupRequest(t2));
}
uploadFileToOSS({ url: e2, formData: t2, name: n2, filePath: s2, fileType: r2, onUploadProgress: i2 }) {
return new Promise((o2, a2) => {
const c2 = this.adapter.uploadFile({ url: e2, formData: t2, name: n2, filePath: s2, fileType: r2, header: { "X-OSS-server-side-encrpytion": "AES256" }, success(e3) {
e3 && e3.statusCode < 400 ? o2(e3) : a2(new te({ code: "UPLOAD_FAILED", message: "文件上传失败" }));
}, fail(e3) {
a2(new te({ code: e3.code || "UPLOAD_FAILED", message: e3.message || e3.errMsg || "文件上传失败" }));
} });
"function" == typeof i2 && c2 && "function" == typeof c2.onProgressUpdate && c2.onProgressUpdate((e3) => {
i2({ loaded: e3.totalBytesSent, total: e3.totalBytesExpectedToSend });
2024-09-24 09:21:34 +00:00
});
});
2024-10-14 07:22:41 +00:00
}
reportOSSUpload(e2) {
const t2 = { method: "serverless.file.resource.report", params: JSON.stringify(e2) };
return this.request(this.setupRequest(t2));
}
async uploadFile({ filePath: e2, cloudPath: t2, fileType: n2 = "image", cloudPathAsRealPath: s2 = false, onUploadProgress: r2, config: i2 }) {
if ("string" !== f(t2))
throw new te({ code: "INVALID_PARAM", message: "cloudPath必须为字符串类型" });
if (!(t2 = t2.trim()))
throw new te({ code: "INVALID_PARAM", message: "cloudPath不可为空" });
if (/:\/\//.test(t2))
throw new te({ code: "INVALID_PARAM", message: "cloudPath不合法" });
const o2 = i2 && i2.envType || this.config.envType;
if (s2 && ("/" !== t2[0] && (t2 = "/" + t2), t2.indexOf("\\") > -1))
throw new te({ code: "INVALID_PARAM", message: "使用cloudPath作为路径时cloudPath不可包含“\\”" });
const a2 = (await this.getOSSUploadOptionsFromPath({ env: o2, filename: s2 ? t2.split("/").pop() : t2, fileId: s2 ? t2 : void 0 })).result, c2 = "https://" + a2.cdnDomain + "/" + a2.ossPath, { securityToken: u2, accessKeyId: h2, signature: l2, host: d2, ossPath: p2, id: g2, policy: m2, ossCallbackUrl: y2 } = a2, _2 = { "Cache-Control": "max-age=2592000", "Content-Disposition": "attachment", OSSAccessKeyId: h2, Signature: l2, host: d2, id: g2, key: p2, policy: m2, success_action_status: 200 };
if (u2 && (_2["x-oss-security-token"] = u2), y2) {
const e3 = JSON.stringify({ callbackUrl: y2, callbackBody: JSON.stringify({ fileId: g2, spaceId: this.config.spaceId }), callbackBodyType: "application/json" });
_2.callback = le.toBase64(e3);
}
const w2 = { url: "https://" + a2.host, formData: _2, fileName: "file", name: "file", filePath: e2, fileType: n2 };
if (await this.uploadFileToOSS(Object.assign({}, w2, { onUploadProgress: r2 })), y2)
return { success: true, filePath: e2, fileID: c2 };
if ((await this.reportOSSUpload({ id: g2 })).success)
return { success: true, filePath: e2, fileID: c2 };
throw new te({ code: "UPLOAD_FAILED", message: "文件上传失败" });
}
getTempFileURL({ fileList: e2 } = {}) {
return new Promise((t2, n2) => {
Array.isArray(e2) && 0 !== e2.length || n2(new te({ code: "INVALID_PARAM", message: "fileList的元素必须是非空的字符串" })), t2({ fileList: e2.map((e3) => ({ fileID: e3, tempFileURL: e3 })) });
});
}
async getFileInfo({ fileList: e2 } = {}) {
if (!Array.isArray(e2) || 0 === e2.length)
throw new te({ code: "INVALID_PARAM", message: "fileList的元素必须是非空的字符串" });
const t2 = { method: "serverless.file.resource.info", params: JSON.stringify({ id: e2.map((e3) => e3.split("?")[0]).join(",") }) };
return { fileList: (await this.request(this.setupRequest(t2))).result };
}
};
var pe = { init(e2) {
const t2 = new de(e2), n2 = { signInAnonymously: function() {
return t2.authorize();
}, getLoginState: function() {
return Promise.resolve(false);
} };
return t2.auth = function() {
return n2;
}, t2.customAuth = t2.auth, t2;
} };
const fe = "undefined" != typeof location && "http:" === location.protocol ? "http:" : "https:";
var ge;
!function(e2) {
e2.local = "local", e2.none = "none", e2.session = "session";
}(ge || (ge = {}));
var me = function() {
}, ye = n(function(e2, t2) {
var n2;
e2.exports = (n2 = r, function(e3) {
var t3 = n2, s2 = t3.lib, r2 = s2.WordArray, i2 = s2.Hasher, o2 = t3.algo, a2 = [], c2 = [];
!function() {
function t4(t5) {
for (var n4 = e3.sqrt(t5), s4 = 2; s4 <= n4; s4++)
if (!(t5 % s4))
return false;
return true;
}
function n3(e4) {
return 4294967296 * (e4 - (0 | e4)) | 0;
}
for (var s3 = 2, r3 = 0; r3 < 64; )
t4(s3) && (r3 < 8 && (a2[r3] = n3(e3.pow(s3, 0.5))), c2[r3] = n3(e3.pow(s3, 1 / 3)), r3++), s3++;
}();
var u2 = [], h2 = o2.SHA256 = i2.extend({ _doReset: function() {
this._hash = new r2.init(a2.slice(0));
}, _doProcessBlock: function(e4, t4) {
for (var n3 = this._hash.words, s3 = n3[0], r3 = n3[1], i3 = n3[2], o3 = n3[3], a3 = n3[4], h3 = n3[5], l2 = n3[6], d2 = n3[7], p2 = 0; p2 < 64; p2++) {
if (p2 < 16)
u2[p2] = 0 | e4[t4 + p2];
else {
var f2 = u2[p2 - 15], g2 = (f2 << 25 | f2 >>> 7) ^ (f2 << 14 | f2 >>> 18) ^ f2 >>> 3, m2 = u2[p2 - 2], y2 = (m2 << 15 | m2 >>> 17) ^ (m2 << 13 | m2 >>> 19) ^ m2 >>> 10;
u2[p2] = g2 + u2[p2 - 7] + y2 + u2[p2 - 16];
}
var _2 = s3 & r3 ^ s3 & i3 ^ r3 & i3, w2 = (s3 << 30 | s3 >>> 2) ^ (s3 << 19 | s3 >>> 13) ^ (s3 << 10 | s3 >>> 22), v2 = d2 + ((a3 << 26 | a3 >>> 6) ^ (a3 << 21 | a3 >>> 11) ^ (a3 << 7 | a3 >>> 25)) + (a3 & h3 ^ ~a3 & l2) + c2[p2] + u2[p2];
d2 = l2, l2 = h3, h3 = a3, a3 = o3 + v2 | 0, o3 = i3, i3 = r3, r3 = s3, s3 = v2 + (w2 + _2) | 0;
}
n3[0] = n3[0] + s3 | 0, n3[1] = n3[1] + r3 | 0, n3[2] = n3[2] + i3 | 0, n3[3] = n3[3] + o3 | 0, n3[4] = n3[4] + a3 | 0, n3[5] = n3[5] + h3 | 0, n3[6] = n3[6] + l2 | 0, n3[7] = n3[7] + d2 | 0;
}, _doFinalize: function() {
var t4 = this._data, n3 = t4.words, s3 = 8 * this._nDataBytes, r3 = 8 * t4.sigBytes;
return n3[r3 >>> 5] |= 128 << 24 - r3 % 32, n3[14 + (r3 + 64 >>> 9 << 4)] = e3.floor(s3 / 4294967296), n3[15 + (r3 + 64 >>> 9 << 4)] = s3, t4.sigBytes = 4 * n3.length, this._process(), this._hash;
}, clone: function() {
var e4 = i2.clone.call(this);
return e4._hash = this._hash.clone(), e4;
} });
t3.SHA256 = i2._createHelper(h2), t3.HmacSHA256 = i2._createHmacHelper(h2);
}(Math), n2.SHA256);
}), _e = ye, we = n(function(e2, t2) {
e2.exports = r.HmacSHA256;
});
const ve = () => {
let e2;
if (!Promise) {
e2 = () => {
}, e2.promise = {};
const t3 = () => {
throw new te({ message: 'Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.' });
2024-09-24 09:21:34 +00:00
};
2024-10-14 07:22:41 +00:00
return Object.defineProperty(e2.promise, "then", { get: t3 }), Object.defineProperty(e2.promise, "catch", { get: t3 }), e2;
}
const t2 = new Promise((t3, n2) => {
e2 = (e3, s2) => e3 ? n2(e3) : t3(s2);
});
return e2.promise = t2, e2;
};
function Ie(e2) {
return void 0 === e2;
}
function Se(e2) {
return "[object Null]" === Object.prototype.toString.call(e2);
}
var be;
function ke(e2) {
const t2 = (n2 = e2, "[object Array]" === Object.prototype.toString.call(n2) ? e2 : [e2]);
var n2;
for (const e3 of t2) {
const { isMatch: t3, genAdapter: n3, runtime: s2 } = e3;
if (t3())
return { adapter: n3(), runtime: s2 };
}
}
!function(e2) {
e2.WEB = "web", e2.WX_MP = "wx_mp";
}(be || (be = {}));
const Ae = { adapter: null, runtime: void 0 }, Pe = ["anonymousUuidKey"];
class Te extends me {
constructor() {
super(), Ae.adapter.root.tcbObject || (Ae.adapter.root.tcbObject = {});
}
setItem(e2, t2) {
Ae.adapter.root.tcbObject[e2] = t2;
}
getItem(e2) {
return Ae.adapter.root.tcbObject[e2];
}
removeItem(e2) {
delete Ae.adapter.root.tcbObject[e2];
}
clear() {
delete Ae.adapter.root.tcbObject;
}
}
function Ce(e2, t2) {
switch (e2) {
case "local":
return t2.localStorage || new Te();
case "none":
return new Te();
default:
return t2.sessionStorage || new Te();
}
}
class xe {
constructor(e2) {
if (!this._storage) {
this._persistence = Ae.adapter.primaryStorage || e2.persistence, this._storage = Ce(this._persistence, Ae.adapter);
const t2 = `access_token_${e2.env}`, n2 = `access_token_expire_${e2.env}`, s2 = `refresh_token_${e2.env}`, r2 = `anonymous_uuid_${e2.env}`, i2 = `login_type_${e2.env}`, o2 = `user_info_${e2.env}`;
this.keys = { accessTokenKey: t2, accessTokenExpireKey: n2, refreshTokenKey: s2, anonymousUuidKey: r2, loginTypeKey: i2, userInfoKey: o2 };
}
}
updatePersistence(e2) {
if (e2 === this._persistence)
return;
const t2 = "local" === this._persistence;
this._persistence = e2;
const n2 = Ce(e2, Ae.adapter);
for (const e3 in this.keys) {
const s2 = this.keys[e3];
if (t2 && Pe.includes(e3))
continue;
const r2 = this._storage.getItem(s2);
Ie(r2) || Se(r2) || (n2.setItem(s2, r2), this._storage.removeItem(s2));
}
this._storage = n2;
}
setStore(e2, t2, n2) {
if (!this._storage)
return;
const s2 = { version: n2 || "localCachev1", content: t2 }, r2 = JSON.stringify(s2);
try {
this._storage.setItem(e2, r2);
} catch (e3) {
throw e3;
}
}
getStore(e2, t2) {
try {
if (!this._storage)
return;
} catch (e3) {
return "";
}
t2 = t2 || "localCachev1";
const n2 = this._storage.getItem(e2);
if (!n2)
return "";
if (n2.indexOf(t2) >= 0) {
return JSON.parse(n2).content;
}
return "";
}
removeStore(e2) {
this._storage.removeItem(e2);
}
}
const Oe = {}, Ee = {};
function Le(e2) {
return Oe[e2];
}
class Re {
constructor(e2, t2) {
this.data = t2 || null, this.name = e2;
}
}
class Ue extends Re {
constructor(e2, t2) {
super("error", { error: e2, data: t2 }), this.error = e2;
}
}
const Ne = new class {
constructor() {
this._listeners = {};
}
on(e2, t2) {
return function(e3, t3, n2) {
n2[e3] = n2[e3] || [], n2[e3].push(t3);
}(e2, t2, this._listeners), this;
}
off(e2, t2) {
return function(e3, t3, n2) {
if (n2 && n2[e3]) {
const s2 = n2[e3].indexOf(t3);
-1 !== s2 && n2[e3].splice(s2, 1);
}
}(e2, t2, this._listeners), this;
}
fire(e2, t2) {
if (e2 instanceof Ue)
return console.error(e2.error), this;
const n2 = "string" == typeof e2 ? new Re(e2, t2 || {}) : e2;
const s2 = n2.name;
if (this._listens(s2)) {
n2.target = this;
const e3 = this._listeners[s2] ? [...this._listeners[s2]] : [];
for (const t3 of e3)
t3.call(this, n2);
}
return this;
}
_listens(e2) {
return this._listeners[e2] && this._listeners[e2].length > 0;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
}();
function De(e2, t2) {
Ne.on(e2, t2);
}
function Me(e2, t2 = {}) {
Ne.fire(e2, t2);
}
function qe(e2, t2) {
Ne.off(e2, t2);
}
const Fe = "loginStateChanged", Ke = "loginStateExpire", je = "loginTypeChanged", $e = "anonymousConverted", Be = "refreshAccessToken";
var We;
!function(e2) {
e2.ANONYMOUS = "ANONYMOUS", e2.WECHAT = "WECHAT", e2.WECHAT_PUBLIC = "WECHAT-PUBLIC", e2.WECHAT_OPEN = "WECHAT-OPEN", e2.CUSTOM = "CUSTOM", e2.EMAIL = "EMAIL", e2.USERNAME = "USERNAME", e2.NULL = "NULL";
}(We || (We = {}));
const He = ["auth.getJwt", "auth.logout", "auth.signInWithTicket", "auth.signInAnonymously", "auth.signIn", "auth.fetchAccessTokenWithRefreshToken", "auth.signUpWithEmailAndPassword", "auth.activateEndUserMail", "auth.sendPasswordResetEmail", "auth.resetPasswordWithToken", "auth.isUsernameRegistered"], ze = { "X-SDK-Version": "1.3.5" };
function Je(e2, t2, n2) {
const s2 = e2[t2];
e2[t2] = function(t3) {
const r2 = {}, i2 = {};
n2.forEach((n3) => {
const { data: s3, headers: o3 } = n3.call(e2, t3);
Object.assign(r2, s3), Object.assign(i2, o3);
});
const o2 = t3.data;
return o2 && (() => {
var e3;
if (e3 = o2, "[object FormData]" !== Object.prototype.toString.call(e3))
t3.data = { ...o2, ...r2 };
else
for (const e4 in r2)
o2.append(e4, r2[e4]);
})(), t3.headers = { ...t3.headers || {}, ...i2 }, s2.call(e2, t3);
};
}
function Ge() {
const e2 = Math.random().toString(16).slice(2);
return { data: { seqId: e2 }, headers: { ...ze, "x-seqid": e2 } };
}
class Ve {
constructor(e2 = {}) {
var t2;
this.config = e2, this._reqClass = new Ae.adapter.reqClass({ timeout: this.config.timeout, timeoutMsg: `请求在${this.config.timeout / 1e3}s内未完成已中断`, restrictedMethods: ["post"] }), this._cache = Le(this.config.env), this._localCache = (t2 = this.config.env, Ee[t2]), Je(this._reqClass, "post", [Ge]), Je(this._reqClass, "upload", [Ge]), Je(this._reqClass, "download", [Ge]);
}
async post(e2) {
return await this._reqClass.post(e2);
}
async upload(e2) {
return await this._reqClass.upload(e2);
}
async download(e2) {
return await this._reqClass.download(e2);
}
async refreshAccessToken() {
let e2, t2;
this._refreshAccessTokenPromise || (this._refreshAccessTokenPromise = this._refreshAccessToken());
try {
e2 = await this._refreshAccessTokenPromise;
} catch (e3) {
t2 = e3;
}
if (this._refreshAccessTokenPromise = null, this._shouldRefreshAccessTokenHook = null, t2)
throw t2;
return e2;
}
async _refreshAccessToken() {
const { accessTokenKey: e2, accessTokenExpireKey: t2, refreshTokenKey: n2, loginTypeKey: s2, anonymousUuidKey: r2 } = this._cache.keys;
this._cache.removeStore(e2), this._cache.removeStore(t2);
let i2 = this._cache.getStore(n2);
if (!i2)
throw new te({ message: "未登录CloudBase" });
const o2 = { refresh_token: i2 }, a2 = await this.request("auth.fetchAccessTokenWithRefreshToken", o2);
if (a2.data.code) {
const { code: e3 } = a2.data;
if ("SIGN_PARAM_INVALID" === e3 || "REFRESH_TOKEN_EXPIRED" === e3 || "INVALID_REFRESH_TOKEN" === e3) {
if (this._cache.getStore(s2) === We.ANONYMOUS && "INVALID_REFRESH_TOKEN" === e3) {
const e4 = this._cache.getStore(r2), t3 = this._cache.getStore(n2), s3 = await this.send("auth.signInAnonymously", { anonymous_uuid: e4, refresh_token: t3 });
return this.setRefreshToken(s3.refresh_token), this._refreshAccessToken();
}
Me(Ke), this._cache.removeStore(n2);
}
throw new te({ code: a2.data.code, message: `刷新access token失败${a2.data.code}` });
}
if (a2.data.access_token)
return Me(Be), this._cache.setStore(e2, a2.data.access_token), this._cache.setStore(t2, a2.data.access_token_expire + Date.now()), { accessToken: a2.data.access_token, accessTokenExpire: a2.data.access_token_expire };
a2.data.refresh_token && (this._cache.removeStore(n2), this._cache.setStore(n2, a2.data.refresh_token), this._refreshAccessToken());
}
async getAccessToken() {
const { accessTokenKey: e2, accessTokenExpireKey: t2, refreshTokenKey: n2 } = this._cache.keys;
if (!this._cache.getStore(n2))
throw new te({ message: "refresh token不存在登录状态异常" });
let s2 = this._cache.getStore(e2), r2 = this._cache.getStore(t2), i2 = true;
return this._shouldRefreshAccessTokenHook && !await this._shouldRefreshAccessTokenHook(s2, r2) && (i2 = false), (!s2 || !r2 || r2 < Date.now()) && i2 ? this.refreshAccessToken() : { accessToken: s2, accessTokenExpire: r2 };
}
async request(e2, t2, n2) {
const s2 = `x-tcb-trace_${this.config.env}`;
let r2 = "application/x-www-form-urlencoded";
const i2 = { action: e2, env: this.config.env, dataVersion: "2019-08-16", ...t2 };
if (-1 === He.indexOf(e2)) {
const { refreshTokenKey: e3 } = this._cache.keys;
this._cache.getStore(e3) && (i2.access_token = (await this.getAccessToken()).accessToken);
}
let o2;
if ("storage.uploadFile" === e2) {
o2 = new FormData();
for (let e3 in o2)
o2.hasOwnProperty(e3) && void 0 !== o2[e3] && o2.append(e3, i2[e3]);
r2 = "multipart/form-data";
} else {
r2 = "application/json", o2 = {};
for (let e3 in i2)
void 0 !== i2[e3] && (o2[e3] = i2[e3]);
}
let a2 = { headers: { "content-type": r2 } };
n2 && n2.onUploadProgress && (a2.onUploadProgress = n2.onUploadProgress);
const c2 = this._localCache.getStore(s2);
c2 && (a2.headers["X-TCB-Trace"] = c2);
const { parse: u2, inQuery: h2, search: l2 } = t2;
let d2 = { env: this.config.env };
u2 && (d2.parse = true), h2 && (d2 = { ...h2, ...d2 });
let p2 = function(e3, t3, n3 = {}) {
const s3 = /\?/.test(t3);
let r3 = "";
for (let e4 in n3)
"" === r3 ? !s3 && (t3 += "?") : r3 += "&", r3 += `${e4}=${encodeURIComponent(n3[e4])}`;
return /^http(s)?\:\/\//.test(t3 += r3) ? t3 : `${e3}${t3}`;
}(fe, "//tcb-api.tencentcloudapi.com/web", d2);
l2 && (p2 += l2);
const f2 = await this.post({ url: p2, data: o2, ...a2 }), g2 = f2.header && f2.header["x-tcb-trace"];
if (g2 && this._localCache.setStore(s2, g2), 200 !== Number(f2.status) && 200 !== Number(f2.statusCode) || !f2.data)
throw new te({ code: "NETWORK_ERROR", message: "network request error" });
return f2;
}
async send(e2, t2 = {}) {
const n2 = await this.request(e2, t2, { onUploadProgress: t2.onUploadProgress });
if ("ACCESS_TOKEN_EXPIRED" === n2.data.code && -1 === He.indexOf(e2)) {
await this.refreshAccessToken();
const n3 = await this.request(e2, t2, { onUploadProgress: t2.onUploadProgress });
if (n3.data.code)
throw new te({ code: n3.data.code, message: n3.data.message });
return n3.data;
}
if (n2.data.code)
throw new te({ code: n2.data.code, message: n2.data.message });
return n2.data;
}
setRefreshToken(e2) {
const { accessTokenKey: t2, accessTokenExpireKey: n2, refreshTokenKey: s2 } = this._cache.keys;
this._cache.removeStore(t2), this._cache.removeStore(n2), this._cache.setStore(s2, e2);
}
}
const Ye = {};
function Qe(e2) {
return Ye[e2];
}
class Xe {
constructor(e2) {
this.config = e2, this._cache = Le(e2.env), this._request = Qe(e2.env);
}
setRefreshToken(e2) {
const { accessTokenKey: t2, accessTokenExpireKey: n2, refreshTokenKey: s2 } = this._cache.keys;
this._cache.removeStore(t2), this._cache.removeStore(n2), this._cache.setStore(s2, e2);
}
setAccessToken(e2, t2) {
const { accessTokenKey: n2, accessTokenExpireKey: s2 } = this._cache.keys;
this._cache.setStore(n2, e2), this._cache.setStore(s2, t2);
}
async refreshUserInfo() {
const { data: e2 } = await this._request.send("auth.getUserInfo", {});
return this.setLocalUserInfo(e2), e2;
}
setLocalUserInfo(e2) {
const { userInfoKey: t2 } = this._cache.keys;
this._cache.setStore(t2, e2);
}
}
class Ze {
constructor(e2) {
if (!e2)
throw new te({ code: "PARAM_ERROR", message: "envId is not defined" });
this._envId = e2, this._cache = Le(this._envId), this._request = Qe(this._envId), this.setUserInfo();
}
linkWithTicket(e2) {
if ("string" != typeof e2)
throw new te({ code: "PARAM_ERROR", message: "ticket must be string" });
return this._request.send("auth.linkWithTicket", { ticket: e2 });
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
linkWithRedirect(e2) {
e2.signInWithRedirect();
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
updatePassword(e2, t2) {
return this._request.send("auth.updatePassword", { oldPassword: t2, newPassword: e2 });
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
updateEmail(e2) {
return this._request.send("auth.updateEmail", { newEmail: e2 });
}
updateUsername(e2) {
if ("string" != typeof e2)
throw new te({ code: "PARAM_ERROR", message: "username must be a string" });
return this._request.send("auth.updateUsername", { username: e2 });
}
async getLinkedUidList() {
const { data: e2 } = await this._request.send("auth.getLinkedUidList", {});
let t2 = false;
const { users: n2 } = e2;
return n2.forEach((e3) => {
e3.wxOpenId && e3.wxPublicId && (t2 = true);
}), { users: n2, hasPrimaryUid: t2 };
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
setPrimaryUid(e2) {
return this._request.send("auth.setPrimaryUid", { uid: e2 });
}
unlink(e2) {
return this._request.send("auth.unlink", { platform: e2 });
}
async update(e2) {
const { nickName: t2, gender: n2, avatarUrl: s2, province: r2, country: i2, city: o2 } = e2, { data: a2 } = await this._request.send("auth.updateUserInfo", { nickName: t2, gender: n2, avatarUrl: s2, province: r2, country: i2, city: o2 });
this.setLocalUserInfo(a2);
}
async refresh() {
const { data: e2 } = await this._request.send("auth.getUserInfo", {});
return this.setLocalUserInfo(e2), e2;
}
setUserInfo() {
const { userInfoKey: e2 } = this._cache.keys, t2 = this._cache.getStore(e2);
["uid", "loginType", "openid", "wxOpenId", "wxPublicId", "unionId", "qqMiniOpenId", "email", "hasPassword", "customUserId", "nickName", "gender", "avatarUrl"].forEach((e3) => {
this[e3] = t2[e3];
}), this.location = { country: t2.country, province: t2.province, city: t2.city };
}
setLocalUserInfo(e2) {
const { userInfoKey: t2 } = this._cache.keys;
this._cache.setStore(t2, e2), this.setUserInfo();
}
}
class et {
constructor(e2) {
if (!e2)
throw new te({ code: "PARAM_ERROR", message: "envId is not defined" });
this._cache = Le(e2);
const { refreshTokenKey: t2, accessTokenKey: n2, accessTokenExpireKey: s2 } = this._cache.keys, r2 = this._cache.getStore(t2), i2 = this._cache.getStore(n2), o2 = this._cache.getStore(s2);
this.credential = { refreshToken: r2, accessToken: i2, accessTokenExpire: o2 }, this.user = new Ze(e2);
}
get isAnonymousAuth() {
return this.loginType === We.ANONYMOUS;
}
get isCustomAuth() {
return this.loginType === We.CUSTOM;
}
get isWeixinAuth() {
return this.loginType === We.WECHAT || this.loginType === We.WECHAT_OPEN || this.loginType === We.WECHAT_PUBLIC;
}
get loginType() {
return this._cache.getStore(this._cache.keys.loginTypeKey);
}
}
class tt extends Xe {
async signIn() {
this._cache.updatePersistence("local");
const { anonymousUuidKey: e2, refreshTokenKey: t2 } = this._cache.keys, n2 = this._cache.getStore(e2) || void 0, s2 = this._cache.getStore(t2) || void 0, r2 = await this._request.send("auth.signInAnonymously", { anonymous_uuid: n2, refresh_token: s2 });
if (r2.uuid && r2.refresh_token) {
this._setAnonymousUUID(r2.uuid), this.setRefreshToken(r2.refresh_token), await this._request.refreshAccessToken(), Me(Fe), Me(je, { env: this.config.env, loginType: We.ANONYMOUS, persistence: "local" });
const e3 = new et(this.config.env);
return await e3.user.refresh(), e3;
}
throw new te({ message: "匿名登录失败" });
}
async linkAndRetrieveDataWithTicket(e2) {
const { anonymousUuidKey: t2, refreshTokenKey: n2 } = this._cache.keys, s2 = this._cache.getStore(t2), r2 = this._cache.getStore(n2), i2 = await this._request.send("auth.linkAndRetrieveDataWithTicket", { anonymous_uuid: s2, refresh_token: r2, ticket: e2 });
if (i2.refresh_token)
return this._clearAnonymousUUID(), this.setRefreshToken(i2.refresh_token), await this._request.refreshAccessToken(), Me($e, { env: this.config.env }), Me(je, { loginType: We.CUSTOM, persistence: "local" }), { credential: { refreshToken: i2.refresh_token } };
throw new te({ message: "匿名转化失败" });
}
_setAnonymousUUID(e2) {
const { anonymousUuidKey: t2, loginTypeKey: n2 } = this._cache.keys;
this._cache.removeStore(t2), this._cache.setStore(t2, e2), this._cache.setStore(n2, We.ANONYMOUS);
}
_clearAnonymousUUID() {
this._cache.removeStore(this._cache.keys.anonymousUuidKey);
}
}
class nt extends Xe {
async signIn(e2) {
if ("string" != typeof e2)
throw new te({ code: "PARAM_ERROR", message: "ticket must be a string" });
const { refreshTokenKey: t2 } = this._cache.keys, n2 = await this._request.send("auth.signInWithTicket", { ticket: e2, refresh_token: this._cache.getStore(t2) || "" });
if (n2.refresh_token)
return this.setRefreshToken(n2.refresh_token), await this._request.refreshAccessToken(), Me(Fe), Me(je, { env: this.config.env, loginType: We.CUSTOM, persistence: this.config.persistence }), await this.refreshUserInfo(), new et(this.config.env);
throw new te({ message: "自定义登录失败" });
}
}
class st extends Xe {
async signIn(e2, t2) {
if ("string" != typeof e2)
throw new te({ code: "PARAM_ERROR", message: "email must be a string" });
const { refreshTokenKey: n2 } = this._cache.keys, s2 = await this._request.send("auth.signIn", { loginType: "EMAIL", email: e2, password: t2, refresh_token: this._cache.getStore(n2) || "" }), { refresh_token: r2, access_token: i2, access_token_expire: o2 } = s2;
if (r2)
return this.setRefreshToken(r2), i2 && o2 ? this.setAccessToken(i2, o2) : await this._request.refreshAccessToken(), await this.refreshUserInfo(), Me(Fe), Me(je, { env: this.config.env, loginType: We.EMAIL, persistence: this.config.persistence }), new et(this.config.env);
throw s2.code ? new te({ code: s2.code, message: `邮箱登录失败: ${s2.message}` }) : new te({ message: "邮箱登录失败" });
}
async activate(e2) {
return this._request.send("auth.activateEndUserMail", { token: e2 });
}
async resetPasswordWithToken(e2, t2) {
return this._request.send("auth.resetPasswordWithToken", { token: e2, newPassword: t2 });
}
}
class rt extends Xe {
async signIn(e2, t2) {
if ("string" != typeof e2)
throw new te({ code: "PARAM_ERROR", message: "username must be a string" });
"string" != typeof t2 && (t2 = "", console.warn("password is empty"));
const { refreshTokenKey: n2 } = this._cache.keys, s2 = await this._request.send("auth.signIn", { loginType: We.USERNAME, username: e2, password: t2, refresh_token: this._cache.getStore(n2) || "" }), { refresh_token: r2, access_token_expire: i2, access_token: o2 } = s2;
if (r2)
return this.setRefreshToken(r2), o2 && i2 ? this.setAccessToken(o2, i2) : await this._request.refreshAccessToken(), await this.refreshUserInfo(), Me(Fe), Me(je, { env: this.config.env, loginType: We.USERNAME, persistence: this.config.persistence }), new et(this.config.env);
throw s2.code ? new te({ code: s2.code, message: `用户名密码登录失败: ${s2.message}` }) : new te({ message: "用户名密码登录失败" });
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
}
class it {
constructor(e2) {
this.config = e2, this._cache = Le(e2.env), this._request = Qe(e2.env), this._onAnonymousConverted = this._onAnonymousConverted.bind(this), this._onLoginTypeChanged = this._onLoginTypeChanged.bind(this), De(je, this._onLoginTypeChanged);
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
get currentUser() {
const e2 = this.hasLoginState();
return e2 && e2.user || null;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
get loginType() {
return this._cache.getStore(this._cache.keys.loginTypeKey);
}
anonymousAuthProvider() {
return new tt(this.config);
}
customAuthProvider() {
return new nt(this.config);
}
emailAuthProvider() {
return new st(this.config);
}
usernameAuthProvider() {
return new rt(this.config);
}
async signInAnonymously() {
return new tt(this.config).signIn();
}
async signInWithEmailAndPassword(e2, t2) {
return new st(this.config).signIn(e2, t2);
}
signInWithUsernameAndPassword(e2, t2) {
return new rt(this.config).signIn(e2, t2);
}
async linkAndRetrieveDataWithTicket(e2) {
this._anonymousAuthProvider || (this._anonymousAuthProvider = new tt(this.config)), De($e, this._onAnonymousConverted);
return await this._anonymousAuthProvider.linkAndRetrieveDataWithTicket(e2);
}
async signOut() {
if (this.loginType === We.ANONYMOUS)
throw new te({ message: "匿名用户不支持登出操作" });
const { refreshTokenKey: e2, accessTokenKey: t2, accessTokenExpireKey: n2 } = this._cache.keys, s2 = this._cache.getStore(e2);
if (!s2)
return;
const r2 = await this._request.send("auth.logout", { refresh_token: s2 });
return this._cache.removeStore(e2), this._cache.removeStore(t2), this._cache.removeStore(n2), Me(Fe), Me(je, { env: this.config.env, loginType: We.NULL, persistence: this.config.persistence }), r2;
}
async signUpWithEmailAndPassword(e2, t2) {
return this._request.send("auth.signUpWithEmailAndPassword", { email: e2, password: t2 });
}
async sendPasswordResetEmail(e2) {
return this._request.send("auth.sendPasswordResetEmail", { email: e2 });
}
onLoginStateChanged(e2) {
De(Fe, () => {
const t3 = this.hasLoginState();
e2.call(this, t3);
});
const t2 = this.hasLoginState();
e2.call(this, t2);
}
onLoginStateExpired(e2) {
De(Ke, e2.bind(this));
}
onAccessTokenRefreshed(e2) {
De(Be, e2.bind(this));
}
onAnonymousConverted(e2) {
De($e, e2.bind(this));
}
onLoginTypeChanged(e2) {
De(je, () => {
const t2 = this.hasLoginState();
e2.call(this, t2);
});
}
async getAccessToken() {
return { accessToken: (await this._request.getAccessToken()).accessToken, env: this.config.env };
}
hasLoginState() {
const { refreshTokenKey: e2 } = this._cache.keys;
return this._cache.getStore(e2) ? new et(this.config.env) : null;
}
async isUsernameRegistered(e2) {
if ("string" != typeof e2)
throw new te({ code: "PARAM_ERROR", message: "username must be a string" });
const { data: t2 } = await this._request.send("auth.isUsernameRegistered", { username: e2 });
return t2 && t2.isRegistered;
}
getLoginState() {
return Promise.resolve(this.hasLoginState());
}
async signInWithTicket(e2) {
return new nt(this.config).signIn(e2);
}
shouldRefreshAccessToken(e2) {
this._request._shouldRefreshAccessTokenHook = e2.bind(this);
}
getUserInfo() {
return this._request.send("auth.getUserInfo", {}).then((e2) => e2.code ? e2 : { ...e2.data, requestId: e2.seqId });
}
getAuthHeader() {
const { refreshTokenKey: e2, accessTokenKey: t2 } = this._cache.keys, n2 = this._cache.getStore(e2);
return { "x-cloudbase-credentials": this._cache.getStore(t2) + "/@@/" + n2 };
}
_onAnonymousConverted(e2) {
const { env: t2 } = e2.data;
t2 === this.config.env && this._cache.updatePersistence(this.config.persistence);
}
_onLoginTypeChanged(e2) {
const { loginType: t2, persistence: n2, env: s2 } = e2.data;
s2 === this.config.env && (this._cache.updatePersistence(n2), this._cache.setStore(this._cache.keys.loginTypeKey, t2));
}
}
const ot = function(e2, t2) {
t2 = t2 || ve();
const n2 = Qe(this.config.env), { cloudPath: s2, filePath: r2, onUploadProgress: i2, fileType: o2 = "image" } = e2;
return n2.send("storage.getUploadMetadata", { path: s2 }).then((e3) => {
const { data: { url: a2, authorization: c2, token: u2, fileId: h2, cosFileId: l2 }, requestId: d2 } = e3, p2 = { key: s2, signature: c2, "x-cos-meta-fileid": l2, success_action_status: "201", "x-cos-security-token": u2 };
n2.upload({ url: a2, data: p2, file: r2, name: s2, fileType: o2, onUploadProgress: i2 }).then((e4) => {
201 === e4.statusCode ? t2(null, { fileID: h2, requestId: d2 }) : t2(new te({ code: "STORAGE_REQUEST_FAIL", message: `STORAGE_REQUEST_FAIL: ${e4.data}` }));
}).catch((e4) => {
t2(e4);
});
}).catch((e3) => {
t2(e3);
}), t2.promise;
}, at = function(e2, t2) {
t2 = t2 || ve();
const n2 = Qe(this.config.env), { cloudPath: s2 } = e2;
return n2.send("storage.getUploadMetadata", { path: s2 }).then((e3) => {
t2(null, e3);
}).catch((e3) => {
t2(e3);
}), t2.promise;
}, ct = function({ fileList: e2 }, t2) {
if (t2 = t2 || ve(), !e2 || !Array.isArray(e2))
return { code: "INVALID_PARAM", message: "fileList必须是非空的数组" };
for (let t3 of e2)
if (!t3 || "string" != typeof t3)
return { code: "INVALID_PARAM", message: "fileList的元素必须是非空的字符串" };
const n2 = { fileid_list: e2 };
return Qe(this.config.env).send("storage.batchDeleteFile", n2).then((e3) => {
e3.code ? t2(null, e3) : t2(null, { fileList: e3.data.delete_list, requestId: e3.requestId });
}).catch((e3) => {
t2(e3);
}), t2.promise;
}, ut = function({ fileList: e2 }, t2) {
t2 = t2 || ve(), e2 && Array.isArray(e2) || t2(null, { code: "INVALID_PARAM", message: "fileList必须是非空的数组" });
let n2 = [];
for (let s3 of e2)
"object" == typeof s3 ? (s3.hasOwnProperty("fileID") && s3.hasOwnProperty("maxAge") || t2(null, { code: "INVALID_PARAM", message: "fileList的元素必须是包含fileID和maxAge的对象" }), n2.push({ fileid: s3.fileID, max_age: s3.maxAge })) : "string" == typeof s3 ? n2.push({ fileid: s3 }) : t2(null, { code: "INVALID_PARAM", message: "fileList的元素必须是字符串" });
const s2 = { file_list: n2 };
return Qe(this.config.env).send("storage.batchGetDownloadUrl", s2).then((e3) => {
e3.code ? t2(null, e3) : t2(null, { fileList: e3.data.download_list, requestId: e3.requestId });
}).catch((e3) => {
t2(e3);
}), t2.promise;
}, ht = async function({ fileID: e2 }, t2) {
const n2 = (await ut.call(this, { fileList: [{ fileID: e2, maxAge: 600 }] })).fileList[0];
if ("SUCCESS" !== n2.code)
return t2 ? t2(n2) : new Promise((e3) => {
e3(n2);
2024-09-24 09:21:34 +00:00
});
2024-10-14 07:22:41 +00:00
const s2 = Qe(this.config.env);
let r2 = n2.download_url;
if (r2 = encodeURI(r2), !t2)
return s2.download({ url: r2 });
t2(await s2.download({ url: r2 }));
}, lt = function({ name: e2, data: t2, query: n2, parse: s2, search: r2 }, i2) {
const o2 = i2 || ve();
let a2;
try {
a2 = t2 ? JSON.stringify(t2) : "";
} catch (e3) {
return Promise.reject(e3);
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
if (!e2)
return Promise.reject(new te({ code: "PARAM_ERROR", message: "函数名不能为空" }));
const c2 = { inQuery: n2, parse: s2, search: r2, function_name: e2, request_data: a2 };
return Qe(this.config.env).send("functions.invokeFunction", c2).then((e3) => {
if (e3.code)
o2(null, e3);
else {
let t3 = e3.data.response_data;
if (s2)
o2(null, { result: t3, requestId: e3.requestId });
else
try {
t3 = JSON.parse(e3.data.response_data), o2(null, { result: t3, requestId: e3.requestId });
} catch (e4) {
o2(new te({ message: "response data must be json" }));
}
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
return o2.promise;
}).catch((e3) => {
o2(e3);
}), o2.promise;
}, dt = { timeout: 15e3, persistence: "session" }, pt = {};
class ft {
constructor(e2) {
this.config = e2 || this.config, this.authObj = void 0;
}
init(e2) {
switch (Ae.adapter || (this.requestClient = new Ae.adapter.reqClass({ timeout: e2.timeout || 5e3, timeoutMsg: `请求在${(e2.timeout || 5e3) / 1e3}s内未完成已中断` })), this.config = { ...dt, ...e2 }, true) {
case this.config.timeout > 6e5:
console.warn("timeout大于可配置上限[10分钟],已重置为上限数值"), this.config.timeout = 6e5;
break;
case this.config.timeout < 100:
console.warn("timeout小于可配置下限[100ms],已重置为下限数值"), this.config.timeout = 100;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
return new ft(this.config);
}
auth({ persistence: e2 } = {}) {
if (this.authObj)
return this.authObj;
const t2 = e2 || Ae.adapter.primaryStorage || dt.persistence;
var n2;
return t2 !== this.config.persistence && (this.config.persistence = t2), function(e3) {
const { env: t3 } = e3;
Oe[t3] = new xe(e3), Ee[t3] = new xe({ ...e3, persistence: "local" });
}(this.config), n2 = this.config, Ye[n2.env] = new Ve(n2), this.authObj = new it(this.config), this.authObj;
}
on(e2, t2) {
return De.apply(this, [e2, t2]);
}
off(e2, t2) {
return qe.apply(this, [e2, t2]);
}
callFunction(e2, t2) {
return lt.apply(this, [e2, t2]);
}
deleteFile(e2, t2) {
return ct.apply(this, [e2, t2]);
}
getTempFileURL(e2, t2) {
return ut.apply(this, [e2, t2]);
}
downloadFile(e2, t2) {
return ht.apply(this, [e2, t2]);
}
uploadFile(e2, t2) {
return ot.apply(this, [e2, t2]);
}
getUploadMetadata(e2, t2) {
return at.apply(this, [e2, t2]);
}
registerExtension(e2) {
pt[e2.name] = e2;
}
async invokeExtension(e2, t2) {
const n2 = pt[e2];
if (!n2)
throw new te({ message: `扩展${e2} 必须先注册` });
return await n2.invoke(t2, this);
}
useAdapters(e2) {
const { adapter: t2, runtime: n2 } = ke(e2) || {};
t2 && (Ae.adapter = t2), n2 && (Ae.runtime = n2);
}
}
var gt = new ft();
function mt(e2, t2, n2) {
void 0 === n2 && (n2 = {});
var s2 = /\?/.test(t2), r2 = "";
for (var i2 in n2)
"" === r2 ? !s2 && (t2 += "?") : r2 += "&", r2 += i2 + "=" + encodeURIComponent(n2[i2]);
return /^http(s)?:\/\//.test(t2 += r2) ? t2 : "" + e2 + t2;
}
class yt {
post(e2) {
const { url: t2, data: n2, headers: s2 } = e2;
return new Promise((e3, r2) => {
ne.request({ url: mt("https:", t2), data: n2, method: "POST", header: s2, success(t3) {
e3(t3);
}, fail(e4) {
r2(e4);
} });
});
}
upload(e2) {
return new Promise((t2, n2) => {
const { url: s2, file: r2, data: i2, headers: o2, fileType: a2 } = e2, c2 = ne.uploadFile({ url: mt("https:", s2), name: "file", formData: Object.assign({}, i2), filePath: r2, fileType: a2, header: o2, success(e3) {
const n3 = { statusCode: e3.statusCode, data: e3.data || {} };
200 === e3.statusCode && i2.success_action_status && (n3.statusCode = parseInt(i2.success_action_status, 10)), t2(n3);
}, fail(e3) {
n2(new Error(e3.errMsg || "uploadFile:fail"));
} });
"function" == typeof e2.onUploadProgress && c2 && "function" == typeof c2.onProgressUpdate && c2.onProgressUpdate((t3) => {
e2.onUploadProgress({ loaded: t3.totalBytesSent, total: t3.totalBytesExpectedToSend });
});
2024-09-24 09:21:34 +00:00
});
2024-10-14 07:22:41 +00:00
}
}
const _t = { setItem(e2, t2) {
ne.setStorageSync(e2, t2);
}, getItem: (e2) => ne.getStorageSync(e2), removeItem(e2) {
ne.removeStorageSync(e2);
}, clear() {
ne.clearStorageSync();
} };
var wt = { genAdapter: function() {
return { root: {}, reqClass: yt, localStorage: _t, primaryStorage: "local" };
}, isMatch: function() {
return true;
}, runtime: "uni_app" };
gt.useAdapters(wt);
const vt = gt, It = vt.init;
vt.init = function(e2) {
e2.env = e2.spaceId;
const t2 = It.call(this, e2);
t2.config.provider = "tencent", t2.config.spaceId = e2.spaceId;
const n2 = t2.auth;
return t2.auth = function(e3) {
const t3 = n2.call(this, e3);
return ["linkAndRetrieveDataWithTicket", "signInAnonymously", "signOut", "getAccessToken", "getLoginState", "signInWithTicket", "getUserInfo"].forEach((e4) => {
var n3;
t3[e4] = (n3 = t3[e4], function(e5) {
e5 = e5 || {};
const { success: t4, fail: s2, complete: r2 } = ee(e5);
if (!(t4 || s2 || r2))
return n3.call(this, e5);
n3.call(this, e5).then((e6) => {
t4 && t4(e6), r2 && r2(e6);
}, (e6) => {
s2 && s2(e6), r2 && r2(e6);
});
}).bind(t3);
}), t3;
}, t2.customAuth = t2.auth, t2;
};
var St = vt;
var bt = class extends de {
getAccessToken() {
return new Promise((e2, t2) => {
const n2 = "Anonymous_Access_token";
this.setAccessToken(n2), e2(n2);
2024-09-24 09:21:34 +00:00
});
2024-10-14 07:22:41 +00:00
}
setupRequest(e2, t2) {
const n2 = Object.assign({}, e2, { spaceId: this.config.spaceId, timestamp: Date.now() }), s2 = { "Content-Type": "application/json" };
"auth" !== t2 && (n2.token = this.accessToken, s2["x-basement-token"] = this.accessToken), s2["x-serverless-sign"] = le.sign(n2, this.config.clientSecret);
const r2 = he();
s2["x-client-info"] = encodeURIComponent(JSON.stringify(r2));
const { token: i2 } = re();
return s2["x-client-token"] = i2, { url: this.config.requestUrl, method: "POST", data: n2, dataType: "json", header: JSON.parse(JSON.stringify(s2)) };
}
uploadFileToOSS({ url: e2, formData: t2, name: n2, filePath: s2, fileType: r2, onUploadProgress: i2 }) {
return new Promise((o2, a2) => {
const c2 = this.adapter.uploadFile({ url: e2, formData: t2, name: n2, filePath: s2, fileType: r2, success(e3) {
e3 && e3.statusCode < 400 ? o2(e3) : a2(new te({ code: "UPLOAD_FAILED", message: "文件上传失败" }));
}, fail(e3) {
a2(new te({ code: e3.code || "UPLOAD_FAILED", message: e3.message || e3.errMsg || "文件上传失败" }));
} });
"function" == typeof i2 && c2 && "function" == typeof c2.onProgressUpdate && c2.onProgressUpdate((e3) => {
i2({ loaded: e3.totalBytesSent, total: e3.totalBytesExpectedToSend });
2024-09-24 09:21:34 +00:00
});
2024-10-14 07:22:41 +00:00
});
}
uploadFile({ filePath: e2, cloudPath: t2, fileType: n2 = "image", onUploadProgress: s2 }) {
if (!t2)
throw new te({ code: "CLOUDPATH_REQUIRED", message: "cloudPath不可为空" });
let r2;
return this.getOSSUploadOptionsFromPath({ cloudPath: t2 }).then((t3) => {
const { url: i2, formData: o2, name: a2 } = t3.result;
r2 = t3.result.fileUrl;
const c2 = { url: i2, formData: o2, name: a2, filePath: e2, fileType: n2 };
return this.uploadFileToOSS(Object.assign({}, c2, { onUploadProgress: s2 }));
}).then(() => this.reportOSSUpload({ cloudPath: t2 })).then((t3) => new Promise((n3, s3) => {
t3.success ? n3({ success: true, filePath: e2, fileID: r2 }) : s3(new te({ code: "UPLOAD_FAILED", message: "文件上传失败" }));
}));
}
deleteFile({ fileList: e2 }) {
const t2 = { method: "serverless.file.resource.delete", params: JSON.stringify({ fileList: e2 }) };
return this.request(this.setupRequest(t2)).then((e3) => {
if (e3.success)
return e3.result;
throw new te({ code: "DELETE_FILE_FAILED", message: "删除文件失败" });
});
}
getTempFileURL({ fileList: e2, maxAge: t2 } = {}) {
if (!Array.isArray(e2) || 0 === e2.length)
throw new te({ code: "INVALID_PARAM", message: "fileList的元素必须是非空的字符串" });
const n2 = { method: "serverless.file.resource.getTempFileURL", params: JSON.stringify({ fileList: e2, maxAge: t2 }) };
return this.request(this.setupRequest(n2)).then((e3) => {
if (e3.success)
return { fileList: e3.result.fileList.map((e4) => ({ fileID: e4.fileID, tempFileURL: e4.tempFileURL })) };
throw new te({ code: "GET_TEMP_FILE_URL_FAILED", message: "获取临时文件链接失败" });
});
2024-09-24 09:21:34 +00:00
}
};
2024-10-14 07:22:41 +00:00
var kt = { init(e2) {
const t2 = new bt(e2), n2 = { signInAnonymously: function() {
return t2.authorize();
}, getLoginState: function() {
return Promise.resolve(false);
} };
return t2.auth = function() {
return n2;
}, t2.customAuth = t2.auth, t2;
} }, At = n(function(e2, t2) {
e2.exports = r.enc.Hex;
});
function Pt(e2 = "", t2 = {}) {
const { data: n2, functionName: s2, method: r2, headers: i2, signHeaderKeys: o2 = [], config: a2 } = t2, c2 = Date.now(), u2 = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e3) {
var t3 = 16 * Math.random() | 0;
return ("x" === e3 ? t3 : 3 & t3 | 8).toString(16);
}), h2 = Object.assign({}, i2, { "x-from-app-id": a2.spaceAppId, "x-from-env-id": a2.spaceId, "x-to-env-id": a2.spaceId, "x-from-instance-id": c2, "x-from-function-name": s2, "x-client-timestamp": c2, "x-alipay-source": "client", "x-request-id": u2, "x-alipay-callid": u2, "x-trace-id": u2 }), l2 = ["x-from-app-id", "x-from-env-id", "x-to-env-id", "x-from-instance-id", "x-from-function-name", "x-client-timestamp"].concat(o2), [d2 = "", p2 = ""] = e2.split("?") || [], f2 = function(e3) {
const t3 = e3.signedHeaders.join(";"), n3 = e3.signedHeaders.map((t4) => `${t4.toLowerCase()}:${e3.headers[t4]}
`).join(""), s3 = _e(e3.body).toString(At), r3 = `${e3.method.toUpperCase()}
${e3.path}
${e3.query}
${n3}
${t3}
${s3}
`, i3 = _e(r3).toString(At), o3 = `HMAC-SHA256
${e3.timestamp}
${i3}
`, a3 = we(o3, e3.secretKey).toString(At);
return `HMAC-SHA256 Credential=${e3.secretId}, SignedHeaders=${t3}, Signature=${a3}`;
}({ path: d2, query: p2, method: r2, headers: h2, timestamp: c2, body: JSON.stringify(n2), secretId: a2.accessKey, secretKey: a2.secretKey, signedHeaders: l2.sort() });
return { url: `${a2.endpoint}${e2}`, headers: Object.assign({}, h2, { Authorization: f2 }) };
}
function Tt({ url: e2, data: t2, method: n2 = "POST", headers: s2 = {} }) {
return new Promise((r2, i2) => {
ne.request({ url: e2, method: n2, data: t2, header: s2, dataType: "json", complete: (e3 = {}) => {
const t3 = s2["x-trace-id"] || "";
if (!e3.statusCode || e3.statusCode >= 400) {
const { message: n3, errMsg: s3, trace_id: r3 } = e3.data || {};
return i2(new te({ code: "SYS_ERR", message: n3 || s3 || "request:fail", requestId: r3 || t3 }));
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
r2({ status: e3.statusCode, data: e3.data, headers: e3.header, requestId: t3 });
} });
});
}
function Ct(e2, t2) {
const { path: n2, data: s2, method: r2 = "GET" } = e2, { url: i2, headers: o2 } = Pt(n2, { functionName: "", data: s2, method: r2, headers: { "x-alipay-cloud-mode": "oss", "x-data-api-type": "oss", "x-expire-timestamp": Date.now() + 6e4 }, signHeaderKeys: ["x-data-api-type", "x-expire-timestamp"], config: t2 });
return Tt({ url: i2, data: s2, method: r2, headers: o2 }).then((e3) => {
const t3 = e3.data || {};
if (!t3.success)
throw new te({ code: e3.errCode, message: e3.errMsg, requestId: e3.requestId });
return t3.data || {};
}).catch((e3) => {
throw new te({ code: e3.errCode, message: e3.errMsg, requestId: e3.requestId });
});
}
function xt(e2 = "") {
const t2 = e2.trim().replace(/^cloud:\/\//, ""), n2 = t2.indexOf("/");
if (n2 <= 0)
throw new te({ code: "INVALID_PARAM", message: "fileID不合法" });
const s2 = t2.substring(0, n2), r2 = t2.substring(n2 + 1);
return s2 !== this.config.spaceId && console.warn("file ".concat(e2, " does not belong to env ").concat(this.config.spaceId)), r2;
}
function Ot(e2 = "") {
return "cloud://".concat(this.config.spaceId, "/").concat(e2.replace(/^\/+/, ""));
}
var Et = class {
constructor(e2) {
if (["spaceId", "spaceAppId", "accessKey", "secretKey"].forEach((t2) => {
if (!Object.prototype.hasOwnProperty.call(e2, t2))
throw new Error(`${t2} required`);
}), e2.endpoint) {
if ("string" != typeof e2.endpoint)
throw new Error("endpoint must be string");
if (!/^https:\/\//.test(e2.endpoint))
throw new Error("endpoint must start with https://");
e2.endpoint = e2.endpoint.replace(/\/$/, "");
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
this.config = Object.assign({}, e2, { endpoint: e2.endpoint || `https://${e2.spaceId}.api-hz.cloudbasefunction.cn` });
}
callFunction(e2) {
return function(e3, t2) {
const { name: n2, data: s2 } = e3, r2 = "POST", { url: i2, headers: o2 } = Pt("/functions/invokeFunction", { functionName: n2, data: s2, method: r2, headers: { "x-to-function-name": n2 }, signHeaderKeys: ["x-to-function-name"], config: t2 });
return Tt({ url: i2, data: s2, method: r2, headers: o2 }).then((e4) => ({ errCode: 0, success: true, requestId: e4.requestId, result: e4.data })).catch((e4) => {
throw new te({ code: e4.errCode, message: e4.errMsg, requestId: e4.requestId });
});
}(e2, this.config);
}
uploadFileToOSS({ url: e2, filePath: t2, fileType: n2, formData: s2, onUploadProgress: r2 }) {
return new Promise((i2, o2) => {
const a2 = ne.uploadFile({ url: e2, filePath: t2, fileType: n2, formData: s2, name: "file", success(e3) {
e3 && e3.statusCode < 400 ? i2(e3) : o2(new te({ code: "UPLOAD_FAILED", message: "文件上传失败" }));
}, fail(e3) {
o2(new te({ code: e3.code || "UPLOAD_FAILED", message: e3.message || e3.errMsg || "文件上传失败" }));
} });
"function" == typeof r2 && a2 && "function" == typeof a2.onProgressUpdate && a2.onProgressUpdate((e3) => {
r2({ loaded: e3.totalBytesSent, total: e3.totalBytesExpectedToSend });
});
});
}
async uploadFile({ filePath: e2, cloudPath: t2 = "", fileType: n2 = "image", onUploadProgress: s2 }) {
if ("string" !== f(t2))
throw new te({ code: "INVALID_PARAM", message: "cloudPath必须为字符串类型" });
if (!(t2 = t2.trim()))
throw new te({ code: "INVALID_PARAM", message: "cloudPath不可为空" });
if (/:\/\//.test(t2))
throw new te({ code: "INVALID_PARAM", message: "cloudPath不合法" });
const r2 = await Ct({ path: "/".concat(t2.replace(/^\//, ""), "?post_url") }, this.config), { file_id: i2, upload_url: o2, form_data: a2 } = r2, c2 = a2 && a2.reduce((e3, t3) => (e3[t3.key] = t3.value, e3), {});
return this.uploadFileToOSS({ url: o2, filePath: e2, fileType: n2, formData: c2, onUploadProgress: s2 }).then(() => ({ fileID: i2 }));
}
async getTempFileURL({ fileList: e2 }) {
return new Promise((t2, n2) => {
(!e2 || e2.length < 0) && n2(new te({ errCode: "INVALID_PARAM", errMsg: "fileList不能为空数组" })), e2.length > 50 && n2(new te({ errCode: "INVALID_PARAM", errMsg: "fileList数组长度不能超过50" }));
const s2 = [];
for (const t3 of e2) {
"string" !== f(t3) && n2(new te({ errCode: "INVALID_PARAM", errMsg: "fileList的元素必须是非空的字符串" }));
const e3 = xt.call(this, t3);
s2.push({ file_id: e3, expire: 600 });
}
Ct({ path: "/?download_url", data: { file_list: s2 }, method: "POST" }, this.config).then((e3) => {
const { file_list: n3 = [] } = e3;
t2({ fileList: n3.map((e4) => ({ fileID: Ot.call(this, e4.file_id), tempFileURL: e4.download_url })) });
}).catch((e3) => n2(e3));
});
}
};
var Lt = { init: (e2) => {
e2.provider = "alipay";
const t2 = new Et(e2);
return t2.auth = function() {
return { signInAnonymously: function() {
return Promise.resolve();
}, getLoginState: function() {
return Promise.resolve(true);
} };
}, t2;
} };
function Rt({ data: e2 }) {
let t2;
t2 = he();
const n2 = JSON.parse(JSON.stringify(e2 || {}));
if (Object.assign(n2, { clientInfo: t2 }), !n2.uniIdToken) {
const { token: e3 } = re();
e3 && (n2.uniIdToken = e3);
}
return n2;
}
async function Ut({ name: e2, data: t2 } = {}) {
await this.__dev__.initLocalNetwork();
const { localAddress: n2, localPort: s2 } = this.__dev__, r2 = { aliyun: "aliyun", tencent: "tcb", alipay: "alipay" }[this.config.provider], i2 = this.config.spaceId, o2 = `http://${n2}:${s2}/system/check-function`, a2 = `http://${n2}:${s2}/cloudfunctions/${e2}`;
return new Promise((t3, n3) => {
ne.request({ method: "POST", url: o2, data: { name: e2, platform: P, provider: r2, spaceId: i2 }, timeout: 3e3, success(e3) {
t3(e3);
}, fail() {
t3({ data: { code: "NETWORK_ERROR", message: "连接本地调试服务失败,请检查客户端是否和主机在同一局域网下,自动切换为已部署的云函数。" } });
} });
}).then(({ data: e3 } = {}) => {
const { code: t3, message: n3 } = e3 || {};
return { code: 0 === t3 ? 0 : t3 || "SYS_ERR", message: n3 || "SYS_ERR" };
}).then(({ code: n3, message: s3 }) => {
if (0 !== n3) {
switch (n3) {
case "MODULE_ENCRYPTED":
console.error(`此云函数(${e2})依赖加密公共模块不可本地调试,自动切换为云端已部署的云函数`);
break;
case "FUNCTION_ENCRYPTED":
console.error(`此云函数(${e2})已加密不可本地调试,自动切换为云端已部署的云函数`);
break;
case "ACTION_ENCRYPTED":
console.error(s3 || "需要访问加密的uni-clientDB-action自动切换为云端环境");
break;
case "NETWORK_ERROR": {
const e3 = "连接本地调试服务失败,请检查客户端是否和主机在同一局域网下";
throw console.error(e3), new Error(e3);
}
case "SWITCH_TO_CLOUD":
break;
default: {
const e3 = `检测本地调试服务出现错误:${s3},请检查网络环境或重启客户端再试`;
throw console.error(e3), new Error(e3);
}
}
return this._callCloudFunction({ name: e2, data: t2 });
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
return new Promise((e3, n4) => {
const s4 = Rt.call(this, { data: t2 });
ne.request({ method: "POST", url: a2, data: { provider: r2, platform: P, param: s4 }, success: ({ statusCode: t3, data: s5 } = {}) => !t3 || t3 >= 400 ? n4(new te({ code: s5.code || "SYS_ERR", message: s5.message || "request:fail" })) : e3({ result: s5 }), fail(e4) {
n4(new te({ code: e4.code || e4.errCode || "SYS_ERR", message: e4.message || e4.errMsg || "request:fail" }));
} });
});
});
}
const Nt = [{ rule: /fc_function_not_found|FUNCTION_NOT_FOUND/, content: ",云函数[{functionName}]在云端不存在,请检查此云函数名称是否正确以及该云函数是否已上传到服务空间", mode: "append" }];
var Dt = /[\\^$.*+?()[\]{}|]/g, Mt = RegExp(Dt.source);
function qt(e2, t2, n2) {
return e2.replace(new RegExp((s2 = t2) && Mt.test(s2) ? s2.replace(Dt, "\\$&") : s2, "g"), n2);
var s2;
}
const Kt = "request", jt = "response", $t = "both";
const An = { code: 2e4, message: "System error" }, Pn = { code: 20101, message: "Invalid client" };
function xn(e2) {
const { errSubject: t2, subject: n2, errCode: s2, errMsg: r2, code: i2, message: o2, cause: a2 } = e2 || {};
return new te({ subject: t2 || n2 || "uni-secure-network", code: s2 || i2 || An.code, message: r2 || o2, cause: a2 });
}
let En;
function Dn({ secretType: e2 } = {}) {
return e2 === Kt || e2 === jt || e2 === $t;
}
function Mn({ name: e2, data: t2 = {} } = {}) {
return "DCloud-clientDB" === e2 && "encryption" === t2.redirectTo && "getAppClientKey" === t2.action;
}
function qn({ provider: e2, spaceId: t2, functionName: n2 } = {}) {
const { appId: s2, uniPlatform: r2, osName: i2 } = ce();
let o2 = r2;
"app" === r2 && (o2 = i2);
const a2 = function({ provider: e3, spaceId: t3 } = {}) {
const n3 = A;
if (!n3)
return {};
e3 = /* @__PURE__ */ function(e4) {
return "tencent" === e4 ? "tcb" : e4;
}(e3);
const s3 = n3.find((n4) => n4.provider === e3 && n4.spaceId === t3);
return s3 && s3.config;
}({ provider: e2, spaceId: t2 });
if (!a2 || !a2.accessControl || !a2.accessControl.enable)
return false;
const c2 = a2.accessControl.function || {}, u2 = Object.keys(c2);
if (0 === u2.length)
return true;
const h2 = function(e3, t3) {
let n3, s3, r3;
for (let i3 = 0; i3 < e3.length; i3++) {
const o3 = e3[i3];
o3 !== t3 ? "*" !== o3 ? o3.split(",").map((e4) => e4.trim()).indexOf(t3) > -1 && (s3 = o3) : r3 = o3 : n3 = o3;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
return n3 || s3 || r3;
}(u2, n2);
if (!h2)
return false;
if ((c2[h2] || []).find((e3 = {}) => e3.appId === s2 && (e3.platform || "").toLowerCase() === o2.toLowerCase()))
return true;
throw console.error(`此应用[appId: ${s2}, platform: ${o2}]不在云端配置的允许访问的应用列表内参考https://uniapp.dcloud.net.cn/uniCloud/secure-network.html#verify-client`), xn(Pn);
}
function Fn({ functionName: e2, result: t2, logPvd: n2 }) {
if (this.__dev__.debugLog && t2 && t2.requestId) {
const s2 = JSON.stringify({ spaceId: this.config.spaceId, functionName: e2, requestId: t2.requestId });
console.log(`[${n2}-request]${s2}[/${n2}-request]`);
}
}
function Kn(e2) {
const t2 = e2.callFunction, n2 = function(n3) {
const s2 = n3.name;
n3.data = Rt.call(e2, { data: n3.data });
const r2 = { aliyun: "aliyun", tencent: "tcb", tcb: "tcb", alipay: "alipay" }[this.config.provider], i2 = Dn(n3), o2 = Mn(n3), a2 = i2 || o2;
return t2.call(this, n3).then((e3) => (e3.errCode = 0, !a2 && Fn.call(this, { functionName: s2, result: e3, logPvd: r2 }), Promise.resolve(e3)), (e3) => (!a2 && Fn.call(this, { functionName: s2, result: e3, logPvd: r2 }), e3 && e3.message && (e3.message = function({ message: e4 = "", extraInfo: t3 = {}, formatter: n4 = [] } = {}) {
for (let s3 = 0; s3 < n4.length; s3++) {
const { rule: r3, content: i3, mode: o3 } = n4[s3], a3 = e4.match(r3);
if (!a3)
continue;
let c2 = i3;
for (let e5 = 1; e5 < a3.length; e5++)
c2 = qt(c2, `{$${e5}}`, a3[e5]);
for (const e5 in t3)
c2 = qt(c2, `{${e5}}`, t3[e5]);
return "replace" === o3 ? c2 : e4 + c2;
}
return e4;
}({ message: `[${n3.name}]: ${e3.message}`, formatter: Nt, extraInfo: { functionName: s2 } })), Promise.reject(e3)));
};
e2.callFunction = function(t3) {
const { provider: s2, spaceId: r2 } = e2.config, i2 = t3.name;
let o2, a2;
if (t3.data = t3.data || {}, e2.__dev__.debugInfo && !e2.__dev__.debugInfo.forceRemote && C ? (e2._callCloudFunction || (e2._callCloudFunction = n2, e2._callLocalFunction = Ut), o2 = Ut) : o2 = n2, o2 = o2.bind(e2), Mn(t3))
a2 = n2.call(e2, t3);
else if (Dn(t3)) {
a2 = new En({ secretType: t3.secretType, uniCloudIns: e2 }).wrapEncryptDataCallFunction(n2.bind(e2))(t3);
} else if (qn({ provider: s2, spaceId: r2, functionName: i2 })) {
a2 = new En({ secretType: t3.secretType, uniCloudIns: e2 }).wrapVerifyClientCallFunction(n2.bind(e2))(t3);
} else
a2 = o2(t3);
return Object.defineProperty(a2, "result", { get: () => (console.warn("当前返回结果为Promise类型不可直接访问其result属性详情请参考https://uniapp.dcloud.net.cn/uniCloud/faq?id=promise"), {}) }), a2.then((e3) => ("undefined" != typeof UTSJSONObject && (e3.result = new UTSJSONObject(e3.result)), e3));
};
}
En = class {
constructor() {
throw xn({ message: `Platform ${P} is not enabled, please check whether secure network module is enabled in your manifest.json` });
}
};
const jn = Symbol("CLIENT_DB_INTERNAL");
function $n(e2, t2) {
return e2.then = "DoNotReturnProxyWithAFunctionNamedThen", e2._internalType = jn, e2.inspect = null, e2.__v_raw = void 0, new Proxy(e2, { get(e3, n2, s2) {
if ("_uniClient" === n2)
return null;
if ("symbol" == typeof n2)
return e3[n2];
if (n2 in e3 || "string" != typeof n2) {
const t3 = e3[n2];
return "function" == typeof t3 ? t3.bind(e3) : t3;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
return t2.get(e3, n2, s2);
} });
}
function Bn(e2) {
return { on: (t2, n2) => {
e2[t2] = e2[t2] || [], e2[t2].indexOf(n2) > -1 || e2[t2].push(n2);
}, off: (t2, n2) => {
e2[t2] = e2[t2] || [];
const s2 = e2[t2].indexOf(n2);
-1 !== s2 && e2[t2].splice(s2, 1);
} };
}
const Wn = ["db.Geo", "db.command", "command.aggregate"];
function Hn(e2, t2) {
return Wn.indexOf(`${e2}.${t2}`) > -1;
}
function zn(e2) {
switch (f(e2 = se(e2))) {
case "array":
return e2.map((e3) => zn(e3));
case "object":
return e2._internalType === jn || Object.keys(e2).forEach((t2) => {
e2[t2] = zn(e2[t2]);
}), e2;
case "regexp":
return { $regexp: { source: e2.source, flags: e2.flags } };
case "date":
return { $date: e2.toISOString() };
default:
return e2;
}
}
function Jn(e2) {
return e2 && e2.content && e2.content.$method;
}
class Gn {
constructor(e2, t2, n2) {
this.content = e2, this.prevStage = t2 || null, this.udb = null, this._database = n2;
}
toJSON() {
let e2 = this;
const t2 = [e2.content];
for (; e2.prevStage; )
e2 = e2.prevStage, t2.push(e2.content);
return { $db: t2.reverse().map((e3) => ({ $method: e3.$method, $param: zn(e3.$param) })) };
}
toString() {
return JSON.stringify(this.toJSON());
}
getAction() {
const e2 = this.toJSON().$db.find((e3) => "action" === e3.$method);
return e2 && e2.$param && e2.$param[0];
}
getCommand() {
return { $db: this.toJSON().$db.filter((e2) => "action" !== e2.$method) };
}
get isAggregate() {
let e2 = this;
for (; e2; ) {
const t2 = Jn(e2), n2 = Jn(e2.prevStage);
if ("aggregate" === t2 && "collection" === n2 || "pipeline" === t2)
return true;
e2 = e2.prevStage;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
return false;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
get isCommand() {
let e2 = this;
for (; e2; ) {
if ("command" === Jn(e2))
return true;
e2 = e2.prevStage;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
return false;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
get isAggregateCommand() {
let e2 = this;
for (; e2; ) {
const t2 = Jn(e2), n2 = Jn(e2.prevStage);
if ("aggregate" === t2 && "command" === n2)
return true;
e2 = e2.prevStage;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
return false;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
getNextStageFn(e2) {
const t2 = this;
2024-09-24 09:21:34 +00:00
return function() {
2024-10-14 07:22:41 +00:00
return Vn({ $method: e2, $param: zn(Array.from(arguments)) }, t2, t2._database);
};
}
get count() {
return this.isAggregate ? this.getNextStageFn("count") : function() {
return this._send("count", Array.from(arguments));
};
}
get remove() {
return this.isCommand ? this.getNextStageFn("remove") : function() {
return this._send("remove", Array.from(arguments));
};
}
get() {
return this._send("get", Array.from(arguments));
}
get add() {
return this.isCommand ? this.getNextStageFn("add") : function() {
return this._send("add", Array.from(arguments));
};
}
update() {
return this._send("update", Array.from(arguments));
}
end() {
return this._send("end", Array.from(arguments));
}
get set() {
return this.isCommand ? this.getNextStageFn("set") : function() {
throw new Error("JQL禁止使用set方法");
};
}
_send(e2, t2) {
const n2 = this.getAction(), s2 = this.getCommand();
if (s2.$db.push({ $method: e2, $param: zn(t2) }), S) {
const e3 = s2.$db.find((e4) => "collection" === e4.$method), t3 = e3 && e3.$param;
t3 && 1 === t3.length && "string" == typeof e3.$param[0] && e3.$param[0].indexOf(",") > -1 && console.warn("检测到使用JQL语法联表查询时未使用getTemp先过滤主表数据在主表数据量大的情况下可能会查询缓慢。\n- 如何优化请参考此文档https://uniapp.dcloud.net.cn/uniCloud/jql?id=lookup-with-temp \n- 如果主表数据量很小请忽略此信息,项目发行时不会出现此提示。");
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
return this._database._callCloudFunction({ action: n2, command: s2 });
}
}
function Vn(e2, t2, n2) {
return $n(new Gn(e2, t2, n2), { get(e3, t3) {
let s2 = "db";
return e3 && e3.content && (s2 = e3.content.$method), Hn(s2, t3) ? Vn({ $method: t3 }, e3, n2) : function() {
return Vn({ $method: t3, $param: zn(Array.from(arguments)) }, e3, n2);
};
} });
}
function Yn({ path: e2, method: t2 }) {
return class {
constructor() {
this.param = Array.from(arguments);
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
toJSON() {
return { $newDb: [...e2.map((e3) => ({ $method: e3 })), { $method: t2, $param: this.param }] };
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
toString() {
return JSON.stringify(this.toJSON());
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
};
}
function Qn(e2, t2 = {}) {
return $n(new e2(t2), { get: (e3, t3) => Hn("db", t3) ? Vn({ $method: t3 }, null, e3) : function() {
return Vn({ $method: t3, $param: zn(Array.from(arguments)) }, null, e3);
} });
}
class Xn extends class {
constructor({ uniClient: e2 = {}, isJQL: t2 = false } = {}) {
this._uniClient = e2, this._authCallBacks = {}, this._dbCallBacks = {}, e2._isDefault && (this._dbCallBacks = L("_globalUniCloudDatabaseCallback")), t2 || (this.auth = Bn(this._authCallBacks)), this._isJQL = t2, Object.assign(this, Bn(this._dbCallBacks)), this.env = $n({}, { get: (e3, t3) => ({ $env: t3 }) }), this.Geo = $n({}, { get: (e3, t3) => Yn({ path: ["Geo"], method: t3 }) }), this.serverDate = Yn({ path: [], method: "serverDate" }), this.RegExp = Yn({ path: [], method: "RegExp" });
}
getCloudEnv(e2) {
if ("string" != typeof e2 || !e2.trim())
throw new Error("getCloudEnv参数错误");
return { $env: e2.replace("$cloudEnv_", "") };
}
_callback(e2, t2) {
const n2 = this._dbCallBacks;
n2[e2] && n2[e2].forEach((e3) => {
e3(...t2);
});
}
_callbackAuth(e2, t2) {
const n2 = this._authCallBacks;
n2[e2] && n2[e2].forEach((e3) => {
e3(...t2);
});
}
multiSend() {
const e2 = Array.from(arguments), t2 = e2.map((e3) => {
const t3 = e3.getAction(), n2 = e3.getCommand();
if ("getTemp" !== n2.$db[n2.$db.length - 1].$method)
throw new Error("multiSend只支持子命令内使用getTemp");
return { action: t3, command: n2 };
});
return this._callCloudFunction({ multiCommand: t2, queryList: e2 });
}
} {
_parseResult(e2) {
return this._isJQL ? e2.result : e2;
}
_callCloudFunction({ action: e2, command: t2, multiCommand: n2, queryList: s2 }) {
function r2(e3, t3) {
if (n2 && s2)
for (let n3 = 0; n3 < s2.length; n3++) {
const r3 = s2[n3];
r3.udb && "function" == typeof r3.udb.setResult && (t3 ? r3.udb.setResult(t3) : r3.udb.setResult(e3.result.dataList[n3]));
2024-09-24 09:21:34 +00:00
}
}
2024-10-14 07:22:41 +00:00
const i2 = this, o2 = this._isJQL ? "databaseForJQL" : "database";
function a2(e3) {
return i2._callback("error", [e3]), M(q(o2, "fail"), e3).then(() => M(q(o2, "complete"), e3)).then(() => (r2(null, e3), Y(j, { type: W, content: e3 }), Promise.reject(e3)));
}
const c2 = M(q(o2, "invoke")), u2 = this._uniClient;
return c2.then(() => u2.callFunction({ name: "DCloud-clientDB", type: h, data: { action: e2, command: t2, multiCommand: n2 } })).then((e3) => {
const { code: t3, message: n3, token: s3, tokenExpired: c3, systemInfo: u3 = [] } = e3.result;
if (u3)
for (let e4 = 0; e4 < u3.length; e4++) {
const { level: t4, message: n4, detail: s4 } = u3[e4], r3 = console["warn" === t4 ? "error" : t4] || console.log;
let i3 = "[System Info]" + n4;
s4 && (i3 = `${i3}
详细信息${s4}`), r3(i3);
}
if (t3) {
return a2(new te({ code: t3, message: n3, requestId: e3.requestId }));
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
e3.result.errCode = e3.result.errCode || e3.result.code, e3.result.errMsg = e3.result.errMsg || e3.result.message, s3 && c3 && (ie({ token: s3, tokenExpired: c3 }), this._callbackAuth("refreshToken", [{ token: s3, tokenExpired: c3 }]), this._callback("refreshToken", [{ token: s3, tokenExpired: c3 }]), Y(B, { token: s3, tokenExpired: c3 }));
const h2 = [{ prop: "affectedDocs", tips: "affectedDocs不再推荐使用请使用inserted/deleted/updated/data.length替代" }, { prop: "code", tips: "code不再推荐使用请使用errCode替代" }, { prop: "message", tips: "message不再推荐使用请使用errMsg替代" }];
for (let t4 = 0; t4 < h2.length; t4++) {
const { prop: n4, tips: s4 } = h2[t4];
if (n4 in e3.result) {
const t5 = e3.result[n4];
Object.defineProperty(e3.result, n4, { get: () => (console.warn(s4), t5) });
}
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
return function(e4) {
return M(q(o2, "success"), e4).then(() => M(q(o2, "complete"), e4)).then(() => {
r2(e4, null);
const t4 = i2._parseResult(e4);
return Y(j, { type: W, content: t4 }), Promise.resolve(t4);
});
}(e3);
}, (e3) => {
/fc_function_not_found|FUNCTION_NOT_FOUND/g.test(e3.message) && console.warn("clientDB未初始化请在web控制台保存一次schema以开启clientDB");
return a2(new te({ code: e3.code || "SYSTEM_ERROR", message: e3.message, requestId: e3.requestId }));
});
}
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
const Zn = "token无效跳转登录页面", es = "token过期跳转登录页面", ts = { TOKEN_INVALID_TOKEN_EXPIRED: es, TOKEN_INVALID_INVALID_CLIENTID: Zn, TOKEN_INVALID: Zn, TOKEN_INVALID_WRONG_TOKEN: Zn, TOKEN_INVALID_ANONYMOUS_USER: Zn }, ns = { "uni-id-token-expired": es, "uni-id-check-token-failed": Zn, "uni-id-token-not-exist": Zn, "uni-id-check-device-feature-failed": Zn };
function ss(e2, t2) {
let n2 = "";
return n2 = e2 ? `${e2}/${t2}` : t2, n2.replace(/^\//, "");
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
function rs(e2 = [], t2 = "") {
const n2 = [], s2 = [];
return e2.forEach((e3) => {
true === e3.needLogin ? n2.push(ss(t2, e3.path)) : false === e3.needLogin && s2.push(ss(t2, e3.path));
}), { needLoginPage: n2, notNeedLoginPage: s2 };
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
function is(e2) {
return e2.split("?")[0].replace(/^\//, "");
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
function os() {
return function(e2) {
let t2 = e2 && e2.$page && e2.$page.fullPath || "";
return t2 ? ("/" !== t2.charAt(0) && (t2 = "/" + t2), t2) : t2;
}(function() {
const e2 = getCurrentPages();
return e2[e2.length - 1];
}());
}
function as() {
return is(os());
}
function cs(e2 = "", t2 = {}) {
if (!e2)
return false;
if (!(t2 && t2.list && t2.list.length))
return false;
const n2 = t2.list, s2 = is(e2);
return n2.some((e3) => e3.pagePath === s2);
}
const us = !!e.uniIdRouter;
const { loginPage: hs, routerNeedLogin: ls, resToLogin: ds, needLoginPage: ps, notNeedLoginPage: fs, loginPageInTabBar: gs } = function({ pages: t2 = [], subPackages: n2 = [], uniIdRouter: s2 = {}, tabBar: r2 = {} } = e) {
const { loginPage: i2, needLogin: o2 = [], resToLogin: a2 = true } = s2, { needLoginPage: c2, notNeedLoginPage: u2 } = rs(t2), { needLoginPage: h2, notNeedLoginPage: l2 } = function(e2 = []) {
const t3 = [], n3 = [];
return e2.forEach((e3) => {
const { root: s3, pages: r3 = [] } = e3, { needLoginPage: i3, notNeedLoginPage: o3 } = rs(r3, s3);
t3.push(...i3), n3.push(...o3);
}), { needLoginPage: t3, notNeedLoginPage: n3 };
}(n2);
return { loginPage: i2, routerNeedLogin: o2, resToLogin: a2, needLoginPage: [...c2, ...h2], notNeedLoginPage: [...u2, ...l2], loginPageInTabBar: cs(i2, r2) };
}();
if (ps.indexOf(hs) > -1)
throw new Error(`Login page [${hs}] should not be "needLogin", please check your pages.json`);
function ms(e2) {
const t2 = as();
if ("/" === e2.charAt(0))
return e2;
const [n2, s2] = e2.split("?"), r2 = n2.replace(/^\//, "").split("/"), i2 = t2.split("/");
i2.pop();
for (let e3 = 0; e3 < r2.length; e3++) {
const t3 = r2[e3];
".." === t3 ? i2.pop() : "." !== t3 && i2.push(t3);
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
return "" === i2[0] && i2.shift(), "/" + i2.join("/") + (s2 ? "?" + s2 : "");
}
function ys(e2) {
const t2 = is(ms(e2));
return !(fs.indexOf(t2) > -1) && (ps.indexOf(t2) > -1 || ls.some((t3) => function(e3, t4) {
return new RegExp(t4).test(e3);
}(e2, t3)));
}
function _s({ redirect: e2 }) {
const t2 = is(e2), n2 = is(hs);
return as() !== n2 && t2 !== n2;
}
function ws({ api: e2, redirect: t2 } = {}) {
if (!t2 || !_s({ redirect: t2 }))
return;
const n2 = function(e3, t3) {
return "/" !== e3.charAt(0) && (e3 = "/" + e3), t3 ? e3.indexOf("?") > -1 ? e3 + `&uniIdRedirectUrl=${encodeURIComponent(t3)}` : e3 + `?uniIdRedirectUrl=${encodeURIComponent(t3)}` : e3;
}(hs, t2);
gs ? "navigateTo" !== e2 && "redirectTo" !== e2 || (e2 = "switchTab") : "switchTab" === e2 && (e2 = "navigateTo");
const s2 = { navigateTo: uni.navigateTo, redirectTo: uni.redirectTo, switchTab: uni.switchTab, reLaunch: uni.reLaunch };
setTimeout(() => {
s2[e2]({ url: n2 });
}, 0);
}
function vs({ url: e2 } = {}) {
const t2 = { abortLoginPageJump: false, autoToLoginPage: false }, n2 = function() {
const { token: e3, tokenExpired: t3 } = re();
let n3;
if (e3) {
if (t3 < Date.now()) {
const e4 = "uni-id-token-expired";
n3 = { errCode: e4, errMsg: ns[e4] };
}
} else {
const e4 = "uni-id-check-token-failed";
n3 = { errCode: e4, errMsg: ns[e4] };
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
return n3;
}();
if (ys(e2) && n2) {
n2.uniIdRedirectUrl = e2;
if (J($).length > 0)
return setTimeout(() => {
Y($, n2);
}, 0), t2.abortLoginPageJump = true, t2;
t2.autoToLoginPage = true;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
return t2;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
function Is() {
!function() {
const e3 = os(), { abortLoginPageJump: t2, autoToLoginPage: n2 } = vs({ url: e3 });
t2 || n2 && ws({ api: "redirectTo", redirect: e3 });
}();
const e2 = ["navigateTo", "redirectTo", "reLaunch", "switchTab"];
for (let t2 = 0; t2 < e2.length; t2++) {
const n2 = e2[t2];
uni.addInterceptor(n2, { invoke(e3) {
const { abortLoginPageJump: t3, autoToLoginPage: s2 } = vs({ url: e3.url });
return t3 ? e3 : s2 ? (ws({ api: n2, redirect: ms(e3.url) }), false) : e3;
} });
}
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
function Ss() {
this.onResponse((e2) => {
const { type: t2, content: n2 } = e2;
let s2 = false;
switch (t2) {
case "cloudobject":
s2 = function(e3) {
if ("object" != typeof e3)
return false;
const { errCode: t3 } = e3 || {};
return t3 in ns;
}(n2);
break;
case "clientdb":
s2 = function(e3) {
if ("object" != typeof e3)
return false;
const { errCode: t3 } = e3 || {};
return t3 in ts;
}(n2);
}
s2 && function(e3 = {}) {
const t3 = J($);
Z().then(() => {
const n3 = os();
if (n3 && _s({ redirect: n3 }))
return t3.length > 0 ? Y($, Object.assign({ uniIdRedirectUrl: n3 }, e3)) : void (hs && ws({ api: "navigateTo", redirect: n3 }));
});
}(n2);
2024-09-24 09:21:34 +00:00
});
}
2024-10-14 07:22:41 +00:00
function bs(e2) {
!function(e3) {
e3.onResponse = function(e4) {
G(j, e4);
}, e3.offResponse = function(e4) {
V(j, e4);
};
}(e2), function(e3) {
e3.onNeedLogin = function(e4) {
G($, e4);
}, e3.offNeedLogin = function(e4) {
V($, e4);
}, us && (L("_globalUniCloudStatus").needLoginInit || (L("_globalUniCloudStatus").needLoginInit = true, Z().then(() => {
Is.call(e3);
}), ds && Ss.call(e3)));
}(e2), function(e3) {
e3.onRefreshToken = function(e4) {
G(B, e4);
}, e3.offRefreshToken = function(e4) {
V(B, e4);
};
}(e2);
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
let ks;
const As = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", Ps = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;
function Ts() {
const e2 = re().token || "", t2 = e2.split(".");
if (!e2 || 3 !== t2.length)
return { uid: null, role: [], permission: [], tokenExpired: 0 };
let n2;
try {
n2 = JSON.parse((s2 = t2[1], decodeURIComponent(ks(s2).split("").map(function(e3) {
return "%" + ("00" + e3.charCodeAt(0).toString(16)).slice(-2);
}).join(""))));
} catch (e3) {
throw new Error("获取当前用户信息出错,详细错误信息为:" + e3.message);
}
var s2;
return n2.tokenExpired = 1e3 * n2.exp, delete n2.exp, delete n2.iat, n2;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
ks = "function" != typeof atob ? function(e2) {
if (e2 = String(e2).replace(/[\t\n\f\r ]+/g, ""), !Ps.test(e2))
throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");
var t2;
e2 += "==".slice(2 - (3 & e2.length));
for (var n2, s2, r2 = "", i2 = 0; i2 < e2.length; )
t2 = As.indexOf(e2.charAt(i2++)) << 18 | As.indexOf(e2.charAt(i2++)) << 12 | (n2 = As.indexOf(e2.charAt(i2++))) << 6 | (s2 = As.indexOf(e2.charAt(i2++))), r2 += 64 === n2 ? String.fromCharCode(t2 >> 16 & 255) : 64 === s2 ? String.fromCharCode(t2 >> 16 & 255, t2 >> 8 & 255) : String.fromCharCode(t2 >> 16 & 255, t2 >> 8 & 255, 255 & t2);
return r2;
} : atob;
var Cs = n(function(e2, t2) {
Object.defineProperty(t2, "__esModule", { value: true });
const n2 = "chooseAndUploadFile:ok", s2 = "chooseAndUploadFile:fail";
function r2(e3, t3) {
return e3.tempFiles.forEach((e4, n3) => {
e4.name || (e4.name = e4.path.substring(e4.path.lastIndexOf("/") + 1)), t3 && (e4.fileType = t3), e4.cloudPath = Date.now() + "_" + n3 + e4.name.substring(e4.name.lastIndexOf("."));
}), e3.tempFilePaths || (e3.tempFilePaths = e3.tempFiles.map((e4) => e4.path)), e3;
}
function i2(e3, t3, { onChooseFile: s3, onUploadProgress: r3 }) {
return t3.then((e4) => {
if (s3) {
const t4 = s3(e4);
if (void 0 !== t4)
return Promise.resolve(t4).then((t5) => void 0 === t5 ? e4 : t5);
}
return e4;
}).then((t4) => false === t4 ? { errMsg: n2, tempFilePaths: [], tempFiles: [] } : function(e4, t5, s4 = 5, r4) {
(t5 = Object.assign({}, t5)).errMsg = n2;
const i3 = t5.tempFiles, o2 = i3.length;
let a2 = 0;
return new Promise((n3) => {
for (; a2 < s4; )
c2();
function c2() {
const s5 = a2++;
if (s5 >= o2)
return void (!i3.find((e5) => !e5.url && !e5.errMsg) && n3(t5));
const u2 = i3[s5];
e4.uploadFile({ provider: u2.provider, filePath: u2.path, cloudPath: u2.cloudPath, fileType: u2.fileType, cloudPathAsRealPath: u2.cloudPathAsRealPath, onUploadProgress(e5) {
e5.index = s5, e5.tempFile = u2, e5.tempFilePath = u2.path, r4 && r4(e5);
} }).then((e5) => {
u2.url = e5.fileID, s5 < o2 && c2();
}).catch((e5) => {
u2.errMsg = e5.errMsg || e5.message, s5 < o2 && c2();
});
}
});
}(e3, t4, 5, r3));
}
t2.initChooseAndUploadFile = function(e3) {
return function(t3 = { type: "all" }) {
return "image" === t3.type ? i2(e3, function(e4) {
const { count: t4, sizeType: n3, sourceType: i3 = ["album", "camera"], extension: o2 } = e4;
return new Promise((e5, a2) => {
uni.chooseImage({ count: t4, sizeType: n3, sourceType: i3, extension: o2, success(t5) {
e5(r2(t5, "image"));
}, fail(e6) {
a2({ errMsg: e6.errMsg.replace("chooseImage:fail", s2) });
} });
});
}(t3), t3) : "video" === t3.type ? i2(e3, function(e4) {
const { camera: t4, compressed: n3, maxDuration: i3, sourceType: o2 = ["album", "camera"], extension: a2 } = e4;
return new Promise((e5, c2) => {
uni.chooseVideo({ camera: t4, compressed: n3, maxDuration: i3, sourceType: o2, extension: a2, success(t5) {
const { tempFilePath: n4, duration: s3, size: i4, height: o3, width: a3 } = t5;
e5(r2({ errMsg: "chooseVideo:ok", tempFilePaths: [n4], tempFiles: [{ name: t5.tempFile && t5.tempFile.name || "", path: n4, size: i4, type: t5.tempFile && t5.tempFile.type || "", width: a3, height: o3, duration: s3, fileType: "video", cloudPath: "" }] }, "video"));
}, fail(e6) {
c2({ errMsg: e6.errMsg.replace("chooseVideo:fail", s2) });
} });
});
}(t3), t3) : i2(e3, function(e4) {
const { count: t4, extension: n3 } = e4;
return new Promise((e5, i3) => {
let o2 = uni.chooseFile;
if ("undefined" != typeof wx && "function" == typeof wx.chooseMessageFile && (o2 = wx.chooseMessageFile), "function" != typeof o2)
return i3({ errMsg: s2 + " 请指定 type 类型,该平台仅支持选择 image 或 video。" });
o2({ type: "all", count: t4, extension: n3, success(t5) {
e5(r2(t5));
}, fail(e6) {
i3({ errMsg: e6.errMsg.replace("chooseFile:fail", s2) });
} });
});
}(t3), t3);
};
};
}), xs = t$1(Cs);
const Os = "manual";
function Es(e2) {
return { props: { localdata: { type: Array, default: () => [] }, options: { type: [Object, Array], default: () => ({}) }, spaceInfo: { type: Object, default: () => ({}) }, collection: { type: [String, Array], default: "" }, action: { type: String, default: "" }, field: { type: String, default: "" }, orderby: { type: String, default: "" }, where: { type: [String, Object], default: "" }, pageData: { type: String, default: "add" }, pageCurrent: { type: Number, default: 1 }, pageSize: { type: Number, default: 20 }, getcount: { type: [Boolean, String], default: false }, gettree: { type: [Boolean, String], default: false }, gettreepath: { type: [Boolean, String], default: false }, startwith: { type: String, default: "" }, limitlevel: { type: Number, default: 10 }, groupby: { type: String, default: "" }, groupField: { type: String, default: "" }, distinct: { type: [Boolean, String], default: false }, foreignKey: { type: String, default: "" }, loadtime: { type: String, default: "auto" }, manual: { type: Boolean, default: false } }, data: () => ({ mixinDatacomLoading: false, mixinDatacomHasMore: false, mixinDatacomResData: [], mixinDatacomErrorMessage: "", mixinDatacomPage: {}, mixinDatacomError: null }), created() {
this.mixinDatacomPage = { current: this.pageCurrent, size: this.pageSize, count: 0 }, this.$watch(() => {
var e3 = [];
return ["pageCurrent", "pageSize", "localdata", "collection", "action", "field", "orderby", "where", "getont", "getcount", "gettree", "groupby", "groupField", "distinct"].forEach((t2) => {
e3.push(this[t2]);
}), e3;
}, (e3, t2) => {
if (this.loadtime === Os)
return;
let n2 = false;
const s2 = [];
for (let r2 = 2; r2 < e3.length; r2++)
e3[r2] !== t2[r2] && (s2.push(e3[r2]), n2 = true);
e3[0] !== t2[0] && (this.mixinDatacomPage.current = this.pageCurrent), this.mixinDatacomPage.size = this.pageSize, this.onMixinDatacomPropsChange(n2, s2);
});
}, methods: { onMixinDatacomPropsChange(e3, t2) {
}, mixinDatacomEasyGet({ getone: e3 = false, success: t2, fail: n2 } = {}) {
this.mixinDatacomLoading || (this.mixinDatacomLoading = true, this.mixinDatacomErrorMessage = "", this.mixinDatacomError = null, this.mixinDatacomGet().then((n3) => {
this.mixinDatacomLoading = false;
const { data: s2, count: r2 } = n3.result;
this.getcount && (this.mixinDatacomPage.count = r2), this.mixinDatacomHasMore = s2.length < this.pageSize;
const i2 = e3 ? s2.length ? s2[0] : void 0 : s2;
this.mixinDatacomResData = i2, t2 && t2(i2);
}).catch((e4) => {
this.mixinDatacomLoading = false, this.mixinDatacomErrorMessage = e4, this.mixinDatacomError = e4, n2 && n2(e4);
}));
}, mixinDatacomGet(t2 = {}) {
let n2;
t2 = t2 || {}, n2 = "undefined" != typeof __uniX && __uniX ? e2.databaseForJQL(this.spaceInfo) : e2.database(this.spaceInfo);
const s2 = t2.action || this.action;
s2 && (n2 = n2.action(s2));
const r2 = t2.collection || this.collection;
n2 = Array.isArray(r2) ? n2.collection(...r2) : n2.collection(r2);
const i2 = t2.where || this.where;
i2 && Object.keys(i2).length && (n2 = n2.where(i2));
const o2 = t2.field || this.field;
o2 && (n2 = n2.field(o2));
const a2 = t2.foreignKey || this.foreignKey;
a2 && (n2 = n2.foreignKey(a2));
const c2 = t2.groupby || this.groupby;
c2 && (n2 = n2.groupBy(c2));
const u2 = t2.groupField || this.groupField;
u2 && (n2 = n2.groupField(u2));
true === (void 0 !== t2.distinct ? t2.distinct : this.distinct) && (n2 = n2.distinct());
const h2 = t2.orderby || this.orderby;
h2 && (n2 = n2.orderBy(h2));
const l2 = void 0 !== t2.pageCurrent ? t2.pageCurrent : this.mixinDatacomPage.current, d2 = void 0 !== t2.pageSize ? t2.pageSize : this.mixinDatacomPage.size, p2 = void 0 !== t2.getcount ? t2.getcount : this.getcount, f2 = void 0 !== t2.gettree ? t2.gettree : this.gettree, g2 = void 0 !== t2.gettreepath ? t2.gettreepath : this.gettreepath, m2 = { getCount: p2 }, y2 = { limitLevel: void 0 !== t2.limitlevel ? t2.limitlevel : this.limitlevel, startWith: void 0 !== t2.startwith ? t2.startwith : this.startwith };
return f2 && (m2.getTree = y2), g2 && (m2.getTreePath = y2), n2 = n2.skip(d2 * (l2 - 1)).limit(d2).get(m2), n2;
} } };
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
function Ls(e2) {
return function(t2, n2 = {}) {
n2 = function(e3, t3 = {}) {
return e3.customUI = t3.customUI || e3.customUI, e3.parseSystemError = t3.parseSystemError || e3.parseSystemError, Object.assign(e3.loadingOptions, t3.loadingOptions), Object.assign(e3.errorOptions, t3.errorOptions), "object" == typeof t3.secretMethods && (e3.secretMethods = t3.secretMethods), e3;
}({ customUI: false, loadingOptions: { title: "加载中...", mask: true }, errorOptions: { type: "modal", retry: false } }, n2);
const { customUI: s2, loadingOptions: r2, errorOptions: i2, parseSystemError: o2 } = n2, a2 = !s2;
return new Proxy({}, { get(s3, c2) {
switch (c2) {
case "toString":
return "[object UniCloudObject]";
case "toJSON":
return {};
}
return function({ fn: e3, interceptorName: t3, getCallbackArgs: n3 } = {}) {
return async function(...s4) {
const r3 = n3 ? n3({ params: s4 }) : {};
let i3, o3;
try {
return await M(q(t3, "invoke"), { ...r3 }), i3 = await e3(...s4), await M(q(t3, "success"), { ...r3, result: i3 }), i3;
} catch (e4) {
throw o3 = e4, await M(q(t3, "fail"), { ...r3, error: o3 }), o3;
} finally {
await M(q(t3, "complete"), o3 ? { ...r3, error: o3 } : { ...r3, result: i3 });
}
};
}({ fn: async function s4(...h2) {
let l2;
a2 && uni.showLoading({ title: r2.title, mask: r2.mask });
const d2 = { name: t2, type: u, data: { method: c2, params: h2 } };
"object" == typeof n2.secretMethods && function(e3, t3) {
const n3 = t3.data.method, s5 = e3.secretMethods || {}, r3 = s5[n3] || s5["*"];
r3 && (t3.secretType = r3);
}(n2, d2);
let p2 = false;
try {
l2 = await e2.callFunction(d2);
} catch (e3) {
p2 = true, l2 = { result: new te(e3) };
}
const { errSubject: f2, errCode: g2, errMsg: m2, newToken: y2 } = l2.result || {};
if (a2 && uni.hideLoading(), y2 && y2.token && y2.tokenExpired && (ie(y2), Y(B, { ...y2 })), g2) {
let e3 = m2;
if (p2 && o2) {
e3 = (await o2({ objectName: t2, methodName: c2, params: h2, errSubject: f2, errCode: g2, errMsg: m2 })).errMsg || m2;
}
if (a2)
if ("toast" === i2.type)
uni.showToast({ title: e3, icon: "none" });
else {
if ("modal" !== i2.type)
throw new Error(`Invalid errorOptions.type: ${i2.type}`);
{
const { confirm: t3 } = await async function({ title: e4, content: t4, showCancel: n4, cancelText: s5, confirmText: r3 } = {}) {
return new Promise((i3, o3) => {
uni.showModal({ title: e4, content: t4, showCancel: n4, cancelText: s5, confirmText: r3, success(e5) {
i3(e5);
}, fail() {
i3({ confirm: false, cancel: true });
} });
});
}({ title: "提示", content: e3, showCancel: i2.retry, cancelText: "取消", confirmText: i2.retry ? "重试" : "确定" });
if (i2.retry && t3)
return s4(...h2);
}
}
const n3 = new te({ subject: f2, code: g2, message: m2, requestId: l2.requestId });
throw n3.detail = l2.result, Y(j, { type: z, content: n3 }), n3;
}
return Y(j, { type: z, content: l2.result }), l2.result;
}, interceptorName: "callObject", getCallbackArgs: function({ params: e3 } = {}) {
return { objectName: t2, methodName: c2, params: e3 };
} });
} });
};
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
function Rs(e2) {
return L("_globalUniCloudSecureNetworkCache__{spaceId}".replace("{spaceId}", e2.config.spaceId));
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
async function Us({ openid: e2, callLoginByWeixin: t2 = false } = {}) {
Rs(this);
throw new Error(`[SecureNetwork] API \`initSecureNetworkByWeixin\` is not supported on platform \`${P}\``);
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
async function Ns(e2) {
const t2 = Rs(this);
return t2.initPromise || (t2.initPromise = Us.call(this, e2).then((e3) => e3).catch((e3) => {
throw delete t2.initPromise, e3;
})), t2.initPromise;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
function Ds(e2) {
return function({ openid: t2, callLoginByWeixin: n2 = false } = {}) {
return Ns.call(e2, { openid: t2, callLoginByWeixin: n2 });
};
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
function Ms(e2) {
const t2 = { getSystemInfo: uni.getSystemInfo, getPushClientId: uni.getPushClientId };
return function(n2) {
return new Promise((s2, r2) => {
t2[e2]({ ...n2, success(e3) {
s2(e3);
}, fail(e3) {
r2(e3);
} });
});
};
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
class qs extends class {
constructor() {
this._callback = {};
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
addListener(e2, t2) {
this._callback[e2] || (this._callback[e2] = []), this._callback[e2].push(t2);
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
on(e2, t2) {
return this.addListener(e2, t2);
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
removeListener(e2, t2) {
if (!t2)
throw new Error('The "listener" argument must be of type function. Received undefined');
const n2 = this._callback[e2];
if (!n2)
return;
const s2 = function(e3, t3) {
for (let n3 = e3.length - 1; n3 >= 0; n3--)
if (e3[n3] === t3)
return n3;
return -1;
}(n2, t2);
n2.splice(s2, 1);
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
off(e2, t2) {
return this.removeListener(e2, t2);
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
removeAllListener(e2) {
delete this._callback[e2];
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
emit(e2, ...t2) {
const n2 = this._callback[e2];
if (n2)
for (let e3 = 0; e3 < n2.length; e3++)
n2[e3](...t2);
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
} {
constructor() {
super(), this._uniPushMessageCallback = this._receivePushMessage.bind(this), this._currentMessageId = -1, this._payloadQueue = [];
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
init() {
return Promise.all([Ms("getSystemInfo")(), Ms("getPushClientId")()]).then(([{ appId: e2 } = {}, { cid: t2 } = {}] = []) => {
if (!e2)
throw new Error("Invalid appId, please check the manifest.json file");
if (!t2)
throw new Error("Invalid push client id");
this._appId = e2, this._pushClientId = t2, this._seqId = Date.now() + "-" + Math.floor(9e5 * Math.random() + 1e5), this.emit("open"), this._initMessageListener();
}, (e2) => {
throw this.emit("error", e2), this.close(), e2;
});
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
async open() {
return this.init();
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
_isUniCloudSSE(e2) {
if ("receive" !== e2.type)
return false;
const t2 = e2 && e2.data && e2.data.payload;
return !(!t2 || "UNI_CLOUD_SSE" !== t2.channel || t2.seqId !== this._seqId);
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
_receivePushMessage(e2) {
if (!this._isUniCloudSSE(e2))
return;
const t2 = e2 && e2.data && e2.data.payload, { action: n2, messageId: s2, message: r2 } = t2;
this._payloadQueue.push({ action: n2, messageId: s2, message: r2 }), this._consumMessage();
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
_consumMessage() {
for (; ; ) {
const e2 = this._payloadQueue.find((e3) => e3.messageId === this._currentMessageId + 1);
if (!e2)
break;
this._currentMessageId++, this._parseMessagePayload(e2);
}
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
_parseMessagePayload(e2) {
const { action: t2, messageId: n2, message: s2 } = e2;
"end" === t2 ? this._end({ messageId: n2, message: s2 }) : "message" === t2 && this._appendMessage({ messageId: n2, message: s2 });
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
_appendMessage({ messageId: e2, message: t2 } = {}) {
this.emit("message", t2);
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
_end({ messageId: e2, message: t2 } = {}) {
this.emit("end", t2), this.close();
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
_initMessageListener() {
uni.onPushMessage(this._uniPushMessageCallback);
}
_destroy() {
uni.offPushMessage(this._uniPushMessageCallback);
}
toJSON() {
return { appId: this._appId, pushClientId: this._pushClientId, seqId: this._seqId };
}
close() {
this._destroy(), this.emit("close");
}
}
async function Fs(e2, t2) {
const n2 = `http://${e2}:${t2}/system/ping`;
try {
const e3 = await (s2 = { url: n2, timeout: 500 }, new Promise((e4, t3) => {
ne.request({ ...s2, success(t4) {
e4(t4);
}, fail(e5) {
t3(e5);
2024-09-24 09:21:34 +00:00
} });
2024-10-14 07:22:41 +00:00
}));
return !(!e3.data || 0 !== e3.data.code);
} catch (e3) {
return false;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
var s2;
}
async function Ks(e2) {
{
const { osName: e3, osVersion: t3 } = ce();
"ios" === e3 && function(e4) {
if (!e4 || "string" != typeof e4)
return 0;
const t4 = e4.match(/^(\d+)./);
return t4 && t4[1] ? parseInt(t4[1]) : 0;
}(t3) >= 14 && console.warn("iOS 14及以上版本连接uniCloud本地调试服务需要允许客户端查找并连接到本地网络上的设备仅开发期间需要发行后不需要");
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
const t2 = e2.__dev__;
if (!t2.debugInfo)
return;
const { address: n2, servePort: s2 } = t2.debugInfo, { address: r2 } = await async function(e3, t3) {
let n3;
for (let s3 = 0; s3 < e3.length; s3++) {
const r3 = e3[s3];
if (await Fs(r3, t3)) {
n3 = r3;
break;
}
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
return { address: n3, port: t3 };
}(n2, s2);
if (r2)
return t2.localAddress = r2, void (t2.localPort = s2);
const i2 = console["error"];
let o2 = "";
if ("remote" === t2.debugInfo.initialLaunchType ? (t2.debugInfo.forceRemote = true, o2 = "当前客户端和HBuilderX不在同一局域网下或其他网络原因无法连接HBuilderXuniCloud本地调试服务不对当前客户端生效。\n- 如果不使用uniCloud本地调试服务请直接忽略此信息。\n- 如需使用uniCloud本地调试服务请将客户端与主机连接到同一局域网下并重新运行到客户端。") : o2 = "无法连接uniCloud本地调试服务请检查当前客户端是否与主机在同一局域网下。\n- 如需使用uniCloud本地调试服务请将客户端与主机连接到同一局域网下并重新运行到客户端。", o2 += "\n- 如果在HBuilderX开启的状态下切换过网络环境请重启HBuilderX后再试\n- 检查系统防火墙是否拦截了HBuilderX自带的nodejs\n- 检查是否错误的使用拦截器修改uni.request方法的参数", 0 === P.indexOf("mp-") && (o2 += "\n- 小程序中如何使用uniCloud请参考https://uniapp.dcloud.net.cn/uniCloud/publish.html#useinmp"), !t2.debugInfo.forceRemote)
throw new Error(o2);
i2(o2);
}
function js(e2) {
e2._initPromiseHub || (e2._initPromiseHub = new v({ createPromise: function() {
let t2 = Promise.resolve();
var n2;
n2 = 1, t2 = new Promise((e3) => {
setTimeout(() => {
e3();
}, n2);
2024-09-24 09:21:34 +00:00
});
2024-10-14 07:22:41 +00:00
const s2 = e2.auth();
return t2.then(() => s2.getLoginState()).then((e3) => e3 ? Promise.resolve() : s2.signInAnonymously());
} }));
}
const $s = { tcb: St, tencent: St, aliyun: pe, private: kt, alipay: Lt };
let Bs = new class {
init(e2) {
let t2 = {};
const n2 = $s[e2.provider];
if (!n2)
throw new Error("未提供正确的provider参数");
t2 = n2.init(e2), function(e3) {
const t3 = {};
e3.__dev__ = t3, t3.debugLog = "app" === P;
const n3 = T;
n3 && !n3.code && (t3.debugInfo = n3);
const s2 = new v({ createPromise: function() {
return Ks(e3);
} });
t3.initLocalNetwork = function() {
return s2.exec();
};
}(t2), js(t2), Kn(t2), function(e3) {
const t3 = e3.uploadFile;
e3.uploadFile = function(e4) {
return t3.call(this, e4);
};
}(t2), function(e3) {
e3.database = function(t3) {
if (t3 && Object.keys(t3).length > 0)
return e3.init(t3).database();
if (this._database)
return this._database;
const n3 = Qn(Xn, { uniClient: e3 });
return this._database = n3, n3;
}, e3.databaseForJQL = function(t3) {
if (t3 && Object.keys(t3).length > 0)
return e3.init(t3).databaseForJQL();
if (this._databaseForJQL)
return this._databaseForJQL;
const n3 = Qn(Xn, { uniClient: e3, isJQL: true });
return this._databaseForJQL = n3, n3;
};
}(t2), function(e3) {
e3.getCurrentUserInfo = Ts, e3.chooseAndUploadFile = xs.initChooseAndUploadFile(e3), Object.assign(e3, { get mixinDatacom() {
return Es(e3);
} }), e3.SSEChannel = qs, e3.initSecureNetworkByWeixin = Ds(e3), e3.importObject = Ls(e3);
}(t2);
return ["callFunction", "uploadFile", "deleteFile", "getTempFileURL", "downloadFile", "chooseAndUploadFile"].forEach((e3) => {
if (!t2[e3])
return;
const n3 = t2[e3];
t2[e3] = function() {
return n3.apply(t2, Array.from(arguments));
}, t2[e3] = (/* @__PURE__ */ function(e4, t3) {
return function(n4) {
let s2 = false;
if ("callFunction" === t3) {
const e5 = n4 && n4.type || c;
s2 = e5 !== c;
}
const r2 = "callFunction" === t3 && !s2, i2 = this._initPromiseHub.exec();
n4 = n4 || {};
const { success: o2, fail: a2, complete: u2 } = ee(n4), h2 = i2.then(() => s2 ? Promise.resolve() : M(q(t3, "invoke"), n4)).then(() => e4.call(this, n4)).then((e5) => s2 ? Promise.resolve(e5) : M(q(t3, "success"), e5).then(() => M(q(t3, "complete"), e5)).then(() => (r2 && Y(j, { type: H, content: e5 }), Promise.resolve(e5))), (e5) => s2 ? Promise.reject(e5) : M(q(t3, "fail"), e5).then(() => M(q(t3, "complete"), e5)).then(() => (Y(j, { type: H, content: e5 }), Promise.reject(e5))));
if (!(o2 || a2 || u2))
return h2;
h2.then((e5) => {
o2 && o2(e5), u2 && u2(e5), r2 && Y(j, { type: H, content: e5 });
}, (e5) => {
a2 && a2(e5), u2 && u2(e5), r2 && Y(j, { type: H, content: e5 });
});
};
}(t2[e3], e3)).bind(t2);
}), t2.init = this.init, t2;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
}();
(() => {
const e2 = C;
let t2 = {};
if (e2 && 1 === e2.length)
t2 = e2[0], Bs = Bs.init(t2), Bs._isDefault = true;
else {
const t3 = ["auth", "callFunction", "uploadFile", "deleteFile", "getTempFileURL", "downloadFile", "database", "getCurrentUSerInfo", "importObject"];
let n2;
n2 = e2 && e2.length > 0 ? "应用有多个服务空间请通过uniCloud.init方法指定要使用的服务空间" : "应用未关联服务空间请在uniCloud目录右键关联服务空间", t3.forEach((e3) => {
Bs[e3] = function() {
return console.error(n2), Promise.reject(new te({ code: "SYS_ERR", message: n2 }));
};
});
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
Object.assign(Bs, { get mixinDatacom() {
return Es(Bs);
} }), bs(Bs), Bs.addInterceptor = N, Bs.removeInterceptor = D, Bs.interceptObject = F;
})();
var Ws = Bs;
const ERR_MSG_OK = "chooseAndUploadFile:ok";
const ERR_MSG_FAIL = "chooseAndUploadFile:fail";
function chooseImage(opts) {
const {
count,
sizeType = ["original", "compressed"],
sourceType,
extension
} = opts;
return new Promise((resolve, reject) => {
uni.chooseImage({
count,
sizeType,
sourceType,
extension,
success(res) {
resolve(normalizeChooseAndUploadFileRes(res, "image"));
},
fail(res) {
reject({
errMsg: res.errMsg.replace("chooseImage:fail", ERR_MSG_FAIL)
});
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
});
});
}
function chooseVideo(opts) {
const {
count,
camera,
compressed,
maxDuration,
sourceType,
extension
} = opts;
return new Promise((resolve, reject) => {
uni.chooseVideo({
camera,
compressed,
maxDuration,
sourceType,
extension,
success(res) {
const {
tempFilePath,
duration,
size,
height,
width
} = res;
resolve(normalizeChooseAndUploadFileRes({
errMsg: "chooseVideo:ok",
tempFilePaths: [tempFilePath],
tempFiles: [{
name: res.tempFile && res.tempFile.name || "",
path: tempFilePath,
size,
type: res.tempFile && res.tempFile.type || "",
width,
height,
duration,
fileType: "video",
cloudPath: ""
}]
}, "video"));
},
fail(res) {
reject({
errMsg: res.errMsg.replace("chooseVideo:fail", ERR_MSG_FAIL)
});
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
});
});
}
function chooseAll(opts) {
const {
count,
extension
} = opts;
return new Promise((resolve, reject) => {
let chooseFile = uni.chooseFile;
if (typeof wx !== "undefined" && typeof wx.chooseMessageFile === "function") {
chooseFile = wx.chooseMessageFile;
}
if (typeof chooseFile !== "function") {
return reject({
errMsg: ERR_MSG_FAIL + " 请指定 type 类型,该平台仅支持选择 image 或 video。"
});
}
chooseFile({
type: "all",
count,
extension,
success(res) {
resolve(normalizeChooseAndUploadFileRes(res));
},
fail(res) {
reject({
errMsg: res.errMsg.replace("chooseFile:fail", ERR_MSG_FAIL)
});
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
});
});
}
function normalizeChooseAndUploadFileRes(res, fileType) {
res.tempFiles.forEach((item, index) => {
if (!item.name) {
item.name = item.path.substring(item.path.lastIndexOf("/") + 1);
}
if (fileType) {
item.fileType = fileType;
}
item.cloudPath = Date.now() + "_" + index + item.name.substring(item.name.lastIndexOf("."));
});
if (!res.tempFilePaths) {
res.tempFilePaths = res.tempFiles.map((file) => file.path);
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
return res;
}
function uploadCloudFiles(files, max = 5, onUploadProgress) {
files = JSON.parse(JSON.stringify(files));
const len = files.length;
let count = 0;
let self2 = this;
return new Promise((resolve) => {
while (count < max) {
next();
}
function next() {
let cur = count++;
if (cur >= len) {
!files.find((item) => !item.url && !item.errMsg) && resolve(files);
return;
}
const fileItem = files[cur];
const index = self2.files.findIndex((v2) => v2.uuid === fileItem.uuid);
fileItem.url = "";
delete fileItem.errMsg;
Ws.uploadFile({
filePath: fileItem.path,
cloudPath: fileItem.cloudPath,
fileType: fileItem.fileType,
onUploadProgress: (res) => {
res.index = index;
onUploadProgress && onUploadProgress(res);
}
}).then((res) => {
fileItem.url = res.fileID;
fileItem.index = index;
if (cur < len) {
next();
}
}).catch((res) => {
fileItem.errMsg = res.errMsg || res.message;
fileItem.index = index;
if (cur < len) {
next();
}
});
}
2024-09-24 09:21:34 +00:00
});
}
2024-10-14 07:22:41 +00:00
function uploadFiles(choosePromise, {
onChooseFile,
onUploadProgress
}) {
return choosePromise.then((res) => {
if (onChooseFile) {
const customChooseRes = onChooseFile(res);
if (typeof customChooseRes !== "undefined") {
return Promise.resolve(customChooseRes).then((chooseRes) => typeof chooseRes === "undefined" ? res : chooseRes);
}
}
return res;
}).then((res) => {
if (res === false) {
return {
errMsg: ERR_MSG_OK,
tempFilePaths: [],
tempFiles: []
};
}
return res;
});
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
function chooseAndUploadFile(opts = {
type: "all"
}) {
if (opts.type === "image") {
return uploadFiles(chooseImage(opts), opts);
} else if (opts.type === "video") {
return uploadFiles(chooseVideo(opts), opts);
}
return uploadFiles(chooseAll(opts), opts);
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
const get_file_ext = (name2) => {
const last_len = name2.lastIndexOf(".");
const len = name2.length;
return {
name: name2.substring(0, last_len),
ext: name2.substring(last_len + 1, len)
};
};
const get_extname = (fileExtname) => {
if (!Array.isArray(fileExtname)) {
let extname = fileExtname.replace(/(\[|\])/g, "");
return extname.split(",");
} else {
return fileExtname;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
};
const get_files_and_is_max = (res, _extname) => {
let filePaths = [];
let files = [];
if (!_extname || _extname.length === 0) {
return {
filePaths,
files
};
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
res.tempFiles.forEach((v2) => {
let fileFullName = get_file_ext(v2.name);
const extname = fileFullName.ext.toLowerCase();
if (_extname.indexOf(extname) !== -1) {
files.push(v2);
filePaths.push(v2.path);
}
});
if (files.length !== res.tempFiles.length) {
uni.showToast({
title: `当前选择了${res.tempFiles.length}个文件 ${res.tempFiles.length - files.length} 个文件格式不正确`,
icon: "none",
duration: 5e3
});
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
return {
filePaths,
files
};
};
const get_file_info = (filepath) => {
return new Promise((resolve, reject) => {
uni.getImageInfo({
src: filepath,
success(res) {
resolve(res);
},
fail(err) {
reject(err);
}
});
});
};
const get_file_data = async (files, type = "image") => {
let fileFullName = get_file_ext(files.name);
const extname = fileFullName.ext.toLowerCase();
let filedata = {
name: files.name,
uuid: files.uuid,
extname: extname || "",
cloudPath: files.cloudPath,
fileType: files.fileType,
thumbTempFilePath: files.thumbTempFilePath,
url: files.path || files.path,
size: files.size,
//单位是字节
image: {},
path: files.path,
video: {}
};
if (type === "image") {
const imageinfo = await get_file_info(files.path);
delete filedata.video;
filedata.image.width = imageinfo.width;
filedata.image.height = imageinfo.height;
filedata.image.location = imageinfo.path;
} else {
delete filedata.image;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
return filedata;
};
const _sfc_main$r = {
name: "uploadImage",
emits: ["uploadFiles", "choose", "delFile"],
props: {
filesList: {
type: Array,
default() {
return [];
}
},
disabled: {
type: Boolean,
default: false
},
disablePreview: {
type: Boolean,
default: false
},
limit: {
type: [Number, String],
default: 9
},
imageStyles: {
type: Object,
default() {
return {
width: "auto",
height: "auto",
border: {}
};
}
},
delIcon: {
type: Boolean,
default: true
},
readonly: {
type: Boolean,
default: false
}
},
computed: {
styles() {
let styles = {
width: "auto",
height: "auto",
border: {}
};
return Object.assign(styles, this.imageStyles);
},
boxStyle() {
const {
width = "auto",
height = "auto"
} = this.styles;
let obj = {};
if (height === "auto") {
if (width !== "auto") {
obj.height = this.value2px(width);
obj["padding-top"] = 0;
} else {
obj.height = 0;
}
} else {
obj.height = this.value2px(height);
obj["padding-top"] = 0;
}
if (width === "auto") {
if (height !== "auto") {
obj.width = this.value2px(height);
} else {
obj.width = "33.3%";
}
} else {
obj.width = this.value2px(width);
}
let classles = "";
for (let i2 in obj) {
classles += `${i2}:${obj[i2]};`;
}
return classles;
},
borderStyle() {
let {
border
} = this.styles;
let obj = {};
const widthDefaultValue = 1;
const radiusDefaultValue = 3;
if (typeof border === "boolean") {
obj.border = border ? "1px #eee solid" : "none";
} else {
let width = border && border.width || widthDefaultValue;
width = this.value2px(width);
let radius = border && border.radius || radiusDefaultValue;
radius = this.value2px(radius);
obj = {
"border-width": width,
"border-style": border && border.style || "solid",
"border-color": border && border.color || "#eee",
"border-radius": radius
};
}
let classles = "";
for (let i2 in obj) {
classles += `${i2}:${obj[i2]};`;
}
return classles;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
},
methods: {
uploadFiles(item, index) {
this.$emit("uploadFiles", item);
},
choose() {
this.$emit("choose");
},
delFile(index) {
this.$emit("delFile", index);
},
prviewImage(img, index) {
let urls = [];
if (Number(this.limit) === 1 && this.disablePreview && !this.disabled) {
this.$emit("choose");
}
if (this.disablePreview)
return;
this.filesList.forEach((i2) => {
urls.push(i2.url);
});
uni.previewImage({
urls,
current: index
});
},
value2px(value) {
if (typeof value === "number") {
value += "px";
} else {
if (value.indexOf("%") === -1) {
value = value.indexOf("px") !== -1 ? value : value + "px";
}
}
return value;
2024-09-24 09:21:34 +00:00
}
}
2024-10-14 07:22:41 +00:00
};
function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
return vue.openBlock(), vue.createElementBlock("view", { class: "uni-file-picker__container" }, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList($props.filesList, (item, index) => {
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: "file-picker__box",
key: index,
style: vue.normalizeStyle($options.boxStyle)
},
[
vue.createElementVNode(
"view",
{
class: "file-picker__box-content",
style: vue.normalizeStyle($options.borderStyle)
},
[
vue.createElementVNode("image", {
class: "file-image",
src: item.url,
mode: "aspectFill",
onClick: vue.withModifiers(($event) => $options.prviewImage(item, index), ["stop"])
}, null, 8, ["src", "onClick"]),
$props.delIcon && !$props.readonly ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "icon-del-box",
onClick: vue.withModifiers(($event) => $options.delFile(index), ["stop"])
}, [
vue.createElementVNode("view", { class: "icon-del" }),
vue.createElementVNode("view", { class: "icon-del rotate" })
], 8, ["onClick"])) : vue.createCommentVNode("v-if", true),
item.progress && item.progress !== 100 || item.progress === 0 ? (vue.openBlock(), vue.createElementBlock("view", {
key: 1,
class: "file-picker__progress"
}, [
vue.createElementVNode("progress", {
class: "file-picker__progress-item",
percent: item.progress === -1 ? 0 : item.progress,
"stroke-width": "4",
backgroundColor: item.errMsg ? "#ff5a5f" : "#EBEBEB"
}, null, 8, ["percent", "backgroundColor"])
])) : vue.createCommentVNode("v-if", true),
item.errMsg ? (vue.openBlock(), vue.createElementBlock("view", {
key: 2,
class: "file-picker__mask",
onClick: vue.withModifiers(($event) => $options.uploadFiles(item, index), ["stop"])
}, " 点击重试 ", 8, ["onClick"])) : vue.createCommentVNode("v-if", true)
],
4
/* STYLE */
)
],
4
/* STYLE */
);
}),
128
/* KEYED_FRAGMENT */
)),
$props.filesList.length < $props.limit && !$props.readonly ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 0,
class: "file-picker__box",
style: vue.normalizeStyle($options.boxStyle)
},
[
vue.createElementVNode(
"view",
{
class: "file-picker__box-content is-add",
style: vue.normalizeStyle($options.borderStyle),
onClick: _cache[0] || (_cache[0] = (...args) => $options.choose && $options.choose(...args))
},
[
vue.renderSlot(_ctx.$slots, "default", {}, () => [
vue.createElementVNode("view", { class: "icon-add" }),
vue.createElementVNode("view", { class: "icon-add rotate" })
], true)
],
4
/* STYLE */
)
],
4
/* STYLE */
)) : vue.createCommentVNode("v-if", true)
]);
}
const uploadImage = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["render", _sfc_render$6], ["__scopeId", "data-v-bdfc07e0"], ["__file", "D:/projects/cxc-szcx-uniapp/uni_modules/uni-file-picker/components/uni-file-picker/upload-image.vue"]]);
const _sfc_main$q = {
name: "uploadFile",
emits: ["uploadFiles", "choose", "delFile"],
props: {
filesList: {
type: Array,
default() {
return [];
}
},
delIcon: {
type: Boolean,
default: true
},
limit: {
type: [Number, String],
default: 9
},
showType: {
type: String,
default: ""
},
listStyles: {
type: Object,
default() {
return {
// 是否显示边框
border: true,
// 是否显示分隔线
dividline: true,
// 线条样式
borderStyle: {}
};
}
},
readonly: {
type: Boolean,
default: false
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
},
computed: {
list() {
let files = [];
this.filesList.forEach((v2) => {
files.push(v2);
});
return files;
},
styles() {
let styles = {
border: true,
dividline: true,
"border-style": {}
};
return Object.assign(styles, this.listStyles);
},
borderStyle() {
let {
borderStyle,
border
} = this.styles;
let obj = {};
if (!border) {
obj.border = "none";
} else {
let width = borderStyle && borderStyle.width || 1;
width = this.value2px(width);
let radius = borderStyle && borderStyle.radius || 5;
radius = this.value2px(radius);
obj = {
"border-width": width,
"border-style": borderStyle && borderStyle.style || "solid",
"border-color": borderStyle && borderStyle.color || "#eee",
"border-radius": radius
};
}
let classles = "";
for (let i2 in obj) {
classles += `${i2}:${obj[i2]};`;
}
return classles;
},
borderLineStyle() {
let obj = {};
let {
borderStyle
} = this.styles;
if (borderStyle && borderStyle.color) {
obj["border-color"] = borderStyle.color;
}
if (borderStyle && borderStyle.width) {
let width = borderStyle && borderStyle.width || 1;
let style = borderStyle && borderStyle.style || 0;
if (typeof width === "number") {
width += "px";
} else {
width = width.indexOf("px") ? width : width + "px";
}
obj["border-width"] = width;
if (typeof style === "number") {
style += "px";
} else {
style = style.indexOf("px") ? style : style + "px";
}
obj["border-top-style"] = style;
}
let classles = "";
for (let i2 in obj) {
classles += `${i2}:${obj[i2]};`;
}
return classles;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
},
methods: {
uploadFiles(item, index) {
this.$emit("uploadFiles", {
item,
index
});
},
choose() {
this.$emit("choose");
},
delFile(index) {
this.$emit("delFile", index);
},
value2px(value) {
if (typeof value === "number") {
value += "px";
} else {
value = value.indexOf("px") !== -1 ? value : value + "px";
}
return value;
2024-09-24 09:21:34 +00:00
}
}
2024-10-14 07:22:41 +00:00
};
function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
return vue.openBlock(), vue.createElementBlock("view", { class: "uni-file-picker__files" }, [
!$props.readonly ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "files-button",
onClick: _cache[0] || (_cache[0] = (...args) => $options.choose && $options.choose(...args))
}, [
vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
])) : vue.createCommentVNode("v-if", true),
vue.createCommentVNode(` :class="{'is-text-box':showType === 'list'}" `),
$options.list.length > 0 ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 1,
class: "uni-file-picker__lists is-text-box",
style: vue.normalizeStyle($options.borderStyle)
},
[
vue.createCommentVNode(" ,'is-list-card':showType === 'list-card' "),
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList($options.list, (item, index) => {
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass(["uni-file-picker__lists-box", {
"files-border": index !== 0 && $options.styles.dividline
}]),
key: index,
style: vue.normalizeStyle(index !== 0 && $options.styles.dividline && $options.borderLineStyle)
},
[
vue.createElementVNode("view", { class: "uni-file-picker__item" }, [
vue.createCommentVNode(` :class="{'is-text-image':showType === 'list'}" `),
vue.createCommentVNode(' <view class="files__image is-text-image">\r\n <image class="header-image" :src="item.logo" mode="aspectFit"></image>\r\n </view> '),
vue.createElementVNode(
"view",
{ class: "files__name" },
vue.toDisplayString(item.name),
1
/* TEXT */
),
$props.delIcon && !$props.readonly ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "icon-del-box icon-files",
onClick: ($event) => $options.delFile(index)
}, [
vue.createElementVNode("view", { class: "icon-del icon-files" }),
vue.createElementVNode("view", { class: "icon-del rotate" })
], 8, ["onClick"])) : vue.createCommentVNode("v-if", true)
]),
item.progress && item.progress !== 100 || item.progress === 0 ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "file-picker__progress"
}, [
vue.createElementVNode("progress", {
class: "file-picker__progress-item",
percent: item.progress === -1 ? 0 : item.progress,
"stroke-width": "4",
backgroundColor: item.errMsg ? "#ff5a5f" : "#EBEBEB"
}, null, 8, ["percent", "backgroundColor"])
])) : vue.createCommentVNode("v-if", true),
item.status === "error" ? (vue.openBlock(), vue.createElementBlock("view", {
key: 1,
class: "file-picker__mask",
onClick: vue.withModifiers(($event) => $options.uploadFiles(item, index), ["stop"])
}, " 点击重试 ", 8, ["onClick"])) : vue.createCommentVNode("v-if", true)
],
6
/* CLASS, STYLE */
);
}),
128
/* KEYED_FRAGMENT */
))
],
4
/* STYLE */
)) : vue.createCommentVNode("v-if", true)
]);
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
const uploadFile = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["render", _sfc_render$5], ["__scopeId", "data-v-a54939c6"], ["__file", "D:/projects/cxc-szcx-uniapp/uni_modules/uni-file-picker/components/uni-file-picker/upload-file.vue"]]);
const _sfc_main$p = {
name: "uniFilePicker",
components: {
uploadImage,
uploadFile
},
options: {
virtualHost: true
},
emits: ["select", "success", "fail", "progress", "delete", "update:modelValue", "input"],
props: {
modelValue: {
type: [Array, Object],
default() {
return [];
}
},
value: {
type: [Array, Object],
default() {
return [];
}
},
disabled: {
type: Boolean,
default: false
},
disablePreview: {
type: Boolean,
default: false
},
delIcon: {
type: Boolean,
default: true
},
// 自动上传
autoUpload: {
type: Boolean,
default: true
},
// 最大选择个数 h5只能限制单选或是多选
limit: {
type: [Number, String],
default: 9
},
// 列表样式 grid | list | list-card
mode: {
type: String,
default: "grid"
},
// 选择文件类型 image/video/all
fileMediatype: {
type: String,
default: "image"
},
// 文件类型筛选
fileExtname: {
type: [Array, String],
default() {
return [];
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
},
title: {
type: String,
default: ""
},
listStyles: {
type: Object,
default() {
return {
// 是否显示边框
border: true,
// 是否显示分隔线
dividline: true,
// 线条样式
borderStyle: {}
};
}
},
imageStyles: {
type: Object,
default() {
return {
width: "auto",
height: "auto"
};
}
},
readonly: {
type: Boolean,
default: false
},
returnType: {
type: String,
default: "array"
},
sizeType: {
type: Array,
default() {
return ["original", "compressed"];
}
},
sourceType: {
type: Array,
default() {
return ["album", "camera"];
}
},
provider: {
type: String,
default: ""
// 默认上传到 unicloud 内置存储 extStorage 扩展存储
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
},
data() {
return {
files: [],
localValue: []
};
},
watch: {
value: {
handler(newVal, oldVal) {
this.setValue(newVal, oldVal);
},
immediate: true
},
modelValue: {
handler(newVal, oldVal) {
this.setValue(newVal, oldVal);
},
immediate: true
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
},
computed: {
filesList() {
let files = [];
this.files.forEach((v2) => {
files.push(v2);
});
return files;
},
showType() {
if (this.fileMediatype === "image") {
return this.mode;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
return "list";
},
limitLength() {
if (this.returnType === "object") {
return 1;
}
if (!this.limit) {
return 1;
}
if (this.limit >= 9) {
return 9;
}
return this.limit;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
},
created() {
if (!(Ws.config && Ws.config.provider)) {
this.noSpace = true;
Ws.chooseAndUploadFile = chooseAndUploadFile;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
this.form = this.getForm("uniForms");
this.formItem = this.getForm("uniFormsItem");
if (this.form && this.formItem) {
if (this.formItem.name) {
this.rename = this.formItem.name;
this.form.inputChildrens.push(this);
}
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
},
methods: {
/**
* 公开用户使用清空文件
* @param {Object} index
*/
clearFiles(index) {
if (index !== 0 && !index) {
this.files = [];
this.$nextTick(() => {
this.setEmit();
});
} else {
this.files.splice(index, 1);
}
this.$nextTick(() => {
this.setEmit();
});
},
/**
* 公开用户使用继续上传
*/
upload() {
let files = [];
this.files.forEach((v2, index) => {
if (v2.status === "ready" || v2.status === "error") {
files.push(Object.assign({}, v2));
}
});
return this.uploadFiles(files);
},
async setValue(newVal, oldVal) {
const newData = async (v2) => {
const reg = /cloud:\/\/([\w.]+\/?)\S*/;
let url = "";
if (v2.fileID) {
url = v2.fileID;
} else {
url = v2.url;
}
if (reg.test(url)) {
v2.fileID = url;
v2.url = await this.getTempFileURL(url);
}
if (v2.url)
v2.path = v2.url;
return v2;
};
if (this.returnType === "object") {
if (newVal) {
await newData(newVal);
} else {
newVal = {};
}
} else {
if (!newVal)
newVal = [];
for (let i2 = 0; i2 < newVal.length; i2++) {
let v2 = newVal[i2];
await newData(v2);
}
}
this.localValue = newVal;
if (this.form && this.formItem && !this.is_reset) {
this.is_reset = false;
this.formItem.setValue(this.localValue);
}
let filesData = Object.keys(newVal).length > 0 ? newVal : [];
this.files = [].concat(filesData);
},
/**
* 选择文件
*/
choose() {
if (this.disabled)
return;
if (this.files.length >= Number(this.limitLength) && this.showType !== "grid" && this.returnType === "array") {
uni.showToast({
title: `您最多选择 ${this.limitLength} 个文件`,
icon: "none"
});
return;
}
this.chooseFiles();
},
/**
* 选择文件并上传
*/
chooseFiles() {
const _extname = get_extname(this.fileExtname);
Ws.chooseAndUploadFile({
type: this.fileMediatype,
compressed: false,
sizeType: this.sizeType,
sourceType: this.sourceType,
// TODO 如果为空video 有问题
extension: _extname.length > 0 ? _extname : void 0,
count: this.limitLength - this.files.length,
//默认9
onChooseFile: this.chooseFileCallback,
onUploadProgress: (progressEvent) => {
this.setProgress(progressEvent, progressEvent.index);
}
}).then((result) => {
this.setSuccessAndError(result.tempFiles);
}).catch((err) => {
formatAppLog("log", "at uni_modules/uni-file-picker/components/uni-file-picker/uni-file-picker.vue:364", "选择失败", err);
});
},
/**
* 选择文件回调
* @param {Object} res
*/
async chooseFileCallback(res) {
const _extname = get_extname(this.fileExtname);
const is_one = Number(this.limitLength) === 1 && this.disablePreview && !this.disabled || this.returnType === "object";
if (is_one) {
this.files = [];
}
let {
filePaths,
files
} = get_files_and_is_max(res, _extname);
if (!(_extname && _extname.length > 0)) {
filePaths = res.tempFilePaths;
files = res.tempFiles;
}
let currentData = [];
for (let i2 = 0; i2 < files.length; i2++) {
if (this.limitLength - this.files.length <= 0)
break;
files[i2].uuid = Date.now();
let filedata = await get_file_data(files[i2], this.fileMediatype);
filedata.progress = 0;
filedata.status = "ready";
this.files.push(filedata);
currentData.push({
...filedata,
file: files[i2]
});
}
this.$emit("select", {
tempFiles: currentData,
tempFilePaths: filePaths
});
res.tempFiles = files;
if (!this.autoUpload || this.noSpace) {
res.tempFiles = [];
}
res.tempFiles.forEach((fileItem, index) => {
this.provider && (fileItem.provider = this.provider);
const fileNameSplit = fileItem.name.split(".");
const ext = fileNameSplit.pop();
const fileName = fileNameSplit.join(".").replace(/[\s\/\?<>\\:\*\|":]/g, "_");
fileItem.cloudPath = fileName + "_" + Date.now() + "_" + index + "." + ext;
});
},
/**
* 批传
* @param {Object} e
*/
uploadFiles(files) {
files = [].concat(files);
return uploadCloudFiles.call(this, files, 5, (res) => {
this.setProgress(res, res.index, true);
}).then((result) => {
this.setSuccessAndError(result);
return result;
}).catch((err) => {
formatAppLog("log", "at uni_modules/uni-file-picker/components/uni-file-picker/uni-file-picker.vue:437", err);
});
},
/**
* 成功或失败
*/
async setSuccessAndError(res, fn) {
let successData = [];
let errorData = [];
let tempFilePath = [];
let errorTempFilePath = [];
for (let i2 = 0; i2 < res.length; i2++) {
const item = res[i2];
const index = item.uuid ? this.files.findIndex((p2) => p2.uuid === item.uuid) : item.index;
if (index === -1 || !this.files)
break;
if (item.errMsg === "request:fail") {
this.files[index].url = item.path;
this.files[index].status = "error";
this.files[index].errMsg = item.errMsg;
errorData.push(this.files[index]);
errorTempFilePath.push(this.files[index].url);
} else {
this.files[index].errMsg = "";
this.files[index].fileID = item.url;
const reg = /cloud:\/\/([\w.]+\/?)\S*/;
if (reg.test(item.url)) {
this.files[index].url = await this.getTempFileURL(item.url);
} else {
this.files[index].url = item.url;
}
this.files[index].status = "success";
this.files[index].progress += 1;
successData.push(this.files[index]);
tempFilePath.push(this.files[index].fileID);
}
}
if (successData.length > 0) {
this.setEmit();
this.$emit("success", {
tempFiles: this.backObject(successData),
tempFilePaths: tempFilePath
});
}
if (errorData.length > 0) {
this.$emit("fail", {
tempFiles: this.backObject(errorData),
tempFilePaths: errorTempFilePath
});
}
},
/**
* 获取进度
* @param {Object} progressEvent
* @param {Object} index
* @param {Object} type
*/
setProgress(progressEvent, index, type) {
this.files.length;
const percentCompleted = Math.round(progressEvent.loaded * 100 / progressEvent.total);
let idx = index;
if (!type) {
idx = this.files.findIndex((p2) => p2.uuid === progressEvent.tempFile.uuid);
}
if (idx === -1 || !this.files[idx])
return;
this.files[idx].progress = percentCompleted - 1;
this.$emit("progress", {
index: idx,
progress: parseInt(percentCompleted),
tempFile: this.files[idx]
});
},
/**
* 删除文件
* @param {Object} index
*/
delFile(index) {
this.$emit("delete", {
index,
tempFile: this.files[index],
tempFilePath: this.files[index].url
});
this.files.splice(index, 1);
this.$nextTick(() => {
this.setEmit();
});
},
/**
* 获取文件名和后缀
* @param {Object} name
*/
getFileExt(name2) {
const last_len = name2.lastIndexOf(".");
const len = name2.length;
return {
name: name2.substring(0, last_len),
ext: name2.substring(last_len + 1, len)
};
},
/**
* 处理返回事件
*/
setEmit() {
let data = [];
if (this.returnType === "object") {
data = this.backObject(this.files)[0];
this.localValue = data ? data : null;
} else {
data = this.backObject(this.files);
if (!this.localValue) {
this.localValue = [];
}
this.localValue = [...data];
}
this.$emit("update:modelValue", this.localValue);
},
/**
* 处理返回参数
* @param {Object} files
*/
backObject(files) {
let newFilesData = [];
files.forEach((v2) => {
newFilesData.push({
extname: v2.extname,
fileType: v2.fileType,
image: v2.image,
name: v2.name,
path: v2.path,
size: v2.size,
fileID: v2.fileID,
url: v2.url,
// 修改删除一个文件后不能再上传的bug, #694
uuid: v2.uuid,
status: v2.status,
cloudPath: v2.cloudPath
});
});
return newFilesData;
},
async getTempFileURL(fileList) {
fileList = {
fileList: [].concat(fileList)
};
const urls = await Ws.getTempFileURL(fileList);
return urls.fileList[0].tempFileURL || "";
},
/**
* 获取父元素实例
*/
getForm(name2 = "uniForms") {
let parent = this.$parent;
let parentName = parent.$options.name;
while (parentName !== name2) {
parent = parent.$parent;
if (!parent)
return false;
parentName = parent.$options.name;
}
return parent;
2024-09-24 09:21:34 +00:00
}
}
2024-10-14 07:22:41 +00:00
};
function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
const _component_upload_image = vue.resolveComponent("upload-image");
const _component_upload_file = vue.resolveComponent("upload-file");
return vue.openBlock(), vue.createElementBlock("view", { class: "uni-file-picker" }, [
$props.title ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "uni-file-picker__header"
}, [
vue.createElementVNode(
"text",
{ class: "file-title" },
vue.toDisplayString($props.title),
1
/* TEXT */
),
vue.createElementVNode(
"text",
{ class: "file-count" },
vue.toDisplayString($options.filesList.length) + "/" + vue.toDisplayString($options.limitLength),
1
/* TEXT */
)
])) : vue.createCommentVNode("v-if", true),
$props.fileMediatype === "image" && $options.showType === "grid" ? (vue.openBlock(), vue.createBlock(_component_upload_image, {
key: 1,
readonly: $props.readonly,
"image-styles": $props.imageStyles,
"files-list": $options.filesList,
limit: $options.limitLength,
disablePreview: $props.disablePreview,
delIcon: $props.delIcon,
onUploadFiles: $options.uploadFiles,
onChoose: $options.choose,
onDelFile: $options.delFile
}, {
default: vue.withCtx(() => [
vue.renderSlot(_ctx.$slots, "default", {}, () => [
vue.createElementVNode("view", { class: "is-add" }, [
vue.createElementVNode("view", { class: "icon-add" }),
vue.createElementVNode("view", { class: "icon-add rotate" })
])
], true)
]),
_: 3
/* FORWARDED */
}, 8, ["readonly", "image-styles", "files-list", "limit", "disablePreview", "delIcon", "onUploadFiles", "onChoose", "onDelFile"])) : vue.createCommentVNode("v-if", true),
$props.fileMediatype !== "image" || $options.showType !== "grid" ? (vue.openBlock(), vue.createBlock(_component_upload_file, {
key: 2,
readonly: $props.readonly,
"list-styles": $props.listStyles,
"files-list": $options.filesList,
showType: $options.showType,
delIcon: $props.delIcon,
onUploadFiles: $options.uploadFiles,
onChoose: $options.choose,
onDelFile: $options.delFile
}, {
default: vue.withCtx(() => [
vue.renderSlot(_ctx.$slots, "default", {}, () => [
vue.createElementVNode("button", {
type: "primary",
size: "mini"
}, "选择文件")
], true)
]),
_: 3
/* FORWARDED */
}, 8, ["readonly", "list-styles", "files-list", "showType", "delIcon", "onUploadFiles", "onChoose", "onDelFile"])) : vue.createCommentVNode("v-if", true)
]);
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
const __easycom_0$2 = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["render", _sfc_render$4], ["__scopeId", "data-v-6223573f"], ["__file", "D:/projects/cxc-szcx-uniapp/uni_modules/uni-file-picker/components/uni-file-picker/uni-file-picker.vue"]]);
function qjAddApi(config) {
return https({
url: "/CxcQxj/cxcQxj/add",
method: "post",
data: config
});
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
function queryZwmcAndExaApi(username) {
return https({
url: "/CxcQxj/cxcQxj/queryZwmcByUsername",
method: "get",
data: {
username
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
});
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
function qjQueryByIdApi(config) {
return https({
url: "/CxcQxj/cxcQxj/queryById",
method: "get",
data: config
});
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
function queryDepByCode(code) {
return https({
url: "/sys/sysDepart/queryDepNameByDepCode",
method: "get",
data: {
code
}
});
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
function obj2strClass(obj) {
let classess = "";
for (let key in obj) {
const val = obj[key];
if (val) {
classess += `${key} `;
}
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
return classess;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
function obj2strStyle(obj) {
let style = "";
for (let key in obj) {
const val = obj[key];
style += `${key}:${val};`;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
return style;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
const _sfc_main$o = {
name: "uni-easyinput",
emits: [
"click",
"iconClick",
"update:modelValue",
"input",
"focus",
"blur",
"confirm",
"clear",
"eyes",
"change",
"keyboardheightchange"
],
model: {
prop: "modelValue",
event: "update:modelValue"
},
options: {
virtualHost: true
},
inject: {
form: {
from: "uniForm",
default: null
},
formItem: {
from: "uniFormItem",
default: null
}
},
props: {
name: String,
value: [Number, String],
modelValue: [Number, String],
type: {
type: String,
default: "text"
},
clearable: {
type: Boolean,
default: true
},
autoHeight: {
type: Boolean,
default: false
},
placeholder: {
type: String,
default: " "
},
placeholderStyle: String,
focus: {
type: Boolean,
default: false
},
disabled: {
type: Boolean,
default: false
},
maxlength: {
type: [Number, String],
default: 140
},
confirmType: {
type: String,
default: "done"
},
clearSize: {
type: [Number, String],
default: 24
},
inputBorder: {
type: Boolean,
default: true
},
prefixIcon: {
type: String,
default: ""
},
suffixIcon: {
type: String,
default: ""
},
trim: {
type: [Boolean, String],
default: false
},
cursorSpacing: {
type: Number,
default: 0
},
passwordIcon: {
type: Boolean,
default: true
},
adjustPosition: {
type: Boolean,
default: true
},
primaryColor: {
type: String,
default: "#2979ff"
},
styles: {
type: Object,
default() {
return {
color: "#333",
backgroundColor: "#fff",
disableColor: "#F7F6F6",
borderColor: "#e5e5e5"
};
}
},
errorMessage: {
type: [String, Boolean],
default: ""
}
},
data() {
return {
focused: false,
val: "",
showMsg: "",
border: false,
isFirstBorder: false,
showClearIcon: false,
showPassword: false,
focusShow: false,
localMsg: "",
isEnter: false
// 用于判断当前是否是使用回车操作
};
},
computed: {
// 输入框内是否有值
isVal() {
const val = this.val;
if (val || val === 0) {
return true;
}
return false;
},
msg() {
return this.localMsg || this.errorMessage;
},
// 因为uniapp的input组件的maxlength组件必须要数值这里转为数值用户可以传入字符串数值
inputMaxlength() {
return Number(this.maxlength);
},
// 处理外层样式的style
boxStyle() {
return `color:${this.inputBorder && this.msg ? "#e43d33" : this.styles.color};`;
},
// input 内容的类和样式处理
inputContentClass() {
return obj2strClass({
"is-input-border": this.inputBorder,
"is-input-error-border": this.inputBorder && this.msg,
"is-textarea": this.type === "textarea",
"is-disabled": this.disabled,
"is-focused": this.focusShow
});
},
inputContentStyle() {
const focusColor = this.focusShow ? this.primaryColor : this.styles.borderColor;
const borderColor = this.inputBorder && this.msg ? "#dd524d" : focusColor;
return obj2strStyle({
"border-color": borderColor || "#e5e5e5",
"background-color": this.disabled ? this.styles.disableColor : this.styles.backgroundColor
});
},
// input右侧样式
inputStyle() {
const paddingRight = this.type === "password" || this.clearable || this.prefixIcon ? "" : "10px";
return obj2strStyle({
"padding-right": paddingRight,
"padding-left": this.prefixIcon ? "" : "10px"
});
}
},
watch: {
value(newVal) {
if (newVal === null) {
this.val = "";
return;
}
this.val = newVal;
},
modelValue(newVal) {
if (newVal === null) {
this.val = "";
return;
}
this.val = newVal;
},
focus(newVal) {
this.$nextTick(() => {
this.focused = this.focus;
this.focusShow = this.focus;
});
}
},
created() {
this.init();
if (this.form && this.formItem) {
this.$watch("formItem.errMsg", (newVal) => {
this.localMsg = newVal;
});
}
},
mounted() {
this.$nextTick(() => {
this.focused = this.focus;
this.focusShow = this.focus;
2024-09-24 09:21:34 +00:00
});
2024-10-14 07:22:41 +00:00
},
methods: {
/**
* 初始化变量值
*/
init() {
if (this.value || this.value === 0) {
this.val = this.value;
} else if (this.modelValue || this.modelValue === 0 || this.modelValue === "") {
this.val = this.modelValue;
} else {
this.val = "";
}
},
/**
* 点击图标时触发
* @param {Object} type
*/
onClickIcon(type) {
this.$emit("iconClick", type);
},
/**
* 显示隐藏内容密码框时生效
*/
onEyes() {
this.showPassword = !this.showPassword;
this.$emit("eyes", this.showPassword);
},
/**
* 输入时触发
* @param {Object} event
*/
onInput(event) {
let value = event.detail.value;
if (this.trim) {
if (typeof this.trim === "boolean" && this.trim) {
value = this.trimStr(value);
}
if (typeof this.trim === "string") {
value = this.trimStr(value, this.trim);
}
}
if (this.errMsg)
this.errMsg = "";
this.val = value;
this.$emit("input", value);
this.$emit("update:modelValue", value);
},
/**
* 外部调用方法
* 获取焦点时触发
* @param {Object} event
*/
onFocus() {
this.$nextTick(() => {
this.focused = true;
});
this.$emit("focus", null);
},
_Focus(event) {
this.focusShow = true;
this.$emit("focus", event);
},
/**
* 外部调用方法
* 失去焦点时触发
* @param {Object} event
*/
onBlur() {
this.focused = false;
this.$emit("blur", null);
},
_Blur(event) {
event.detail.value;
this.focusShow = false;
this.$emit("blur", event);
if (this.isEnter === false) {
this.$emit("change", this.val);
}
if (this.form && this.formItem) {
const { validateTrigger } = this.form;
if (validateTrigger === "blur") {
this.formItem.onFieldChange();
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
}
},
/**
* 按下键盘的发送键
* @param {Object} e
*/
onConfirm(e2) {
this.$emit("confirm", this.val);
this.isEnter = true;
this.$emit("change", this.val);
this.$nextTick(() => {
this.isEnter = false;
});
},
/**
* 清理内容
* @param {Object} event
*/
onClear(event) {
this.val = "";
this.$emit("input", "");
this.$emit("update:modelValue", "");
this.$emit("clear");
},
/**
* 键盘高度发生变化的时候触发此事件
* 兼容性微信小程序2.7.0+App 3.1.0+
* @param {Object} event
*/
onkeyboardheightchange(event) {
this.$emit("keyboardheightchange", event);
},
/**
* 去除空格
*/
trimStr(str, pos = "both") {
if (pos === "both") {
return str.trim();
} else if (pos === "left") {
return str.trimLeft();
} else if (pos === "right") {
return str.trimRight();
} else if (pos === "start") {
return str.trimStart();
} else if (pos === "end") {
return str.trimEnd();
} else if (pos === "all") {
return str.replace(/\s+/g, "");
} else if (pos === "none") {
return str;
}
return str;
2024-09-24 09:21:34 +00:00
}
}
2024-10-14 07:22:41 +00:00
};
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_1$1);
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass(["uni-easyinput", { "uni-easyinput-error": $options.msg }]),
style: vue.normalizeStyle($options.boxStyle)
},
[
vue.createElementVNode(
"view",
{
class: vue.normalizeClass(["uni-easyinput__content", $options.inputContentClass]),
style: vue.normalizeStyle($options.inputContentStyle)
},
[
$props.prefixIcon ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
key: 0,
class: "content-clear-icon",
type: $props.prefixIcon,
color: "#c0c4cc",
onClick: _cache[0] || (_cache[0] = ($event) => $options.onClickIcon("prefix")),
size: "22"
}, null, 8, ["type"])) : vue.createCommentVNode("v-if", true),
vue.renderSlot(_ctx.$slots, "left", {}, void 0, true),
$props.type === "textarea" ? (vue.openBlock(), vue.createElementBlock("textarea", {
key: 1,
class: vue.normalizeClass(["uni-easyinput__content-textarea", { "input-padding": $props.inputBorder }]),
name: $props.name,
value: $data.val,
placeholder: $props.placeholder,
placeholderStyle: $props.placeholderStyle,
disabled: $props.disabled,
"placeholder-class": "uni-easyinput__placeholder-class",
maxlength: $options.inputMaxlength,
focus: $data.focused,
autoHeight: $props.autoHeight,
"cursor-spacing": $props.cursorSpacing,
"adjust-position": $props.adjustPosition,
onInput: _cache[1] || (_cache[1] = (...args) => $options.onInput && $options.onInput(...args)),
onBlur: _cache[2] || (_cache[2] = (...args) => $options._Blur && $options._Blur(...args)),
onFocus: _cache[3] || (_cache[3] = (...args) => $options._Focus && $options._Focus(...args)),
onConfirm: _cache[4] || (_cache[4] = (...args) => $options.onConfirm && $options.onConfirm(...args)),
onKeyboardheightchange: _cache[5] || (_cache[5] = (...args) => $options.onkeyboardheightchange && $options.onkeyboardheightchange(...args))
}, null, 42, ["name", "value", "placeholder", "placeholderStyle", "disabled", "maxlength", "focus", "autoHeight", "cursor-spacing", "adjust-position"])) : (vue.openBlock(), vue.createElementBlock("input", {
key: 2,
type: $props.type === "password" ? "text" : $props.type,
class: "uni-easyinput__content-input",
style: vue.normalizeStyle($options.inputStyle),
name: $props.name,
value: $data.val,
password: !$data.showPassword && $props.type === "password",
placeholder: $props.placeholder,
placeholderStyle: $props.placeholderStyle,
"placeholder-class": "uni-easyinput__placeholder-class",
disabled: $props.disabled,
maxlength: $options.inputMaxlength,
focus: $data.focused,
confirmType: $props.confirmType,
"cursor-spacing": $props.cursorSpacing,
"adjust-position": $props.adjustPosition,
onFocus: _cache[6] || (_cache[6] = (...args) => $options._Focus && $options._Focus(...args)),
onBlur: _cache[7] || (_cache[7] = (...args) => $options._Blur && $options._Blur(...args)),
onInput: _cache[8] || (_cache[8] = (...args) => $options.onInput && $options.onInput(...args)),
onConfirm: _cache[9] || (_cache[9] = (...args) => $options.onConfirm && $options.onConfirm(...args)),
onKeyboardheightchange: _cache[10] || (_cache[10] = (...args) => $options.onkeyboardheightchange && $options.onkeyboardheightchange(...args))
}, null, 44, ["type", "name", "value", "password", "placeholder", "placeholderStyle", "disabled", "maxlength", "focus", "confirmType", "cursor-spacing", "adjust-position"])),
$props.type === "password" && $props.passwordIcon ? (vue.openBlock(), vue.createElementBlock(
vue.Fragment,
{ key: 3 },
[
vue.createCommentVNode(" 开启密码时显示小眼睛 "),
$options.isVal ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
key: 0,
class: vue.normalizeClass(["content-clear-icon", { "is-textarea-icon": $props.type === "textarea" }]),
type: $data.showPassword ? "eye-slash-filled" : "eye-filled",
size: 22,
color: $data.focusShow ? $props.primaryColor : "#c0c4cc",
onClick: $options.onEyes
}, null, 8, ["class", "type", "color", "onClick"])) : vue.createCommentVNode("v-if", true)
],
64
/* STABLE_FRAGMENT */
)) : vue.createCommentVNode("v-if", true),
$props.suffixIcon ? (vue.openBlock(), vue.createElementBlock(
vue.Fragment,
{ key: 4 },
[
$props.suffixIcon ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
key: 0,
class: "content-clear-icon",
type: $props.suffixIcon,
color: "#c0c4cc",
onClick: _cache[11] || (_cache[11] = ($event) => $options.onClickIcon("suffix")),
size: "22"
}, null, 8, ["type"])) : vue.createCommentVNode("v-if", true)
],
64
/* STABLE_FRAGMENT */
)) : (vue.openBlock(), vue.createElementBlock(
vue.Fragment,
{ key: 5 },
[
$props.clearable && $options.isVal && !$props.disabled && $props.type !== "textarea" ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
key: 0,
class: vue.normalizeClass(["content-clear-icon", { "is-textarea-icon": $props.type === "textarea" }]),
type: "clear",
size: $props.clearSize,
color: $options.msg ? "#dd524d" : $data.focusShow ? $props.primaryColor : "#c0c4cc",
onClick: $options.onClear
}, null, 8, ["class", "size", "color", "onClick"])) : vue.createCommentVNode("v-if", true)
],
64
/* STABLE_FRAGMENT */
)),
vue.renderSlot(_ctx.$slots, "right", {}, void 0, true)
],
6
/* CLASS, STYLE */
)
],
6
/* CLASS, STYLE */
);
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
const __easycom_1 = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["render", _sfc_render$3], ["__scopeId", "data-v-09fd5285"], ["__file", "D:/projects/cxc-szcx-uniapp/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue"]]);
function isString(data) {
return typeof data === "string";
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
function paging(data, PAGENUM = 50) {
if (!Array.isArray(data) || !data.length)
return data;
const pages2 = [];
data.forEach((item, index) => {
const i2 = Math.floor(index / PAGENUM);
if (!pages2[i2]) {
pages2[i2] = [];
}
pages2[i2].push(item);
});
return pages2;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
__name: "data-select-item",
props: {
node: {
type: Object,
default: () => ({})
},
choseParent: {
type: Boolean,
default: true
},
dataLabel: {
type: String,
default: "name"
},
dataValue: {
type: String,
default: "value"
},
dataChildren: {
type: String,
default: "children"
},
border: {
type: Boolean,
default: false
},
linkage: {
type: Boolean,
default: false
},
lazyLoadChildren: {
type: Boolean,
default: false
},
level: {
type: Number,
default: 0
}
},
setup(__props) {
const { nodeClick, nameClick, loadNode, initData, addNode } = vue.inject("nodeFn");
const props = __props;
const listData = vue.ref([]);
const clearTimerList = vue.ref([]);
const loadingArr = vue.ref([]);
vue.watchEffect(() => {
if (props.node.showChildren && props.node[props.dataChildren] && props.node[props.dataChildren].length) {
resetClearTimerList();
renderTree(props.node[props.dataChildren]);
}
2024-09-24 09:21:34 +00:00
});
2024-10-14 07:22:41 +00:00
function resetClearTimerList() {
const list = [...clearTimerList.value];
clearTimerList.value = [];
list.forEach((fn) => fn());
}
function renderTree(arr) {
const pagingArr = paging(arr);
listData.value = (pagingArr == null ? void 0 : pagingArr[0]) || [];
lazyRenderList(pagingArr, 1);
}
function lazyRenderList(arr, startIndex) {
for (let i2 = startIndex; i2 < arr.length; i2++) {
let timer = null;
timer = setTimeout(() => {
listData.value.push(...arr[i2]);
}, i2 * 500);
clearTimerList.push(() => clearTimeout(timer));
}
}
function handleNameClick(node) {
var _a;
if (!node.visible)
return;
if (!((_a = node[props.dataChildren]) == null ? void 0 : _a.length) && props.lazyLoadChildren) {
loadingArr.value.push(node[props.dataValue].toString());
loadNode(node).then((res) => {
addNode(node, initData(res, node.visible));
}).finally(() => {
loadingArr.value = [];
});
} else {
nameClick(node);
}
}
return (_ctx, _cache) => {
const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_1$1);
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass(["customthree-tree-select-content", {
border: __props.border && __props.node[__props.dataChildren] && __props.node[__props.dataChildren].length && __props.node.showChildren
}]),
style: vue.normalizeStyle({ marginLeft: `${__props.level ? 14 : 0}px` })
},
[
__props.node.visible ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "custom-tree-select-item"
}, [
vue.createElementVNode("view", { class: "item-content" }, [
vue.createElementVNode("view", {
class: "left",
onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => handleNameClick(__props.node), ["stop"]))
}, [
vue.createElementVNode("view", { class: "icon-group" }, [
__props.node[__props.dataChildren] && __props.node[__props.dataChildren].length ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 0,
class: vue.normalizeClass(["right-icon", { active: __props.node.showChildren }])
},
[
vue.createVNode(_component_uni_icons, {
type: "right",
size: "14",
color: "#333"
})
],
2
/* CLASS */
)) : (vue.openBlock(), vue.createElementBlock("view", {
key: 1,
class: "smallcircle-filled"
}, [
vue.createVNode(_component_uni_icons, {
class: "smallcircle-filled-icon",
type: "smallcircle-filled",
size: "10",
color: "#333"
})
]))
]),
loadingArr.value.includes(__props.node[props.dataValue].toString()) ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "loading-icon-box"
}, [
vue.createVNode(_component_uni_icons, {
class: "loading-icon",
type: "spinner-cycle",
size: "14",
color: "#333"
})
])) : vue.createCommentVNode("v-if", true),
vue.createElementVNode(
"view",
{
class: "name",
style: vue.normalizeStyle(__props.node.disabled ? "color: #999" : "")
},
[
vue.createElementVNode(
"text",
null,
vue.toDisplayString(__props.node[__props.dataLabel]),
1
/* TEXT */
)
],
4
/* STYLE */
)
]),
__props.choseParent || !__props.choseParent && !__props.node[__props.dataChildren] || !__props.choseParent && __props.node[__props.dataChildren] && !__props.node[__props.dataChildren].length ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 0,
class: vue.normalizeClass(["check-box", { disabled: __props.node.disabled }]),
onClick: _cache[1] || (_cache[1] = vue.withModifiers(($event) => !__props.node.disabled && vue.unref(nodeClick)(__props.node), ["stop"]))
},
[
!__props.node.checked && __props.node.partChecked && __props.linkage ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "part-checked"
})) : vue.createCommentVNode("v-if", true),
__props.node.checked ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
key: 1,
type: "checkmarkempty",
size: "18",
color: __props.node.disabled ? "#333" : "#007aff"
}, null, 8, ["color"])) : vue.createCommentVNode("v-if", true)
],
2
/* CLASS */
)) : vue.createCommentVNode("v-if", true)
])
])) : vue.createCommentVNode("v-if", true),
__props.node.showChildren && __props.node[__props.dataChildren] && __props.node[__props.dataChildren].length ? (vue.openBlock(), vue.createElementBlock("view", { key: 1 }, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(listData.value, (item) => {
return vue.openBlock(), vue.createBlock(dataSelectItem, {
key: item[__props.dataValue],
node: item,
dataLabel: __props.dataLabel,
dataValue: __props.dataValue,
dataChildren: __props.dataChildren,
choseParent: __props.choseParent,
lazyLoadChildren: __props.lazyLoadChildren,
border: __props.border,
linkage: __props.linkage,
level: __props.level + 1
}, null, 8, ["node", "dataLabel", "dataValue", "dataChildren", "choseParent", "lazyLoadChildren", "border", "linkage", "level"]);
}),
128
/* KEYED_FRAGMENT */
))
])) : vue.createCommentVNode("v-if", true)
],
6
/* CLASS, STYLE */
);
};
2024-09-24 09:21:34 +00:00
}
});
2024-10-14 07:22:41 +00:00
const dataSelectItem = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__scopeId", "data-v-3a65eef7"], ["__file", "D:/projects/cxc-szcx-uniapp/components/treeSelect/data-select-item.vue"]]);
const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
__name: "treeSelect",
props: {
canSelectAll: {
type: Boolean,
default: false
},
safeArea: {
type: Boolean,
default: true
},
search: {
type: Boolean,
default: false
},
clearResetSearch: {
type: Boolean,
default: false
},
animation: {
type: Boolean,
default: true
},
"is-mask-click": {
type: Boolean,
default: true
},
"mask-background-color": {
type: String,
default: "rgba(0,0,0,0.4)"
},
"background-color": {
type: String,
default: "none"
},
"safe-area": {
type: Boolean,
default: true
},
choseParent: {
type: Boolean,
default: false
},
placeholder: {
type: String,
default: "请选择"
},
confirmText: {
type: String,
default: "确认"
},
confirmTextColor: {
type: String,
default: "#007aff"
},
dataSource: {
type: Array,
default: () => []
},
dataLabel: {
type: String,
default: "name"
},
dataValue: {
type: String,
default: "id"
},
dataChildren: {
type: String,
default: "children"
},
linkage: {
type: Boolean,
default: false
},
removeLinkage: {
type: Boolean,
default: true
},
clearable: {
type: Boolean,
default: false
},
mutiple: {
type: Boolean,
default: false
},
disabled: {
type: Boolean,
default: false
},
deleteSource: {
type: Boolean,
default: false
},
showChildren: {
type: Boolean,
default: false
},
border: {
type: Boolean,
default: false
},
lazyLoadChildren: {
type: Boolean,
default: false
},
load: {
type: Function,
default: function() {
}
},
modelValue: {
type: [Array, String],
default: () => []
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
},
emits: ["update:modelValue", "change", "maskClick", "select-change", "removeSelect"],
setup(__props, { emit: __emit }) {
const props = __props;
const emits = __emit;
const contentHeight = vue.ref("500px");
const treeData = vue.ref([]);
const filterTreeData = vue.ref([]);
const clearTimerList = vue.ref([]);
const selectedListBaseinfo = vue.ref([]);
const showPopup = vue.ref(false);
const isSelectedAll = vue.ref(false);
const scrollTop = vue.ref(0);
const searchStr = vue.ref("");
const popup = vue.ref(null);
const partCheckedSet = /* @__PURE__ */ new Set();
vue.provide("nodeFn", {
nodeClick: handleNodeClick,
nameClick: handleHideChildren,
loadNode: props.load,
initData,
addNode
});
const selectList = vue.computed(() => {
const newVal = props.modelValue === null ? "" : props.modelValue;
return isString(newVal) ? newVal.length ? newVal.split(",") : [] : newVal.map((item) => item.toString());
});
vue.onMounted(() => {
getContentHeight(uni.getSystemInfoSync());
});
function getContentHeight({ screenHeight }) {
contentHeight.value = `${Math.floor(screenHeight * 0.7)}px`;
}
vue.watch(
() => props.dataSource,
(newVal) => {
if (newVal) {
treeData.value = initData(newVal);
if (showPopup.value) {
resetClearTimerList();
renderTree(treeData.value);
}
}
},
{ immediate: true, deep: true }
);
vue.watch(
() => props.modelValue,
(newVal) => {
const ids = newVal ? Array.isArray(newVal) ? newVal : newVal.split(",") : [];
changeStatus(treeData.value, ids, true);
filterTreeData.value.length && changeStatus(filterTreeData.value, ids);
},
{ immediate: true }
);
function goTop() {
scrollTop.val = 10;
vue.nextTick(() => {
scrollTop.value = 0;
2024-09-24 09:21:34 +00:00
});
2024-10-14 07:22:41 +00:00
}
function handleSearch(isClear = false) {
resetClearTimerList();
if (isClear) {
if (props.clearResetSearch) {
renderTree(treeData.value);
}
} else {
renderTree(searchValue(searchStr.value, treeData.value));
}
goTop();
uni.hideKeyboard();
}
function searchValue(str, arr) {
const res = [];
arr.forEach((item) => {
var _a, _b;
if (item.visible) {
if (item[props.dataLabel].toString().toLowerCase().indexOf(str.toLowerCase()) > -1) {
res.push(item);
} else {
if ((_a = item[props.dataChildren]) == null ? void 0 : _a.length) {
const data = searchValue(str, item[props.dataChildren]);
if (data == null ? void 0 : data.length) {
if (str && !item.showChildren && ((_b = item[props.dataChildren]) == null ? void 0 : _b.length)) {
item.showChildren = true;
}
res.push({
...item,
[props.dataChildren]: data
});
}
}
}
}
2024-09-24 09:21:34 +00:00
});
2024-10-14 07:22:41 +00:00
return res;
}
async function open2() {
if (props.disabled)
return;
showPopup.value = true;
popup.value.open();
renderTree(treeData.value);
}
function close() {
popup.value.close();
}
function change(data) {
if (!data.show) {
resetClearTimerList();
searchStr.value = "";
showPopup.value = false;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
emits("change", data);
}
function maskClick() {
emits("maskClick");
}
function initData(arr, parentVisible) {
var _a;
if (!Array.isArray(arr))
return [];
const res = [];
for (let i2 = 0; i2 < arr.length; i2++) {
const obj = {
[props.dataLabel]: arr[i2][props.dataLabel],
[props.dataValue]: arr[i2][props.dataValue]
};
obj.checked = selectList.value.includes(arr[i2][props.dataValue].toString());
obj.disabled = Boolean(arr[i2].disabled);
obj.partChecked = Boolean(arr[i2].partChecked === void 0 ? false : arr[i2].partChecked);
obj.partChecked && obj.partCheckedSet.add(obj[props.dataValue]);
!obj.partChecked && (isSelectedAll.value = false);
const parentVisibleState = parentVisible === void 0 ? true : parentVisible;
const curVisibleState = arr[i2].visible === void 0 ? true : Boolean(arr[i2].visible);
if (parentVisibleState === curVisibleState) {
obj.visible = parentVisibleState;
} else if (!parentVisibleState || !curVisibleState) {
obj.visible = false;
} else {
obj.visible = true;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
obj.showChildren = "showChildren" in arr[i2] && arr[i2].showChildren != void 0 ? arr[i2].showChildren : props.showChildren;
if (arr[i2].visible && !arr[i2].disabled && !arr[i2].checked) {
isSelectedAll.value = false;
}
if ((_a = arr[i2][props.dataChildren]) == null ? void 0 : _a.length) {
obj[props.dataChildren] = initData(arr[i2][props.dataChildren], obj.visible);
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
res.push(obj);
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
return res;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
function addNode(node, children) {
getReflectNode(node, treeData.value)[props.dataChildren] = children;
handleHideChildren(node);
}
function resetClearTimerList() {
const list = [...clearTimerList.value];
clearTimerList.value = [];
list.forEach((fn) => fn());
}
function renderTree(arr) {
const pagingArr = paging(arr);
filterTreeData.value = (pagingArr == null ? void 0 : pagingArr[0]) || [];
lazyRenderList(pagingArr, 1);
}
function lazyRenderList(arr, startIndex) {
for (let i2 = startIndex; i2 < arr.length; i2++) {
let timer = null;
timer = setTimeout(() => {
filterTreeData.value.push(...arr[i2]);
}, i2 * 500);
clearTimerList.push(() => clearTimeout(timer));
}
}
function changeStatus(list, ids, needEmit = false) {
var _a;
const arr = [...list];
let flag = true;
needEmit && (selectedListBaseinfo.value = []);
while (arr.length) {
const item = arr.shift();
if (ids.includes(item[props.dataValue].toString())) {
item.checked = true;
item.partChecked = false;
partCheckedSet.delete(item[props.dataValue]);
needEmit && selectedListBaseinfo.value.push(item);
} else {
item.checked = false;
if (item.visible && !item.disabled) {
flag = false;
}
if (partCheckedSet.has(item[props.dataValue])) {
item.partChecked = true;
} else {
item.partChecked = false;
}
}
if ((_a = item[props.dataChildren]) == null ? void 0 : _a.length) {
arr.push(...item[props.dataChildren]);
}
}
isSelectedAll.value = flag;
needEmit && emits("select-change", [...selectedListBaseinfo.value]);
}
function removeSelectedItem(node) {
isSelectedAll.value = false;
if (props.linkage) {
handleNodeClick(node, false);
emits("removeSelect", node);
} else {
const emitData = selectList.value.filter((item) => item !== node[props.dataValue].toString());
emits("removeSelect", node);
emits("update:modelValue", isString(props.modelValue) ? emitData.join(",") : emitData);
}
}
function getReflectNode(node, arr) {
var _a;
const array = [...arr];
while (array.length) {
const item = array.shift();
if (item[props.dataValue] === node[props.dataValue]) {
return item;
}
if ((_a = item[props.dataChildren]) == null ? void 0 : _a.length) {
array.push(...item[props.dataChildren]);
}
}
2024-09-24 09:21:34 +00:00
return {};
}
2024-10-14 07:22:41 +00:00
function getChildren(node) {
var _a;
if (!((_a = node[props.dataChildren]) == null ? void 0 : _a.length))
return [];
const res = node[props.dataChildren].reduce((pre, val) => {
if (val.visible) {
return [...pre, val];
}
return pre;
}, []);
for (let i2 = 0; i2 < node[props.dataChildren].length; i2++) {
res.push(...getChildren(node[props.dataChildren][i2]));
}
return res;
}
function getParentNode(target, arr) {
var _a;
let res = [];
for (let i2 = 0; i2 < arr.length; i2++) {
if (arr[i2][props.dataValue] === target[props.dataValue]) {
return true;
}
if ((_a = arr[i2][props.dataChildren]) == null ? void 0 : _a.length) {
const childRes = getParentNode(target, arr[i2][props.dataChildren]);
if (typeof childRes === "boolean" && childRes) {
res = [arr[i2]];
} else if (Array.isArray(childRes) && childRes.length) {
res = [...childRes, arr[i2]];
}
}
}
return res;
}
function handleNodeClick(data, status) {
const node = getReflectNode(data, treeData.value);
node.checked = typeof status === "boolean" ? status : !node.checked;
node.partChecked = false;
partCheckedSet.delete(node[props.dataValue]);
if (!props.mutiple) {
let emitData = [];
if (node.checked) {
emitData = [node[props.dataValue].toString()];
}
emits("update:modelValue", isString(props.modelValue) ? emitData.join(",") : emitData);
} else {
if (!props.linkage) {
let emitData = null;
if (node.checked) {
emitData = Array.from(/* @__PURE__ */ new Set([...selectList.value, node[props.dataValue].toString()]));
} else {
emitData = selectList.value.filter((id) => id !== node[props.dataValue].toString());
}
emits("update:modelValue", isString(props.modelValue) ? emitData.join(",") : emitData);
} else {
let emitData = [...selectList.value];
const parentNodes = getParentNode(node, treeData.value);
const childrenVal = getChildren(node).filter((item) => !item.disabled);
if (node.checked) {
emitData = Array.from(/* @__PURE__ */ new Set([...emitData, node[props.dataValue].toString()]));
if (childrenVal.length) {
emitData = Array.from(
/* @__PURE__ */ new Set([...emitData, ...childrenVal.map((item) => item[props.dataValue].toString())])
);
childrenVal.forEach((childNode) => {
childNode.partChecked = false;
partCheckedSet.delete(childNode[props.dataValue]);
});
}
if (parentNodes.length) {
let flag = false;
while (parentNodes.length) {
const item = parentNodes.shift();
if (!item.disabled) {
if (flag) {
item.partChecked = true;
partCheckedSet.add(item[props.dataValue]);
} else {
const allChecked = item[props.dataChildren].filter((node2) => node2.visible && !node2.disabled).every((node2) => node2.checked);
if (allChecked) {
item.checked = true;
item.partChecked = false;
partCheckedSet.delete(item[props.dataValue]);
emitData = Array.from(/* @__PURE__ */ new Set([...emitData, item[props.dataValue].toString()]));
} else {
item.partChecked = true;
partCheckedSet.add(item[props.dataValue]);
flag = true;
}
}
}
}
}
} else {
emitData = emitData.filter((id) => id !== node[props.dataValue].toString());
if (childrenVal.length) {
childrenVal.forEach((childNode) => {
emitData = emitData.filter((id) => id !== childNode[props.dataValue].toString());
});
}
if (parentNodes.length) {
parentNodes.forEach((parentNode) => {
if (emitData.includes(parentNode[props.dataValue].toString())) {
parentNode.checked = false;
}
emitData = emitData.filter((id) => id !== parentNode[props.dataValue].toString());
const hasChecked = parentNode[props.dataChildren].filter((node2) => node2.visible && !node2.disabled).some((node2) => node2.checked || node2.partChecked);
parentNode.partChecked = hasChecked;
if (hasChecked) {
partCheckedSet.add(parentNode[props.dataValue]);
} else {
partCheckedSet.delete(parentNode[props.dataValue]);
}
});
}
}
emits("update:modelValue", isString(props.modelValue) ? emitData.join(",") : emitData);
}
2024-09-24 09:21:34 +00:00
}
}
2024-10-14 07:22:41 +00:00
function handleHideChildren(node) {
const status = !node.showChildren;
getReflectNode(node, treeData.value).showChildren = status;
getReflectNode(node, filterTreeData.value).showChildren = status;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
function handleSelectAll() {
isSelectedAll.value = !isSelectedAll.value;
if (isSelectedAll.value) {
if (!props.mutiple) {
uni.showToast({
title: "单选模式下不能全选",
icon: "none",
duration: 1e3
});
return;
}
let emitData = [];
treeData.value.forEach((item) => {
var _a;
if (item.visible || item.disabled && item.checked) {
emitData = Array.from(/* @__PURE__ */ new Set([...emitData, item[props.dataValue].toString()]));
if ((_a = item[props.dataChildren]) == null ? void 0 : _a.length) {
emitData = Array.from(
/* @__PURE__ */ new Set([
...emitData,
...getChildren(item).filter((item2) => !item2.disabled || item2.disabled && item2.checked).map((item2) => item2[props.dataValue].toString())
])
);
}
}
});
emits("update:modelValue", isString(props.modelValue) ? emitData.join(",") : emitData);
} else {
clearSelectList();
}
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
function clearSelectList() {
if (props.disabled)
return;
partCheckedSet.clear();
const emitData = [];
selectedListBaseinfo.value.forEach((node) => {
if (node.visible && node.checked && node.disabled) {
emitData.push(node[props.dataValue]);
}
});
emits("update:modelValue", isString(props.modelValue) ? emitData.join(",") : emitData);
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
return (_ctx, _cache) => {
const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_1$1);
const _component_uni_easyinput = resolveEasycom(vue.resolveDynamicComponent("uni-easyinput"), __easycom_1);
const _component_uni_popup = resolveEasycom(vue.resolveDynamicComponent("uni-popup"), __easycom_2);
return vue.openBlock(), vue.createElementBlock(
vue.Fragment,
null,
[
vue.createElementVNode(
"view",
{
class: vue.normalizeClass(["select-list", { disabled: __props.disabled }, { active: selectList.value.length }]),
onClick: open2
},
[
vue.createElementVNode("view", { class: "left" }, [
selectList.value.length ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "select-items"
}, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(selectedListBaseinfo.value, (item) => {
return vue.openBlock(), vue.createElementBlock("view", {
class: "select-item",
key: item[__props.dataValue]
}, [
vue.createElementVNode("view", { class: "name" }, [
vue.createElementVNode(
"text",
null,
vue.toDisplayString(item[__props.dataLabel]),
1
/* TEXT */
)
]),
!__props.disabled && !item.disabled && __props.deleteSource ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "close",
onClick: vue.withModifiers(($event) => removeSelectedItem(item), ["stop"])
}, [
vue.createVNode(_component_uni_icons, {
type: "closeempty",
size: "16",
color: "#999"
})
], 8, ["onClick"])) : vue.createCommentVNode("v-if", true)
]);
}),
128
/* KEYED_FRAGMENT */
))
])) : (vue.openBlock(), vue.createElementBlock("view", {
key: 1,
class: "no-data"
}, [
vue.createElementVNode(
"text",
null,
vue.toDisplayString(__props.placeholder),
1
/* TEXT */
)
]))
]),
vue.createElementVNode("view", null, [
!selectList.value.length || !__props.clearable ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
key: 0,
type: "bottom",
color: "#333333"
})) : vue.createCommentVNode("v-if", true),
vue.createElementVNode("view", {
onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => {
}, ["stop"]))
}, [
selectList.value.length && __props.clearable ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
key: 0,
type: "clear",
size: "24",
color: "#c0c4cc",
onClick: clearSelectList
})) : vue.createCommentVNode("v-if", true)
])
])
],
2
/* CLASS */
),
vue.createVNode(_component_uni_popup, {
ref_key: "popup",
ref: popup,
animation: __props.animation,
"is-mask-click": _ctx.isMaskClick,
"mask-background-color": _ctx.maskBackgroundColor,
"background-color": _ctx.backgroundColor,
"safe-area": __props.safeArea,
type: "bottom",
onChange: change,
onMaskClick: maskClick
}, {
default: vue.withCtx(() => [
vue.createElementVNode(
"view",
{
class: "popup-content",
style: vue.normalizeStyle({ height: contentHeight.value })
},
[
vue.createElementVNode("view", { class: "title" }, [
__props.mutiple && __props.canSelectAll ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "left",
onClick: handleSelectAll
}, [
vue.createElementVNode(
"text",
null,
vue.toDisplayString(isSelectedAll.value ? "取消全选" : "全选"),
1
/* TEXT */
)
])) : vue.createCommentVNode("v-if", true),
vue.createElementVNode("view", { class: "center" }, [
vue.createElementVNode(
"text",
null,
vue.toDisplayString(__props.placeholder),
1
/* TEXT */
)
]),
vue.createElementVNode(
"view",
{
class: "right",
style: vue.normalizeStyle({ color: __props.confirmTextColor }),
onClick: close
},
[
vue.createElementVNode(
"text",
null,
vue.toDisplayString(__props.confirmText),
1
/* TEXT */
)
],
4
/* STYLE */
)
]),
__props.search ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "search-box"
}, [
vue.createVNode(_component_uni_easyinput, {
maxlength: -1,
prefixIcon: "search",
placeholder: "搜索",
modelValue: searchStr.value,
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => searchStr.value = $event),
"confirm-type": "search",
onConfirm: _cache[2] || (_cache[2] = ($event) => handleSearch(false)),
onClear: _cache[3] || (_cache[3] = ($event) => handleSearch(true))
}, null, 8, ["modelValue"]),
vue.createElementVNode("button", {
type: "primary",
size: "mini",
class: "search-btn",
onClick: _cache[4] || (_cache[4] = ($event) => handleSearch(false))
}, "搜索")
])) : vue.createCommentVNode("v-if", true),
treeData.value.length ? (vue.openBlock(), vue.createElementBlock("view", {
key: 1,
class: "select-content"
}, [
vue.createElementVNode("scroll-view", {
class: "scroll-view-box",
"scroll-top": scrollTop.value,
"scroll-y": "true",
onTouchmove: _cache[5] || (_cache[5] = vue.withModifiers(() => {
}, ["stop"]))
}, [
!filterTreeData.value.length ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "no-data center"
}, [
vue.createElementVNode("text", null, "暂无数据")
])) : vue.createCommentVNode("v-if", true),
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(filterTreeData.value, (item) => {
return vue.openBlock(), vue.createBlock(dataSelectItem, {
key: item[__props.dataValue],
node: item,
dataLabel: __props.dataLabel,
dataValue: __props.dataValue,
dataChildren: __props.dataChildren,
choseParent: __props.choseParent,
border: __props.border,
linkage: __props.linkage,
lazyLoadChildren: __props.lazyLoadChildren
}, null, 8, ["node", "dataLabel", "dataValue", "dataChildren", "choseParent", "border", "linkage", "lazyLoadChildren"]);
}),
128
/* KEYED_FRAGMENT */
)),
vue.createElementVNode("view", { class: "sentry" })
], 40, ["scroll-top"])
])) : (vue.openBlock(), vue.createElementBlock("view", {
key: 2,
class: "no-data center"
}, [
vue.createElementVNode("text", null, "暂无数据")
]))
],
4
/* STYLE */
)
]),
_: 1
/* STABLE */
}, 8, ["animation", "is-mask-click", "mask-background-color", "background-color", "safe-area"])
],
64
/* STABLE_FRAGMENT */
);
2024-09-24 09:21:34 +00:00
};
}
2024-10-14 07:22:41 +00:00
});
const treeSelect = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__scopeId", "data-v-0328d33e"], ["__file", "D:/projects/cxc-szcx-uniapp/components/treeSelect/treeSelect.vue"]]);
const _sfc_main$l = {
__name: "application",
setup(__props) {
const store = useStore();
const {
proxy
} = vue.getCurrentInstance();
const realname = vue.ref(store.userinfo.realname);
const depart = vue.ref("");
const phone = vue.ref(store.userinfo.phone);
const type = vue.ref("");
const dataSource = vue.ref([]);
const beginTime = vue.ref("");
const chooseStart = (e2) => {
beginTime.value = e2.detail.value;
2024-09-24 09:21:34 +00:00
};
2024-10-14 07:22:41 +00:00
const endTime = vue.ref("");
const chooseEnd = (e2) => {
endTime.value = e2.detail.value;
2024-09-24 09:21:34 +00:00
};
2024-10-14 07:22:41 +00:00
const typeArr = vue.ref([]);
const typeIndex = vue.ref(null);
const ifShow = vue.ref(true);
const zwcj = vue.ref("");
const address = vue.ref("");
const reason = vue.ref("");
const path = vue.ref([]);
2024-10-15 00:38:47 +00:00
const baseUrl2 = "https://36.112.48.190/jeecg-boot/sys/common/upload/";
2024-10-14 07:22:41 +00:00
const imageStyles = {
width: 64,
height: 64,
border: {
color: "#dce7e1",
width: 2,
style: "dashed",
radius: "2px"
}
2024-09-24 09:21:34 +00:00
};
2024-10-14 07:22:41 +00:00
onLoad(() => {
loadData();
});
const select = (e2) => {
e2.tempFilePaths;
for (let i2 = 0; i2 < e2.tempFilePaths.length; i2++) {
let photoPath = "职工请假/" + store.userinfo.orgCode + "/" + store.userinfo.realname;
uni.uploadFile({
url: baseUrl2,
filePath: e2.tempFilePaths[i2],
name: "file",
formData: {
appPath: photoPath
},
success: (res) => {
path.value.push(JSON.parse(res.data).message);
}
});
}
};
const qjAdd = () => {
if (!phone.value.trim())
return proxy.$toast("请输入联系方式");
if (!type.value)
return proxy.$toast("请选择请假类型");
if (!beginTime.value)
return proxy.$toast("请选择开始时间");
if (!endTime.value)
return proxy.$toast("请选择结束时间");
if (ifShow.value) {
if (typeIndex.value == null) {
return proxy.$toast("请选择审批领导");
}
}
if (!address.value.trim())
return proxy.$toast("请输入请假地点");
if (!reason.value.trim())
return proxy.$toast("请输入请假事由");
qjAddApi({
username: store.userinfo.username,
phone: phone.value,
type: type.value,
begintime: beginTime.value,
endtime: endTime.value,
examineleader: typeArr.value[typeIndex.value].username,
address: address.value,
reason: reason.value,
zwmc: zwcj.value,
path: path.value.toString()
}).then((res) => {
if (res.success) {
startMutilProcess(res.message);
} else {
proxy.$toast(res.message);
}
});
2024-09-24 09:21:34 +00:00
};
2024-10-14 07:22:41 +00:00
const startMutilProcess = (id) => {
startMutilProcessApi({
flowCode: "dev_cxc_qxj",
id,
formUrl: "modules/qxj/modules/CxcQxjBpmModel",
formUrlMobile: "leaveApplication"
//对应main.js里全局注册createApp()里的 app.component('leaveApplication',index)
}).then((res) => {
if (res.success) {
proxy.$toast(res.message);
setTimeout(() => {
uni.navigateBack();
}, 2e3);
}
}).catch((err) => {
formatAppLog("log", "at pages/leave/application.vue:235", err);
});
2024-09-24 09:21:34 +00:00
};
2024-10-14 07:22:41 +00:00
const loadData = () => {
getCategoryItemsApi("1838487445813645313").then((res) => {
if (res.success) {
dataSource.value = res.result;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
});
queryDepByCode(store.userinfo.orgCode).then((res) => {
if (res.success) {
depart.value = res.result;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
});
queryZwmcAndExaApi(store.userinfo.username).then((res) => {
if (res.success) {
typeArr.value = res.result.list;
zwcj.value = res.result.zwmc;
if (zwcj.value == "单位专家" || zwcj.value == "正职" || zwcj.value == "高级主管") {
ifShow.value = false;
}
} else {
proxy.$toast(res.message);
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
});
};
const bindType = (e2) => {
typeIndex.value = e2.detail.value;
};
return (_ctx, _cache) => {
const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_1$1);
const _component_uni_file_picker = resolveEasycom(vue.resolveDynamicComponent("uni-file-picker"), __easycom_0$2);
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass({ "gray": vue.unref(store).isgray == 1 })
},
[
vue.createElementVNode("view", { class: "form" }, [
vue.createElementVNode("view", { class: "f-row aic jcb input_box" }, [
vue.createElementVNode("view", { class: "title" }, " 职工姓名: "),
vue.withDirectives(vue.createElementVNode(
"input",
{
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => realname.value = $event),
disabled: ""
},
null,
512
/* NEED_PATCH */
), [
[vue.vModelText, realname.value]
])
]),
vue.createElementVNode("view", { class: "f-row aic jcb input_box" }, [
vue.createElementVNode("view", { class: "title" }, " 工作单位: "),
vue.withDirectives(vue.createElementVNode(
"input",
{
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => depart.value = $event),
disabled: ""
},
null,
512
/* NEED_PATCH */
), [
[vue.vModelText, depart.value]
])
]),
vue.createElementVNode("view", { class: "f-row aic jcb input_box" }, [
vue.createElementVNode("view", { class: "title" }, " 联系方式: "),
vue.withDirectives(vue.createElementVNode(
"input",
{
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => phone.value = $event)
},
null,
512
/* NEED_PATCH */
), [
[vue.vModelText, phone.value]
])
]),
vue.createElementVNode("view", { class: "f-row aic jcb input_box" }, [
vue.createElementVNode("view", { class: "title" }, " 请假类型: "),
vue.createVNode(treeSelect, {
dataSource: dataSource.value,
modelValue: type.value,
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => type.value = $event),
dataValue: "name"
}, null, 8, ["dataSource", "modelValue"])
]),
vue.createElementVNode("picker", {
mode: "date",
fields: "day",
onChange: chooseStart,
value: beginTime.value
}, [
vue.createElementVNode("view", { class: "f-row aic jcb box" }, [
vue.createElementVNode("view", { class: "title" }, " 开始时间: "),
vue.createElementVNode("view", { class: "f-row aic" }, [
vue.createElementVNode(
"view",
{
class: vue.normalizeClass([{ "choose": !beginTime.value }, { "choosed": beginTime.value }])
},
vue.toDisplayString(beginTime.value ? beginTime.value : "请选择"),
3
/* TEXT, CLASS */
),
vue.createVNode(_component_uni_icons, {
type: "bottom",
color: "#333333"
})
])
])
], 40, ["value"]),
vue.createElementVNode("picker", {
mode: "date",
fields: "day",
onChange: chooseEnd,
value: endTime.value
}, [
vue.createElementVNode("view", { class: "f-row aic jcb box" }, [
vue.createElementVNode("view", { class: "title" }, " 截止时间: "),
vue.createElementVNode("view", { class: "f-row aic" }, [
vue.createElementVNode(
"view",
{
class: vue.normalizeClass([{ "choose": !endTime.value }, { "choosed": endTime.value }])
},
vue.toDisplayString(endTime.value ? endTime.value : "请选择"),
3
/* TEXT, CLASS */
),
vue.createVNode(_component_uni_icons, {
type: "bottom",
color: "#333333"
})
])
])
], 40, ["value"]),
ifShow.value ? (vue.openBlock(), vue.createElementBlock("picker", {
key: 0,
onChange: bindType,
value: typeIndex.value,
range: typeArr.value,
"range-key": "realname"
}, [
vue.createElementVNode("view", { class: "f-row aic jcb box" }, [
vue.createElementVNode("view", { class: "title" }, " 审批领导: "),
vue.createElementVNode("view", { class: "f-row aic" }, [
vue.createElementVNode(
"view",
{
class: vue.normalizeClass([{ "choose": typeIndex.value == null }, { "choosed": typeIndex.value != null }])
},
vue.toDisplayString(typeIndex.value != null ? typeArr.value[typeIndex.value].realname : "请选择"),
3
/* TEXT, CLASS */
),
vue.createVNode(_component_uni_icons, {
type: "bottom",
color: "#333333"
})
])
])
], 40, ["value", "range"])) : vue.createCommentVNode("v-if", true),
vue.createElementVNode("view", { class: "f-row aic jcb input_box" }, [
vue.createElementVNode("view", { class: "title" }, " 请假地点: "),
vue.withDirectives(vue.createElementVNode(
"input",
{
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => address.value = $event),
placeholder: "请输入",
"nplaceholder-style": "font-size: 28rpx;color: #999999;"
},
null,
512
/* NEED_PATCH */
), [
[vue.vModelText, address.value]
])
]),
vue.createElementVNode("view", { class: "f-row aic jcb input_box" }, [
vue.createElementVNode("view", { class: "title" }, " 请假事由: "),
vue.withDirectives(vue.createElementVNode(
"input",
{
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => reason.value = $event),
placeholder: "请输入",
"placeholder-style": "font-size: 28rpx;color: #999999;"
},
null,
512
/* NEED_PATCH */
), [
[vue.vModelText, reason.value]
])
]),
vue.createElementVNode("view", { class: "f-row aic jcb input_box" }, [
vue.createElementVNode("view", { class: "title" }, " 上传附件: "),
vue.createVNode(_component_uni_file_picker, {
onSelect: select,
"image-styles": imageStyles
})
])
]),
vue.createElementVNode("view", { class: "btn f-col aic" }, [
vue.createElementVNode("view", { onClick: qjAdd }, " 提交 ")
])
],
2
/* CLASS */
);
};
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
};
const PagesLeaveApplication = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["__scopeId", "data-v-f12ae642"], ["__file", "D:/projects/cxc-szcx-uniapp/pages/leave/application.vue"]]);
const _sfc_main$k = {
__name: "index",
setup(__props) {
const store = useStore();
const back = () => {
uni.navigateBack();
};
return (_ctx, _cache) => {
const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_1$1);
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass(["content", { "gray": vue.unref(store).isgray == 1 }])
},
[
vue.createVNode(customNav, null, {
default: vue.withCtx(() => [
vue.createElementVNode("view", { class: "nav_box f-row aic" }, [
vue.createElementVNode("view", {
class: "back",
onClick: back
}, [
vue.createVNode(_component_uni_icons, {
type: "left",
size: "20",
color: "#fff"
})
]),
vue.createElementVNode("view", { class: "avatar" }, [
vue.createElementVNode("image", {
src: vue.unref(store).userinfo.avatar,
mode: ""
}, null, 8, ["src"])
]),
vue.createElementVNode("view", { class: "f-col" }, [
vue.createElementVNode(
"view",
{ class: "name" },
vue.toDisplayString(vue.unref(store).userinfo.realname),
1
/* TEXT */
),
vue.createElementVNode(
"view",
{ class: "position" },
vue.toDisplayString(vue.unref(store).role),
1
/* TEXT */
)
])
])
]),
_: 1
/* STABLE */
}),
vue.createElementVNode("view", { class: "time_box f-row aic jcb" }, [
vue.createElementVNode("view", { class: "box" }, [
vue.createElementVNode("view", { class: "time f-row aic" }, [
vue.createElementVNode("view", { class: "" }, " 上班 9:30 "),
vue.createElementVNode("image", {
src: "/static/checkin/chenggong.png",
mode: ""
})
]),
vue.createElementVNode("view", { class: "text" }, " 重庆市渝北区上弯路 ")
]),
vue.createElementVNode("view", { class: "box" }, [
vue.createElementVNode("view", { class: "time f-row aic" }, [
vue.createElementVNode("view", { class: "" }, " 下班 16:30 "),
vue.createElementVNode("image", {
src: "/static/checkin/shibai.png",
mode: ""
})
]),
vue.createElementVNode("view", { class: "text" }, " 打卡已超时 ")
])
]),
vue.createElementVNode("view", { class: "checkin" }, [
vue.createElementVNode("view", { class: "f-col aic" }, [
vue.createElementVNode("view", { class: "status f-col aic" }, [
vue.createCommentVNode(' <image src="../../static/checkin/position1.png" mode=""></image>\r\n <image src="../../static/checkin/position2.png" mode=""></image>\r\n <image src="../../static/checkin/position3.png" mode=""></image> '),
vue.createElementVNode("image", {
src: "/static/checkin/position4.png",
mode: ""
}),
vue.createElementVNode("text", null, "打卡失败")
]),
vue.createElementVNode("view", {
class: vue.normalizeClass(["circle", "f-col", "aic", "out", "check", "success", "fail"])
}, [
vue.createElementVNode("view", { class: "title" }, " 上班打卡 "),
vue.createElementVNode("view", { class: "time" }, " 9:00 "),
vue.createElementVNode("view", { class: "ontime" }, " 已超时 ")
])
])
])
],
2
/* CLASS */
);
};
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
};
const PagesCheckinIndex = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__scopeId", "data-v-1410bd6b"], ["__file", "D:/projects/cxc-szcx-uniapp/pages/checkin/index.vue"]]);
const _sfc_main$j = {
__name: "useredit",
setup(__props) {
2024-10-15 00:38:47 +00:00
const baseUrl2 = "https://36.112.48.190/jeecg-boot/sys/common/upload";
2024-10-14 07:22:41 +00:00
const store = useStore();
const chooseAvatar = () => {
uni.chooseImage({
count: 1,
success: (chooseImageRes) => {
const tempFilePaths = chooseImageRes.tempFilePaths;
const photoPath = "用户头像/" + store.userinfo.realname;
uni.uploadFile({
url: baseUrl2,
//仅为示例,非真实的接口地址
filePath: tempFilePaths[0],
name: "file",
formData: {
appPath: photoPath
},
success: (res) => {
uni.showLoading({
title: "上传中..."
});
form.avatar = JSON.parse(res.data).message;
userEditApi({
avatar: form.avatar,
id: store.userinfo.id
}).then((res2) => {
if (res2) {
uni.showToast({
title: res2,
icon: "success",
duration: 2e3
});
}
}).catch((err) => {
formatAppLog("log", "at pages/useredit/useredit.vue:97", err);
});
},
fail(err) {
formatAppLog("log", "at pages/useredit/useredit.vue:101", "图片上传出错", err);
}
});
}
});
};
const form = vue.reactive({
avatar: "",
realname: "",
phone: ""
});
const loginout = () => {
uni.showModal({
title: "退出登录",
content: "您确认要退出登录吗?",
success(res) {
if (res.confirm) {
uni.removeStorageSync("token");
uni.removeStorageSync("user");
uni.removeStorageSync("role");
uni.removeStorageSync("logintime");
uni.reLaunch({
url: "/pages/login/login"
});
}
}
});
};
onLoad(() => {
uni.setNavigationBarColor({
frontColor: "#ffffff",
backgroundColor: "#bebebe"
});
});
return (_ctx, _cache) => {
const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_1$1);
return vue.openBlock(), vue.createElementBlock(
vue.Fragment,
null,
[
vue.createElementVNode(
"view",
{
class: vue.normalizeClass(["content", { "gray": vue.unref(store).isgray == 1 }])
},
[
vue.createElementVNode("view", { class: "box" }, [
vue.createElementVNode("view", null, "头像"),
vue.createElementVNode("view", { style: { "display": "flex", "align-items": "center" } }, [
vue.createElementVNode("button", {
class: "head-btn",
onClick: chooseAvatar
}, [
!form.avatar ? (vue.openBlock(), vue.createElementBlock("image", {
key: 0,
class: "head-img",
src: vue.unref(imgUrl)(vue.unref(store).userinfo.avatar),
mode: ""
}, null, 8, ["src"])) : (vue.openBlock(), vue.createElementBlock("image", {
key: 1,
class: "head-img",
src: vue.unref(imgUrl)(form.avatar)
}, null, 8, ["src"]))
]),
vue.createVNode(_component_uni_icons, {
type: "right",
size: "24"
})
])
]),
vue.createElementVNode("view", {
class: "box",
style: { "padding-top": "30rpx", "padding-bottom": "30rpx" }
}, [
vue.createElementVNode("view", null, "姓名"),
vue.withDirectives(vue.createElementVNode(
"input",
{
disabled: "",
style: { "text-align": "right" },
type: "nickname",
"placeholder-style": "font-size: 32rpx;color: #999999;",
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.unref(store).userinfo.realname = $event),
placeholder: "请输入姓名"
},
null,
512
/* NEED_PATCH */
), [
[vue.vModelText, vue.unref(store).userinfo.realname]
])
]),
vue.createElementVNode("view", {
class: "box",
style: { "padding-top": "30rpx", "padding-bottom": "30rpx" }
}, [
vue.createElementVNode("view", null, "手机号"),
vue.withDirectives(vue.createElementVNode(
"input",
{
disabled: "",
style: { "text-align": "right" },
type: "nickname",
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => vue.unref(store).userinfo.phone = $event),
placeholder: "请输入手机号",
"placeholder-style": "font-size: 32rpx;color: #999999;"
},
null,
512
/* NEED_PATCH */
), [
[vue.vModelText, vue.unref(store).userinfo.phone]
])
]),
vue.createElementVNode("view", {
class: "box",
style: { "padding-top": "30rpx", "padding-bottom": "30rpx" }
}, [
vue.createElementVNode("view", null, "劳动合同号"),
vue.withDirectives(vue.createElementVNode(
"input",
{
style: { "text-align": "right" },
type: "nickname",
disabled: "",
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => vue.unref(store).userinfo.workNo = $event),
placeholder: "请输入劳动合同号",
"placeholder-style": "font-size: 32rpx;color: #999999;"
},
null,
512
/* NEED_PATCH */
), [
[vue.vModelText, vue.unref(store).userinfo.workNo]
])
])
],
2
/* CLASS */
),
vue.createElementVNode("view", { class: "line" }),
vue.createElementVNode("view", {
class: "btn",
onClick: loginout
}, " 退出登录 ")
],
64
/* STABLE_FRAGMENT */
);
};
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
};
const PagesUsereditUseredit = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__scopeId", "data-v-503dd57f"], ["__file", "D:/projects/cxc-szcx-uniapp/pages/useredit/useredit.vue"]]);
const _sfc_main$i = {
__name: "address",
setup(__props) {
const store = useStore();
const jump = (url) => {
beforeJump(url, () => {
uni.navigateTo({
url
});
2024-09-24 09:21:34 +00:00
});
};
2024-10-14 07:22:41 +00:00
return (_ctx, _cache) => {
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass(["content", { "gray": vue.unref(store).isgray == 1 }])
},
[
vue.createElementVNode("view", { class: "list" }, [
(vue.openBlock(), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(2, (item, i2) => {
return vue.createElementVNode("view", {
class: "item",
key: i2
}, [
vue.createElementVNode("view", { class: "province f-row aic" }, [
vue.createElementVNode("view", { class: "" }, " 浙江省,杭州市 "),
vue.createElementVNode("image", {
src: "/static/my/default.png",
mode: ""
})
]),
vue.createElementVNode("view", { class: "address f-row jcb" }, [
vue.createElementVNode("view", { class: "" }, " 重庆 重庆市 渝北区 龙溪街道花卉园东路黄金 宝高级住宅小区 "),
vue.createElementVNode("image", {
src: "/static/my/edit.png",
mode: ""
})
]),
vue.createElementVNode("view", { class: "set f-row aic jcb" }, [
vue.createElementVNode("view", { class: "f-row aic" }, [
vue.createCommentVNode(' <image src="../../static/login/checked.png" mode=""></image> '),
vue.createElementVNode("image", {
src: "/static/login/nocheck.png",
mode: ""
}),
vue.createTextVNode(" 设为默认地址 ")
]),
vue.createElementVNode("view", { class: "" }, " 删除 ")
])
]);
}),
64
/* STABLE_FRAGMENT */
))
]),
vue.createElementVNode("view", { class: "btn f-col aic" }, [
vue.createElementVNode("view", {
class: "",
onClick: _cache[0] || (_cache[0] = ($event) => jump("/pages/useredit/add_address"))
}, " +添加收货地址 ")
])
],
2
/* CLASS */
);
2024-09-24 09:21:34 +00:00
};
}
2024-10-14 07:22:41 +00:00
};
const PagesUsereditAddress = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__scopeId", "data-v-4bd9b73b"], ["__file", "D:/projects/cxc-szcx-uniapp/pages/useredit/address.vue"]]);
const _sfc_main$h = {
__name: "add_address",
setup(__props) {
const store = useStore();
return (_ctx, _cache) => {
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass(["content", { "gray": vue.unref(store).isgray == 1 }])
},
[
vue.createElementVNode("view", { class: "area f-row jcb" }, [
vue.createElementVNode("view", { class: "title topic" }, " 所在地区 "),
vue.createElementVNode("input", {
type: "text",
placeholder: "省、市、区、街道"
})
]),
vue.createElementVNode("view", { class: "area f-row jcb" }, [
vue.createElementVNode("view", { class: "title topic" }, " 详细地址 "),
vue.createElementVNode("textarea", { placeholder: "小区楼栋/乡村名称" })
]),
vue.createElementVNode("view", { class: "area f-row jcb" }, [
vue.createElementVNode("view", { class: "title" }, " 设为默认地址 "),
vue.createElementVNode("image", {
src: "/static/login/checked.png",
mode: ""
}),
vue.createCommentVNode(' <image src="../../static/login/nocheck.png" mode=""></image> ')
]),
vue.createElementVNode("view", { class: "btn f-col aic" }, [
vue.createElementVNode("view", { class: "" }, " 保存 ")
])
],
2
/* CLASS */
);
};
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
};
const PagesUsereditAdd_address = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-f1271877"], ["__file", "D:/projects/cxc-szcx-uniapp/pages/useredit/add_address.vue"]]);
const _sfc_main$g = {
__name: "addressbook",
setup(__props) {
const store = useStore();
return (_ctx, _cache) => {
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass({ "gray": vue.unref(store).isgray == 1 })
},
[
vue.createElementVNode("view", { class: "list" }, [
(vue.openBlock(), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(4, (item, i2) => {
return vue.createElementVNode("view", {
class: "item f-row aic jcb",
key: i2
}, [
vue.createElementVNode("view", { class: "user f-row aic" }, [
vue.createElementVNode("image", {
src: "",
mode: ""
}),
vue.createElementVNode("view", { class: "name_job" }, [
vue.createElementVNode("view", { class: "name" }, " 我是晴天 "),
vue.createElementVNode("view", { class: "job" }, " 销售部-销售总监 ")
])
]),
vue.createElementVNode("view", { class: "btn" }, " 电话联系 ")
]);
}),
64
/* STABLE_FRAGMENT */
))
])
],
2
/* CLASS */
);
};
}
};
const PagesUsereditAddressbook = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-c0e791d9"], ["__file", "D:/projects/cxc-szcx-uniapp/pages/useredit/addressbook.vue"]]);
const _sfc_main$f = {
__name: "extendCom",
props: {
title: {
type: String,
default: ""
},
img: {
type: String,
default: ""
},
list: {
type: Array,
default: function() {
return [];
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
},
// selfArrquery: {
// type: Array,
// default: function() {
// return []
// }
// },
total: {
type: Number,
default: 0
}
},
setup(__props) {
vue.useCssVars((_ctx) => ({
"e40cd242-moreHeight": moreHeight.value
}));
const props = __props;
const open2 = vue.ref(false);
const moreHeight = vue.ref(null);
const CurrentInstance = vue.getCurrentInstance();
vue.watch(() => props.list, () => {
vue.nextTick(() => {
uni.createSelectorQuery().in(CurrentInstance.proxy).select(".item_box").boundingClientRect((data) => {
moreHeight.value = (data == null ? void 0 : data.height) + "px";
formatAppLog("log", "at bpm/extendCom.vue:82", "moreHeight", moreHeight.value);
}).exec();
});
}, {
immediate: true
});
const tolist = (title) => {
let id = null;
beforeJump("/pages/task/index", () => {
if (props.title == "待办事项") {
id = 0;
}
if (props.title == "已办事项") {
id = 2;
}
if (props.title == "本人发起") {
return uni.navigateTo({
url: `/pages/task/self?title=${title}`
2024-09-24 09:21:34 +00:00
});
}
2024-10-14 07:22:41 +00:00
uni.navigateTo({
url: `/pages/task/index?id=${id}&title=${title}`
2024-09-24 09:21:34 +00:00
});
2024-10-14 07:22:41 +00:00
});
2024-09-24 09:21:34 +00:00
};
2024-10-14 07:22:41 +00:00
return (_ctx, _cache) => {
return vue.openBlock(), vue.createElementBlock("view", { class: "content" }, [
vue.createElementVNode("view", { class: "todo f-col aic" }, [
vue.createElementVNode("view", { class: "f-col aic" }, [
vue.createElementVNode("view", {
class: "title_box f-row aic jcb",
onClick: _cache[0] || (_cache[0] = ($event) => tolist(""))
}, [
vue.createElementVNode("view", { class: "title f-row aic" }, [
vue.createElementVNode("image", {
src: `/static/my/${__props.img}.png`,
mode: ""
}, null, 8, ["src"]),
vue.createTextVNode(
" " + vue.toDisplayString(__props.title),
1
/* TEXT */
)
]),
vue.createElementVNode(
"view",
{ class: "num" },
vue.toDisplayString(__props.total),
1
/* TEXT */
)
]),
__props.list.length ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "list"
}, [
vue.createElementVNode(
"view",
{
class: vue.normalizeClass(["box", { "close": __props.list.length > 5 && open2.value }])
},
[
vue.createElementVNode("view", { class: "item_box" }, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(__props.list, (item, i2) => {
return vue.openBlock(), vue.createElementBlock("view", {
onClick: ($event) => tolist(item.title),
class: "item f-row aic",
key: i2
}, [
vue.createElementVNode(
"view",
{ class: "" },
vue.toDisplayString(item.title),
1
/* TEXT */
),
vue.createElementVNode(
"text",
null,
vue.toDisplayString(item.num),
1
/* TEXT */
)
], 8, ["onClick"]);
}),
128
/* KEYED_FRAGMENT */
))
])
],
2
/* CLASS */
),
vue.withDirectives(vue.createElementVNode(
"view",
{
class: "more",
onClick: _cache[1] || (_cache[1] = ($event) => open2.value = !open2.value)
},
vue.toDisplayString(!open2.value ? "显示更多" : "收起"),
513
/* TEXT, NEED_PATCH */
), [
[vue.vShow, __props.list.length > 5]
])
])) : vue.createCommentVNode("v-if", true)
])
])
]);
};
}
};
const extendCom = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-e40cd242"], ["__file", "D:/projects/cxc-szcx-uniapp/bpm/extendCom.vue"]]);
const _sfc_main$e = {
__name: "todotask",
setup(__props) {
const store = useStore();
onLoad(() => {
taskList();
taskHistoryList();
myApplyProcessList();
2024-09-24 09:21:34 +00:00
});
2024-10-14 07:22:41 +00:00
const todoArr = vue.ref([]);
const todoTotal = vue.ref(0);
const taskList = () => {
taskListApi({
pageNo: 1,
pageSize: 4,
_t: (/* @__PURE__ */ new Date()).getTime()
}).then((res) => {
var _a, _b, _c, _d;
if (res == null ? void 0 : res.success) {
if (((_a = res == null ? void 0 : res.result) == null ? void 0 : _a.total) > 4) {
taskListApi({
pageNo: 1,
pageSize: (_b = res == null ? void 0 : res.result) == null ? void 0 : _b.total,
_t: (/* @__PURE__ */ new Date()).getTime()
}).then((res1) => {
var _a2, _b2;
if (res1 == null ? void 0 : res1.success) {
todoArr.value = [...todoArr.value, ...handleData((_a2 = res1 == null ? void 0 : res1.result) == null ? void 0 : _a2.records)];
todoTotal.value = (_b2 = res1 == null ? void 0 : res1.result) == null ? void 0 : _b2.total;
}
}).catch((err) => {
formatAppLog("log", "at pages/task/todotask.vue:53", "err", err);
});
} else {
todoArr.value = [...todoArr.value, ...handleData((_c = res == null ? void 0 : res.result) == null ? void 0 : _c.records)];
todoTotal.value = (_d = res == null ? void 0 : res.result) == null ? void 0 : _d.total;
2024-09-24 09:21:34 +00:00
}
}
2024-10-14 07:22:41 +00:00
}).catch((err) => {
formatAppLog("log", "at pages/task/todotask.vue:62", err);
});
};
const doneArr = vue.ref([]);
const doneTotal = vue.ref(0);
const taskHistoryList = () => {
taskHistoryListApi({
pageNo: 1,
pageSize: 4,
_t: (/* @__PURE__ */ new Date()).getTime()
}).then((res) => {
if (res.success) {
if (res.result.total > 4) {
taskHistoryListApi({
pageNo: 1,
pageSize: res.result.total,
_t: (/* @__PURE__ */ new Date()).getTime()
}).then((res1) => {
if (res1.success) {
doneArr.value = [...doneArr.value, ...handleData(res1.result.records)];
doneTotal.value = res1.result.total;
}
}).catch((err) => {
formatAppLog("log", "at pages/task/todotask.vue:87", err);
});
} else {
doneArr.value = [...doneArr.value, ...handleData(res.result.records)];
doneTotal.value = res.result.total;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
}
}).catch((err) => {
formatAppLog("log", "at pages/task/todotask.vue:96", err);
});
};
const selfArr = vue.ref([]);
const selfTotal = vue.ref(0);
vue.ref([]);
const myApplyProcessList = () => {
myApplyProcessListApi({
pageNo: 1,
pageSize: 4,
_t: (/* @__PURE__ */ new Date()).getTime()
}).then((res) => {
if (res.success) {
if (res.result.total > 4) {
myApplyProcessListApi({
pageNo: 1,
pageSize: res.result.total,
_t: (/* @__PURE__ */ new Date()).getTime()
}).then((res1) => {
if (res1.success) {
selfArr.value = [...selfArr.value, ...handleData(res1.result.records)];
selfTotal.value = res1.result.total;
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
}).catch((err) => {
formatAppLog("log", "at pages/task/todotask.vue:122", err);
});
} else {
selfArr.value = [...selfArr.value, ...handleData(res.result.records)];
selfTotal.value = res.result.total;
}
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
}).catch((err) => {
formatAppLog("log", "at pages/task/todotask.vue:132", err);
});
};
const handleData = (titlearr) => {
let titleArr = titlearr.length ? titlearr.map((item) => item.processDefinitionName || item.prcocessDefinitionName) : [];
let res = titleArr.reduce((obj, title) => {
if (title in obj) {
obj[title]++;
} else {
obj[title] = 1;
}
return obj;
}, {});
return Object.entries(res).map(([k, v2]) => ({
title: k,
num: v2
}));
};
return (_ctx, _cache) => {
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass(["content", { "gray": vue.unref(store).isgray == 1 }])
},
[
vue.createVNode(extendCom, {
title: "待办事项",
img: "todo",
list: todoArr.value,
total: todoTotal.value
}, null, 8, ["list", "total"]),
vue.createVNode(extendCom, {
title: "已办事项",
img: "done",
list: doneArr.value,
total: doneTotal.value
}, null, 8, ["list", "total"]),
vue.createVNode(extendCom, {
title: "本人发起",
img: "self",
list: selfArr.value,
total: selfTotal.value
}, null, 8, ["list", "total"])
],
2
/* CLASS */
);
};
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
};
const PagesTaskTodotask = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__file", "D:/projects/cxc-szcx-uniapp/pages/task/todotask.vue"]]);
const _sfc_main$d = {
__name: "safeCom",
setup(__props) {
const jump = (url) => {
beforeJump(url, () => {
uni.navigateTo({
url
});
});
};
return (_ctx, _cache) => {
return vue.openBlock(), vue.createElementBlock("view", { class: "list f-row aic jcb" }, [
(vue.openBlock(), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(20, (item, i2) => {
return vue.createElementVNode("view", {
class: "item",
key: i2,
onClick: _cache[0] || (_cache[0] = ($event) => jump("/pages/safe/detail"))
}, [
vue.createElementVNode("view", { class: "" }, [
vue.createElementVNode("image", {
src: "",
mode: ""
})
]),
vue.createElementVNode("view", { class: "text" }, " 五月天“突然好想你”线上演唱会精彩回放 ")
]);
}),
64
/* STABLE_FRAGMENT */
))
]);
};
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
};
const safeCom = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-982fcf41"], ["__file", "D:/projects/cxc-szcx-uniapp/bpm/safeCom.vue"]]);
const _sfc_main$c = {
__name: "manage",
setup(__props) {
const store = useStore();
const showicon = vue.ref(true);
const searchKey = vue.ref("");
return (_ctx, _cache) => {
const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_1$1);
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass(["content", { "gray": vue.unref(store).isgray == 1 }])
},
[
vue.createVNode(customNav, null, {
default: vue.withCtx(() => [
vue.createElementVNode("view", { class: "nav_box f-row aic jcb" }, [
vue.createElementVNode("view", {
class: "back f-row aic",
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.back && _ctx.back(...args))
}, [
vue.createVNode(_component_uni_icons, {
type: "left",
size: "20",
color: "#fff"
})
]),
vue.createElementVNode("view", { class: "search f-row aic" }, [
vue.withDirectives(vue.createElementVNode(
"input",
{
type: "text",
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => searchKey.value = $event),
onConfirm: _cache[2] || (_cache[2] = (...args) => _ctx.search && _ctx.search(...args)),
onBlur: _cache[3] || (_cache[3] = ($event) => showicon.value = !searchKey.value),
onFocus: _cache[4] || (_cache[4] = ($event) => showicon.value = false)
},
null,
544
/* NEED_HYDRATION, NEED_PATCH */
), [
[vue.vModelText, searchKey.value]
]),
showicon.value ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "f-row aic"
}, [
vue.createElementVNode("image", {
src: "/static/search.png",
mode: ""
}),
vue.createElementVNode("text", null, "搜索")
])) : vue.createCommentVNode("v-if", true)
])
])
]),
_: 1
/* STABLE */
}),
vue.createElementVNode("view", { class: "" }, [
vue.createVNode(safeCom)
])
],
2
/* CLASS */
);
};
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
};
const PagesSafeManage = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-dc2f4615"], ["__file", "D:/projects/cxc-szcx-uniapp/pages/safe/manage.vue"]]);
const _sfc_main$b = {
__name: "index",
setup(__props) {
const store = useStore();
const shishiArr = vue.ref([]);
const productArr = vue.ref([]);
onLoad((options) => {
shishiArr.value = JSON.parse(options.shishi);
productArr.value = JSON.parse(options.product);
});
return (_ctx, _cache) => {
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass(["f-col", "aic", { "gray": vue.unref(store).isgray == 1 }])
},
[
vue.createVNode(dataCom, {
title: "实时输差",
list: shishiArr.value
}, null, 8, ["list"]),
vue.createVNode(dataCom, {
title: "偏远计量点",
list: shishiArr.value
}, null, 8, ["list"]),
vue.createVNode(dataCom, {
title: "生产实时数据",
list: productArr.value
}, null, 8, ["list"])
],
2
/* CLASS */
);
};
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
};
const PagesProductIndex = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__file", "D:/projects/cxc-szcx-uniapp/pages/product/index.vue"]]);
const en = {
"uni-load-more.contentdown": "Pull up to show more",
"uni-load-more.contentrefresh": "loading...",
"uni-load-more.contentnomore": "No more data"
};
const zhHans = {
"uni-load-more.contentdown": "上拉显示更多",
"uni-load-more.contentrefresh": "正在加载...",
"uni-load-more.contentnomore": "没有更多数据了"
};
const zhHant = {
"uni-load-more.contentdown": "上拉顯示更多",
"uni-load-more.contentrefresh": "正在加載...",
"uni-load-more.contentnomore": "沒有更多數據了"
};
const messages = {
en,
"zh-Hans": zhHans,
"zh-Hant": zhHant
};
let platform;
setTimeout(() => {
platform = uni.getSystemInfoSync().platform;
}, 16);
const {
t
} = initVueI18n(messages);
const _sfc_main$a = {
name: "UniLoadMore",
emits: ["clickLoadMore"],
props: {
status: {
// 上拉的状态more-loading前loading-loading中noMore-没有更多了
type: String,
default: "more"
},
showIcon: {
type: Boolean,
default: true
},
iconType: {
type: String,
default: "auto"
},
iconSize: {
type: Number,
default: 24
},
color: {
type: String,
default: "#777777"
},
contentText: {
type: Object,
default() {
return {
contentdown: "",
contentrefresh: "",
contentnomore: ""
};
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
},
showText: {
type: Boolean,
default: true
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
},
data() {
return {
webviewHide: false,
platform,
imgBase64: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QzlBMzU3OTlEOUM0MTFFOUI0NTZDNERBQURBQzI4RkUiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QzlBMzU3OUFEOUM0MTFFOUI0NTZDNERBQURBQzI4RkUiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpDOUEzNTc5N0Q5QzQxMUU5QjQ1NkM0REFBREFDMjhGRSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpDOUEzNTc5OEQ5QzQxMUU5QjQ1NkM0REFBREFDMjhGRSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pt+ALSwAAA6CSURBVHja1FsLkFZVHb98LM+F5bHL8khA1iSeiyQBCRM+YGqKUnnJTDLGI0BGZlKDIU2MMglUiDApEZvSsZnQtBRJtKwQNKQMFYeRDR10WOLd8ljYXdh+v8v5fR3Od+797t1dnOnO/Ofce77z+J//+b/P+ZqtXbs2sJ9MJhNUV1cHJ06cCJo3bx7EPc2aNcvpy7pWrVoF+/fvDyoqKoI2bdoE9fX1F7TjN8a+EXBn/fkfvw942Tf+wYMHg9mzZwfjxo0LDhw4EPa1x2MbFw/fOGfPng1qa2tzcCkILsLDydq2bRsunpOTMM7TD/W/tZDZhPdeKD+yGxHhdu3aBV27dg3OnDlzMVANMheLAO3btw8KCwuDmpoaX5OxbgUIMEq7K8IcPnw4KCsrC/r37x8cP378/4cAXAB3vqSkJMuiDhTkw+XcuXNhOWbMmKBly5YhUT8xArhyFvP0BfwRsAuwxJZJsm/nzp2DTp06he/OU+cZ64K6o0ePBkOHDg2GDx8e6gEbJ5Q/NHNuAJQ1hgBeHUDlR7nVTkY8rQAvAi4z34vR/mPs1FoRsaCgIJThI0eOBC1atEiFGGV+5MiRoS45efJkqFjJFXV1dQuA012m2WcwTw98fy6CqBdsaiIO4CScrGPHjvk4odhavPquRtFWXEC25VgkREKOCh/qDSq+vn37htzD/mZTOmOc5U7zKzBPEedygWshcDyWvs30igAbU+6oyMgJBCFhwQE0fccxN60Ay9iebbjoDh06hMowjQxT4fXq1SskArmHZpkArvixp/kWzHdMeArExSJEaiXIjjRjRJ4DaAGWpibLzXN3Fm1vA5teBgh3j1Rv3bp1YgKwPdmf2p9zcyNYYgPKMfY0T5f5nNYdw158nJ8QawW4CLKwiOBSEgO/hok2eBydR+3dYH+PLxA5J8Vv0KBBwenTp0P2JWAx6+yFEBfs8lMY+y0SWMBNI9E4ThKi58VKTg3FQZS1RQF1cz27eC0QHMu+3E0SkUowjhVt5VdaWhp07949ZHv2Qd1EjDXM2cla1M0nl3GxAs3J9yREzyTdFVKVFOaE9qRA8GM0WebRuo9JGZKA7Mv2SeS/Z8+eoQ9BArMfFrLGo6jvxbhHbJZnKX2Rzz1O7QhJJ9Cs2ZMaWIyq/zhdeqPNfIoHd58clIQD+JSXl4dKlyIAuBdVXZwFVWKspSSoxE++h8x4k3uCnEhE4I5KwRiFWGOU0QWKiCYLbdoRMRKAu2kQ9vkfLU6dOhX06NEjlH+yMRZSinnuyWnYosVcji8CEA/6Cg2JF+IIUBqnGKUTCNwtwBN4f89RiK1R96DEgO2o0NDmtEdvVFdVVYV+P3UAPUEs6GFwV3PHmXkD4vh74iDFJysVI/MlaQhwKeBNTLYX5VuA8T4/gZxA4MRGFxDB6R7OmYPfyykGRJbyie+XnGYnQIC/coH9+vULiYrxrkL9ZA9+0ykaHIfEpM7ge8TiJ2CsHYwyMfafAF1yCGBHYIbCVDjDjKt7BeB51D+LgQa6OkG7IDYEEtvQ7lnXLKLtLdLuJBpE4gPUXcW2+PkZwOex+4cGDhwYDBkyRL7/HFcEwUGPo/8uWRUpYnfxGHco8HkewLHLyYmAawAPuIFZxhOpDfJQ8gbUv41yORAptMWBNr6oqMhWird5+u+iHmBb2nhjDV7HWBNQTgK8y11l5NetWzc5ULscAtSj7nbNI0skhWeUZCc0W4nyH/jO4Vz0u1IeYhbk4AiwM6tjxIWByHsoZ9qcIBPJd/y+DwPfBESOmCa/QF3WiZHucLlEDpNxcNhmheEOPgdQNx6/VZFQzFZ5TN08AHXQt2Ii3EdyFuUsPtTcGPhW5iMiCNELvz+Gdn9huG4HUJaW/w3g0wxV0XaG7arG2WeKiUWYM4Y7GO5ezshTARbbWGw/DvXkpp/ivVvE0JVoMxN4rpGzJMhE5Pl+xlATsDIqikP9F9D2z3h9nOksEUFhK+qO4rcPkoalMQ/HqJLIyb3F3JdjrCcw1yZ8joyJLR5gCo54etlag7qIoeNh1N1BRYj3DTFJ0elotxPlVzkGuYAmL0VSJVGAJA41c4Z6A3BzTLfn0HYwYKEI6CUAMzZEWvLsIcQOo1AmmyyM72nHJCfYsogflGV6jEk9vyQZXSuq6w4c16NsGcGZbwOPr+H1RkOk2LEzjNepxQkihHSCQ4ynAYNRx2zMKV92CQMWqj8J0BRE8EShxRFN6YrfCRhC0x3r/Zm4IbQCcmJoV0kMamllccR6FjHqUC5F2R/wS2dcymOlfAKOS4KmzQb5cpNC2MC7JhVn5wjXoJ44rYhLh8n0eXOCorJxa7POjbSlCGVczr34/RsAmrcvo9s+wGp3tzVhntxiXiJ4nvEYb4FJkf0O8HocAePmLvCxnL0AORraVekJk6TYjDabRVXfRE2lCN1h6ZQRN1+InUbsCpKwoBZHh0dODN9JBCUffItXxEavTQkUtnfTVAplCWL3JISz29h4NjotnuSsQKJCk8dF+kJR6RARjrqFVmfPnj3ZbK8cIJ0msd6jgHPGtfVTQ8VLmlvh4mct9sobRmPic0DyDQQnx/NlfYUgyz59+oScsH379pAwXABD32nTpoUHIToESeI5mnbE/UqDdyLcafEBf2MCqgC7NwxIbMREJQ0g4D4sfJwnD+AmRrII05cfMWJE+L1169bQr+fip06dGp4oJ83lmYd5wj/EmMa4TaHivo4EeCguYZBnkB5g2aWA69OIEnUHOaGysjIYMGBAMGnSpODYsWPZwCpFmm4lNq+4gSLQA7jcX8DwtjEyRC8wjabnXEx9kfWnTJkSJkAo90xpJVV+FmcVNeYAF5zWngS4C4O91MBxmAv8blLEpbjI5
};
},
computed: {
iconSnowWidth() {
return (Math.floor(this.iconSize / 24) || 1) * 2;
},
contentdownText() {
return this.contentText.contentdown || t("uni-load-more.contentdown");
},
contentrefreshText() {
return this.contentText.contentrefresh || t("uni-load-more.contentrefresh");
},
contentnomoreText() {
return this.contentText.contentnomore || t("uni-load-more.contentnomore");
}
},
mounted() {
var pages2 = getCurrentPages();
var page = pages2[pages2.length - 1];
var currentWebview = page.$getAppWebview();
currentWebview.addEventListener("hide", () => {
this.webviewHide = true;
2024-09-24 09:21:34 +00:00
});
2024-10-14 07:22:41 +00:00
currentWebview.addEventListener("show", () => {
this.webviewHide = false;
2024-09-24 09:21:34 +00:00
});
2024-10-14 07:22:41 +00:00
},
methods: {
onClick() {
this.$emit("clickLoadMore", {
detail: {
status: this.status
}
});
}
2024-09-24 09:21:34 +00:00
}
2024-10-14 07:22:41 +00:00
};
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
return vue.openBlock(), vue.createElementBlock("view", {
class: "uni-load-more",
onClick: _cache[0] || (_cache[0] = (...args) => $options.onClick && $options.onClick(...args))
}, [
!$data.webviewHide && ($props.iconType === "circle" || $props.iconType === "auto" && $data.platform === "android") && $props.status === "loading" && $props.showIcon ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 0,
style: vue.normalizeStyle({ width: $props.iconSize + "px", height: $props.iconSize + "px" }),
class: "uni-load-more__img uni-load-more__img--android-MP"
},
[
vue.createElementVNode(
"view",
{
class: "uni-load-more__img-icon",
style: vue.normalizeStyle({ borderTopColor: $props.color, borderTopWidth: $props.iconSize / 12 })
},
null,
4
/* STYLE */
),
vue.createElementVNode(
"view",
{
class: "uni-load-more__img-icon",
style: vue.normalizeStyle({ borderTopColor: $props.color, borderTopWidth: $props.iconSize / 12 })
},
null,
4
/* STYLE */
),
vue.createElementVNode(
"view",
{
class: "uni-load-more__img-icon",
style: vue.normalizeStyle({ borderTopColor: $props.color, borderTopWidth: $props.iconSize / 12 })
},
null,
4
/* STYLE */
)
],
4
/* STYLE */
)) : !$data.webviewHide && $props.status === "loading" && $props.showIcon ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 1,
style: vue.normalizeStyle({ width: $props.iconSize + "px", height: $props.iconSize + "px" }),
class: "uni-load-more__img uni-load-more__img--ios-H5"
},
[
vue.createElementVNode("image", {
src: $data.imgBase64,
mode: "widthFix"
}, null, 8, ["src"])
],
4
/* STYLE */
)) : vue.createCommentVNode("v-if", true),
$props.showText ? (vue.openBlock(), vue.createElementBlock(
"text",
{
key: 2,
class: "uni-load-more__text",
style: vue.normalizeStyle({ color: $props.color })
},
vue.toDisplayString($props.status === "more" ? $options.contentdownText : $props.status === "loading" ? $options.contentrefreshText : $options.contentnomoreText),
5
/* TEXT, STYLE */
)) : vue.createCommentVNode("v-if", true)
]);
}
const __easycom_0$1 = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$2], ["__scopeId", "data-v-9245e42c"], ["__file", "D:/projects/cxc-szcx-uniapp/uni_modules/uni-load-more/components/uni-load-more/uni-load-more.vue"]]);
2024-09-24 09:21:34 +00:00
const dataPicker = {
props: {
localdata: {
type: [Array, Object],
default() {
return [];
}
},
spaceInfo: {
type: Object,
default() {
return {};
}
},
collection: {
type: String,
default: ""
},
action: {
type: String,
default: ""
},
field: {
type: String,
default: ""
},
orderby: {
type: String,
default: ""
},
where: {
type: [String, Object],
default: ""
},
pageData: {
type: String,
default: "add"
},
pageCurrent: {
type: Number,
default: 1
},
pageSize: {
type: Number,
default: 500
},
getcount: {
type: [Boolean, String],
default: false
},
getone: {
type: [Boolean, String],
default: false
},
gettree: {
type: [Boolean, String],
default: false
},
manual: {
type: Boolean,
default: false
},
value: {
type: [Array, String, Number],
default() {
return [];
}
},
modelValue: {
type: [Array, String, Number],
default() {
return [];
}
},
preload: {
type: Boolean,
default: false
},
stepSearh: {
type: Boolean,
default: true
},
selfField: {
type: String,
default: ""
},
parentField: {
type: String,
default: ""
},
multiple: {
type: Boolean,
default: false
},
map: {
type: Object,
default() {
return {
text: "text",
value: "value"
};
}
}
},
data() {
return {
loading: false,
errorMessage: "",
loadMore: {
contentdown: "",
contentrefresh: "",
contentnomore: ""
},
dataList: [],
selected: [],
selectedIndex: 0,
page: {
current: this.pageCurrent,
size: this.pageSize,
count: 0
}
};
},
computed: {
isLocalData() {
return !this.collection.length;
},
isCloudData() {
return this.collection.length > 0;
},
isCloudDataList() {
return this.isCloudData && (!this.parentField && !this.selfField);
},
isCloudDataTree() {
return this.isCloudData && this.parentField && this.selfField;
},
dataValue() {
let isModelValue = Array.isArray(this.modelValue) ? this.modelValue.length > 0 : this.modelValue !== null || this.modelValue !== void 0;
return isModelValue ? this.modelValue : this.value;
},
hasValue() {
if (typeof this.dataValue === "number") {
return true;
}
return this.dataValue != null && this.dataValue.length > 0;
}
},
created() {
this.$watch(() => {
var al = [];
[
"pageCurrent",
"pageSize",
"spaceInfo",
"value",
"modelValue",
"localdata",
"collection",
"action",
"field",
"orderby",
"where",
"getont",
"getcount",
"gettree"
].forEach((key) => {
al.push(this[key]);
});
return al;
}, (newValue, oldValue) => {
for (let i2 = 2; i2 < newValue.length; i2++) {
if (newValue[i2] != oldValue[i2]) {
break;
}
}
if (newValue[0] != oldValue[0]) {
this.page.current = this.pageCurrent;
}
this.page.size = this.pageSize;
this.onPropsChange();
});
this._treeData = [];
},
methods: {
onPropsChange() {
this._treeData = [];
},
// 填充 pickview 数据
async loadData() {
if (this.isLocalData) {
this.loadLocalData();
} else if (this.isCloudDataList) {
this.loadCloudDataList();
} else if (this.isCloudDataTree) {
this.loadCloudDataTree();
}
},
// 加载本地数据
async loadLocalData() {
this._treeData = [];
this._extractTree(this.localdata, this._treeData);
let inputValue = this.dataValue;
if (inputValue === void 0) {
return;
}
if (Array.isArray(inputValue)) {
inputValue = inputValue[inputValue.length - 1];
if (typeof inputValue === "object" && inputValue[this.map.value]) {
inputValue = inputValue[this.map.value];
}
}
this.selected = this._findNodePath(inputValue, this.localdata);
},
// 加载 Cloud 数据 (单列)
async loadCloudDataList() {
if (this.loading) {
return;
}
this.loading = true;
try {
let response = await this.getCommand();
let responseData = response.result.data;
this._treeData = responseData;
this._updateBindData();
this._updateSelected();
this.onDataChange();
} catch (e2) {
this.errorMessage = e2;
} finally {
this.loading = false;
}
},
// 加载 Cloud 数据 (树形)
async loadCloudDataTree() {
if (this.loading) {
return;
}
this.loading = true;
try {
let commandOptions = {
field: this._cloudDataPostField(),
where: this._cloudDataTreeWhere()
};
if (this.gettree) {
commandOptions.startwith = `${this.selfField}=='${this.dataValue}'`;
}
let response = await this.getCommand(commandOptions);
let responseData = response.result.data;
this._treeData = responseData;
this._updateBindData();
this._updateSelected();
this.onDataChange();
} catch (e2) {
this.errorMessage = e2;
} finally {
this.loading = false;
}
},
// 加载 Cloud 数据 (节点)
async loadCloudDataNode(callback) {
if (this.loading) {
return;
}
this.loading = true;
try {
let commandOptions = {
field: this._cloudDataPostField(),
where: this._cloudDataNodeWhere()
};
let response = await this.getCommand(commandOptions);
let responseData = response.result.data;
callback(responseData);
} catch (e2) {
this.errorMessage = e2;
} finally {
this.loading = false;
}
},
// 回显 Cloud 数据
getCloudDataValue() {
if (this.isCloudDataList) {
return this.getCloudDataListValue();
}
if (this.isCloudDataTree) {
return this.getCloudDataTreeValue();
}
},
// 回显 Cloud 数据 (单列)
getCloudDataListValue() {
let where = [];
let whereField = this._getForeignKeyByField();
if (whereField) {
where.push(`${whereField} == '${this.dataValue}'`);
}
where = where.join(" || ");
if (this.where) {
where = `(${this.where}) && (${where})`;
}
return this.getCommand({
field: this._cloudDataPostField(),
where
}).then((res) => {
this.selected = res.result.data;
return res.result.data;
});
},
// 回显 Cloud 数据 (树形)
getCloudDataTreeValue() {
return this.getCommand({
field: this._cloudDataPostField(),
getTreePath: {
startWith: `${this.selfField}=='${this.dataValue}'`
}
}).then((res) => {
let treePath = [];
this._extractTreePath(res.result.data, treePath);
this.selected = treePath;
return treePath;
});
},
getCommand(options = {}) {
let db = Ws.database(this.spaceInfo);
const action = options.action || this.action;
if (action) {
db = db.action(action);
}
const collection = options.collection || this.collection;
db = db.collection(collection);
const where = options.where || this.where;
if (!(!where || !Object.keys(where).length)) {
db = db.where(where);
}
const field = options.field || this.field;
if (field) {
db = db.field(field);
}
const orderby = options.orderby || this.orderby;
if (orderby) {
db = db.orderBy(orderby);
}
const current = options.pageCurrent !== void 0 ? options.pageCurrent : this.page.current;
const size = options.pageSize !== void 0 ? options.pageSize : this.page.size;
const getCount = options.getcount !== void 0 ? options.getcount : this.getcount;
const getTree = options.gettree !== void 0 ? options.gettree : this.gettree;
const getOptions = {
getCount,
getTree
};
if (options.getTreePath) {
getOptions.getTreePath = options.getTreePath;
}
db = db.skip(size * (current - 1)).limit(size).get(getOptions);
return db;
},
_cloudDataPostField() {
let fields = [this.field];
if (this.parentField) {
fields.push(`${this.parentField} as parent_value`);
}
return fields.join(",");
},
_cloudDataTreeWhere() {
let result = [];
let selected = this.selected;
let parentField = this.parentField;
if (parentField) {
result.push(`${parentField} == null || ${parentField} == ""`);
}
if (selected.length) {
for (var i2 = 0; i2 < selected.length - 1; i2++) {
result.push(`${parentField} == '${selected[i2].value}'`);
}
}
let where = [];
if (this.where) {
where.push(`(${this.where})`);
}
if (result.length) {
where.push(`(${result.join(" || ")})`);
}
return where.join(" && ");
},
_cloudDataNodeWhere() {
let where = [];
let selected = this.selected;
if (selected.length) {
where.push(`${this.parentField} == '${selected[selected.length - 1].value}'`);
}
where = where.join(" || ");
if (this.where) {
return `(${this.where}) && (${where})`;
}
return where;
},
_getWhereByForeignKey() {
let result = [];
let whereField = this._getForeignKeyByField();
if (whereField) {
result.push(`${whereField} == '${this.dataValue}'`);
}
if (this.where) {
return `(${this.where}) && (${result.join(" || ")})`;
}
return result.join(" || ");
},
_getForeignKeyByField() {
let fields = this.field.split(",");
let whereField = null;
for (let i2 = 0; i2 < fields.length; i2++) {
const items = fields[i2].split("as");
if (items.length < 2) {
continue;
}
if (items[1].trim() === "value") {
whereField = items[0].trim();
break;
}
}
return whereField;
},
_updateBindData(node) {
const {
dataList,
hasNodes
} = this._filterData(this._treeData, this.selected);
let isleaf = this._stepSearh === false && !hasNodes;
if (node) {
node.isleaf = isleaf;
}
this.dataList = dataList;
this.selectedIndex = dataList.length - 1;
if (!isleaf && this.selected.length < dataList.length) {
this.selected.push({
value: null,
text: "请选择"
});
}
return {
isleaf,
hasNodes
};
},
_updateSelected() {
let dl = this.dataList;
let sl = this.selected;
let textField = this.map.text;
let valueField = this.map.value;
for (let i2 = 0; i2 < sl.length; i2++) {
let value = sl[i2].value;
let dl2 = dl[i2];
for (let j2 = 0; j2 < dl2.length; j2++) {
let item2 = dl2[j2];
if (item2[valueField] === value) {
sl[i2].text = item2[textField];
break;
}
}
}
},
_filterData(data, paths) {
let dataList = [];
let hasNodes = true;
dataList.push(data.filter((item) => {
return item.parent_value === null || item.parent_value === void 0 || item.parent_value === "";
}));
for (let i2 = 0; i2 < paths.length; i2++) {
let value = paths[i2].value;
let nodes = data.filter((item) => {
return item.parent_value === value;
});
if (nodes.length) {
dataList.push(nodes);
} else {
hasNodes = false;
}
}
return {
dataList,
hasNodes
};
},
_extractTree(nodes, result, parent_value) {
let valueField = this.map.value;
for (let i2 = 0; i2 < nodes.length; i2++) {
let node = nodes[i2];
let child = {};
for (let key in node) {
if (key !== "children") {
child[key] = node[key];
}
}
if (parent_value !== null && parent_value !== void 0 && parent_value !== "") {
child.parent_value = parent_value;
}
result.push(child);
let children = node.children;
if (children) {
this._extractTree(children, result, node[valueField]);
}
}
},
_extractTreePath(nodes, result) {
for (let i2 = 0; i2 < nodes.length; i2++) {
let node = nodes[i2];
let child = {};
for (let key in node) {
if (key !== "children") {
child[key] = node[key];
}
}
result.push(child);
let children = node.children;
if (children) {
this._extractTreePath(children, result);
}
}
},
_findNodePath(key, nodes, path = []) {
let textField = this.map.text;
let valueField = this.map.value;
for (let i2 = 0; i2 < nodes.length; i2++) {
let node = nodes[i2];
let children = node.children;
let text = node[textField];
let value = node[valueField];
path.push({
value,
text
});
if (value === key) {
return path;
}
if (children) {
const p2 = this._findNodePath(key, children, path);
if (p2.length) {
return p2;
}
}
path.pop();
}
return [];
}
}
};
const _sfc_main$9 = {
name: "UniDataPickerView",
emits: ["nodeclick", "change", "datachange", "update:modelValue"],
mixins: [dataPicker],
props: {
managedMode: {
type: Boolean,
default: false
},
ellipsis: {
type: Boolean,
default: true
}
},
created() {
if (!this.managedMode) {
this.$nextTick(() => {
this.loadData();
});
}
},
methods: {
onPropsChange() {
this._treeData = [];
this.selectedIndex = 0;
this.$nextTick(() => {
this.loadData();
});
},
handleSelect(index) {
this.selectedIndex = index;
},
handleNodeClick(item, i2, j2) {
if (item.disable) {
return;
}
const node = this.dataList[i2][j2];
const text = node[this.map.text];
const value = node[this.map.value];
if (i2 < this.selected.length - 1) {
this.selected.splice(i2, this.selected.length - i2);
this.selected.push({
text,
value
});
} else if (i2 === this.selected.length - 1) {
this.selected.splice(i2, 1, {
text,
value
});
}
if (node.isleaf) {
this.onSelectedChange(node, node.isleaf);
return;
}
const {
isleaf,
hasNodes
} = this._updateBindData();
if (this.isLocalData) {
this.onSelectedChange(node, !hasNodes || isleaf);
} else if (this.isCloudDataList) {
this.onSelectedChange(node, true);
} else if (this.isCloudDataTree) {
if (isleaf) {
this.onSelectedChange(node, node.isleaf);
} else if (!hasNodes) {
this.loadCloudDataNode((data) => {
if (!data.length) {
node.isleaf = true;
} else {
this._treeData.push(...data);
this._updateBindData(node);
}
this.onSelectedChange(node, node.isleaf);
});
}
}
},
updateData(data) {
this._treeData = data.treeData;
this.selected = data.selected;
if (!this._treeData.length) {
this.loadData();
} else {
this._updateBindData();
}
},
onDataChange() {
this.$emit("datachange");
},
onSelectedChange(node, isleaf) {
if (isleaf) {
this._dispatchEvent();
}
if (node) {
this.$emit("nodeclick", node);
}
},
_dispatchEvent() {
this.$emit("change", this.selected.slice(0));
}
}
};
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
const _component_uni_load_more = resolveEasycom(vue.resolveDynamicComponent("uni-load-more"), __easycom_0$1);
return vue.openBlock(), vue.createElementBlock("view", { class: "uni-data-pickerview" }, [
!_ctx.isCloudDataList ? (vue.openBlock(), vue.createElementBlock("scroll-view", {
key: 0,
class: "selected-area",
"scroll-x": "true"
}, [
vue.createElementVNode("view", { class: "selected-list" }, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(_ctx.selected, (item, index) => {
return vue.openBlock(), vue.createElementBlock("view", {
class: vue.normalizeClass(["selected-item", {
"selected-item-active": index == _ctx.selectedIndex
}]),
key: index,
onClick: ($event) => $options.handleSelect(index)
}, [
vue.createElementVNode(
"text",
null,
vue.toDisplayString(item.text || ""),
1
/* TEXT */
)
], 10, ["onClick"]);
}),
128
/* KEYED_FRAGMENT */
))
])
])) : vue.createCommentVNode("v-if", true),
vue.createElementVNode("view", { class: "tab-c" }, [
vue.createElementVNode("scroll-view", {
class: "list",
"scroll-y": true
}, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(_ctx.dataList[_ctx.selectedIndex], (item, j2) => {
return vue.openBlock(), vue.createElementBlock("view", {
class: vue.normalizeClass(["item", { "is-disabled": !!item.disable }]),
key: j2,
onClick: ($event) => $options.handleNodeClick(item, _ctx.selectedIndex, j2)
}, [
vue.createElementVNode(
"text",
{ class: "item-text" },
vue.toDisplayString(item[_ctx.map.text]),
1
/* TEXT */
),
_ctx.selected.length > _ctx.selectedIndex && item[_ctx.map.value] == _ctx.selected[_ctx.selectedIndex].value ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "check"
})) : vue.createCommentVNode("v-if", true)
], 10, ["onClick"]);
}),
128
/* KEYED_FRAGMENT */
))
]),
_ctx.loading ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "loading-cover"
}, [
vue.createVNode(_component_uni_load_more, {
class: "load-more",
contentText: _ctx.loadMore,
status: "loading"
}, null, 8, ["contentText"])
])) : vue.createCommentVNode("v-if", true),
_ctx.errorMessage ? (vue.openBlock(), vue.createElementBlock("view", {
key: 1,
class: "error-message"
}, [
vue.createElementVNode(
"text",
{ class: "error-text" },
vue.toDisplayString(_ctx.errorMessage),
1
/* TEXT */
)
])) : vue.createCommentVNode("v-if", true)
])
]);
}
const DataPickerView = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$1], ["__scopeId", "data-v-91ec6a82"], ["__file", "D:/projects/cxc-szcx-uniapp/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-pickerview.vue"]]);
const _sfc_main$8 = {
name: "UniDataPicker",
emits: ["popupopened", "popupclosed", "nodeclick", "input", "change", "update:modelValue", "inputclick"],
mixins: [dataPicker],
components: {
DataPickerView
},
props: {
options: {
type: [Object, Array],
default() {
return {};
}
},
popupTitle: {
type: String,
default: "请选择"
},
placeholder: {
type: String,
default: "请选择"
},
heightMobile: {
type: String,
default: ""
},
readonly: {
type: Boolean,
default: false
},
clearIcon: {
type: Boolean,
default: true
},
border: {
type: Boolean,
default: true
},
split: {
type: String,
default: "/"
},
ellipsis: {
type: Boolean,
default: true
}
},
data() {
return {
isOpened: false,
inputSelected: []
};
},
created() {
this.$nextTick(() => {
this.load();
});
},
watch: {
localdata: {
handler() {
this.load();
},
deep: true
}
},
methods: {
clear() {
this._dispatchEvent([]);
},
onPropsChange() {
this._treeData = [];
this.selectedIndex = 0;
this.load();
},
load() {
if (this.readonly) {
this._processReadonly(this.localdata, this.dataValue);
return;
}
if (this.isLocalData) {
this.loadData();
this.inputSelected = this.selected.slice(0);
} else if (this.isCloudDataList || this.isCloudDataTree) {
this.loading = true;
this.getCloudDataValue().then((res) => {
this.loading = false;
this.inputSelected = res;
}).catch((err) => {
this.loading = false;
this.errorMessage = err;
});
}
},
show() {
this.isOpened = true;
setTimeout(() => {
this.$refs.pickerView.updateData({
treeData: this._treeData,
selected: this.selected,
selectedIndex: this.selectedIndex
});
}, 200);
this.$emit("popupopened");
},
hide() {
this.isOpened = false;
this.$emit("popupclosed");
},
handleInput() {
if (this.readonly) {
this.$emit("inputclick");
return;
}
this.show();
},
handleClose(e2) {
this.hide();
},
onnodeclick(e2) {
this.$emit("nodeclick", e2);
},
ondatachange(e2) {
this._treeData = this.$refs.pickerView._treeData;
},
onchange(e2) {
this.hide();
this.$nextTick(() => {
this.inputSelected = e2;
});
this._dispatchEvent(e2);
},
_processReadonly(dataList, value) {
var isTree = dataList.findIndex((item2) => {
return item2.children;
});
if (isTree > -1) {
let inputValue;
if (Array.isArray(value)) {
inputValue = value[value.length - 1];
if (typeof inputValue === "object" && inputValue.value) {
inputValue = inputValue.value;
}
} else {
inputValue = value;
}
this.inputSelected = this._findNodePath(inputValue, this.localdata);
return;
}
if (!this.hasValue) {
this.inputSelected = [];
return;
}
let result = [];
for (let i2 = 0; i2 < value.length; i2++) {
var val = value[i2];
var item = dataList.find((v2) => {
return v2.value == val;
});
if (item) {
result.push(item);
}
}
if (result.length) {
this.inputSelected = result;
}
},
_filterForArray(data, valueArray) {
var result = [];
for (let i2 = 0; i2 < valueArray.length; i2++) {
var value = valueArray[i2];
var found = data.find((item) => {
return item.value == value;
});
if (found) {
result.push(found);
}
}
return result;
},
_dispatchEvent(selected) {
let item = {};
if (selected.length) {
var value = new Array(selected.length);
for (var i2 = 0; i2 < selected.length; i2++) {
value[i2] = selected[i2].value;
}
item = selected[selected.length - 1];
} else {
item.value = "";
}
if (this.formItem) {
this.formItem.setValue(item.value);
}
this.$emit("input", item.value);
this.$emit("update:modelValue", item.value);
this.$emit("change", {
detail: {
value: selected
}
});
}
}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
const _component_uni_load_more = resolveEasycom(vue.resolveDynamicComponent("uni-load-more"), __easycom_0$1);
const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_1$1);
const _component_data_picker_view = vue.resolveComponent("data-picker-view");
return vue.openBlock(), vue.createElementBlock("view", { class: "uni-data-tree" }, [
vue.createElementVNode("view", {
class: "uni-data-tree-input",
onClick: _cache[1] || (_cache[1] = (...args) => $options.handleInput && $options.handleInput(...args))
}, [
vue.renderSlot(_ctx.$slots, "default", {
options: $props.options,
data: $data.inputSelected,
error: _ctx.errorMessage
}, () => [
vue.createElementVNode(
"view",
{
class: vue.normalizeClass(["input-value", { "input-value-border": $props.border }])
},
[
_ctx.errorMessage ? (vue.openBlock(), vue.createElementBlock(
"text",
{
key: 0,
class: "selected-area error-text"
},
vue.toDisplayString(_ctx.errorMessage),
1
/* TEXT */
)) : _ctx.loading && !$data.isOpened ? (vue.openBlock(), vue.createElementBlock("view", {
key: 1,
class: "selected-area"
}, [
vue.createVNode(_component_uni_load_more, {
class: "load-more",
contentText: _ctx.loadMore,
status: "loading"
}, null, 8, ["contentText"])
])) : $data.inputSelected.length ? (vue.openBlock(), vue.createElementBlock("scroll-view", {
key: 2,
class: "selected-area",
"scroll-x": "true"
}, [
vue.createElementVNode("view", { class: "selected-list" }, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList($data.inputSelected, (item, index) => {
return vue.openBlock(), vue.createElementBlock("view", {
class: "selected-item",
key: index
}, [
vue.createElementVNode(
"text",
{ class: "text-color" },
vue.toDisplayString(item.text),
1
/* TEXT */
),
index < $data.inputSelected.length - 1 ? (vue.openBlock(), vue.createElementBlock(
"text",
{
key: 0,
class: "input-split-line"
},
vue.toDisplayString($props.split),
1
/* TEXT */
)) : vue.createCommentVNode("v-if", true)
]);
}),
128
/* KEYED_FRAGMENT */
))
])
])) : (vue.openBlock(), vue.createElementBlock(
"text",
{
key: 3,
class: "selected-area placeholder"
},
vue.toDisplayString($props.placeholder),
1
/* TEXT */
)),
$props.clearIcon && !$props.readonly && $data.inputSelected.length ? (vue.openBlock(), vue.createElementBlock("view", {
key: 4,
class: "icon-clear",
onClick: _cache[0] || (_cache[0] = vue.withModifiers((...args) => $options.clear && $options.clear(...args), ["stop"]))
}, [
vue.createVNode(_component_uni_icons, {
type: "clear",
color: "#c0c4cc",
size: "24"
})
])) : vue.createCommentVNode("v-if", true),
(!$props.clearIcon || !$data.inputSelected.length) && !$props.readonly ? (vue.openBlock(), vue.createElementBlock("view", {
key: 5,
class: "arrow-area"
}, [
vue.createElementVNode("view", { class: "input-arrow" })
])) : vue.createCommentVNode("v-if", true)
],
2
/* CLASS */
)
], true)
]),
$data.isOpened ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "uni-data-tree-cover",
onClick: _cache[2] || (_cache[2] = (...args) => $options.handleClose && $options.handleClose(...args))
})) : vue.createCommentVNode("v-if", true),
$data.isOpened ? (vue.openBlock(), vue.createElementBlock("view", {
key: 1,
class: "uni-data-tree-dialog"
}, [
vue.createElementVNode("view", { class: "uni-popper__arrow" }),
vue.createElementVNode("view", { class: "dialog-caption" }, [
vue.createElementVNode("view", { class: "title-area" }, [
vue.createElementVNode(
"text",
{ class: "dialog-title" },
vue.toDisplayString($props.popupTitle),
1
/* TEXT */
)
]),
vue.createElementVNode("view", {
class: "dialog-close",
onClick: _cache[3] || (_cache[3] = (...args) => $options.handleClose && $options.handleClose(...args))
}, [
vue.createElementVNode("view", {
class: "dialog-close-plus",
"data-id": "close"
}),
vue.createElementVNode("view", {
class: "dialog-close-plus dialog-close-rotate",
"data-id": "close"
})
])
]),
vue.createVNode(_component_data_picker_view, {
class: "picker-view",
ref: "pickerView",
modelValue: _ctx.dataValue,
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => _ctx.dataValue = $event),
localdata: _ctx.localdata,
preload: _ctx.preload,
collection: _ctx.collection,
field: _ctx.field,
orderby: _ctx.orderby,
where: _ctx.where,
"step-searh": _ctx.stepSearh,
"self-field": _ctx.selfField,
"parent-field": _ctx.parentField,
"managed-mode": true,
map: _ctx.map,
ellipsis: $props.ellipsis,
onChange: $options.onchange,
onDatachange: $options.ondatachange,
onNodeclick: $options.onnodeclick
}, null, 8, ["modelValue", "localdata", "preload", "collection", "field", "orderby", "where", "step-searh", "self-field", "parent-field", "map", "ellipsis", "onChange", "onDatachange", "onNodeclick"])
])) : vue.createCommentVNode("v-if", true)
]);
}
const __easycom_0 = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render], ["__scopeId", "data-v-2653531e"], ["__file", "D:/projects/cxc-szcx-uniapp/uni_modules/uni-data-picker/components/uni-data-picker/uni-data-picker.vue"]]);
const _sfc_main$7 = {
__name: "index",
setup(__props) {
const store = useStore();
const {
proxy
} = vue.getCurrentInstance();
const departList = vue.ref([]);
const queryMyDeptTreeList = () => {
queryMyDeptTreeListApi().then((res) => {
departList.value = res.result;
currentId = res.result[0].id;
queryUserByDepId(res.result[0].id);
}).catch((err) => {
formatAppLog("log", "at pages/userlist/index.vue:98", err);
});
};
const userlist = vue.ref([]);
const queryUserByDepId = (id, username2, realname2) => {
queryUserByDepIdApi({
id,
username: username2 || "",
realname: realname2 || ""
}).then((res) => {
if (res.success) {
userlist.value = res.result;
}
}).catch((err) => {
formatAppLog("log", "at pages/userlist/index.vue:113", err);
});
};
let currentId = null;
let departArr = [];
const onnodeclick = (e2) => {
queryUserByDepId(e2.id);
currentId = e2.id;
if (departArr.indexOf(e2.title) != -1) {
departArr.splice(departArr.indexOf(e2.title), 1, e2.title);
} else {
departArr.push(e2.title);
}
};
const popclose = (e2) => {
formatAppLog("log", "at pages/userlist/index.vue:129", "qqq", e2);
};
const chooseArr = vue.ref([]);
const choose = (id) => {
if (isradio) {
if (chooseArr.value.indexOf(id) != -1)
return;
chooseArr.value.splice(chooseArr.value.indexOf(id), 1, id);
} else {
if (chooseArr.value.indexOf(id) != -1) {
chooseArr.value.splice(chooseArr.value.indexOf(id), 1);
} else {
chooseArr.value.push(id);
}
}
};
let isradio = 0;
let taskId = null;
let nextnode = null;
let reason = null;
onLoad((options) => {
isradio = options.isradio;
taskId = options.id;
reason = options.reason;
if (options.nextnode) {
nextnode = JSON.parse(options.nextnode);
}
queryMyDeptTreeList();
});
const username = vue.ref("");
const realname = vue.ref("");
const search = () => {
if (username.value.trim() || realname.value.trim()) {
userlist.value = [];
queryUserByDepId(currentId, username.value, realname.value);
}
};
const refresh = () => {
username.value = "";
realname.value = "";
userlist.value = [];
queryUserByDepId(currentId, username.value, realname.value);
};
const taskEntrust = () => {
if (!chooseArr.value.length)
return proxy.$toast("请选择被委托人");
taskEntrustApi({
taskAssignee: userlist.value.filter((item) => item.id == chooseArr.value[0])[0].username,
taskId
}).then((res) => {
if (res.success) {
proxy.$toast(res.message);
setTimeout(() => {
uni.navigateBack();
}, 2e3);
}
});
};
const handleprocess = () => {
if (nextnode) {
processComplete();
} else {
taskEntrust();
}
};
const processComplete = () => {
processCompleteApi({
taskId,
reason,
processModel: 1,
nextnode: nextnode[0].nextnode,
nextUserName: userlist.value.filter((item) => item.id == chooseArr.value[0])[0].realname,
nextUserId: chooseArr.value[0]
}).then((res) => {
proxy.$toast(res.message);
setTimeout(() => {
uni.navigateBack();
}, 2e3);
});
};
return (_ctx, _cache) => {
const _component_uni_data_picker = resolveEasycom(vue.resolveDynamicComponent("uni-data-picker"), __easycom_0);
const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_1$1);
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass(["content", { "gray": vue.unref(store).isgray == 1 }])
},
[
vue.createVNode(_component_uni_data_picker, {
onPopupclosed: _cache[0] || (_cache[0] = ($event) => popclose($event)),
"step-searh": false,
map: { text: "departName", value: "id" },
localdata: departList.value,
"popup-title": "请选择部门",
placeholder: "请选择部门",
onNodeclick: onnodeclick
}, null, 8, ["localdata"]),
vue.createElementVNode("view", { class: "search_box" }, [
vue.createElementVNode("view", { class: "username f-row aic" }, [
vue.createTextVNode(" 用户姓名:"),
vue.withDirectives(vue.createElementVNode(
"input",
{
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => realname.value = $event),
type: "text",
placeholder: "请输入姓名",
"placeholder-style": "color: grey;font-size: 28rpx;"
},
null,
512
/* NEED_PATCH */
), [
[vue.vModelText, realname.value]
])
]),
vue.createElementVNode("view", { class: "username f-row aic" }, [
vue.createTextVNode(" 用户账号:"),
vue.withDirectives(vue.createElementVNode(
"input",
{
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => username.value = $event),
type: "text",
placeholder: "请输入账号",
"placeholder-style": "color: grey;font-size: 28rpx;"
},
null,
512
/* NEED_PATCH */
), [
[vue.vModelText, username.value]
])
]),
vue.createElementVNode("view", { class: "btn f-row aic jca" }, [
vue.createElementVNode("view", {
class: "f-row aic",
onClick: search
}, [
vue.createVNode(_component_uni_icons, {
type: "search",
size: "15",
color: "#fff"
}),
vue.createTextVNode(" 查询 ")
]),
vue.createElementVNode("view", {
class: "f-row aic",
onClick: refresh
}, [
vue.createVNode(_component_uni_icons, {
type: "refreshempty",
size: "15",
color: "#fff"
}),
vue.createTextVNode(" 重置 ")
])
])
]),
vue.createElementVNode("view", { class: "list" }, [
vue.createElementVNode("view", { class: "title f-row aic box" }, [
vue.createElementVNode("view", { class: "" }),
vue.createElementVNode("view", { class: "" }, " 序号 "),
vue.createElementVNode("view", { class: "username" }, " 用户账号 "),
vue.createElementVNode("view", { class: "" }, " 用户姓名 ")
]),
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(userlist.value, (item, i2) => {
return vue.openBlock(), vue.createElementBlock("view", {
class: "item f-row aic box",
key: i2
}, [
vue.createElementVNode("view", {
class: "f-row aic img",
onClick: ($event) => choose(item.id)
}, [
chooseArr.value.includes(item.id) ? (vue.openBlock(), vue.createElementBlock("image", {
key: 0,
src: "/static/login/checked.png",
mode: ""
})) : (vue.openBlock(), vue.createElementBlock("image", {
key: 1,
src: "/static/login/nocheck.png",
mode: ""
}))
], 8, ["onClick"]),
vue.createElementVNode(
"view",
{ class: "order" },
vue.toDisplayString(i2 + 1),
1
/* TEXT */
),
vue.createElementVNode("view", { class: "username f-col aic" }, [
vue.createElementVNode(
"view",
{ class: "" },
vue.toDisplayString(item.username),
1
/* TEXT */
)
]),
vue.createElementVNode("view", { class: "realname" }, [
vue.createElementVNode(
"view",
{ class: "" },
vue.toDisplayString(item.realname),
1
/* TEXT */
)
])
]);
}),
128
/* KEYED_FRAGMENT */
))
]),
vue.createElementVNode("view", { class: "confirm f-col aic" }, [
vue.createElementVNode("view", {
class: "",
onClick: handleprocess
}, " 确认 ")
])
],
2
/* CLASS */
);
};
}
};
const PagesUserlistIndex = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-89e61cf9"], ["__file", "D:/projects/cxc-szcx-uniapp/pages/userlist/index.vue"]]);
const _sfc_main$6 = {
__name: "detail",
setup(__props) {
const store = useStore();
return (_ctx, _cache) => {
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass(["content", { "gray": vue.unref(store).isgray == 1 }])
},
[
vue.createElementVNode("view", { class: "" }, [
vue.createElementVNode("video", { src: "" }),
vue.createElementVNode("view", { class: "title" }, " 五月天“突然好想你”线上演唱会精彩回放,这里就是标题 ")
]),
vue.createElementVNode("view", { class: "listcom" }, [
vue.createVNode(safeCom)
])
],
2
/* CLASS */
);
};
}
};
const PagesSafeDetail = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-952b08c2"], ["__file", "D:/projects/cxc-szcx-uniapp/pages/safe/detail.vue"]]);
var dayjs_min = { exports: {} };
(function(module, exports) {
!function(t2, e2) {
module.exports = e2();
}(commonjsGlobal, function() {
var t2 = 1e3, e2 = 6e4, n2 = 36e5, r2 = "millisecond", i2 = "second", s2 = "minute", u2 = "hour", a2 = "day", o2 = "week", c2 = "month", f2 = "quarter", h2 = "year", d2 = "date", l2 = "Invalid Date", $2 = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y2 = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M2 = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t3) {
var e3 = ["th", "st", "nd", "rd"], n3 = t3 % 100;
return "[" + t3 + (e3[(n3 - 20) % 10] || e3[n3] || e3[0]) + "]";
} }, m2 = function(t3, e3, n3) {
var r3 = String(t3);
return !r3 || r3.length >= e3 ? t3 : "" + Array(e3 + 1 - r3.length).join(n3) + t3;
}, v2 = { s: m2, z: function(t3) {
var e3 = -t3.utcOffset(), n3 = Math.abs(e3), r3 = Math.floor(n3 / 60), i3 = n3 % 60;
return (e3 <= 0 ? "+" : "-") + m2(r3, 2, "0") + ":" + m2(i3, 2, "0");
}, m: function t3(e3, n3) {
if (e3.date() < n3.date())
return -t3(n3, e3);
var r3 = 12 * (n3.year() - e3.year()) + (n3.month() - e3.month()), i3 = e3.clone().add(r3, c2), s3 = n3 - i3 < 0, u3 = e3.clone().add(r3 + (s3 ? -1 : 1), c2);
return +(-(r3 + (n3 - i3) / (s3 ? i3 - u3 : u3 - i3)) || 0);
}, a: function(t3) {
return t3 < 0 ? Math.ceil(t3) || 0 : Math.floor(t3);
}, p: function(t3) {
return { M: c2, y: h2, w: o2, d: a2, D: d2, h: u2, m: s2, s: i2, ms: r2, Q: f2 }[t3] || String(t3 || "").toLowerCase().replace(/s$/, "");
}, u: function(t3) {
return void 0 === t3;
} }, g2 = "en", D2 = {};
D2[g2] = M2;
var p2 = "$isDayjsObject", S2 = function(t3) {
return t3 instanceof _2 || !(!t3 || !t3[p2]);
}, w2 = function t3(e3, n3, r3) {
var i3;
if (!e3)
return g2;
if ("string" == typeof e3) {
var s3 = e3.toLowerCase();
D2[s3] && (i3 = s3), n3 && (D2[s3] = n3, i3 = s3);
var u3 = e3.split("-");
if (!i3 && u3.length > 1)
return t3(u3[0]);
} else {
var a3 = e3.name;
D2[a3] = e3, i3 = a3;
}
return !r3 && i3 && (g2 = i3), i3 || !r3 && g2;
}, O2 = function(t3, e3) {
if (S2(t3))
return t3.clone();
var n3 = "object" == typeof e3 ? e3 : {};
return n3.date = t3, n3.args = arguments, new _2(n3);
}, b2 = v2;
b2.l = w2, b2.i = S2, b2.w = function(t3, e3) {
return O2(t3, { locale: e3.$L, utc: e3.$u, x: e3.$x, $offset: e3.$offset });
};
var _2 = function() {
function M3(t3) {
this.$L = w2(t3.locale, null, true), this.parse(t3), this.$x = this.$x || t3.x || {}, this[p2] = true;
}
var m3 = M3.prototype;
return m3.parse = function(t3) {
this.$d = function(t4) {
var e3 = t4.date, n3 = t4.utc;
if (null === e3)
return /* @__PURE__ */ new Date(NaN);
if (b2.u(e3))
return /* @__PURE__ */ new Date();
if (e3 instanceof Date)
return new Date(e3);
if ("string" == typeof e3 && !/Z$/i.test(e3)) {
var r3 = e3.match($2);
if (r3) {
var i3 = r3[2] - 1 || 0, s3 = (r3[7] || "0").substring(0, 3);
return n3 ? new Date(Date.UTC(r3[1], i3, r3[3] || 1, r3[4] || 0, r3[5] || 0, r3[6] || 0, s3)) : new Date(r3[1], i3, r3[3] || 1, r3[4] || 0, r3[5] || 0, r3[6] || 0, s3);
}
}
return new Date(e3);
}(t3), this.init();
}, m3.init = function() {
var t3 = this.$d;
this.$y = t3.getFullYear(), this.$M = t3.getMonth(), this.$D = t3.getDate(), this.$W = t3.getDay(), this.$H = t3.getHours(), this.$m = t3.getMinutes(), this.$s = t3.getSeconds(), this.$ms = t3.getMilliseconds();
}, m3.$utils = function() {
return b2;
}, m3.isValid = function() {
return !(this.$d.toString() === l2);
}, m3.isSame = function(t3, e3) {
var n3 = O2(t3);
return this.startOf(e3) <= n3 && n3 <= this.endOf(e3);
}, m3.isAfter = function(t3, e3) {
return O2(t3) < this.startOf(e3);
}, m3.isBefore = function(t3, e3) {
return this.endOf(e3) < O2(t3);
}, m3.$g = function(t3, e3, n3) {
return b2.u(t3) ? this[e3] : this.set(n3, t3);
}, m3.unix = function() {
return Math.floor(this.valueOf() / 1e3);
}, m3.valueOf = function() {
return this.$d.getTime();
}, m3.startOf = function(t3, e3) {
var n3 = this, r3 = !!b2.u(e3) || e3, f3 = b2.p(t3), l3 = function(t4, e4) {
var i3 = b2.w(n3.$u ? Date.UTC(n3.$y, e4, t4) : new Date(n3.$y, e4, t4), n3);
return r3 ? i3 : i3.endOf(a2);
}, $3 = function(t4, e4) {
return b2.w(n3.toDate()[t4].apply(n3.toDate("s"), (r3 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e4)), n3);
}, y3 = this.$W, M4 = this.$M, m4 = this.$D, v3 = "set" + (this.$u ? "UTC" : "");
switch (f3) {
case h2:
return r3 ? l3(1, 0) : l3(31, 11);
case c2:
return r3 ? l3(1, M4) : l3(0, M4 + 1);
case o2:
var g3 = this.$locale().weekStart || 0, D3 = (y3 < g3 ? y3 + 7 : y3) - g3;
return l3(r3 ? m4 - D3 : m4 + (6 - D3), M4);
case a2:
case d2:
return $3(v3 + "Hours", 0);
case u2:
return $3(v3 + "Minutes", 1);
case s2:
return $3(v3 + "Seconds", 2);
case i2:
return $3(v3 + "Milliseconds", 3);
default:
return this.clone();
}
}, m3.endOf = function(t3) {
return this.startOf(t3, false);
}, m3.$set = function(t3, e3) {
var n3, o3 = b2.p(t3), f3 = "set" + (this.$u ? "UTC" : ""), l3 = (n3 = {}, n3[a2] = f3 + "Date", n3[d2] = f3 + "Date", n3[c2] = f3 + "Month", n3[h2] = f3 + "FullYear", n3[u2] = f3 + "Hours", n3[s2] = f3 + "Minutes", n3[i2] = f3 + "Seconds", n3[r2] = f3 + "Milliseconds", n3)[o3], $3 = o3 === a2 ? this.$D + (e3 - this.$W) : e3;
if (o3 === c2 || o3 === h2) {
var y3 = this.clone().set(d2, 1);
y3.$d[l3]($3), y3.init(), this.$d = y3.set(d2, Math.min(this.$D, y3.daysInMonth())).$d;
} else
l3 && this.$d[l3]($3);
return this.init(), this;
}, m3.set = function(t3, e3) {
return this.clone().$set(t3, e3);
}, m3.get = function(t3) {
return this[b2.p(t3)]();
}, m3.add = function(r3, f3) {
var d3, l3 = this;
r3 = Number(r3);
var $3 = b2.p(f3), y3 = function(t3) {
var e3 = O2(l3);
return b2.w(e3.date(e3.date() + Math.round(t3 * r3)), l3);
};
if ($3 === c2)
return this.set(c2, this.$M + r3);
if ($3 === h2)
return this.set(h2, this.$y + r3);
if ($3 === a2)
return y3(1);
if ($3 === o2)
return y3(7);
var M4 = (d3 = {}, d3[s2] = e2, d3[u2] = n2, d3[i2] = t2, d3)[$3] || 1, m4 = this.$d.getTime() + r3 * M4;
return b2.w(m4, this);
}, m3.subtract = function(t3, e3) {
return this.add(-1 * t3, e3);
}, m3.format = function(t3) {
var e3 = this, n3 = this.$locale();
if (!this.isValid())
return n3.invalidDate || l2;
var r3 = t3 || "YYYY-MM-DDTHH:mm:ssZ", i3 = b2.z(this), s3 = this.$H, u3 = this.$m, a3 = this.$M, o3 = n3.weekdays, c3 = n3.months, f3 = n3.meridiem, h3 = function(t4, n4, i4, s4) {
return t4 && (t4[n4] || t4(e3, r3)) || i4[n4].slice(0, s4);
}, d3 = function(t4) {
return b2.s(s3 % 12 || 12, t4, "0");
}, $3 = f3 || function(t4, e4, n4) {
var r4 = t4 < 12 ? "AM" : "PM";
return n4 ? r4.toLowerCase() : r4;
};
return r3.replace(y2, function(t4, r4) {
return r4 || function(t5) {
switch (t5) {
case "YY":
return String(e3.$y).slice(-2);
case "YYYY":
return b2.s(e3.$y, 4, "0");
case "M":
return a3 + 1;
case "MM":
return b2.s(a3 + 1, 2, "0");
case "MMM":
return h3(n3.monthsShort, a3, c3, 3);
case "MMMM":
return h3(c3, a3);
case "D":
return e3.$D;
case "DD":
return b2.s(e3.$D, 2, "0");
case "d":
return String(e3.$W);
case "dd":
return h3(n3.weekdaysMin, e3.$W, o3, 2);
case "ddd":
return h3(n3.weekdaysShort, e3.$W, o3, 3);
case "dddd":
return o3[e3.$W];
case "H":
return String(s3);
case "HH":
return b2.s(s3, 2, "0");
case "h":
return d3(1);
case "hh":
return d3(2);
case "a":
return $3(s3, u3, true);
case "A":
return $3(s3, u3, false);
case "m":
return String(u3);
case "mm":
return b2.s(u3, 2, "0");
case "s":
return String(e3.$s);
case "ss":
return b2.s(e3.$s, 2, "0");
case "SSS":
return b2.s(e3.$ms, 3, "0");
case "Z":
return i3;
}
return null;
}(t4) || i3.replace(":", "");
});
}, m3.utcOffset = function() {
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
}, m3.diff = function(r3, d3, l3) {
var $3, y3 = this, M4 = b2.p(d3), m4 = O2(r3), v3 = (m4.utcOffset() - this.utcOffset()) * e2, g3 = this - m4, D3 = function() {
return b2.m(y3, m4);
};
switch (M4) {
case h2:
$3 = D3() / 12;
break;
case c2:
$3 = D3();
break;
case f2:
$3 = D3() / 3;
break;
case o2:
$3 = (g3 - v3) / 6048e5;
break;
case a2:
$3 = (g3 - v3) / 864e5;
break;
case u2:
$3 = g3 / n2;
break;
case s2:
$3 = g3 / e2;
break;
case i2:
$3 = g3 / t2;
break;
default:
$3 = g3;
}
return l3 ? $3 : b2.a($3);
}, m3.daysInMonth = function() {
return this.endOf(c2).$D;
}, m3.$locale = function() {
return D2[this.$L];
}, m3.locale = function(t3, e3) {
if (!t3)
return this.$L;
var n3 = this.clone(), r3 = w2(t3, e3, true);
return r3 && (n3.$L = r3), n3;
}, m3.clone = function() {
return b2.w(this.$d, this);
}, m3.toDate = function() {
return new Date(this.valueOf());
}, m3.toJSON = function() {
return this.isValid() ? this.toISOString() : null;
}, m3.toISOString = function() {
return this.$d.toISOString();
}, m3.toString = function() {
return this.$d.toUTCString();
}, M3;
}(), k = _2.prototype;
return O2.prototype = k, [["$ms", r2], ["$s", i2], ["$m", s2], ["$H", u2], ["$W", a2], ["$M", c2], ["$y", h2], ["$D", d2]].forEach(function(t3) {
k[t3[1]] = function(e3) {
return this.$g(e3, t3[0], t3[1]);
};
}), O2.extend = function(t3, e3) {
return t3.$i || (t3(e3, _2, O2), t3.$i = true), O2;
}, O2.locale = w2, O2.isDayjs = S2, O2.unix = function(t3) {
return O2(1e3 * t3);
}, O2.en = D2[g2], O2.Ls = D2, O2.p = {}, O2;
});
})(dayjs_min);
var dayjs_minExports = dayjs_min.exports;
const dayjs = /* @__PURE__ */ getDefaultExportFromCjs(dayjs_minExports);
const _sfc_main$5 = {
__name: "index",
setup(__props) {
const store = useStore();
const zhibanArr = vue.ref([]);
onLoad(() => {
zhibanQuery();
});
const index = vue.ref(dayjs().format("YYYY-MM"));
const bindPickerChange = (e2) => {
index.value = e2.detail.value;
zhibanQuery();
};
const zhibanQuery = () => {
let [year, month] = index.value.split("-");
zhibanQueryApi({
year,
month
}).then((res) => {
zhibanArr.value = res.result.records;
}).catch((err) => {
formatAppLog("log", "at pages/zhiban/index.vue:73", err);
});
};
return (_ctx, _cache) => {
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass(["f-col", "aic", { "gray": vue.unref(store).isgray == 1 }])
},
[
vue.createElementVNode("picker", {
fields: "month",
mode: "date",
onChange: bindPickerChange,
value: index.value
}, [
vue.createElementVNode(
"view",
{ class: "date" },
vue.toDisplayString(index.value) + " 点击选择月份",
1
/* TEXT */
)
], 40, ["value"]),
vue.createElementVNode("view", { class: "info" }, [
vue.createElementVNode("view", { class: "info_title f-row aic" }, [
vue.createElementVNode("view", { class: "" }, " 日期 "),
vue.createElementVNode("view", { class: "" }, " 带班领导 "),
vue.createElementVNode("view", { class: "" }, " 值班领导 "),
vue.createElementVNode("view", { class: "" }, " 值班干部 ")
]),
vue.createElementVNode("view", { class: "data_box" }, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(zhibanArr.value, (item, i2) => {
return vue.openBlock(), vue.createElementBlock("view", { class: "data f-row aic" }, [
vue.createElementVNode(
"view",
{ class: "" },
vue.toDisplayString(item.date),
1
/* TEXT */
),
vue.createElementVNode(
"view",
{ class: "" },
vue.toDisplayString(item.dbld_dictText),
1
/* TEXT */
),
vue.createElementVNode(
"view",
{ class: "" },
vue.toDisplayString(item.zbld_dictText),
1
/* TEXT */
),
vue.createElementVNode(
"view",
{ class: "" },
vue.toDisplayString(item.zbgbrealname),
1
/* TEXT */
)
]);
}),
256
/* UNKEYED_FRAGMENT */
))
])
])
],
2
/* CLASS */
);
};
}
};
const PagesZhibanIndex = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-54a2fc4a"], ["__file", "D:/projects/cxc-szcx-uniapp/pages/zhiban/index.vue"]]);
const _sfc_main$4 = {
__name: "self",
setup(__props) {
const store = useStore();
const taskArr = vue.ref([]);
let processName = "";
onLoad((options) => {
processName = options.title;
getmyApply();
});
let pageNo = 1;
let pageSize = 10;
let loading2 = false;
const getmyApply = () => {
loading2 = true;
uni.showLoading({
title: "加载中..."
});
myApplyProcessListApi({
pageNo,
pageSize,
_t: (/* @__PURE__ */ new Date()).getTime(),
processName
}).then((res) => {
if (res.success) {
if (!res.result.records.length)
return toast("没有更多了~");
let arr = res.result.records;
arr.map((item) => {
item["processApplyUserName"] = item["startUserName"];
item["processDefinitionName"] = item["prcocessDefinitionName"];
item["taskBeginTime"] = item["startTime"];
});
taskArr.value = [...taskArr.value, ...arr];
loading2 = false;
}
}).catch((err) => {
formatAppLog("log", "at pages/task/self.vue:59", err);
});
};
const jump = (url) => {
beforeJump(url, () => {
uni.navigateTo({
url
});
});
};
onReachBottom(() => {
if (loading2)
return;
pageNo++;
getmyApply();
});
return (_ctx, _cache) => {
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass({ "gray": vue.unref(store).isgray == 1 })
},
[
vue.createVNode(tasklistCom, {
onJump: jump,
taskArr: taskArr.value,
currentIndex: 2
}, null, 8, ["taskArr"])
],
2
/* CLASS */
);
};
}
};
const PagesTaskSelf = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__file", "D:/projects/cxc-szcx-uniapp/pages/task/self.vue"]]);
__definePage("pages/login/login", PagesLoginLogin);
__definePage("pages/tab/index", PagesTabIndex);
__definePage("pages/tab/office", PagesTabOffice);
__definePage("pages/tab/product", PagesTabProduct);
__definePage("pages/tab/my", PagesTabMy);
__definePage("pages/task/index", PagesTaskIndex);
__definePage("pages/task/handle", PagesTaskHandle);
__definePage("pages/talk/message_list", PagesTalkMessage_list);
__definePage("pages/talk/conversation", PagesTalkConversation);
__definePage("pages/talk/system", PagesTalkSystem);
__definePage("pages/document/index", PagesDocumentIndex);
__definePage("pages/document/detail", PagesDocumentDetail);
__definePage("pages/meeting/index", PagesMeetingIndex);
__definePage("pages/meeting/detail", PagesMeetingDetail);
__definePage("pages/leave/application", PagesLeaveApplication);
__definePage("pages/checkin/index", PagesCheckinIndex);
__definePage("pages/useredit/useredit", PagesUsereditUseredit);
__definePage("pages/useredit/address", PagesUsereditAddress);
__definePage("pages/useredit/add_address", PagesUsereditAdd_address);
__definePage("pages/useredit/addressbook", PagesUsereditAddressbook);
__definePage("pages/task/todotask", PagesTaskTodotask);
__definePage("pages/safe/manage", PagesSafeManage);
__definePage("pages/product/index", PagesProductIndex);
__definePage("pages/userlist/index", PagesUserlistIndex);
__definePage("pages/safe/detail", PagesSafeDetail);
__definePage("pages/zhiban/index", PagesZhibanIndex);
__definePage("pages/task/self", PagesTaskSelf);
2024-10-15 00:38:47 +00:00
const baseUrl = "https://36.112.48.190/jeecg-boot/sys/common/static/";
2024-09-24 09:21:34 +00:00
const useUpdateApp = defineStore("updateApp", () => {
const updateOptions = vue.reactive({
force: false,
hasNew: false,
content: "",
url: "",
wgtUrl: ""
});
const systemInfo = uni.getSystemInfoSync();
function checkAppUpdate(to = false) {
try {
upDateAppApi().then(async (res) => {
let {
result
} = res;
2024-09-26 04:06:47 +00:00
result.apkUrl = baseUrl + result.apkUrl;
result.wgtUrl = baseUrl + result.wgtUrl;
formatAppLog("log", "at store/update.js:40", "更新", result);
2024-09-24 09:21:34 +00:00
updateOptions.wgtUrl = result.wgtUrl;
if (systemInfo.osName === "android") {
updateOptions.apkUrl = result.apkUrl;
updateOptions.hasNew = await hasNewVersion(result.versionCode, result.update == "wgt");
} else {
updateOptions.url = `itms-apps://itunes.apple.com/cn/app/id${123456}?mt=8`;
}
updateOptions.hasNew && uni.showModal({
title: "更新",
content: "发现新版本,请更新",
success(res2) {
if (res2.confirm) {
onClickUpdate(result.update, result);
} else {
plus.runtime.quit();
}
}
});
});
} catch (error) {
updateOptions.hasNew = false;
}
}
return {
checkAppUpdate,
...vue.toRefs(updateOptions),
systemInfo
};
});
const _sfc_main$3 = {
__name: "App",
setup(__props) {
onLaunch(() => {
uni.onTabBarMidButtonTap(() => {
beforeJump("/pages/task/index", () => {
uni.navigateTo({
url: "/pages/task/index?id=0"
});
});
});
useUpdateApp().checkAppUpdate();
getLocation();
});
onShow(() => {
cxcJurisdictionApi({
id: "1827997127165677570"
}).then((res) => {
if (res.success) {
const store = useStore();
uni.setStorageSync("isgray", res.result.value);
store.setIsgray(res.result.value);
}
});
});
return () => {
};
}
};
const App = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__file", "D:/projects/cxc-szcx-uniapp/App.vue"]]);
const _sfc_main$2 = {
__name: "index",
props: {
dataId: {
type: String,
default: ""
}
},
setup(__props) {
const props = __props;
2024-10-14 07:22:41 +00:00
const imageValue = vue.ref([]);
const imageStyles = {
width: 64,
height: 64,
border: {
color: "#dce7e1",
width: 2,
style: "dashed",
radius: "2px"
}
};
2024-09-24 09:21:34 +00:00
const info = vue.ref({});
2024-10-14 00:51:28 +00:00
const qjQueryById = () => {
2024-09-24 09:21:34 +00:00
qjQueryByIdApi({
id: props.dataId
}).then((res) => {
if (res.success) {
2024-10-14 00:51:28 +00:00
info.value = res.result.records[0];
2024-10-14 07:22:41 +00:00
imageValue.value = info.value.path.split(",").map((path) => {
const name2 = path.split("/").pop();
const extname = name2.split(".").pop();
return {
name: name2,
extname,
url: imgUrl(path)
};
});
2024-09-24 09:21:34 +00:00
}
});
};
2024-10-14 00:51:28 +00:00
const extActFlowData = () => {
2024-09-24 09:21:34 +00:00
extActFlowDataApi({
2024-10-12 00:53:10 +00:00
flowCode: "dev_cxc_qxj",
2024-09-24 09:21:34 +00:00
dataId: props.dataId
}).then((res) => {
if (res.success) {
processHistoryList(res.result.processInstanceId);
}
});
};
const step = vue.ref([]);
const processHistoryList = (processInstanceId) => {
processHistoryListApi({
processInstanceId
}).then((res) => {
if (res.success) {
step.value = res.result.records;
}
});
};
vue.onMounted(() => {
qjQueryById();
extActFlowData();
});
return (_ctx, _cache) => {
2024-10-14 07:22:41 +00:00
const _component_uni_file_picker = resolveEasycom(vue.resolveDynamicComponent("uni-file-picker"), __easycom_0$2);
2024-10-14 00:51:28 +00:00
return vue.openBlock(), vue.createElementBlock(
vue.Fragment,
null,
[
vue.createElementVNode("view", { class: "f-col aic" }, [
vue.createElementVNode("view", { class: "info_box" }, [
vue.createElementVNode("view", { class: "title" }, " 申请信息 "),
vue.createElementVNode("view", { class: "info f-row aic jcb" }, [
vue.createElementVNode("view", null, " 请假职工: "),
vue.createElementVNode(
"text",
null,
vue.toDisplayString(info.value.username_dictText),
1
/* TEXT */
)
]),
vue.createElementVNode("view", { class: "info f-row aic jcb" }, [
vue.createElementVNode("view", null, " 所属单位: "),
vue.createElementVNode(
"text",
null,
vue.toDisplayString(info.value.sysOrgCode_dictText),
1
/* TEXT */
)
]),
vue.createElementVNode("view", { class: "info f-row aic jcb" }, [
vue.createElementVNode("view", null, " 联系方式: "),
vue.createElementVNode(
"text",
null,
vue.toDisplayString(info.value.phone),
1
/* TEXT */
)
]),
vue.createElementVNode("view", { class: "info f-row aic jcb" }, [
vue.createElementVNode("view", null, " 请假类型: "),
vue.createElementVNode(
"text",
null,
vue.toDisplayString(info.value.type),
1
/* TEXT */
)
]),
vue.createElementVNode("view", { class: "info f-row aic jcb" }, [
vue.createElementVNode("view", null, " 请假开始时间: "),
vue.createElementVNode(
"text",
null,
vue.toDisplayString(info.value.begintime),
1
/* TEXT */
)
]),
vue.createElementVNode("view", { class: "info f-row aic jcb" }, [
vue.createElementVNode("view", null, " 请假结束时间: "),
vue.createElementVNode(
"text",
null,
vue.toDisplayString(info.value.endtime),
1
/* TEXT */
)
]),
vue.createElementVNode("view", { class: "info f-row aic jcb" }, [
vue.createElementVNode("view", null, " 请假天数: "),
vue.createElementVNode(
"text",
null,
2024-10-14 07:22:41 +00:00
vue.toDisplayString(info.value.days),
2024-10-14 00:51:28 +00:00
1
/* TEXT */
)
]),
vue.createElementVNode("view", { class: "info f-row aic jcb" }, [
vue.createElementVNode("view", null, " 审批人: "),
vue.createElementVNode(
"text",
null,
vue.toDisplayString(info.value.examineleader_dictText),
1
/* TEXT */
)
]),
vue.createElementVNode("view", { class: "info f-row aic jcb" }, [
vue.createElementVNode("view", null, " 请假地点: "),
vue.createElementVNode(
"text",
null,
vue.toDisplayString(info.value.address),
1
/* TEXT */
)
]),
vue.createElementVNode("view", { class: "info f-row aic jcb" }, [
vue.createElementVNode("view", null, " 请假原因: "),
vue.createElementVNode(
"text",
null,
vue.toDisplayString(info.value.reason),
1
/* TEXT */
)
2024-10-14 07:22:41 +00:00
]),
vue.createElementVNode("view", { class: "info f-row aic jcb" }, [
vue.createElementVNode("view", null, " 附件: "),
vue.createVNode(_component_uni_file_picker, {
modelValue: imageValue.value,
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => imageValue.value = $event),
"image-styles": imageStyles
}, null, 8, ["modelValue"])
2024-10-14 00:51:28 +00:00
])
2024-09-24 09:21:34 +00:00
])
2024-10-14 00:51:28 +00:00
]),
vue.createElementVNode("view", { class: "f-col aic" }, [
vue.createElementVNode("view", { class: "progress" }, [
vue.createElementVNode("view", { class: "title" }, " 审批流程 "),
vue.createElementVNode("view", { class: "progress_box" }, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(step.value, (item, index) => {
return vue.openBlock(), vue.createElementBlock("view", {
class: "box",
key: index
}, [
vue.createElementVNode("view", { class: "topic f-row aic" }, [
vue.createElementVNode(
"view",
null,
vue.toDisplayString(item.name),
1
/* TEXT */
),
vue.createElementVNode(
"view",
{
class: vue.normalizeClass(["status", { "complete": item.deleteReason == "已完成" }, { "refuse": item.deleteReason == "已拒绝" }])
},
vue.toDisplayString(item.deleteReason),
3
/* TEXT, CLASS */
)
]),
2024-09-24 09:21:34 +00:00
vue.createElementVNode(
"view",
2024-10-14 00:51:28 +00:00
{ class: "name_time" },
vue.toDisplayString(item.assigneeName) + " | " + vue.toDisplayString(item.endTime),
2024-09-24 09:21:34 +00:00
1
/* TEXT */
)
2024-10-14 00:51:28 +00:00
]);
}),
128
/* KEYED_FRAGMENT */
))
])
2024-09-24 09:21:34 +00:00
])
])
2024-10-14 00:51:28 +00:00
],
64
/* STABLE_FRAGMENT */
);
2024-09-24 09:21:34 +00:00
};
}
};
const leaveApplication = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-e7121647"], ["__file", "D:/projects/cxc-szcx-uniapp/bpm/leaveApplication/index.vue"]]);
const _sfc_main$1 = {
__name: "processCom",
props: {
info: {
type: Array,
default: () => []
}
},
setup(__props) {
return (_ctx, _cache) => {
return vue.openBlock(), vue.createElementBlock("view", { class: "f-col aic" }, [
vue.createElementVNode("view", { class: "info_box" }, [
vue.createElementVNode("view", { class: "title" }, " 申请信息 "),
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(__props.info, (item, i2) => {
return vue.openBlock(), vue.createElementBlock("view", {
class: "",
key: i2
}, [
vue.createElementVNode("view", { class: "info f-row aic jcb" }, [
vue.createElementVNode(
"view",
{ class: "" },
vue.toDisplayString(item.title) + " ",
1
/* TEXT */
),
item.title == "事项内容" ? (vue.openBlock(), vue.createElementBlock("rich-text", {
key: 0,
nodes: item.data
}, null, 8, ["nodes"])) : (vue.openBlock(), vue.createElementBlock(
"text",
{ key: 1 },
vue.toDisplayString(item.data),
1
/* TEXT */
))
])
]);
}),
128
/* KEYED_FRAGMENT */
))
])
]);
};
}
};
const processCom = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-edc8a089"], ["__file", "D:/projects/cxc-szcx-uniapp/bpm/processCom.vue"]]);
const _sfc_main = {
__name: "supervise",
props: {
dataId: {
type: String,
default: ""
}
},
setup(__props) {
const props = __props;
const tabArr = [{
title: "基本信息",
id: 1
}, {
title: "事项详情",
id: 2
}, {
title: "添加下级",
id: 3
}, {
title: "节点顺序",
id: 4
}, {
title: "运行计划",
id: 5
}];
const currentTab = vue.ref(1);
const changeTab = (id) => {
currentTab.value = id;
dbSxxqQueryById();
};
const info = vue.ref([]);
const dbSxxqQueryById = () => {
dbSxxqQueryByIdApi({
id: props.dataId
}).then((res) => {
if (res.success) {
if (currentTab.value == 1) {
dbJbxxQueryById(res.result.jbxxid);
}
if (currentTab.value == 2) {
let d2 = res.result;
info.value = [{
title: "承办部门",
data: d2.zbdw
}, {
title: "协办部门",
data: d2.xbdw
}, {
title: "部门领导",
data: d2.fgld
}, {
title: "办理人员",
data: d2.dbry
}, {
title: "要求反馈时间",
data: d2.yqfksj
}, {
title: "节点名称",
data: ""
}, {
title: "预计完成时间",
data: ""
}, {
title: "实际反馈时间",
data: d2.sjfksj
}, {
title: "自评价",
data: d2.zpj
}, {
title: "发起时间",
data: d2.fqsj
}, {
title: "序号",
data: ""
}, {
title: "概述",
data: ""
}, {
title: "时间进度",
data: ""
}, {
title: "事项内容",
data: d2.sxnr
}];
}
}
});
};
const dbJbxxQueryById = (id) => {
dbJbxxQueryByIdApi({
id
}).then((res) => {
if (res.success) {
let d2 = res.result;
info.value = [{
title: "督办分类",
data: d2.fl
}, {
title: "协办部门",
data: d2.xbbm
}, {
title: "督办部门",
data: d2.cbbm
}, {
title: "督办人员",
data: d2.dbry
}, {
title: "督办部门负责人",
data: d2.zrr
}, {
title: "是否涉密",
data: d2.sfsm
}, {
title: "计划完成时间",
data: d2.jhwcsj
}, {
title: "实际完成时间",
data: d2.wcsj
}, {
title: "完成状态",
data: d2.wczt
}, {
title: "备注",
data: d2.bz
}, {
title: "督办事项",
data: d2.dbsx
}, {
title: "时间进度",
data: d2.sjjd
}];
}
});
};
const extActFlowData = (dataId) => {
extActFlowDataApi({
flowCode: "dev_db_sxxq_001",
dataId: props.dataId
}).then((res) => {
if (res.success) {
processHistoryList(res.result.processInstanceId);
}
});
};
const step = vue.ref([]);
const processHistoryList = (processInstanceId) => {
formatAppLog("log", "at bpm/supervise.vue:199", "000", processInstanceId);
processHistoryListApi({
processInstanceId
}).then((res) => {
formatAppLog("log", "at bpm/supervise.vue:203", "0088800", res);
if (res.success) {
step.value = res.result.records;
}
});
};
vue.onMounted(() => {
dbSxxqQueryById();
extActFlowData();
});
return (_ctx, _cache) => {
return vue.openBlock(), vue.createElementBlock("view", { class: "" }, [
vue.createElementVNode("view", { class: "tab f-row aic" }, [
(vue.openBlock(), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(tabArr, (item, i2) => {
return vue.createElementVNode("view", {
class: vue.normalizeClass({ "active": currentTab.value == item.id }),
key: i2,
onClick: ($event) => changeTab(item.id)
}, vue.toDisplayString(item.title), 11, ["onClick"]);
}),
64
/* STABLE_FRAGMENT */
))
]),
vue.createVNode(processCom, { info: info.value }, null, 8, ["info"]),
vue.createElementVNode("view", { class: "f-col aic" }, [
vue.createElementVNode("view", { class: "progress" }, [
vue.createElementVNode("view", { class: "title" }, " 审批流程 "),
vue.createElementVNode("view", { class: "progress_box" }, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(step.value, (item, index) => {
return vue.openBlock(), vue.createElementBlock("view", {
class: "box",
key: index
}, [
vue.createElementVNode("view", { class: "topic f-row aic" }, [
vue.createElementVNode(
"view",
{ class: "" },
vue.toDisplayString(item.name),
1
/* TEXT */
),
vue.createElementVNode(
"view",
{
class: vue.normalizeClass(["status", { "complete": item.deleteReason == "已完成" }, { "refuse": item.deleteReason == "已拒绝" }])
},
vue.toDisplayString(item.deleteReason),
3
/* TEXT, CLASS */
)
]),
vue.createElementVNode(
"view",
{ class: "name_time" },
vue.toDisplayString(item.assigneeName) + " | " + vue.toDisplayString(item.endTime),
1
/* TEXT */
)
]);
}),
128
/* KEYED_FRAGMENT */
))
])
])
])
]);
};
}
};
const supervise = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-ecbe2408"], ["__file", "D:/projects/cxc-szcx-uniapp/bpm/supervise.vue"]]);
const pinia = createPinia();
function createApp() {
const app = vue.createVueApp(App);
app.use(pinia);
app.component("leaveApplication", leaveApplication);
app.component("supervise", supervise);
app.config.globalProperties.$toast = toast;
return {
app
};
}
const { app: __app__, Vuex: __Vuex__, Pinia: __Pinia__ } = createApp();
uni.Vuex = __Vuex__;
uni.Pinia = __Pinia__;
__app__.provide("__globalStyles", __uniConfig.styles);
__app__._component.mpType = "app";
__app__._component.render = () => {
};
__app__.mount("#app");
})(Vue);