main.js 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797
  1. import * as compnt from "../../../../public/js/compnt.js";
  2. import * as unicom from "../../../../public/js/unicom.js";
  3. import "../scss/main.scss";
  4. var ticket = getUrlParam("ticket");
  5. var querys = {};
  6. var control = false;
  7. var impose = 0;
  8. compnt.showLoading();
  9. //alert('开始初始化')
  10. unicom.init().then(function(response) {
  11. compnt.hideLoading();
  12. unicom.product = response.product[0];
  13. unicom.fesname = response.festival;
  14. // alert('页面初始化完成')
  15. findRbtMvs();
  16. bindEvent();
  17. if (location.href.indexOf('/cancel') >= 0) {
  18. unicom.burypointLogId('110002'); // 退订页面pv, pv去重得到uv
  19. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'open', ea: 'cancel_open' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  20. WoAnalytics.addPoint({ ad: $('#directflowactivity').val(), at: $('#namehd').val(), ett: 'open', ea: 'activity_detail_view', cpn: 'activity_detail', pm: parseInt(unicom.query.sou, 32) })
  21. WoAnalytics.addPoint({ ad: $('#directflowactivitys').val(), at: $('#namehds').val(), ett: 'open', ea: 'activity_detail_view', cpn: 'activity_detail', pm: parseInt(unicom.query.sou, 32) })
  22. } else if (location.href.indexOf('/draw') >= 0) {
  23. unicom.burypointLogId('110003'); // 领取页面pv, pv去重得到uv
  24. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'open', ea: 'draw_open' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  25. } else if (location.href.indexOf('/flow') >= 0) {
  26. unicom.burypointLogId('110004'); // 流量查询pv, pv去重得到uv
  27. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'open', ea: 'flow_open' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  28. } else if (location.href.indexOf('/active') >= 0) {
  29. unicom.burypointLogId('110005'); // 激活页面pv, pv去重得到uv
  30. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'open', ea: 'active_open' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  31. } else if (location.href.indexOf('/refund') >= 0) {
  32. unicom.burypointLogId('110006'); // 退款
  33. } else {
  34. unicom.burypointLogId('110001'); // 订购页面pv, pv去重得到uv
  35. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'open', ea: 'order_open' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  36. WoAnalytics.addPoint({ ad: $('#directflowactivity').val(), at: $('#namehd').val(), ett: 'open', ea: 'activity_detail_view', cpn: 'activity_detail', pm: parseInt(unicom.query.sou, 32) })
  37. WoAnalytics.addPoint({ ad: $('#directflowactivitys').val(), at: $('#namehds').val(), ett: 'open', ea: 'activity_detail_view', cpn: 'activity_detail', pm: parseInt(unicom.query.sou, 32) })
  38. }
  39. register()
  40. })
  41. function register() {
  42. if (ticket == null || ticket == '') {
  43. if (navigator.userAgent.toLocaleLowerCase().indexOf('unicom') < 0) {
  44. compnt.showAlert('请在中国联通APP中访问本页面!');
  45. compnt.unlockClick();
  46. return;
  47. } else {
  48. compnt.showAlert('未获取到ticket,请联系管理员!');
  49. compnt.unlockClick();
  50. return;
  51. }
  52. } else {
  53. control = true
  54. unicom.register(ticket).then(function(data) {
  55. switch (data.resultCode) {
  56. case "0000":
  57. querys = data
  58. queryOrdersar(data.userid, data.usermob)
  59. break;
  60. case "1061":
  61. compnt.showAlert('会话已过期,请重新打开此页面!');
  62. impose = 1;
  63. break;
  64. default:
  65. compnt.showAlert(data.errorInfo);
  66. break;
  67. }
  68. });
  69. }
  70. }
  71. function queryOrdersar(userid, mobile) {
  72. compnt.showLoading();
  73. unicom.queryOrder(userid, mobile).then(function(data) {
  74. compnt.hideLoading();
  75. console.log(data)
  76. switch (data.resultCode) {
  77. case "0000": //订购
  78. $(".btn-order").css("display", "none")
  79. $(".btn-order_h").css("display", "none")
  80. $(".btn-channel_a").css("display", "block")
  81. break;
  82. case "0001": //退订
  83. $(".btn-order").css("display", "none")
  84. $(".btn-order_h").css("display", "block")
  85. $(".btn-channel_a").css("display", "none")
  86. $(".btn-order_h").css("filter", "grayscale(100%)")
  87. break;
  88. case "9201":
  89. break;
  90. default:
  91. compnt.showAlert(data.errorInfo);
  92. break;
  93. }
  94. return;
  95. })
  96. }
  97. function bindEvent() {
  98. $('#btn-order').unbind('click').on('click', function() {
  99. if (control == true && impose == 0) {
  100. var usermobsr = querys.usermob.substr(0, 3) + '****' + querys.usermob.substr(7, 4);
  101. var messages = '确认为' + usermobsr + '的号码订购该产品吗?';
  102. showConfirm(messages, function() {
  103. order(querys.userid, querys.usermob, null || unicom.query.ringid);
  104. })
  105. } else {
  106. compnt.showAlert('会话已过期,请重新打开此页面!');
  107. compnt.unlockClick();
  108. }
  109. if (!compnt.lockClick()) {
  110. return;
  111. }
  112. WoAnalytics.addPoint({ ad: $('#directflowactivity').val(), at: $('#namehd').val(), ett: 'click', ea: 'activity_detail_order', pm: parseInt(unicom.query.sou, 32) })
  113. WoAnalytics.addPoint({ ad: $('#directflowactivitys').val(), at: $('#namehds').val(), ett: 'click', ea: 'activity_detail_order', pm: parseInt(unicom.query.sou, 32) })
  114. })
  115. $('#open-agr').unbind('click').on('click', function() {
  116. showDialogAgr();
  117. })
  118. $('#btn-none').unbind('click').on('click', function() {
  119. var usermobsrr = querys.usermob.substr(0, 3) + '****' + querys.usermob.substr(7, 4);
  120. var messagesr = '确认为' + usermobsrr + '的号码退订该产品吗?';
  121. showConfirm(messagesr, function() {
  122. showCancelPages();
  123. })
  124. })
  125. }
  126. function doOrder(ringid) {
  127. unicom.showCapPage().then(function(data) {
  128. compnt.unlockClick();
  129. order(data.userid, data.token, data.usermob, ringid || unicom.query.ringid);
  130. }).fail(function(response) {
  131. compnt.unlockClick();
  132. })
  133. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'order_click_order_btn' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  134. }
  135. function showCancelPages() {
  136. unicom.showCancelReasonPage().done(function(cancelReason) {
  137. console.log(querys)
  138. doShowCancelPagear(cancelReason, querys)
  139. }).fail(function() {
  140. });
  141. }
  142. function doShowCancelPagear(cancelReason, querys) {
  143. compnt.showLoading();
  144. unicom.cancel(querys.userid, querys.usermob, cancelReason.canceltype, cancelReason.cancelmsg).done(function(response) {
  145. compnt.hideLoading();
  146. switch (response.resultCode) {
  147. case "0000":
  148. showAlertDialog('退订成功');
  149. $dialog.close();
  150. $parentDialog.close();
  151. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'cancel_success' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  152. break;
  153. case "7605": //应该是已经退订了吧,因此不需要在重复退订啦
  154. compnt.showAlert(response.errorInfo);
  155. $dialog.close();
  156. $parentDialog.close();
  157. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'cancel_failure' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  158. break;
  159. default:
  160. var prefix = '';
  161. if (response.errorInfo.indexOf('退订失败') < 0) {
  162. prefix = '退订失败,';
  163. }
  164. compnt.showAlert(prefix + response.errorInfo);
  165. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'cancel_failure' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  166. break;
  167. }
  168. }).fail(function(data) {
  169. compnt.hideLoading();
  170. })
  171. }
  172. function showCancelPage($parentDialog) {
  173. $parentDialog && $parentDialog.hide();
  174. unicom.showCancelReasonPage().done(function(cancelReason) {
  175. doShowCancelPage(cancelReason)
  176. }).fail(function() {
  177. });
  178. function doShowCancelPage(cancelReason) {
  179. var $overlay = $('<div class="overlay"></div>');
  180. var $dialog = $(
  181. '<div class="fixed-center sms-form section-login"' +
  182. ' <div class="sms-form">' +
  183. ' <div class="form-group">' +
  184. ' <div class="input-row">' +
  185. ' <input class="usermob" type="tel" maxLength="11" name="phone" placeholder="请输入您的手机号码" />' +
  186. ' </div>' +
  187. ' <div class="input-row">' +
  188. ' <input class="smscode" type="tel" maxLength="6" name="sms" placeholder="请输入验证码">' +
  189. ' <span class="sendcode">获取验证码</span>' +
  190. ' </div>' +
  191. ' </div>' +
  192. ' <div class="actions">' +
  193. ' <div class="btn btn-primary cancel">取消</div>' +
  194. ' <div class="btn btn-info okay">确认</div>' +
  195. ' </div>' +
  196. ' </div>' +
  197. '</div>');
  198. $overlay.appendTo($(document.body))
  199. $dialog.appendTo($(document.body))
  200. $('body').css('overflow', 'hidden')
  201. $dialog.close = function() {
  202. $overlay.remove();
  203. $dialog.remove();
  204. $parentDialog && $parentDialog.show();
  205. $("body").css("overflow", "auto");
  206. }
  207. $dialog.find('.cancel').unbind('click').on('click', function() {
  208. $dialog.close()
  209. })
  210. $dialog.find('.sendcode').unbind('click').on('click', function() {
  211. unicom.sendSms($dialog, 'cancellogin');
  212. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'cancel_click_send_sms_code_btn' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  213. })
  214. $dialog.find('.okay').unbind('click').on('click', function() {
  215. compnt.showLoading();
  216. unicom.checkCode($dialog).done(function() {
  217. compnt.hideLoading();
  218. $dialog.close();
  219. showConfirm('您确定退订视频彩铃包吗?', function() {
  220. doCancel($dialog, $parentDialog, cancelReason)
  221. });
  222. }).fail(function(data) {
  223. compnt.hideLoading();
  224. })
  225. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'cancel_click_confirm_btn' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  226. return $dialog;
  227. });
  228. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'cancel_open' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  229. }
  230. }
  231. function doCancel($dialog, $parentDialog, cancelReason) {
  232. compnt.showLoading();
  233. unicom.cancel(null, null, cancelReason.canceltype, cancelReason.cancelmsg).done(function(response) {
  234. compnt.hideLoading();
  235. switch (response.resultCode) {
  236. case "0000":
  237. showAlertDialog('退订成功');
  238. $dialog.close();
  239. $parentDialog.close();
  240. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'cancel_success' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  241. break;
  242. case "7605": //应该是已经退订了吧,因此不需要在重复退订啦
  243. compnt.showAlert(response.errorInfo);
  244. $dialog.close();
  245. $parentDialog.close();
  246. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'cancel_failure' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  247. break;
  248. default:
  249. var prefix = '';
  250. if (response.errorInfo.indexOf('退订失败') < 0) {
  251. prefix = '退订失败,';
  252. }
  253. compnt.showAlert(prefix + response.errorInfo);
  254. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'cancel_failure' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  255. break;
  256. }
  257. }).fail(function(data) {
  258. compnt.hideLoading();
  259. })
  260. }
  261. function findRbtMvs() {
  262. unicom.findRbtMvs().then(function(data) {
  263. // alert('列表加载完成')
  264. window.rbtMvList = JSON.parse(data).data;
  265. window.rbtMvListLength = JSON.parse(data).data.length;
  266. for (var i = 0; i < window.rbtMvList.length; i++) {
  267. window.rbtMvList[i]['shown'] = '0';
  268. }
  269. showRbtMvs();
  270. }).fail(function(response) {
  271. })
  272. }
  273. function showRbtMvs(label) {
  274. $('#rbt-item-box').empty();
  275. var labelMap = {};
  276. for (var i = 0; i < window.rbtMvList.length; i++) {
  277. if (labelMap[window.rbtMvList[i].label] == null) {
  278. labelMap[window.rbtMvList[i].label] = '其它';
  279. }
  280. }
  281. // 重排序,使热门排在第一个
  282. var labelList = []
  283. $.each(labelMap, function(item, i) {
  284. if (item == '热门') {
  285. labelList[labelList.length] = labelList[0];
  286. labelList[0] = item;
  287. } else {
  288. labelList[labelList.length] = item;
  289. }
  290. })
  291. $.each(labelList, function(i, item) {
  292. var $item = $('<div id="' + item + '" class="item" total="0" showcount="0" oldshowcount="0">' + item + '</div>');
  293. if (label == null && item == '热门') {
  294. $item.addClass('item-active');
  295. label = '热门';
  296. }
  297. $item.on('click', function(event) {
  298. if ($(event.target).hasClass('item-active')) {
  299. return;
  300. }
  301. // 删除以前选择的
  302. $('#rbt-item-box .item-active').removeClass('item-active');
  303. $(event.target).addClass('item-active');
  304. $(event.target).attr("showcount", "0"); //用于翻页
  305. $(event.target).attr("oldshowcount", "0");
  306. $('#rbtmv-container').attr('scrollTop', 0);
  307. $('#rbtmv-content').empty();
  308. for (var i = 0; i < window.rbtMvList.length; i++) {
  309. window.rbtMvList[i]['shown'] = '0';
  310. }
  311. showRbtMvsBody($(event.target).html());
  312. })
  313. for (var i = 0; i < window.rbtMvList.length; i++) {
  314. if (window.rbtMvList[i].label == item) {
  315. var total = $item.attr("total");
  316. $item.attr("total", parseInt(total) + 1);
  317. }
  318. }
  319. $item.appendTo($('#rbt-item-box'));
  320. })
  321. // alert('标题加载完成')
  322. showRbtMvsBody(label);
  323. }
  324. function showRbtMvsBody(label) {
  325. for (var i = 0; i < window.rbtMvList.length; i++) {
  326. if (window.rbtMvList[i].label == label) {
  327. var total = parseInt($('#' + label).attr("total"));
  328. var showcount = parseInt($('#' + label).attr("showcount"));
  329. var oldshowcount = parseInt($('#' + label).attr("oldshowcount"));
  330. if (showcount == oldshowcount + 6) {
  331. $('#' + label).attr("oldshowcount", showcount);
  332. break;
  333. }
  334. if (window.rbtMvList[i]['shown'] == '1') {
  335. continue;
  336. }
  337. $('#' + label).attr("showcount", showcount + 1);
  338. window.rbtMvList[i]['shown'] = '1';
  339. var $item = $(
  340. '<div class="rbt-item">' +
  341. ' <div class="rbt-main" src="' + window.rbtMvList[i].videUrl + '" poster="' + window.rbtMvList[i].coverUrl +
  342. '" contentid="' + window.rbtMvList[i].contentid + '" contentname="' + window.rbtMvList[i].contentname + '">' +
  343. ' <img class="rbt-cover" src="' + window.rbtMvList[i].coverUrl + '">' +
  344. ' <img class="rbt-play" src="v1/images/icon-play.png">' +
  345. ' <div class="btn btn-setting">设为彩铃</div>' +
  346. ' </div>' +
  347. ' <div class="rbt-title">' + window.rbtMvList[i].contentname + '</div>' +
  348. '</div>');
  349. $item.find('.rbt-play').unbind('click').on('click', function(event) {
  350. var videoUrl = $(event.target).parent().attr('src');
  351. var poster = $(event.target).parent().attr('poster');
  352. var ringid = $(event.target).parent().attr('contentid');
  353. var ringname = $(event.target).parent().attr('contentname');
  354. showDialogPreview(videoUrl, ringid, ringname, poster);
  355. });
  356. $item.find('.btn-setting').on('click', function() {
  357. var ringid = $(event.target).parent().attr('contentid');
  358. var ringname = $(event.target).parent().attr('contentname');
  359. setting(ringid, ringname);
  360. });
  361. $item.appendTo($('#rbtmv-content'));
  362. // 已经显示到底了
  363. if (total == showcount + 1) {
  364. var $dom = $('<div class="no-more"><div class="line"></div><div class="title">已经到底啦</div><div class="line"></div></div>')
  365. $dom.appendTo($('#rbtmv-content'))
  366. }
  367. }
  368. }
  369. }
  370. function setting(ringid, ringname) {
  371. if (ringid == null || ringid.trim() == "") {
  372. compnt.showAlert("请选择一个视频彩铃!");
  373. return;
  374. }
  375. queryOrderStatusForSetting(querys.userid, querys.usermob, ringid, ringname);
  376. }
  377. function settingExecutor(ringid, ringname) {
  378. var usermob = querys.usermob.substr(0, 3) + '****' + querys.usermob.substr(7, 4);
  379. var message = '确认设置“' + ringname + '” 为' + usermob + '的视频彩铃吗?';
  380. showConfirm(message, function() {
  381. compnt.showLoading();
  382. unicom.setting(ringid, querys.userid).done(function(data) {
  383. compnt.hideLoading();
  384. if (data.resultCode == "0000") {
  385. showAlertDialog('设置成功')
  386. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'draw_success' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  387. } else {
  388. compnt.showAlert(data.errorInfo);
  389. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'draw_failure' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  390. }
  391. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'draw_click_confirm_btn' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
  392. });
  393. })
  394. }
  395. function queryOrderStatusForSetting(userid, mobile, ringid, ringname) {
  396. unicom.loadUserInfo();
  397. // if (unicom.user != null && unicom.user.userid != null && (
  398. // unicom.user.orderStatus == "0000" ||
  399. // unicom.user.orderStatus == "0001")) {
  400. // settingExecutor(ringid, ringname);
  401. // return;
  402. // }
  403. compnt.showLoading();
  404. unicom.queryOrder(userid, mobile).then(function(data) {
  405. compnt.hideLoading();
  406. switch (data.resultCode) {
  407. case "0000": //订购
  408. case "0001": //退订
  409. if (unicom.user != null && unicom.user.userid != null) {
  410. unicom.user.orderStatus = data.resultCode;
  411. unicom.saveUserInfo();
  412. }
  413. if (userid) {
  414. settingExecutor(ringid, ringname)
  415. } else {
  416. compnt.showAlert("会话已过期,请重新打开此页面!");
  417. }
  418. break;
  419. case "9201":
  420. compnt.showAlert("您未订购视频彩铃包产品!");
  421. break;
  422. default:
  423. compnt.showAlert(data.errorInfo);
  424. break;
  425. }
  426. return;
  427. })
  428. }
  429. function showDialogPreview(videUrl, ringid, ringname, poster) {
  430. var $dialog = $(
  431. '<div class="section-preview">' +
  432. ' <div class="content">' +
  433. ' <div class="close"><span>《</span>返回</div>' +
  434. ' <video src="' + videUrl + '" poster="' + poster + '"></video>' +
  435. ' <div class="play"></div>' +
  436. ' <div class="dail"></div>' +
  437. ' <div class="setting">设为视频彩铃</div>' +
  438. ' <a class="must-know" href="https://m.10155.com/h5/mactivity/terminal.html">设置须知</a>' +
  439. ' </div>' +
  440. '</div>');
  441. $dialog.appendTo($(document.body))
  442. $dialog.close = function() {
  443. $dialog.remove();
  444. }
  445. var $video = $dialog.find('video');
  446. var $playIcon = $dialog.find('.play');
  447. $video.on('play', function() {
  448. $playIcon.css('display', 'none')
  449. });
  450. $video.on('pause', function() {
  451. $playIcon.css('display', 'block')
  452. });
  453. $video.on('ended', function() {
  454. $playIcon.css('display', 'block')
  455. });
  456. $video.on('click', function() {
  457. if ($video.prop('paused')) {
  458. $video[0].play();
  459. } else {
  460. $video[0].pause();
  461. }
  462. });
  463. $playIcon.on('click', function() {
  464. $video[0].play()
  465. });
  466. $dialog.find('.setting').on('click', function() {
  467. setting(ringid, ringname, $dialog);
  468. })
  469. $dialog.find('.close').on('click', function() {
  470. $dialog.close();
  471. })
  472. return $dialog;
  473. }
  474. function showDialogAgr() {
  475. var $overlay = $('<div class="overlay"></div>');
  476. var $dialog = $(
  477. '<div id="section-agr" class="section-agr">' +
  478. ' <div class="agr-title">' +
  479. ' <div class="close"></div>' +
  480. ' </div>' +
  481. ' <div class="agr-content">' +
  482. ' <div class="title">活动说明</div>' +
  483. ' <div class="content">' +
  484. ' <ul>' +
  485. ' <li>1.活动时间:2023年3月17日-2023年4月30日;</li>' +
  486. ' <li>2.活动期间订购本产品且当月未退订的正常缴费用户,将返还5元话费,返还话费将于10个工作日内充值至订购手机号码(联通预付费用户,不参与此次赠送话费活动);</li>' +
  487. ' <li>3.每位用户活动期仅可参加一次本活动。</li>' +
  488. ' </ul>' +
  489. ' </div>' +
  490. ' <div class="title">业务说明</div>' +
  491. ' <div class="content">' +
  492. ' <ul>' +
  493. ' <li>1.该产品资费15元/月,包含15GB专属定向流量及抖音视频彩铃服务,按自然月扣费,次月自动续订;</li>' +
  494. ' <li>2.符合订购约定的中国联通手机4G、5G套餐(除智慧沃家等部分融合套餐)用户均可订购“抖音视频彩铃定向流量月包(标准版)”。手机套餐中流量资费、流量使用规则另有约定的,按照手机套餐执行;</li>' +
  495. ' <li>3.该产品中的抖音视频彩铃仅支持适配终端使用,适配手机终端型号可在温馨提示的视频彩铃说明中查看;</li>' +
  496. ' <li>4.达量限速套餐用户订购当前定向流量产品,包内定向流量不提升原套餐限速阈值和网速,不能作为限速后解限的加速包使用,依然执行基础套餐限速阈值的约定;</li>' +
  497. ' <li>5.该产品内定向流量仅限当月使用,未使用部分不能延续、累加至次月及以后各月使用,且服从中国联通套餐流量封顶统一限制;</li>' +
  498. ' <li>6.请使用手机默认3GNET接入点访问本产品(如需修改请在手机设置-移动网络-接入点APN内更改);</li>' +
  499. ' <li>7.该活动所返还的话费,可支持用户购买其他增值产品;</li>' +
  500. ' <li>8.关于产品使用过程中有任何疑问可咨询联通客服:10010;</li>' +
  501. ' <li>9.对我们有任何意见和建议,点此<a href="https://account.bol.wo.cn/v2/feedback?clientId=directflow2021073001" style="color: #266cd6">反馈</a>。</li>' +
  502. ' </ul>' +
  503. ' </div>' +
  504. ' <div class="title">流量说明</div>' +
  505. ' <div class="content">' +
  506. ' <ul>' +
  507. ' <li>1.定向流量适用范围包含:抖音短视频、今日头条、西瓜视频、火山小视频、多闪、懂车帝、图虫、皮皮虾、海豚股票、海豚财富、gogokid、轻颜、好好学习、飞聊、时光相册、半次元、飞书、激萌、番茄畅听APP使用;</li>' +
  508. ' <li>2.定向流量包适用范围不包含:发起直播及上传视频产生的流量;第三方提供的广告、视频、图片产生的流量;下载、缓存客户端及第三方链接视频产生的流量;使用抖音系产品拍摄上传功能,上传分享至抖音系外部应用产生的流量;视频聊天、语音聊天产生的流量;</li>' +
  509. ' <li>3.如您是头条相关互联网卡套餐用户,如蚂蚁宝卡、阿里宝卡、钉钉宝卡或工商银行e卡等,将优先使用套餐内的专属定向流量,用罄后即消耗该产品包内的定向流量。</li> ' +
  510. ' </ul>' +
  511. ' </div>' +
  512. ' <div class="title">视频彩铃说明</div>' +
  513. ' <div class="content">' +
  514. ' <ul>' +
  515. ' <li>1.中国联通手机4G、5G套餐用户(其中5G腾讯王卡用户入网第三个月起)可以享受抖音视频彩铃服务;</li>' +
  516. ' <li>2.部分省分4G/5G联通用户如有一号多端IVPN服务,则不支持视频彩铃功能开通,即不支持视频彩铃业务使用;目前已有24个省分已支持一号多端IVPN服务同时使用视频彩铃业务,包括河南、湖北、浙江、四川、海南、河北、山东、山西、上海、江苏、福建、北京、江西、辽宁、吉林、内蒙古、广东、天津、湖南、贵州、陕西、广西、黑龙江、西藏;</li>' +
  517. ' <li>3.订购该产品用户可通过抖音APP客户端进入视频彩铃专区,享受任意设置视频彩铃服务,同时可通过页面进行彩铃DIY;</li>' +
  518. ' <li>4.成功设置视频彩铃后,其他人拨打已订购该产品的设备电话时,Ta就能看到已设置的视频;</li>' +
  519. ' <li>5.成功设置视频彩铃后,他人来电时看到已订购该产品设备的视频彩铃有2个条件:①Ta的终端支持播放中国联通视频彩铃;②Ta开通了VoLTE网络并拨打您电话时处于VoLTE网络下,手机信号显示HD或5G(编辑短信“DGVOLTE”至10010免费开通);注:仅支持联通用户间拨打观看;</li>' +
  520. ' <li>6.手机终端型号支持拨打呈现视频彩铃适用机型可通过关注“沃音乐”微信公众号发送“终端”进行查询或点击链接<a style="margin-left: -0.2rem;" href="https://m.10155.com/h5/mactivity/terminal.html">https://m.10155.com/h5/mactivity/terminal.html</a>了解适配机型。</li>' +
  521. ' </ul>' +
  522. ' </div>' +
  523. ' </div>' +
  524. '</div>');
  525. $overlay.appendTo($(document.body))
  526. $dialog.appendTo($(document.body))
  527. $('body').css('overflow', 'hidden')
  528. $dialog.close = function() {
  529. $overlay.remove();
  530. $dialog.remove();
  531. $("body").css("overflow", "auto");
  532. }
  533. $dialog.hide = function() {
  534. $overlay.css('display', 'none');
  535. $dialog.css('display', 'none');
  536. }
  537. $dialog.show = function() {
  538. $overlay.css('display', 'block');
  539. $dialog.css('display', 'block');
  540. }
  541. $dialog.find('.close').unbind('click').on('click', function() {
  542. $dialog.close()
  543. })
  544. $dialog.find('.cancel').unbind('click').on('click', function() {
  545. $dialog.close();
  546. showCancelPage($dialog)
  547. })
  548. return $dialog;
  549. }
  550. function showAlertDialog(message) {
  551. var $overlay = $('<div class="overlay"></div>');
  552. var $dialog = $(
  553. '<div class="fixed-center section-setting section-alert">' +
  554. ' <div class="content">' +
  555. ' <div class="status">' +
  556. ' <span class="status-name">' + message + '</span>' +
  557. ' <div class="status-icon"></div>' +
  558. ' </div>' +
  559. ' </div>' +
  560. ' <div class="actions">' +
  561. ' <div class="btn btn-lg btn-primary">知道了</div>' +
  562. ' </div>' +
  563. '</div>');
  564. $overlay.appendTo($(document.body))
  565. $dialog.appendTo($(document.body))
  566. $dialog.find('.btn').unbind('click').on('click', function() {
  567. queryOrdersar(querys.userid, querys.usermob)
  568. $dialog.close()
  569. })
  570. $dialog.close = function() {
  571. $overlay.remove();
  572. $dialog.remove();
  573. $dialog = null;
  574. $('body').css('overflow', 'auto')
  575. }
  576. $('body').css('overflow', 'hidden')
  577. return $dialog;
  578. }
  579. function showConfirm(message, handler, cancelLabel, okayLabel) {
  580. var $overlay = $('<div class="overlay"></div>');
  581. var $dialog = $(
  582. '<div class="fixed-center section-message">' +
  583. ' <div class="content">' + message + '</div>' +
  584. ' <div class="actions">' +
  585. ' <div class="btn close btn-primary">' + (cancelLabel || "取消") + '</div>' +
  586. ' <div class="btn okay btn-info">' + (okayLabel || '确认') + '</div>' +
  587. ' </div>' +
  588. '</div>');
  589. $overlay.appendTo($(document.body))
  590. $dialog.appendTo($(document.body))
  591. $dialog.find('.close').unbind('click').on('click', function() {
  592. $dialog.close()
  593. })
  594. $dialog.find('.okay').unbind('click').on('click', function() {
  595. handler && handler();
  596. $dialog.close();
  597. })
  598. $dialog.close = function() {
  599. $overlay.remove();
  600. $dialog.remove();
  601. $dialog = null;
  602. }
  603. return $dialog;
  604. }
  605. /**
  606. * 订购
  607. */
  608. function order(userid, usermob, ringid) {
  609. compnt.showLoading('处理中,请稍后...');
  610. unicom.usermob(userid, usermob, ringid).done(function(response) {
  611. compnt.hideLoading();
  612. switch (response.resultCode) {
  613. case "0000": //订购成功!跳转到领取会员页面
  614. unicom.saveUserInfo();
  615. showAlertDialog('订购成功');
  616. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'order_success' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) });
  617. WoAnalytics.addPoint({ ad: $('#directflowactivity').val(), at: $('#namehd').val(), ett: 'open', ea: 'pay_result_success', cpn: 'pay_result', pm: parseInt(unicom.query.sou, 32), mp: unicom.user.usermob })
  618. WoAnalytics.addPoint({ ad: $('#directflowactivitys').val(), at: $('#namehds').val(), ett: 'open', ea: 'pay_result_success', cpn: 'pay_result', pm: parseInt(unicom.query.sou, 32), mp: unicom.user.usermob })
  619. return;
  620. case "0013":
  621. compnt.showAlert('该号码归属省分2/3G暂未开通此产品!');
  622. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'order_failure' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) });
  623. WoAnalytics.addPoint({ ad: $('#directflowactivity').val(), at: $('#namehd').val(), ett: 'open', ea: 'pay_result_failure', cpn: 'pay_result', pm: parseInt(unicom.query.sou, 32), mp: unicom.user.usermob })
  624. WoAnalytics.addPoint({ ad: $('#directflowactivitys').val(), at: $('#namehds').val(), ett: 'open', ea: 'pay_result_failure', cpn: 'pay_result', pm: parseInt(unicom.query.sou, 32), mp: unicom.user.usermob })
  625. break;
  626. case "6611":
  627. compnt.showAlert('错误代码(6611),订购失败,请重试!');
  628. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'order_failure' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) });
  629. WoAnalytics.addPoint({ ad: $('#directflowactivity').val(), at: $('#namehd').val(), ett: 'open', ea: 'pay_result_failure', cpn: 'pay_result', pm: parseInt(unicom.query.sou, 32), mp: unicom.user.usermob })
  630. WoAnalytics.addPoint({ ad: $('#directflowactivitys').val(), at: $('#namehds').val(), ett: 'open', ea: 'pay_result_failure', cpn: 'pay_result', pm: parseInt(unicom.query.sou, 32), mp: unicom.user.usermob })
  631. break;
  632. case "6615":
  633. compnt.showAlert('订购失败,请确定用户套餐!');
  634. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'order_failure' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) });
  635. WoAnalytics.addPoint({ ad: $('#directflowactivity').val(), at: $('#namehd').val(), ett: 'open', ea: 'pay_result_failure', cpn: 'pay_result', pm: parseInt(unicom.query.sou, 32), mp: unicom.user.usermob })
  636. WoAnalytics.addPoint({ ad: $('#directflowactivitys').val(), at: $('#namehds').val(), ett: 'open', ea: 'pay_result_failure', cpn: 'pay_result', pm: parseInt(unicom.query.sou, 32), mp: unicom.user.usermob })
  637. break;
  638. case "6622": // 用户已订购过此产品!跳转到流量查页面
  639. // localStorage.setItem('message', '您已经订购了本产品~');
  640. compnt.showAlert('您已经订购了本产品~')
  641. unicom.saveUserInfo();
  642. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'order_failure' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) });
  643. WoAnalytics.addPoint({ ad: $('#directflowactivity').val(), at: $('#namehd').val(), ett: 'open', ea: 'pay_result_failure', cpn: 'pay_result', pm: parseInt(unicom.query.sou, 32), mp: unicom.user.usermob })
  644. WoAnalytics.addPoint({ ad: $('#directflowactivitys').val(), at: $('#namehds').val(), ett: 'open', ea: 'pay_result_failure', cpn: 'pay_result', pm: parseInt(unicom.query.sou, 32), mp: unicom.user.usermob })
  645. break;
  646. case "5015": // 用户已订购过此产品!跳转到流量查页面
  647. // localStorage.setItem('message', '您已经订购了本产品~');
  648. compnt.showAlert('会话已过期,请重新打开此页面!')
  649. unicom.saveUserInfo();
  650. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'order_failure' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) });
  651. WoAnalytics.addPoint({ ad: $('#directflowactivity').val(), at: $('#namehd').val(), ett: 'open', ea: 'pay_result_failure', cpn: 'pay_result', pm: parseInt(unicom.query.sou, 32), mp: unicom.user.usermob })
  652. WoAnalytics.addPoint({ ad: $('#directflowactivitys').val(), at: $('#namehds').val(), ett: 'open', ea: 'pay_result_failure', cpn: 'pay_result', pm: parseInt(unicom.query.sou, 32), mp: unicom.user.usermob })
  653. break;
  654. default:
  655. compnt.showAlert(response.errorInfo + ',订购失败,请确定用户套餐!');
  656. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'order_failure' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) });
  657. WoAnalytics.addPoint({ ad: $('#directflowactivity').val(), at: $('#namehd').val(), ett: 'open', ea: 'pay_result_failure', cpn: 'pay_result', pm: parseInt(unicom.query.sou, 32), mp: unicom.user.usermob })
  658. WoAnalytics.addPoint({ ad: $('#directflowactivitys').val(), at: $('#namehds').val(), ett: 'open', ea: 'pay_result_failure', cpn: 'pay_result', pm: parseInt(unicom.query.sou, 32), mp: unicom.user.usermob })
  659. break;
  660. }
  661. }).fail(function(error) {
  662. compnt.hideLoading();
  663. console.log(error);
  664. });
  665. }
  666. $('#rbtmv-container').on('touchmove', function(event) {
  667. if ($('#rbtmv-content').height() + $('#rbtmv-content').scrollTop() >= $('#rbtmv-container').height()) {
  668. showRbtMvsBody($('.item-active')[0].id);
  669. }
  670. })
  671. $('#rbtmv-container').on('touchstart', function(event) {
  672. if ($('#rbtmv-content').height() + $('#rbtmv-content').scrollTop() >= $('#rbtmv-container').height()) {
  673. showRbtMvsBody($('.item-active')[0].id);
  674. }
  675. })
  676. var t1 = 0;
  677. var t2 = 0;
  678. let timer = null;
  679. $('#rbtmv-content').on('scroll', function(event) {
  680. clearTimeout(timer)
  681. timer = setTimeout(isScrollEnd, 100)
  682. t1 = $('#rbtmv-content').scrollTop()
  683. })
  684. function isScrollEnd() {
  685. t2 = $('#rbtmv-content').scrollTop();
  686. if (t2 == t1) {
  687. clearTimeout(timer)
  688. if ($('#rbtmv-content').height() + $('#rbtmv-content').scrollTop() >= $('#rbtmv-container').height() - 200) {
  689. showRbtMvsBody();
  690. }
  691. }
  692. }
  693. function getUrlParam(urlprm) {
  694. var reg = new RegExp("(^|&)" + urlprm + "=([^&]*)(&|$)");
  695. var r = window.location.search.substr(1).match(reg);
  696. if (r != null) {
  697. return r[2];
  698. }
  699. }