add.html 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <include file="public@header" />
  2. </head>
  3. <body>
  4. <div class="wrap">
  5. <ul class="nav nav-tabs">
  6. <li ><a href="{:url('Liveing/index')}">直播列表</a></li>
  7. <li class="active"><a >{:lang('ADD')}</a></li>
  8. </ul>
  9. <form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('Liveing/addPost')}">
  10. <div class="form-group">
  11. <label for="input-uid" class="col-sm-2 control-label"><span class="form-required">*</span>用户ID</label>
  12. <div class="col-md-6 col-sm-10">
  13. <input type="text" class="form-control" id="input-uid" name="uid">
  14. </div>
  15. </div>
  16. <div class="form-group" id="liveclass">
  17. <label for="input-type" class="col-sm-2 control-label"><span class="form-required">*</span>直播分类</label>
  18. <div class="col-md-6 col-sm-10">
  19. <select class="form-control" name="liveclassid">
  20. <option value="0">默认分类</option>
  21. <volist name="liveclass" id="v">
  22. <option value="{$key}">{$v}</option>
  23. </volist>
  24. </select>
  25. </div>
  26. </div>
  27. <div class="form-group" id="type">
  28. <label for="input-type" class="col-sm-2 control-label"><span class="form-required">*</span>房间类型</label>
  29. <div class="col-md-6 col-sm-10">
  30. <select class="form-control" name="type" id="cdn">
  31. <volist name="type" id="v">
  32. <option value="{$key}">{$v}</option>
  33. </volist>
  34. </select>
  35. </div>
  36. </div>
  37. <div class="form-group" id="cdn_switch_1" style="display:none;">
  38. <label for="input-type_val" class="col-sm-2 control-label"><span class="form-required">*</span>密码或价格</label>
  39. <div class="col-md-6 col-sm-10">
  40. <input type="text" class="form-control" id="input-type_val" name="type_val">
  41. </div>
  42. </div><br>
  43. <div class="form-group">
  44. <label class="col-sm-2 control-label"></label>
  45. <label class="col-md-6 col-sm-10">
  46. <a href="#" id="getLivePushUrl" >单机一键获取——播流地址、推流地址、TaskId</a>
  47. </label>
  48. </div>
  49. <div class="form-group">
  50. <label for="input-TaskId" class="col-sm-2 control-label"><span class="form-required">*</span>云直播TaskId</label>
  51. <div class="col-md-6 col-sm-10">
  52. <input type="text" class="form-control" id="input-TaskId" name="TaskId" value="">TaskId
  53. </div>
  54. </div>
  55. <div class="form-group">
  56. <label for="input-pull" class="col-sm-2 control-label"><span class="form-required">*</span>播流地址</label>
  57. <div class="col-md-6 col-sm-10">
  58. <input type="text" class="form-control" id="input-pull" name="pull" value="">播流格式:MP4
  59. </div>
  60. </div>
  61. <div class="form-group">
  62. <label for="input-push" class="col-sm-2 control-label"><span class="form-required">*</span>推流地址</label>
  63. <div class="col-md-6 col-sm-10">
  64. <input type="text" class="form-control" id="input-push" name="push" value="">推流格式:MP4
  65. </div>
  66. </div>
  67. <div class="form-group" id="anyway">
  68. <label for="input-words" class="col-sm-2 control-label"><span class="form-required">*</span>视频类型</label>
  69. <div class="col-md-6 col-sm-10">
  70. <select class="form-control" name="anyway">
  71. <option value="0">竖屏</option>
  72. </select>
  73. </div>
  74. </div>
  75. <div class="form-group">
  76. <div class="col-sm-offset-2 col-sm-10">
  77. <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('ADD')}</button>
  78. <a class="btn btn-default" href="{:url('Liveing/index')}">{:lang('BACK')}</a>
  79. </div>
  80. </div>
  81. </form>
  82. </div>
  83. <script src="__STATIC__/js/admin.js"></script>
  84. <script>
  85. (function(){
  86. $("#cdn").on('change',function(){
  87. var v=$(this).val();
  88. var b=$("#cdn_switch_1");
  89. if(v==0){
  90. b.hide();
  91. $("#input-type_val").val('');
  92. }else{
  93. b.show();
  94. }
  95. })
  96. $("#live_type").on('change',function(){
  97. var v=$(this).val();
  98. if(v==0){
  99. $("#liveclass").show();
  100. $("#type").show();
  101. $("#anyway").show();
  102. }else{
  103. $("#liveclass").hide();
  104. $("#type").hide();
  105. $("#anyway").hide();
  106. }
  107. });
  108. // 点击 获取推流地址 ,异步请求接口
  109. $("#getLivePushUrl").on('click', function () {
  110. var uid = $('#input-uid').val();
  111. // 检查值是否为空或者非数字
  112. if (uid === '' || isNaN(uid)) {
  113. alert('请输入正确的UID(数字)');
  114. } else {
  115. // console.log('UID:', uid);
  116. $.ajax({
  117. url: '/admin/liveing/getLivePushUrl.html',
  118. type: 'POST',
  119. data: {
  120. uid: uid,
  121. },
  122. dataType: 'json',
  123. success: function (data) {
  124. $('#input-TaskId').val(data.TaskId);
  125. $('#input-push').val(data.push);
  126. $('#input-pull').val(data.pull);
  127. console.log('请求成功:', data);
  128. },
  129. error: function (error) {
  130. console.error('请求失败:', error);
  131. }
  132. });
  133. }
  134. })
  135. })()
  136. </script>
  137. </body>
  138. </html>