1 /**
  2  * 单账号解绑手机
  3  * 
  4  * @fileOverView 单账号解绑手机
  5  * @author  <a href="mailto:zhang.gd@foxmail.com">Zhang Guangda</a>
  6  * @date    2012-12-20
  7  */
  8 define(
  9 	"unbind_account_from_mobile_group",
 10 	[
 11 		"component/process_ui",
 12 		"business/unbind_account_from_mobile_group",
 13 		"business/bind_mobile",
 14 		"business/set_login_name"
 15 	],
 16 	function() {
 17 		
 18 		$we.process.config.unbind_account_from_mobile_group = {
 19 			processes: [{
 20 				name: "确认解绑",
 21 				widget: "unbind_account_from_mobile_group.confirm",
 22 				beforeAction: function() {
 23 					if (!$we.process.getData("sdid")) {
 24 						$we.comp.alert("请选择您需要解绑的账号!");
 25 						this.notify("abort");
 26 						return false;
 27 					}
 28 					if ($we.process.getData("is_mobile_acc")) {
 29 						$we.comp.alert("手机账号不能解绑!");
 30 						this.notify("abort");
 31 						return false;
 32 					}
 33 					return $we.process.getData("is_last_account");
 34 				}
 35 			}, {
 36 				widget: "unbind_account_from_mobile_group.start",
 37 				beforeAction: function() {
 38 					if ($we.process.getData("is_mobile_acc")) {
 39 						this.params.tips = "解绑手机后,该账号将不能使用手机号码"+$we.process.getData("group")+"作为账号名登录,同时失去G家提供的安全服务,请谨慎操作";
 40 					}
 41 					return true;
 42 				}
 43 			}, {
 44 				name: "验证账号信息",
 45 				widget: "bind_mobile",
 46 				params: {
 47 					verifyName: "group"
 48 				},
 49 				beforeAction: function() {
 50 					if ($we.process.getData("is_mobile_acc")) {
 51 						this.params.tips = '这是一个手机账号,继续操作将与手机'+$we.process.getData("group")+'解除绑定,请谨慎操作!';
 52 					} else {
 53 						this.params.tips = '账号 '+$we.process.getData("display_name")+' 将与手机'+$we.process.getData("group")+'解除绑定';
 54 					}					
 55 					this.params.extraData = {sdid: $we.process.getData("sdid")};
 56 					return true;
 57 				}
 58 			}, {
 59 				widget: "set_login_name",
 60 				params: {
 61 					title: "",
 62 					btmTips: ""
 63 				},
 64 				beforeAction: function() {
 65 					if (!$we.process.getData("need_alias")) {
 66 						return false;
 67 					} else {
 68 						this.params.tips = "解绑手机后,将不能再使用手机号码"+$we.process.getData("group")+"作为账号名登录,请设置新的登录名";
 69 						return true;
 70 					}
 71 				}
 72 			}, {
 73 				name: "解绑成功",
 74 				widget: "process.end",
 75 				params: {
 76 					title: "解绑手机成功!",
 77 					content: function() {
 78 						if ($we.process.getData("is_mobile_acc"))
 79 							return "现在您可以用新的账号名 "+$we.process.getData("alias")+" 登录了";
 80 						else
 81 							return "";
 82 					}
 83 				}
 84 			}],
 85 			config: {
 86 				flow: "unbindAccount",
 87 				title: "解绑账号"
 88 			},
 89 			data: ["group", "is_mobile_acc", "is_last_account", "display_name"]
 90 		};
 91 		
 92 		return $we.process.use;
 93 	}
 94 );