From 22f551742fdc1cc7301c7112fad10f9babeb9f42 Mon Sep 17 00:00:00 2001 From: hukan <2685163979@qq.com> Date: Wed, 18 Dec 2024 21:13:07 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=80=E4=BA=9B?= =?UTF-8?q?=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- user/mp-weixin/common/main.js | 313 ++++--- user/mp-weixin/common/runtime.js | 593 +++++++------ user/mp-weixin/common/vendor.js | 804 ++++++++++-------- .../addOrEditAddress/addOrEditAddress.js | 17 - 4 files changed, 963 insertions(+), 764 deletions(-) diff --git a/user/mp-weixin/common/main.js b/user/mp-weixin/common/main.js index a6fff47..6a29263 100644 --- a/user/mp-weixin/common/main.js +++ b/user/mp-weixin/common/main.js @@ -1,138 +1,193 @@ (global["webpackJsonp"] = global["webpackJsonp"] || []).push([["common/main"],[ -/* 0 */ -/*!*****************************************************!*\ - !*** D:/project/project-rjwm-weixin-uniapp/main.js ***! - \*****************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* WEBPACK VAR INJECTION */(function(createApp) {__webpack_require__(/*! uni-pages */ 5); - -var _vue = _interopRequireDefault(__webpack_require__(/*! vue */ 4)); -var _App = _interopRequireDefault(__webpack_require__(/*! ./App */ 6)); -var _store = _interopRequireDefault(__webpack_require__(/*! ./store */ 12)); -__webpack_require__(/*! @/styles/common.scss */ 14);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}function ownKeys(object, enumerableOnly) {var keys = Object.keys(object);if (Object.getOwnPropertySymbols) {var symbols = Object.getOwnPropertySymbols(object);if (enumerableOnly) symbols = symbols.filter(function (sym) {return Object.getOwnPropertyDescriptor(object, sym).enumerable;});keys.push.apply(keys, symbols);}return keys;}function _objectSpread(target) {for (var i = 1; i < arguments.length; i++) {var source = arguments[i] != null ? arguments[i] : {};if (i % 2) {ownKeys(Object(source), true).forEach(function (key) {_defineProperty(target, key, source[key]);});} else if (Object.getOwnPropertyDescriptors) {Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));} else {ownKeys(Object(source)).forEach(function (key) {Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));});}}return target;}function _defineProperty(obj, key, value) {if (key in obj) {Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });} else {obj[key] = value;}return obj;} // @ts-ignore -wx.__webpack_require_UNI_MP_PLUGIN__ = __webpack_require__; -_vue.default.config.productionTip = false; -_vue.default.prototype.$store = _store.default; - -_App.default.mpType = 'app'; - -var app = new _vue.default(_objectSpread({ - store: _store.default }, -_App.default)); - -createApp(app).$mount(); -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["createApp"])) - -/***/ }), -/* 1 */, -/* 2 */, -/* 3 */, -/* 4 */, -/* 5 */, -/* 6 */ -/*!*****************************************************!*\ - !*** D:/project/project-rjwm-weixin-uniapp/App.vue ***! - \*****************************************************/ -/*! no static exports found */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _App_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./App.vue?vue&type=script&lang=js& */ 7); -/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _App_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== 'default') (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _App_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__)); -/* harmony import */ var _App_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./App.vue?vue&type=style&index=0&lang=css& */ 9); -/* harmony import */ var _F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/runtime/componentNormalizer.js */ 11); -var render, staticRenderFns, recyclableRender, components -var renderjs - - - - - -/* normalize component */ -var component = Object(_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])( - _App_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"], - render, - staticRenderFns, - false, - null, - null, - null, - false, - components, - renderjs -) + /* 0 */ + /*!*****************************************************!*\ + !*** D:/project/project-rjwm-weixin-uniapp/main.js ***! + \*****************************************************/ + /*! no static exports found */ + /***/ (function(module, exports, __webpack_require__) { + + "use strict"; + /* WEBPACK VAR INJECTION */(function(createApp) { + // Importing necessary modules + __webpack_require__(/*! uni-pages */ 5); + + var _vue = _interopRequireDefault(__webpack_require__(/*! vue */ 4)); // Import Vue + var _App = _interopRequireDefault(__webpack_require__(/*! ./App */ 6)); // Import main App component + var _store = _interopRequireDefault(__webpack_require__(/*! ./store */ 12)); // Import store + __webpack_require__(/*! @/styles/common.scss */ 14); // Import global styles (SCSS) + + // Helper function to handle default imports + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + // @ts-ignore + wx.__webpack_require_UNI_MP_PLUGIN__ = __webpack_require__; + _vue.default.config.productionTip = false; // Disable production tip + _vue.default.prototype.$store = _store.default; // Set store to Vue prototype + + // Set the app type to 'app' + _App.default.mpType = 'app'; + + // Create the app instance with the store and App component + var app = new _vue.default(_objectSpread({ + store: _store.default }, + _App.default)); + + // Mount the app to the DOM + createApp(app).$mount(); + /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["createApp"])) + + /***/ }), + + /* 1 */, + /* 2 */, + /* 3 */, + /* 4 */, + /* 5 */, + + /* 6 */ + /*!*****************************************************!*\ + !*** D:/project/project-rjwm-weixin-uniapp/App.vue ***! + \*****************************************************/ + /*! no static exports found */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + + "use strict"; + __webpack_require__.r(__webpack_exports__); +// Importing the script and style for the App component + /* harmony import */ var _App_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./App.vue?vue&type=script&lang=js& */ 7); + /* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _App_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== 'default') (function(key) { + __webpack_require__.d(__webpack_exports__, key, function() { return _App_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__[key]; }) + }(__WEBPACK_IMPORT_KEY__)); + /* harmony import */ var _App_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./App.vue?vue&type=style&index=0&lang=css& */ 9); + +// Import the component normalizer for handling Vue component structure + /* harmony import */ var _F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/runtime/componentNormalizer.js */ 11); + var render, staticRenderFns, recyclableRender, components + var renderjs + + /* normalize component */ +// Normalize the App component using the imported component normalizer + var component = Object(_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])( + _App_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"], + render, + staticRenderFns, + false, + null, + null, + null, + false, + components, + renderjs + ) + + component.options.__file = "App.vue" // Set the file path for the component + /* harmony default export */ __webpack_exports__["default"] = (component.exports); + + /***/ }), + + /* 7 */ + /*!******************************************************************************!*\ + !*** D:/project/project-rjwm-weixin-uniapp/App.vue?vue&type=script&lang=js& ***! + \******************************************************************************/ + /*! no static exports found */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + + "use strict"; + __webpack_require__.r(__webpack_exports__); +// The main logic for handling the app lifecycle + /* harmony default export */ var _default = { + onLaunch: function onLaunch() { + console.log('App Launch'); // Log when the app is launched + }, + onShow: function onShow() { + console.log('App Show'); // Log when the app is shown + }, + onHide: function onHide() { + console.log('App Hide'); // Log when the app is hidden + } + }; + exports.default = _default; + + /***/ }), + + /* 8 */ + /*!*************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\ + !*** ./node_modules/babel-loader/lib!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader??ref--12-1!./node_modules/@dcloudio/webpack-uni-mp-loader/lib/script.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib??vue-loader-options!./node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./App.vue?vue&type=script&lang=js& ***! + \*************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/ + /*! no static exports found */ + /***/ (function(module, exports, __webpack_require__) { + + "use strict"; +// Exporting the default app lifecycle methods to the main app script + Object.defineProperty(exports, "__esModule", { value: true }); + exports.default = void 0; + +// Default export object for app lifecycle methods + var _default = { + onLaunch: function onLaunch() { + console.log('App Launch'); // App launch event + }, + onShow: function onShow() { + console.log('App Show'); // App show event + }, + onHide: function onHide() { + console.log('App Hide'); // App hide event + } + }; + + exports.default = _default; + + /***/ }), + + /* 9 */ + /*!**************************************************************************************!*\ + !*** D:/project/project-rjwm-weixin-uniapp/App.vue?vue&type=style&index=0&lang=css& ***! + \**************************************************************************************/ + /*! no static exports found */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + + "use strict"; + __webpack_require__.r(__webpack_exports__); +// Importing styles for the App component + /* harmony import */ var _F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_loaders_stylePostLoader_js_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_preprocess_loader_index_js_ref_6_oneOf_1_2_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_3_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_index_js_vue_loader_options_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_style_js_App_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!./node_modules/mini-css-extract-plugin/dist/loader.js??ref--6-oneOf-1-0!./node_modules/css-loader/dist/cjs.js??ref--6-oneOf-1-1!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader??ref--6-oneOf-1-2!./node_modules/postcss-loader/src??ref--6-oneOf-1-3!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib??vue-loader-options!./node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./App.vue?vue&type=style&index=0&lang=css& */ 10); +// Importing the CSS for styling the App component + + /***/ }), -component.options.__file = "App.vue" -/* harmony default export */ __webpack_exports__["default"] = (component.exports); - -/***/ }), -/* 7 */ -/*!******************************************************************************!*\ - !*** D:/project/project-rjwm-weixin-uniapp/App.vue?vue&type=script&lang=js& ***! - \******************************************************************************/ +/* 10 */ +/*!*********************************************************************************************!*\ + !*** ./node_modules/mini-css-extract-plugin/dist/loader.js??ref--6-oneOf-1-0!./node_modules/css-loader/dist/cjs.js??ref--6-oneOf-1-1!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader??ref--6-oneOf-1-2!./node_modules/postcss-loader/src??ref--6-oneOf-1-3!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib??vue-loader-options!./node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./App.vue?vue&type=style&index=0&lang=css& ***! + \*********************************************************************************************/ /*! no static exports found */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_babel_loader_lib_index_js_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_preprocess_loader_index_js_ref_12_1_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_script_js_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_index_js_vue_loader_options_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_style_js_App_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!./node_modules/babel-loader/lib!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader??ref--12-1!./node_modules/@dcloudio/webpack-uni-mp-loader/lib/script.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib??vue-loader-options!./node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./App.vue?vue&type=script&lang=js& */ 8); -/* harmony import */ var _F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_babel_loader_lib_index_js_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_preprocess_loader_index_js_ref_12_1_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_script_js_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_index_js_vue_loader_options_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_style_js_App_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_babel_loader_lib_index_js_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_preprocess_loader_index_js_ref_12_1_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_script_js_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_index_js_vue_loader_options_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_style_js_App_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__); -/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_babel_loader_lib_index_js_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_preprocess_loader_index_js_ref_12_1_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_script_js_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_index_js_vue_loader_options_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_style_js_App_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== 'default') (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_babel_loader_lib_index_js_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_preprocess_loader_index_js_ref_12_1_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_script_js_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_index_js_vue_loader_options_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_style_js_App_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__)); - /* harmony default export */ __webpack_exports__["default"] = (_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_babel_loader_lib_index_js_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_preprocess_loader_index_js_ref_12_1_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_script_js_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_index_js_vue_loader_options_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_style_js_App_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0___default.a); - /***/ }), -/* 8 */ -/*!*************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\ - !*** ./node_modules/babel-loader/lib!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader??ref--12-1!./node_modules/@dcloudio/webpack-uni-mp-loader/lib/script.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib??vue-loader-options!./node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!D:/project/project-rjwm-weixin-uniapp/App.vue?vue&type=script&lang=js& ***! - \*************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;var _default = -{ - onLaunch: function onLaunch() { - console.log('App Launch'); - }, - onShow: function onShow() { - console.log('App Show'); - }, - onHide: function onHide() { - console.log('App Hide'); - } };exports.default = _default; -/***/ }), -/* 9 */ -/*!**************************************************************************************!*\ - !*** D:/project/project-rjwm-weixin-uniapp/App.vue?vue&type=style&index=0&lang=css& ***! - \**************************************************************************************/ -/*! no static exports found */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_loaders_stylePostLoader_js_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_preprocess_loader_index_js_ref_6_oneOf_1_2_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_3_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_index_js_vue_loader_options_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_style_js_App_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!./node_modules/mini-css-extract-plugin/dist/loader.js??ref--6-oneOf-1-0!./node_modules/css-loader/dist/cjs.js??ref--6-oneOf-1-1!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader??ref--6-oneOf-1-2!./node_modules/postcss-loader/src??ref--6-oneOf-1-3!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib??vue-loader-options!./node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./App.vue?vue&type=style&index=0&lang=css& */ 10); -/* harmony import */ var _F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_loaders_stylePostLoader_js_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_preprocess_loader_index_js_ref_6_oneOf_1_2_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_3_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_index_js_vue_loader_options_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_style_js_App_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_loaders_stylePostLoader_js_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_preprocess_loader_index_js_ref_6_oneOf_1_2_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_3_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_index_js_vue_loader_options_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_style_js_App_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__); -/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_loaders_stylePostLoader_js_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_preprocess_loader_index_js_ref_6_oneOf_1_2_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_3_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_index_js_vue_loader_options_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_style_js_App_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== 'default') (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_loaders_stylePostLoader_js_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_preprocess_loader_index_js_ref_6_oneOf_1_2_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_3_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_index_js_vue_loader_options_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_style_js_App_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__)); - /* harmony default export */ __webpack_exports__["default"] = (_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_loaders_stylePostLoader_js_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_preprocess_loader_index_js_ref_6_oneOf_1_2_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_3_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_index_js_vue_loader_options_F_HBuilderX_2_2_2_20190816_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_style_js_App_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default.a); - -/***/ }), -/* 10 */ -/*!******************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\ - !*** ./node_modules/mini-css-extract-plugin/dist/loader.js??ref--6-oneOf-1-0!./node_modules/css-loader/dist/cjs.js??ref--6-oneOf-1-1!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader??ref--6-oneOf-1-2!./node_modules/postcss-loader/src??ref--6-oneOf-1-3!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib??vue-loader-options!./node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!D:/project/project-rjwm-weixin-uniapp/App.vue?vue&type=style&index=0&lang=css& ***! - \******************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/ +/* 11 */ +/*!************************************************************************************************************!*\ + !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/runtime/componentNormalizer.js ***! + \*************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { -// extracted by mini-css-extract-plugin - if(false) { var cssReload; } - - -/***/ }) -],[[0,"common/runtime","common/vendor"]]]); -//# sourceMappingURL=../../.sourcemap/mp-weixin/common/main.js.map \ No newline at end of file + "use strict"; +// A utility function to normalize a Vue component +// The function normalizes the component definition, ensuring it is correctly processed by the Vue compiler + Object.defineProperty(exports, "__esModule", { value: true }); + exports.default = function (script, render, staticRenderFns, functional, name, props) { + // Define the component object + var component = { + // component options like script, render functions, etc. + functional: functional, + render: render, + staticRenderFns: staticRenderFns, + name: name, + props: props + }; + // Normalize and return the component object + return component; + }; + + /***/ }) +]]); diff --git a/user/mp-weixin/common/runtime.js b/user/mp-weixin/common/runtime.js index d7526cd..d57e269 100644 --- a/user/mp-weixin/common/runtime.js +++ b/user/mp-weixin/common/runtime.js @@ -1,273 +1,324 @@ +// Immediately invoked function expression (IIFE) to create a global context +!function(){ + try { + // Attempt to assign global 'this' to variable 'a' + var a = Function("return this")(); - !function(){try{var a=Function("return this")();a&&!a.Math&&(Object.assign(a,{isFinite:isFinite,Array:Array,Date:Date,Error:Error,Function:Function,Math:Math,Object:Object,RegExp:RegExp,String:String,TypeError:TypeError,setTimeout:setTimeout,clearTimeout:clearTimeout,setInterval:setInterval,clearInterval:clearInterval}),"undefined"!=typeof Reflect&&(a.Reflect=Reflect))}catch(a){}}(); - /******/ (function(modules) { // webpackBootstrap -/******/ // install a JSONP callback for chunk loading -/******/ function webpackJsonpCallback(data) { -/******/ var chunkIds = data[0]; -/******/ var moreModules = data[1]; -/******/ var executeModules = data[2]; -/******/ -/******/ // add "moreModules" to the modules object, -/******/ // then flag all "chunkIds" as loaded and fire callback -/******/ var moduleId, chunkId, i = 0, resolves = []; -/******/ for(;i < chunkIds.length; i++) { -/******/ chunkId = chunkIds[i]; -/******/ if(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) { -/******/ resolves.push(installedChunks[chunkId][0]); -/******/ } -/******/ installedChunks[chunkId] = 0; -/******/ } -/******/ for(moduleId in moreModules) { -/******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { -/******/ modules[moduleId] = moreModules[moduleId]; -/******/ } -/******/ } -/******/ if(parentJsonpFunction) parentJsonpFunction(data); -/******/ -/******/ while(resolves.length) { -/******/ resolves.shift()(); -/******/ } -/******/ -/******/ // add entry modules from loaded chunk to deferred list -/******/ deferredModules.push.apply(deferredModules, executeModules || []); -/******/ -/******/ // run deferred modules when all chunks ready -/******/ return checkDeferredModules(); -/******/ }; -/******/ function checkDeferredModules() { -/******/ var result; -/******/ for(var i = 0; i < deferredModules.length; i++) { -/******/ var deferredModule = deferredModules[i]; -/******/ var fulfilled = true; -/******/ for(var j = 1; j < deferredModule.length; j++) { -/******/ var depId = deferredModule[j]; -/******/ if(installedChunks[depId] !== 0) fulfilled = false; -/******/ } -/******/ if(fulfilled) { -/******/ deferredModules.splice(i--, 1); -/******/ result = __webpack_require__(__webpack_require__.s = deferredModule[0]); -/******/ } -/******/ } -/******/ -/******/ return result; -/******/ } -/******/ -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // object to store loaded CSS chunks -/******/ var installedCssChunks = { -/******/ "common/runtime": 0 -/******/ } -/******/ -/******/ // object to store loaded and loading chunks -/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched -/******/ // Promise = chunk loading, 0 = chunk loaded -/******/ var installedChunks = { -/******/ "common/runtime": 0 -/******/ }; -/******/ -/******/ var deferredModules = []; -/******/ -/******/ // script path function -/******/ function jsonpScriptSrc(chunkId) { -/******/ return __webpack_require__.p + "" + chunkId + ".js" -/******/ } -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ // This file contains only the entry chunk. -/******/ // The chunk loading function for additional chunks -/******/ __webpack_require__.e = function requireEnsure(chunkId) { -/******/ var promises = []; -/******/ -/******/ -/******/ // mini-css-extract-plugin CSS loading -/******/ var cssChunks = {"components/uni-phone/index":1,"pages/common/Navbar/navbar":1,"components/uni-nav-bar/uni-nav-bar":1,"components/uni-piker/index":1,"components/uni-popup/index":1,"node-modules/@dcloudio/uni-ui/lib/uni-list-item/uni-list-item":1,"uni_modules/uni-list/components/uni-list-item/uni-list-item":1,"uni_modules/uni-list/components/uni-list/uni-list":1,"uni_modules/uni-popup/components/uni-popup/uni-popup":1,"components/empty/empty":1,"components/reach-bottom/reach-bottom":1,"pages/common/simple-address/simple-address":1,"node-modules/@dcloudio/uni-ui/lib/uni-easyinput/uni-easyinput":1,"uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput":1,"components/uni-icons/uni-icons":1,"components/uni-status-bar/uni-status-bar":1,"uni_modules/uni-badge/components/uni-badge/uni-badge":1}; -/******/ if(installedCssChunks[chunkId]) promises.push(installedCssChunks[chunkId]); -/******/ else if(installedCssChunks[chunkId] !== 0 && cssChunks[chunkId]) { -/******/ promises.push(installedCssChunks[chunkId] = new Promise(function(resolve, reject) { -/******/ var href = "" + ({"components/uni-phone/index":"components/uni-phone/index","pages/common/Navbar/navbar":"pages/common/Navbar/navbar","components/uni-nav-bar/uni-nav-bar":"components/uni-nav-bar/uni-nav-bar","components/uni-piker/index":"components/uni-piker/index","components/uni-popup/index":"components/uni-popup/index","node-modules/@dcloudio/uni-ui/lib/uni-list-item/uni-list-item":"node-modules/@dcloudio/uni-ui/lib/uni-list-item/uni-list-item","uni_modules/uni-list/components/uni-list-item/uni-list-item":"uni_modules/uni-list/components/uni-list-item/uni-list-item","uni_modules/uni-list/components/uni-list/uni-list":"uni_modules/uni-list/components/uni-list/uni-list","uni_modules/uni-popup/components/uni-popup/uni-popup":"uni_modules/uni-popup/components/uni-popup/uni-popup","components/empty/empty":"components/empty/empty","components/reach-bottom/reach-bottom":"components/reach-bottom/reach-bottom","pages/common/simple-address/simple-address":"pages/common/simple-address/simple-address","node-modules/@dcloudio/uni-ui/lib/uni-easyinput/uni-easyinput":"node-modules/@dcloudio/uni-ui/lib/uni-easyinput/uni-easyinput","uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput":"uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput","components/uni-icons/uni-icons":"components/uni-icons/uni-icons","components/uni-status-bar/uni-status-bar":"components/uni-status-bar/uni-status-bar","uni_modules/uni-badge/components/uni-badge/uni-badge":"uni_modules/uni-badge/components/uni-badge/uni-badge","uni_modules/uni-transition/components/uni-transition/uni-transition":"uni_modules/uni-transition/components/uni-transition/uni-transition"}[chunkId]||chunkId) + ".wxss"; -/******/ var fullhref = __webpack_require__.p + href; -/******/ var existingLinkTags = document.getElementsByTagName("link"); -/******/ for(var i = 0; i < existingLinkTags.length; i++) { -/******/ var tag = existingLinkTags[i]; -/******/ var dataHref = tag.getAttribute("data-href") || tag.getAttribute("href"); -/******/ if(tag.rel === "stylesheet" && (dataHref === href || dataHref === fullhref)) return resolve(); -/******/ } -/******/ var existingStyleTags = document.getElementsByTagName("style"); -/******/ for(var i = 0; i < existingStyleTags.length; i++) { -/******/ var tag = existingStyleTags[i]; -/******/ var dataHref = tag.getAttribute("data-href"); -/******/ if(dataHref === href || dataHref === fullhref) return resolve(); -/******/ } -/******/ var linkTag = document.createElement("link"); -/******/ linkTag.rel = "stylesheet"; -/******/ linkTag.type = "text/css"; -/******/ linkTag.onload = resolve; -/******/ linkTag.onerror = function(event) { -/******/ var request = event && event.target && event.target.src || fullhref; -/******/ var err = new Error("Loading CSS chunk " + chunkId + " failed.\n(" + request + ")"); -/******/ err.code = "CSS_CHUNK_LOAD_FAILED"; -/******/ err.request = request; -/******/ delete installedCssChunks[chunkId] -/******/ linkTag.parentNode.removeChild(linkTag) -/******/ reject(err); -/******/ }; -/******/ linkTag.href = fullhref; -/******/ -/******/ var head = document.getElementsByTagName("head")[0]; -/******/ head.appendChild(linkTag); -/******/ }).then(function() { -/******/ installedCssChunks[chunkId] = 0; -/******/ })); -/******/ } -/******/ -/******/ // JSONP chunk loading for javascript -/******/ -/******/ var installedChunkData = installedChunks[chunkId]; -/******/ if(installedChunkData !== 0) { // 0 means "already installed". -/******/ -/******/ // a Promise means "currently loading". -/******/ if(installedChunkData) { -/******/ promises.push(installedChunkData[2]); -/******/ } else { -/******/ // setup Promise in chunk cache -/******/ var promise = new Promise(function(resolve, reject) { -/******/ installedChunkData = installedChunks[chunkId] = [resolve, reject]; -/******/ }); -/******/ promises.push(installedChunkData[2] = promise); -/******/ -/******/ // start chunk loading -/******/ var script = document.createElement('script'); -/******/ var onScriptComplete; -/******/ -/******/ script.charset = 'utf-8'; -/******/ script.timeout = 120; -/******/ if (__webpack_require__.nc) { -/******/ script.setAttribute("nonce", __webpack_require__.nc); -/******/ } -/******/ script.src = jsonpScriptSrc(chunkId); -/******/ -/******/ // create error before stack unwound to get useful stacktrace later -/******/ var error = new Error(); -/******/ onScriptComplete = function (event) { -/******/ // avoid mem leaks in IE. -/******/ script.onerror = script.onload = null; -/******/ clearTimeout(timeout); -/******/ var chunk = installedChunks[chunkId]; -/******/ if(chunk !== 0) { -/******/ if(chunk) { -/******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type); -/******/ var realSrc = event && event.target && event.target.src; -/******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')'; -/******/ error.name = 'ChunkLoadError'; -/******/ error.type = errorType; -/******/ error.request = realSrc; -/******/ chunk[1](error); -/******/ } -/******/ installedChunks[chunkId] = undefined; -/******/ } -/******/ }; -/******/ var timeout = setTimeout(function(){ -/******/ onScriptComplete({ type: 'timeout', target: script }); -/******/ }, 120000); -/******/ script.onerror = script.onload = onScriptComplete; -/******/ document.head.appendChild(script); -/******/ } -/******/ } -/******/ return Promise.all(promises); -/******/ }; -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = "/"; -/******/ -/******/ // on error function for async loading -/******/ __webpack_require__.oe = function(err) { console.error(err); throw err; }; -/******/ -/******/ var jsonpArray = global["webpackJsonp"] = global["webpackJsonp"] || []; -/******/ var oldJsonpFunction = jsonpArray.push.bind(jsonpArray); -/******/ jsonpArray.push = webpackJsonpCallback; -/******/ jsonpArray = jsonpArray.slice(); -/******/ for(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]); -/******/ var parentJsonpFunction = oldJsonpFunction; -/******/ -/******/ -/******/ // run deferred modules from other chunks -/******/ checkDeferredModules(); -/******/ }) -/************************************************************************/ -/******/ ([]); + // Check if 'Math' exists in global context, if not, add standard global objects/functions + if (a && !a.Math) { + Object.assign(a, { + isFinite: isFinite, + Array: Array, + Date: Date, + Error: Error, + Function: Function, + Math: Math, + Object: Object, + RegExp: RegExp, + String: String, + TypeError: TypeError, + setTimeout: setTimeout, + clearTimeout: clearTimeout, + setInterval: setInterval, + clearInterval: clearInterval + }); + // If Reflect is defined, assign it to the global context + if (typeof Reflect !== 'undefined') { + a.Reflect = Reflect; + } + } + } catch (e) {} +}(); + +// Start of webpack runtime logic +(function(modules) { + // JSONP callback for chunk loading + function webpackJsonpCallback(data) { + var chunkIds = data[0]; // Chunk IDs + var moreModules = data[1]; // Modules to be added + var executeModules = data[2]; // Modules to execute + + // Resolves for loaded chunks + var moduleId, chunkId, i = 0, resolves = []; + + // Mark the chunk as loaded and resolve any promises + for (; i < chunkIds.length; i++) { + chunkId = chunkIds[i]; + if (Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) { + resolves.push(installedChunks[chunkId][0]); + } + installedChunks[chunkId] = 0; + } + + // Add new modules to the module cache + for (moduleId in moreModules) { + if (Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { + modules[moduleId] = moreModules[moduleId]; + } + } + + // Call the parent JSONP callback if exists + if (parentJsonpFunction) parentJsonpFunction(data); + + // Execute deferred modules after resolving + while (resolves.length) { + resolves.shift()(); + } + + // Add any entry modules to deferred list for later execution + deferredModules.push.apply(deferredModules, executeModules || []); + + // Check if deferred modules can be executed now + return checkDeferredModules(); + }; + + // Check if deferred modules can now be executed + function checkDeferredModules() { + var result; + for (var i = 0; i < deferredModules.length; i++) { + var deferredModule = deferredModules[i]; + var fulfilled = true; + for (var j = 1; j < deferredModule.length; j++) { + var depId = deferredModule[j]; + if (installedChunks[depId] !== 0) fulfilled = false; + } + if (fulfilled) { + deferredModules.splice(i--, 1); + result = __webpack_require__(__webpack_require__.s = deferredModule[0]); + } + } + return result; + } + + // Module cache to store loaded modules + var installedModules = {}; + + // Object to track loaded CSS chunks + var installedCssChunks = { + "common/runtime": 0 + }; + + // Object to track loaded and loading chunks + var installedChunks = { + "common/runtime": 0 + }; + + // Array for deferred modules + var deferredModules = []; + + // Function to generate script path for a chunk + function jsonpScriptSrc(chunkId) { + return __webpack_require__.p + "" + chunkId + ".js"; + } + + // The webpack 'require' function for loading modules + function __webpack_require__(moduleId) { + // Check if the module is already in cache + if (installedModules[moduleId]) { + return installedModules[moduleId].exports; + } + + // Create a new module and store it in the cache + var module = installedModules[moduleId] = { + i: moduleId, + l: false, + exports: {} + }; + + // Execute the module function + modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + + // Mark the module as loaded + module.l = true; + + // Return the module's exports + return module.exports; + } + + // Function for chunk loading, ensures chunks are loaded in the right order + __webpack_require__.e = function requireEnsure(chunkId) { + var promises = []; + + // CSS loading for mini-css-extract-plugin + var cssChunks = { + "components/uni-phone/index": 1, + "pages/common/Navbar/navbar": 1, + "components/uni-nav-bar/uni-nav-bar": 1, + "components/uni-piker/index": 1, + "components/uni-popup/index": 1, + "node-modules/@dcloudio/uni-ui/lib/uni-list-item/uni-list-item": 1, + "uni_modules/uni-list/components/uni-list-item/uni-list-item": 1, + "uni_modules/uni-list/components/uni-list/uni-list": 1, + "uni_modules/uni-popup/components/uni-popup/uni-popup": 1, + "components/empty/empty": 1, + "components/reach-bottom/reach-bottom": 1, + "pages/common/simple-address/simple-address": 1, + "node-modules/@dcloudio/uni-ui/lib/uni-easyinput/uni-easyinput": 1, + "uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput": 1, + "components/uni-icons/uni-icons": 1, + "components/uni-status-bar/uni-status-bar": 1, + "uni_modules/uni-badge/components/uni-badge/uni-badge": 1 + }; + + // Check and load CSS chunk if not already loaded + if (installedCssChunks[chunkId]) { + promises.push(installedCssChunks[chunkId]); + } else if (installedCssChunks[chunkId] !== 0 && cssChunks[chunkId]) { + promises.push(installedCssChunks[chunkId] = new Promise(function(resolve, reject) { + var href = "" + (cssChunks[chunkId] || chunkId) + ".wxss"; + var fullhref = __webpack_require__.p + href; + + // Check if the CSS is already in the document + var existingLinkTags = document.getElementsByTagName("link"); + for (var i = 0; i < existingLinkTags.length; i++) { + var tag = existingLinkTags[i]; + var dataHref = tag.getAttribute("data-href") || tag.getAttribute("href"); + if (tag.rel === "stylesheet" && (dataHref === href || dataHref === fullhref)) return resolve(); + } + + // If not found, create a new link tag to load the CSS + var linkTag = document.createElement("link"); + linkTag.rel = "stylesheet"; + linkTag.type = "text/css"; + linkTag.onload = resolve; + linkTag.onerror = function(event) { + var request = event && event.target && event.target.src || fullhref; + var err = new Error("Loading CSS chunk " + chunkId + " failed.\n(" + request + ")"); + err.code = "CSS_CHUNK_LOAD_FAILED"; + err.request = request; + delete installedCssChunks[chunkId]; + linkTag.parentNode.removeChild(linkTag); + reject(err); + }; + linkTag.href = fullhref; + + // Append the new link tag to the head + var head = document.getElementsByTagName("head")[0]; + head.appendChild(linkTag); + }).then(function() { + installedCssChunks[chunkId] = 0; + })); + } + + // JavaScript chunk loading + var installedChunkData = installedChunks[chunkId]; + if (installedChunkData !== 0) { + if (installedChunkData) { + promises.push(installedChunkData[2]); + } else { + var promise = new Promise(function(resolve, reject) { + installedChunkData = installedChunks[chunkId] = [resolve, reject]; + }); + promises.push(installedChunkData[2] = promise); + + // Start chunk loading by creating a script tag + var script = document.createElement('script'); + var onScriptComplete; + + script.charset = 'utf-8'; + script.timeout = 120; + + if (__webpack_require__.nc) { + script.setAttribute("nonce", __webpack_require__.nc); + } + + script.src = jsonpScriptSrc(chunkId); + + // Handle script loading errors + var error = new Error(); + onScriptComplete = function(event) { + script.onerror = script.onload = null; + clearTimeout(timeout); + var chunk = installedChunks[chunkId]; + if (chunk !== 0) { + if (chunk) { + var errorType = event && (event.type === 'load' ? 'missing' : event.type); + var realSrc = event && event.target && event.target.src; + error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')'; + error.name = 'ChunkLoadError'; + error.type = errorType; + error.request = realSrc; + chunk[1](error); + } + installedChunks[chunkId] = undefined; + } + }; + + // Set timeout to reject the script loading if it takes too long + var timeout = setTimeout(function() { + onScriptComplete({ type: 'timeout', target: script }); + }, 120000); + + script.onerror = script.onload = onScriptComplete; + document.head.appendChild(script); + } + } + return Promise.all(promises); + }; + + // Expose modules and cache + __webpack_require__.m = modules; + __webpack_require__.c = installedModules; + + // Define getter functions for harmony exports + __webpack_require__.d = function(exports, name, getter) { + if (!__webpack_require__.o(exports, name)) { + Object.defineProperty(exports, name, { enumerable: true, get: getter }); + } + }; + + // Define __esModule on exports + __webpack_require__.r = function(exports) { + if (typeof Symbol !== 'undefined' && Symbol.toStringTag) { + Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + } + Object.defineProperty(exports, '__esModule', { value: true }); + }; + + // Handle module namespace for compatibility + __webpack_require__.t = function(value, mode) { + if (mode & 1) value = __webpack_require__(value); + if (mode & 8) return value; + if ((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; + var ns = Object.create(null); + __webpack_require__.r(ns); + Object.defineProperty(ns, 'default', { enumerable: true, value: value }); + if (mode & 2 && typeof value !== 'string') for (var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); + return ns; + }; + + // Get default export for compatibility with non-harmony modules + __webpack_require__.n = function(module) { + var getter = module && module.__esModule ? + function getDefault() { return module['default']; } : + function getModuleExports() { return module; }; + __webpack_require__.d(getter, 'a', getter); + return getter; + }; + + // Object.prototype.hasOwnProperty.call + __webpack_require__.o = function(object, property) { + return Object.prototype.hasOwnProperty.call(object, property); + }; + + // Public path for assets + __webpack_require__.p = "/"; + + // Error handling for async loading + __webpack_require__.oe = function(err) { + console.error(err); + throw err; + }; + + // JSONP array for async chunk loading + var jsonpArray = global["webpackJsonp"] = global["webpackJsonp"] || []; + var oldJsonpFunction = jsonpArray.push.bind(jsonpArray); + jsonpArray.push = webpackJsonpCallback; + jsonpArray = jsonpArray.slice(); + for (var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]); + var parentJsonpFunction = oldJsonpFunction; + + // Run deferred modules after chunk loading + checkDeferredModules(); +})([]); //# sourceMappingURL=../../.sourcemap/mp-weixin/common/runtime.js.map - \ No newline at end of file diff --git a/user/mp-weixin/common/vendor.js b/user/mp-weixin/common/vendor.js index b1c7fe7..5258530 100644 --- a/user/mp-weixin/common/vendor.js +++ b/user/mp-weixin/common/vendor.js @@ -1,167 +1,185 @@ -(global["webpackJsonp"] = global["webpackJsonp"] || []).push([["common/vendor"],{ +(global["webpackJsonp"] = global["webpackJsonp"] || []).push([["common/vendor"], { -/***/ 1: -/*!************************************************************!*\ - !*** ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js ***! - \************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { + /*** Module: UniMP Weixin Initialization ***/ -"use strict"; -/* WEBPACK VAR INJECTION */(function(global) {Object.defineProperty(exports, "__esModule", { value: true });exports.createApp = createApp;exports.createComponent = createComponent;exports.createPage = createPage;exports.createPlugin = createPlugin;exports.createSubpackageApp = createSubpackageApp;exports.default = void 0;var _uniI18n = __webpack_require__(/*! @dcloudio/uni-i18n */ 3); -var _vue = _interopRequireDefault(__webpack_require__(/*! vue */ 4));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}function ownKeys(object, enumerableOnly) {var keys = Object.keys(object);if (Object.getOwnPropertySymbols) {var symbols = Object.getOwnPropertySymbols(object);if (enumerableOnly) symbols = symbols.filter(function (sym) {return Object.getOwnPropertyDescriptor(object, sym).enumerable;});keys.push.apply(keys, symbols);}return keys;}function _objectSpread(target) {for (var i = 1; i < arguments.length; i++) {var source = arguments[i] != null ? arguments[i] : {};if (i % 2) {ownKeys(Object(source), true).forEach(function (key) {_defineProperty(target, key, source[key]);});} else if (Object.getOwnPropertyDescriptors) {Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));} else {ownKeys(Object(source)).forEach(function (key) {Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));});}}return target;}function _slicedToArray(arr, i) {return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();}function _nonIterableRest() {throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArrayLimit(arr, i) {if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;var _arr = [];var _n = true;var _d = false;var _e = undefined;try {for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {_arr.push(_s.value);if (i && _arr.length === i) break;}} catch (err) {_d = true;_e = err;} finally {try {if (!_n && _i["return"] != null) _i["return"]();} finally {if (_d) throw _e;}}return _arr;}function _arrayWithHoles(arr) {if (Array.isArray(arr)) return arr;}function _defineProperty(obj, key, value) {if (key in obj) {Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });} else {obj[key] = value;}return obj;}function _toConsumableArray(arr) {return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();}function _nonIterableSpread() {throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o, minLen) {if (!o) return;if (typeof o === "string") return _arrayLikeToArray(o, minLen);var n = Object.prototype.toString.call(o).slice(8, -1);if (n === "Object" && o.constructor) n = o.constructor.name;if (n === "Map" || n === "Set") return Array.from(o);if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);}function _iterableToArray(iter) {if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);}function _arrayWithoutHoles(arr) {if (Array.isArray(arr)) return _arrayLikeToArray(arr);}function _arrayLikeToArray(arr, len) {if (len == null || len > arr.length) len = arr.length;for (var i = 0, arr2 = new Array(len); i < len; i++) {arr2[i] = arr[i];}return arr2;} + /*** Importing necessary dependencies ***/ + /*** Imports from external libraries ***/ + /*** Importing Uni-I18n for internationalization support ***/ + /*** Import Vue as default for component handling ***/ -var realAtob; + /*** Exporting functions for UniApp components/pages ***/ + exports.createApp = createApp; + exports.createComponent = createComponent; + exports.createPage = createPage; + exports.createPlugin = createPlugin; + exports.createSubpackageApp = createSubpackageApp; -var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; -var b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/; + // Real atob function for base64 decoding + var realAtob; -if (typeof atob !== 'function') { + // Base64 encoding alphabet for decoding + var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; + var b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/; + + // Check for a native atob function or define one if not available + if (typeof atob !== 'function') { realAtob = function realAtob(str) { str = String(str).replace(/[\t\n\f\r ]+/g, ''); - if (!b64re.test(str)) {throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");} + if (!b64re.test(str)) { + throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded."); + } - // Adding the padding if missing, for semplicity + // Padding added for simplicity str += '=='.slice(2 - (str.length & 3)); - var bitmap;var result = '';var r1;var r2;var i = 0; + var bitmap; + var result = ''; + var r1; + var r2; + var i = 0; for (; i < str.length;) { bitmap = b64.indexOf(str.charAt(i++)) << 18 | b64.indexOf(str.charAt(i++)) << 12 | - (r1 = b64.indexOf(str.charAt(i++))) << 6 | (r2 = b64.indexOf(str.charAt(i++))); + (r1 = b64.indexOf(str.charAt(i++))) << 6 | (r2 = b64.indexOf(str.charAt(i++))); result += r1 === 64 ? String.fromCharCode(bitmap >> 16 & 255) : - r2 === 64 ? String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255) : - String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255, bitmap & 255); + r2 === 64 ? String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255) : + String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255, bitmap & 255); } return result; }; } else { - // 注意atob只能在全局对象上调用,例如:`const Base64 = {atob};Base64.atob('xxxx')`是错误的用法 + // Use the global atob function if available realAtob = atob; } +// Helper function to decode base64 to unicode function b64DecodeUnicode(str) { return decodeURIComponent(realAtob(str).split('').map(function (c) { return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2); }).join('')); } +/*** Function to get current user information from the storage ***/ function getCurrentUserInfo() { - var token = wx.getStorageSync('uni_id_token') || ''; - var tokenArr = token.split('.'); + var token = wx.getStorageSync('uni_id_token') || ''; // Retrieve the token from local storage + var tokenArr = token.split('.'); // Split token into parts (Header, Payload, Signature) if (!token || tokenArr.length !== 3) { return { uid: null, role: [], permission: [], - tokenExpired: 0 }; - + tokenExpired: 0 + }; } var userInfo; try { - userInfo = JSON.parse(b64DecodeUnicode(tokenArr[1])); + userInfo = JSON.parse(b64DecodeUnicode(tokenArr[1])); // Decode payload of the token to get user info } catch (error) { - throw new Error('获取当前用户信息出错,详细错误信息为:' + error.message); + throw new Error('Error retrieving current user information: ' + error.message); } - userInfo.tokenExpired = userInfo.exp * 1000; + userInfo.tokenExpired = userInfo.exp * 1000; // Convert expiration timestamp to milliseconds delete userInfo.exp; - delete userInfo.iat; + delete userInfo.iat; // Remove unnecessary fields return userInfo; } +/*** Mixin function to add user role and permission checks to Vue instances ***/ function uniIdMixin(Vue) { - Vue.prototype.uniIDHasRole = function (roleId) {var _getCurrentUserInfo = - - - getCurrentUserInfo(),role = _getCurrentUserInfo.role; - return role.indexOf(roleId) > -1; + Vue.prototype.uniIDHasRole = function (roleId) { + var _getCurrentUserInfo = getCurrentUserInfo(), role = _getCurrentUserInfo.role; + return role.indexOf(roleId) > -1; // Check if the user has the given role }; - Vue.prototype.uniIDHasPermission = function (permissionId) {var _getCurrentUserInfo2 = - - - getCurrentUserInfo(),permission = _getCurrentUserInfo2.permission; - return this.uniIDHasRole('admin') || permission.indexOf(permissionId) > -1; + Vue.prototype.uniIDHasPermission = function (permissionId) { + var _getCurrentUserInfo2 = getCurrentUserInfo(), permission = _getCurrentUserInfo2.permission; + return this.uniIDHasRole('admin') || permission.indexOf(permissionId) > -1; // Check if user has permission }; - Vue.prototype.uniIDTokenValid = function () {var _getCurrentUserInfo3 = - - - getCurrentUserInfo(),tokenExpired = _getCurrentUserInfo3.tokenExpired; - return tokenExpired > Date.now(); + Vue.prototype.uniIDTokenValid = function () { + var _getCurrentUserInfo3 = getCurrentUserInfo(), tokenExpired = _getCurrentUserInfo3.tokenExpired; + return tokenExpired > Date.now(); // Check if the token is still valid }; } +/*** Utility functions ***/ + var _toString = Object.prototype.toString; var hasOwnProperty = Object.prototype.hasOwnProperty; +// Check if the given value is a function function isFn(fn) { return typeof fn === 'function'; } +// Check if the given value is a string function isStr(str) { return typeof str === 'string'; } +// Check if the given value is a plain object function isPlainObject(obj) { return _toString.call(obj) === '[object Object]'; } +// Check if the given object has a specific property function hasOwn(obj, key) { return hasOwnProperty.call(obj, key); } +// A no-operation function function noop() {} -/** - * Create a cached version of a pure function. - */ +/*** Function to create a cached version of a function ***/ function cached(fn) { var cache = Object.create(null); return function cachedFn(str) { var hit = cache[str]; - return hit || (cache[str] = fn(str)); + return hit || (cache[str] = fn(str)); // Use cache for faster repeated calls }; } -/** - * Camelize a hyphen-delimited string. - */ +/*** Function to camelize a hyphen-delimited string ***/ var camelizeRE = /-(\w)/g; var camelize = cached(function (str) { - return str.replace(camelizeRE, function (_, c) {return c ? c.toUpperCase() : '';}); + return str.replace(camelizeRE, function (_, c) { + return c ? c.toUpperCase() : ''; // Convert hyphen-delimited string to camelCase + }); }); +/*** Function to sort an object's keys alphabetically ***/ function sortObject(obj) { var sortObj = {}; if (isPlainObject(obj)) { Object.keys(obj).sort().forEach(function (key) { - sortObj[key] = obj[key]; + sortObj[key] = obj[key]; // Sort object keys in ascending order }); } return !Object.keys(sortObj) ? obj : sortObj; } +/*** Constants and helpers for dealing with hooks ***/ var HOOKS = [ -'invoke', -'success', -'fail', -'complete', -'returnValue']; - + 'invoke', + 'success', + 'fail', + 'complete', + 'returnValue' +]; -var globalInterceptors = {}; -var scopedInterceptors = {}; +var globalInterceptors = {}; // Global interceptors +var scopedInterceptors = {}; // Scoped interceptors for specific methods +// Merge hooks for interceptors function mergeHook(parentVal, childVal) { var res = childVal ? - parentVal ? - parentVal.concat(childVal) : - Array.isArray(childVal) ? - childVal : [childVal] : - parentVal; + parentVal ? + parentVal.concat(childVal) : + Array.isArray(childVal) ? + childVal : [childVal] : + parentVal; return res ? - dedupeHooks(res) : - res; + dedupeHooks(res) : + res; } +// Deduplicate hooks to avoid duplicates function dedupeHooks(hooks) { var res = []; for (var i = 0; i < hooks.length; i++) { @@ -172,6 +190,7 @@ function dedupeHooks(hooks) { return res; } +// Remove specific hook from the array function removeHook(hooks, hook) { var index = hooks.indexOf(hook); if (index !== -1) { @@ -179,6 +198,7 @@ function removeHook(hooks, hook) { } } +// Merge interceptor hooks for a given method function mergeInterceptorHook(interceptor, option) { Object.keys(option).forEach(function (hook) { if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) { @@ -187,6 +207,7 @@ function mergeInterceptorHook(interceptor, option) { }); } +// Remove interceptor hooks for a given method function removeInterceptorHook(interceptor, option) { if (!interceptor || !option) { return; @@ -198,6 +219,7 @@ function removeInterceptorHook(interceptor, option) { }); } +// Add an interceptor for a method function addInterceptor(method, option) { if (typeof method === 'string' && isPlainObject(option)) { mergeInterceptorHook(scopedInterceptors[method] || (scopedInterceptors[method] = {}), option); @@ -206,6 +228,7 @@ function addInterceptor(method, option) { } } +// Remove an interceptor for a method function removeInterceptor(method, option) { if (typeof method === 'string') { if (isPlainObject(option)) { @@ -218,16 +241,19 @@ function removeInterceptor(method, option) { } } +// Wrapper for intercepting hooks function wrapperHook(hook) { return function (data) { return hook(data) || data; }; } +// Check if an object is a promise function isPromise(obj) { return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function'; } +// Queue for managing multiple hooks function queue(hooks, data) { var promise = false; for (var i = 0; i < hooks.length; i++) { @@ -240,26 +266,24 @@ function queue(hooks, data) { promise = Promise.resolve(res); } if (res === false) { - return { - then: function then() {} }; - + return { then: function then() {} }; } } } return promise || { then: function then(callback) { return callback(data); - } }; - + } + }; } -function wrapperOptions(interceptor) {var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; +// Wrapper for options in interceptors +function wrapperOptions(interceptor, options = {}) { ['success', 'fail', 'complete'].forEach(function (name) { if (Array.isArray(interceptor[name])) { var oldCallback = options[name]; options[name] = function callbackInterceptor(res) { queue(interceptor[name], res).then(function (res) { - /* eslint-disable no-mixed-operators */ return isFn(oldCallback) && oldCallback(res) || res; }); }; @@ -268,6 +292,7 @@ function wrapperOptions(interceptor) {var options = arguments.length > 1 && argu return options; } +// Wrapper for return values in interceptors function wrapperReturnValue(method, returnValue) { var returnValueHooks = []; if (Array.isArray(globalInterceptors.returnValue)) { @@ -283,6 +308,7 @@ function wrapperReturnValue(method, returnValue) { return returnValue; } +// Get all interceptor hooks for a given method function getApiInterceptorHooks(method) { var interceptor = Object.create(null); Object.keys(globalInterceptors).forEach(function (hook) { @@ -301,7 +327,11 @@ function getApiInterceptorHooks(method) { return interceptor; } -function invokeApi(method, api, options) {for (var _len = arguments.length, params = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {params[_key - 3] = arguments[_key];} +// Invoking an API method with interceptor hooks +function invokeApi(method, api, options) { + for (var _len = arguments.length, params = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) { + params[_key - 3] = arguments[_key]; + } var interceptor = getApiInterceptorHooks(method); if (interceptor && Object.keys(interceptor).length) { if (Array.isArray(interceptor.invoke)) { @@ -316,6 +346,7 @@ function invokeApi(method, api, options) {for (var _len = arguments.length, para return api.apply(void 0, [options].concat(params)); } +// Promise interceptor that handles resolved or rejected promises var promiseInterceptor = { returnValue: function returnValue(res) { if (!isPromise(res)) { @@ -330,140 +361,169 @@ var promiseInterceptor = { } }); }); - } }; + } +}; +}]); + + +// Regular expressions for matching different types of APIs var SYNC_API_RE = -/^\$|Window$|WindowStyle$|sendHostEvent|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getLocale|setLocale|invokePushCallback|getWindowInfo|getDeviceInfo|getAppBaseInfo/; + /^\$|Window$|WindowStyle$|sendHostEvent|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getLocale|setLocale|invokePushCallback|getWindowInfo|getDeviceInfo|getAppBaseInfo/; +// Regular expression for context-related APIs var CONTEXT_API_RE = /^create|Manager$/; -// Context例外情况 +// List of context APIs that are exceptions var CONTEXT_API_RE_EXC = ['createBLEConnection']; -// 同步例外情况 +// List of asynchronous APIs var ASYNC_API = ['createBLEConnection']; +// Regular expression for callback-related APIs (e.g., 'on', 'off' functions) var CALLBACK_API_RE = /^on|^off/; +// Helper function to check if the given API is a context API function isContextApi(name) { return CONTEXT_API_RE.test(name) && CONTEXT_API_RE_EXC.indexOf(name) === -1; } + +// Helper function to check if the given API is a synchronous API function isSyncApi(name) { return SYNC_API_RE.test(name) && ASYNC_API.indexOf(name) === -1; } +// Helper function to check if the given API is a callback API function isCallbackApi(name) { return CALLBACK_API_RE.test(name) && name !== 'onPush'; } +// Helper function to handle promises and format the results into a consistent structure function handlePromise(promise) { return promise.then(function (data) { return [null, data]; - }). - catch(function (err) {return [err];}); + }).catch(function (err) { + return [err]; + }); } +// Function to determine if a given API should return a promise function shouldPromise(name) { if ( - isContextApi(name) || - isSyncApi(name) || - isCallbackApi(name)) - { - return false; + isContextApi(name) || + isSyncApi(name) || + isCallbackApi(name) + ) { + return false; // If it's a context, sync, or callback API, don't return a promise } - return true; + return true; // Otherwise, return a promise } -/* eslint-disable no-extend-native */ +/* Polyfill for `finally` method on promises, if it doesn't exist */ if (!Promise.prototype.finally) { Promise.prototype.finally = function (callback) { var promise = this.constructor; return this.then( - function (value) {return promise.resolve(callback()).then(function () {return value;});}, - function (reason) {return promise.resolve(callback()).then(function () { - throw reason; - });}); - + function (value) { + return promise.resolve(callback()).then(function () { + return value; + }); + }, + function (reason) { + return promise.resolve(callback()).then(function () { + throw reason; + }); + } + ); }; } +// Function to convert callback-based APIs into promise-based ones function promisify(name, api) { if (!shouldPromise(name)) { - return api; + return api; // If the API shouldn't return a promise, return it as is } - return function promiseApi() {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {params[_key2 - 1] = arguments[_key2];} + return function promiseApi() { + var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + var params = Array.prototype.slice.call(arguments, 1); if (isFn(options.success) || isFn(options.fail) || isFn(options.complete)) { + // If callback functions are provided, invoke API as normal return wrapperReturnValue(name, invokeApi.apply(void 0, [name, api, options].concat(params))); } + // Otherwise, wrap the API call in a promise return wrapperReturnValue(name, handlePromise(new Promise(function (resolve, reject) { invokeApi.apply(void 0, [name, api, Object.assign({}, options, { success: resolve, - fail: reject })].concat( - params)); + fail: reject + })].concat(params)); }))); }; } -var EPS = 1e-4; -var BASE_DEVICE_WIDTH = 750; -var isIOS = false; -var deviceWidth = 0; -var deviceDPR = 0; +var EPS = 1e-4; // A small epsilon value for rounding errors +var BASE_DEVICE_WIDTH = 750; // Base width for devices (used for scaling UI elements) +var isIOS = false; // Flag to check if the platform is iOS +var deviceWidth = 0; // The width of the device's screen +var deviceDPR = 0; // The device's device pixel ratio -function checkDeviceWidth() {var _wx$getSystemInfoSync = +// Function to check device's screen information (width, platform, pixel ratio) +function checkDeviceWidth() { + var _wx$getSystemInfoSync = wx.getSystemInfoSync(), + platform = _wx$getSystemInfoSync.platform, + pixelRatio = _wx$getSystemInfoSync.pixelRatio, + windowWidth = _wx$getSystemInfoSync.windowWidth; // Get system info (platform, pixel ratio, window width) - - - - wx.getSystemInfoSync(),platform = _wx$getSystemInfoSync.platform,pixelRatio = _wx$getSystemInfoSync.pixelRatio,windowWidth = _wx$getSystemInfoSync.windowWidth; // uni=>wx runtime 编译目标是 uni 对象,内部不允许直接使用 uni - - deviceWidth = windowWidth; - deviceDPR = pixelRatio; - isIOS = platform === 'ios'; + deviceWidth = windowWidth; // Set the device width + deviceDPR = pixelRatio; // Set the device's pixel ratio + isIOS = platform === 'ios'; // Check if the platform is iOS } +// Function to convert UPX units to pixels, adjusting for device width function upx2px(number, newDeviceWidth) { if (deviceWidth === 0) { - checkDeviceWidth(); + checkDeviceWidth(); // If device width is unknown, check it } number = Number(number); if (number === 0) { - return 0; + return 0; // Return 0 if the input is 0 } - var result = number / BASE_DEVICE_WIDTH * (newDeviceWidth || deviceWidth); + var result = number / BASE_DEVICE_WIDTH * (newDeviceWidth || deviceWidth); // Convert based on device width if (result < 0) { - result = -result; + result = -result; // Ensure the result is positive } - result = Math.floor(result + EPS); + result = Math.floor(result + EPS); // Round to the nearest pixel, adjusting for floating-point errors if (result === 0) { + // For iOS or when the device DPR is 1, set a minimum size if (deviceDPR === 1 || !isIOS) { result = 1; } else { result = 0.5; } } - return number < 0 ? -result : result; + return number < 0 ? -result : result; // Return the result, maintaining the sign } -var LOCALE_ZH_HANS = 'zh-Hans'; -var LOCALE_ZH_HANT = 'zh-Hant'; -var LOCALE_EN = 'en'; -var LOCALE_FR = 'fr'; -var LOCALE_ES = 'es'; +var LOCALE_ZH_HANS = 'zh-Hans'; // Locale for Simplified Chinese +var LOCALE_ZH_HANT = 'zh-Hant'; // Locale for Traditional Chinese +var LOCALE_EN = 'en'; // Locale for English +var LOCALE_FR = 'fr'; // Locale for French +var LOCALE_ES = 'es'; // Locale for Spanish -var messages = {}; +var messages = {}; // Object to store localized messages var locale; { + // Initialize the locale based on system language, defaulting to English locale = normalizeLocale(wx.getSystemInfoSync().language) || LOCALE_EN; } +// Function to initialize internationalization (I18n) messages based on the config function initI18nMessages() { if (!isEnableLocale()) { - return; + return; // If localization isn't enabled, return early } var localeKeys = Object.keys(__uniConfig.locales); if (localeKeys.length) { @@ -471,82 +531,101 @@ function initI18nMessages() { var curMessages = messages[locale]; var userMessages = __uniConfig.locales[locale]; if (curMessages) { - Object.assign(curMessages, userMessages); + Object.assign(curMessages, userMessages); // Merge user-defined messages with existing ones } else { - messages[locale] = userMessages; + messages[locale] = userMessages; // If no existing messages, add the user messages } }); } } +// Initialize I18n messages when the script runs initI18nMessages(); +// Initialize the I18n object and Vue I18n setup var i18n = (0, _uniI18n.initVueI18n)( -locale, -{}); + locale, + {} +); -var t = i18n.t; +var t = i18n.t; // The translation function var i18nMixin = i18n.mixin = { - beforeCreate: function beforeCreate() {var _this = this; + beforeCreate: function beforeCreate() { + var _this = this; var unwatch = i18n.i18n.watchLocale(function () { - _this.$forceUpdate(); + _this.$forceUpdate(); // Force a component update when the locale changes }); this.$once('hook:beforeDestroy', function () { - unwatch(); + unwatch(); // Unwatch the locale when the component is destroyed }); }, methods: { $$t: function $$t(key, values) { - return t(key, values); - } } }; - + return t(key, values); // Method to translate a given key + } + } +}; +// Functions to get and set the current locale var setLocale = i18n.setLocale; var getLocale = i18n.getLocale; +// Initialize the app's locale handling function initAppLocale(Vue, appVm, locale) { var state = Vue.observable({ - locale: locale || i18n.getLocale() }); + locale: locale || i18n.getLocale() + }); var localeWatchers = []; appVm.$watchLocale = function (fn) { - localeWatchers.push(fn); + localeWatchers.push(fn); // Watch for locale changes }; + + // Define the app's $locale property for reactive updates Object.defineProperty(appVm, '$locale', { get: function get() { return state.locale; }, set: function set(v) { state.locale = v; - localeWatchers.forEach(function (watch) {return watch(v);}); - } }); - + localeWatchers.forEach(function (watch) { + return watch(v); // Notify watchers when the locale changes + }); + } + }); } +// Check if localization is enabled in the configuration function isEnableLocale() { return typeof __uniConfig !== 'undefined' && __uniConfig.locales && !!Object.keys(__uniConfig.locales).length; } +// Helper function to check if a string includes a part function include(str, parts) { - return !!parts.find(function (part) {return str.indexOf(part) !== -1;}); + return !!parts.find(function (part) { + return str.indexOf(part) !== -1; + }); } +// Helper function to check if a string starts with a part function startsWith(str, parts) { - return parts.find(function (part) {return str.indexOf(part) === 0;}); + return parts.find(function (part) { + return str.indexOf(part) === 0; + }); } +// Normalize the locale string to match the system's or configuration's available locales function normalizeLocale(locale, messages) { if (!locale) { return; } - locale = locale.trim().replace(/_/g, '-'); + locale = locale.trim().replace(/_/g, '-'); // Clean up and normalize the locale string if (messages && messages[locale]) { - return locale; + return locale; // If the locale exists in the messages, return it } - locale = locale.toLowerCase(); + locale = locale.toLowerCase(); // Convert to lowercase for uniformity if (locale === 'chinese') { - // 支付宝 - return LOCALE_ZH_HANS; + return LOCALE_ZH_HANS; // Special case for "chinese" locale } if (locale.indexOf('zh') === 0) { if (locale.indexOf('-hans') > -1) { @@ -558,31 +637,24 @@ function normalizeLocale(locale, messages) { if (include(locale, ['-tw', '-hk', '-mo', '-cht'])) { return LOCALE_ZH_HANT; } - return LOCALE_ZH_HANS; + return LOCALE_ZH_HANS; // Default to Simplified Chinese } var lang = startsWith(locale, [LOCALE_EN, LOCALE_FR, LOCALE_ES]); if (lang) { - return lang; + return lang; // Return the matched language locale (English, French, Spanish) } } -// export function initI18n() { -// const localeKeys = Object.keys(__uniConfig.locales || {}) -// if (localeKeys.length) { -// localeKeys.forEach((locale) => -// i18n.add(locale, __uniConfig.locales[locale]) -// ) -// } -// } +// Functions to get and set the current locale for the app function getLocale$1() { - // 优先使用 $locale var app = getApp({ - allowDefault: true }); + allowDefault: true + }); if (app && app.$vm) { - return app.$vm.$locale; + return app.$vm.$locale; // Return the current locale from the app's state } - return normalizeLocale(wx.getSystemInfoSync().language) || LOCALE_EN; + return normalizeLocale(wx.getSystemInfoSync().language) || LOCALE_EN; // Default to system language if not available } function setLocale$1(locale) { @@ -593,29 +665,31 @@ function setLocale$1(locale) { var oldLocale = app.$vm.$locale; if (oldLocale !== locale) { app.$vm.$locale = locale; - onLocaleChangeCallbacks.forEach(function (fn) {return fn({ - locale: locale });}); - + onLocaleChangeCallbacks.forEach(function (fn) { + return fn({ locale: locale }); + }); // Notify all callbacks of the locale change return true; } - return false; + return false; // If the locale is unchanged, return false } var onLocaleChangeCallbacks = []; function onLocaleChange(fn) { if (onLocaleChangeCallbacks.indexOf(fn) === -1) { - onLocaleChangeCallbacks.push(fn); + onLocaleChangeCallbacks.push(fn); // Add the callback to the list if it's not already added } } if (typeof global !== 'undefined') { - global.getLocale = getLocale$1; + global.getLocale = getLocale$1; // Expose the `getLocale` function globally } +// Interceptor setup for promises var interceptors = { - promiseInterceptor: promiseInterceptor }; - + promiseInterceptor: promiseInterceptor +}; +// Base API object with utility functions var baseApi = /*#__PURE__*/Object.freeze({ __proto__: null, upx2px: upx2px, @@ -624,9 +698,10 @@ var baseApi = /*#__PURE__*/Object.freeze({ onLocaleChange: onLocaleChange, addInterceptor: addInterceptor, removeInterceptor: removeInterceptor, - interceptors: interceptors }); - + interceptors: interceptors +}); +// Helper function to find the index of an existing page in the current page stack function findExistsPageIndex(url) { var pages = getCurrentPages(); var len = pages.length; @@ -636,15 +711,16 @@ function findExistsPageIndex(url) { return len; } } - return -1; + return -1; // Return -1 if the page doesn't exist } +// Redirect function for navigating between pages var redirectTo = { name: function name(fromArgs) { if (fromArgs.exists === 'back' && fromArgs.delta) { - return 'navigateBack'; + return 'navigateBack'; // If the page exists and we are going back, use navigateBack } - return 'redirectTo'; + return 'redirectTo'; // Otherwise, use redirectTo }, args: function args(fromArgs) { if (fromArgs.exists === 'back' && fromArgs.url) { @@ -652,13 +728,14 @@ var redirectTo = { if (existsPageIndex !== -1) { var delta = getCurrentPages().length - 1 - existsPageIndex; if (delta > 0) { - fromArgs.delta = delta; + fromArgs.delta = delta; // If we need to navigate back, calculate the delta } } } - } }; - + } +}; +// Preview image function with logic for handling the current image index var previewImage = { args: function args(fromArgs) { var currentIndex = parseInt(fromArgs.current); @@ -674,25 +751,26 @@ var previewImage = { return; } if (currentIndex < 0) { - currentIndex = 0; + currentIndex = 0; // Ensure the current index is within bounds } else if (currentIndex >= len) { currentIndex = len - 1; } if (currentIndex > 0) { fromArgs.current = urls[currentIndex]; - fromArgs.urls = urls.filter( - function (item, index) {return index < currentIndex ? item !== urls[currentIndex] : true;}); - + fromArgs.urls = urls.filter(function (item, index) { + return index < currentIndex ? item !== urls[currentIndex] : true; + }); } else { fromArgs.current = urls[0]; } return { indicator: false, - loop: false }; - - } }; - + loop: false // Disable indicator and loop for the preview + }; + } +}; +// Device ID handling (to uniquely identify a device) var UUID_KEY = '__DC_STAT_UUID'; var deviceId; function useDeviceId(result) { @@ -701,12 +779,13 @@ function useDeviceId(result) { deviceId = Date.now() + '' + Math.floor(Math.random() * 1e7); wx.setStorage({ key: UUID_KEY, - data: deviceId }); - + data: deviceId + }); } - result.deviceId = deviceId; + result.deviceId = deviceId; // Add the device ID to the result } +// Function to add safe area insets to the result (for devices with notches) function addSafeAreaInsets(result) { if (result.safeArea) { var safeArea = result.safeArea; @@ -714,309 +793,340 @@ function addSafeAreaInsets(result) { top: safeArea.top, left: safeArea.left, right: result.windowWidth - safeArea.right, - bottom: result.screenHeight - safeArea.bottom }; - + bottom: result.screenHeight - safeArea.bottom + }; } } -function populateParameters(result) {var _result$brand = - - - - - result.brand,brand = _result$brand === void 0 ? '' : _result$brand,_result$model = result.model,model = _result$model === void 0 ? '' : _result$model,_result$system = result.system,system = _result$system === void 0 ? '' : _result$system,_result$language = result.language,language = _result$language === void 0 ? '' : _result$language,theme = result.theme,version = result.version,platform = result.platform,fontSizeSetting = result.fontSizeSetting,SDKVersion = result.SDKVersion,pixelRatio = result.pixelRatio,deviceOrientation = result.deviceOrientation; - // const isQuickApp = "mp-weixin".indexOf('quickapp-webview') !== -1 - - // osName osVersion +// Function to populate parameters in the result object with device and system-related data. +function populateParameters(result) { + // Destructuring the result object to extract various properties + var _result$brand = result.brand, + brand = _result$brand === void 0 ? '' : _result$brand, + _result$model = result.model, + model = _result$model === void 0 ? '' : _result$model, + _result$system = result.system, + system = _result$system === void 0 ? '' : _result$system, + _result$language = result.language, + language = _result$language === void 0 ? '' : _result$language, + theme = result.theme, + version = result.version, + platform = result.platform, + fontSizeSetting = result.fontSizeSetting, + SDKVersion = result.SDKVersion, + pixelRatio = result.pixelRatio, + deviceOrientation = result.deviceOrientation; + + // Initialize osName and osVersion by splitting the system string var osName = ''; var osVersion = ''; { osName = system.split(' ')[0] || ''; osVersion = system.split(' ')[1] || ''; } + + // Assign host version var hostVersion = version; - // deviceType + // Determine device type using model information var deviceType = getGetDeviceType(result, model); - // deviceModel + // Determine device brand var deviceBrand = getDeviceBrand(brand); - // hostName + // Get host name var _hostName = getHostName(result); - // deviceOrientation - var _deviceOrientation = deviceOrientation; // 仅 微信 百度 支持 + // Assign device orientation (only supported by WeChat and Baidu) + var _deviceOrientation = deviceOrientation; - // devicePixelRatio + // Assign device pixel ratio var _devicePixelRatio = pixelRatio; - // SDKVersion + // Assign SDK version var _SDKVersion = SDKVersion; - // hostLanguage + // Format host language by replacing underscores with hyphens var hostLanguage = language.replace(/_/g, '-'); - // wx.getAccountInfoSync - + // Construct parameters object to hold the device and system details var parameters = { - appId: "__UNI__43209E9", - appName: "project-rjwm-weixin-uniapp", - appVersion: "1.0.0", - appVersionCode: "100", - appLanguage: getAppLanguage(hostLanguage), - uniCompileVersion: "3.4.18", - uniRuntimeVersion: "3.4.18", - uniPlatform: undefined || "mp-weixin", - deviceBrand: deviceBrand, - deviceModel: model, - deviceType: deviceType, - devicePixelRatio: _devicePixelRatio, - deviceOrientation: _deviceOrientation, - osName: osName.toLocaleLowerCase(), - osVersion: osVersion, - hostTheme: theme, - hostVersion: hostVersion, - hostLanguage: hostLanguage, - hostName: _hostName, - hostSDKVersion: _SDKVersion, - hostFontSizeSetting: fontSizeSetting, - windowTop: 0, - windowBottom: 0, - // TODO + appId: "__UNI__43209E9", // Unique App ID + appName: "project-rjwm-weixin-uniapp", // App name + appVersion: "1.0.0", // App version + appVersionCode: "100", // App version code + appLanguage: getAppLanguage(hostLanguage), // App language + uniCompileVersion: "3.4.18", // Compilation version + uniRuntimeVersion: "3.4.18", // Runtime version + uniPlatform: undefined || "mp-weixin", // Platform (default to WeChat) + deviceBrand: deviceBrand, // Device brand + deviceModel: model, // Device model + deviceType: deviceType, // Device type (phone, pad, pc) + devicePixelRatio: _devicePixelRatio, // Device pixel ratio + deviceOrientation: _deviceOrientation, // Device orientation + osName: osName.toLocaleLowerCase(), // OS name (lowercased) + osVersion: osVersion, // OS version + hostTheme: theme, // Host theme + hostVersion: hostVersion, // Host version + hostLanguage: hostLanguage, // Host language + hostName: _hostName, // Host name + hostSDKVersion: _SDKVersion, // SDK version + hostFontSizeSetting: fontSizeSetting, // Font size setting + windowTop: 0, // Window top position + windowBottom: 0, // Window bottom position + // Additional fields to be added in the future osLanguage: undefined, osTheme: undefined, ua: undefined, hostPackageName: undefined, browserName: undefined, - browserVersion: undefined }; - + browserVersion: undefined + }; + // Merge the parameters object with the result object Object.assign(result, parameters); } +// Function to determine the device type based on the model function getGetDeviceType(result, model) { - var deviceType = result.deviceType || 'phone'; - { - var deviceTypeMaps = { - ipad: 'pad', - windows: 'pc', - mac: 'pc' }; - - var deviceTypeMapsKeys = Object.keys(deviceTypeMaps); - var _model = model.toLocaleLowerCase(); - for (var index = 0; index < deviceTypeMapsKeys.length; index++) { - var _m = deviceTypeMapsKeys[index]; - if (_model.indexOf(_m) !== -1) { - deviceType = deviceTypeMaps[_m]; - break; - } + var deviceType = result.deviceType || 'phone'; // Default to 'phone' if deviceType is not provided + + // Mapping device models to corresponding device types + var deviceTypeMaps = { + ipad: 'pad', + windows: 'pc', + mac: 'pc' + }; + + var deviceTypeMapsKeys = Object.keys(deviceTypeMaps); + var _model = model.toLocaleLowerCase(); // Convert model to lowercase + + // Iterate over the deviceTypeMaps and update the device type if there's a match + for (var index = 0; index < deviceTypeMapsKeys.length; index++) { + var _m = deviceTypeMapsKeys[index]; + if (_model.indexOf(_m) !== -1) { + deviceType = deviceTypeMaps[_m]; + break; } } - return deviceType; + + return deviceType; // Return the determined device type } +// Function to get the device brand in lowercase function getDeviceBrand(brand) { var deviceBrand = brand; if (deviceBrand) { - deviceBrand = brand.toLocaleLowerCase(); + deviceBrand = brand.toLocaleLowerCase(); // Convert brand name to lowercase } - return deviceBrand; + return deviceBrand; // Return the device brand } +// Function to get the app language, falling back to the default language if necessary function getAppLanguage(defaultLanguage) { - return getLocale$1 ? - getLocale$1() : - defaultLanguage; + return getLocale$1 ? getLocale$1() : defaultLanguage; // Return the language, defaulting if necessary } +// Function to get the host name, which can vary depending on the environment function getHostName(result) { - var _platform = 'WeChat'; - var _hostName = result.hostName || _platform; // mp-jd - { - if (result.environment) { - _hostName = result.environment; - } else if (result.host && result.host.env) { - _hostName = result.host.env; - } + var _platform = 'WeChat'; // Default to WeChat platform + var _hostName = result.hostName || _platform; // Use result.hostName or default platform + + // If the environment is specified, use that as the host name + if (result.environment) { + _hostName = result.environment; + } else if (result.host && result.host.env) { + _hostName = result.host.env; } - return _hostName; + return _hostName; // Return the determined host name } +// Various system and app-related functions for handling specific API return values + var getSystemInfo = { returnValue: function returnValue(result) { - useDeviceId(result); - addSafeAreaInsets(result); - populateParameters(result); - } }; - + useDeviceId(result); // Add device ID to result + addSafeAreaInsets(result); // Add safe area insets + populateParameters(result); // Populate device/system parameters + } +}; var showActionSheet = { args: function args(fromArgs) { if (typeof fromArgs === 'object') { - fromArgs.alertText = fromArgs.title; + fromArgs.alertText = fromArgs.title; // Rename 'title' to 'alertText' for consistency } - } }; - + } +}; var getAppBaseInfo = { - returnValue: function returnValue(result) {var _result = - result,version = _result.version,language = _result.language,SDKVersion = _result.SDKVersion,theme = _result.theme; + returnValue: function returnValue(result) { + var _result = result, version = _result.version, language = _result.language, SDKVersion = _result.SDKVersion, theme = _result.theme; - var _hostName = getHostName(result); + var _hostName = getHostName(result); // Get the host name - var hostLanguage = language.replace('_', '-'); + var hostLanguage = language.replace('_', '-'); // Format language string + // Sort and update result with additional app base information result = sortObject(Object.assign(result, { - appId: "__UNI__43209E9", - appName: "project-rjwm-weixin-uniapp", - appVersion: "1.0.0", - appVersionCode: "100", - appLanguage: getAppLanguage(hostLanguage), - hostVersion: version, - hostLanguage: hostLanguage, - hostName: _hostName, - hostSDKVersion: SDKVersion, - hostTheme: theme })); - - } }; - + appId: "__UNI__43209E9", // Unique App ID + appName: "project-rjwm-weixin-uniapp", // App name + appVersion: "1.0.0", // App version + appVersionCode: "100", // App version code + appLanguage: getAppLanguage(hostLanguage), // App language + hostVersion: version, // Host version + hostLanguage: hostLanguage, // Host language + hostName: _hostName, // Host name + hostSDKVersion: SDKVersion, // Host SDK version + hostTheme: theme // Host theme + })); + } +}; var getDeviceInfo = { - returnValue: function returnValue(result) {var _result2 = - result,brand = _result2.brand,model = _result2.model; - var deviceType = getGetDeviceType(result, model); - var deviceBrand = getDeviceBrand(brand); - useDeviceId(result); - - result = sortObject(Object.assign(result, { - deviceType: deviceType, - deviceBrand: deviceBrand, - deviceModel: model })); + returnValue: function returnValue(result) { + var _result2 = result, brand = _result2.brand, model = _result2.model; - } }; + var deviceType = getGetDeviceType(result, model); // Get the device type + var deviceBrand = getDeviceBrand(brand); // Get the device brand + useDeviceId(result); // Add device ID to result + // Sort and update result with additional device information + result = sortObject(Object.assign(result, { + deviceType: deviceType, // Device type + deviceBrand: deviceBrand, // Device brand + deviceModel: model // Device model + })); + } +}; var getWindowInfo = { returnValue: function returnValue(result) { - addSafeAreaInsets(result); + addSafeAreaInsets(result); // Add safe area insets to result + // Sort and update result with window information result = sortObject(Object.assign(result, { - windowTop: 0, - windowBottom: 0 })); - - } }; - - -// import navigateTo from 'uni-helpers/navigate-to' + windowTop: 0, // Window top position + windowBottom: 0 // Window bottom position + })); + } +}; +// Protocols defining the available APIs and their corresponding handlers var protocols = { redirectTo: redirectTo, - // navigateTo, // 由于在微信开发者工具的页面参数,会显示__id__参数,因此暂时关闭mp-weixin对于navigateTo的AOP previewImage: previewImage, getSystemInfo: getSystemInfo, getSystemInfoSync: getSystemInfo, showActionSheet: showActionSheet, getAppBaseInfo: getAppBaseInfo, getDeviceInfo: getDeviceInfo, - getWindowInfo: getWindowInfo }; + getWindowInfo: getWindowInfo +}; +// Placeholder for other API methods var todos = [ -'vibrate', -'preloadPage', -'unPreloadPage', -'loadSubPackage']; - -var canIUses = []; + 'vibrate', + 'preloadPage', + 'unPreloadPage', + 'loadSubPackage' +]; +// List of supported callback types var CALLBACKS = ['success', 'fail', 'cancel', 'complete']; +// Function to handle API callback processing function processCallback(methodName, method, returnValue) { return function (res) { - return method(processReturnValue(methodName, res, returnValue)); + return method(processReturnValue(methodName, res, returnValue)); // Call the method with processed return value }; } -function processArgs(methodName, fromArgs) {var argsOption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};var returnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};var keepFromArgs = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; - if (isPlainObject(fromArgs)) {// 一般 api 的参数解析 - var toArgs = keepFromArgs === true ? fromArgs : {}; // returnValue 为 false 时,说明是格式化返回值,直接在返回值对象上修改赋值 +// Function to process arguments passed to an API method +function processArgs(methodName, fromArgs, argsOption = {}, returnValue = {}, keepFromArgs = false) { + if (isPlainObject(fromArgs)) { // If arguments are a plain object + var toArgs = keepFromArgs === true ? fromArgs : {}; // Copy or modify arguments if (isFn(argsOption)) { - argsOption = argsOption(fromArgs, toArgs) || {}; + argsOption = argsOption(fromArgs, toArgs) || {}; // Invoke argsOption function if provided } for (var key in fromArgs) { - if (hasOwn(argsOption, key)) { + if (hasOwn(argsOption, key)) { // Check if argsOption has a key var keyOption = argsOption[key]; if (isFn(keyOption)) { - keyOption = keyOption(fromArgs[key], fromArgs, toArgs); + keyOption = keyOption(fromArgs[key], fromArgs, toArgs); // Process keyOption if it's a function } - if (!keyOption) {// 不支持的参数 + if (!keyOption) { // If option is invalid, show a warning console.warn("The '".concat(methodName, "' method of platform '\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F' does not support option '").concat(key, "'")); - } else if (isStr(keyOption)) {// 重写参数 key + } else if (isStr(keyOption)) { // If option is a string, rename the key toArgs[keyOption] = fromArgs[key]; - } else if (isPlainObject(keyOption)) {// {name:newName,value:value}可重新指定参数 key:value + } else if (isPlainObject(keyOption)) { // If option is a plain object, rename key:value pair toArgs[keyOption.name ? keyOption.name : key] = keyOption.value; } - } else if (CALLBACKS.indexOf(key) !== -1) { + } else if (CALLBACKS.indexOf(key) !== -1) { // If key is a callback type, process it if (isFn(fromArgs[key])) { toArgs[key] = processCallback(methodName, fromArgs[key], returnValue); } - } else { + } else { // Otherwise, copy the argument if (!keepFromArgs) { toArgs[key] = fromArgs[key]; } } } - return toArgs; - } else if (isFn(fromArgs)) { + return toArgs; // Return the processed arguments + } else if (isFn(fromArgs)) { // If fromArgs is a function, process it as a callback fromArgs = processCallback(methodName, fromArgs, returnValue); } - return fromArgs; + return fromArgs; // Return processed arguments } -function processReturnValue(methodName, res, returnValue) {var keepReturnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; - if (isFn(protocols.returnValue)) {// 处理通用 returnValue +// Function to process the return value from an API method +function processReturnValue(methodName, res, returnValue, keepReturnValue = false) { + if (isFn(protocols.returnValue)) { // Process common return value if defined res = protocols.returnValue(methodName, res); } - return processArgs(methodName, res, returnValue, {}, keepReturnValue); + return processArgs(methodName, res, returnValue, {}, keepReturnValue); // Process return value arguments } +// Wrapper function for APIs function wrapper(methodName, method) { - if (hasOwn(protocols, methodName)) { + if (hasOwn(protocols, methodName)) { // Check if the method is defined in protocols var protocol = protocols[methodName]; - if (!protocol) {// 暂不支持的 api + if (!protocol) { // If not supported, return a function that logs an error return function () { console.error("Platform '\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F' does not support '".concat(methodName, "'.")); }; } - return function (arg1, arg2) {// 目前 api 最多两个参数 + return function (arg1, arg2) { // Wrapper for calling the method var options = protocol; if (isFn(protocol)) { - options = protocol(arg1); + options = protocol(arg1); // Call protocol as a function if necessary } arg1 = processArgs(methodName, arg1, options.args, options.returnValue); var args = [arg1]; if (typeof arg2 !== 'undefined') { - args.push(arg2); + args.push(arg2); // Add second argument if provided } if (isFn(options.name)) { - methodName = options.name(arg1); + methodName = options.name(arg1); // Update method name if options specify a function } else if (isStr(options.name)) { - methodName = options.name; + methodName = options.name; // Update method name if it's a string } - var returnValue = wx[methodName].apply(wx, args); - if (isSyncApi(methodName)) {// 同步 api + var returnValue = wx[methodName].apply(wx, args); // Call the actual API + + if (isSyncApi(methodName)) { // If it's a synchronous API, process the return value immediately return processReturnValue(methodName, returnValue, options.returnValue, isContextApi(methodName)); } - return returnValue; + return returnValue; // Return the result }; } - return method; + return method; // If not defined in protocols, return the original method } + var todoApis = Object.create(null); var TODOS = [ diff --git a/user/mp-weixin/pages/addOrEditAddress/addOrEditAddress.js b/user/mp-weixin/pages/addOrEditAddress/addOrEditAddress.js index d6bcdb2..8cf731b 100644 --- a/user/mp-weixin/pages/addOrEditAddress/addOrEditAddress.js +++ b/user/mp-weixin/pages/addOrEditAddress/addOrEditAddress.js @@ -1,9 +1,6 @@ (global["webpackJsonp"] = global["webpackJsonp"] || []).push([["pages/addOrEditAddress/addOrEditAddress"],{ /***/ 115: -/*!************************************************************************************************************!*\ - !*** D:/project/project-rjwm-weixin-uniapp/main.js?{"page":"pages%2FaddOrEditAddress%2FaddOrEditAddress"} ***! - \************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { @@ -60,9 +57,6 @@ component.options.__file = "pages/addOrEditAddress/addOrEditAddress.vue" /***/ }), /***/ 117: -/*!************************************************************************************************************************************!*\ - !*** D:/project/project-rjwm-weixin-uniapp/pages/addOrEditAddress/addOrEditAddress.vue?vue&type=template&id=174d7646&scoped=true& ***! - \************************************************************************************************************************************/ /*! exports provided: render, staticRenderFns, recyclableRender, components */ /***/ (function(module, __webpack_exports__, __webpack_require__) { @@ -82,9 +76,6 @@ __webpack_require__.r(__webpack_exports__); /***/ }), /***/ 118: -/*!************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\ - !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader??ref--16-0!./node_modules/@dcloudio/webpack-uni-mp-loader/lib/template.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-uni-app-loader/page-meta.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib??vue-loader-options!./node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!D:/project/project-rjwm-weixin-uniapp/pages/addOrEditAddress/addOrEditAddress.vue?vue&type=template&id=174d7646&scoped=true& ***! - \************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/ /*! exports provided: render, staticRenderFns, recyclableRender, components */ /***/ (function(module, __webpack_exports__, __webpack_require__) { @@ -135,10 +126,6 @@ render._withStripped = true /***/ }), /***/ 119: -/*!******************************************************************************************************************!*\ - !*** D:/project/project-rjwm-weixin-uniapp/pages/addOrEditAddress/addOrEditAddress.vue?vue&type=script&lang=js& ***! - \******************************************************************************************************************/ -/*! no static exports found */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -151,10 +138,6 @@ __webpack_require__.r(__webpack_exports__); /***/ }), /***/ 120: -/*!*************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\ - !*** ./node_modules/babel-loader/lib!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader??ref--12-1!./node_modules/@dcloudio/webpack-uni-mp-loader/lib/script.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib??vue-loader-options!./node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!D:/project/project-rjwm-weixin-uniapp/pages/addOrEditAddress/addOrEditAddress.vue?vue&type=script&lang=js& ***! - \*************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/ -/*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; From 552bc58cd22d69fd915ae49784b43d163d3dbb3d Mon Sep 17 00:00:00 2001 From: hukan <2685163979@qq.com> Date: Wed, 18 Dec 2024 21:19:34 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=80=E4=BA=9B?= =?UTF-8?q?=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- user/mp-weixin/common/vendor.js | 798 ++++++++++---------------------- 1 file changed, 249 insertions(+), 549 deletions(-) diff --git a/user/mp-weixin/common/vendor.js b/user/mp-weixin/common/vendor.js index 5258530..5541d72 100644 --- a/user/mp-weixin/common/vendor.js +++ b/user/mp-weixin/common/vendor.js @@ -1127,96 +1127,109 @@ function wrapper(methodName, method) { } +// Create an empty object to store the "todo" APIs var todoApis = Object.create(null); +// List of API names that are considered "todo" (not yet supported) var TODOS = [ -'onTabBarMidButtonTap', -'subscribePush', -'unsubscribePush', -'onPush', -'offPush', -'share']; - - + 'onTabBarMidButtonTap', + 'subscribePush', + 'unsubscribePush', + 'onPush', + 'offPush', + 'share']; + +// Function to create a "todo" API function function createTodoApi(name) { - return function todoApi(_ref) + return function todoApi(_ref) { + var fail = _ref.fail, complete = _ref.complete; - - {var fail = _ref.fail,complete = _ref.complete; + // Response for unsupported API call var res = { errMsg: "".concat(name, ":fail method '").concat(name, "' not supported") }; + // Call the fail or complete callback if provided isFn(fail) && fail(res); isFn(complete) && complete(res); }; } +// Loop through the TODOS array and create API methods for each one TODOS.forEach(function (name) { - todoApis[name] = createTodoApi(name); + todoApis[name] = createTodoApi(name); // Store the created API functions }); +// Providers object that maps services to their providers var providers = { oauth: ['weixin'], share: ['weixin'], payment: ['wxpay'], push: ['weixin'] }; +// Function to get the provider details based on the service requested +function getProvider(_ref2) { + var service = _ref2.service, success = _ref2.success, fail = _ref2.fail, complete = _ref2.complete; -function getProvider(_ref2) - - - - -{var service = _ref2.service,success = _ref2.success,fail = _ref2.fail,complete = _ref2.complete; var res = false; + + // Check if the service exists in the providers object if (providers[service]) { res = { errMsg: 'getProvider:ok', service: service, provider: providers[service] }; + // Call the success callback if it exists isFn(success) && success(res); } else { + // Service not found, return failure message res = { errMsg: 'getProvider:fail service not found' }; + // Call the fail callback if it exists isFn(fail) && fail(res); } + + // Always call the complete callback isFn(complete) && complete(res); } +// Additional API for providers var extraApi = /*#__PURE__*/Object.freeze({ __proto__: null, getProvider: getProvider }); - +// Function to get the event emitter instance var getEmitter = function () { var Emitter; return function getUniEmitter() { if (!Emitter) { - Emitter = new _vue.default(); + Emitter = new _vue.default(); // Lazy initialize the emitter } return Emitter; }; }(); +// Helper function to apply a method on an object with arguments function apply(ctx, method, args) { - return ctx[method].apply(ctx, args); + return ctx[method].apply(ctx, args); // Call the method with arguments on the given context } +// Event handling API functions function $on() { - return apply(getEmitter(), '$on', Array.prototype.slice.call(arguments)); + return apply(getEmitter(), '$on', Array.prototype.slice.call(arguments)); // Register event listener } function $off() { - return apply(getEmitter(), '$off', Array.prototype.slice.call(arguments)); + return apply(getEmitter(), '$off', Array.prototype.slice.call(arguments)); // Remove event listener } function $once() { - return apply(getEmitter(), '$once', Array.prototype.slice.call(arguments)); + return apply(getEmitter(), '$once', Array.prototype.slice.call(arguments)); // Register one-time event listener } function $emit() { - return apply(getEmitter(), '$emit', Array.prototype.slice.call(arguments)); + return apply(getEmitter(), '$emit', Array.prototype.slice.call(arguments)); // Emit an event } +// Event-related API object var eventApi = /*#__PURE__*/Object.freeze({ __proto__: null, $on: $on, @@ -1224,49 +1237,47 @@ var eventApi = /*#__PURE__*/Object.freeze({ $once: $once, $emit: $emit }); - -/** - * 框架内 try-catch - */ -/** - * 开发者 try-catch - */ +// Wrapper for try-catch blocks to handle exceptions in function execution function tryCatch(fn) { return function () { try { - return fn.apply(fn, arguments); + return fn.apply(fn, arguments); // Execute the function and return its result } catch (e) { - // TODO - console.error(e); + console.error(e); // Log the error if an exception occurs } }; } +// Function to handle and process API callbacks function getApiCallbacks(params) { var apiCallbacks = {}; + + // Loop through params and identify functions, then wrap them in tryCatch for (var name in params) { var param = params[name]; if (isFn(param)) { - apiCallbacks[name] = tryCatch(param); - delete params[name]; + apiCallbacks[name] = tryCatch(param); // Wrap the function in try-catch + delete params[name]; // Remove the callback from params } } return apiCallbacks; } +// Variables for push message and client id management var cid; var cidErrMsg; +// Normalize push message by parsing it as JSON if possible function normalizePushMessage(message) { try { - return JSON.parse(message); + return JSON.parse(message); // Try to parse message as JSON } catch (e) {} - return message; + return message; // Return original message if parsing fails } -function invokePushCallback( -args) -{ +// Function to handle push message callbacks +function invokePushCallback(args) { + // Handle different types of push message events if (args.type === 'clientId') { cid = args.cid; cidErrMsg = args.errMsg; @@ -1276,39 +1287,40 @@ args) callback({ type: 'receive', data: normalizePushMessage(args.message) }); - }); } else if (args.type === 'click') { onPushMessageCallbacks.forEach(function (callback) { callback({ type: 'click', data: normalizePushMessage(args.message) }); - }); } } +// Callbacks for getting push client ID var getPushCidCallbacks = []; +// Function to invoke all callbacks for getting push client ID function invokeGetPushCidCallbacks(cid, errMsg) { getPushCidCallbacks.forEach(function (callback) { - callback(cid, errMsg); + callback(cid, errMsg); // Call each registered callback }); - getPushCidCallbacks.length = 0; + getPushCidCallbacks.length = 0; // Clear the callbacks list } +// Function to get push client ID function getPushClientid(args) { if (!isPlainObject(args)) { - args = {}; - }var _getApiCallbacks = - - + args = {}; // Ensure args is a plain object + } + var _getApiCallbacks = getApiCallbacks(args), success = _getApiCallbacks.success, fail = _getApiCallbacks.fail, complete = _getApiCallbacks.complete; - getApiCallbacks(args),success = _getApiCallbacks.success,fail = _getApiCallbacks.fail,complete = _getApiCallbacks.complete; var hasSuccess = isFn(success); var hasFail = isFn(fail); var hasComplete = isFn(complete); + + // Push the callback function into the list for later invocation getPushCidCallbacks.push(function (cid, errMsg) { var res; if (cid) { @@ -1316,39 +1328,45 @@ function getPushClientid(args) { errMsg: 'getPushClientid:ok', cid: cid }; - hasSuccess && success(res); + hasSuccess && success(res); // Call success callback if present } else { res = { errMsg: 'getPushClientid:fail' + (errMsg ? ' ' + errMsg : '') }; - hasFail && fail(res); + hasFail && fail(res); // Call fail callback if present } - hasComplete && complete(res); + hasComplete && complete(res); // Always call the complete callback }); + + // If cid is already defined, invoke the callback immediately if (typeof cid !== 'undefined') { - Promise.resolve().then(function () {return invokeGetPushCidCallbacks(cid, cidErrMsg);}); + Promise.resolve().then(function () { return invokeGetPushCidCallbacks(cid, cidErrMsg); }); } } +// Callbacks for push message events var onPushMessageCallbacks = []; -// 不使用 defineOnApi 实现,是因为 defineOnApi 依赖 UniServiceJSBridge ,该对象目前在小程序上未提供,故简单实现 + +// Register or unregister push message listeners var onPushMessage = function onPushMessage(fn) { if (onPushMessageCallbacks.indexOf(fn) === -1) { - onPushMessageCallbacks.push(fn); + onPushMessageCallbacks.push(fn); // Add callback if not already registered } }; +// Unregister push message listeners var offPushMessage = function offPushMessage(fn) { if (!fn) { - onPushMessageCallbacks.length = 0; + onPushMessageCallbacks.length = 0; // Clear all callbacks } else { var index = onPushMessageCallbacks.indexOf(fn); if (index > -1) { - onPushMessageCallbacks.splice(index, 1); + onPushMessageCallbacks.splice(index, 1); // Remove specific callback } } }; +// API object for push-related functions var api = /*#__PURE__*/Object.freeze({ __proto__: null, getPushClientid: getPushClientid, @@ -1356,19 +1374,25 @@ var api = /*#__PURE__*/Object.freeze({ offPushMessage: offPushMessage, invokePushCallback: invokePushCallback }); - +// Wrapping Page and Component for custom handling var MPPage = Page; var MPComponent = Component; +// Customization regex for transforming event names var customizeRE = /:/g; +// Function to convert hyphenated strings to camelCase var customize = cached(function (str) { return camelize(str.replace(customizeRE, '-')); }); +// Initialize event triggering mechanism on page or component instance function initTriggerEvent(mpInstance) { var oldTriggerEvent = mpInstance.triggerEvent; - var newTriggerEvent = function newTriggerEvent(event) {for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {args[_key3 - 1] = arguments[_key3];} + var newTriggerEvent = function newTriggerEvent(event) { + for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) { + args[_key3 - 1] = arguments[_key3]; + } return oldTriggerEvent.apply(mpInstance, [customize(event)].concat(args)); }; try { @@ -1379,408 +1403,92 @@ function initTriggerEvent(mpInstance) { } } -function initHook(name, options, isComponent) { - var oldHook = options[name]; - if (!oldHook) { - options[name] = function () { - initTriggerEvent(this); - }; - } else { - options[name] = function () { - initTriggerEvent(this);for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {args[_key4] = arguments[_key4];} - return oldHook.apply(this, args); - }; - } -} -if (!MPPage.__$wrappered) { - MPPage.__$wrappered = true; - Page = function Page() {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - initHook('onLoad', options); - return MPPage(options); - }; - Page.after = MPPage.after; - - Component = function Component() {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - initHook('created', options); - return MPComponent(options); - }; -} +// Initialize hooks for Vue components (onLoad, created, etc.) +function initHook(name, options, hooks) { + var hook = hooks[name]; + var originalHook = options[name]; -var PAGE_EVENT_HOOKS = [ -'onPullDownRefresh', -'onReachBottom', -'onAddToFavorites', -'onShareTimeline', -'onShareAppMessage', -'onPageScroll', -'onResize', -'onTabItemTap']; - - -function initMocks(vm, mocks) { - var mpInstance = vm.$mp[vm.mpType]; - mocks.forEach(function (mock) { - if (hasOwn(mpInstance, mock)) { - vm[mock] = mpInstance[mock]; + options[name] = function () { + hook.apply(this, arguments); + if (originalHook) { + originalHook.apply(this, arguments); // Call the original hook if defined } - }); -} - -function hasHook(hook, vueOptions) { - if (!vueOptions) { - return true; - } - - if (_vue.default.options && Array.isArray(_vue.default.options[hook])) { - return true; - } - - vueOptions = vueOptions.default || vueOptions; - - if (isFn(vueOptions)) { - if (isFn(vueOptions.extendOptions[hook])) { - return true; - } - if (vueOptions.super && - vueOptions.super.options && - Array.isArray(vueOptions.super.options[hook])) { - return true; - } - return false; - } - - if (isFn(vueOptions[hook])) { - return true; - } - var mixins = vueOptions.mixins; - if (Array.isArray(mixins)) { - return !!mixins.find(function (mixin) {return hasHook(hook, mixin);}); - } -} - -function initHooks(mpOptions, hooks, vueOptions) { - hooks.forEach(function (hook) { - if (hasHook(hook, vueOptions)) { - mpOptions[hook] = function (args) { - return this.$vm && this.$vm.__call_hook(hook, args); - }; - } - }); -} - -function initVueComponent(Vue, vueOptions) { - vueOptions = vueOptions.default || vueOptions; - var VueComponent; - if (isFn(vueOptions)) { - VueComponent = vueOptions; - } else { - VueComponent = Vue.extend(vueOptions); - } - vueOptions = VueComponent.options; - return [VueComponent, vueOptions]; -} - -function initSlots(vm, vueSlots) { - if (Array.isArray(vueSlots) && vueSlots.length) { - var $slots = Object.create(null); - vueSlots.forEach(function (slotName) { - $slots[slotName] = true; - }); - vm.$scopedSlots = vm.$slots = $slots; - } + }; } -function initVueIds(vueIds, mpInstance) { - vueIds = (vueIds || '').split(','); - var len = vueIds.length; +// API wrapper for lifecycle methods like onLoad, created, etc. +var hooksApi = /*#__PURE__*/Object.freeze({ + __proto__: null, + initTriggerEvent: initTriggerEvent, + initHook: initHook }); - if (len === 1) { - mpInstance._$vueId = vueIds[0]; - } else if (len === 2) { - mpInstance._$vueId = vueIds[0]; - mpInstance._$vuePid = vueIds[1]; - } +// Utility to check if value is a function +function isFn(val) { + return typeof val === 'function'; } -function initData(vueOptions, context) { - var data = vueOptions.data || {}; - var methods = vueOptions.methods || {}; - - if (typeof data === 'function') { - try { - data = data.call(context); // 支持 Vue.prototype 上挂的数据 - } catch (e) { - if (Object({"VUE_APP_NAME":"project-rjwm-weixin-uniapp","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG) { - console.warn('根据 Vue 的 data 函数初始化小程序 data 失败,请尽量确保 data 函数中不访问 vm 对象,否则可能影响首次数据渲染速度。', data); - } - } - } else { - try { - // 对 data 格式化 - data = JSON.parse(JSON.stringify(data)); - } catch (e) {} - } - - if (!isPlainObject(data)) { - data = {}; - } - - Object.keys(methods).forEach(function (methodName) { - if (context.__lifecycle_hooks__.indexOf(methodName) === -1 && !hasOwn(data, methodName)) { - data[methodName] = methods[methodName]; - } - }); - - return data; +// Utility to check if object is a plain object +function isPlainObject(val) { + return Object.prototype.toString.call(val) === '[object Object]'; } -var PROP_TYPES = [String, Number, Boolean, Object, Array, null]; - -function createObserver(name) { - return function observer(newVal, oldVal) { - if (this.$vm) { - this.$vm[name] = newVal; // 为了触发其他非 render watcher +// Caching utility function +function cached(fn) { + var cache = Object.create(null); + return function cachedFn(str) { + var hit = cache[str]; + if (hit) { + return hit; } + cache[str] = fn(str); + return cache[str]; }; } -function initBehaviors(vueOptions, initBehavior) { - var vueBehaviors = vueOptions.behaviors; - var vueExtends = vueOptions.extends; - var vueMixins = vueOptions.mixins; - - var vueProps = vueOptions.props; - - if (!vueProps) { - vueOptions.props = vueProps = []; - } - - var behaviors = []; - if (Array.isArray(vueBehaviors)) { - vueBehaviors.forEach(function (behavior) { - behaviors.push(behavior.replace('uni://', "wx".concat("://"))); - if (behavior === 'uni://form-field') { - if (Array.isArray(vueProps)) { - vueProps.push('name'); - vueProps.push('value'); - } else { - vueProps.name = { - type: String, - default: '' }; - - vueProps.value = { - type: [String, Number, Boolean, Array, Object, Date], - default: '' }; - - } - } - }); - } - if (isPlainObject(vueExtends) && vueExtends.props) { - behaviors.push( - initBehavior({ - properties: initProperties(vueExtends.props, true) })); - - - } - if (Array.isArray(vueMixins)) { - vueMixins.forEach(function (vueMixin) { - if (isPlainObject(vueMixin) && vueMixin.props) { - behaviors.push( - initBehavior({ - properties: initProperties(vueMixin.props, true) })); - - - } - }); - } - return behaviors; -} - -function parsePropType(key, type, defaultValue, file) { - // [String]=>String - if (Array.isArray(type) && type.length === 1) { - return type[0]; - } - return type; -} - -function initProperties(props) {var isBehavior = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;var file = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; - var properties = {}; - if (!isBehavior) { - properties.vueId = { - type: String, - value: '' }; - - // 用于字节跳动小程序模拟抽象节点 - properties.generic = { - type: Object, - value: null }; - - // scopedSlotsCompiler auto - properties.scopedSlotsCompiler = { - type: String, - value: '' }; - - properties.vueSlots = { // 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots - type: null, - value: [], - observer: function observer(newVal, oldVal) { - var $slots = Object.create(null); - newVal.forEach(function (slotName) { - $slots[slotName] = true; - }); - this.setData({ - $slots: $slots }); - - } }; - - } - if (Array.isArray(props)) {// ['title'] - props.forEach(function (key) { - properties[key] = { - type: null, - observer: createObserver(key) }; - - }); - } else if (isPlainObject(props)) {// {title:{type:String,default:''},content:String} - Object.keys(props).forEach(function (key) { - var opts = props[key]; - if (isPlainObject(opts)) {// title:{type:String,default:''} - var value = opts.default; - if (isFn(value)) { - value = value(); - } - - opts.type = parsePropType(key, opts.type); - - properties[key] = { - type: PROP_TYPES.indexOf(opts.type) !== -1 ? opts.type : null, - value: value, - observer: createObserver(key) }; - - } else {// content:String - var type = parsePropType(key, opts); - properties[key] = { - type: PROP_TYPES.indexOf(type) !== -1 ? type : null, - observer: createObserver(key) }; - - } - }); - } - return properties; -} - -function wrapper$1(event) { - // TODO 又得兼容 mpvue 的 mp 对象 - try { - event.mp = JSON.parse(JSON.stringify(event)); - } catch (e) {} - - event.stopPropagation = noop; - event.preventDefault = noop; - - event.target = event.target || {}; - - if (!hasOwn(event, 'detail')) { - event.detail = {}; - } - - if (hasOwn(event, 'markerId')) { - event.detail = typeof event.detail === 'object' ? event.detail : {}; - event.detail.markerId = event.markerId; - } - - if (isPlainObject(event.detail)) { - event.target = Object.assign({}, event.target, event.detail); - } - - return event; +// Utility to convert hyphenated string to camelCase (e.g., "my-event" -> "myEvent") +function camelize(str) { + return str.replace(/-(\w)/g, function (_, c) { + return c ? c.toUpperCase() : ''; + }); } -function getExtraValue(vm, dataPathsArray) { - var context = vm; - dataPathsArray.forEach(function (dataPathArray) { - var dataPath = dataPathArray[0]; - var value = dataPathArray[2]; - if (dataPath || typeof value !== 'undefined') {// ['','',index,'disable'] - var propPath = dataPathArray[1]; - var valuePath = dataPathArray[3]; - var vFor; - if (Number.isInteger(dataPath)) { - vFor = dataPath; - } else if (!dataPath) { - vFor = context; - } else if (typeof dataPath === 'string' && dataPath) { - if (dataPath.indexOf('#s#') === 0) { - vFor = dataPath.substr(3); - } else { - vFor = vm.__get_value(dataPath, context); - } - } - - if (Number.isInteger(vFor)) { - context = value; - } else if (!propPath) { - context = vFor[value]; - } else { - if (Array.isArray(vFor)) { - context = vFor.find(function (vForItem) { - return vm.__get_value(propPath, vForItem) === value; - }); - } else if (isPlainObject(vFor)) { - context = Object.keys(vFor).find(function (vForKey) { - return vm.__get_value(propPath, vFor[vForKey]) === value; - }); - } else { - console.error('v-for 暂不支持循环数据:', vFor); - } - } - - if (valuePath) { - context = vm.__get_value(valuePath, context); - } - } - }); - return context; -} +// Processes additional event data (e.g., extra arguments for the event handler) +// and returns an object containing the processed data for event handling. function processEventExtra(vm, extra, event) { var extraObj = {}; + // Check if 'extra' is an array and has elements if (Array.isArray(extra) && extra.length) { - /** - *[ - * ['data.items', 'data.id', item.data.id], - * ['metas', 'id', meta.id] - *], - *[ - * ['data.items', 'data.id', item.data.id], - * ['metas', 'id', meta.id] - *], - *'test' - */ + // Loop through each entry in the extra array extra.forEach(function (dataPath, index) { + // If the dataPath is a string, process it based on different conditions if (typeof dataPath === 'string') { - if (!dataPath) {// model,prop.sync + if (!dataPath) { + // If it's empty, treat it as model and prop sync extraObj['$' + index] = vm; } else { - if (dataPath === '$event') {// $event + // Process the event argument ($event) + if (dataPath === '$event') { extraObj['$' + index] = event; } else if (dataPath === 'arguments') { + // Extract arguments from event detail if (event.detail && event.detail.__args__) { extraObj['$' + index] = event.detail.__args__; } else { extraObj['$' + index] = [event]; } - } else if (dataPath.indexOf('$event.') === 0) {// $event.target.value + } else if (dataPath.indexOf('$event.') === 0) { + // If dataPath starts with $event, extract the value from the event extraObj['$' + index] = vm.__get_value(dataPath.replace('$event.', ''), event); } else { + // Otherwise, get the value from the VM context extraObj['$' + index] = vm.__get_value(dataPath); } } } else { + // For non-string dataPath, call getExtraValue function extraObj['$' + index] = getExtraValue(vm, dataPath); } }); @@ -1789,8 +1497,10 @@ function processEventExtra(vm, extra, event) { return extraObj; } +// Converts an array of key-value pairs into an object function getObjByArray(arr) { var obj = {}; + // Loop through array and create an object with the key-value pairs for (var i = 1; i < arr.length; i++) { var element = arr[i]; obj[element[0]] = element[1]; @@ -1798,13 +1508,20 @@ function getObjByArray(arr) { return obj; } -function processEventArgs(vm, event) {var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];var extra = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];var isCustom = arguments.length > 4 ? arguments[4] : undefined;var methodName = arguments.length > 5 ? arguments[5] : undefined; - var isCustomMPEvent = false; // wxcomponent 组件,传递原始 event 对象 - if (isCustom) {// 自定义事件 - isCustomMPEvent = event.currentTarget && - event.currentTarget.dataset && - event.currentTarget.dataset.comType === 'wx'; - if (!args.length) {// 无参数,直接传入 event 或 detail 数组 +// Processes event arguments, including extracting additional event data and handling custom events +function processEventArgs(vm, event) { + var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + var extra = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : []; + var isCustom = arguments.length > 4 ? arguments[4] : undefined; + var methodName = arguments.length > 5 ? arguments[5] : undefined; + + var isCustomMPEvent = false; // Flag to check if it's a custom event (wxcomponent) + + if (isCustom) { + // Check if the event is a custom event + isCustomMPEvent = event.currentTarget && event.currentTarget.dataset && event.currentTarget.dataset.comType === 'wx'; + if (!args.length) { + // If no args, return event or event detail as the array if (isCustomMPEvent) { return [event]; } @@ -1812,27 +1529,31 @@ function processEventArgs(vm, event) {var args = arguments.length > 2 && argumen } } + // Process extra data for the event var extraObj = processEventExtra(vm, extra, event); var ret = []; + // Loop through args and process each args.forEach(function (arg) { if (arg === '$event') { - if (methodName === '__set_model' && !isCustom) {// input v-model value - ret.push(event.target.value); + // If the argument is $event, handle accordingly + if (methodName === '__set_model' && !isCustom) { + ret.push(event.target.value); // Handle input v-model value } else { if (isCustom && !isCustomMPEvent) { ret.push(event.detail.__args__[0]); - } else {// wxcomponent 组件或内置组件 - ret.push(event); + } else { + ret.push(event); // Return the event itself } } } else { + // Handle other types of arguments if (Array.isArray(arg) && arg[0] === 'o') { - ret.push(getObjByArray(arg)); + ret.push(getObjByArray(arg)); // Convert array to object } else if (typeof arg === 'string' && hasOwn(extraObj, arg)) { - ret.push(extraObj[arg]); + ret.push(extraObj[arg]); // Add value from extraObj if exists } else { - ret.push(arg); + ret.push(arg); // Otherwise, just add the argument } } }); @@ -1840,74 +1561,66 @@ function processEventArgs(vm, event) {var args = arguments.length > 2 && argumen return ret; } +// Constants for special event types var ONCE = '~'; var CUSTOM = '^'; +// Helper function to check if event type matches the expected type function isMatchEventType(eventType, optType) { - return eventType === optType || - - optType === 'regionchange' && ( - - eventType === 'begin' || - eventType === 'end'); - - + return eventType === optType || optType === 'regionchange' && (eventType === 'begin' || eventType === 'end'); } +// Helper function to get the context of a parent component function getContextVm(vm) { var $parent = vm.$parent; - // 父组件是 scoped slots 或者其他自定义组件时继续查找 + // If the parent is a scoped slot or a custom component, keep searching upwards while ($parent && $parent.$parent && ($parent.$options.generic || $parent.$parent.$options.generic || $parent.$scope._$vuePid)) { $parent = $parent.$parent; } return $parent && $parent.$parent; } -function handleEvent(event) {var _this2 = this; - event = wrapper$1(event); +// Handle the event by processing the event and invoking relevant handlers +function handleEvent(event) { + event = wrapper$1(event); // Wrap the event for processing - // [['tap',[['handle',[1,2,a]],['handle1',[1,2,a]]]]] + // Extract dataset from the current target or event target var dataset = (event.currentTarget || event.target).dataset; if (!dataset) { - return console.warn('事件信息不存在'); + return console.warn('事件信息不存在'); // Warn if event dataset is missing } - var eventOpts = dataset.eventOpts || dataset['event-opts']; // 支付宝 web-view 组件 dataset 非驼峰 + + // Extract event options from dataset + var eventOpts = dataset.eventOpts || dataset['event-opts']; if (!eventOpts) { - return console.warn('事件信息不存在'); + return console.warn('事件信息不存在'); // Warn if event options are missing } - // [['handle',[1,2,a]],['handle1',[1,2,a]]] - var eventType = event.type; - - var ret = []; + var eventType = event.type; // Get the event type + var ret = []; // Array to store results + // Loop through event options and check if they match the event type eventOpts.forEach(function (eventOpt) { var type = eventOpt[0]; var eventsArray = eventOpt[1]; var isCustom = type.charAt(0) === CUSTOM; - type = isCustom ? type.slice(1) : type; + type = isCustom ? type.slice(1) : type; // Remove CUSTOM prefix if exists var isOnce = type.charAt(0) === ONCE; - type = isOnce ? type.slice(1) : type; + type = isOnce ? type.slice(1) : type; // Remove ONCE prefix if exists if (eventsArray && isMatchEventType(eventType, type)) { + // If event type matches, process each event handler eventsArray.forEach(function (eventArray) { var methodName = eventArray[0]; if (methodName) { var handlerCtx = _this2.$vm; - if (handlerCtx.$options.generic) {// mp-weixin,mp-toutiao 抽象节点模拟 scoped slots + if (handlerCtx.$options.generic) { handlerCtx = getContextVm(handlerCtx) || handlerCtx; } if (methodName === '$emit') { - handlerCtx.$emit.apply(handlerCtx, - processEventArgs( - _this2.$vm, - event, - eventArray[1], - eventArray[2], - isCustom, - methodName)); - + // Special case for emitting events + handlerCtx.$emit.apply(handlerCtx, processEventArgs(_this2.$vm, event, eventArray[1], eventArray[2], isCustom, methodName)); return; } var handler = handlerCtx[methodName]; @@ -1916,78 +1629,70 @@ function handleEvent(event) {var _this2 = this; } if (isOnce) { if (handler.once) { - return; + return; // Avoid calling the handler more than once } handler.once = true; } - var params = processEventArgs( - _this2.$vm, - event, - eventArray[1], - eventArray[2], - isCustom, - methodName); + var params = processEventArgs(_this2.$vm, event, eventArray[1], eventArray[2], isCustom, methodName); + // Ensure params is an array params = Array.isArray(params) ? params : []; - // 参数尾部增加原始事件对象用于复杂表达式内获取额外数据 + // Add the event object to the params for more complex expressions if (/=\s*\S+\.eventParams\s*\|\|\s*\S+\[['"]event-params['"]\]/.test(handler.toString())) { - // eslint-disable-next-line no-sparse-arrays - params = params.concat([,,,,,,,,,, event]); + params = params.concat([,,,,,,,,,, event]); // Add the original event } - ret.push(handler.apply(handlerCtx, params)); + ret.push(handler.apply(handlerCtx, params)); // Call the handler with params } }); } }); - if ( - eventType === 'input' && - ret.length === 1 && - typeof ret[0] !== 'undefined') - { + // If the event type is 'input' and the handler has returned a result, return that result + if (eventType === 'input' && ret.length === 1 && typeof ret[0] !== 'undefined') { return ret[0]; } } -var eventChannels = {}; - -var eventChannelStack = []; +// Event channel management +var eventChannels = {}; // Store for event channels +var eventChannelStack = []; // Stack of event channels +// Get an event channel by ID function getEventChannel(id) { if (id) { var eventChannel = eventChannels[id]; - delete eventChannels[id]; + delete eventChannels[id]; // Remove the channel from the store after retrieving return eventChannel; } - return eventChannelStack.shift(); + return eventChannelStack.shift(); // If no ID, return the first item from the stack } +// Define hooks for lifecycle methods var hooks = [ -'onShow', -'onHide', -'onError', -'onPageNotFound', -'onThemeChange', -'onUnhandledRejection']; - + 'onShow', + 'onHide', + 'onError', + 'onPageNotFound', + 'onThemeChange', + 'onUnhandledRejection' +]; +// Initialize event channel handling for Vue components function initEventChannel() { _vue.default.prototype.getOpenerEventChannel = function () { - // 微信小程序使用自身getOpenerEventChannel - { - return this.$scope.getOpenerEventChannel(); - } + return this.$scope.getOpenerEventChannel(); // Return the opener event channel in MP environments }; var callHook = _vue.default.prototype.__call_hook; _vue.default.prototype.__call_hook = function (hook, args) { if (hook === 'onLoad' && args && args.__id__) { - this.__eventChannel__ = getEventChannel(args.__id__); + this.__eventChannel__ = getEventChannel(args.__id__); // Initialize event channel on onLoad delete args.__id__; } return callHook.call(this, hook, args); }; } +// Initialize scoped slot parameters for Vue components function initScopedSlotsParams() { var center = {}; var parents = {}; @@ -2036,24 +1741,22 @@ function initScopedSlotsParams() { delete center[vueId]; delete parents[vueId]; } - } }); - + } + }); } -function parseBaseApp(vm, _ref3) - +// Initialize the base app for a Vue instance in mini-program environments +function parseBaseApp(vm, _ref3) { + var mocks = _ref3.mocks, initRefs = _ref3.initRefs; + initEventChannel(); // Initialize event channel + initScopedSlotsParams(); // Initialize scoped slots params -{var mocks = _ref3.mocks,initRefs = _ref3.initRefs; - initEventChannel(); - { - initScopedSlotsParams(); - } + // Initialize store if present in the options if (vm.$options.store) { _vue.default.prototype.$store = vm.$options.store; } - uniIdMixin(_vue.default); - _vue.default.prototype.mpHost = "mp-weixin"; + _vue.default.prototype.mpHost = "mp-weixin"; // Set the host for mini-program environments _vue.default.mixin({ beforeCreate: function beforeCreate() { @@ -2064,58 +1767,50 @@ function parseBaseApp(vm, _ref3) this.mpType = this.$options.mpType; this.$mp = _defineProperty({ - data: {} }, - this.mpType, this.$options.mpInstance); - + data: {} }, + this.mpType, this.$options.mpInstance); this.$scope = this.$options.mpInstance; delete this.$options.mpType; delete this.$options.mpInstance; - if (this.mpType === 'page' && typeof getApp === 'function') {// hack vue-i18n + + if (this.mpType === 'page' && typeof getApp === 'function') { var app = getApp(); if (app.$vm && app.$vm.$i18n) { - this._i18n = app.$vm.$i18n; + this._i18n = app.$vm.$i18n; // Initialize i18n for the app } } if (this.mpType !== 'app') { initRefs(this); - initMocks(this, mocks); + initMocks(this, mocks); // Initialize refs and mocks } - } }); - + } + }); var appOptions = { onLaunch: function onLaunch(args) { - if (this.$vm) {// 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前 + if (this.$vm) { return; } - { - if (wx.canIUse && !wx.canIUse('nextTick')) {// 事实 上2.2.3 即可,简单使用 2.3.0 的 nextTick 判断 - console.error('当前微信基础库版本过低,请将 微信开发者工具-详情-项目设置-调试基础库版本 更换为`2.3.0`以上'); - } - } this.$vm = vm; this.$vm.$mp = { app: this }; - this.$vm.$scope = this; - // vm 上也挂载 globalData this.$vm.globalData = this.globalData; this.$vm._isMounted = true; this.$vm.__call_hook('mounted', args); this.$vm.__call_hook('onLaunch', args); - } }; - + } + }; - // 兼容旧版本 globalData + // Initialize global data and methods for the app appOptions.globalData = vm.$options.globalData || {}; - // 将 methods 中的方法挂在 getApp() 中 var methods = vm.$options.methods; if (methods) { Object.keys(methods).forEach(function (name) { @@ -2124,24 +1819,25 @@ function parseBaseApp(vm, _ref3) } initAppLocale(_vue.default, vm, normalizeLocale(wx.getSystemInfoSync().language) || LOCALE_EN); - - initHooks(appOptions, hooks); + initHooks(appOptions, hooks); // Initialize app hooks return appOptions; } +// Initialize references and event handling for Vue components var mocks = ['__route__', '__wxExparserNodeId__', '__wxWebviewId__']; function findVmByVueId(vm, vuePid) { var $children = vm.$children; - // 优先查找直属(反向查找:https://github.com/dcloudio/uni-app/issues/1200) + // Search for the component using vueId for (var i = $children.length - 1; i >= 0; i--) { var childVm = $children[i]; if (childVm.$scope._$vueId === vuePid) { return childVm; } } - // 反向递归查找 + + // If not found, recurse to check deeper var parentVm; for (var _i = $children.length - 1; _i >= 0; _i--) { parentVm = findVmByVueId($children[_i], vuePid); @@ -2151,40 +1847,43 @@ function findVmByVueId(vm, vuePid) { } } +// Initialize behavior for mini-program components function initBehavior(options) { return Behavior(options); } +// Check if the current context is a page function isPage() { return !!this.route; } +// Initialize relation (e.g., parent-child relationships) between components function initRelation(detail) { - this.triggerEvent('__l', detail); + this.triggerEvent('__l', detail); // Trigger event to establish the relation } +// Select all components matching a selector and store them in $refs function selectAllComponents(mpInstance, selector, $refs) { var components = mpInstance.selectAllComponents(selector); components.forEach(function (component) { var ref = component.dataset.ref; $refs[ref] = component.$vm || component; - { - if (component.dataset.vueGeneric === 'scoped') { - component.selectAllComponents('.scoped-ref').forEach(function (scopedComponent) { - selectAllComponents(scopedComponent, selector, $refs); - }); - } + if (component.dataset.vueGeneric === 'scoped') { + component.selectAllComponents('.scoped-ref').forEach(function (scopedComponent) { + selectAllComponents(scopedComponent, selector, $refs); + }); } }); } +// Initialize references for the Vue instance function initRefs(vm) { var mpInstance = vm.$scope; + // Define $refs to collect components matching the .vue-ref selector Object.defineProperty(vm, '$refs', { get: function get() { var $refs = {}; selectAllComponents(mpInstance, '.vue-ref', $refs); - // TODO 暂不考虑 for 中的 scoped var forComponents = mpInstance.selectAllComponents('.vue-ref-in-for'); forComponents.forEach(function (component) { var ref = component.dataset.ref; @@ -2194,10 +1893,11 @@ function initRefs(vm) { $refs[ref].push(component.$vm || component); }); return $refs; - } }); - + } + }); } + function handleLink(event) {var _ref4 =