12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- function signalViewModel(account, name, personid) {
-
- var clickNum = 0;
- mui.back = function (event) {
- clickNum++; if (clickNum > 1) { plus.runtime.quit(); }
- else {
- mui.toast("再按一次退出应用");
- } setTimeout(function () { clickNum = 0 }, 2000); return false;
- }
- //账户
- this.Account = account;
- //登录名
- this.Name = name;
- //人员ID
- this.PersonId = personid;
- //登录的集成代理类
- this.LoginProxy = $.connection.LoginHub;
- //初始化连接服务器成功后调用
- //this.LoginProxy.client.connectedSuccess = function (connectId) {
- // ZLPMS.Msg('成功获取到在线用户信息');
- //}
- //被踢下线
- this.LoginProxy.client.MoblieOffline = function () {
- $.post("/MobileAccount/LogOut", {}, function (data) {
- mui.alert('您的账号在其它客户端登录,被强制下线', function () {
- window.location.href = '/MobileAccount/MobileProblemLogin'
- });
- })
-
- }
- //向服务端发起注册
- this.register = function () {
- var that = this;
- //向服务器注册客户端
- $.connection.hub.start().done(function () {
- //客户端向服务器的Hub类注册成功事件(成功后,执行登录)
- that.LoginProxy.server.MoblieLogin(that.Account, that.Name, that.PersonId);
- }).fail(function () {
- //客户端向服务器的Hub类注册失败事件
- mui.toast('客户端向服务器的Hub类注册失败事件');
- });
- };
-
- }
|