# 用户

用户模块是众多模块里页面最多模块了,完整的用户中心足足有22个html模板,并且大部分还带接口交互,开发的工作量有点大,这也就解释了定做会员中心模板少则千把块多则好几千的价格了。

  • 文件目录 html/user/
  • 所属模型 model('User')
  • 模型mid 6,使用{$maccms.mid}标签即可获得当前模型mid值
  • 页面aid 6,用户中心所有页面的aid都为6
  • 当前用户数组 $obj 登录状态下在所有用户模块下都可以调用。如果用户中心以为使用则要以 $user开头 ,如用户名 {$user.user_name},只能非静态模式下兼容,纯静态模式建议通过js交互。

# 用户字段

  {$obj.user_id} 用户id
  {$obj.group_id} 用户组id
  {$obj.group.group_name} 用户组
  {$obj.user_name} 用户名称
  {$obj.user_nick_name} 用户昵称
  {$obj.user_qq} 绑定qq
  {$obj.user_email} 绑定邮箱
  {$obj.user_phone} 绑定手机
  {$obj.user_status} 用户状态
  {$obj.user_portrait} 用户头像
  {$obj.user_portrait_thumb} 小头像
  {$obj.user_openid_qq} 登录qq
  {$obj.user_openid_weixin} 登录微信
  {$obj.user_question} 保密问题
  {$obj.user_answer} 保密答案
  {$obj.user_points} 用户积分
  {$obj.user_points_froze} 冻结积分
  {$obj.user_reg_time} 注册时间
  {$obj.user_reg_ip} 注册IP
  {$obj.user_login_time} 登录时间
  {$obj.user_login_ip} 登录IP
  {$obj.user_last_login_time} 上次登录时间
  {$obj.user_last_login_ip}int(10) 上次登录IP
  {$obj.user_login_num} 登录次数
  {$obj.user_pid} 一级分销
  {$obj.user_pid_2} 二级分销
  {$obj.user_pid_3} 三级分销
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

TIP

非静态模式下,可获取到的当前登录用户的信息;用户中心里各个界面也可用以下参数{$obj.开头}

# 全局调用

   {$user.user_id} 用户编号
   {$user.user_name} 登录名
   {$user.user_nick_name} 昵称
   {$user.user_email} 邮箱
   {$user.user_qq}  QQ
   {$user.user_phone} 联系电话
   {$user.user_portrait}  头像
   {$user.user_points} 积分
   {$user.user_reg_time} 注册时间
   {$user.user_reg_ip} 注册ip
   {$user.user_login_time} 登录时间
   {$user.user_login_ip} 登录ip
   {$user.user_last_login_time} 上次登录时间
   {$user.user_last_login_ip} 上次登录ip
   {$user.user_login_num} 登录次数
   {$user.user_end_time} vip截止期限
   {$user.group_id}用户组编号
   ...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

# 用户登录

  • 文件目录 html/user/login.html

苹果CMSv10用户登录示例

<!-- 登录表单 -->
<form method="post" id="fm" action="">
   <h4>账户信息</h4>
   <div class="group">
      <label >账号</label>
      <input type="text" id="user_name" name="user_name"  placeholder="请输入您的登录账号">
   </div>
   <div class="group">
      <label>密码</label>
      <input type="password" id="user_pwd" name="user_pwd"  placeholder="请输入您的登录密码">
   </div>
   {if condition="$GLOBALS['config']['user']['login_verify'] eq 1"}
   <div class="group">
      <label>验证码</label>
      <input type="text" id="verify" name="verify" placeholder="请输入验证码">
      <img id="verify_img" src="{:url('verify/index')}" onClick="this.src=this.src+'?'"  alt="单击刷新" />
   </div>
   {/if}
   <input type="button" id="btn_submit"  value="立即登录">
</form>

<script type="text/javascript">
	$(function(){
		$("body").bind('keyup',function(event) {
			if(event.keyCode==13){ $('#btnLogin').click(); }
		});
		$('#btn_submit').click(function() {
			if ($('#user_name').val()  == '') { alert('请输入用户!'); $("#user_name").focus(); return false; }
			if ($('#user_pwd').val()  == '') { alert('请输入密码!'); $("#user_pwd").focus(); return false; }
			if ($('#verify').length> 0 && $('#verify').val()  == '') { alert('请输入验证码!'); $("#verify").focus(); return false; }
			$.ajax({
				url: "{:url('user/login')}",
				type: "post",
				dataType: "json",
				data: $('#fm').serialize(),
				beforeSend: function () {
					$("#btn_submit").css("background","#fd6a6a").val("loading...");
				},
				success: function (r) {
					if(r.code==1){
						location.href="{:url('user/index')}";
					}
					else{
						alert(r.msg);
						$('#verify_img').click();
					}
				},
				complete: function () {
					$("#btn_submit").css("background","#fa4646").val("立即登录");
				}
			});
		});
	});
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54

# 用户注册

  • 文件目录 html/user/reg.html

苹果CMSv10用户注册完整示例

<form method="post" id="fm" action="">
   <h4>用户注册</h4>
   <div class="reg-group">
      <label>账号</label>
      <input type="text" id="user_name" name="user_name"  placeholder="请输入您的登录账号">
   </div>
   <div class="reg-group">
      <label>密码</label>
      <input type="password" id="user_pwd" name="user_pwd"  placeholder="请输入您的登录密码">
   </div>
   <div class="reg-group">
      <label>确认密码</label>
      <input type="password" id="user_pwd2" name="user_pwd2"  placeholder="请输入您的确认密码">
   </div>
   <!-- 判断后台是否开启手机注册 -->
   {if condition="$user_config.reg_phone_sms neq 0"}
   <input type="hidden" name="ac" value="phone">
   <div class="reg-group">
      <label>手机号码</label>
      <input type="text" id="to" name="to" placeholder="请输入手机号">
      <input type="button" class="fr mr10 mt10" id="btn_send_sms" value="获取验证码"/>
   </div>
   <div class="reg-group">
      <label>手机验证码</label>
      <input type="text" id="code" name="code" placeholder="请输入验证码">
   </div>
   <!-- 判断后台是否开启邮箱注册 -->
   {elseif condition="$user_config.reg_email_sms neq 0"}
   <input type="hidden" name="ac" value="email">
   <div class="reg-group">
      <label>邮箱地址</label>
      <input type="text" id="to" name="to" placeholder="请输入邮箱">
      <input type="button" class="fr mr10 mt10" id="btn_send_sms" value="获取验证码"/>
   </div>
   <div class="reg-group">
      <label>邮箱验证码</label>
      <input type="text" id="code" name="code" placeholder="请输入验证码">
   </div>
   {/if}
   <!-- 判断后台是否开始注册验证码 -->
   {if condition="$user_config.reg_verify neq 0"}
   <div class="reg-group">
      <label>验证码</label>
      <input type="text" id="verify" name="verify" placeholder="请输入验证码">
      <img class="fr mr10 mt10" id="verify_img" src="{:url('verify/index')}" onClick="this.src=this.src+'?'"  alt="单击刷新" />
   </div>
   {/if}
   <input type="button" id="btn_submit" class="btn-brand btn-sub" value="立即注册">
</form>

<script type="text/javascript">
    var countdown=60;
    function settime(val) {
        if (countdown == 0) {
            val.removeAttribute("disabled");
            val.value="获取验证码";
            countdown = 60;
            return true;
        } else {
            val.setAttribute("disabled", true);
            val.value="重新发送(" + countdown + ")";
            countdown--;
        }
        setTimeout(function() {settime(val) },1000)
    }
		$("body").bind('keyup',function(event) {
			if(event.keyCode==13){ $('#btnLogin').click(); }
		});

        $('#btn_send_sms').click(function(){
            var ac = $('input[name="ac"]').val();
            var to = $('input[name="to"]').val();
            if(ac=='email') {
                var pattern = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
                var ex = pattern.test(to);
                if (!ex) {
                    alert('邮箱格式不正确');
                    return;
                }
            }
            else if(ac=='phone') {
                var pattern=/^[1][0-9]{10}$/;
                var ex = pattern.test(to);
                if (!ex) {
                    alert('手机号格式不正确');
                    return;
                }
            }
            else{
                alert('参数错误');
                return;
            }

            settime(this);
            var data = $("#fm").serialize();

            $.ajax({
                url: "{:url('user/reg_msg')}",
                type: "post",
                dataType: "json",
                data: data,
                beforeSend: function () {
                    //开启loading
                },
                success: function (r) {
                    alert(r.msg);
                },
                complete: function () {
                    //结束loading
                }
            });
        });

		$('#btn_submit').click(function() {
			if ($('#user_name').val()  == '') { alert('请输入用户!'); $("#user_name").focus(); return false; }
			if ($('#user_pwd').val()  == '') { alert('请输入密码!'); $("#user_pwd").focus(); return false; }
			if ($('#verify').val()  == '') { alert('请输入验证码!'); $("#verify").focus(); return false; }

			$.ajax({
				url: "{:url('user/reg')}",
				type: "post",
				dataType: "json",
				data: $('#fm').serialize(),
				beforeSend: function () {
					$("#btn_submit").css("background","#fd6a6a").val("loading...");
				},
				success: function (r) {
					alert(r.msg);
					if(r.code==1){
						// location.href="{:url('user/login')}";
					}
					else{
						$('#verify_img').click();
					}
				},
				complete: function () {
					$("#btn_submit").css("background","#fa4646").val("立即注册");
				}
			});
		});
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141

# 用户中心

  • 文件目录 html/user/index.html

用户中心常用示例

<div class="cur">
   <p><span >用户名:</span>{$obj.user_name}</p>
   <p><span >所属会员组:</span>{$obj.group.group_name}</p>
   <p><span >会员期限:</span>{$obj.user_end_time|mac_day}</p>
   <p><span >QQ号码:</span>{$obj.user_qq}</p>
   <p><span >Email地址:</span>{$obj.user_email}</p>
   <p><span >注册时间:</span>{$obj.user_reg_time|mac_day}</p>
   <p><span >登陆IP:</span>{$obj.user_login_ip|long2ip}</p>
   <p><span >登陆时间:</span>{$obj.user_login_time|mac_day}</p>
   <p><span >账户积分:</span>{$obj.user_points}</p>
   {if $GLOBALS['config']['user']['invite_reg_points'] gt 0}
   <p><span >推广注册链接:</span>
      <input id="url"  value="{$maccms.http_type}{$maccms.site_url}{:mac_url('user/reg')}?uid={$obj.user_id}" size="70" style="width:500px;">
   </p>
   {/if}
   {if $GLOBALS['config']['user']['invite_visit_points'] gt 0}
   <p><span >推广访问链接:</span>
      <input id="url2"  value="{$maccms.http_type}{$maccms.site_url}{:mac_url('user/visit')}?uid={$obj.user_id}" size="70" style="width:500px;">
   </p>
   {/if}
</div>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

# 修改信息

  • 文件目录 html/user/info.html

苹果CMSv10用户修改信息表单示例

<form id="fm" name="fm" method="post" action="" >
   <p><span >用户名:</span>{$obj.user_name}</p>
   <p><span >昵称:</span><input type="text" name="user_nick_name"  value="{$obj.user_nick_name}"></p>
   <p><span >原始密码:</span><input type="password" name="user_pwd" ></p>
   <p><span >新密码:</span><input type="password" name="user_pwd1" ><span class="tishi">不修改请留空</span></p>
   <p><span >重复密码:</span><input type="password" name="user_pwd2" ></p>
   <p><span >QQ号码:</span><input type="text" name="user_qq"  value="{$obj.user_qq}"></p>
   {if condition="$obj.user_email neq ''"}
      <p><span >邮箱:</span><input type="text" name="user_email"  readonly="readonly" value="{$obj.user_email}">[<a class="btn_unbind" ac="email" href="javascript:;">解绑</a>]</p>
   {else/}
      <p><span >邮箱:</span><input type="text" name="user_email"  value="">[<a href="{:url('user/bind')}?ac=email">绑定</a>]</p>
   {/if}

   {if condition="$obj.user_phone neq ''"}
   <p><span >手机:</span><input type="text" name="user_phone"  readonly="readonly" value="{$obj.user_phone}">[<a class="btn_unbind" ac="phone" href="javascript:;">解绑</a>]</p>
   {else/}
   <p><span >手机:</span><input type="text" name="user_phone"  value="">[<a href="{:url('user/bind')}?ac=phone">绑定</a>]</p>
   {/if}

   <p><span >找回密码问题:</span><input type="text" name="user_question"  value="{$obj.user_question}"></p>
   <p><span >找回密码答案:</span><input type="text" name="user_answer"  value="{$obj.user_answer}"></p>
   <p><span ></span><input type="button" id="btn_submit" class="search-button" value="保存">
   <span class="wjmm"><a href="{:url('user/findpass')}">忘记密码了?</a></span></p>
</form>

<script type="text/javascript">
	$('.btn_unbind').click(function(){
		var ac = $(this).attr('ac');
		if(ac!='email' && ac!='phone'){
			alert('参数错误');
		}
		if(confirm('确认解除绑定吗?此操作不可恢复?')) {
			$.ajax({
				url: "{:url('user/unbind')}",
				type: "post",
				dataType: "json",
				data: {ac: ac},
				beforeSend: function () {
					//开启loading
				},
				success: function (r) {
					alert(r.msg);
					if(r.code==1){
						location.href="{:url('user/info')}";
					}
				},
				complete: function () {
					//结束loading
				}
			});
		}
	});

	$("#btn_submit").click(function() {
		var data = $("#fm").serialize();
		$.ajax({
			url: "{:url('user/info')}",
			type: "post",
			dataType: "json",
			data: data,
			beforeSend: function () {
				//开启loading
				//$(".loading_box").css("display","block");
				$("#btn_submit").css("background","#fd6a6a").val("loading...");
			},
			success: function (r) {
				alert(r.msg);
				if(r.code==1){
					location.href="{:url('user/info')}";
				}
			},
			complete: function () {
				//结束loading
				//$(".loading_box").css("display","none");
				$("#btn_submit").css("background","#fa4646").val("提交");
			}
		});
	});
</script>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80

# 用户权限

  • 文件目录 html/user/popedom.html
  • 权限列表(数组) $type_tree

苹果CMS列出当前用户所有权限示例

{volist name="type_tree" id="vo"}
   <p>
   <span class="quanxian">{$vo.type_name}</span>
   {foreach name="$vo.popedom" id="v2"}
      {if condition="$v2 eq 1"}
         <span class="you">{$key}</span>
      {else}
         <span class="wu">{$key}</span>
      {/if}
   {/foreach}
   </p>
   <p>
   <!-- 子分类权限 -->
   {volist name="vo.child" id="child"}
      <span class="quanxian">{$child.type_name}</span>
      {foreach name="$child.popedom" id="v2"}
         {if condition="$v2 eq 1"}
            <span class="you">{$key}</span>
         {else}
            <span class="wu">{$key}</span>
         {/if}
      {/foreach}
      </p>
   {/volist}
{/volist}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

# 我的播放

  • 文件目录 html/user/plays.html
  • 数据列表(数组) $list使用volist进行遍历

苹果CMS列出用户播放记录示例

<table width="770" border="0" cellspacing="1" cellpadding="0" class="table">
   <tr>
      <td width="66" height="36" align="center" valign="middle" bgcolor="#f7f7f7">选择</td>
      <td width="80" align="center" valign="middle" bgcolor="#f7f7f7">编号</td>
      <td width="317" align="center" valign="middle" bgcolor="#f7f7f7">名称</td>
      <td width="120" align="center" valign="middle" bgcolor="#f7f7f7">进度</td>
      <td width="100" align="center" valign="middle" bgcolor="#f7f7f7">消费积分</td>
      <td width="80" align="center" valign="middle" bgcolor="#f7f7f7">操作</td>
   </tr>
   <form id="form1" name="form1" method="post">
      {volist name="list" id="vo"}
      <tr>
         <td height="36" align="center" valign="middle" bgcolor="#FFFFFF"><input name="ids[]" type="checkbox" value="{$vo.ulog_id}"></td>
         <td align="center" valign="middle" bgcolor="#FFFFFF">{$vo.ulog_id}</td>
         <td align="left" valign="middle" bgcolor="#FFFFFF" class="pad">[{$vo.data.type.type_name}] {$vo.data.name} [{$vo.ulog_rid}-{$vo.ulog_sid}-{$vo.ulog_nid}]</td>
         <td align="center" valign="middle" bgcolor="#FFFFFF"><a target="_blank" href="{$vo.data.link}" class="fen">重新观看</a></td>
         <td align="center" valign="middle" bgcolor="#FFFFFF">{$vo.ulog_points}</td>
         <td align="center" valign="middle" bgcolor="#FFFFFF"><a href="javascript:;" onclick="delData({$vo.ulog_id})" class="delete">删除</a></td>
      </tr>
      {/volist}
   </form>
</table>
<!-- 删除记录脚本 -->
<script>
	function delData(ids,all){
		var msg ='删除';
		if(all==1){
			msg='清空';
		}
		if(confirm('确定要'+msg+'记录吗')){
			$.post("{:url('user/ulog_del')}",{ids:ids,type:4,all:all},function(data) {
				if (data.code == '1') {
					alert('删除成功');
					location.reload();
				}else {
					alert('删除失败:' + data.msg);
				}
			}, 'json')
		}
	}
	$("#btnClear").click(function(){
		delData('',1);
	});
	$("#btnDel").click(function(){
		var ids = MAC.CheckBox.Ids('ids[]');
		if(ids==''){
			alert("请至少选择一个数据");
			return;
		}
		delData(ids,0);
	});
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52

# 我的下载

  • 文件目录 html/user/downs.html
  • 数据列表(数组) $list使用volist进行遍历

苹果CMS列出用户下载记录示例

<table width="770" border="0" cellspacing="1" cellpadding="0" class="table">
   <tr>
      <td width="66" height="36" align="center" valign="middle" bgcolor="#f7f7f7">选择</td>
      <td width="80" align="center" valign="middle" bgcolor="#f7f7f7">编号</td>
      <td width="317" align="center" valign="middle" bgcolor="#f7f7f7">名称</td>
      <td width="120" align="center" valign="middle" bgcolor="#f7f7f7">进度</td>
      <td width="100" align="center" valign="middle" bgcolor="#f7f7f7">消费积分</td>
      <td width="80" align="center" valign="middle" bgcolor="#f7f7f7">操作</td>
   </tr>
   <form id="form1" name="form1" method="post">
      {volist name="list" id="vo"}
      <tr>
			<td height="36" align="center" valign="middle" bgcolor="#FFFFFF"><input name="ids[]" type="checkbox" value="{$vo.ulog_id}"></td>
			<td align="center" valign="middle" bgcolor="#FFFFFF">{$vo.ulog_id}</td>
			<td align="left" valign="middle" bgcolor="#FFFFFF" class="pad">[{$vo.data.type.type_name}] {$vo.data.name} [{$vo.ulog_rid}-{$vo.ulog_sid}-{$vo.ulog_nid}]</td>
			<td align="center" valign="middle" bgcolor="#FFFFFF"><a href="{$vo.data.link}" class="fen">重新下载</a></td>
			<td align="center" valign="middle" bgcolor="#FFFFFF">{$vo.ulog_points}</td>
			<td align="center" valign="middle" bgcolor="#FFFFFF"><a href="" class="delete">删除</a></td>
		  </tr>
      {/volist}
   </form>
</table>
<!-- 删除记录脚本 -->
<script>
	function delData(ids,all){
		var msg ='删除';
		if(all==1){
			msg='清空';
		}
		if(confirm('确定要'+msg+'记录吗')){
			$.post("{:url('user/ulog_del')}",{ids:ids,type:5,all:all},function(data) {
				if (data.code == '1') {
					alert('删除成功');
					location.reload();
				}else {
					alert('删除失败:' + data.msg);
				}
			}, 'json')
		}
	}
	$("#btnClear").click(function(){
		delData('',1);
	});
	$("#btnDel").click(function(){
		var ids = MAC.CheckBox.Ids('ids[]');
		if(ids==''){
			alert("请至少选择一个数据");
			return;
		}
		delData(ids,0);
	});
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52

# 我的收藏

  • 文件目录 html/user/favs.html
  • 数据列表(数组) $list使用volist进行遍历 苹果CMS列出用户下载记录示例
<table width="770" border="0" cellspacing="1" cellpadding="0" class="table">
   <tr>
      <td width="66" height="36" align="center" valign="middle" bgcolor="#f7f7f7">选择</td>
      <td width="80" align="center" valign="middle" bgcolor="#f7f7f7">编号</td>
      <td width="317" align="center" valign="middle" bgcolor="#f7f7f7">名称</td>
      <td width="120" align="center" valign="middle" bgcolor="#f7f7f7">进度</td>
      <td width="100" align="center" valign="middle" bgcolor="#f7f7f7">消费积分</td>
      <td width="80" align="center" valign="middle" bgcolor="#f7f7f7">操作</td>
   </tr>
   <form id="form1" name="form1" method="post">
      {volist name="list" id="vo"}
      	{if condition="$vo.ulog_mid eq 1"}
         <tr>
            <td height="36" align="center" valign="middle" bgcolor="#FFFFFF">
            <input type="checkbox" name="ids[]" id="checkbox" value="{$vo.ulog_id}"/></td>
            <td align="center" valign="middle" bgcolor="#FFFFFF">{$vo.ulog_id}</td>
            <td align="left" valign="middle" bgcolor="#FFFFFF" class="pad">
               {if condition="$vo.ulog_mid eq 1"}
               <a target="_blank" href="{$vo.data.link}">[{$vo.data.type.type_name}] {$vo.data.name}</a>
               {elseif condition="$vo.ulog_mid eq 2"}
               <a target="_blank" href="{$vo.data.link}">[{$vo.data.type.type_name}] {$vo.data.name}</a>
               {elseif condition="$vo.ulog_mid eq 3"}
               <a target="_blank" href="{$vo.data.link}">{$vo.data.name}</a>
               {/if}
            </td>
            <td align="center" valign="middle" bgcolor="#FFFFFF"><a href="javascript:;" onclick="delData({$vo.ulog_id},0)" class="delete">删除</a></td>
         </tr>
		  {/if}
      {/volist}
   </form>
</table>
<!-- 删除记录脚本 -->
<script>
	function delData(ids,all){
		var msg ='删除';
		if(all==1){
			msg='清空';
		}
		if(confirm('确定要'+msg+'记录吗')){
			$.post("{:url('user/ulog_del')}",{ids:ids,type:2,all:all},function(data) {
				if (data.code == '1') {
					alert('删除成功');
					location.reload();
				}else {
					alert('删除失败:' + data.msg);
				}
			}, 'json')
		}
	}
	$("#btnClear").click(function(){
		delData('',1);
	});
	$("#btnDel").click(function(){
		var ids = MAC.CheckBox.Ids('ids[]');
		if(ids==''){
			alert("请至少选择一个数据");
			return;
		}
		delData(ids,0);
	});
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61

# 在线充值

  • 文件目录 html/user/buy.html

苹果CMS在线充值表单示例

<div class="line40">
   <p>充值的金额:<input type="text" name="price" value="{$config.min}" class="jifen-input"></p>
   <p><input type="button" id="btn_submit_pay" class="jifen2-button" value="确认"></p>
   <p class="hui">友情提示:最小充值金额为{$config.min}元,1元可以兑换{$config.scale}个积分</p>
</div>

<script>
   
	$('#btn_submit_pay').click(function(){
		var that=$(this);
		var price = $("input[name='price']").val();
		if(Number(price)<1){
			return;
		}
		if(confirm('确定要在线充值吗')) {
			$.ajax({
				url: "{:url('user/buy')}",
				type: "post",
				dataType: "json",
				data: {price: price,flag:'pay'},
				beforeSend: function () {
					$("#btn_submit_pay").css("background","#fd6a6a").val("loading...");
				},
				success: function (r) {
					if (r.code == 1) {
                  //生成订单后跳转支付页面
						location.href="{:url('user/pay')}?order_code=" + r.data.order_code;
					}
					else{
						alert(r.msg);
					}
				},
				complete: function () {
					$("#btn_submit_pay").css("background","#fa4646").val("提交");
				}
			});
		}
	});

</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

苹果CMS卡密充值表单示例

<div class="line40">
   <p>充值卡号:<input type="text" name="card_no" value="" class="jifen-input">
      {if condition="$GLOBALS['config']['pay']['card']['url'] neq ''"}
      <a target="_blank" href="{$GLOBALS['config']['pay']['card']['url']}">点击购买卡密</a>
      {/if}
   </p>
   <p>充值密码:<input type="text" name="card_pwd" value="" class="jifen-input"></p>
   <p><input type="button" id="btn_submit_card" class="jifen2-button" value="确认"></p>
   <p class="hui">友情提示:请到卡密平台购买充值卡</p>
</div>

<script>
   $('#btn_submit_card').click(function(){
		var that=$(this);
		var no = $('input[name="card_no"]').val();
		var pwd = $('input[name="card_pwd"]').val();
		if(no=='' || pwd==''){
			alert('请输入充值卡号和密码');
			return;
		}
		if(confirm('确定要使用充值卡充值吗')) {
			$.ajax({
				url: "{:url('user/buy')}",
				type: "post",
				dataType: "json",
				data: {card_no: no,card_pwd:pwd,flag:'card'},
				beforeSend: function () {
					$("#btn_submit_card").css("background","#fd6a6a").val("loading...");
				},
				success: function (r) {
					alert(r.msg);
				},
				complete: function () {
					$("#btn_submit_card").css("background","#fa4646").val("提交");
				}
			});
		}
	});
</script>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

# 支付页面

  • 文件目录 html/user/pay.html

在用确认在线充值后并且已生成订单后跳转到该页面

苹果CMS支付页表单示例

<form method="post" target="_blank" action="{:url('user/gopay')}">
   <input type="hidden" name="order_id" value="{$info.order_id}">
   <input type="hidden" name="order_code" value="{$info.order_code}">
   <div class="line40">
      <p><span class="xiang">订单编号:</span>{$info.order_code}</p>
      <p><span class="xiang">订单金额:</span>{$info.order_price}元</p>
      <p>
         <span class="xiang">支付方式:</span>
         <select name="payment" id="payment">
            <option value ="">请选择...</option>
            {volist name="ext_list" id="vo"}
            <option value="{$key}">{$vo}支付</option>
            {/volist}
         </select>
      </p>

      <p class="info-item" id="paytype_box" style="display:none;">
         <span class="xiang">支付类型:</span>
         <select class="paytype" id="paytype" name="paytype">
         </select>
      </p>

      <p><input type="submit" id="btn_submit" class="jifen2-button" value="确认"></p>
   </div>
</form>

<script>
	var codepay_type = '{maccms:foreach name=":explode(',',$config.codepay.type)"}<option value ="{$vo}">{if condition="$vo==1"}支付宝二维码{elseif condition="$vo==2"/}QQ钱包二维{elseif condition="$vo==3"/}微信二维码{/if}</option>{/maccms:foreach}';
	var zhapay_type ='{maccms:foreach name=":explode(',',$config.zhapay.type)"}<option value ="{$vo}">{if condition="$vo==1"}微信{elseif condition="$vo==2"/}支付宝{/if}</option> {/maccms:foreach}';
 
	$("#payment").change(function() {
		$('#paytype').html('');
		if($("#payment").val()=="codepay" || $("#payment").val()=="zhapay" || $("#payment").val()=="Pkfaka"){
			if($("#payment").val()=="codepay") {
				$('#paytype').html(codepay_type);
			}
			if($("#payment").val()=="zhapay") {
				$('#paytype').html(zhapay_type);
			}
         
			$("#paytype_box").slideDown();
		}
		else{
			$("#paytype_box").slideUp();
		}
	});

	$(".paytype").change(function() {
		$('#paytype').val( $(this).val() );
	});
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51

# 微信充值

  • 文件目录 html/user/payment_weixin.html

当用户选择微信支付是会跳转到该页面进行扫码确认

苹果CMS微信支付示例

<form method="post" target="_blank" action="{:url('user/gopay')}">
   <input type="hidden" name="order_id" value="{$info.order_id}">
   <input type="hidden" name="order_code" value="{$info.order_code}">
   <div class="line40">
      <p><span class="xiang">订单编号:</span>{$order.order_code}</p>
      <p><span class="xiang">订单金额:</span>{$order.order_price}元</p>
      <p><img src="{:url('user/qrcode')}?data={$payment.code_url|urlencode}" width="150" height="150"/></p>
      <p>打开微信,扫码支付</p>
   </div>
</form>

<script>
	function check(){
		$.get("{:url('user/order_info')}" + '?order_id={$order.order_id}', function(data){
			if(data.info.order_status == 1){
				alert('支付完成,即将跳转到会员中心');
				window.location.href = "{:url('user/index')}";
			}
		});
	}
	$(function(){
		setInterval(function(){check()}, 5000);  //5秒查询一次支付是否成功
	})
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

# 订单记录

查看充值订单记录,未支付的订单可以从这个页面再次发动支付!

  • 文件目录 html/user/orders.html
  • 数据列表(数组) $list使用volist进行遍历

苹果CMS获取用户充值订单记录示例

<table width="870" border="0" cellspacing="1" cellpadding="0" class="table">
   <tr>
   <td width="66" height="36" align="center" valign="middle" bgcolor="#f7f7f7">选择</td>
   <td width="60" align="center" valign="middle" bgcolor="#f7f7f7">编号</td>
   <td width="300" align="center" valign="middle" bgcolor="#f7f7f7">单号</td>
   <td width="60" align="center" valign="middle" bgcolor="#f7f7f7">状态</td>
      <td width="60" align="center" valign="middle" bgcolor="#f7f7f7">金额</td>
      <td width="60" align="center" valign="middle" bgcolor="#f7f7f7">积分</td>
   <td width="150" align="center" valign="middle" bgcolor="#f7f7f7">时间</td>
   <td width="80" align="center" valign="middle" bgcolor="#f7f7f7">操作</td>
   </tr>
   {volist name="list" id="vo"}
   <tr>
      <td height="36" align="center" valign="middle" bgcolor="#FFFFFF"><input name="ids[]" type="checkbox" value="{$vo.order_id}"></td>
      <td align="center" valign="middle" bgcolor="#FFFFFF">{$vo.order_id}</td>
      <td align="left" valign="middle" bgcolor="#FFFFFF" class="pad">{$vo.order_code}</td>
      <td align="center" valign="middle" bgcolor="#FFFFFF">{if condition="$vo.order_status eq 1"}已支付{else}未支付{/if}</td>
      <td align="center" valign="middle" bgcolor="#FFFFFF">{$vo.order_price}</td>
         <td align="center" valign="middle" bgcolor="#FFFFFF">{$vo.order_points}</td>
         <td align="center" valign="middle" bgcolor="#FFFFFF">{$vo.order_time|mac_day}</td>
      <td align="center" valign="middle" bgcolor="#FFFFFF">{if condition="$vo.order_status eq 0"}<a href="{:url('user/pay')}?order_code={$vo.order_code}" class="delete">支付</a>{/if}</td>
   </tr>
   {/volist}
</table>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

# 卡密记录

列出用户使用过的充值卡号和充值日期

  • 文件目录 html/user/cards.html
  • 数据列表(数组) $list使用volist进行遍历

苹果CMS获取用户卡密充值记录示例

<table width="870" border="0" cellspacing="1" cellpadding="0" class="table">
   <tr>
      <td width="66" height="36" align="center" valign="middle" bgcolor="#f7f7f7">选择</td>
      <td width="60" align="center" valign="middle" bgcolor="#f7f7f7">编号</td>
      <td width="300" align="center" valign="middle" bgcolor="#f7f7f7">卡号</td>
      <td width="60" align="center" valign="middle" bgcolor="#f7f7f7">面值</td>
      <td width="60" align="center" valign="middle" bgcolor="#f7f7f7">积分</td>
      <td width="150" align="center" valign="middle" bgcolor="#f7f7f7">使用时间</td>
      <td width="80" align="center" valign="middle" bgcolor="#f7f7f7">操作</td>
   </tr>
   {volist name="list" id="vo"}
   <tr>
      <td height="36" align="center" valign="middle" bgcolor="#FFFFFF"><input name="ids[]" type="checkbox" value="{$vo.card_id}"></td>
      <td align="center" valign="middle" bgcolor="#FFFFFF">{$vo.card_id}</td>
      <td align="left" valign="middle" bgcolor="#FFFFFF" class="pad">{$vo.card_no}</td>
      <td align="center" valign="middle" bgcolor="#FFFFFF">{$vo.card_money}</td>
      <td align="center" valign="middle" bgcolor="#FFFFFF">{$vo.card_points}</td>
      <td align="center" valign="middle" bgcolor="#FFFFFF">{$vo.card_use_time|mac_day}</td>
      <td align="center" valign="middle" bgcolor="#FFFFFF"></td>
   </tr>
   {/volist}
</table>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

# 积分记录

  • 文件目录 html/user/plog.html
  • 数据列表(数组) $list使用volist进行遍历

苹果CMS获取用户积分变动记录示例

<table width="770" border="0" cellspacing="1" cellpadding="0" class="table">
   <tr>
      <td width="66" height="36" align="center" valign="middle" bgcolor="#f7f7f7">选择</td>
      <td width="80" align="center" valign="middle" bgcolor="#f7f7f7">编号</td>
      <td width="100" align="center" valign="middle" bgcolor="#f7f7f7">分类</td>
      <td width="100" align="center" valign="middle" bgcolor="#f7f7f7">积分</td>
      <td width="140" align="center" valign="middle" bgcolor="#f7f7f7">时间</td>
      <td width="80" align="center" valign="middle" bgcolor="#f7f7f7">操作</td>
   </tr>
   <form id="form1" name="form1" method="post">
      {volist name="list" id="vo"}
      <tr>
         <td height="36" align="center" valign="middle" bgcolor="#FFFFFF">
         <input type="checkbox" name="ids[]" id="checkbox" value="{$vo.plog_id}"/></td>
         <td align="center" valign="middle" bgcolor="#FFFFFF">{$vo.plog_id}</td>
         <td align="center" valign="middle" bgcolor="#FFFFFF">{$vo.plog_type|mac_get_plog_type_text}</td>
         <td align="center" valign="middle" bgcolor="#FFFFFF">{if condition="in_array($vo.plog_type,[1,2,3,4])"}+{else/}-{/if}{$vo.plog_points}</td>
            <td align="center" valign="middle" bgcolor="#FFFFFF">{$vo.plog_time|mac_day}</td>
         <td align="center" valign="middle" bgcolor="#FFFFFF"><a href="javascript:;" onclick="delData({$vo.plog_id},0)" class="delete">删除</a></td>
      </tr>
      {/volist}
   </form>
</table>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

# 提现记录

  • 文件目录 html/user/cash.html
  • 数据列表(数组) $list使用volist进行遍历

苹果CMS积分提表单现示例

<form id="fm" name="fm" method="post" action="" >
   <p>1元等于{$GLOBALS['config']['user']['cash_ratio']}积分,最低提现金额:{$GLOBALS['config']['user']['cash_min']}元</p>
   <p>剩余{$GLOBALS['user']['user_points']}积分,相当于{$GLOBALS['user']['user_points']/$GLOBALS['config']['user']['cash_ratio']}元;冻结{$GLOBALS['user']['user_points_froze']}积分,相当于{$GLOBALS['user']['user_points_froze']/$GLOBALS['config']['user']['cash_ratio']}元;</p>

   银行名称:<input type="text" name="cash_bank_name"  placeholder="请输入开户行名称或支付宝微信" value="">
   银行账号:<input type="text" name="cash_bank_no" placeholder="请输入银行卡号或支付宝微信账号"  value="">

   收款姓名:<input type="text" name="cash_payee_name"  placeholder="请输入收款人姓名与上方账户对应"  value="">提现金额:<input type="text" name="cash_money"  placeholder="请输入提现金额"  value="">
   <input type="button" id="btn_submit"  value="提交" style="margin: 5px;">
</form>

<script>
$("#btn_submit").click(function() {
   var cash_bank_name = $('input[name="cash_bank_name"]').val();
   if(cash_bank_name==''){
      alert('请输入银行名称');
      return;
   }
   var cash_bank_no = $('input[name="cash_bank_no"]').val();
   if(cash_bank_no==''){
      alert('请输入银行账户');
      return;
   }
   var cash_payee_name = $('input[name="cash_payee_name"]').val();
   if(cash_payee_name==''){
      alert('请输入收款人姓名');
      return;
   }
   var cash_money = $('input[name="cash_money"]').val();
   if(cash_money==''){
      alert('请输入提现金额');
      return;
   }
   var data = $("#fm").serialize();
   $.ajax({
      url: "{:url('user/cash')}",
      type: "post",
      dataType: "json",
      data: data,
      beforeSend: function () {
            //开启loading
            //$(".loading_box").css("display","block");
            $("#btn_submit").css("background","#fd6a6a").val("loading...");
      },
      success: function (r) {
            alert(r.msg);
            if(r.code==1){
               location.href="{:url('user/cash')}";
            }
      },
      complete: function () {
            //结束loading
            //$(".loading_box").css("display","none");
            $("#btn_submit").css("background","#fa4646").val("提交");
      }
   });
});
</script>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59

苹果CMS获取用户提现记录示例


<table width="770" border="0" cellspacing="1" cellpadding="0" class="table">
   <tr>
      <td width="66" height="36" align="center" valign="middle" bgcolor="#f7f7f7">选择</td>
      <td width="80" align="center" valign="middle" bgcolor="#f7f7f7">编号</td>
      <td width="100" align="center" valign="middle" bgcolor="#f7f7f7">提现积分</td>
      <td width="100" align="center" valign="middle" bgcolor="#f7f7f7">提现金额</td>
      <td width="100" align="center" valign="middle" bgcolor="#f7f7f7">状态</td>
      <td width="140" align="center" valign="middle" bgcolor="#f7f7f7">时间</td>
      <td width="80" align="center" valign="middle" bgcolor="#f7f7f7">操作</td>
   </tr>
   <form id="form1" name="form1" method="post">
      {volist name="list" id="vo"}
      <tr>
         <td height="36" align="center" valign="middle" bgcolor="#FFFFFF">
         <input type="checkbox" name="ids[]" id="checkbox" value="{$vo.cash_id}"/></td>
         <td align="center" valign="middle" bgcolor="#FFFFFF">{$vo.cash_id}</td>
         <td align="center" valign="middle" bgcolor="#FFFFFF">{$vo.cash_points}</td>
         <td align="center" valign="middle" bgcolor="#FFFFFF">{$vo.cash_money}</td>
         <td align="center" valign="middle" bgcolor="#FFFFFF">{if condition="$vo.cash_status eq '1'"}已审核{else/}未审核{/if}</td>
         <td align="center" valign="middle" bgcolor="#FFFFFF">{$vo.cash_time|mac_day}</td>
         <td align="center" valign="middle" bgcolor="#FFFFFF"><a href="javascript:;" onclick="delData({$vo.cash_id},0)" class="delete">删除</a></td>
      </tr>
      {/volist}
   </form>
</table>

<script>
   	function delData(ids,all){
		var msg ='删除';
		if(all==1){
			msg='清空';
		}
		if(confirm('确定要'+msg+'记录吗')){
			$.post("{:url('user/cash_del')}",{ids:ids,all:all},function(data) {
				if (data.code == '1') {
					alert('删除成功');
					location.reload();
				}else {
					alert('删除失败:' + data.msg);
				}
			}, 'json')
		}
	}
	$("#btnClear").click(function(){
		delData('',1);
	});
	$("#btnDel").click(function(){
		var ids = MAC.CheckBox.Ids('ids[]');
		if(ids==''){
			alert("请至少选择一个数据");
			return;
		}
		delData(ids,0);
	});
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

# 分销记录

  • 文件目录 html/user/reward.html
  • 数据列表(数组) $list使用volist进行遍历

苹果CMS三级分销代码示例

<ul class="fn-clear">
   {if condition="$param.level eq ''"}
      <li class="cur">一级下线</li>
   {else/}
      <li><a href="{:url('user/reward')}">一级下线</a></li>
   {/if}
   {if condition="$param.level eq '2'"}
      <li class="cur">二级下线</li>
   {else/}
      <li><a href="{:url('user/reward')}?level=2">二级下线</a></li>
   {/if}
   {if condition="$param.level eq '3'"}
      <li class="cur">三级下线</li>
   {else/}
      <li><a href="{:url('user/reward')}?level=3">三级下线</a></li>
   {/if}
</ul>

<table width="770" border="0" cellspacing="1" cellpadding="0" class="table">
   <tr>
      <td width="80" align="center" valign="middle" bgcolor="#f7f7f7">编号</td>
      <td width="100" align="center" valign="middle" bgcolor="#f7f7f7">会员</td>
      <td width="140" align="center" valign="middle" bgcolor="#f7f7f7">时间</td>
   </tr>
   <form id="form1" name="form1" method="post">
      {volist name="list" id="vo"}
      <tr>
         <td align="center" valign="middle" bgcolor="#FFFFFF">{$vo.user_id}</td>
         <td align="center" valign="middle" bgcolor="#FFFFFF">{$vo.user_name}</td>
         <td align="center" valign="middle" bgcolor="#FFFFFF">{$vo.user_reg_time|mac_day}</td>
      </tr>
      {/volist}
   </form>
</table>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

# 升级会员

  • 文件目录 html/user/upgrade.html

苹果CMS会员升级表单示例

 <!-- BEGIN row -->
{volist name="group_list" id="vo"}
   {if condition="$vo.group_id gt 2 && $vo.group_status eq 1"}
   <div class="huang grade"  data-id="{$vo.group_id}" data-name="{$vo.group_name}" data-points="{$vo.group_points_day}" data-long="day">
      {$vo.group_name}-包天:{$vo.group_points_day}积分
   </div>

   <div class="lan grade"  data-id="{$vo.group_id}" data-name="{$vo.group_name}" data-points="{$vo.group_points_week}" data-long="week">
      {$vo.group_name}-包周:{$vo.group_points_week}积分
   </div>

  <div class="hong grade"  data-id="{$vo.group_id}" data-name="{$vo.group_name}" data-points="{$vo.group_points_month}" data-long="month">
      {$vo.group_name}-包月:{$vo.group_points_month}积分
  </div>

  <div class="zi grade"  data-id="{$vo.group_id}" data-name="{$vo.group_name}" data-points="{$vo.group_points_year}" data-long="year">
      {$vo.group_name}-包年:{$vo.group_points_year}积分
   </div>
{/if}
{/volist}
<!-- END row -->

<script>	
$('.grade').click(function(){
   var that=$(this);
   var group_id = that.attr('data-id');
   var group_name = that.attr('data-name');
   var long = that.attr('data-long');
   var points = that.attr('data-points');

   if(confirm('确定要升级到【'+group_name+'】吗,需要花费【'+points+'】积分')) {
      $.ajax({
         url: "{:url('user/upgrade')}",
         type: "post",
         dataType: "json",
         data: {group_id: group_id,long:long },
         beforeSend: function () {
            $("#btn_submit").css("background","#fd6a6a").val("loading...");
         },
         success: function (r) {
            alert(r.msg);
            if (r.code == 1) {
               location.reload();
            }
         },
         complete: function () {
            $("#btn_submit").css("background","#fa4646").val("提交");
         }
      });
   }
});
</script>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53

# 绑定信息

  • 文件目录 html/user/bind.html
  • 页面变量 $ac phone 为绑定手机 ,email 为绑定邮箱

苹果CMS用户绑定信息示例

<h1>绑定{if condition="$ac eq 'phone'"}手机{else/}邮箱{/if}</h1>
<form id="fm" name="fm" method="post" action="" >
   <input type="hidden" name="ac" value="{$ac}">
   {if condition="$ac eq 'phone'"}手机{else/}邮箱{/if}:
   <input type="text" name="to" class="member-input" value="">

   <input type="button" id="btn_bind_send" value="获取验证码"/>

   验证码:</span><input type="text" name="code" class="member-input" value="">

   <input type="button" id="btn_submit" class="search-button" value="确认绑定">
</form>
<script type="text/javascript">
	var countdown=60;
	function settime(val) {
		if (countdown == 0) {
			val.removeAttribute("disabled");
			val.value="获取验证码";
			countdown = 60;
			return true;
		} else {
			val.setAttribute("disabled", true);
			val.value="重新发送(" + countdown + ")";
			countdown--;
		}
		setTimeout(function() {settime(val) },1000)
	}

	$('#btn_bind_send').click(function(){
	    var ac = $('input[name="ac"]').val();
		var to = $('input[name="to"]').val();
		if(ac=='email') {
            var pattern = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
            var ex = pattern.test(to);
            if (!ex) {
                alert('邮箱格式不正确');
                return;
            }
        }
        else if(ac=='phone') {
            var pattern=/^[1][0-9]{10}$/;
            var ex = pattern.test(to);
            if (!ex) {
                alert('手机号格式不正确');
                return;
            }
        }
		else{
		    alert('参数错误');
			return;
		}


		settime(this);
		var data = $("#fm").serialize();

		$.ajax({
			url: "{:url('user/bindmsg')}",
			type: "post",
			dataType: "json",
			data: data,
			beforeSend: function () {
				//开启loading
			},
			success: function (r) {
				alert(r.msg);
			},
			complete: function () {
				//结束loading
			}
		});
	});

	$("#btn_submit").click(function() {
        var ac = $('input[name="ac"]').val();
        var to = $('input[name="to"]').val();

        if(ac=='email') {
            var pattern = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
            var ex = pattern.test(to);
            if (!ex) {
                alert('邮箱格式不正确');
                return;
            }
        }
        else if(ac=='phone') {
            var pattern=/^[1][0-9]{10}$/;
            var ex = pattern.test(to);
            if (!ex) {
                alert('手机号格式不正确');
                return;
            }
        }
        else{
            alert('参数错误');
            return;
        }

		var code = $('input[name="code"]').val();
		if(code==''){
			alert('请输入验证码');
			return;
		}
		var data = $("#fm").serialize();

		$.ajax({
			url: "{:url('user/bind')}",
			type: "post",
			dataType: "json",
			data: data,
			beforeSend: function () {
				//开启loading
				//$(".loading_box").css("display","block");
				$("#btn_submit").css("background","#fd6a6a").val("loading...");
			},
			success: function (r) {
				alert(r.msg);
				if(r.code==1){
					location.href="{:url('user/info')}";
				}
			},
			complete: function () {
				//结束loading
				//$(".loading_box").css("display","none");
				$("#btn_submit").css("background","#fa4646").val("提交");
			}
		});
	});

</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130

# 找回密码

  • 文件目录 html/user/findpass.html

苹果CMS保密问题找回密码表单示例

<form method="post" id="fm" action="">
   <h4>预留问题找回密码</h4>
   <div class="reg-group">
      <label class="bd-r" >账号</label>
      <input type="text" id="user_name" name="user_name"  placeholder="请输入您的登录账号">
   </div>
   <div class="reg-group">
      <label>找回问题</label>
      <input type="text" id="user_question" name="user_question"  placeholder="请输入您密码找回问题">
   </div>
   <div class="reg-group">
      <label>找回答案</label>
      <input type="text" id="user_answer" name="user_answer"  placeholder="请输入您的密码找回答案">
   </div>
   <div class="reg-group">
      <label>新的密码</label>
      <input type="password" id="user_pwd" name="user_pwd"  placeholder="请输入您的新密码">
   </div>
   <div class="reg-group">
      <label>确认密码</label>
      <input type="password" id="user_pwd2" name="user_pwd2"  placeholder="请输入您的确认密码">
   </div>
   <div class="reg-group">
      <label>验证码</label>
      <input type="text" class="reg-control w150" id="verify" name="verify" placeholder="请输入验证码">
      <img class="fr mr10 mt10" src="{:url('verify/index')}" onClick="this.src=this.src+'?'"  alt="单击刷新" />
   </div>
   <input type="button" id="btn_submit" class="btn-brand btn-sub" value="立即找回">
</form>
<script type="text/javascript">

	$(function(){
		$("body").bind('keyup',function(event) {
			if(event.keyCode==13){ $('#btnLogin').click(); }
		});
		$('#btn_submit').click(function() {
			if ($('#user_name').val()  == '') { alert('请输入用户!'); $("#user_name").focus(); return false; }
			if ($('#user_pwd').val()  == '') { alert('请输入密码!'); $("#user_pwd").focus(); return false; }
			if ($('#verify').val()  == '') { alert('请输入验证码!'); $("#verify").focus(); return false; }

			$.ajax({
				url: "{:url('user/findpass')}",
				type: "post",
				dataType: "json",
				data: $('#fm').serialize(),
				beforeSend: function () {
					$("#btn_submit").css("background","#fd6a6a").val("loading...");
				},
				success: function (r) {
					if(r.code==1){
						location.href="{:url('user/index')}";
					}
					else{
						alert(r.msg);
					}
				},
				complete: function () {
					$('#verify').click();
					$("#btn_submit").css("background","#fa4646").val("立即找回");
				}
			});

		});
	});

</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
  • 文件目录 html/user/findpass_msg.html

苹果CMS绑定信息找回密码示例

<form method="post" id="fm" action="">
   <input type="hidden" name="ac" value="{$param['ac']}">
   <h4>{$param['ac_text']}找回密码</h4>
   <div class="reg-group">
      <label class="bd-r" style="letter-spacing: normal;">{$param['ac_text']}</label>
      <input type="text" id="to" name="to" class="reg-control" placeholder="请输入您绑定的{$param['ac_text']}">
   </div>

   <div class="reg-group">
      <label>验证码</label>
      <input type="text" class="reg-control w150" id="verify" name="verify" placeholder="请输入验证码">
      <img class="fr mr10 mt10" src="{:url('verify/index')}" onClick="this.src=this.src+'?'"  alt="单击刷新" />
   </div>
   <input type="button" id="btn_send" class="btn-brand btn-sub" style="margin-top:5px;" value="发送验证码">
</form>

<form method="post" id="fm2" action="">
   <input type="hidden" name="ac" value="email">
   <h4>验证信息</h4>
   <div class="reg-group">
      <label class="bd-r" style="letter-spacing: normal;">验证码</label>
      <input type="text" id="code" name="code" class="reg-control" placeholder="请输入验证码">
   </div>
   <div class="reg-group">
      <label>新密码</label>
      <input type="password" class="reg-control w150" id="user_pwd" name="user_pwd" placeholder="请输入新密码">
   </div>
   <div class="reg-group">
      <label>确认密码</label>
      <input type="password" class="reg-control w150" id="user_pwd2" name="user_pwd2" placeholder="请输入确认密码">
   </div>
   <input type="button" id="btn_submit" class="btn-brand btn-sub" value="重置密码">
</form>
<script type="text/javascript">

	$(function(){
		$("body").bind('keyup',function(event) {
			if(event.keyCode==13){ $('#btnLogin').click(); }
		});
		$('#btn_send').click(function() {
			if ($('#to').val()  == '') { alert('请输入{$param["ac_text"]}!'); $("#to").focus(); return false; }

			$.ajax({
				url: "{:url('user/findpass_msg')}",
				type: "post",
				dataType: "json",
				data: $('#fm').serialize(),
				beforeSend: function () {
					$("#btn_send").css("background","#fd6a6a").val("loading...");
				},
				success: function (r) {
					alert(r.msg);
				},
				complete: function () {
					$('#verify').click();
					$("#btn_send").css("background","#fa4646").val("发送邮件");
				}
			});
		});

		$('#btn_submit').click(function() {
			if ($('#to').val()  == '') { alert('请输入{$param["ac_text"]}'); $("#to").focus(); return false; }
			if ($('#code').val()  == '') { alert('请输入验证码!'); $("#code").focus(); return false; }
			if ($('#user_pwd').val()  == '') { alert('请输入新密码!'); $("#user_pwd").focus(); return false; }
			if ($('#user_pwd2').val()  == '') { alert('请输入确认密码!'); $("#user_pwd2").focus(); return false; }
			if ($('#user_pwd').val()  != $('#user_pwd2').val() ) { alert('二次密码不一致!'); $("#user_pwd2").focus(); return false; }

			var data= {ac:'{$param["ac"]}',to:$('#to').val(),code:$('#code').val(),user_pwd:$('#user_pwd').val(),user_pwd2:$('#user_pwd2').val()};
			$.ajax({
				url: "{:url('user/findpass_reset')}",
				type: "post",
				dataType: "json",
				data: data,
				beforeSend: function () {
					$("#btn_submit").css("background","#fd6a6a").val("loading...");
				},
				success: function (r) {
					alert(r.msg);
				},
				complete: function () {
					$("#btn_submit").css("background","#fa4646").val("重置密码");
				}
			});
		});
	});

</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87

# 弹出层

# 弹出登录

用于制做js弹出登录框模板 , 由 home.js 里的 MAC.User.Login();触发,用户未登录状态弹出的是 ajax_login.html 登录后弹出进入的是 ajax_info.html;

  • 文件目录 html/user/ajax_login.html

<!--登录弹窗开始-->
<div class="mac_login">
    <form class="mac_login_form">
        <div class="login_form_group">
            <input type="text" class="mac_u_name" name="user_name" placeholder="手机/登录账号">
        </div>
        <div class="login_form_group">
            <input type="password" class="mac_u_pwd" name="user_pwd" placeholder="登录密码">
        </div>
        {if condition="$GLOBALS['config']['user']['login_verify'] eq 1"}
        <div class="login_form_group clearfix">
            <input type="text" class="mac_u_verify" name="verify" placeholder="请输入验证码">
            <img class="mac_verify_img" src="{:url('verify/index')}" onclick="this.src = this.src+'?'">
        </div>
        {/if}
        <div class="login_form_link">
            <a href="{:url('user/reg')}">注册</a>
            <a href="{:url('user/findpass')}">忘记密码</a>
        </div>
        <div class="login_form_group">
            <input type="button" class="login_form_submit" value="登录">
        </div>
    </form>
</div>
<!--登录弹窗结束-->

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

# 弹出信息

  • 文件目录 html/user/ajax_info.html

<!--登录弹窗开始-->
<div class="mac_login">
    <form class="mac_login_form">
        <div class="login_form_group">
            会员名:{$obj.user_name}
        </div>
        <div class="login_form_group">
            会员等级:{$obj.group_name}
        </div>
        <div class="login_form_group">
           剩余积分:{$obj.user_points}
        </div>
        <div class="login_form_group">
            上次登录时间:{$obj.user_last_login_time|mac_day=color}
        </div>
        <div class="login_form_group">
            登录次数:{$obj.user_login_num}
        </div>
        <div class="login_form_link">
            <a href="{:url('user/index')}">进入会员中心</a>
            <a href="{:url('user/logout')}">退出</a>
        </div>
    </form>
</div>
<!--登录弹窗结束-->

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

实现弹出效果

<!-- 模板需要确保已经引入 `static\js\home.js` -->
<a class="nav-link" href="javascript:;" id="Login">会员</a>
<script>
   $('body').on('click', '#Login', function(e){              	
      MAC.User.Login();
   });  
</script>
1
2
3
4
5
6
7

# 通用分页

用户中心所有列表都可以使用一下示例分页。

<div class="member-page">
   <em>共{$__PAGING__.record_total}条</em>
   <a class="page_link" href="{$__PAGING__.page_url|str_replace='PAGELINK',1,###}" title="首页">首页</a>
   <a class="page_link" href="{$__PAGING__.page_url|str_replace='PAGELINK',$__PAGING__.page_prev,###}" title="上一页">上一页</a>
   {volist name="$__PAGING__.page_num" id="num"}
      {if condition="$__PAGING__['page_current'] eq $num"}
         <a class="page_link page_current" href="javascript:;" title="第{$num}页">{$num}</a>
      {else}
         <a class="page_link" href="{$__PAGING__.page_url|str_replace='PAGELINK',$num,###}" title="第{$num}页" >{$num}</a>
      {/if}
   {/volist}
   <a class="page_link" href="{$__PAGING__.page_url|str_replace='PAGELINK',$__PAGING__.page_next,###}" title="下一页">下一页</a>

   <a class="page_link" href="{$__PAGING__.page_url|str_replace='PAGELINK',$__PAGING__.page_total,###}" title="尾页">尾页</a>

   <em>到第</em><input type="text" name="" class="page-input"><em></em><input type="submit" class="page-button" value="确定">
</div>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17