Commit 875c8343 authored by xiabin's avatar xiabin

添加设置回调系统登录Url的功能

parent 4f0ffdfe
...@@ -158,6 +158,7 @@ class HomeController extends \yii\web\Controller ...@@ -158,6 +158,7 @@ class HomeController extends \yii\web\Controller
} }
} }
/** /**
* 点赞或者取消点赞 * 点赞或者取消点赞
* @param $coursewareId * @param $coursewareId
......
...@@ -317,6 +317,21 @@ class SiteController extends Controller ...@@ -317,6 +317,21 @@ class SiteController extends Controller
} }
} }
/**
* 设置登录后回调url
* @param $url
* @throws \yii\web\ForbiddenHttpException
*/
public function actionSetReturnUrl($url)
{
if (Yii::$app->request->isAjax) {
Yii::$app->user->setReturnUrl($url);
Utils::ajaxResponse(TRUE);
} else {
throw new \yii\web\ForbiddenHttpException('非法请求');
}
}
/** /**
* 发送注册短信 * 发送注册短信
* ajax * ajax
...@@ -324,7 +339,7 @@ class SiteController extends Controller ...@@ -324,7 +339,7 @@ class SiteController extends Controller
*/ */
public function actionSendSignupMsg() public function actionSendSignupMsg()
{ {
if (TRUE || Yii::$app->request->isAjax) { if (Yii::$app->request->isAjax) {
$telephone = trim(Yii::$app->request->get('telephone')); $telephone = trim(Yii::$app->request->get('telephone'));
if (Utils::isTelephone($telephone)) { if (Utils::isTelephone($telephone)) {
$key = self::REDIS_SIGNUP_MSG_PREFIX . '::' . Utils::getRealIP(); $key = self::REDIS_SIGNUP_MSG_PREFIX . '::' . Utils::getRealIP();
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
</div> </div>
</div> </div>
<div v-if="coursewareInfo.isGuest" class="comment-login"> <div v-if="coursewareInfo.isGuest" class="comment-login">
需要 <a href="">登录</a> 才能评论 需要 <a @click="login" href="javascript:;">登录</a> 才能评论
</div> </div>
<div v-else class="comment-box"> <div v-else class="comment-box">
<div class="comment-head"> <div class="comment-head">
...@@ -53,7 +53,16 @@ ...@@ -53,7 +53,16 @@
} }
}, },
methods: { methods: {
getCommentlists(coursewareId,page,num){ login(){
var returnUrl = __BASE_URL__ + 'home/video?courseId=5';
var url = __BASE_URL__ + 'site/set-return-url?url=' + returnUrl;
$.getJSON(url, function () {
window.location.href = __BASE_URL__ + 'site/login';
}).error(function () {
layer.alert('设置登录回调url错误', {'icon': 2, 'title': '提示'})
});
},
getCommentlists(coursewareId, page, num){
var self = this; var self = this;
var url = __BASE_URL__ + 'home/get-comment-lists?coursewareId=' + coursewareId + '&page=' + var url = __BASE_URL__ + 'home/get-comment-lists?coursewareId=' + coursewareId + '&page=' +
page + '&num=' + num; page + '&num=' + num;
...@@ -73,7 +82,7 @@ ...@@ -73,7 +82,7 @@
} }
}, },
ready(){ ready(){
this.getCommentlists(this.coursewareInfo.id,this.page,this.num); this.getCommentlists(this.coursewareInfo.id, this.page, this.num);
} }
} }
</script> </script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment