注册绑定问题
This commit is contained in:
parent
2886bba2bc
commit
0bb5c8b5fb
|
@ -53,10 +53,20 @@ module Mobile
|
|||
requires :password, type: String, desc: 'password'
|
||||
end
|
||||
post do
|
||||
|
||||
openid = session[:wechat_openid]
|
||||
logger.debug "openid ============== #{openid}"
|
||||
raise "无法获取到openid,请在微信中打开本页面" unless openid
|
||||
|
||||
|
||||
us = UsersService.new
|
||||
user = us.register params.merge(:password_confirmation => params[:password],
|
||||
:should_confirmation_password => true)
|
||||
raise "该邮箱已经被注册过了" if user.new_record?
|
||||
raise user.errors.full_messages.first if user.new_record?
|
||||
UserWechat.create!(
|
||||
openid: openid,
|
||||
user: user
|
||||
)
|
||||
|
||||
present :data, user, with: Mobile::Entities::User
|
||||
present :status, 0
|
||||
|
|
|
@ -28,29 +28,29 @@
|
|||
|
||||
<script src="https://dn-demotest.qbox.me/angular.all.min.js"></script>
|
||||
<!--<script src="/javascripts/wechat/build/angular.all.min.js"></script>-->
|
||||
<script src="/javascripts/wechat/build/app.min.js"></script>
|
||||
<!--<script src="/javascripts/wechat/app.js"></script>-->
|
||||
<!--<script src="/javascripts/wechat/others/factory.js"></script>-->
|
||||
<!--<script src="/javascripts/wechat/others/filter.js"></script>-->
|
||||
<!--<script src="/javascripts/wechat/directives/alert.js"></script>-->
|
||||
<!--<script src="/javascripts/wechat/directives/form_validate.js"></script>-->
|
||||
<!--<script src="/javascripts/wechat/directives/input_auto.js"></script>-->
|
||||
<!--<script src="/javascripts/wechat/directives/loading_spinner.js"></script>-->
|
||||
<!--<script src="/javascripts/wechat/controllers/reg.js"></script>-->
|
||||
<!--<script src="/javascripts/wechat/controllers/invite_code.js"></script>-->
|
||||
<!--<script src="/javascripts/wechat/controllers/login.js"></script>-->
|
||||
<!--<script src="/javascripts/wechat/controllers/activity.js"></script>-->
|
||||
<!--<script src="/javascripts/wechat/controllers/new_class.js"></script>-->
|
||||
<!--<script src="/javascripts/wechat/controllers/blog.js"></script>-->
|
||||
<!--<script src="/javascripts/wechat/controllers/course_notice.js"></script>-->
|
||||
<!--<script src="/javascripts/wechat/controllers/discussion.js"></script>-->
|
||||
<!--<script src="/javascripts/wechat/controllers/homework.js"></script>-->
|
||||
<!--<script src="/javascripts/wechat/controllers/issue.js"></script>-->
|
||||
<!--<script src="/javascripts/wechat/controllers/journals.js"></script>-->
|
||||
<!--<script src="/javascripts/wechat/controllers/class.js"></script>-->
|
||||
<!--<script src="/javascripts/wechat/controllers/class_list.js"></script>-->
|
||||
<!--<script src="/javascripts/wechat/controllers/myresource.js"></script>-->
|
||||
<!--<script src="/javascripts/wechat/others/routes.js"></script>-->
|
||||
<!--<script src="/javascripts/wechat/build/app.min.js"></script>-->
|
||||
<script src="/javascripts/wechat/app.js"></script>
|
||||
<script src="/javascripts/wechat/others/factory.js"></script>
|
||||
<script src="/javascripts/wechat/others/filter.js"></script>
|
||||
<script src="/javascripts/wechat/directives/alert.js"></script>
|
||||
<script src="/javascripts/wechat/directives/form_validate.js"></script>
|
||||
<script src="/javascripts/wechat/directives/input_auto.js"></script>
|
||||
<script src="/javascripts/wechat/directives/loading_spinner.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/reg.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/invite_code.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/login.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/activity.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/new_class.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/blog.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/course_notice.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/discussion.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/homework.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/issue.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/journals.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/class.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/class_list.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/myresource.js"></script>
|
||||
<script src="/javascripts/wechat/others/routes.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -40,4 +40,5 @@
|
|||
</form>
|
||||
</div>
|
||||
|
||||
<my-alert message="errDialog.message" title="errDialog.title" visible="errDialog.visible"></my-alert>
|
||||
<my-alert message="errDialog.message" title="errDialog.title" visible="errDialog.visible"></my-alert>
|
||||
<my-alert message="successDialog.message" title="successDialog.title" visible="successDialog.visible" cb="successDialog.cb"></my-alert>
|
|
@ -1,8 +1,9 @@
|
|||
app.controller('RegController', ['$scope', '$http', '$location', 'alertService',
|
||||
function ($scope, $http, $location, alertService) {
|
||||
app.controller('RegController', ['$scope', '$http', '$location', 'alertService','$location',
|
||||
function ($scope, $http, $location, alertService, $location) {
|
||||
|
||||
var vm = $scope;
|
||||
vm.errDialog = alertService.create();
|
||||
vm.successDialog = alertService.create();
|
||||
|
||||
vm.goLogin = function () {
|
||||
$location.path("/login");
|
||||
|
@ -32,10 +33,12 @@ app.controller('RegController', ['$scope', '$http', '$location', 'alertService',
|
|||
if (response.data.status != 0) {
|
||||
vm.errDialog.showMessage('出错了',response.data.message);
|
||||
} else {
|
||||
vm.errDialog.showMessage("提示","注册且绑定微信成功");
|
||||
vm.successDialog.showMessage("提示","注册且绑定微信成功", function(){
|
||||
$location.path("/activities");
|
||||
});
|
||||
}
|
||||
}, function (response) {
|
||||
vm.errDialo.showMessage('出错了',response.data);
|
||||
vm.errDialog.showMessage('出错了',response.data);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue