1 /**
  2  *
  3  * 从手机群解绑账号
  4  *
  5  * @fileOverView
  6  * @author  <a href="mailto:zhang.gd@foxmail.com">Zhang Guangda</a>
  7  * @date    2012-12-05
  8  */
  9 define(["core", "component/process_components"], function() {
 10 
 11 	var _startHtml = [
 12 			'<div attr="root" class="we_cell_func_intro">',				
 13 				'<img src="'+$we.conf.ENV.__STATIC+'/img/src/untie_pic.png?v='+$we.STATIC_VERSION+'">',
 14             	'<ul class="we_mt15">',
 15                 	'<li class="we_func_item">',
 16                     	'<h3 class="we_func_title"><i class="we_icon_key_login"></i>一键登录</h3>轻滑手机即可登录,安全又便捷',
 17                     '</li>',
 18                     '<li class="we_func_item">',
 19                     	'<h3 class="we_func_title"><i class="we_dyn_pwd"></i>动态密码</h3>会变的密码,让账户与消费更安心',
 20                     '</li>',
 21                     '<li class="we_func_item">',
 22                     	'<h3 class="we_func_title"><i class="we_safe_notice"></i>安全通知</h3>即时的账号、消费安全通知一手掌握',
 23                     '</li>',
 24                 '</ul>',
 25         	'</div>'
 26 		].join(""),
 27 		_startTips = "解绑手机后,该账号将不能使用G家提供的安全服务,请谨慎操作";
 28 
 29 	/**
 30 	 * 绑定手机组件
 31 	 * @lends  $we.widget.unbind_account_from_mobile_group.start
 32 	 */
 33 	$we.widget.reg("unbind_account_from_mobile_group.start", {
 34 		/**
 35 		 * @constructs
 36 		 */
 37 		init: function(el, params) {
 38 			this.el = el;
 39 			this.params = params || {};
 40 
 41 			this.params.tips = $we.utils.setValue(this.params.tips, _startTips);
 42 		},
 43 		/**
 44 		 * interfaces
 45 		 * @memberOf $we.widget.unbind_account_from_mobile_group.start#
 46 		 */
 47 		interfaces: {
 48 			/**
 49 			 * 渲染
 50 			 * @param  {Object} params 参数
 51 			 * @memberOf $we.widget.unbind_account_from_mobile_group.start#
 52 			 */
 53 			render: function(params) {
 54 				if (typeof params == "object") {
 55 					for (var i in params) {
 56 						this.params[i] = params[i];
 57 					}
 58 				}
 59 
 60 				this.tips = $we.widget.add("process.tips.small", this.el, {
 61 					content: this.params.tips
 62 				});
 63 
 64 				this.append(this.el, _startHtml);
 65 
 66 				this.notify("setButton", {cancel:true, next:"继续"});
 67 			}
 68 		},
 69 		/**
 70 		 * process
 71 		 * @memberOf $we.widget.unbind_account_from_mobile_group.start#
 72 		 */
 73 		process: {
 74 			start: function(params) {this.render(params); },
 75 			end: function() {$(this.node.root).remove(); this.tips && this.tips.remove(); },
 76 			checkSucc: function() {this.notify("goNext"); }
 77 		}
 78 	});
 79 
 80 	var _confirmHtml = [
 81 		'<div class="we_cell_status">',
 82 			'<p class="we_txt"><strong class="we_cell_title"><i class="we_icon_alert_b"></i>这是手机<span class="we_yellow"> $group$ </span>绑定的最后一个账号了,确认要继续解绑?</strong></p>',
 83 		'</div>',
 84 	    '<div class="we_cell_pic">',
 85 	        '<p class="we_bold_text">确认解绑点击继续,否则点击取消放弃操作</p>',
 86 	        '<img src="'+$we.conf.ENV.__STATIC+'/img/src/unbind_pic.png?v='+$we.STATIC_VERSION+'">',
 87 	    '</div>'
 88 		].join("");
 89 	
 90 	/**
 91 	 * 绑定手机组件
 92 	 * @lends  $we.widget.unbind_account_from_mobile_group.confirm
 93 	 */
 94 	$we.widget.reg("unbind_account_from_mobile_group.confirm", {
 95 		/**
 96 		 * @constructs
 97 		 */
 98 		init: function(el, params) {
 99 			this.el = el;
100 			this.params = params || {};
101 		},
102 		/**
103 		 * interfaces
104 		 * @memberOf $we.widget.unbind_account_from_mobile_group.confirm#
105 		 */
106 		interfaces: {
107 			/**
108 			 * 渲染
109 			 * @param  {Object} params 参数
110 			 * @memberOf $we.widget.unbind_account_from_mobile_group.confirm#
111 			 */
112 			render: function(params) {
113 				this.append(this.el, _confirmHtml, {
114 					group: $we.process.getData("group")
115 				});
116 
117 				this.notify("setButton", {cancel:true, next:"继续"});
118 				this.notify("hideProgressBar");
119 			}
120 		},
121 		/**
122 		 * process
123 		 * @memberOf $we.widget.unbind_account_from_mobile_group.confirm#
124 		 */
125 		process: {
126 			start: function(params) {this.render(params); },
127 			end: function() { this.notify("showProgressBar"); $(this.el).empty(); },
128 			checkSucc: function() {this.notify("goNext");}
129 		}
130 	});
131 
132 	return {
133 		start: $we.widget.amd("unbind_account_from_mobile_group.start"),
134 		confirm: $we.widget.amd("unbind_account_from_mobile_group.confirm")
135 	};
136 
137 });