Commit fec08629 by shijiuyan

Merge remote-tracking branch 'origin/master'

parents 404aef43 7d095c3f
<?php
// 圈子创建第一步
require_once ("../user_include.inc");
ErrorLogger::doOutput("Compass...ajax_circle_new1.php....Start.", 0);
//获取参数
$unionId = ParamUtil::getRequestString("unionId");
$circleId = ParamUtil::getRequestNumber("circleId", 0);
$title = ParamUtil::getRequestString("title");//圈子名称
$needCheck = ParamUtil::getRequestBoolean("needCheck", false);//圈子名称
$longitude = ParamUtil::getRequestString("longitude");//用户位置的经度
$latitude = ParamUtil::getRequestString("latitude");//用户位置的纬度
$province = ParamUtil::getRequestString("province");
$city = ParamUtil::getRequestString("city");
$district = ParamUtil::getRequestString("district");
$result = array();
//参数检查
if(empty($unionId) || empty($circleId) || empty($title) || empty($longitude) || empty($latitude)) {
$result["message"] = "参数错误!";
responseNG($result);
}
//判断用户是否存在
$param = array();
$param['unionid'] = $unionId;
$param['delete_flg'] = false;
$userList = UserMst::getList($param,'id','desc', 0, 1);
if(empty($userList)) {
$result["message"] = "用户不存在!";
responseNG($result);
}
$userMst = $userList[0];
//圈子是否存在
$param = array();
$param['id'] = $circleId;
$param['owner_id'] = $userMst->id;
$param['delete_flg'] = false;
$circleDatList = CircleDat::getList($param,'id','desc', 0, 1);
if(empty($circleDatList)) {
$result["message"] = "圈子不存在!";
responseOK($result);
}
$circleDat = $circleDatList[0];
//编辑圈子
$circleDat->title = $title;
$circleDat->need_check = $needCheck;
$circleDat->longitude = $longitude;
$circleDat->latitude = $latitude;
$circleDat->province = $province;
$circleDat->city = $city;
$circleDat->district = $district;
$circleDat->owner_id = $userMst->id;
$circleDat->save();
//返回数据
$result["message"] = "编辑成功!";
$result["circleDat"] = $circleDat;
responseOK($result);
responseNG($result);
ErrorLogger::doOutput("Compass...ajax_circle_new1.php....End.", 0);
//返回结果
responseOK($result);
function responseNG($result) {
$result = array("status"=>"NG", "result"=>$result);
print json_encode($result);
exit;
}
function responseOK($result) {
$result = array("status"=>"OK", "result"=>$result);
print json_encode($result);
exit;
}
?>
\ No newline at end of file
<?
// 圈子创建第2步,提交介绍和封面图片
require_once ("../user_include.inc");
ErrorLogger::doOutput("Compass...ajax_circle_edit2.php....Start.", 0);
//获取参数
$unionId = ParamUtil::getRequestString("unionId");
$circleId = ParamUtil::getRequestNumber("circleId", 0);
$comment = ParamUtil::getRequestString("comment");
//清理圈子相册数据
$clear = ParamUtil::getRequestBoolean("clear");
$deleteImages = ParamUtil::getRequestString("deleteImages");
//参数验证
if(empty($unionId) || empty($circleId)) {
$result["message"] = "参数错误!";
responseNG($result);
}
//判断用户是否已经存在
$param = array();
$param['unionid'] = $unionId;
$param['delete_flg'] = false;
$userList = UserMst::getList($param,'id','desc', 0, 1);
if(empty($userList)) {
$result["message"] = "用户不存在!";
responseOK($result);
}
$userMst = $userList[0];
//圈子是否存在
$param = array();
$param['id'] = $circleId;
$param['owner_id'] = $userMst->id;
$param['delete_flg'] = false;
$circleDatList = CircleDat::getList($param,'id','desc', 0, 1);
if(empty($circleDatList)) {
$result["message"] = "数据错误!";
responseOK($result);
}
$circleDat = $circleDatList[0];
//带有comment的时候
if(!empty($comment)) {
$circleDat->comment = $comment;
$circleDat->save();
}
//处理图片
//处理上传图片【封面】
if(!empty($_FILES['frontImage']['tmp_name'])){
$aliHandler = new AliUploadHandler();
$upload_file = FileUploadUtil::getScalarFile(@$_FILES['frontImage']);
$tmp_file_name = date("Ymd") . "_" . trim(basename($upload_file->name));//保存的名字自定义,这里如果图片的名字原来的是aa.jp,保存成20200220_aa.jpg
$url = $aliHandler->uploadImg($tmp_file_name, $upload_file->tmp_name);
ErrorLogger::doOutput("Compass...ajax_circle_edit2.php....url1=" . $url, 0);
//这里的url就是http://compass-dev.oss-cn-beijing.aliyuncs.com/20200220_aa.jpg
$oldFrontImage = $circleDat->front_image;
$circleDat->front_image = $url;
$circleDat->save();
//删除oss的图片
$aliHandler->delete($oldFrontImage);
}
//处理上传图片【图片】
if(!empty($_FILES['image']['tmp_name'])){
$aliHandler = new AliUploadHandler();
$upload_file = FileUploadUtil::getScalarFile(@$_FILES['image']);
$tmp_file_name = date("Ymd") . "_" . trim(basename($upload_file->name));//保存的名字自定义,这里如果图片的名字原来的是aa.jp,保存成20200220_aa.jpg
ErrorLogger::doOutput("Compass...ajax_circle_edit2.php....tmp_file_name==".$_FILES['image']['size'], 0);
$url = $aliHandler->uploadImg($tmp_file_name, $upload_file->tmp_name);
//这里的url就是http://compass-dev.oss-cn-beijing.aliyuncs.com/20200220_aa.jpg
$circleDat = CircleDat::getById($circleId);
if(empty($circleDat->images)) {
$circleDat->images = $url;
} else {
$circleDat->images = $circleDat->images . "|" . $url;
}
$circleDat->save();
}
//清理相册已经删除的图片
if($clear==true && !empty($deleteImages) && !empty($circleDat->images)) {
$aliHandler = new AliUploadHandler();
$images = "|" . $circleDat->images;
//竖线分割为数组
$deleteImageArray = explode("|",$deleteImages);
if(!empty($deleteImageArray)) {
foreach($deleteImageArray as $deleteImage) {
ErrorLogger::doOutput("Compass...ajax_circle_edit2.php....images==" . $images, 0);
$images = str_replace("|".$deleteImage,"",$images);
//删除oss的图片
$aliHandler->delete($deleteImage);
}
}
//更新回数据库
if(empty($images)) {
$circleDat->images = "";
} else {
$circleDat->images = substr($images, 1);
}
//$circleDat->save();
}
ErrorLogger::doOutput("Compass...ajax_circle_edit2.php....End.", 0);
$result["message"] = "提交成功!";
responseOK($result);
function responseNG($result) {
$result = array("status"=>"NG", "result"=>$result);
print json_encode($result);
exit;
}
function responseOK($result) {
$result = array("status"=>"OK", "result"=>$result);
print json_encode($result);
exit;
}
?>
\ No newline at end of file
......@@ -27,8 +27,8 @@ if(empty($userList)) {
$result["message"] = "用户不存在!";
responseNG($result);
}
$userMst = $userList[0];
$ownerId = 0;
$isOwner = false;//是否为圈主
......
......@@ -28,6 +28,7 @@ if(empty($userList)) {
$result["message"] = "用户不存在!";
responseNG($result);
}
$userMst = $userList[0];
//判断圈子是否存在
$circleDat = CircleDat::getById($circleId);
......@@ -36,15 +37,22 @@ if(empty($circleDat)) {
responseNG($result);
}
//获取圈子最新一条公告信息
//是否为圈主
$isOwner = false;
if($circleDat->owner_id == $userMst->id) {
$isOwner = true;
}
//获取圈子公告信息
$param = array();
$param['circle_id'] = $circleDat->id;
$param['delete_flg'] = false;
$noticeList = CircleNoticeDat::getList($param, "id", "desc", 0, 1);
$noticeList = CircleNoticeDat::getList($param, "id", "desc");
ErrorLogger::doOutput("Compass...ajax_get_circle_notice_list.php....End.", 0);
//返回结果
$result["isOwner"] = $isOwner;
$result["noticeList"] = $noticeList;
responseOK($result);
......
......@@ -14,7 +14,7 @@ $comment = ParamUtil::getRequestString("comment");//公告标题正文
$result = array();
//参数检查
if(empty($unionId) || empty($circleId)|| empty($title)|| empty($comment)) {
if(empty($unionId) || empty($circleId)) {
$result["message"] = "参数错误!";
responseNG($result);
}
......@@ -46,22 +46,35 @@ if($circleDat->owner_id != $userMst->id) {
}
//发布公告
$noticeDat = new CircleNoticeDat();
$noticeDat->circle_id = $circleDat->id;
$noticeDat->title = $title;
$noticeDat->comment = $comment;
if(!empty($title) && !empty($comment)) {
$noticeDat = new CircleNoticeDat();
$noticeDat->circle_id = $circleDat->id;
$noticeDat->title = $title;
$noticeDat->comment = $comment;
$noticeDat->save();
}
//上传图片到阿里云oss
$aliHandler = new AliUploadHandler();
if(!empty($_FILES['image']['tmp_name'])){
$upload_file = FileUploadUtil::getScalarFile(@$_FILES['image']);
$tmp_file_name = date("Ymd") . "_" . trim(basename($upload_file->name));//保存的名字自定义,这里如果图片的名字原来的是aa.jp,保存成20200220_aa.jpg
$url = $aliHandler->uploadImg($tmp_file_name, $upload_file->tmp_name);
ErrorLogger::doOutput($url);
//这里的url就是http://compass-dev.oss-cn-beijing.aliyuncs.com/20200220_aa.jpg
$noticeDat->image = $url;
//查找最新一条公告
$param = array();
$param['circle_id'] = $circleDat->id;
$param['delete_flg'] = false;
$noticeDatList = CircleNoticeDat::getList($param,"id","desc",0,1);
if(!empty($noticeDatList)) {
$noticeDat = $noticeDatList[0];
$aliHandler = new AliUploadHandler();
$upload_file = FileUploadUtil::getScalarFile(@$_FILES['image']);
$tmp_file_name = date("Ymd") . "_" . trim(basename($upload_file->name));//保存的名字自定义,这里如果图片的名字原来的是aa.jp,保存成20200220_aa.jpg
$url = $aliHandler->uploadImg($tmp_file_name, $upload_file->tmp_name);
ErrorLogger::doOutput($url);
//这里的url就是http://compass-dev.oss-cn-beijing.aliyuncs.com/20200220_aa.jpg
$noticeDat->image = $url;
$noticeDat->save();
}
}
$noticeDat->save();
ErrorLogger::doOutput("Compass...ajax_set_circle_notice_new.php....End.", 0);
//返回结果
......
......@@ -16,6 +16,7 @@
"pages/searchCircle/searchCircle",
"pages/newCircleEvent/newCircleEvent",
"pages/circleDetails/circleDetails",
"pages/circleNoticeNew/circleNoticeNew",
"pages/classDetails/classDetails",
"pages/jump/jump",
"pages/history/history",
......
......@@ -62,7 +62,7 @@ Page({
//圈子公告
circleNews(){
wx.navigateTo({
url: '../circleNotice/circleNotice' + this.data.circleId,
url: '../circleNotice/circleNotice?circleId=' + this.data.circleId,
})
},
......
......@@ -30,7 +30,6 @@
}
.top_testCircle>image{
width: 100%;
height: 130px;
}
.top_circleGonggao{
width: 100%;
......
// pages/activeManagement/activeManagement.js
// pages/circleNotice/circleNotice.js
var app = getApp();
Page({
......@@ -6,21 +6,25 @@ Page({
* 页面的初始数据
*/
data: {
circleId: 0,
isOwner: false,
noticeList: []
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var that = this;
that.setData({
circleId: options.circleId
})
var config = wx.getStorageSync('config');
wx: wx.request({
wx.request({
url: app.url + 'ajax_get_circle_notice_list.php',
data: {
unionId: config.unionId,
circleId:7
circleId:that.data.circleId
},
header: { 'content-type': 'application/json' },
method: 'GET',
......@@ -28,7 +32,10 @@ Page({
success: function (res) {
console.log(res)
if (res.statusCode == 200) {
that.setData({
isOwner: res.data.result.isOwner,
noticeList: res.data.result.noticeList
})
}
},
fail: function (res) { },
......@@ -50,32 +57,11 @@ Page({
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
//发布公告
noticeNew() {
wx.navigateTo({
url: '../circleNoticeNew/circleNoticeNew?circleId=' + this.data.circleId,
});
},
/**
......
{
"usingComponents": {}
"usingComponents": {},
"navigationBarTitleText": "圈子公告"
}
\ No newline at end of file
<!--pages/activeManagement/activeManagement.wxml-->
<view class='activeManagement'>
<view class='top_activeManagement'>滴滴滴!圈主邀请您参加活动,点击进入,参加报名吧</view>
<view class='listVolunteers'>
<view>
<view class='left_listVolunteers'>
<image src='../../img/3.jpg'></image>
<text>征集中</text>
<view>(市)</view>
</view>
<view class='right_listVolunteers'>
<text>周末图书馆清洁活动</text>
<view>
<text>征集范围:校内\n</text>
<text>征集人数:10人\n</text>
<text>发布单位:南京市教育局\n</text>
<text>报名截止:2019.10.10</text>
</view>
</view>
</view>
<view>
<view class='left_listVolunteers'>
<image src='../../img/3.jpg'></image>
<text>征集中</text>
<view>(校)</view>
</view>
<view class='right_listVolunteers'>
<text>敬老院探望老人活动</text>
<view>
<text>征集范围:校内\n</text>
<text>征集人数:15人\n</text>
<text>发布单位:南京市教育局\n</text>
<text>报名截止:2019.11.10</text>
</view>
</view>
</view>
<view>
<view class='left_listVolunteers'>
<image src='../../img/3.jpg'></image>
<text>征集中</text>
<view>(市)</view>
</view>
<view class='right_listVolunteers'>
<text>周末图书馆清洁活动</text>
<view>
<text>征集范围:校内\n</text>
<text>征集人数:10人\n</text>
<text>发布单位:南京市教育局\n</text>
<text>报名截止:2019.10.10</text>
</view>
</view>
</view>
<view>
<view class='left_listVolunteers'>
<image src='../../img/3.jpg'></image>
<text>已结束</text>
<view>(社)</view>
</view>
<view class='right_listVolunteers'>
<text>敬老院探望老人活动</text>
<view>
<text>征集范围:校内\n</text>
<text>征集人数:15人\n</text>
<text>发布单位:南京市教育局\n</text>
<text>报名截止:2019.11.10</text>
</view>
</view>
</view>
<!--pages/circleNotice/circleNotice.wxml-->
<view class='circleNotice'>
<view style='position: fixed;bottom: 0;left: 0;font-size:14px;color:#fff;background: #0D76ED;width: 100%;height: 40px;line-height: 40px;text-align: center;'bindtap="noticeNew" wx:if="{{isOwner}}">
发布公告
</view>
<view class="noticeItem" wx:for="{{noticeList}}">
<view class="title">{{item.title}}</view>
<view class="time">发布时间 : {{item.registration_date}}</view>
<image src='{{item.image}}'></image>
<view class="comment">{{item.comment}}</view>
</view>
</view>
/* pages/activeManagement/activeManagement.wxss */
.top_activeManagement{
font-size: 12px;
color: red;
box-sizing: border-box;
padding-left: 30px;
.circleNotice{
margin-top: 10px;
margin-bottom: 50px;
width: 96%;
display: flex;
flex-direction:column;
justify-content : space-between;
align-items:center;
font-size: 14px;
}
.noticeItem{
margin-top: 10px;
width: 90%;
display: flex;
flex-direction:column;
justify-content : space-between;
align-items:center;
font-size: 15px;
border-bottom: 1rpx solid #FCFCFC;
}
.noticeItem>image{
width:100%;
}
.noticeItem .title{
bottom: 3px;
left: 0;
width:100%;
height:35px;
line-height: 35px;
text-align: left;
font-size: 15px;
font-weight: bold;
}
.noticeItem .time{
bottom: 3px;
left: 0;
width:100%;
height:25px;
line-height: 25px;
text-align: right;
color: #878787;
}
.noticeItem .comment{
bottom: 3px;
left: 0;
width:100%;
line-height: 25px;
text-align: left;
font-size: 15px;
margin-bottom: 10px;
}
\ No newline at end of file
// pages/circleNoticeNew/circleNoticeNew.js
import Notify from '../../dist/notify/notify';
var app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
circleId: '',
circleDat: null,
title: '',
comment:'',
fileList: [],
imagePath:'',
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
//获取参数
this.setData({
circleId: options.circleId
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
//第1张图片
delete(event) {
const { index, name } = event.detail;
const fileList = this.data[`fileList`];
fileList.splice(index, 1);
this.setData({ [`fileList`]: fileList });
},
afterRead(event) {
const { file, name } = event.detail;
const fileList = this.data[`fileList`];
this.setData({
[`fileList`]: fileList.concat(file),
imagePath: file[0].path
});
},
beforeRead(event) {
const { file, callback } = event.detail;
if (file[0].path.indexOf('jpg') < 0) {
wx.showToast({ title: '请选择jpg图片上传', icon: 'none' });
callback(false);
return;
}
callback(true);
},
//发布公告
publish(){
var that = this;
//内容必须输入
if (that.data.title == null || that.data.title.trim() == "") {
Notify('请公告标题')
return
}
//内容必须输入
if (that.data.comment == null || that.data.comment.trim() == "") {
Notify('请公告内容')
return
}
var config = wx.getStorageSync('config');
wx.request({
url: app.url + 'ajax_set_circle_notice_new.php',
data: {
unionId: config.unionId,
circleId: that.data.circleId,
title: that.data.title,
comment: that.data.comment,
},
header: { 'content-type': 'application/json' },
method: 'GET',
dataType: 'json',
success: function (res) {
if (that.data.imagePath != null && that.data.imagePath != undefined) {
wx.uploadFile({
url: app.url + 'ajax_set_circle_notice_new.php?unionId=' + config.unionId + "&circleId=" + that.data.circleId,
filePath: that.data.imagePath,
name: 'image',
header: { 'content-type': 'multipart/form-data' },
success: function (res) {
Notify('发布成功!')
//循环执行等待全部结束
var a = setInterval(function () {
//跳转到圈子首页
wx.navigateTo({
url: '../circleDetails/circleDetails?circleId=' + that.data.circleId,
});
//循环执行代码
clearInterval(a)
}, 1000) //循环时间 这里是1秒
},
fail: function (res) {
console.log(res, '上传失败')
},
complete: function (res) {
},
})
}
},
fail: function (res) { },
complete: function (res) { },
})
},
//获取输入的公告标题
inputTitle(event){
this.setData({
title: event.detail.value
})
},
//获取输入的公告内容
inputComment(event) {
this.setData({
comment: event.detail.value
})
}
})
\ No newline at end of file
{
"usingComponents": {},
"navigationBarTitleText": "发布公告"
}
\ No newline at end of file
<!--pages/joinSocialEvent/joinSocialEvent.wxml-->
<view class='uploadDocuments'>
<view style='width:100%;background:#fff'>
<view class='textTitle'>
公告标题:
</view>
<input class='inputTitle' name='title' bindinput="inputTitle" value='{{title}}' />
<view class='textTitle'>
公告内容:
</view>
<textarea class='inputComment' bindinput="inputComment" value='{{comment}}'></textarea>
<view style="width:90%;margin:10px auto;">公告图片:</view>
<view class='uploadDocuments_img'>
<view>
<van-uploader file-list="{{ fileList }}"
max-count="1"
multiple
bind:after-read="afterRead"
bind:before-read="beforeRead"
use-before-read="{{ true }}"
bind:delete="delete"/>
<text style='font-size:12px;color:#666'>仅支持jpg格式</text>
</view>
<text style='font-size:14px;color:#666'></text>
</view>
</view>
<view style='width:100%;display:flex;justify-content: center;'>
<view class="actionBtn" bindtap="publish">确认发布</view>
</view>
<van-notify id="van-notify" />
</view>
/* pages/uploadDocuments/uploadDocuments.wxss */
page{
width: 100%;
height: 100%;
background: #f5f5f5;
}
.uploadDocuments{
width: 100%;
margin: 0 auto;
font-size: 14px;
background: #fff;
}
.textTitle{
width: 90%;
height:30px;
line-height: 30px;
margin: 20px auto 0;
}
.inputTitle{
display: block;
width: 90%;
height: 25px;
border: 1px solid #f0f0f0;
font-size: 12px;
padding: 5px;
margin: 15px auto;
}
.inputComment{
display: block;
width: 90%;
height: 60px;
border: 1px solid #f0f0f0;
font-size: 12px;
padding: 5px;
margin: 15px auto;
}
.uploadDocuments_img{
width: 90%;
display: flex;
height: 126px;
margin: 10px auto;
}
.uploadDocuments_img>view{
width: 100px;
height: 100px;
}
.actionBtn{
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 40px;
line-height: 40px;
text-align: center;
font-size: 14px;
background: #0D76ED;
color: #fff;
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment