11-Comment页面

<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Comment</title>
<script src="~/Script/jquery-1.10.2.min.js"></script>

</head>
<body>
<div style="width:1010px; margin:50px; border-color:antiquewhite" id="refreshContainer">
<input type="button" value="显示"/>
<div style="width:1000px; margin:50px">
<p>
<img src='' width="40" height="40" id="img" />
<label id="s1"></label><label id="s2" style="margin:200px;"></label>
</p>
<p>
<span>发布人:</span><label id="L"></label>
</p>
<p>
<h3>
宝贝介绍
</h3>
<div id="s3" style="height:80px;"> </div>
<img src="" id="Img1" width="600" height="300" />

</p>
</div>

<h2 style="width:1000px; margin:50px">评论</h2>
<p style="border-bottom-style:double;width:1000px; margin:50px"></p>
<div id="P1" style="width:1000px; margin:50px">

<table style="margin-left:50px"></table>
</div>
<p style="border-bottom-style:double; width:1000px; margin:50px"></p>

 

<div style="width:1000px; margin:100px">
<form id="f1">
<p>
<input type="hidden" name="NewsID" value="@Request.QueryString["ID"]"/>
<input type="hidden" name="FileName" value="/Image/QQ图片20181115110035.gif" />
评论称呼:<input type="text" name="Name" id="Name" /><span style="color:red;" id="Ping1">*</span>
</p>
<div>
<textarea id="Context" name="Context" style="width:500px;height:100px"></textarea>
</div>
<input type="button" οnclick="AddBut()" value="评论" />
</form>
</div>

</div>
<p class="refreshText"></p>


</body>
</html>
<script>
$(function () {
//查询单个集市信息
$.ajax({
url: "http://localhost:8888/News/GetNew",
data: {
id:@Request.QueryString["ID"],
},
type: "get",
success: function (data)
{
$("#img").attr("src",data.TypeImg);
$("#s1").text(data.Title);
$("#s2").text(data.CreateTime);
$("#L").text(data.Name);
$("#s3").text(data.Context);
$("#Img1").attr("src", data.FileName);
}

})

//查询所有评论
$.ajax({
url: "http://localhost:8888/Comment/GetComments",
data: {
ID:@Request.QueryString["ID"],
},
type: "get",
success: function (data)
{
$(data).each(function (i,data) {
$("table").append("<tr><td style = \"width:240px\" > <img src=\"" + data.FileName + "\" width=\"40\" height=\"40\" /> <span>" + data.Name + "</span> <br /> <span>" + data.CreateTime + "</span></td><td><span>" + data.Context + "</span></td></tr>");
})

}

})
})

//添加评论
function AddBut()
{

if ($("#Name").val().trim().length <= 0 && $("#Name").val().trim().length >=10 )
{
$("#Ping1").html("必填项,不超过10个字");
}
$.ajax({
url: "http://localhost:8888/Comment/AddComment",
data:
$("#f1").serialize()
,
type: "post",
success: function (data)
{
if (data > 0) {
alert("评论成功");
location.href = "/News/Comment?ID=@Request.QueryString["ID"]"
}
else {
alert("失败!!")
}
}

})
}



</script>

转载于:https://www.cnblogs.com/Wangyang11/p/10003745.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
const { DBPost } = require("../../db/DBPost"); // pages/post-detail/post-detail.js Page({ /** * 页面的初 zx始数据 */ data: { }, /** * 生命周期函数--监听页面加载 */ onLoad:function(options) { var postId=options.id; this.dbPost=new DBPost(postId); this.postData=this.dbPost.getPostItemById().data; this.setData({ post:this.postData }) }, onReady:function(){ wx.setNavigationBarTitle({ title: this.postData.title }) }, onCollectionTap:function(event){ var newData = this.dbPost.collect(); this.setData({ 'post.collectionStatus':newData.collectionStatus, 'post.collectionNum':newData.collectionNum }) wx.showToast({ title:newData.collectionStatus?"收藏成功":"取消成功", duration:1000, icon:"success", mask:true }) }, onUpTap:function(evenet){ var newData=this.dbPost.up(); this.setData({ 'post.upStatus':newData.upStatus, 'post.upNum':newData.upNum }) }, onCommentTap:function(event){ var id = event.currentTarget.dataset.postId; wx.navigateTo({ url: '../post/post-comment/post-comment?id=' +id }) }, /** * 生命周期函数--监听页面初次渲染完成 */ /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })分析代码
06-02

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值