工作记录:
1.在手机H5页面会员名录(找人people模块)用户列表中添加扩展资料中2条信息:
修改文件位置:前端模板--Application/Mob/Views/default/People/_peoplelist.html
控制器-----Application/Mob/Controller/PeopleController.class.php
修改内容: 控制器:在foreach遍历用户信息$people中更具用户uid取出field表中需要的扩展资料信息.
代码:
//从test_field表取职位信息
$find['uid'] = $v['uid'];
$find['field_id'] = array('in',array(12,13));
$fields_list = M('field')->where($find)->field('field_data')->select();
$v['comp'] = $fields_list[0]['field_data'];
$v['job'] = $fields_list[1]['field_data'];
前段模板:在用户信息下取出扩展资料。
代码:
<div class="signature" style="color: #A9A9A9">
<if condition="$people['job'] eq ''">
还没想好O(∩_∩)O
<else/>
{$people.comp}
</if>
</div>
<div class="signature" style="color: #A9A9A9">
<if condition="$people['job'] eq ''">
还没想好O(∩_∩)O
<else/>
{$people.job}
</if>
</div>
2.手机H5游客限制访问,登入跳转优化。
根据需求需要在移动版加入游客限制访问固定模块功能。并实现登入后跳转登入前页面优化。
修改文件位置:
前段模板:Mob/View/default/Member/index.html;
控制器:./Addons/CloseGuest/CloseGuestAddon.class.php;
Mob/Controller/MemberController.class.php;
修改内容:
移动版游客限制访问固定模块:在游客访问限制插件中对模块进行判定,mob模块下使用独立限制条件。
CloseGuestAddon.class.php
代码:
模块判断:
if (MODULE_NAME != "Mob") { //不是mob模块使用网页端限制条件
手机端限制:
//手机端登入限制
$defaulthome = "mob/member/"; //移动版登入页
trace($defaulthome,'默认页面');
$defaultfilter = array("Admin","Singlepage","Api","Member","News","Event","Home","Register,Foundpassword");//过滤模块,即游客可访问模块
$goUrl = __APP__ . $defaulthome;
trace($goUrl,'__gourl__');
if(CONTROLLER_NAME != "Addons"){
if(!in_array(CONTROLLER_NAME,$defaultfilter)){
if(!is_login()){
redirect($goUrl);
}
}
}
return true;
移动版登入后跳转登入前页面优化:
Mob/View/default/Member/index.html;
首先在前段模板中表单提交加入隐藏提交响应页面地址,使用$_SERVER['HTTP_REFERER'];
代码:
<input name="from" type="hidden" value="<php>echo $_SERVER['HTTP_REFERER']</php>">
在控制器中将响应地址复制给$data['go'],使其ajax返回
代码:
$data['go'] = I('post.from', U('mob/event/index'), 'text'); // post无传值时默认为event模块主页,输出形式为test。
代码:
$.post(url, data, function (msg) {
if (msg.status == 1) {
toast.success(msg.info);
setTimeout(function () {
window.location.href = msg.go;
}, 200);
} else {
toast.error(msg.info);
}
}, 'json');