From 20ee31ed0fa1ed2dd05b14c59cc060906dfdc633 Mon Sep 17 00:00:00 2001 From: tianya <tianya@imcollege.cn> Date: Wed, 16 Sep 2020 13:21:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BC=9A=E5=91=98=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/member/pm.php | 41 ++++---- src/member/templets/pm-main.htm | 40 ++++++-- src/member/templets/pm-read.htm | 94 ------------------ src/member/templets/pm-send.htm | 162 -------------------------------- 4 files changed, 50 insertions(+), 287 deletions(-) delete mode 100755 src/member/templets/pm-read.htm delete mode 100755 src/member/templets/pm-send.htm diff --git a/src/member/pm.php b/src/member/pm.php index 7955e9b1..78e44818 100755 --- a/src/member/pm.php +++ b/src/member/pm.php @@ -26,29 +26,10 @@ if(!isset($dopost)) //检查用户是否被禁言 CheckNotAllow(); $state=(empty($state))? 0 : intval($state); -/*-------------------- -function __send(){ } -----------------------*/ -if($dopost=='send') -{ - /** 好友记录 **/ - $sql = "SELECT * FROM `#@__member_friends` WHERE mid='{$cfg_ml->M_ID}' AND ftype!='-1' ORDER BY addtime DESC LIMIT 20"; - $friends = array(); - $dsql->SetQuery($sql); - $dsql->Execute(); - while ($row = $dsql->GetArray()) { - $friends[] = $row; - } - include_once(dirname(__FILE__).'/templets/pm-send.htm'); - exit(); -} -/*----------------------- -function __read(){ } -----------------------*/ -else if($dopost=='read') +if($dopost=='read') { - $sql = "SELECT * FROM `#@__member_friends` WHERE mid='{$cfg_ml->M_ID}' AND ftype!='-1' ORDER BY addtime DESC LIMIT 20"; + $sql = "SELECT * FROM `#@__member_friends` WHERE mid='{$cfg_ml->M_ID}' AND ftype!='-1' ORDER BY addtime DESC LIMIT 20"; $friends = array(); $dsql->SetQuery($sql); $dsql->Execute(); @@ -59,12 +40,26 @@ else if($dopost=='read') $row = $dsql->GetOne("SELECT * FROM `#@__member_pms` WHERE id='$id' AND (fromid='{$cfg_ml->M_ID}' OR toid='{$cfg_ml->M_ID}')"); if(!is_array($row)) { - ShowMsg('对不起,你指定的消息不存在或你没权限查看!','-1'); + $result = array( + "code" => -1, + "data" => null, + "msg" => "对不起,你指定的消息不存在或你没权限查看", + ); + echo json_encode($result); exit(); } $dsql->ExecuteNoneQuery("UPDATE `#@__member_pms` SET hasview=1 WHERE id='$id' AND folder='inbox' AND toid='{$cfg_ml->M_ID}'"); $dsql->ExecuteNoneQuery("UPDATE `#@__member_pms` SET hasview=1 WHERE folder='outbox' AND toid='{$cfg_ml->M_ID}'"); - include_once(dirname(__FILE__).'/templets/pm-read.htm'); + $result = array( + "code" => 200, + "data" => array( + "subject" => $row['subject'], + "message" => $row['message'], + "sendtime" => MyDate("Y-m-d H:i", $row['sendtime']), + ), + "msg" => "", + ); + echo json_encode($result); exit(); } /*----------------------- diff --git a/src/member/templets/pm-main.htm b/src/member/templets/pm-main.htm index 68bf47de..eac10975 100755 --- a/src/member/templets/pm-main.htm +++ b/src/member/templets/pm-main.htm @@ -9,7 +9,25 @@ <link href="<?php echo $cfg_cmsurl;?>/static/font-awesome/css/font-awesome.min.css" rel="stylesheet"> <link rel="stylesheet" href="<?php echo $cfg_cmsurl;?>/static/css/dede.css"> <link rel="stylesheet" href="<?php echo $cfg_cmsurl;?>/static/css/member.css"> + <script src="<?php echo $cfg_cmsurl;?>/static/js/bootstrap.bundle.min.js"></script> + <script src="<?php echo $cfg_cmsurl;?>/static/js/dede.js"></script> <title>消息管理 - 会员中心 - <?php echo $cfg_webname; ?></title> + <script> + // 阅读消息 + function ReadMsg(id) { + $.get(`<?php echo $cfg_memberurl?>/pm.php?dopost=read&id=${id}`, function (data) { + let result = JSON.parse(data); + if (result.code === 200) { + ShowMsg(`<b>标题:</b><p>${result.data.subject}</p> + <b>时间:</b><p>${result.data.sendtime}</p> + <b>内容</b><p>${result.data.subject}</p>`); + $(`.pm-read-status[for='${id}']`).html("已阅读"); + } else { + ShowAlert("#feedback-alert", `评论失败:${result.msg}`, "danger"); + } + }) + } + </script> </head> <body> @@ -45,6 +63,8 @@ <div class="table-responsive"> <form action="pm.php" method="post" name="form1"> <input type='hidden' name='dopost' value='del' /> + <div id="feedback-alert"> + </div> <table class="table"> <thead> <tr> @@ -64,8 +84,8 @@ <td scope="row"><input type="checkbox" name="deleteid" value="{dede:field.id/}" style=" margin-left:5px" /></td> <td><?php - if($fields['hasview']==0) echo "<a href='pm.php?dopost=read&id={$fields['id']}'>{$fields['subject']}</a>"; - else echo "<a href='pm.php?dopost=read&id={$fields['id']}'>{$fields['subject']}</a>"; + if($fields['hasview']==0) echo "<a href='javascript:ReadMsg({$fields['id']})'>{$fields['subject']}</a>"; + else echo "<a href='javascript:ReadMsg({$fields['id']})'>{$fields['subject']}</a>"; ?></td> <td><?php if($folder == "inbox") { @@ -75,13 +95,15 @@ }?> </td> <td> - <?php - $readmsg = ($fields['hasview']==0 ? "<span style='color:red'>未阅读</span>" : '已阅读'); - echo $readmsg; - ?> + <div class="pm-read-status" for="<?php echo $fields['id'];?>"> + <?php + $readmsg = ($fields['hasview']==0 ? "<span style='color:red'>未阅读</span>" : '已阅读'); + echo $readmsg; + ?> + </div> </td> <td><?php - echo MyDate('y-m-d H:i:s',$fields['sendtime']); + echo MyDate('Y-m-d H:i:s',$fields['sendtime']); ?></td> </tr> {/dede:datalist} @@ -120,13 +142,15 @@ function DoSubmit(myfolder) { var selid = GetCheckfolderItem(); if (selid == '') { - alert("你没选中任何信息!"); + ShowMsg("你没选中任何信息!"); return false; } if (window.confirm("你确定要删除这些消息么?")) { location = "pm.php?dopost=del&ids=" + selid + "&folder=" + myfolder; } } + + </script> </body> diff --git a/src/member/templets/pm-read.htm b/src/member/templets/pm-read.htm deleted file mode 100755 index d73cbe6b..00000000 --- a/src/member/templets/pm-read.htm +++ /dev/null @@ -1,94 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $cfg_soft_lang; ?>" /> -<title>消息管理 - 会员中心 - <?php echo $cfg_webname; ?></title> -<link href="templets/style/base.css" rel="stylesheet" type="text/css" /> -<script type="text/javascript" src="../static/js/jquery.js"></script> -<script type="text/javascript" src="templets/js/load.js"></script> -<script type="text/javascript" src="templets/js/leftmenu.js"></script> -<script type="text/javascript"> - function folderSelAll() - { - for(i=0;i<document.form1.deleteid.length;i++) - { - if(!document.form1.deleteid[i].checked) - { - document.form1.deleteid[i].checked=true; - } - } - } - - //获得选中文件的文件名 - function GetCheckfolderItem() - { - var allSel=''; - if(document.form1.deleteid.value) return document.form1.deleteid.value; - for(i=0;i<document.form1.deleteid.length;i++) - { - if(document.form1.deleteid[i].checked) - { - if(allSel=='') - allSel=document.form1.deleteid[i].value; - else - allSel=allSel+","+document.form1.deleteid[i].value; - } - } - return allSel; - } - - function DoSubmit(myfolder) - { - var selid = GetCheckfolderItem(); - if(selid=='') { - alert("你没选中任何信息!"); - return false; - } - if(window.confirm("你确定要删除这些消息么?")) - { - location = "pm.php?dopost=del&ids="+selid+"&folder="+myfolder; - } - } -</script> -</head> -<body> -<div id="main"> - <?php include(DEDEMEMBER."/templets/head.htm"); ?> - <div id="content" class="w960 clearfix"> - <?php include(DEDEMEMBER."/templets/menu.php"); ?> - <div id="mcpmain"> - <div id="appTab"> - <ul> - <li><a href="pm.php?dopost=send">写新消息</a></li> - <li class="thisTab"><a href="pm.php?folder=inbox">收件箱</a></li> - <li><a href="pm.php?folder=outbox">发件箱</a></li> - <li><a href="pm.php?folder=track">已发出信息</a></li> - </ul> - <div class="tabOther"> - - </div> - </div> - <ul class="tabSub"> - <li <?php if(empty($state)) echo 'class="thisTab"'; ?>><a href="pm.php?folder=inbox"><span>全部</span></a></li> - <li <?php if($state == "1") echo 'class="thisTab"'; ?>><a href="pm.php?folder=inbox&state=1"><span>已阅读</span></a></li> - <li <?php if($state == "-1") echo 'class="thisTab"'; ?>><a href="pm.php?folder=inbox&state=-1"><span>未阅读</span></a></li> - </ul> - <div id="mainCp"> - <!--内容消息提示 --> - <h3 class="meTitle">短消息内容</h3> - <div class="contentShow"> - <p> - <label>标题:</label> - <?php echo $row['subject']; ?> [<a href="pm.php?dopost=send">回复</a>]</p> - <p> - <label>内容:</label> - <?php echo text2html($row['message']); ?></p> - </div> - </div> - <!--主操作区域 --> - </div> - </div> - <?php include(DEDEMEMBER."/templets/foot.htm"); ?> -</div> -</body> -</html> diff --git a/src/member/templets/pm-send.htm b/src/member/templets/pm-send.htm deleted file mode 100755 index bfffe08b..00000000 --- a/src/member/templets/pm-send.htm +++ /dev/null @@ -1,162 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $cfg_soft_lang; ?>" /> -<title>消息管理 - 会员中心 - <?php echo $cfg_webname; ?></title> -<link href="templets/style/base.css" rel="stylesheet" type="text/css" /> -<script type="text/javascript" src="../static/js/jquery.js"></script> -<script type="text/javascript" src="templets/js/load.js"></script> -<script type="text/javascript" src="templets/js/leftmenu.js"></script> -<script type="text/javascript"> - function folderSelAll() - { - for(i=0;i<document.form1.deleteid.length;i++) - { - if(!document.form1.deleteid[i].checked) - { - document.form1.deleteid[i].checked=true; - } - } - } - - //获得选中文件的文件名 - function GetCheckfolderItem() - { - var allSel=''; - if(document.form1.deleteid.value) return document.form1.deleteid.value; - for(i=0;i<document.form1.deleteid.length;i++) - { - if(document.form1.deleteid[i].checked) - { - if(allSel=='') - allSel=document.form1.deleteid[i].value; - else - allSel=allSel+","+document.form1.deleteid[i].value; - } - } - return allSel; - } - - function DoSubmit(myfolder) - { - var selid = GetCheckfolderItem(); - if(selid=='') { - alert("你没选中任何信息!"); - return false; - } - if(window.confirm("你确定要删除这些消息么?")) - { - location = "pm.php?dopost=del&ids="+selid+"&folder="+myfolder; - } - } -</script> -</head> -<body> -<div id="main"> - <?php include(DEDEMEMBER."/templets/head.htm"); ?> - <div id="content" class="w960 clearfix"> - <?php include(DEDEMEMBER."/templets/menu.php"); ?> - <div id="mcpmain"> - <div id="appTab"> - <ul> - <li class="thisTab"><a href="pm.php?dopost=send">写新消息</a></li> - <li><a href="pm.php?folder=inbox">收件箱</a></li> - <li><a href="pm.php?folder=outbox">发件箱</a></li> - <li><a href="pm.php?folder=track">已发出信息</a></li> - </ul> - <div class="tabOther"> - - </div> - </div> - <div id="mainCp" style="height:330px;"> - <h3 class="meTitle">发送新短消息</h3> - <div class="postForm" style="padding-left: 20px; padding-right: 20px;width: 520px; float: left;"> - <form class="mTB10 mL10 mR10" action="pm.php" method="post" name="form1"> - <input type='hidden' name='dopost' value='savesend' /> - <p> - <label>发送到:</label> - <input name="msgtoid" type="text" class="intxt" value="<?php if(!empty($uid)) echo $uid; ?>" size="28" maxlength="100" style=" width:100px" id="msgtoid"/> - <small> (填写用户的登录id(网址uid=后面跟的id)</small> - </p> - <p> - <label>标题:</label> - <input name="subject" type="text" class="intxt" value="" size="50" maxlength="70" style="width:300px;"/> - <small> (60个字符节以内)</small> - </p> - <p style=" width:530px"> - <label>内容:</label> - <textarea name="message" cols="50" rows="" style="width:300px;"></textarea> - <small>(1000个字符以内)</small> - </p> - <?php - if(preg_match("/5/",$safe_gdopen)){ - ?> - <p> - <label>验证码:</label> - <input type="text" class="intxt w200" style="width: 50px; text-transform: uppercase;" id="vdcode" name="vdcode"/><img id="vdimgck" align="absmiddle" onclick="this.src=this.src+'?'" style="cursor: pointer;" alt="看不清?点击更换" src="../plus/vdimgck.php"/> - 看不清? <a href="javascript:void(0)" onclick="changeAuthCode();">点击更换</a></li> - </p> - <?php }?> - <?php - if($safe_faq_msg == '1'){ - $faqkey = array_rand($safefaqs); - ?> - <p> - <label>验证问题:</label> - <?php echo $safefaqs[$faqkey]['question'];?> (答案:<?php echo $safefaqs[$faqkey]['answer'];?>)<input class="intxt" name="safeanswer" type="text" id="safeanswer" size="25" style='width:150px;'/> - <input type="hidden" name="faqkey" value="<?php echo $faqkey;?>" /> - <?php - } - ?> - </p> - <p><label><button class="button2" type="submit">发送</button></label></p> - </form> - </div> - - - <div class="dedeRight"> - <!--好友列表 --> - <script type="text/javascript"> - $(document).ready(function(){ - $(".buddy dt").click(function(){$(this).toggleClass("close");$(this).next("dd").toggle();}); - $(".buddy li").hover(function(){$(this).addClass("hover"); },function(){$(this).removeClass("hover"); }); - $('.uname').click(function() - { - var uname = $(this).text(); - $('#msgtoid').val(uname); - }); - }); - </script> - <div class="titleBar"> - <h5 class="fLeft">好友列表</h5> - <span class="fRight"><a href="myfriend.php" title="好友管理">管理</a></span> - </div> - <dl class="buddy"> - <dt class="icon17">所有好友</dt> - <dd> - <ul> - <?php - foreach ($friends as $friend) - { - echo '<li class="thickbox"><span class="fLeft icon16"></span><span class="uname">'.$friend['funame'].'</span></li>'; - } - ?> - </ul> - </dd> - </dl> - <!--好友搜索 --> - <div class="buddySearch textCenter"> - <form action="search.php"> - <input class="text" type="text" name="keyword" value="" style="width:100px;" /> - <button class="button1" type="submit">搜</button> - </form> - </div> - </div> - </div> - <!--主操作区域 --> - </div> - </div> - <?php include(DEDEMEMBER."/templets/foot.htm"); ?> -</div> -</body> -</html>