1 Star 2 Fork 2

仙士可/mwxz_2_wap

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
myfriend.html 10.80 KB
一键复制 编辑 原始数据 按行查看 历史
仙士可 提交于 2019-11-26 20:18 . 更新到服务器上提交
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>我的好友</title>
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta content="telephone=no" name="format-detection">
<meta name="description"/>
<meta name="keywords"/>
<!-- 开启对web app程序的支持 -->
<meta name="apple-mobile-web-app-capable" content="yes">
<!-- 全屏模式浏览 -->
<meta name="apple-touch-fullscreen" content="yes">
<!-- 改变Safari状态栏的外观 -->
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<!-- 禁止自动识别5位以上数字为电话 -->
<meta name="format-detection" content="telephone=no">
<link type="text/css" rel="stylesheet" href="./assets/css/list.css"/>
<link type="text/css" rel="stylesheet" href="./assets/css/list_common.css"/>
<link rel="stylesheet" type="text/css" href="./assets/layui/layui.css"/>
<link rel="stylesheet" type="text/css" href="./assets/css/public.css"/>
<script>
(function (win) {
document.documentElement.style.fontSize = document.documentElement.clientWidth / 7.5 + 'px';
function resizeLayout() {
setTimeout(function () {
document.documentElement.style.fontSize = document.documentElement.clientWidth / 7.5 + 'px';
}, 500);
}
if ("onorientationchange" in win) {
win.addEventListener("orientationchange", function () {
resizeLayout();
}, false);
} else {
win.addEventListener("resize", function () {
resizeLayout();
}, false);
}
}(window));
</script>
</head>
<body>
<div id="page-head">
<nav class="backnav">
<div class="area">
<a class="back" id="reveal-left"><span class="back_ico"></span><span class="back_txt ">返回</span></a>
&nbsp; 我的好友
<a class="add" id="add_friend" style="float: right"><span></span><span class="back_txt ">添加</span></a>
</div>
</nav>
</div>
<section class="search" id="search" style=" display:none">
<div class="tit">
<input class="text" type="search" id="user_name" autocomplete="off" placeholder="请输入会员用户名"><a
class="close" id="search-btn">搜索</a>
</div>
<div id="selectBox" class="selectBox" style="display: block;">
</div>
<div id="hisBox" class="histBox" style="display: block;">
<div>
<!--<a href="javascript:void(0)http://s.auto.sohu.com/search/wap.at?suggest=%u5965%u8FEA" target="_self">奥迪</a>-->
</div>
<a onclick=" $('#search').hide();" class="clearbtn">返回</a>
</div>
</section>
<nav class="modelnav">
<ul>
<li><a href="javascript:void(0)javascript:void(0);">我的好友</a></li>
<li><a href="javascript:void(0)javascript:void(0);">好友申请</a></li>
</ul>
</nav>
<section class="area" id="modelListArea">
<div class="tit"><h2 id="my_friend"><lable for="my">我的好友</lable></h2>
<h2 id="apply_friend" for="app" style="float: right"><lable for="app">好友申请</lable></h2></div>
<ul class="pt_list" id="pt_list">
</ul>
<ul class="pt_list" id="pt_apply_list">
</ul>
</section>
<script id="list" type="text/html">
{{#
for(var i=0;i
<d.length;i++){
var vo = d[i];
arr[vo.id] = vo;
}}
<li onclick="friend_info({{vo.user_id}})"><a><img src="/data/upload/default.gif"/>
<p><span class="orange"> <em>{{vo.user_name}}</em> </span></p>
<p>餐厅<span class="orange"> <em>{{vo.res_name}}</em> </span></p>
<p>等级<span class="orange"> <em>{{vo.res_level}}</em> </span></p>
</div>
</a></li>
{{# }
window.food_arr = arr;}}
</script>
<div id="alpha_cover" class="alpha-cover"></div>
<div class="loading" id="loading">
<span class="loading-ring"></span>
</div>
<script src="./assets/js/config.js"></script>
<script src="./assets/js/jquery-1.8.2.min.js"></script>
<script src="./assets/js/public.js"></script>
<script src="./assets/js/jquery.cookie.js"></script>
<script src="./assets/layui/layui.js"></script>
<script>
var arr = new Array;
$(function () {
is_login();
$('#add_friend').on('click', function () {
$('#search').show();
});
$('#search-btn').on('click', function () {
get_user_name();
});
get_list();
$('#my_friend').on('click',function(){
get_list();
});
$('#apply_friend').on('click',function(){
goUrl('friend_apply.html');
});
});
function get_user_name() {
var user_name = $('#user_name').val();
loadingShow();
$.ajax({
url: SiteUrl + 'index.php?g=User&m=friend&a=search_user',
data: {
user_name: user_name,
key:key
},
dataType: 'JSON',
type: 'POST',
success: function (res) {
check_login(res);
loadingHide();
if (res['status'] == false) {
msgTip(res['info']);
return;
} else {
var html = '<a>' + res['data']['user_login'] + '(' + res['data']['user_nicename'] + ')<span style="float: right" onclick="add_friend(' + res['data']['id'] + ')">添加</span></a>';
$('#selectBox').html(html);
}
}
});
}
function add_friend(id) {
loadingShow();
$.ajax({
url: SiteUrl + 'index.php?g=User&m=friend&a=add_friend',
data: {
user_id: id,
key:key
},
dataType: 'JSON',
type: 'POST',
success: function (res) {
check_login(res);
loadingHide();
if (res['status'] == false) {
msgTip(res['info']);
return;
} else {
msgTip(res['info']);
}
}
});
}
function friend_info(id){
loadingShow();
$.ajax({
url:SiteUrl + 'index.php?g=User&m=friend&a=friend_info',
data:{user_id:id,key:key},
dataType:'JSON',
type:'POST',
success:function(res){
check_login(res);
loadingHide();
if(res['status']=false){
msgTip(res['info']);
return;
}
var vo = res['data'];
layui.use('layer', function () {
var layer = layui.layer;
layer.open({
title: '好友信息',
offset:'t',
content:
'餐厅名:' +vo['res_name']+'('+vo['street_name']+')'+
'<br>餐厅等级' +vo['res_level']+''+
'<br>金牌数量'+vo['cookbooks_num'],
btn: ['去橱柜','去餐厅','删除','确定'],
btn1: function () {
goUrl('res/find_cupboard.html?user_id='+id);
},
btn2: function () {
goUrl('res/friend_seat.html?user_id='+id);
},
btn3: function () {
del_friend(id);
},
});
});
}
})
}
function get_list() {
layui.use('flow', function () {
var $ = layui.jquery; //不用额外加载jQuery,flow模块本身是有依赖jQuery的,直接用即可。
var flow = layui.flow;
flow.load({
elem: '#pt_apply_list' //指定列表容器
, done: function (page, next) { //到达临界点(默认滚动触发),触发下一页
var lis = [];
//以jQuery的Ajax请求为例,请求下一页数据(注意:page是从2开始返回)
loadingShow();
$.getJSON(SiteUrl + 'index.php?g=User&m=friend&a=get_my_friend&page=' + page,{key:key}, function (res) {
//假设你的列表返回在data集合中
check_login(res);
loadingHide();
layui.use('laytpl', function () {
var laytpl = layui.laytpl;
//使用方式跟独立组件完全一样
var gettpl = document.getElementById('list').innerHTML;
laytpl(gettpl).render(res.list, function (html) {
$('#pt_list').show();
$('#pt_apply_list').hide();
if (res['page'] == 1) {
$('#pt_list').empty();
}
$('#pt_list').append(html);
});
});
//执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页
//pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多
next(lis.join(''), page < res.page_num);
});
}
});
});
}
function del_friend(id){
layui.use('layer', function () {
var layer = layui.layer;
layer.open({
title: '删除好友',
offset: 't',
content: '确认删除吗?',
btn: ['确定','取消'],
btn1: function () {
loadingShow();
$.ajax({
url: SiteUrl + 'index.php?g=User&m=friend&a=del_friend',
data: {
user_id: id,
key:key
},
dataType: 'JSON',
type: 'POST',
success: function (res) {
check_login(res);
loadingHide();
if (res['status'] == false) {
msgTip(res['info']);
return;
} else {
msgTip(res['info']);
get_list();
}
}
});
},
});
});
}
</script>
</body>
</html>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ncl520/mwxz_2_wap.git
git@gitee.com:ncl520/mwxz_2_wap.git
ncl520
mwxz_2_wap
mwxz_2_wap
master

搜索帮助