mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-07-03 23:46:49 +08:00
layui还是有很多问题的,绕开先
This commit is contained in:
parent
b374309c1f
commit
c7cc2210fb
@ -4,6 +4,7 @@ namespace App\Http\Web\Controllers;
|
||||
|
||||
use App\Http\Web\Services\Live as LiveService;
|
||||
use App\Traits\Response as ResponseTrait;
|
||||
use Phalcon\Mvc\View;
|
||||
|
||||
/**
|
||||
* @RoutePrefix("/live")
|
||||
@ -18,33 +19,21 @@ class LiveController extends \Phalcon\Mvc\Controller
|
||||
*/
|
||||
public function membersAction($id)
|
||||
{
|
||||
$list = [
|
||||
[
|
||||
'username' => '直飞机',
|
||||
'avatar' => 'http://tp1.sinaimg.cn/5619439268/180/40030060651/1',
|
||||
'status' => 'online',
|
||||
'sign' => '高舍炮打的准',
|
||||
'id' => 1,
|
||||
],
|
||||
[
|
||||
'username' => '直飞机2',
|
||||
'avatar' => 'http://tp1.sinaimg.cn/5619439268/180/40030060651/1',
|
||||
'status' => 'online',
|
||||
'sign' => '高舍炮打的准',
|
||||
'id' => 2,
|
||||
],
|
||||
[
|
||||
'username' => '直飞机3',
|
||||
'avatar' => 'http://tp1.sinaimg.cn/5619439268/180/40030060651/1',
|
||||
'status' => 'online',
|
||||
'sign' => '高舍炮打的准',
|
||||
'id' => 3,
|
||||
],
|
||||
];
|
||||
return $this->jsonSuccess();
|
||||
}
|
||||
|
||||
$content = ['data' => ['list' => $list]];
|
||||
/**
|
||||
* @Get("/{id:[0-9]+}/stats", name="web.live.stats")
|
||||
*/
|
||||
public function statsAction($id)
|
||||
{
|
||||
$service = new LiveService();
|
||||
|
||||
return $this->jsonSuccess($content);
|
||||
$stats = $service->getStats($id);
|
||||
|
||||
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
||||
$this->view->pick('chapter/live_stats');
|
||||
$this->view->setVar('stats', $stats);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2,26 +2,18 @@
|
||||
|
||||
namespace App\Http\Web\Controllers;
|
||||
|
||||
use App\Http\Web\Services\Index as IndexService;
|
||||
|
||||
/**
|
||||
* @RoutePrefix("/im")
|
||||
*/
|
||||
class MessengerController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* @Get("/", name="web.index")
|
||||
* @Get("/init", name="web.index")
|
||||
*/
|
||||
public function indexAction()
|
||||
public function initAction()
|
||||
{
|
||||
$this->siteSeo->setKeywords($this->siteSettings['keywords']);
|
||||
$this->siteSeo->setDescription($this->siteSettings['description']);
|
||||
|
||||
$indexService = new IndexService();
|
||||
|
||||
$this->view->setVar('slides', $indexService->getSlides());
|
||||
$this->view->setVar('lives', $indexService->getLives());
|
||||
$this->view->setVar('new_courses', $indexService->getNewCourses());
|
||||
$this->view->setVar('free_courses', $indexService->getFreeCourses());
|
||||
$this->view->setVar('vip_courses', $indexService->getVipCourses());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,8 @@ class TeacherController extends Controller
|
||||
*/
|
||||
public function listAction()
|
||||
{
|
||||
$_REQUEST['limit'] = 12;
|
||||
|
||||
$service = new TeacherListService();
|
||||
|
||||
$pager = $service->handle();
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Web\Services;
|
||||
|
||||
use App\Repos\User as UserRepo;
|
||||
use App\Services\Frontend\ChapterTrait;
|
||||
use GatewayClient\Gateway;
|
||||
|
||||
@ -10,21 +11,44 @@ class Live extends Service
|
||||
|
||||
use ChapterTrait;
|
||||
|
||||
public function bindUser($id)
|
||||
public function getStats($id)
|
||||
{
|
||||
$chapter = $this->checkChapterCache($id);
|
||||
|
||||
$user = $this->getCurrentUser();
|
||||
Gateway::$registerAddress = '127.0.0.1:1238';
|
||||
|
||||
$userId = $user->id > 0 ?: $this->session->getId();
|
||||
$groupName = $this->getGroupName($chapter->id);
|
||||
|
||||
$clientCount = Gateway::getClientIdCountByGroup($groupName);
|
||||
$userCount = Gateway::getUidCountByGroup($groupName);
|
||||
$guestCount = $clientCount - $userCount;
|
||||
|
||||
$userIds = Gateway::getUidListByGroup($groupName);
|
||||
|
||||
$users = $this->handleUsers($userIds);
|
||||
|
||||
return [
|
||||
'user_count' => $userCount,
|
||||
'guest_count' => $guestCount,
|
||||
'users' => $users,
|
||||
];
|
||||
}
|
||||
|
||||
public function bindUser($id)
|
||||
{
|
||||
$clientId = $this->request->getPost('client_id');
|
||||
|
||||
$chapter = $this->checkChapterCache($id);
|
||||
|
||||
$user = $this->getCurrentUser();
|
||||
|
||||
$groupName = $this->getGroupName($chapter->id);
|
||||
|
||||
Gateway::$registerAddress = '127.0.0.1:1238';
|
||||
|
||||
Gateway::bindUid($clientId, $userId);
|
||||
if ($user->id > 0) {
|
||||
Gateway::bindUid($clientId, $user->id);
|
||||
}
|
||||
|
||||
Gateway::joinGroup($clientId, $groupName);
|
||||
}
|
||||
@ -33,9 +57,21 @@ class Live extends Service
|
||||
{
|
||||
$chapter = $this->checkChapterCache($id);
|
||||
|
||||
$user = $this->getLoginUser();
|
||||
|
||||
$from = $this->request->getPost('from');
|
||||
$to = $this->request->getPost('to');
|
||||
|
||||
Gateway::$registerAddress = '127.0.0.1:1238';
|
||||
|
||||
$groupName = $this->getGroupName($chapter->id);
|
||||
|
||||
$excludeClientId = null;
|
||||
|
||||
if ($user->id == $from['id']) {
|
||||
$excludeClientId = Gateway::getClientIdByUid($user->id);
|
||||
}
|
||||
|
||||
$content = [
|
||||
'username' => $from['username'],
|
||||
'avatar' => $from['avatar'],
|
||||
@ -52,11 +88,36 @@ class Live extends Service
|
||||
'content' => $content,
|
||||
]);
|
||||
|
||||
$groupName = $this->getGroupName($chapter->id);
|
||||
|
||||
Gateway::$registerAddress = '127.0.0.1:1238';
|
||||
Gateway::sendToGroup($groupName, $message, $excludeClientId);
|
||||
}
|
||||
|
||||
Gateway::sendToGroup($groupName, $message);
|
||||
protected function handleUsers($userIds)
|
||||
{
|
||||
if (!$userIds) return [];
|
||||
|
||||
$userRepo = new UserRepo();
|
||||
|
||||
$users = $userRepo->findByIds($userIds);
|
||||
|
||||
$baseUrl = kg_ci_base_url();
|
||||
|
||||
$result = [];
|
||||
|
||||
foreach ($users->toArray() as $key => $user) {
|
||||
|
||||
$user['avatar'] = $baseUrl . $user['avatar'];
|
||||
|
||||
$result[] = [
|
||||
'id' => $user['id'],
|
||||
'name' => $user['name'],
|
||||
'title' => $user['title'],
|
||||
'vip' => $user['vip'],
|
||||
'avatar' => $user['avatar'],
|
||||
];
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function getGroupName($groupId)
|
||||
|
65
app/Http/Web/Services/Messenger.php
Normal file
65
app/Http/Web/Services/Messenger.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Web\Services;
|
||||
|
||||
use App\Services\Frontend\ChapterTrait;
|
||||
use GatewayClient\Gateway;
|
||||
|
||||
class Messenger extends Service
|
||||
{
|
||||
|
||||
use ChapterTrait;
|
||||
|
||||
public function bindUser($id)
|
||||
{
|
||||
$user = $this->getCurrentUser();
|
||||
|
||||
$userId = $user->id > 0 ?: $this->session->getId();
|
||||
|
||||
$clientId = $this->request->getPost('client_id');
|
||||
|
||||
$groupName = $this->getGroupName($id);
|
||||
|
||||
Gateway::$registerAddress = '127.0.0.1:1238';
|
||||
|
||||
Gateway::bindUid($clientId, $userId);
|
||||
|
||||
Gateway::joinGroup($clientId, $groupName);
|
||||
}
|
||||
|
||||
public function sendMessage($id)
|
||||
{
|
||||
$chapter = $this->checkChapterCache($id);
|
||||
|
||||
$from = $this->request->getPost('from');
|
||||
$to = $this->request->getPost('to');
|
||||
|
||||
$content = [
|
||||
'username' => $from['username'],
|
||||
'avatar' => $from['avatar'],
|
||||
'content' => $from['content'],
|
||||
'fromid' => $from['id'],
|
||||
'id' => $to['id'],
|
||||
'type' => $to['type'],
|
||||
'timestamp' => 1000 * time(),
|
||||
'mine' => false,
|
||||
];
|
||||
|
||||
$message = json_encode([
|
||||
'type' => 'show_message',
|
||||
'content' => $content,
|
||||
]);
|
||||
|
||||
$groupName = $this->getGroupName($chapter->id);
|
||||
|
||||
Gateway::$registerAddress = '127.0.0.1:1238';
|
||||
|
||||
Gateway::sendToGroup($groupName, $message);
|
||||
}
|
||||
|
||||
protected function getGroupName($groupId)
|
||||
{
|
||||
return "group_{$groupId}";
|
||||
}
|
||||
|
||||
}
|
17
app/Http/Web/Views/chapter/live_stats.volt
Normal file
17
app/Http/Web/Views/chapter/live_stats.volt
Normal file
@ -0,0 +1,17 @@
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">在线成员</div>
|
||||
<div class="layui-card-body live-stats">
|
||||
<div class="stats">
|
||||
用户:<span class="count">{{ stats.user_count }}</span>
|
||||
游客:<span class="count">{{ stats.guest_count }}</span>
|
||||
</div>
|
||||
<div class="live-user-list">
|
||||
{% for user in stats.users %}
|
||||
{% set vip_flag = user.vip ? '<span class="layui-badge">vip</span>' : '' %}
|
||||
<div class="live-user-card">
|
||||
<div class="name">{{ user.name }} {{ vip_flag }}</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -9,8 +9,15 @@
|
||||
<a><cite>{{ chapter.title }}</cite></a>
|
||||
</div>
|
||||
|
||||
<div class="live-player container">
|
||||
<div id="player"></div>
|
||||
<div class="layout-main">
|
||||
<div class="layout-content">
|
||||
<div class="live-player container">
|
||||
<div id="player"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layout-sidebar">
|
||||
<div id="sidebar-live-stats" data-url="{{ url({'for':'web.live.stats','id':chapter.id}) }}"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-hide">
|
||||
@ -40,4 +47,17 @@
|
||||
|
||||
{% block inline_js %}
|
||||
|
||||
<script>
|
||||
|
||||
refreshLiveStats();
|
||||
|
||||
setInterval('refreshLiveStats()', 60000);
|
||||
|
||||
function refreshLiveStats() {
|
||||
var $liveStats = $('#sidebar-live-stats');
|
||||
helper.ajaxLoadHtml($liveStats.attr('data-url'), $liveStats.attr('id'));
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
@ -32,35 +32,35 @@
|
||||
<li class="layui-this">详情</li>
|
||||
<li>目录</li>
|
||||
{% if show_tab_packages == 1 %}
|
||||
<li>套餐</li>
|
||||
{% endif %}
|
||||
{% if show_tab_consults == 1 %}
|
||||
<li>咨询</li>
|
||||
{% endif %}
|
||||
{% if show_tab_reviews == 1 %}
|
||||
<li>评价</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
<div class="layui-tab-content">
|
||||
<div class="layui-tab-item layui-show">
|
||||
<div class="course-details">{{ course.details }}</div>
|
||||
<li>套餐</li>
|
||||
{% endif %}
|
||||
{% if show_tab_consults == 1 %}
|
||||
<li>咨询</li>
|
||||
{% endif %}
|
||||
{% if show_tab_reviews == 1 %}
|
||||
<li>评价</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
<div class="layui-tab-content">
|
||||
<div class="layui-tab-item layui-show">
|
||||
<div class="course-details">{{ course.details }}</div>
|
||||
</div>
|
||||
<div class="layui-tab-item">
|
||||
{{ partial('course/chapters') }}
|
||||
</div>
|
||||
{% if show_tab_packages == 1 %}
|
||||
{% set packages_url = url({'for':'web.course.packages','id':course.id}) %}
|
||||
<div class="layui-tab-item" id="tab-packages" data-url="{{ packages_url }}"></div>
|
||||
{% endif %}
|
||||
{% if show_tab_consults == 1 %}
|
||||
{% set consults_url = url({'for':'web.course.consults','id':course.id}) %}
|
||||
<div class="layui-tab-item" id="tab-consults" data-url="{{ consults_url }}"></div>
|
||||
{% endif %}
|
||||
{% if show_tab_reviews == 1 %}
|
||||
{% set reviews_url = url({'for':'web.course.reviews','id':course.id}) %}
|
||||
<div class="layui-tab-item" id="tab-reviews" data-url="{{ reviews_url }}"></div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="layui-tab-item">
|
||||
{{ partial('course/chapters') }}
|
||||
</div>
|
||||
{% if show_tab_packages == 1 %}
|
||||
{% set packages_url = url({'for':'web.course.packages','id':course.id}) %}
|
||||
<div class="layui-tab-item" id="tab-packages" data-url="{{ packages_url }}"></div>
|
||||
{% endif %}
|
||||
{% if show_tab_consults == 1 %}
|
||||
{% set consults_url = url({'for':'web.course.consults','id':course.id}) %}
|
||||
<div class="layui-tab-item" id="tab-consults" data-url="{{ consults_url }}"></div>
|
||||
{% endif %}
|
||||
{% if show_tab_reviews == 1 %}
|
||||
{% set reviews_url = url({'for':'web.course.reviews','id':course.id}) %}
|
||||
<div class="layui-tab-item" id="tab-reviews" data-url="{{ reviews_url }}"></div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -91,33 +91,8 @@
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block inline_js %}
|
||||
{% block include_js %}
|
||||
|
||||
<script>
|
||||
if ($('#tab-packages').length > 0) {
|
||||
var $tabPackages = $('#tab-packages');
|
||||
helper.ajaxLoadHtml($tabPackages.attr('data-url'), $tabPackages.attr('id'));
|
||||
}
|
||||
if ($('#tab-consults').length > 0) {
|
||||
var $tabConsults = $('#tab-consults');
|
||||
helper.ajaxLoadHtml($tabConsults.attr('data-url'), $tabConsults.attr('id'));
|
||||
}
|
||||
if ($('#tab-reviews').length > 0) {
|
||||
var $tabReviews = $('#tab-reviews');
|
||||
helper.ajaxLoadHtml($tabReviews.attr('data-url'), $tabReviews.attr('id'));
|
||||
}
|
||||
if ($('#sidebar-topics').length > 0) {
|
||||
var $sdTopics = $('#sidebar-topics');
|
||||
helper.ajaxLoadHtml($sdTopics.attr('data-url'), $sdTopics.attr('id'));
|
||||
}
|
||||
if ($('#sidebar-recommended').length > 0) {
|
||||
var $sdRecommended = $('#sidebar-recommended');
|
||||
helper.ajaxLoadHtml($sdRecommended.attr('data-url'), $sdRecommended.attr('id'));
|
||||
}
|
||||
if ($('#sidebar-related').length > 0) {
|
||||
var $sdRelated = $('#sidebar-related');
|
||||
helper.ajaxLoadHtml($sdRelated.attr('data-url'), $sdRelated.attr('id'));
|
||||
}
|
||||
</script>
|
||||
{{ js_include('web/js/course.show.js') }}
|
||||
|
||||
{% endblock %}
|
@ -28,30 +28,32 @@
|
||||
<img src="{{ course.cover }}!cover_270" alt="{{ course.title|e }}" title="{{ course.title|e }}">
|
||||
</a>
|
||||
</div>
|
||||
<div class="title layui-elip">
|
||||
<a href="{{ course_url }}" title="{{ course.title|e }}">{{ course.title }}</a>
|
||||
</div>
|
||||
<div class="meta">
|
||||
{% if course.market_price > course.vip_price %}
|
||||
<span>{{ '¥%0.2f'|format(course.market_price) }}</span>
|
||||
{% if course.vip_price > 0 %}
|
||||
<span class="price">{{ '会员¥%0.2f'|format(course.vip_price) }}</span>
|
||||
<div class="info">
|
||||
<div class="title layui-elip">
|
||||
<a href="{{ course_url }}" title="{{ course.title|e }}">{{ course.title }}</a>
|
||||
</div>
|
||||
<div class="meta">
|
||||
{% if course.market_price > course.vip_price %}
|
||||
<span>{{ '¥%0.2f'|format(course.market_price) }}</span>
|
||||
{% if course.vip_price > 0 %}
|
||||
<span class="price">{{ '会员¥%0.2f'|format(course.vip_price) }}</span>
|
||||
{% else %}
|
||||
<span class="free">会员免费</span>
|
||||
{% endif %}
|
||||
<span class="level">{{ level_info(course.level) }}</span>
|
||||
<span class="user">{{ course.user_count }}人购买</span>
|
||||
{% elseif course.market_price > 0 %}
|
||||
<span class="price">{{ '¥%0.2f'|format(course.market_price) }}</span>
|
||||
<span class="level">{{ level_info(course.level) }}</span>
|
||||
<span class="lesson">{{ course.lesson_count }}节课</span>
|
||||
<span class="user">{{ course.user_count }}人购买</span>
|
||||
{% else %}
|
||||
<span class="free">会员免费</span>
|
||||
<span class="free">免费</span>
|
||||
<span class="level">{{ level_info(course.level) }}</span>
|
||||
<span class="lesson">{{ course.lesson_count }}节课</span>
|
||||
<span class="user">{{ course.user_count }}人报名</span>
|
||||
{% endif %}
|
||||
<span class="level">{{ level_info(course.level) }}</span>
|
||||
<span class="user">{{ course.user_count }}人购买</span>
|
||||
{% elseif course.market_price > 0 %}
|
||||
<span class="price">{{ '¥%0.2f'|format(course.market_price) }}</span>
|
||||
<span class="level">{{ level_info(course.level) }}</span>
|
||||
<span class="lesson">{{ course.lesson_count }}节课</span>
|
||||
<span class="user">{{ course.user_count }}人购买</span>
|
||||
{% else %}
|
||||
<span class="free">免费</span>
|
||||
<span class="level">{{ level_info(course.level) }}</span>
|
||||
<span class="lesson">{{ course.lesson_count }}节课</span>
|
||||
<span class="user">{{ course.user_count }}人报名</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{%- endmacro %}
|
||||
@ -90,14 +92,16 @@
|
||||
<img src="{{ item.course.cover }}!cover_270" alt="{{ course_title }}">
|
||||
</a>
|
||||
</div>
|
||||
<div class="title layui-elip">
|
||||
<a href="{{ course_url }}" title="{{ course_title }}">{{ course_title }}</a>
|
||||
</div>
|
||||
<div class="progress">
|
||||
<div class="layui-progress" lay-showPercent="yes">
|
||||
<div class="layui-progress-bar" lay-percent="{{ item.progress }}%"></div>
|
||||
<div class="info">
|
||||
<div class="title layui-elip">
|
||||
<a href="{{ course_url }}" title="{{ course_title }}">{{ course_title }}</a>
|
||||
</div>
|
||||
<div class="progress">
|
||||
<div class="layui-progress" lay-showPercent="yes">
|
||||
<div class="layui-progress-bar" lay-percent="{{ item.progress }}%"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="duration">已学习 {{ item.duration|total_duration }}</div>
|
||||
</div>
|
||||
<div class="duration">已学习 {{ item.duration|total_duration }}</div>
|
||||
</div>
|
||||
{%- endmacro %}
|
@ -14,28 +14,23 @@
|
||||
{% block inline_css %}{% endblock %}
|
||||
</head>
|
||||
<body class="body">
|
||||
|
||||
<div id="header">
|
||||
{{ partial('partials/header') }}
|
||||
</div>
|
||||
|
||||
<div id="main" class="layui-main">
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
|
||||
<div id="footer">
|
||||
{{ partial('partials/footer') }}
|
||||
</div>
|
||||
{{ js_include('lib/layui/layui.all.js') }}
|
||||
|
||||
{{ js_include('lib/layui/layui.js') }}
|
||||
{{ js_include('web/js/common.js') }}
|
||||
<script>
|
||||
layui.util.fixbar({
|
||||
bar1: true,
|
||||
click: function (type) {
|
||||
console.log(type);
|
||||
if (type === 'bar1') {
|
||||
alert('点击了bar1');
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{{ js_include('web/js/fixbar.js') }}
|
||||
|
||||
{% block include_js %}{% endblock %}
|
||||
{% block inline_js %}{% endblock %}
|
||||
</body>
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace App\Services\Frontend\Teacher;
|
||||
|
||||
use App\Library\Paginator\Query as PagerQuery;
|
||||
use App\Models\User;
|
||||
use App\Repos\User as UserRepo;
|
||||
use App\Services\Frontend\Service as FrontendService;
|
||||
|
||||
@ -15,6 +16,7 @@ class TeacherList extends FrontendService
|
||||
|
||||
$params = $pagerQuery->getParams();
|
||||
|
||||
$params['edu_role'] = User::EDU_ROLE_TEACHER;
|
||||
$params['deleted'] = 0;
|
||||
|
||||
$sort = $pagerQuery->getSort();
|
||||
|
@ -174,7 +174,11 @@
|
||||
}
|
||||
|
||||
.index-course-list .course-card {
|
||||
box-shadow: 0 1px 2px 1px rgba(0, 0, 0, 0.05);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.index-course-list .course-card .info {
|
||||
border: 1px solid #eee;
|
||||
}
|
||||
|
||||
.index-carousel {
|
||||
@ -285,7 +289,6 @@
|
||||
}
|
||||
|
||||
.course-card .cover {
|
||||
margin-bottom: 10px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@ -299,15 +302,17 @@
|
||||
transform: scale(1.2);
|
||||
}
|
||||
|
||||
.course-card .info {
|
||||
padding: 10px 5px;
|
||||
}
|
||||
|
||||
.course-card .title {
|
||||
padding: 0 5px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.course-card .meta {
|
||||
color: #666;
|
||||
font-size: 12px;
|
||||
padding: 0 5px;
|
||||
}
|
||||
|
||||
.course-card .meta span {
|
||||
@ -728,8 +733,31 @@
|
||||
}
|
||||
|
||||
.live-player {
|
||||
width: 800px;
|
||||
height: 450px;
|
||||
width: 760px;
|
||||
height: 428px;
|
||||
}
|
||||
|
||||
.live-stats {
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.live-stats .stats {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.live-stats .count {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.live-user-card {
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
.chat-login-tips {
|
||||
padding-top: 20px;
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.chapter-bg {
|
||||
|
@ -1,14 +1,15 @@
|
||||
var $ = layui.jquery;
|
||||
var layer = layui.layer;
|
||||
var captcha = new TencentCaptcha(
|
||||
$('#captcha-btn')[0],
|
||||
$('#captcha-btn').attr('data-app-id'),
|
||||
function (res) {
|
||||
if (res.ret === 0) {
|
||||
$('#ticket').val(res.ticket);
|
||||
$('#rand').val(res.randstr);
|
||||
$('#captcha-block').hide();
|
||||
$('#submit-btn').removeClass('layui-btn-disabled').removeAttr('disabled');
|
||||
layui.use(['jquery'], function () {
|
||||
var $ = layui.jquery;
|
||||
var captcha = new TencentCaptcha(
|
||||
$('#captcha-btn')[0],
|
||||
$('#captcha-btn').attr('data-app-id'),
|
||||
function (res) {
|
||||
if (res.ret === 0) {
|
||||
$('#ticket').val(res.ticket);
|
||||
$('#rand').val(res.randstr);
|
||||
$('#captcha-block').hide();
|
||||
$('#submit-btn').removeClass('layui-btn-disabled').removeAttr('disabled');
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
);
|
||||
});
|
@ -1,87 +1,84 @@
|
||||
var $ = layui.jquery;
|
||||
var layer = layui.layer;
|
||||
layui.use(['jquery', 'util'], function () {
|
||||
|
||||
var timeCounting = false;
|
||||
var $account = $('#cv-account');
|
||||
var $emit = $('#cv-verify-emit');
|
||||
var $ = layui.jquery;
|
||||
var util = layui.util;
|
||||
|
||||
var captcha = new TencentCaptcha(
|
||||
$emit[0],
|
||||
$('#cv-app-id').val(),
|
||||
function (res) {
|
||||
if (res.ret === 0) {
|
||||
$('#cv-ticket').val(res.ticket);
|
||||
$('#cv-rand').val(res.randstr);
|
||||
if (isEmail($account.val()) || isPhone($account.val())) {
|
||||
var postUrl = null;
|
||||
var postData = {
|
||||
ticket: $('#cv-ticket').val(),
|
||||
rand: $('#cv-rand').val(),
|
||||
};
|
||||
if (isPhone($account.val())) {
|
||||
postData.phone = $account.val();
|
||||
postUrl = '/verify/sms/code';
|
||||
} else if (isEmail($account.val())) {
|
||||
postData.email = $account.val();
|
||||
postUrl = '/verify/email/code';
|
||||
}
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: postUrl,
|
||||
data: postData,
|
||||
success: function (res) {
|
||||
var timeCounting = false;
|
||||
var $account = $('#cv-account');
|
||||
var $emit = $('#cv-verify-emit');
|
||||
|
||||
},
|
||||
error: function (xhr) {
|
||||
var json = JSON.parse(xhr.responseText);
|
||||
layer.msg(json.msg, {icon: 2});
|
||||
var captcha = new TencentCaptcha(
|
||||
$emit[0],
|
||||
$('#cv-app-id').val(),
|
||||
function (res) {
|
||||
if (res.ret === 0) {
|
||||
$('#cv-ticket').val(res.ticket);
|
||||
$('#cv-rand').val(res.randstr);
|
||||
if (isEmail($account.val()) || isPhone($account.val())) {
|
||||
var postUrl;
|
||||
var postData = {
|
||||
ticket: $('#cv-ticket').val(),
|
||||
rand: $('#cv-rand').val(),
|
||||
};
|
||||
if (isPhone($account.val())) {
|
||||
postData.phone = $account.val();
|
||||
postUrl = '/verify/sms/code';
|
||||
} else if (isEmail($account.val())) {
|
||||
postData.email = $account.val();
|
||||
postUrl = '/verify/email/code';
|
||||
}
|
||||
});
|
||||
$('#cv-submit-btn').removeClass('layui-btn-disabled').removeAttr('disabled');
|
||||
$emit.addClass('layui-btn-disabled').attr('disabled', 'disabled');
|
||||
showCountDown($emit);
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: postUrl,
|
||||
data: postData
|
||||
});
|
||||
$('#cv-submit-btn').removeClass('layui-btn-disabled').removeAttr('disabled');
|
||||
$emit.addClass('layui-btn-disabled').attr('disabled', 'disabled');
|
||||
showCountDown($emit);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
$account.on('keyup', function () {
|
||||
var accountOk;
|
||||
var type = $(this).attr('data-type');
|
||||
var account = $(this).val();
|
||||
if (type === 'phone') {
|
||||
accountOk = isPhone(account);
|
||||
} else if (type === 'email') {
|
||||
accountOk = isEmail(account);
|
||||
} else {
|
||||
accountOk = isPhone(account) || isEmail(account);
|
||||
}
|
||||
if (accountOk && !timeCounting) {
|
||||
$emit.removeClass('layui-btn-disabled').removeAttr('disabled');
|
||||
} else {
|
||||
$emit.addClass('layui-btn-disabled').attr('disabled', 'disabled');
|
||||
}
|
||||
});
|
||||
|
||||
function showCountDown(obj) {
|
||||
var serverTime = new Date().getTime();
|
||||
var endTime = serverTime + 60 * 1000;
|
||||
layui.util.countdown(endTime, serverTime, function (date, serverTime, timer) {
|
||||
var left = date[0] * 86400 + date[1] * 3600 + date[2] * 60 + date[3];
|
||||
obj.text(left + '秒');
|
||||
if (left === 0) {
|
||||
obj.removeClass('layui-btn-disabled').removeAttr('disabled').text('重新发送');
|
||||
clearInterval(timer);
|
||||
timeCounting = false;
|
||||
$account.on('keyup', function () {
|
||||
var accountOk;
|
||||
var type = $(this).attr('data-type');
|
||||
var account = $(this).val();
|
||||
if (type === 'phone') {
|
||||
accountOk = isPhone(account);
|
||||
} else if (type === 'email') {
|
||||
accountOk = isEmail(account);
|
||||
} else {
|
||||
accountOk = isPhone(account) || isEmail(account);
|
||||
}
|
||||
if (accountOk && !timeCounting) {
|
||||
$emit.removeClass('layui-btn-disabled').removeAttr('disabled');
|
||||
} else {
|
||||
$emit.addClass('layui-btn-disabled').attr('disabled', 'disabled');
|
||||
}
|
||||
});
|
||||
timeCounting = true;
|
||||
}
|
||||
|
||||
function isEmail(email) {
|
||||
return /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/.test(email);
|
||||
}
|
||||
function showCountDown(obj) {
|
||||
var serverTime = new Date().getTime();
|
||||
var endTime = serverTime + 60 * 1000;
|
||||
util.countdown(endTime, serverTime, function (date, serverTime, timer) {
|
||||
var left = date[0] * 86400 + date[1] * 3600 + date[2] * 60 + date[3];
|
||||
obj.text(left + '秒');
|
||||
if (left === 0) {
|
||||
obj.removeClass('layui-btn-disabled').removeAttr('disabled').text('重新发送');
|
||||
clearInterval(timer);
|
||||
timeCounting = false;
|
||||
}
|
||||
});
|
||||
timeCounting = true;
|
||||
}
|
||||
|
||||
function isPhone(phone) {
|
||||
return /^1(3|4|5|6|7|8|9)\d{9}$/.test(phone);
|
||||
}
|
||||
function isEmail(email) {
|
||||
return /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/.test(email);
|
||||
}
|
||||
|
||||
function isPhone(phone) {
|
||||
return /^1(3|4|5|6|7|8|9)\d{9}$/.test(phone);
|
||||
}
|
||||
|
||||
});
|
@ -1,86 +1,92 @@
|
||||
var $ = layui.jquery;
|
||||
var element = layui.element;
|
||||
var form = layui.form;
|
||||
var layer = layui.layer;
|
||||
|
||||
$.ajaxSetup({
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader('X-Csrf-Token', $('meta[name="csrf-token"]').attr('content'));
|
||||
}
|
||||
layui.define(['jquery', 'element'], function (exports) {
|
||||
exports('ajaxLoadHtml', function (url, target) {
|
||||
var $ = layui.jquery;
|
||||
var element = layui.element;
|
||||
var $target = $('#' + target);
|
||||
var html = '<div class="loading"><i class="layui-icon layui-icon-loading layui-anim layui-anim-rotate layui-anim-loop"></i></div>';
|
||||
$target.html(html);
|
||||
$.get(url, function (html) {
|
||||
$target.html(html);
|
||||
element.init();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
var helper = {};
|
||||
layui.use(['jquery', 'form', 'element', 'layer'], function () {
|
||||
|
||||
helper.ajaxLoadHtml = function (url, target) {
|
||||
var $target = $('#' + target);
|
||||
var html = '<div class="loading"><i class="layui-icon layui-icon-loading layui-anim layui-anim-rotate layui-anim-loop"></i></div>';
|
||||
$target.html(html);
|
||||
$.get(url, function (html) {
|
||||
$target.html(html);
|
||||
element.init();
|
||||
});
|
||||
}
|
||||
var $ = layui.jquery;
|
||||
var element = layui.element;
|
||||
var form = layui.form;
|
||||
var layer = layui.layer;
|
||||
|
||||
form.on('submit(go)', function (data) {
|
||||
var submit = $(this);
|
||||
submit.attr('disabled', 'disabled').addClass('layui-btn-disabled');
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: data.form.action,
|
||||
data: data.field,
|
||||
success: function (res) {
|
||||
var icon = res.code === 0 ? 1 : 2;
|
||||
if (res.msg) {
|
||||
layer.msg(res.msg, {icon: icon});
|
||||
}
|
||||
if (res.location) {
|
||||
setTimeout(function () {
|
||||
window.location.href = res.location;
|
||||
}, 1500);
|
||||
} else {
|
||||
submit.removeAttr('disabled').removeClass('layui-btn-disabled');
|
||||
}
|
||||
},
|
||||
error: function (xhr) {
|
||||
var json = JSON.parse(xhr.responseText);
|
||||
layer.msg(json.msg, {icon: 2});
|
||||
submit.removeAttr('disabled').removeClass('layui-btn-disabled');
|
||||
$.ajaxSetup({
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader('X-Csrf-Token', $('meta[name="csrf-token"]').attr('content'));
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.kg-delete').on('click', function () {
|
||||
var url = $(this).attr('data-url');
|
||||
var tips = '确定要删除吗?';
|
||||
layer.confirm(tips, function () {
|
||||
form.on('submit(go)', function (data) {
|
||||
var submit = $(this);
|
||||
submit.attr('disabled', 'disabled').addClass('layui-btn-disabled');
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: url,
|
||||
url: data.form.action,
|
||||
data: data.field,
|
||||
success: function (res) {
|
||||
layer.msg(res.msg, {icon: 1});
|
||||
var icon = res.code === 0 ? 1 : 2;
|
||||
if (res.msg) {
|
||||
layer.msg(res.msg, {icon: icon});
|
||||
}
|
||||
if (res.location) {
|
||||
setTimeout(function () {
|
||||
window.location.href = res.location;
|
||||
}, 1500);
|
||||
} else {
|
||||
window.location.reload();
|
||||
submit.removeAttr('disabled').removeClass('layui-btn-disabled');
|
||||
}
|
||||
},
|
||||
error: function (xhr) {
|
||||
var json = JSON.parse(xhr.responseText);
|
||||
layer.msg(json.msg, {icon: 2});
|
||||
submit.removeAttr('disabled').removeClass('layui-btn-disabled');
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
$('.kg-back').on('click', function () {
|
||||
window.history.back();
|
||||
});
|
||||
$('.kg-delete').on('click', function () {
|
||||
var url = $(this).attr('data-url');
|
||||
var tips = '确定要删除吗?';
|
||||
layer.confirm(tips, function () {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: url,
|
||||
success: function (res) {
|
||||
layer.msg(res.msg, {icon: 1});
|
||||
if (res.location) {
|
||||
setTimeout(function () {
|
||||
window.location.href = res.location;
|
||||
}, 1500);
|
||||
} else {
|
||||
window.location.reload();
|
||||
}
|
||||
},
|
||||
error: function (xhr) {
|
||||
var json = JSON.parse(xhr.responseText);
|
||||
layer.msg(json.msg, {icon: 2});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$('.kg-back').on('click', function () {
|
||||
window.history.back();
|
||||
});
|
||||
|
||||
$('body').on('click', '.layui-laypage > a', function () {
|
||||
var url = $(this).attr('data-url');
|
||||
var target = $(this).attr('data-target');
|
||||
layui.ajaxLoadHtml(url, target);
|
||||
});
|
||||
|
||||
$('body').on('click', '.layui-laypage > a', function () {
|
||||
var url = $(this).attr('data-url');
|
||||
var target = $(this).attr('data-target');
|
||||
helper.ajaxLoadHtml(url, target);
|
||||
});
|
30
public/static/web/js/course.show.js
Normal file
30
public/static/web/js/course.show.js
Normal file
@ -0,0 +1,30 @@
|
||||
layui.use(['jquery', 'element'], function () {
|
||||
|
||||
var $ = layui.jquery;
|
||||
|
||||
if ($('#tab-packages').length > 0) {
|
||||
var $tabPackages = $('#tab-packages');
|
||||
layui.ajaxLoadHtml($tabPackages.attr('data-url'), $tabPackages.attr('id'));
|
||||
}
|
||||
if ($('#tab-consults').length > 0) {
|
||||
var $tabConsults = $('#tab-consults');
|
||||
layui.ajaxLoadHtml($tabConsults.attr('data-url'), $tabConsults.attr('id'));
|
||||
}
|
||||
if ($('#tab-reviews').length > 0) {
|
||||
var $tabReviews = $('#tab-reviews');
|
||||
layui.ajaxLoadHtml($tabReviews.attr('data-url'), $tabReviews.attr('id'));
|
||||
}
|
||||
if ($('#sidebar-topics').length > 0) {
|
||||
var $sdTopics = $('#sidebar-topics');
|
||||
layui.ajaxLoadHtml($sdTopics.attr('data-url'), $sdTopics.attr('id'));
|
||||
}
|
||||
if ($('#sidebar-recommended').length > 0) {
|
||||
var $sdRecommended = $('#sidebar-recommended');
|
||||
layui.ajaxLoadHtml($sdRecommended.attr('data-url'), $sdRecommended.attr('id'));
|
||||
}
|
||||
if ($('#sidebar-related').length > 0) {
|
||||
var $sdRelated = $('#sidebar-related');
|
||||
layui.ajaxLoadHtml($sdRelated.attr('data-url'), $sdRelated.attr('id'));
|
||||
}
|
||||
|
||||
});
|
12
public/static/web/js/fixbar.js
Normal file
12
public/static/web/js/fixbar.js
Normal file
@ -0,0 +1,12 @@
|
||||
layui.use(['util'], function () {
|
||||
var util = layui.util;
|
||||
util.fixbar({
|
||||
bar1: true,
|
||||
click: function (type) {
|
||||
console.log(type);
|
||||
if (type === 'bar1') {
|
||||
alert('点击了bar1');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
@ -2,7 +2,6 @@ layui.use(['jquery', 'layim'], function () {
|
||||
|
||||
var $ = layui.jquery;
|
||||
var layim = layui.layim;
|
||||
|
||||
var socket = new WebSocket('ws://127.0.0.1:8282');
|
||||
|
||||
var membersUrl = $('input[name="im.members_url"]').val();
|
||||
@ -34,9 +33,7 @@ layui.use(['jquery', 'layim'], function () {
|
||||
'sign': user.sign
|
||||
}
|
||||
},
|
||||
members: {
|
||||
url: membersUrl
|
||||
}
|
||||
members: {url: membersUrl}
|
||||
}).chat({
|
||||
type: 'group',
|
||||
name: group.name,
|
||||
@ -44,6 +41,8 @@ layui.use(['jquery', 'layim'], function () {
|
||||
id: group.id
|
||||
});
|
||||
|
||||
layim.setChatMin();
|
||||
|
||||
layim.on('sendMessage', function (res) {
|
||||
sendMessage(res.mine, res.to);
|
||||
});
|
||||
@ -72,6 +71,8 @@ layui.use(['jquery', 'layim'], function () {
|
||||
}
|
||||
};
|
||||
|
||||
showOrHidePoster();
|
||||
|
||||
function bindUser(clientId) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
@ -90,7 +91,16 @@ layui.use(['jquery', 'layim'], function () {
|
||||
}
|
||||
|
||||
function showMessage(message) {
|
||||
layim.getMessage(message);
|
||||
if (message.fromid !== user.id) {
|
||||
layim.getMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
function showOrHidePoster() {
|
||||
if (user.id === '0') {
|
||||
var html = '<div class="chat-login-tips">登录用户才可以参与讨论哦</div>';
|
||||
$('.layim-chat-footer').hide().after(html);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
@ -1,104 +1,108 @@
|
||||
var interval = null;
|
||||
var intervalTime = 5000;
|
||||
var position = 0;
|
||||
var chapterId = $('input[name="chapter.id"]').val();
|
||||
var planId = $('input[name="chapter.plan_id"]').val();
|
||||
var userId = $('input[name="user.id"]').val();
|
||||
var learningUrl = $('input[name="chapter.learning_url"]').val();
|
||||
var playUrls = JSON.parse($('input[name="chapter.play_urls"]').val());
|
||||
var requestId = getRequestId();
|
||||
layui.use(['jquery'], function () {
|
||||
|
||||
var options = {
|
||||
live: true,
|
||||
autoplay: true,
|
||||
h5_flv: true,
|
||||
width: 800,
|
||||
height: 450
|
||||
};
|
||||
var interval = null;
|
||||
var intervalTime = 5000;
|
||||
var position = 0;
|
||||
var chapterId = $('input[name="chapter.id"]').val();
|
||||
var planId = $('input[name="chapter.plan_id"]').val();
|
||||
var userId = $('input[name="user.id"]').val();
|
||||
var learningUrl = $('input[name="chapter.learning_url"]').val();
|
||||
var playUrls = JSON.parse($('input[name="chapter.play_urls"]').val());
|
||||
var requestId = getRequestId();
|
||||
|
||||
if (playUrls.rtmp && playUrls.rtmp.od) {
|
||||
options.rtmp = playUrls.rtmp.od;
|
||||
}
|
||||
var options = {
|
||||
live: true,
|
||||
autoplay: true,
|
||||
h5_flv: true,
|
||||
width: 760,
|
||||
height: 428
|
||||
};
|
||||
|
||||
if (playUrls.rtmp && playUrls.rtmp.hd) {
|
||||
options.rtmp_hd = playUrls.rtmp.hd;
|
||||
}
|
||||
if (playUrls.rtmp && playUrls.rtmp.od) {
|
||||
options.rtmp = playUrls.rtmp.od;
|
||||
}
|
||||
|
||||
if (playUrls.rtmp && playUrls.rtmp.sd) {
|
||||
options.rtmp_sd = playUrls.rtmp.sd;
|
||||
}
|
||||
if (playUrls.rtmp && playUrls.rtmp.hd) {
|
||||
options.rtmp_hd = playUrls.rtmp.hd;
|
||||
}
|
||||
|
||||
if (playUrls.flv && playUrls.flv.od) {
|
||||
options.flv = playUrls.flv.od;
|
||||
}
|
||||
if (playUrls.rtmp && playUrls.rtmp.sd) {
|
||||
options.rtmp_sd = playUrls.rtmp.sd;
|
||||
}
|
||||
|
||||
if (playUrls.flv && playUrls.flv.hd) {
|
||||
options.flv_hd = playUrls.flv.hd;
|
||||
}
|
||||
if (playUrls.flv && playUrls.flv.od) {
|
||||
options.flv = playUrls.flv.od;
|
||||
}
|
||||
|
||||
if (playUrls.flv && playUrls.flv.sd) {
|
||||
options.flv_sd = playUrls.flv.sd;
|
||||
}
|
||||
if (playUrls.flv && playUrls.flv.hd) {
|
||||
options.flv_hd = playUrls.flv.hd;
|
||||
}
|
||||
|
||||
if (playUrls.m3u8 && playUrls.m3u8.od) {
|
||||
options.m3u8 = playUrls.m3u8.od;
|
||||
}
|
||||
if (playUrls.flv && playUrls.flv.sd) {
|
||||
options.flv_sd = playUrls.flv.sd;
|
||||
}
|
||||
|
||||
if (playUrls.m3u8 && playUrls.m3u8.hd) {
|
||||
options.m3u8_hd = playUrls.m3u8.hd;
|
||||
}
|
||||
if (playUrls.m3u8 && playUrls.m3u8.od) {
|
||||
options.m3u8 = playUrls.m3u8.od;
|
||||
}
|
||||
|
||||
if (playUrls.m3u8 && playUrls.m3u8.sd) {
|
||||
options.m3u8_sd = playUrls.m3u8.sd;
|
||||
}
|
||||
if (playUrls.m3u8 && playUrls.m3u8.hd) {
|
||||
options.m3u8_hd = playUrls.m3u8.hd;
|
||||
}
|
||||
|
||||
if (userId !== '0' && planId !== '0') {
|
||||
options.listener = function (msg) {
|
||||
if (msg.type === 'play') {
|
||||
start();
|
||||
} else if (msg.type === 'pause') {
|
||||
stop();
|
||||
} else if (msg.type === 'end') {
|
||||
stop();
|
||||
if (playUrls.m3u8 && playUrls.m3u8.sd) {
|
||||
options.m3u8_sd = playUrls.m3u8.sd;
|
||||
}
|
||||
|
||||
if (userId !== '0' && planId !== '0') {
|
||||
options.listener = function (msg) {
|
||||
if (msg.type === 'play') {
|
||||
start();
|
||||
} else if (msg.type === 'pause') {
|
||||
stop();
|
||||
} else if (msg.type === 'end') {
|
||||
stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var player = new TcPlayer('player', options);
|
||||
var player = new TcPlayer('player', options);
|
||||
|
||||
if (position > 0) {
|
||||
player.currentTime(position);
|
||||
}
|
||||
if (position > 0) {
|
||||
player.currentTime(position);
|
||||
}
|
||||
|
||||
function start() {
|
||||
if (interval != null) {
|
||||
function start() {
|
||||
if (interval != null) {
|
||||
clearInterval(interval);
|
||||
interval = null;
|
||||
}
|
||||
interval = setInterval(learning, intervalTime);
|
||||
}
|
||||
|
||||
function stop() {
|
||||
clearInterval(interval);
|
||||
interval = null;
|
||||
}
|
||||
interval = setInterval(learning, intervalTime);
|
||||
}
|
||||
|
||||
function stop() {
|
||||
clearInterval(interval);
|
||||
interval = null;
|
||||
}
|
||||
function learning() {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: learningUrl,
|
||||
data: {
|
||||
request_id: requestId,
|
||||
chapter_id: chapterId,
|
||||
plan_id: planId,
|
||||
interval: intervalTime,
|
||||
position: player.currentTime(),
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function learning() {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: learningUrl,
|
||||
data: {
|
||||
request_id: requestId,
|
||||
chapter_id: chapterId,
|
||||
plan_id: planId,
|
||||
interval: intervalTime,
|
||||
position: player.currentTime(),
|
||||
}
|
||||
});
|
||||
}
|
||||
function getRequestId() {
|
||||
var id = Date.now().toString(36);
|
||||
id += Math.random().toString(36).substr(3);
|
||||
return id;
|
||||
}
|
||||
|
||||
function getRequestId() {
|
||||
var id = Date.now().toString(36);
|
||||
id += Math.random().toString(36).substr(3);
|
||||
return id;
|
||||
}
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user