Merge branch 'dev' into kongweiyu_branch

kongweiyu_branch
孔维屿 1 year ago
commit e5478db4de

@ -0,0 +1,6 @@
{
"permissions": {
"openapi": [
]
}
}

@ -0,0 +1,25 @@
// 云函数入口文件
const cloud = require('wx-server-sdk');
cloud.init({
env: cloud.DYNAMIC_CURRENT_ENV
});
//const db = cloud.database();
// 云函数入口函数
exports.main = async (val, comment) => {
  return await cloud.database().collection("comment").doc(event.id)
  .update({
      data:{  
comment: comment_text      
      }
  }) 
  .then(res =>{
      console.log("改变评论状态成功1",res)
      return res
  })
  .catch(res =>{
      console.log("改变评论状态失败",res)
      return res
  })
}

@ -0,0 +1,14 @@
{
"name": "sendComment",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"wx-server-sdk": "~2.6.3"
}
}

@ -1,10 +1,11 @@
const db = wx.cloud.database().collection("comment")
Page({
data: {
//评论数据
comment_list: [
{
comment_id: 1, //评论id
comment_pr_id: 1 ,//评论文章所属id
comment_pr_id: 1,//评论文章所属id
comment_user_avatar: 'cloud://cloud1-7gyjwcyfbdf819da.636c-cloud1-7gyjwcyfbdf819da-1321167991/1678762683308.png', //评论用户头像(路径替换为你的图片路径)
comment_user_name: '高同学', //评论人昵称
comment_text: '您觉得这位老师的讲课方式是什么样的呢', //评论内容
@ -36,7 +37,7 @@ Page({
reply_name: ''
}
],
//回复数据
comment_list2: [
{
@ -86,6 +87,58 @@ Page({
}
},
//顶部评论框提交内容时触发
bindconfirm(e) {
var comment_text = e.detail.value //判断用户是否输入内容为空
if (comment_text == '') { //用户评论输入内容为空时弹出
wx.showToast({
title: '请输入内容', //提示内容
icon: 'none' })
} else {
var date = new Date(); //创建时间对象
var year = date.getFullYear(); //获取年
var month = date.getMonth() + 1; //获取月
var day = date.getDate(); //获取日
var hour = date.getHours(); //获取时
var minute = date.getMinutes(); //获取分
var second = date.getSeconds(); //获取秒
var time = `${year}${month}${day}${hour}${minute}${second}`; //当前时间
var comment_list = this.data.comment_list; //获取data中的评论列表
var comment_list2 = this.data.comment_list2; //获取data中的回复列表
var userinfo = this.data.userinfo; //获取当前的用户信息
var comment_user_name = userinfo.nickName //用户昵称
var comment_user_avatar = userinfo.avatarUrl //用户头像 //
var reply_id = this.data.reply_id //获取当前输入评论的id
var comment_list_length = comment_list.length; //获取当前评论数组的长度
var last_id = comment_list[comment_list_length - 1].comment_id; //获取最后一个评论的id
var comment_list2_length = comment_list2.length; //获取回复数组的长度
var last_id2 = comment_list2[comment_list2_length - 1].comment_id; //获取最后回复id
var new_id = last_id > last_id2 ? last_id + 1 : last_id2 + 1; //赋值当前评论的id
var reply_name = null;
var parent_id = 0;
var reply_id = this.data.now_reply; //获取当前输入评论的id
var comment_detail = {} //声明一个评论/回复对象
comment_detail.comment_id = new_id; //评论Id
comment_detail.comment_user_name = comment_user_name; //用户昵称
comment_detail.comment_user_avatar = comment_user_avatar; //用户头像
comment_detail.comment_text = comment_text; //评论内容
comment_detail.comment_time = time; //评论时间
comment_detail.reply_id = reply_id; //回复谁的评论的id
comment_detail.parent_id = parent_id; //评论所属哪个评论id
comment_detail.reply_name = reply_name; //回复评论人的昵称
comment_list.unshift(comment_detail);
this.setData({
value: null, //评论内容
now_reply: 0, //当前点击的评论id
now_reply_name: null, //当前点击的评论的用户昵称
now_reply_type: 0, //评论类型
now_parent_id: 0, //当前点击的评论所属哪个评论id
placeholder2: "说点什么让ta也认识看笔记的你", //输入框占字符
comment_list //评论列表
})
}
},
//点击用户评论或回复时触发
replyComment(e) {
var cid = e.currentTarget.dataset.cid; //当前点击的评论id
@ -93,12 +146,12 @@ Page({
var pid = e.currentTarget.dataset.pid; //当前点击的评论所属评论id
var type = e.currentTarget.dataset.type; //当前回复类型
this.setData({
focus: true, //输入框获取焦点
placeholder: '回复' + name + '', //更改底部输入框占字符
now_reply: cid, //当前点击的评论或回复评论id
now_reply_name: name, //当前点击的评论或回复评论的用户名
now_parent_id: pid, //当前点击的评论或回复评论所属id
now_reply_type: type, //获取类型(1回复评论/2回复-回复评论)
focus: true, //输入框获取焦点
placeholder: '回复' + name + '', //更改底部输入框占字符
now_reply: cid, //当前点击的评论或回复评论id
now_reply_name: name, //当前点击的评论或回复评论的用户名
now_parent_id: pid, //当前点击的评论或回复评论所属id
now_reply_type: type, //获取类型(1回复评论/2回复-回复评论)
})
},
@ -111,7 +164,6 @@ Page({
//用户评论输入内容为空时弹出
wx.showToast({
title: '请输入内容', //提示内容
icon: 'none' //提示图标
})
} else {
var date = new Date(); //创建时间对象
@ -122,99 +174,98 @@ Page({
var minute = date.getMinutes(); //获取分
var second = date.getSeconds(); //获取秒
var time = `${year}${month}${day}${hour}${minute}${second}`; //当前时间
var userinfo = this.data.userinfo; //获取当前的用户信息
var comment_user_name = userinfo.nickName //用户昵称
var comment_user_avatar = userinfo.avatarUrl //用户头像
var reply_name = null; //回复评论用户的昵称
var parent_id = 0; //评论所属哪个评论的id
var reply_id = this.data.now_reply; //回复谁的评论id
var comment_list = this.data.comment_list; //获评论数据
var comment_list2 = this.data.comment_list2; //获取回复数据
var comment_list_length = comment_list.length; //获取当前评论数组的长度
var last_id = comment_list[comment_list_length - 1].comment_id; //获取最后一个评论的id
var comment_list2_length = comment_list2.length; //获取回复数组的长度
var last_id2 = comment_list2[comment_list2_length - 1].comment_id; //获取最后回复的id
var new_id = last_id > last_id2 ? last_id + 1 : last_id2 + 1; //当前将要发表的评论的id
var userinfo = this.data.userinfo; //获取当前的用户信息
var comment_user_name = userinfo.nickName //用户昵称
var comment_user_avatar = userinfo.avatarUrl //用户头像
var reply_name = null; //回复评论用户的昵称
var parent_id = 0; //评论所属哪个评论的id
var reply_id = this.data.now_reply; //回复谁的评论id
//通过回复谁的评论id判断现在是评论还是回复
if(reply_id != 0) {
//现在是回复
var reply_type = this.data.now_reply_type; //回复类型
//通过回复类型判断是回复评论还是回复回复
if (reply_type == 1) {
//回复评论
parent_id = this.data.now_reply; //回复评论所属评论id
reply_name = this.data.now_reply_name; //回复评论用户昵称
} else {
//回复回复
parent_id = this.data.now_parent_id; //回复评论所属评论id
reply_name = this.data.now_reply_name; //回复评论用户昵称
}
//现在是回复
var reply_type = this.data.now_reply_type; //回复类型
//通过回复类型判断是回复评论还是回复回复
if (reply_type == 1) {
//回复评论
parent_id = this.data.now_reply; //回复评论所属评论id
reply_name = this.data.now_reply_name; //回复评论用户昵称
} else {
parent_id = this.data.now_parent_id; //回复评论所属评论id
reply_name = this.data.now_reply_name; //回复评论用户昵称
}
} else {
//现在是评论
}
var comment_detail = {} //评论/回复对象
comment_detail.comment_id = new_id; //评论Id
comment_detail.comment_user_name = comment_user_name; //用户昵称
comment_detail.comment_user_avatar = comment_user_avatar; //用户头像
comment_detail.comment_text = comment_text; //评论内容
comment_detail.comment_time = time; //评论时间
comment_detail.reply_id = reply_id; //回复谁的评论的id
comment_detail.parent_id = parent_id; //评论所属哪个评论id
comment_detail.reply_name = reply_name; //回复评论人的昵称
//判断parent_id是否为0 为0就是评论 不为0就是回复
if(comment_detail.parent_id != 0) {
//回复
comment_list2.unshift(comment_detail);
} else {
//现在是评论
}
var comment_detail = {} //评论/回复对象
comment_detail.comment_id = new_id; //评论Id
comment_detail.comment_user_name = comment_user_name; //用户昵称
comment_detail.comment_user_avatar = comment_user_avatar; //用户头像
comment_detail.comment_text = comment_text; //评论内容
comment_detail.comment_time = time; //评论时间
comment_detail.reply_id = reply_id; //回复谁的评论的id
comment_detail.parent_id = parent_id; //评论所属哪个评论id
comment_detail.reply_name = reply_name; //回复评论人的昵称
//判断parent_id是否为0 为0就是评论 不为0就是回复
if(comment_detail.parent_id > 0) {
//回复
comment_list2.unshift(comment_detail);
} else {
//评论
comment_list.unshift(comment_detail);
}
//动态渲染
ths.setData({
//发表评论后将以下数据初始化 为下次发表评论做准备
comment_text: null, //评论内容
now_reply: 0, //当前点击的评论id
now_reply_name: null, //当前点击的评论的用户昵称
now_reply_type: 0, //评论类型
now_parent_id: 0, //当前点击的评论所属哪个评论id
placeholder: "说点什么...", //输入框占字符
//将加入新数据的数组渲染到页面
comment_list, //评论列表
comment_list2 //回复列表
})
}
//评论
comment_list.unshift(comment_detail);
}
//动态渲染
ths.setData({
//发表评论后将以下数据初始化 为下次发表评论做准备
comment_text: null, //评论内容
now_reply: 0, //当前点击的评论id
now_reply_name: null, //当前点击的评论的用户昵称
now_reply_type: 0, //评论类型
now_parent_id: 0, //当前点击的评论所属哪个评论id
placeholder: "什么...", //输入框占字符
//将加入新数据的数组渲染到页面
comment_list2 //回复列表
})
}
},
//下面的方法可以绑定在输入框的bindblur属性上
blur(e) {
const text = e.detail.value.trim();
if( text == ''){
this.setData({
now_reply: 0, //当前点击的评论或回复评论的id
now_reply_name:null, //当前点击的评论或回复评论的用户昵称
now_reply_type:0, //当前回复类型
now_parent_id:0, //当前点击的评论或回复评论的所属评论id
placeholder: "说点什么呢,万一火了呢", //占字符
focus:false //输入框获取焦点
})
}
},
blur(e) {
const text = e.detail.value.trim();
if (text == '') {
this.setData({
now_reply: 0, //当前点击的评论或回复评论的id
now_reply_name: null, //当前点击的评论或回复评论的用户昵称
now_reply_type: 0, //当前回复类型
now_parent_id: 0, //当前点击的评论或回复评论的所属评论id
placeholder: "说点什么呢,万一火了呢", //占字符
focus: false //输入框获取焦点
})
}
},
//获取输入框内容
getCommentText(e) {
var val = e.detail.value;
this.setData({
comment_text: val
getCommentText(e) {
var val = e.detail.value;
wx.cloud.callFunction({
name:"sendComment",
data:{
comment :val
}
})
},
//顶部评论框提交内容时触发
bindconfirm(e) {
var comment_text = e.detail.value
var comment_list = this.data.comment_list;
var comment_detail = {}
comment_list.unshift(comment_detail);
this.setData({
value: null })
}
comment_text: val
})
},
})

@ -5,7 +5,10 @@
<!-- END -->
<!-- 评论框 -->
<input confirm-type="send" class="container_inp" value="{{value}}" placeholder="{{ placeholder2 }}" placeholder-class="container_place" bindconfirm="bindconfirm"></input>
<!-- <input confirm-type="send" class="container_inp" value="{{value}}" placeholder="{{ placeholder2 }}" placeholder-class="container_place" bindconfirm="bindconfirm"></input> -->
<input confirm-type="send" class="container_inp" value="{{value}}" placeholder="{{ placeholder2 }}" placeholder-class="container_place" bindconfirm="bindconfirm"></input>
<!-- END -->
<!-- 用户评论回复显示区域 -->
@ -16,6 +19,7 @@
<view class="right_content">
<text class="right_content_txt" bindtap='replyComment' data-type="1" data-name='{{list.comment_user_name}}' data-cid='{{list.comment_id}}' data-pid="{{list.parent_id}}">{{list.comment_text}}</text>
<text class="right_content_txt2">{{list.comment_time}}</text>
<!-- 回复评论 -->
<!-- 判断回复列表数据中的parent_id和评论列表数据的comment_id是否相等 相等就显示 不等就不显示 -->
<view class="reply" wx:for="{{comment_list2}}" wx:for-item="list2" wx:key="list2" wx:if="{{list2.parent_id == list.comment_id}}">
@ -32,23 +36,26 @@
</view>
<!-- END -->
<!-- 结束 -->
<view class="end">
<text class="end_txt" space="nbsp">— THE END —</text>
</view>
<!-- END -->
</view>
<!-- END -->
<!-- 底部评论 -->
<view class="foot">
<view class="say">
<view class="flex">
<image class="say_img" src="/images/assemblyNumber/discoveryDetails/icon3.png"></image>
<input confirm-type="send" class="say_inp" placeholder="{{ placeholder }}" value="{{ comment_text }}" focus="{{ focus }}" bindblur="blur" bindconfirm="confirm"></input>
<!-- 底部评论 -->
<view class="foot">
<view class="say">
<view class="flex">
<!-- <image class="say_img" src=" "></image> -->
<input confirm-type="send" class="say_inp" placeholder="{{ placeholder }}" value="{{ comment_text }}" focus="{{ focus }}" bindblur="blur" bindconfirm="confirm"></input>
</view>
</view>
</view>
<image class="foot_img" src="/images/assemblyNumber/discoveryDetails/icon4.png"></image>
<text class="foot_num">210</text>
<image class="foot_img2" src="/images/assemblyNumber/discoveryDetails/icon5.png"></image>
<text class="foot_num">368</text>
</view>
<!-- END -->
<!-- <image class="foot_img" src=" "></image> -->
<text class="foot_num">210</text>
<!-- <image class="foot_img2" src=" "></image> -->
<text class="foot_num"> 368</text>
</view>
<!-- END -->

@ -154,4 +154,5 @@
height: 40rpx;
margin-left: 30rpx;
margin-right: 17rpx;
}
}

@ -14,55 +14,57 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
var index = options.index; // 第一个页面传递过来的教师索引
var teacherInfo = this.data.teacher[index];
// 使用索引在教师数组中获取对应的教师信息
// var teacherInfo = this.data.teacher[index];
// 继续处理教师信息
// 调用云函数获取教师信息
wx.cloud.callFunction({
name: "detailed",
success: (res) => {
this.setData({
teacher: res.result.data
})
// console.log(this.data.teacher[1]);
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
changeTab(e) {
const index = e.currentTarget.dataset.index;
this.setData({
currentTab: parseInt(index)
});
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
onAddButtonTap: function() {
this.setData({
showPopup: true
});
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
onBackButtonTap: function() {
this.setData({
showPopup: false
});
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
handleSubmit: function() {
// 处理....
// 提交成功后隐藏弹窗
this.setData({
showPopup: false
});
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
navToComments: () => {
wx.navigateTo({
url: '/pages/Comments/Comments',
})
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
inputChange(e) {
this.setData({
inputValue: e.detail.value
});
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

@ -11,7 +11,8 @@ Page({
showPopup: false,
teacher: {},
exist: false,
rec: false
rec: false,
selectedIndex: -1,
},
/**

@ -32,7 +32,7 @@
</view>
</view>
<view class="show_information" wx:for="{{teacher}}" wx:key="_id">
<view class="show_information" wx:for="{{teacher}}" data-index="{{index}}"wx:key="_id">
<!-- //当每通过一个教员上传的简历信息则创建一个 -->
<view class="content-container" bind:tap="navToDetails">
<image class="image" src="/images/user.png"></image>

@ -31,7 +31,7 @@
width: 90%;
margin: 20rpx auto;
padding: 20rpx;
background-color: #83acc4;
background-color: #bce3fa;
border-radius: 25rpx;
box-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.1);
}
@ -76,8 +76,6 @@
object-fit: cover;
border-radius: 10rpx 0 0 10rpx;
align-self: flex-start;
/* border: 2rpx solid #ccc; 添加框线样式
丑的一比,下次不要加了*/
}
@ -86,6 +84,15 @@
padding: 20rpx;
}
.text-container > button {
display: inline;
position: relative;
left: 300rpx;
top: 35rpx;
border-radius: 10px;
background-color: #4CAF50;
}
.title {
font-size: 32rpx;
font-weight: bold;
@ -528,7 +535,7 @@ page {
width: 60px;
height: 60px;
border-radius: 50%;
background-color: #8a727a;
background-color: #FFFFFF;
z-index: 999;
}

@ -7,20 +7,18 @@
<view class="tab-item" bindtap="changeTab" data-index="2">已完成</view>
</view>
<view wx:if="{{currentTab==0}}">
<view class="reserved">
<view class="content-container">
<image class="image" src="/images/user.png"></image>
<view class="text-container">
<text class="title">已预约订单名称</text>
<view>
<text class="description">
电话号码:{{item.phone}}
email{{item.email}}
其他信息null
</text>
</view>
</view>
<view class="reserved" wx:if="{{currentTab==0}}">
<view class="content-container">
<image class="image" src="/images/user.png"></image>
<view class="text-container">
<text class="title">已预约订单名称</text>
<view>
<text class="description">
电话号码:{{item.phone}}
email{{item.email}}
其他信息null
</text>
</view>
</view>
</view>
</view>

@ -3,7 +3,7 @@
.tab{
display: flex;
justify-content: space-around;
background-color: #838d9e;
background-color: #c9d9f5;
height: 45px;
border-radius: 0 0 30rpx 30rpx;
}
@ -44,7 +44,7 @@
/* height: 10%; */
margin: 10rpx auto;
padding: 25rpx;
background-color: #83acc4;
background-color: #abdefc;
border-radius: 10rpx;
box-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.1);
}

@ -27,12 +27,12 @@
</view>
<view class="input-group">
<text>居住地址:</text>
<input type="text"name="address" placeholder="输入就读专业及年级" class="input" />
<input type="text"name="address" placeholder="输入现居住地址" class="input" />
</view>
</view>
<view class="container">
<!-- <view class="container">
<text>空闲时间:</text>
<view class="table-container">
<view class="row">
@ -119,8 +119,34 @@
</view>
</view>
</view>
</view> -->
<view class="container">
<text>空闲时间:</text>
<view class="table-container">
<view class="row">
<view class="cell"></view>
<view class="header-cell">周一</view>
<view class="header-cell">周二</view>
<view class="header-cell">周三</view>
<view class="header-cell">周四</view>
<view class="header-cell">周五</view>
<view class="header-cell">周六</view>
<view class="header-cell">周日</view>
</view>
<block wx:for="{{['上午', '中午', '下午']}}" wx:key="index">
<view class="row">
<view class="cell">{{item}}</view>
<block wx:for="{{[0, 1, 2, 3, 4, 5, 6]}}" wx:key="index">
<view class="checkbox-cell">
<checkbox bindchange="checkboxChange" value="{{index}}-{{loop.index0}}"></checkbox>
</view>
</block>
</view>
</block>
</view>
</view>
<view class="container">
<view class="input-group">
<text>教员风采:</text>
@ -142,6 +168,7 @@
<!-- 添加提交按钮 -->
<button class="submit-btn" form-type="submit">提交</button>
</view>
</form>
</view>

@ -56,5 +56,5 @@
}
},
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "miniprogram"
"projectname": "miniProgram3"
}
Loading…
Cancel
Save