main.js 36 KB

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