app-renderjs.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448
  1. var __renderjsModules={};
  2. __renderjsModules["2d61c7cf"] = (() => {
  3. var __defProp = Object.defineProperty;
  4. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  5. var __getOwnPropNames = Object.getOwnPropertyNames;
  6. var __hasOwnProp = Object.prototype.hasOwnProperty;
  7. var __export = (target, all) => {
  8. for (var name in all)
  9. __defProp(target, name, { get: all[name], enumerable: true });
  10. };
  11. var __copyProps = (to, from, except, desc) => {
  12. if (from && typeof from === "object" || typeof from === "function") {
  13. for (let key of __getOwnPropNames(from))
  14. if (!__hasOwnProp.call(to, key) && key !== except)
  15. __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  16. }
  17. return to;
  18. };
  19. var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
  20. // <stdin>
  21. var stdin_exports = {};
  22. __export(stdin_exports, {
  23. default: () => stdin_default
  24. });
  25. var stdin_default = {
  26. data() {
  27. return {
  28. videoElement: null
  29. };
  30. },
  31. methods: {
  32. createVideo(newValue, oldValue, ownerInstance, instance) {
  33. if (!newValue)
  34. return;
  35. const container = instance.$el;
  36. container.innerHTML = "";
  37. const video = document.createElement("video");
  38. video.src = newValue;
  39. video.style.width = "100%";
  40. video.style.height = "100%";
  41. video.style.objectFit = "cover";
  42. video.autoplay = true;
  43. video.loop = true;
  44. video.muted = true;
  45. video.controls = false;
  46. video.setAttribute("playsinline", "true");
  47. video.setAttribute("webkit-playsinline", "true");
  48. video.setAttribute("x5-playsinline", "true");
  49. video.setAttribute("x5-video-player-type", "h5-page");
  50. video.setAttribute("x5-video-player-fullscreen", "false");
  51. video.setAttribute("x-webkit-airplay", "deny");
  52. video.setAttribute("disablePictureInPicture", "true");
  53. video.setAttribute("controlslist", "nodownload nofullscreen noremoteplayback noplaybackrate");
  54. video.addEventListener("loadedmetadata", () => {
  55. ownerInstance.callMethod("onVideoLoaded");
  56. });
  57. video.addEventListener("play", () => {
  58. ownerInstance.callMethod("onVideoLoaded");
  59. });
  60. container.appendChild(video);
  61. this.videoElement = video;
  62. },
  63. // 监听 isPaused 变化
  64. updatePlayState(isPaused, oldValue, ownerInstance, instance) {
  65. if (this.videoElement) {
  66. if (isPaused) {
  67. this.videoElement.pause();
  68. } else {
  69. this.videoElement.play().catch((e) => console.error("Video play rejected:", e));
  70. }
  71. }
  72. },
  73. // 监听强制恢复播放 (处理页面 onShow 切回来的情况)
  74. forcePlay(newVal, oldVal, ownerInstance, instance) {
  75. if (this.videoElement && newVal > 0) {
  76. this.videoElement.play().catch((e) => console.error("Video force play rejected:", e));
  77. }
  78. }
  79. }
  80. };
  81. return __toCommonJS(stdin_exports);
  82. })();
  83. __renderjsModules["68423204"] = (() => {
  84. var __defProp = Object.defineProperty;
  85. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  86. var __getOwnPropNames = Object.getOwnPropertyNames;
  87. var __getOwnPropSymbols = Object.getOwnPropertySymbols;
  88. var __hasOwnProp = Object.prototype.hasOwnProperty;
  89. var __propIsEnum = Object.prototype.propertyIsEnumerable;
  90. var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  91. var __spreadValues = (a, b) => {
  92. for (var prop in b || (b = {}))
  93. if (__hasOwnProp.call(b, prop))
  94. __defNormalProp(a, prop, b[prop]);
  95. if (__getOwnPropSymbols)
  96. for (var prop of __getOwnPropSymbols(b)) {
  97. if (__propIsEnum.call(b, prop))
  98. __defNormalProp(a, prop, b[prop]);
  99. }
  100. return a;
  101. };
  102. var __export = (target, all) => {
  103. for (var name in all)
  104. __defProp(target, name, { get: all[name], enumerable: true });
  105. };
  106. var __copyProps = (to, from, except, desc) => {
  107. if (from && typeof from === "object" || typeof from === "function") {
  108. for (let key of __getOwnPropNames(from))
  109. if (!__hasOwnProp.call(to, key) && key !== except)
  110. __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  111. }
  112. return to;
  113. };
  114. var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
  115. // <stdin>
  116. var stdin_exports = {};
  117. __export(stdin_exports, {
  118. default: () => stdin_default
  119. });
  120. // node_modules/.pnpm/z-paging@2.8.6/node_modules/z-paging/components/z-paging/config/index.js
  121. var config_default = {};
  122. // node_modules/.pnpm/z-paging@2.8.6/node_modules/z-paging/components/z-paging/js/z-paging-constant.js
  123. var z_paging_constant_default = {
  124. // 当前版本号
  125. version: "2.8.6",
  126. // 延迟操作的通用时间
  127. delayTime: 100,
  128. // 请求失败时候全局emit使用的key
  129. errorUpdateKey: "z-paging-error-emit",
  130. // 全局emit complete的key
  131. completeUpdateKey: "z-paging-complete-emit",
  132. // z-paging缓存的前缀key
  133. cachePrefixKey: "z-paging-cache",
  134. // 虚拟列表中列表index的key
  135. listCellIndexKey: "zp_index",
  136. // 虚拟列表中列表的唯一key
  137. listCellIndexUniqueKey: "zp_unique_index"
  138. };
  139. // node_modules/.pnpm/z-paging@2.8.6/node_modules/z-paging/components/z-paging/js/z-paging-utils.js
  140. var storageKey = "Z-PAGING-REFRESHER-TIME-STORAGE-KEY";
  141. var config = null;
  142. var configLoaded = false;
  143. var cachedSystemInfo = null;
  144. var timeoutMap = {};
  145. function gc(key, defaultValue) {
  146. return () => {
  147. _handleDefaultConfig();
  148. if (!config)
  149. return defaultValue;
  150. const value = config[key];
  151. return value === void 0 ? defaultValue : value;
  152. };
  153. }
  154. function getTouch(e) {
  155. let touch = null;
  156. if (e.touches && e.touches.length) {
  157. touch = e.touches[0];
  158. } else if (e.changedTouches && e.changedTouches.length) {
  159. touch = e.changedTouches[0];
  160. } else if (e.datail && e.datail != {}) {
  161. touch = e.datail;
  162. } else {
  163. return { touchX: 0, touchY: 0 };
  164. }
  165. return {
  166. touchX: touch.clientX,
  167. touchY: touch.clientY
  168. };
  169. }
  170. function getTouchFromZPaging(target) {
  171. if (target && target.tagName && target.tagName !== "BODY" && target.tagName !== "UNI-PAGE-BODY") {
  172. const classList = target.classList;
  173. if (classList && classList.contains("z-paging-content")) {
  174. return {
  175. isFromZp: true,
  176. isPageScroll: classList.contains("z-paging-content-page"),
  177. isReachedTop: classList.contains("z-paging-reached-top"),
  178. isUseChatRecordMode: classList.contains("z-paging-use-chat-record-mode")
  179. };
  180. } else {
  181. return getTouchFromZPaging(target.parentNode);
  182. }
  183. } else {
  184. return { isFromZp: false };
  185. }
  186. }
  187. function getParent(parent) {
  188. if (!parent)
  189. return null;
  190. if (parent.$refs.paging)
  191. return parent;
  192. return getParent(parent.$parent);
  193. }
  194. function consoleErr(err) {
  195. console.error(`[z-paging]${err}`);
  196. }
  197. function delay(callback, ms = z_paging_constant_default.delayTime, key) {
  198. const timeout = setTimeout(callback, ms);
  199. ;
  200. if (!!key) {
  201. timeoutMap[key] && clearTimeout(timeoutMap[key]);
  202. timeoutMap[key] = timeout;
  203. }
  204. return timeout;
  205. }
  206. function setRefesrherTime(time, key) {
  207. const datas = getRefesrherTime() || {};
  208. datas[key] = time;
  209. uni.setStorageSync(storageKey, datas);
  210. }
  211. function getRefesrherTime() {
  212. return uni.getStorageSync(storageKey);
  213. }
  214. function getRefesrherTimeByKey(key) {
  215. const datas = getRefesrherTime();
  216. return datas && datas[key] ? datas[key] : null;
  217. }
  218. function getRefesrherFormatTimeByKey(key, textMap) {
  219. const time = getRefesrherTimeByKey(key);
  220. const timeText = time ? _timeFormat(time, textMap) : textMap.none;
  221. return `${textMap.title}${timeText}`;
  222. }
  223. function convertToPx(text) {
  224. const dataType = Object.prototype.toString.call(text);
  225. if (dataType === "[object Number]")
  226. return text;
  227. let isRpx = false;
  228. if (text.indexOf("rpx") !== -1 || text.indexOf("upx") !== -1) {
  229. text = text.replace("rpx", "").replace("upx", "");
  230. isRpx = true;
  231. } else if (text.indexOf("px") !== -1) {
  232. text = text.replace("px", "");
  233. }
  234. if (!isNaN(text)) {
  235. if (isRpx)
  236. return Number(rpx2px(text));
  237. return Number(text);
  238. }
  239. return 0;
  240. }
  241. function rpx2px(rpx) {
  242. return uni.upx2px(rpx);
  243. }
  244. function getSystemInfoSync(useCache = false) {
  245. if (useCache && cachedSystemInfo) {
  246. return cachedSystemInfo;
  247. }
  248. const infoTypes = ["DeviceInfo", "AppBaseInfo", "WindowInfo"];
  249. const { deviceInfo, appBaseInfo, windowInfo } = infoTypes.reduce((acc, key) => {
  250. const method = `get${key}`;
  251. if (uni[method] && uni.canIUse(method)) {
  252. acc[key.charAt(0).toLowerCase() + key.slice(1)] = uni[method]();
  253. }
  254. return acc;
  255. }, {});
  256. if (deviceInfo && appBaseInfo && windowInfo) {
  257. cachedSystemInfo = __spreadValues(__spreadValues(__spreadValues({}, deviceInfo), appBaseInfo), windowInfo);
  258. } else {
  259. cachedSystemInfo = uni.getSystemInfoSync();
  260. }
  261. return cachedSystemInfo;
  262. }
  263. function getTime() {
  264. return (/* @__PURE__ */ new Date()).getTime();
  265. }
  266. function getInstanceId() {
  267. const s = [];
  268. const hexDigits = "0123456789abcdef";
  269. for (let i = 0; i < 10; i++) {
  270. s[i] = hexDigits.substr(Math.floor(Math.random() * 16), 1);
  271. }
  272. return s.join("") + getTime();
  273. }
  274. function wait(ms) {
  275. return new Promise((resolve) => {
  276. setTimeout(resolve, ms);
  277. });
  278. }
  279. function isPromise(func) {
  280. return Object.prototype.toString.call(func) === "[object Promise]";
  281. }
  282. function addUnit(value, unit) {
  283. if (Object.prototype.toString.call(value) === "[object String]") {
  284. let tempValue = value;
  285. tempValue = tempValue.replace("rpx", "").replace("upx", "").replace("px", "");
  286. if (value.indexOf("rpx") === -1 && value.indexOf("upx") === -1 && value.indexOf("px") !== -1) {
  287. tempValue = parseFloat(tempValue) * 2;
  288. }
  289. value = tempValue;
  290. }
  291. return unit === "rpx" ? value + "rpx" : value / 2 + "px";
  292. }
  293. function deepCopy(obj) {
  294. if (typeof obj !== "object" || obj === null)
  295. return obj;
  296. let newObj = Array.isArray(obj) ? [] : {};
  297. for (let key in obj) {
  298. if (obj.hasOwnProperty(key)) {
  299. newObj[key] = deepCopy(obj[key]);
  300. }
  301. }
  302. return newObj;
  303. }
  304. function _handleDefaultConfig() {
  305. if (configLoaded)
  306. return;
  307. if (config_default && Object.keys(config_default).length) {
  308. config = config_default;
  309. }
  310. if (!config && uni.$zp) {
  311. config = uni.$zp.config;
  312. }
  313. config = config ? Object.keys(config).reduce((result, key) => {
  314. result[_toCamelCase(key)] = config[key];
  315. return result;
  316. }, {}) : null;
  317. configLoaded = true;
  318. }
  319. function _timeFormat(time, textMap) {
  320. const date = new Date(time);
  321. const currentDate = /* @__PURE__ */ new Date();
  322. const dateDay = new Date(time).setHours(0, 0, 0, 0);
  323. const currentDateDay = (/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0);
  324. const disTime = dateDay - currentDateDay;
  325. let dayStr = "";
  326. const timeStr = _dateTimeFormat(date);
  327. if (disTime === 0) {
  328. dayStr = textMap.today;
  329. } else if (disTime === -864e5) {
  330. dayStr = textMap.yesterday;
  331. } else {
  332. dayStr = _dateDayFormat(date, date.getFullYear() !== currentDate.getFullYear());
  333. }
  334. return `${dayStr} ${timeStr}`;
  335. }
  336. function _dateDayFormat(date, showYear = true) {
  337. const year = date.getFullYear();
  338. const month = date.getMonth() + 1;
  339. const day = date.getDate();
  340. return showYear ? `${year}-${_fullZeroToTwo(month)}-${_fullZeroToTwo(day)}` : `${_fullZeroToTwo(month)}-${_fullZeroToTwo(day)}`;
  341. }
  342. function _dateTimeFormat(date) {
  343. const hour = date.getHours();
  344. const minute = date.getMinutes();
  345. return `${_fullZeroToTwo(hour)}:${_fullZeroToTwo(minute)}`;
  346. }
  347. function _fullZeroToTwo(str) {
  348. str = str.toString();
  349. return str.length === 1 ? "0" + str : str;
  350. }
  351. function _toCamelCase(value) {
  352. return value.replace(/-([a-z])/g, (_, group1) => group1.toUpperCase());
  353. }
  354. var z_paging_utils_default = {
  355. gc,
  356. setRefesrherTime,
  357. getRefesrherFormatTimeByKey,
  358. getTouch,
  359. getTouchFromZPaging,
  360. getParent,
  361. convertToPx,
  362. getTime,
  363. getInstanceId,
  364. consoleErr,
  365. delay,
  366. wait,
  367. isPromise,
  368. addUnit,
  369. deepCopy,
  370. rpx2px,
  371. getSystemInfoSync
  372. };
  373. // node_modules/.pnpm/z-paging@2.8.6/node_modules/z-paging/components/z-paging/wxs/z-paging-renderjs.js
  374. var data = {
  375. startY: 0,
  376. isTouchFromZPaging: false,
  377. isUsePageScroll: false,
  378. isReachedTop: true,
  379. isIosAndH5: false,
  380. useChatRecordMode: false,
  381. appLaunched: false
  382. };
  383. var z_paging_renderjs_default = {
  384. mounted() {
  385. if (window) {
  386. this._handleTouch();
  387. this.$ownerInstance.callMethod("_handlePageLaunch");
  388. }
  389. },
  390. methods: {
  391. // 接收逻辑层发送的数据(是否是ios+h5)
  392. renderPropIsIosAndH5Change(newVal) {
  393. if (newVal === -1)
  394. return;
  395. data.isIosAndH5 = newVal;
  396. },
  397. // 拦截处理touch事件
  398. _handleTouch() {
  399. if (!window.$zPagingRenderJsInited) {
  400. window.$zPagingRenderJsInited = true;
  401. window.addEventListener("touchstart", this._handleTouchstart, { passive: true });
  402. window.addEventListener("touchmove", this._handleTouchmove, { passive: false });
  403. }
  404. },
  405. // 处理touch开始
  406. _handleTouchstart(e) {
  407. const touch = z_paging_utils_default.getTouch(e);
  408. data.startY = touch.touchY;
  409. const touchResult = z_paging_utils_default.getTouchFromZPaging(e.target);
  410. data.isTouchFromZPaging = touchResult.isFromZp;
  411. data.isUsePageScroll = touchResult.isPageScroll;
  412. data.isReachedTop = touchResult.isReachedTop;
  413. data.useChatRecordMode = touchResult.isUseChatRecordMode;
  414. },
  415. // 处理touch中
  416. _handleTouchmove(e) {
  417. const touch = z_paging_utils_default.getTouch(e);
  418. const moveY = touch.touchY - data.startY;
  419. if (data.isTouchFromZPaging && (data.isReachedTop && (data.useChatRecordMode ? moveY < 0 : moveY > 0) || !data.useChatRecordMode && data.isIosAndH5 && !data.isUsePageScroll && moveY < 0)) {
  420. if (e.cancelable && !e.defaultPrevented) {
  421. e.preventDefault();
  422. }
  423. }
  424. },
  425. // 移除touch相关事件监听
  426. _removeAllEventListener() {
  427. window.removeEventListener("touchstart");
  428. window.removeEventListener("touchmove");
  429. }
  430. }
  431. };
  432. // <stdin>
  433. var stdin_default = {
  434. name: "z-paging",
  435. mixins: [z_paging_renderjs_default]
  436. };
  437. return __toCommonJS(stdin_exports);
  438. })();