コード例 #1
0
ファイル: index.js プロジェクト: moonlight-wang/xfapp
	var Model = function(){
		this.callParent();
		var shellImpl = new ShellImpl(this, {
			"contentsXid" : "pages",
			"pageMappings" : {
				"login" : {
					url : require.toUrl('./login.w')
				},
				"registerEmail" : {
					url : require.toUrl('./registerEmail.w')
				},
				"main" : {
					url : require.toUrl('./main.w')
				},
				"control" : {
					url : require.toUrl('./control.w')
				},
				"add" : {
					url : require.toUrl('./add.w')
				},
				"list" : {
					url : require.toUrl('./list.w')
				},
				"edit" : {
					url : require.toUrl('./edit.w')
				},
				"config" : {
					url : require.toUrl('./config.w')
				},
				"feedBack" : {
					url : require.toUrl('./feedBack.w')
				},
				"about" : {
					url : require.toUrl('./about.w')
				},
				"strainer" : {
					url : require.toUrl('./strainer.w')
				},
				"lxreset" : {
					url : require.toUrl('./lxreset.w')
				},
				"changeID" : {
					url : require.toUrl('./changeID.w')
				},
				"changePassword" : {
					url : require.toUrl('./changePassword.w')
				}
				}});
				shellImpl.useDefaultExitHandler = false;

		CommonUtils.attachDoubleClickExitApp(function() {
			
			//var isHomePage = shellImpl.pagesComp.contents[0].innerContainer.getInnerModel().comp('windowContainer1').getActiveIndex() == 0;
			if (shellImpl.pagesComp.getActiveIndex() === 0) {
				return true;
			}
			return false;
		});
				
	};
コード例 #2
0
ファイル: index.js プロジェクト: Hojondo/QWCY
	Model.prototype.modelLoad = function(event){
		var userLocal = (localStorage.getItem("userID")) || null;
		var self =this;
		CommonUtils.attachDoubleClickExitApp(function() {
				if (self.comp('contents1').getActiveIndex() === 0) {
					return true;
				}
				return false;
			});
		
	};
コード例 #3
0
ファイル: index.js プロジェクト: Cass-D/takeout
	Model.prototype.modelLoad = function(event) {
		var self = this;
		// 获取url上的code参数 - 微信授权code,用于获取微信用户信息
		var weixinCode = this.getContext().getRequestParameter("code");

		// 判断运行环境是否在X5移动客户端中,如果在移动客户端中,则当deviceready后取手机设备uuid作为用户唯一标识
		if (justep.Browser.isX5App) {
			this._deviceType = "app";

			CommonUtils.attachDoubleClickExitApp(function() {
				if (self.comp('contents').getActiveIndex() === 0) {
					return true;
				}
				return false;
			});
			document.addEventListener("deviceready", function() {
				self._userID = window.device.uuid;
				self._userDefaultName = "新用户(来自X5APP的用户)";
			}, false);

		} else if (weixinCode !== "") {
			this._deviceType = "wx";
			if (justep.Browser.isWeChat) {
				this.wxApi = new navigator.WxApi("wx3fb4a0dd8ea0730c");
			}
			
			Baas.sendRequest({
				"url" : "/weixin/weixin",
				"action" : "userinfo",
				"async" : false,
				"params" : {
					code : weixinCode
				},
				"success" : function(weixinUser) {
					self._userID = weixinUser.openid;
					self._userDefaultName = weixinUser.nickname + "(来自微信的用户)";
					self._userDefaultAddress = weixinUser.country + weixinUser.province + weixinUser.city;
					self._userPhotoURL = weixinUser.headimgurl;
				}
			});
			
		}
		
		this.comp('userData').filters.setVar("user", this._userID);
		this.comp('orderData').filters.setVar("user", this._userID);
		this.initPayData();
		//this.queryAddr();
	};
コード例 #4
0
ファイル: index.js プロジェクト: liuyongchao/cgsgrade
	var Model = function() {
		this.callParent();
		var shellImpl = new ShellImpl(this, {
			"contentsXid" : "pages",
			"pageMappings" : {
				"main" : {
					url : require.toUrl('./main.w')
				},
				"list" : {
					url : require.toUrl('./list.w')
				},
				"class" : {
					url : require.toUrl('./class.w')
				},
				"detail" : {
					url : require.toUrl('./detail.w')
				},
				"search" : {
					url : require.toUrl('./search.w')
				},
				"cart" : {
					url : require.toUrl('./cart.w')
				},
				"order" : {
					url : require.toUrl('./order.w')
				},
				"success" : {
					url : require.toUrl('./success.w')
				}
			}
		});
		//shellImpl.setIsSinglePage(true);
		shellImpl.useDefaultExitHandler = false;

		CommonUtils.attachDoubleClickExitApp(function() {
			
			var isHomePage = shellImpl.pagesComp.contents[0].innerContainer.getInnerModel().comp('contents2').getActiveIndex() == 0;
			if (shellImpl.pagesComp.getActiveIndex() === 0 && isHomePage) {
				return true;
			}
			return false;
		});

	};