living.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817
  1. "use strict";
  2. var common_vendor = require("../../common/vendor.js");
  3. var api_live = require("../../api/live.js");
  4. var api_order = require("../../api/order.js");
  5. var api_home = require("../../api/home.js");
  6. var common_assets = require("../../common/assets.js");
  7. require("../../common/request.js");
  8. var wsUrl = "ws://192.168.10.166:7114/app/webSocket";
  9. var pingpangTimes = null;
  10. var isSocketOpen = false;
  11. var socket = null;
  12. const _sfc_main = {
  13. data() {
  14. return {
  15. isFollow: true,
  16. liveViewData: {},
  17. liveViewers: [],
  18. likeName: 0,
  19. hlsPlayer: null,
  20. livingUrl: "",
  21. products: {},
  22. store: {},
  23. orderUser: {},
  24. userType: 0,
  25. timestamp: "",
  26. liveId: common_vendor.index.getStorageSync("liveId"),
  27. livedata: {},
  28. codeimg: "",
  29. placeholderText: "\u8BF4\u70B9\u4EC0\u4E48...",
  30. isZoom: false,
  31. userinfo: "",
  32. path: "http://192.168.10.166/dev-api",
  33. value: "",
  34. talkdisabled: false,
  35. autoplay: true,
  36. showadd: false,
  37. talklist: [],
  38. scrollIntoView: "",
  39. bufferRate: 0,
  40. playDuration: 0,
  41. videoContext: "",
  42. thistime: common_vendor.index.$u.timeFormat(new Date(), "yyyy-mm-dd hh:MM:ss"),
  43. upDown: true,
  44. isLongPress: false,
  45. timeout: null,
  46. showWelcomeMessage: false,
  47. isSubmit: false,
  48. messageContent: "",
  49. showziliao: false,
  50. isScreen: true,
  51. showAnswer: false,
  52. Answerlistall: {},
  53. answerlist: {},
  54. answerfrist: 0,
  55. checkboxValue: [],
  56. checkboxFormValue: "",
  57. allAnswerLists: [],
  58. showAnswerred: false,
  59. answerbtn: false,
  60. redallAnswerLists: [],
  61. redanswerAll: [],
  62. redanswerList: [],
  63. redanswertips: [],
  64. shopping: false,
  65. scrollTop: 0,
  66. old: {
  67. scrollTop: 0
  68. },
  69. liveData: {}
  70. };
  71. },
  72. onLoad(options) {
  73. },
  74. computed: {
  75. filteredViewers() {
  76. return this.liveViewers.slice(0, 3);
  77. }
  78. },
  79. mounted() {
  80. this.getliveViewData();
  81. this.intervalId = setInterval(() => {
  82. this.getliveViewData();
  83. }, 60 * 1e3);
  84. this.getLiveinformation();
  85. this.getliveOrder();
  86. this.getliveStore();
  87. this.getliveGoods();
  88. this.getliveUser();
  89. this.initTime();
  90. this.initSocket();
  91. var that = this;
  92. common_vendor.index.$on("initSocket", () => {
  93. that.initSocket();
  94. });
  95. common_vendor.index.$on("sendMsg", (item) => {
  96. that.sendMsg(item);
  97. });
  98. common_vendor.index.$on("closeWebSocket", () => {
  99. that.closeWebSocket();
  100. });
  101. this.getEWechatSdk();
  102. this.getliving();
  103. this.gettalklist();
  104. this.userinfo = JSON.parse(common_vendor.index.getStorageSync("userInfo"));
  105. },
  106. onReady: function(res) {
  107. this.videoContext = common_vendor.index.createVideoContext("myVideo");
  108. },
  109. onUnload() {
  110. if (this.hlsPlayer) {
  111. this.hlsPlayer.destroy();
  112. this.hlsPlayer = null;
  113. }
  114. },
  115. methods: {
  116. getOrderList() {
  117. let data = {
  118. page: 1,
  119. pageSize: 10
  120. };
  121. api_order.liveOrderList(data).then((res) => {
  122. console.log("\u8BA2\u5355\u5217\u8868>>>>", res);
  123. this.orderList = res;
  124. }, (rej) => {
  125. console.log("qxj rej:" + JSON.stringify(rej));
  126. });
  127. },
  128. initHlsPlayer() {
  129. if (common_vendor.Hls.isSupported() && this.livingUrl) {
  130. const video = document.getElementById("myVideo");
  131. if (video) {
  132. this.hlsPlayer = new common_vendor.Hls();
  133. this.hlsPlayer.loadSource(this.livingUrl);
  134. this.hlsPlayer.attachMedia(video);
  135. this.hlsPlayer.on(common_vendor.Hls.Events.MANIFEST_PARSED, () => {
  136. video.play();
  137. });
  138. }
  139. }
  140. },
  141. videoError(e) {
  142. console.error("\u89C6\u9891\u64AD\u653E\u9519\u8BEF:", e.detail.errMsg);
  143. if (this.livingUrl) {
  144. setTimeout(() => {
  145. this.videoContext.play();
  146. }, 2e3);
  147. }
  148. },
  149. getliving() {
  150. const param = {
  151. id: this.liveId
  152. };
  153. api_home.getlive(param).then((res) => {
  154. if (res.code == 200) {
  155. this.livedata = res.data;
  156. this.codeimg = res.data.qwQrCode;
  157. this.livingUrl = res.data.livingUrl;
  158. if (this.livingUrl && this.livingUrl.indexOf(".m3u8") > -1) {
  159. this.$nextTick(() => {
  160. if (this.videoContext) {
  161. this.videoContext.play();
  162. }
  163. });
  164. } else {
  165. if (this.livedata.status == 1) {
  166. this.autoplay = true;
  167. this.videoContext.seek(this.livedata.nowDuration);
  168. } else {
  169. this.autoplay = false;
  170. this.placeholderText = "\u76F4\u64AD\u5F00\u59CB\u624D\u80FD\u53D1\u8A00\u8BA8\u8BBA";
  171. this.talkdisabled = true;
  172. }
  173. }
  174. } else {
  175. common_vendor.index.showToast({
  176. title: res.msg,
  177. icon: "none",
  178. duration: 2e3
  179. });
  180. }
  181. });
  182. },
  183. maskString(str, maskChar = "*") {
  184. if (!str)
  185. return "";
  186. const strVal = String(str);
  187. return strVal.split("").map((char, index) => index === 0 ? char : maskChar).join("");
  188. },
  189. getPureDecimal(num, precision = 6) {
  190. const decimalPart = Math.abs(num).toFixed(precision).split(".")[1];
  191. return (decimalPart == null ? void 0 : decimalPart.replace(/0+$/, "")) || "";
  192. },
  193. goBack() {
  194. common_vendor.index.navigateBack();
  195. closeWebSocket();
  196. },
  197. getliveViewData() {
  198. api_live.getLiveViewData(this.liveId).then((res) => {
  199. if (res.code == 200) {
  200. console.log("\u76F4\u64AD\u95F4\u70B9\u8D5E\u3001\u5173\u6CE8\u3001\u5728\u7EBF\u4EBA\u6570\u6570\u636E>>>>", res);
  201. this.liveViewData = res;
  202. } else {
  203. common_vendor.index.showToast({
  204. title: res.msg,
  205. icon: "none"
  206. });
  207. }
  208. }, (rej) => {
  209. console.log("qxj rej:" + JSON.stringify(rej));
  210. });
  211. },
  212. getliveOrder() {
  213. api_live.liveOrderUser(this.liveId).then((res) => {
  214. if (res.code == 200) {
  215. console.log("\u6B63\u5728\u8D2D\u4E70>>>>", res);
  216. this.orderUser = res;
  217. } else {
  218. common_vendor.index.showToast({
  219. title: res.msg,
  220. icon: "none"
  221. });
  222. }
  223. }, (rej) => {
  224. console.log("qxj rej:" + JSON.stringify(rej));
  225. });
  226. },
  227. getliveStore() {
  228. let data = {
  229. pageSize: 10,
  230. page: 1
  231. };
  232. api_live.liveStore(this.liveId, data).then((res) => {
  233. if (res.code == 200) {
  234. console.log("\u5C0F\u9EC4\u8F66 \u5E97\u94FA\u5C55\u793A>>>>", res);
  235. this.products = res.products;
  236. this.store = res.store;
  237. } else {
  238. common_vendor.index.showToast({
  239. title: res.msg,
  240. icon: "none"
  241. });
  242. }
  243. }, (rej) => {
  244. console.log("qxj rej:" + JSON.stringify(rej));
  245. });
  246. },
  247. getliveGoods() {
  248. api_live.liveGoodsDetail(this.products.productId).then((res) => {
  249. if (res.code == 200) {
  250. console.log("\u5C0F\u9EC4\u8F66 \u5546\u54C1\u8BE6\u60C5>>>>", res);
  251. } else {
  252. common_vendor.index.showToast({
  253. title: res.msg,
  254. icon: "none"
  255. });
  256. }
  257. }, (rej) => {
  258. console.log("qxj rej:" + JSON.stringify(rej));
  259. });
  260. },
  261. getLiveinformation() {
  262. api_live.getLive(this.liveId).then((res) => {
  263. if (res.code == 200) {
  264. console.log("\u83B7\u53D6\u76F4\u64AD\u95F4\u4FE1\u606F\u63A5\u53E3>>>>", res);
  265. this.livingUrl = res.livingUrl;
  266. } else {
  267. common_vendor.index.showToast({
  268. title: res.msg,
  269. icon: "none"
  270. });
  271. }
  272. }, (rej) => {
  273. console.log("qxj rej:" + JSON.stringify(rej));
  274. });
  275. },
  276. getliveUser() {
  277. api_live.getRecentLiveViewers(this.liveId).then((res) => {
  278. if (res.code == 200) {
  279. console.log("\u83B7\u53D6\u76F4\u64AD\u95F4\u7528\u6237>>>>", res);
  280. this.liveViewers = res.recentLiveViewers;
  281. } else {
  282. common_vendor.index.showToast({
  283. title: res.msg,
  284. icon: "none"
  285. });
  286. }
  287. }, (rej) => {
  288. console.log("qxj rej:" + JSON.stringify(rej));
  289. });
  290. },
  291. onLike() {
  292. api_live.liveDataLike(this.liveId).then((res) => {
  293. if (res.code == 200) {
  294. if (typeof res.msg === "number" || typeof res.msg === "string" && /^\d+$/.test(res.msg.trim())) {
  295. this.liveData++;
  296. } else {
  297. common_vendor.index.showToast({
  298. title: res.msg,
  299. icon: "none"
  300. });
  301. }
  302. } else {
  303. common_vendor.index.showToast({
  304. title: res.msg,
  305. icon: "none"
  306. });
  307. }
  308. }, (rej) => {
  309. console.log("qxj rej:" + JSON.stringify(rej));
  310. });
  311. },
  312. onCollect(item) {
  313. console.log("item>>>", item.productId);
  314. let data = {
  315. liveId: this.liveId,
  316. productId: item.productId,
  317. storeId: this.store.storeId
  318. };
  319. api_live.collectStore(data).then((res) => {
  320. if (res.code == 200) {
  321. console.log("\u6536\u85CFlcollectStore>>>>", res);
  322. } else {
  323. common_vendor.index.showToast({
  324. title: res.msg,
  325. icon: "none"
  326. });
  327. }
  328. }, (rej) => {
  329. console.log("qxj rej:" + JSON.stringify(rej));
  330. });
  331. },
  332. onFollow() {
  333. api_live.follow(this.liveId).then((res) => {
  334. this.isFollow = !this.isFollow;
  335. common_vendor.index.showToast({
  336. title: res.msg,
  337. icon: "none"
  338. });
  339. }, (rej) => {
  340. console.log("qxj rej:" + JSON.stringify(rej));
  341. });
  342. },
  343. onShop() {
  344. },
  345. initTime() {
  346. const now = new Date();
  347. this.timestamp = now.getTime();
  348. },
  349. lowerChat: function(e) {
  350. console.log(e);
  351. },
  352. scroll: function(e) {
  353. console.log(e);
  354. this.old.scrollTop = e.detail.scrollTop;
  355. },
  356. scrolltolower() {
  357. this.loadmore();
  358. },
  359. loadmore() {
  360. },
  361. scrollchat() {
  362. },
  363. noredanswer() {
  364. if (this.Answerlistall > 0) {
  365. this.showAnswer = !this.this.showAnswer;
  366. } else {
  367. common_vendor.index.showToast({
  368. title: "\u6682\u65E0\u9898\u76EE",
  369. icon: "none"
  370. });
  371. }
  372. },
  373. redbagAnswer() {
  374. this.showAnswerred = !this.showAnswerred;
  375. this.answerbtn = !this.answerbtn;
  376. },
  377. submitAnswers() {
  378. if (this.isSubmit)
  379. return;
  380. this.isSubmit = true;
  381. const data = {
  382. questionId: this.answerlist.id,
  383. answer: this.checkboxFormValue
  384. };
  385. api_home.submitAnswer(data).then((res) => {
  386. if (res.code == 200) {
  387. common_vendor.index.showToast({
  388. title: res.msg,
  389. icon: "none"
  390. });
  391. }
  392. if (this.answerfrist < this.Answerlistall - 1) {
  393. this.answerfrist++;
  394. this.answerlist = this.allAnswerLists[this.answerfrist];
  395. this.answerlist.content = JSON.parse(this.answerlist.content);
  396. } else {
  397. common_vendor.index.showToast({
  398. title: "\u5DF2\u662F\u6700\u540E\u4E00\u9898",
  399. icon: "none"
  400. });
  401. this.showAnswer = false;
  402. }
  403. this.checkboxValue = [];
  404. this.checkboxFormValue = "";
  405. common_vendor.index.showToast({
  406. title: res.msg,
  407. icon: "none"
  408. });
  409. }).finally((e) => {
  410. this.isSubmit = false;
  411. });
  412. },
  413. handleCheckboxSelect(value) {
  414. const index = this.checkboxValue.indexOf(value);
  415. console.log(value);
  416. if (this.answerlist.type == 1) {
  417. this.checkboxValue = [value];
  418. this.checkboxFormValue = this.checkboxValue.join(",");
  419. this.submitAnswers();
  420. console.log(this.checkboxValue);
  421. } else if (this.answerlist.type == 2) {
  422. if (index > -1) {
  423. this.checkboxValue.splice(index, 1);
  424. this.checkboxFormValue = this.checkboxValue.join(",");
  425. } else {
  426. this.checkboxValue.push(value);
  427. this.checkboxFormValue = this.checkboxValue.join(",");
  428. }
  429. console.log(this.checkboxFormValue);
  430. }
  431. },
  432. getAnswerlists() {
  433. console.log(123);
  434. const data = {
  435. liveId: this.liveId
  436. };
  437. api_home.getAnswerlist(data).then((res) => {
  438. if (res.code == 200) {
  439. if (res.data.length > 0) {
  440. this.allAnswerLists = res.data;
  441. this.Answerlistall = res.data.length;
  442. if (this.allAnswerLists.length > 0) {
  443. this.answerlist = this.allAnswerLists[0];
  444. this.answerlist.content = JSON.parse(this.allAnswerLists[0].content);
  445. }
  446. this.showAnswer = true;
  447. } else {
  448. this.showAnswer = false;
  449. }
  450. }
  451. });
  452. },
  453. gettalklist() {
  454. const param = {
  455. id: this.liveId
  456. };
  457. api_home.gettextlist(param).then((res) => {
  458. if (res.code == 200) {
  459. this.talklist = res.data;
  460. this.$nextTick(() => {
  461. this.scrollIntoView = `list_${this.talklist.length - 1}`;
  462. });
  463. }
  464. });
  465. },
  466. open() {
  467. },
  468. close() {
  469. this.showadd = !this.showadd;
  470. },
  471. closes() {
  472. this.showziliao = !this.showziliao;
  473. },
  474. closest() {
  475. this.showAnswer = !this.showAnswer;
  476. },
  477. closestred() {
  478. this.showAnswerred = !this.showAnswerred;
  479. },
  480. closeanswer() {
  481. this.answerbtn = !this.answerbtn;
  482. },
  483. closeshop() {
  484. this.shopping = !this.shopping;
  485. },
  486. longPress() {
  487. this.timeout = setTimeout(() => {
  488. this.isLongPress = true;
  489. common_vendor.index.saveImageToPhotosAlbum({
  490. filePath: this.livedata.qwQrCode,
  491. success: () => {
  492. common_vendor.index.showToast({
  493. title: "\u4FDD\u5B58\u6210\u529F"
  494. });
  495. },
  496. fail: () => {
  497. common_vendor.index.showToast({
  498. title: "",
  499. icon: "none"
  500. });
  501. }
  502. });
  503. }, 500);
  504. },
  505. cancelLongPress() {
  506. clearTimeout(this.timeout);
  507. this.isLongPress = false;
  508. },
  509. handleTouchStart() {
  510. this.isZoom = true;
  511. },
  512. handleTouchEnd() {
  513. this.isZoom = false;
  514. },
  515. getliving() {
  516. const param = {
  517. id: this.liveId
  518. };
  519. api_home.getlive(param).then((res) => {
  520. if (res.code == 200) {
  521. this.livedata = res.data;
  522. this.codeimg = res.data.qwQrCode;
  523. if (this.livedata.status == 1) {
  524. this.autoplay = true;
  525. this.videoContext.seek(this.livedata.nowDuration);
  526. } else {
  527. this.autoplay = false;
  528. this.placeholderText = "\u76F4\u64AD\u5F00\u59CB\u624D\u80FD\u53D1\u8A00\u8BA8\u8BBA";
  529. this.talkdisabled = true;
  530. }
  531. console.log(this.autoplay);
  532. } else {
  533. common_vendor.index.showToast({
  534. title: res.msg,
  535. icon: "none",
  536. duration: 2e3
  537. });
  538. }
  539. });
  540. },
  541. getEWechatSdk() {
  542. },
  543. closeWebSocket() {
  544. if (socket != null) {
  545. common_vendor.index.closeSocket();
  546. }
  547. clearInterval(pingpangTimes);
  548. },
  549. reConnect() {
  550. var that = this;
  551. try {
  552. common_vendor.index.closeSocket();
  553. } catch (e) {
  554. }
  555. setTimeout(function() {
  556. that.initSocket();
  557. }, 1e4);
  558. },
  559. initSocket() {
  560. this.userinfo = JSON.parse(common_vendor.index.getStorageSync("userInfo"));
  561. let signature = common_vendor.CryptoJS.HmacSHA256(common_vendor.CryptoJS.enc.Utf8.parse(this.liveId.toString() + this.userinfo.userId + this.userType + this.timestamp), common_vendor.CryptoJS.enc.Utf8.parse(this.timestamp)).toString(common_vendor.CryptoJS.enc.Hex);
  562. var that = this;
  563. socket = common_vendor.index.connectSocket({
  564. url: wsUrl + "?userId=" + this.userinfo.userId + "&liveId=" + this.liveId + "&userType=" + this.userType + "&timestamp=" + this.timestamp + "&signature=" + signature,
  565. multiple: true,
  566. success: (res) => {
  567. clearInterval(pingpangTimes);
  568. common_vendor.index.onSocketMessage((res2) => {
  569. if (res2.data.code == 500) {
  570. common_vendor.index.showToast({
  571. title: res2.data.msg,
  572. icon: "none",
  573. duration: 2e3
  574. });
  575. }
  576. const redata = JSON.parse(res2.data);
  577. console.log("WebSocket\u62FF\u5230\u7684\u4E1C\u897F", redata);
  578. this.talklist.push(redata.data);
  579. this.$nextTick(() => {
  580. this.scrollIntoView = `list_${this.talklist.length - 1}`;
  581. });
  582. if (redata.cmd == "deleteId") {
  583. common_vendor.index.$emit("deleteId");
  584. } else if (redata.cmd == "init") {
  585. common_vendor.index.$emit("init", redata.data);
  586. } else if (redata.cmd == "reload") {
  587. common_vendor.index.$emit("reload");
  588. } else if (redata.data.cmd == "sendRedPacketQuestion") {
  589. const list = JSON.parse(redata.data.data);
  590. this.redanswerAll = [...this.redanswerAll, ...list];
  591. if (this.redanswerAll[1].randomAmount !== null) {
  592. this.redanswertips = JSON.parse(this.redanswerAll[0].randomAmount);
  593. }
  594. console.log(this.redanswertips);
  595. console.log(this.redanswerAll);
  596. } else if (redata.data.cmd == "entry") {
  597. this.showWelcomeMessage = true;
  598. common_vendor.index.$emit("entry", redata.data);
  599. }
  600. });
  601. },
  602. error: (res) => {
  603. common_vendor.index.$emit("websocket", 0);
  604. console.log(res);
  605. }
  606. });
  607. common_vendor.index.onSocketOpen(() => {
  608. isSocketOpen = true;
  609. console.log("WebSocket\u8FDE\u63A5\u5DF2\u6253\u5F00\uFF01!");
  610. common_vendor.index.showToast({
  611. title: "\u63D2\u4EF6\u5DF2\u6253\u5F00",
  612. icon: "none"
  613. });
  614. });
  615. common_vendor.index.onSocketClose(() => {
  616. isSocketOpen = false;
  617. clearInterval(pingpangTimes);
  618. console.log("WebSocket\u8FDE\u63A5\u5DF2\u5173\u95ED\uFF01");
  619. common_vendor.index.showToast({
  620. title: "\u63D2\u4EF6\u79BB\u7EBF",
  621. icon: "none"
  622. });
  623. that.reConnect();
  624. });
  625. common_vendor.index.onSocketError(() => {
  626. isSocketOpen = false;
  627. clearInterval(pingpangTimes);
  628. console.log("WebSocket\u8FDE\u63A5\u6253\u5F00\u5931\u8D25");
  629. common_vendor.index.showToast({
  630. title: "\u63D2\u4EF6\u79BB\u7EBF",
  631. icon: "none"
  632. });
  633. common_vendor.index.showModal({
  634. content: "\u804A\u5929\u8FDE\u63A5\u5931\u8D25\u662F\u5426\u91CD\u65B0\u5C1D\u8BD5\u8FDE\u63A5",
  635. success() {
  636. that.reConnect();
  637. }
  638. });
  639. });
  640. },
  641. sendMsg() {
  642. if (isSocketOpen) {
  643. const data = {
  644. liveId: this.liveId,
  645. userId: this.userinfo.userId,
  646. userType: 0,
  647. cmd: "sendMsg",
  648. msg: this.value,
  649. nickName: this.userinfo.nickName,
  650. avatar: this.userinfo.avatar
  651. };
  652. if (this.value == "") {
  653. common_vendor.index.showToast({
  654. title: "\u4E0D\u80FD\u53D1\u9001\u7A7A\u6D88\u606F",
  655. icon: "none"
  656. });
  657. } else {
  658. socket.send({
  659. data: JSON.stringify(data),
  660. success: () => {
  661. console.log("\u53D1\u9001\u6210\u529F");
  662. this.value = "";
  663. },
  664. fail: () => {
  665. console.log("\u53D1\u9001\u5931\u8D25");
  666. }
  667. });
  668. }
  669. }
  670. }
  671. }
  672. };
  673. if (!Array) {
  674. const _easycom_u_avatar2 = common_vendor.resolveComponent("u-avatar");
  675. const _easycom_u_input2 = common_vendor.resolveComponent("u-input");
  676. const _easycom_u_icon2 = common_vendor.resolveComponent("u-icon");
  677. const _easycom_u_popup2 = common_vendor.resolveComponent("u-popup");
  678. const _easycom_u_list_item2 = common_vendor.resolveComponent("u-list-item");
  679. const _easycom_u_list2 = common_vendor.resolveComponent("u-list");
  680. (_easycom_u_avatar2 + _easycom_u_input2 + _easycom_u_icon2 + _easycom_u_popup2 + _easycom_u_list_item2 + _easycom_u_list2)();
  681. }
  682. const _easycom_u_avatar = () => "../../uni_modules/uview-plus/components/u-avatar/u-avatar.js";
  683. const _easycom_u_input = () => "../../uni_modules/uview-plus/components/u-input/u-input.js";
  684. const _easycom_u_icon = () => "../../uni_modules/uview-plus/components/u-icon/u-icon.js";
  685. const _easycom_u_popup = () => "../../uni_modules/uview-plus/components/u-popup/u-popup.js";
  686. const _easycom_u_list_item = () => "../../uni_modules/uview-plus/components/u-list-item/u-list-item.js";
  687. const _easycom_u_list = () => "../../uni_modules/uview-plus/components/u-list/u-list.js";
  688. if (!Math) {
  689. (_easycom_u_avatar + _easycom_u_input + _easycom_u_icon + _easycom_u_popup + _easycom_u_list_item + _easycom_u_list)();
  690. }
  691. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  692. return common_vendor.e({
  693. a: common_vendor.o((...args) => $options.goBack && $options.goBack(...args)),
  694. b: common_assets._imports_0,
  695. c: common_vendor.p({
  696. src: $data.livedata.liveImgUrl,
  697. size: "32"
  698. }),
  699. d: common_vendor.t($data.livedata.liveName ? $data.livedata.liveName : "\u82B3\u534E\u672A\u6765"),
  700. e: common_vendor.t($data.liveViewData.follow || $data.liveViewData.follow === 0 ? $data.liveViewData.follow : 0),
  701. f: $data.isFollow
  702. }, $data.isFollow ? {
  703. g: common_vendor.o((...args) => $options.onFollow && $options.onFollow(...args))
  704. } : {
  705. h: common_vendor.o((...args) => $options.onFollow && $options.onFollow(...args))
  706. }, {
  707. i: common_vendor.f($options.filteredViewers, (item, index, i0) => {
  708. return {
  709. a: index,
  710. b: item.avatar
  711. };
  712. }),
  713. j: common_vendor.t($data.liveViewData.online),
  714. k: common_vendor.o(($event) => $options.onLike()),
  715. l: common_vendor.t($data.liveViewData.like),
  716. m: common_vendor.t($data.orderUser.userName ? $options.maskString($data.orderUser.userName) : ""),
  717. n: common_vendor.t($data.orderUser.count || 0),
  718. o: $data.livingUrl,
  719. p: $data.autoplay,
  720. q: common_vendor.o((...args) => $options.videoError && $options.videoError(...args)),
  721. r: $data.isScreen ? "100vh" : "",
  722. s: common_vendor.f($data.talklist, (item, index, i0) => {
  723. return {
  724. a: common_vendor.t(item.msg),
  725. b: item.index,
  726. c: `list_${index}`,
  727. d: item.cmd == "announcement"
  728. };
  729. }),
  730. t: common_vendor.t($data.messageContent),
  731. v: common_vendor.f($data.talklist, (item, index, i0) => {
  732. return {
  733. a: common_vendor.t(item.nickName),
  734. b: common_vendor.t(item.msg),
  735. c: item.index,
  736. d: `list_${index}`,
  737. e: item.cmd == "sendMsg"
  738. };
  739. }),
  740. w: $data.showWelcomeMessage
  741. }, $data.showWelcomeMessage ? {
  742. x: common_vendor.f($data.talklist, (item, index, i0) => {
  743. return {
  744. a: common_vendor.t(item.nickName),
  745. b: common_vendor.t(item.msg),
  746. c: item.index,
  747. d: `list_${index}`,
  748. e: item.cmd == "entry" || item.cmd == "out"
  749. };
  750. }),
  751. y: common_vendor.t($data.messageContent)
  752. } : {}, {
  753. z: $data.scrollIntoView,
  754. A: common_vendor.o($options.sendMsg),
  755. B: common_vendor.o($options.sendMsg),
  756. C: common_vendor.o(($event) => $data.value = $event),
  757. D: common_vendor.p({
  758. placeholder: $data.placeholderText,
  759. border: "none",
  760. customStyle: "font-size:24rpx;",
  761. shape: "circle",
  762. color: "#fff",
  763. placeholderStyle: "color:#e7e7e7",
  764. modelValue: $data.value
  765. }),
  766. E: common_vendor.o(($event) => $data.shopping = !$data.shopping),
  767. F: common_vendor.o(($event) => $data.showziliao = !$data.showziliao),
  768. G: common_vendor.o(($event) => $data.showziliao = !$data.showziliao),
  769. H: common_vendor.p({
  770. name: "close",
  771. size: "18"
  772. }),
  773. I: $data.livedata.liveDesc,
  774. J: common_vendor.o($options.closes),
  775. K: common_vendor.p({
  776. show: $data.showziliao,
  777. round: "20",
  778. bgColor: "#fffee1"
  779. }),
  780. L: common_vendor.p({
  781. src: $data.livedata.liveImgUrl,
  782. size: "36"
  783. }),
  784. M: common_assets._imports_1,
  785. N: common_assets._imports_2,
  786. O: common_vendor.o((...args) => $options.onCollect && $options.onCollect(...args)),
  787. P: common_assets._imports_3,
  788. Q: common_vendor.o((...args) => $options.getOrderList && $options.getOrderList(...args)),
  789. R: common_vendor.f($data.products, (item, index, i0) => {
  790. return {
  791. a: item.imgUrl,
  792. b: common_vendor.t(index + 1),
  793. c: common_vendor.t(item.productName),
  794. d: common_vendor.t(item.productIntroduce),
  795. e: common_vendor.t(item.sales),
  796. f: common_vendor.t(Math.trunc(item.price)),
  797. g: common_vendor.t($options.getPureDecimal(item.price) ? $options.getPureDecimal(item.price) : "00"),
  798. h: common_vendor.o(($event) => $options.onCollect(item)),
  799. i: index,
  800. j: "55719d20-7-" + i0 + ",55719d20-6"
  801. };
  802. }),
  803. S: common_vendor.o($options.scrolltolower),
  804. T: common_vendor.p({
  805. height: "350"
  806. }),
  807. U: common_vendor.o($options.closeshop),
  808. V: common_vendor.o($options.open),
  809. W: common_vendor.p({
  810. show: $data.shopping,
  811. round: "20rpx",
  812. bgColor: "#f3f5f9"
  813. })
  814. });
  815. }
  816. var MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-55719d20"], ["__file", "C:/Users/Administrator/Desktop/\u9879\u76EE/\u76F4\u64AD/liveH5-v3/pages/home/living.vue"]]);
  817. wx.createPage(MiniProgramPage);