Commit 425d1713 by biao

11111

parent 9173d5a5
......@@ -184,6 +184,20 @@ CREATE TABLE IF NOT EXISTS circle_notice_dat(
Create INDEX circle_notice_dat_circle_id_idx ON circle_notice_dat(circle_id);
##----circle_moment_dat create
DROP TABLE IF EXISTS circle_moment_dat;
CREATE TABLE IF NOT EXISTS circle_moment_dat(
id bigint unsigned NOT NULL PRIMARY KEY auto_increment,
registration_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
circle_id int8 NOT NULL DEFAULT '0',
comment text,
images text,
delete_flg tinyint(1) NOT NULL DEFAULT '0'
) ENGINE = INNODB DEFAULT CHARSET=utf8mb4;
Create INDEX circle_moment_dat_circle_id_idx ON circle_moment_dat(circle_id);
##----circle_member_dat create
......
doc/c1.jpg

92.1 KB

doc/c2.jpg

48.2 KB

......@@ -36,7 +36,7 @@ class CircleDat extends CompassDynamicData
$this->member_count = $record["member_count"];
$this->need_check = $record["need_check"];
$this->front_image = $record["front_image"];
$this->images = $record["images"];
$this->images = $record["images"];
$this->comment = $record["comment"];
$this->longitude = $record["longitude"];
$this->latitude = $record["latitude"];
......
<?php
/**
* CircleMomentDat Entity
* $Id: CircleMomentDat.inc,v 1.1 2020/2/27 14:40:01 Exp $
* @author zb
* @package jp.compass.entity
* @access public
*/
class CircleMomentDat extends CompassDynamicData
{
var $circle_id;
var $comment;
var $images;
var $delete_flg;
/**
* 构造实现。circle_moment_dat创建实例。
*
* @access public
* @param mixed circle_moment_dat
*/
function constructor($record)
{
parent::constructor($record);
$this->circle_id = $record["circle_id"];
$this->comment = $record["comment"];
$this->images = $record["images"];
$this->delete_flg = $record["delete_flg"];
}
/**
* 根据条件,获取数据列表。
* 条件与DBManager的doSelect相同。
* @access public
* @static
* @param array 检索条件
* @return array Entity的队列
*/
public static function getList($w_param = null, $orderkey = null, $direction = "ASC", $offset = null, $limit = null)
{
if ($w_param == null) {
$w_param = array();
$w_param["delete_flg"] = "false";
}
return CompassDBHandler::getList("CircleMomentDat", "circle_moment_dat", $w_param, $orderkey, $direction, $offset, $limit);
}
/**
* 根据条件,获取数据列表的件数。
* 条件与DBManager的doSelect相同。
* @access public
* @static
* @param array 检索条件
* @return array Entity的队列
*/
public static function getListCount($w_param = null)
{
if ($w_param == null) {
$w_param = array();
$w_param["delete_flg"] = "false";
}
$db = CompassDBManager::getInstance();
$result = $db->doSelect("circle_moment_dat", $w_param, null, null, null, null, "count(*) as count");
return $result[0]["count"];
}
/**
* 获得此类指定ID的实例。
*/
public static function getById($id)
{
// delete_flg
$param = array();
$param["delete_flg"] = false;
return CompassDBHandler::getById("CircleMomentDat", "circle_moment_dat", $id, $param);
}
// -- 这里开始Dynamic ---
/**
* 将此实例写入DB。
* DynamicData共用的保存方法。
* @access public
* @return int 写入实例的ID
*/
public function save()
{
$v_param = array();
ParamUtil::copyObj2Array($v_param, $this, "circle_id");
ParamUtil::copyObj2ArrayNullField($v_param, $this, "comment");
ParamUtil::copyObj2ArrayNullField($v_param, $this, "images");
ParamUtil::copyObj2Array($v_param, $this, "delete_flg");
// 保存
parent::_save("circle_moment_dat", $v_param);
}
}
\ No newline at end of file
......@@ -16,6 +16,7 @@ require_once(COMPASS_LIB_ROOT . "/cn/compass/entity/CompassDynamicData.inc");
require_once(COMPASS_LIB_ROOT . "/cn/compass/entity/AccountMst.inc");
require_once(COMPASS_LIB_ROOT . "/cn/compass/entity/CircleDat.inc");
require_once(COMPASS_LIB_ROOT . "/cn/compass/entity/CircleNoticeDat.inc");
require_once(COMPASS_LIB_ROOT . "/cn/compass/entity/CircleMomentDat.inc");
require_once(COMPASS_LIB_ROOT . "/cn/compass/entity/CircleMemberDat.inc");
require_once(COMPASS_LIB_ROOT . "/cn/compass/entity/ClassMst.inc");
require_once(COMPASS_LIB_ROOT . "/cn/compass/entity/EventDat.inc");
......
......@@ -3,7 +3,7 @@
// 圈子创建第一步
require_once ("../user_include.inc");
ErrorLogger::doOutput("Compass...ajax_circle_new1.php....Start.", 0);
ErrorLogger::doOutput("Compass...ajax_circle_edit.php....Start.", 0);
//获取参数
$unionId = ParamUtil::getRequestString("unionId");
......@@ -12,6 +12,7 @@ $title = ParamUtil::getRequestString("title");//圈子名称
$needCheck = ParamUtil::getRequestBoolean("needCheck", false);//圈子名称
$longitude = ParamUtil::getRequestString("longitude");//用户位置的经度
$latitude = ParamUtil::getRequestString("latitude");//用户位置的纬度
$comment = ParamUtil::getRequestString("comment");//圈子简介
$province = ParamUtil::getRequestString("province");
$city = ParamUtil::getRequestString("city");
......@@ -20,7 +21,7 @@ $district = ParamUtil::getRequestString("district");
$result = array();
//参数检查
if(empty($unionId) || empty($circleId) || empty($title) || empty($longitude) || empty($latitude)) {
if(empty($unionId) || empty($circleId)) {
$result["message"] = "参数错误!";
responseNG($result);
}
......@@ -52,15 +53,37 @@ if(empty($circleDatList)) {
$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();
if(!empty($title)) {
$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->comment = $comment;
$circleDat->save();
} else {
//上传图片处理
ErrorLogger::doOutput("Compass...ajax_circle_edit.php....here!!", 0);
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_edit.php....url1=" . $url, 0);
//这里的url就是http://compass-dev.oss-cn-beijing.aliyuncs.com/20200220_aa.jpg
$circleDat->front_image = $url;
$circleDat->save();
//返回数据
$result["message"] = "编辑成功!";
$result["circleDat"] = $circleDat;
responseOK($result);
}
}
//返回数据
$result["message"] = "编辑成功!";
......@@ -69,7 +92,7 @@ responseOK($result);
responseNG($result);
ErrorLogger::doOutput("Compass...ajax_circle_new1.php....End.", 0);
ErrorLogger::doOutput("Compass...ajax_circle_edit.php....End.", 0);
//返回结果
responseOK($result);
......
<?
// 圈子创建第2步,提交介绍和封面图片
// 添加圈子动态
require_once ("../user_include.inc");
ErrorLogger::doOutput("Compass...ajax_circle_new2.php....Start.", 0);
ErrorLogger::doOutput("Compass...ajax_circle_moment_new.php....Start.", 0);
//获取参数
$unionId = ParamUtil::getRequestString("unionId");
......@@ -42,54 +42,39 @@ $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_new2.php....url1=" . $url, 0);
//这里的url就是http://compass-dev.oss-cn-beijing.aliyuncs.com/20200220_aa.jpg
$circleDat->front_image = $url;
$circleDat->save();
//自动发布一条公告!
$circleNoticeDat = new CircleNoticeDat();
$circleNoticeDat->circle_id = $circleDat->id;
$circleNoticeDat->title = $circleDat->title . "圈子成立公告";
$circleNoticeDat->comment = $circleDat->comment;
$circleNoticeDat->image = $circleDat->front_image;
$circleNoticeDat->save();
}
//处理上传图片【图片】
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
//添加动态
$circleMomentDat = new CircleMomentDat();
$circleMomentDat->circle_id = $circleDat->id;
$circleMomentDat->comment = $comment;
$circleMomentDat->save();
} else {
//处理上传图片【图片】
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
$url = $aliHandler->uploadImg($tmp_file_name, $upload_file->tmp_name);
ErrorLogger::doOutput("Compass...ajax_circle_moment_new.php....url2=" . $url, 0);
//这里的url就是http://compass-dev.oss-cn-beijing.aliyuncs.com/20200220_aa.jpg
$param = array();
$param['circle_id'] = $circleId;
$param['delete_flg'] = false;
$tmpList = CircleMomentDat::getList($param,"id","desc",0,1);
if(!empty($tmpList)) {
$circleMomentDat = $tmpList[0];
if(empty($circleMomentDat->images)) {
$circleMomentDat->images = $url;
} else {
$circleMomentDat->images = $circleMomentDat->images . "|" . $url;
}
$circleMomentDat->save();
}
$url = $aliHandler->uploadImg($tmp_file_name, $upload_file->tmp_name);
ErrorLogger::doOutput("Compass...ajax_circle_new2.php....url2=" . $url, 0);
//这里的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();
}
ErrorLogger::doOutput("Compass...ajax_circle_new2.php....End.", 0);
ErrorLogger::doOutput("Compass...ajax_circle_moment_new.php....End.", 0);
$result["message"] = "提交成功!";
responseOK($result);
......
......@@ -3,14 +3,16 @@
// 圈子创建第一步
require_once ("../user_include.inc");
ErrorLogger::doOutput("Compass...ajax_circle_new1.php....Start.", 0);
ErrorLogger::doOutput("Compass...ajax_circle_new.php....Start.", 0);
//获取参数
$unionId = ParamUtil::getRequestString("unionId");
$circleId = ParamUtil::getRequestNumber("circleId");
$title = ParamUtil::getRequestString("title");//圈子名称
$needCheck = ParamUtil::getRequestBoolean("needCheck", false);//圈子名称
$longitude = ParamUtil::getRequestString("longitude");//用户位置的经度
$latitude = ParamUtil::getRequestString("latitude");//用户位置的纬度
$comment = ParamUtil::getRequestString("comment");//圈子简介
$province = ParamUtil::getRequestString("province");
$city = ParamUtil::getRequestString("city");
......@@ -19,7 +21,7 @@ $district = ParamUtil::getRequestString("district");
$result = array();
//参数检查
if(empty($unionId) || empty($title) || empty($longitude) || empty($latitude)) {
if(empty($unionId)) {
$result["message"] = "参数错误!";
responseNG($result);
}
......@@ -36,58 +38,102 @@ if(empty($userList)) {
}
$userMst = $userList[0];
//检查圈子数量
$param = array();
$param['owner_id'] = $userMst->id;
$param['delete_flg'] = false;
$circleCount = CircleDat::getListCount($param);
if($circleCount >= MAX_CIRCLE_COUNT) {
$result["message"] = "最多只能创建" + MAX_CIRCLE_COUNT + "个圈子!";
responseNG($result);
}
//建立圈子
$circleDat = new CircleDat();
$circleDat->title = $title;
$circleDat->need_check = $needCheck;
$circleDat->member_count = 1;
$circleDat->longitude = $longitude;
$circleDat->latitude = $latitude;
$circleDat->province = $province;
$circleDat->city = $city;
$circleDat->district = $district;
$circleDat->owner_id = $userMst->id;
$circleDat->save();
//返回创建的圈子
$param = array();
$param['owner_id'] = $userMst->id;
$param['delete_flg'] = false;
$circleList = CircleDat::getList($param, "id", "desc", 0, 1);
if(!empty($circleList)) {
$circleDat = $circleList[0];
//同步插入圈子成员表
$circleMemberDat = new CircleMemberDat();
$circleMemberDat->circle_id = $circleDat->id;
$circleMemberDat->user_id = $userMst->id;
$circleMemberDat->name = $userMst->name;
$circleMemberDat->header_img = $userMst->header_img;
$circleMemberDat->is_owner = true;
$circleMemberDat->save();
$circleDat = null;
if(!empty($title)) {
//检查圈子数量
$param = array();
$param['owner_id'] = $userMst->id;
$param['delete_flg'] = false;
$circleCount = CircleDat::getListCount($param);
if($circleCount >= MAX_CIRCLE_COUNT) {
$result["message"] = "最多只能创建" + MAX_CIRCLE_COUNT + "个圈子!";
responseNG($result);
}
//建立圈子
$circleDat = new CircleDat();
$circleDat->title = $title;
$circleDat->need_check = $needCheck;
$circleDat->member_count = 1;
$circleDat->longitude = $longitude;
$circleDat->latitude = $latitude;
$circleDat->province = $province;
$circleDat->city = $city;
$circleDat->district = $district;
$circleDat->owner_id = $userMst->id;
$circleDat->comment = $comment;
$circleDat->save();
//返回数据
$result["message"] = "创建成功!";
$result["circleDat"] = $circleDat;
responseOK($result);
//返回创建的圈子
$param = array();
$param['owner_id'] = $userMst->id;
$param['delete_flg'] = false;
$circleList = CircleDat::getList($param, "id", "desc", 0, 1);
if(!empty($circleList)) {
$circleDat = $circleList[0];
//同步插入圈子成员表
$circleMemberDat = new CircleMemberDat();
$circleMemberDat->circle_id = $circleDat->id;
$circleMemberDat->user_id = $userMst->id;
$circleMemberDat->name = $userMst->name;
$circleMemberDat->header_img = $userMst->header_img;
$circleMemberDat->is_owner = true;
$circleMemberDat->save();
//返回数据
$result["message"] = "创建成功!";
$result["circleDat"] = $circleDat;
responseOK($result);
}
} else {
//上传图片接口处理
//圈子是否存在
$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];
//圈子是否存在
//处理上传图片【封面】
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_new.php....url1=" . $url, 0);
//这里的url就是http://compass-dev.oss-cn-beijing.aliyuncs.com/20200220_aa.jpg
$circleDat->front_image = $url;
$circleDat->save();
//自动发布一条公告!
$circleNoticeDat = new CircleNoticeDat();
$circleNoticeDat->circle_id = $circleDat->id;
$circleNoticeDat->title = $circleDat->title . "圈子成立公告";
$circleNoticeDat->comment = $circleDat->comment;
$circleNoticeDat->image = $circleDat->front_image;
$circleNoticeDat->save();
//返回数据
$result["message"] = "创建成功!";
$result["circleDat"] = $circleDat;
responseOK($result);
}
}
$result["message"] = "系统错误!";
responseNG($result);
ErrorLogger::doOutput("Compass...ajax_circle_new1.php....End.", 0);
ErrorLogger::doOutput("Compass...ajax_circle_new.php....End.", 0);
//返回结果
responseOK($result);
......
<?php
// 指定删除圈子
require_once ("../user_include.inc");
ErrorLogger::doOutput("Compass...ajax_delete_circle.php....Start.", 0);
//获取参数
$unionId = ParamUtil::getRequestString("unionId");
$circleId = ParamUtil::getRequestNumber("circleId", 0);//圈子id
$result = array();
//参数检查
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"] = "用户不存在!";
responseNG($result);
}
$userMst = $userList[0];
//判断圈子是否存在
$circleDat = CircleDat::getById($circleId);
if(empty($circleDat)) {
$result["message"] = "圈子不存在!";
responseNG($result);
}
//只有圈主才可以删除
if($circleDat->owner_id != $userMst->id) {
$result["message"] = "只有圈主才可以删除!";
responseNG($result);
}
//删除成员处理
$param = array();
$param['circle_id'] = $circleDat->id;
$param['delete_flg'] = false;
$memberList = CircleMemberDat::getList($param, "id", "asc", 0, 1);
if(!empty($memberList)) {
foreach($memberList as $member) {
$member->delete_flg = true;
$member->save();
}
}
//删除公告
$param = array();
$param['circle_id'] = $circleDat->id;
$param['delete_flg'] = false;
$noticeList = CircleNoticeDat::getList($param, "id", "asc", 0, 1);
if(!empty($noticeList)) {
foreach($noticeList as $notice) {
$notice->delete_flg = true;
$notice->save();
}
}
//删除圈子
$circleDat->delete_flg = true;
$circleDat->save();
//组装返回数据
$result["message"] = "删除成功!";
ErrorLogger::doOutput("Compass...ajax_delete_circle.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
......@@ -58,6 +58,21 @@ if(!empty($tmpList)) {
$noticeDat = $tmpList[0];
}
//获取最新一条动态
$momentDat = null;
//获取圈子最新一条公告信息
$param = array();
$param['circle_id'] = $circleDat->id;
$param['delete_flg'] = false;
$tmpList = CircleMomentDat::getList($param, "id", "desc", 0, 1);
if(!empty($tmpList)) {
$momentDat = $tmpList[0];
if(!empty($momentDat->images)) {
$tmpArr = explode("|",$momentDat->images);
$momentDat->images = array_filter($tmpArr);
}
}
ErrorLogger::doOutput("Compass...ajax_get_circle_info.php....End.", 0);
......@@ -65,6 +80,7 @@ ErrorLogger::doOutput("Compass...ajax_get_circle_info.php....End.", 0);
$result["isOwner"] = $isOwner;
$result["circleDat"] = $circleDat;
$result["noticeDat"] = $noticeDat;
$result["momentDat"] = $momentDat;
responseOK($result);
function responseNG($result) {
......
<?php
// 获取指定圈子的动态信息
require_once ("../user_include.inc");
ErrorLogger::doOutput("Compass...ajax_get_circle_moment_list.php....Start.", 0);
//获取参数
$unionId = ParamUtil::getRequestString("unionId");
$circleId = ParamUtil::getRequestNumber("circleId", 0);//圈子id
$page = ParamUtil::getRequestNumber("page", 0);
$result = array();
//参数检查
if(empty($unionId) || empty($circleId)) {
$result["message"] = "参数错误!";
responseNG($result);
}
$result = array();
//判断用户是否存在
$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];
//判断圈子是否存在
$circleDat = CircleDat::getById($circleId);
if(empty($circleDat)) {
$result["message"] = "圈子不存在!";
responseNG($result);
}
//是否为圈主
$isOwner = false;
if($circleDat->owner_id == $userMst->id) {
$isOwner = true;
}
//获取用户消息列表
$rowCount = 10;
$offset = $page * $rowCount;
//获取圈子动态信息
$momentList = array();
$param = array();
$param['circle_id'] = $circleDat->id;
$param['delete_flg'] = false;
$tmpList = CircleMomentDat::getList($param, "id", "desc", $offset, $rowCount);
$allCount = CircleMomentDat::getListCount($param);
$pageCount = ceil($allCount/$rowCount);
if(!empty($tmpList)) {
foreach($tmpList as $tmp) {
if(!empty($tmp->images)) {
$tmpArr = explode("|",$tmp->images);
$tmp->images = array_filter($tmpArr);
}
$momentList[] = $tmp;
}
}
ErrorLogger::doOutput("Compass...ajax_get_circle_moment_list.php....End.", 0);
//返回结果
$result["pageCount"] = $pageCount;
$result["isOwner"] = $isOwner;
$result["momentList"] = $momentList;
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
......@@ -120,7 +120,7 @@ $param['delete_flg'] = false;
$unreadMessageCount = UserMessageDat::getListCount($param);
//组装返回数据
$result["unreadMessageCount"] = $volunteerEventList;
$result["unreadMessageCount"] = $unreadMessageCount;
$result["volunteerEventList"] = $volunteerEventList;
$result["familyEventList"] = $familyEventList;
$result["socialEventList"] = $socialEventList;
......
......@@ -27,7 +27,8 @@
"pages/register/register",
"pages/courseIndex/courseIndex",
"pages/circleMembers/circleMembers",
"pages/newCircle1/newCircle1",
"pages/circleMoment/circleMoment",
"pages/newCircle/newCircle",
"pages/activeDetails/activeDetails",
"pages/volunteersRank1/volunteersRank1",
"pages/volunteersRank2/volunteersRank2",
......@@ -47,9 +48,9 @@
"pages/inviteCircleMember/inviteCircleMember",
"pages/circleNotice/circleNotice",
"pages/volunteersEventDetail/volunteersEventDetail",
"pages/newCircle2/newCircle2",
"pages/newCircleMoment/newCircleMoment",
"pages/circleEvents/circleEvents",
"pages/editCircle1/editCircle1",
"pages/editCircle/editCircle",
"pages/editCircle2/editCircle2"
],
"window": {
......
......@@ -18,7 +18,6 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.circleShouye()
},
/**
......@@ -32,7 +31,7 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getCircleTopDat()
},
/**
......@@ -72,11 +71,8 @@ Page({
//新建圈子
creatCircle(){
wx.navigateTo({
url: '../newCircle1/newCircle1',
url: '../newCircle/newCircle',
});
wx.setNavigationBarTitle({
title: '我的圈子'
})
},
//查找附近的圈子
......@@ -145,7 +141,7 @@ Page({
})
},
// 圈子首页获取数据
circleShouye(){
getCircleTopDat(){
var that = this;
var config = wx.getStorageSync('config');
// var location = wx.getStorageSync('location');
......
......@@ -9,7 +9,8 @@ Page({
circleId:0,
isOwner:false,
circleDat:null,
noticeDat:null
noticeDat:null,
momentDat: null
},
/**
......@@ -47,8 +48,9 @@ Page({
//圈子编辑
circleEdit() {
//只有群主可以编辑圈子
wx.navigateTo({
url: '../editCircle1/editCircle1?circleId=' + this.data.circleId,
url: '../editCircle/editCircle?circleId=' + this.data.circleId,
})
},
......@@ -86,7 +88,8 @@ Page({
that.setData({
isOwner: res.data.result.isOwner,
circleDat: res.data.result.circleDat,
noticeDat: res.data.result.noticeDat
noticeDat: res.data.result.noticeDat,
momentDat: res.data.result.momentDat
})
}
}
......@@ -108,5 +111,19 @@ Page({
wx.navigateTo({
url: '../circleEvents/circleEvents?circleId=' + this.data.circleId,
})
},
//圈子动态列表
circleMoments() {
wx.navigateTo({
url: '../circleMoment/circleMoment?circleId=' + this.data.circleId,
})
},
//添加圈子动态
creatCircleMoment() {
wx.navigateTo({
url: '../newCircleMoment/newCircleMoment?circleId=' + this.data.circleId,
})
}
})
\ No newline at end of file
......@@ -3,10 +3,14 @@
<view class='top_testCircle'>
<image src='{{circleDat.front_image}}'></image>
<view class='girdList'>
<view bindtap="circleEdit">
<view bindtap="circleEdit" wx:if="{{isOwner}}">
<image src='../../img/c1.png'></image>
<view>圈子编辑</view>
</view>
<view bindtap="circleMoments">
<image src='../../img/c5.png'></image>
<view>圈子动态</view>
</view>
<view bindtap="circleMembers">
<image src='../../img/c2.png'></image>
<view>成员管理</view>
......@@ -30,6 +34,22 @@
<image src='{{noticeDat.image}}'></image>
</view>
</view>
<view class='circleMoment'>
<view class='top_circleMoment'>
<image src='../../img/sanjiao.png'></image>圈子动态
<view class='xinjian' bindtap='creatCircleMoment' wx:if="{{isOwner}}">
<image src='../../img/jia.png'></image>添加动态
</view>
</view>
<view class='con_circleMoment'>
<text class="con_circleMomentComment">{{momentDat.comment}}</text>
<view class='con_circleMomentImages'>
<image src='{{item}}' wx:for="{{momentDat.images}}" mode="aspectFit"></image>
</view>
</view>
</view>
<view class='circleGonggao'>
<view class='top_circleGonggao'>
<image src='../../img/sanjiao.png'></image>圈子简介
......
/* pages/testCircle/testCircle.wxss */
.girdList{
width: 96%;
width: 98%;
margin: 0 auto;
display: flex;
justify-content: space-between;
......@@ -9,8 +9,8 @@
font-size: 12px;
}
.girdList>view{
width: 25%;
height: 73px;
width: 20%;
height: 70px;
display: flex;
justify-content: center;
align-items: center;
......@@ -69,4 +69,59 @@
color: #fff;
border-radius: 15px;
margin: 20px auto;
}
.xinjian{
margin-left: auto;
margin-right: 5%;
display: flex;
align-items: center;
color: #0D76ED;
}
.xinjian>image{
width: 20px;
height: 20px;
margin-right: 5px;
}
.top_circleMoment{
width: 100%;
display: flex;
align-items: center;
font-size: 14px;
margin-top: 10px;
margin-bottom: 20px;
}
.top_circleMoment>image{
width: 12px;
height: 12px;
margin: 0 5px;
}
.con_circleMoment{
width: 100%;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
}
.con_circleMoment .con_circleMomentComment{
font-size: 14px;
width: 90%;
line-height: 18px;
margin: 0 auto;
}
.con_circleMoment .con_circleMomentImages{
width: 90%;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
.con_circleMomentImages>image{
height:75px;
margin-top: 10px;
margin-right: 5px;
}
\ No newline at end of file
// pages/circleMoment/circleMoment.js
var app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
circleId: 0,
page:0,
pageCount:0,
isOwner: false,
momentList: []
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var that = this;
that.setData({
circleId: options.circleId
})
this.getMomentList();
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
//触底以后加载更多
if ((this.data.page + 1) < this.data.pageCount) {
var pageIndex = this.data.page + 1
this.setData({
page: pageIndex
})
this.getMomentList();
} else {
wx.showToast({
title: '没有更多消息啦。',
icon: 'success',
duration: 2000
});
}
},
//发布动态
getMomentList() {
var that = this;
var config = wx.getStorageSync('config');
wx.request({
url: app.url + 'ajax_get_circle_moment_list.php',
data: {
unionId: config.unionId,
circleId: that.data.circleId,
page: that.data.page
},
header: { 'content-type': 'application/json' },
method: 'GET',
dataType: 'json',
success: function (res) {
console.log(res)
if (res.statusCode == 200) {
that.setData({
isOwner: res.data.result.isOwner,
pageCount: res.data.result.pageCount,
momentList: that.data.momentList.concat(res.data.result.momentList)
})
}
},
fail: function (res) { },
complete: function (res) { },
})
},
//发布动态
momentNew() {
wx.navigateTo({
url: '../newCircleMoment/newCircleMoment?circleId=' + this.data.circleId,
});
},
})
\ No newline at end of file
{
"usingComponents": {},
"navigationBarTitleText": "圈子动态"
}
\ No newline at end of file
<!--pages/circleMoment/circleMoment.wxml-->
<view class='circleMoment'>
<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="momentNew" wx:if="{{isOwner}}">
发布动态
</view>
<view class="momentItem" wx:for="{{momentList}}" wx:for-item='momentDat'>
<view class="comment">{{momentDat.comment}}[{{momentDat.registration_date}}]</view>
<view class="images">
<image src='{{item}}' wx:for="{{momentDat.images}}" mode="aspectFit"></image>
</view>
</view>
</view>
.circleMoment{
margin-top: 10px;
margin-left: 2%;
margin-bottom: 50px;
width: 96%;
display: flex;
flex-direction:column;
justify-content : space-between;
align-items:center;
font-size: 14px;
}
.momentItem{
margin-top: 5px;
margin-bottom: 5px;
width: 100%;
display: flex;
flex-direction:column;
justify-content : space-between;
align-items:center;
border-bottom: 1rpx solid #ccc;
}
.momentItem .comment{
width:100%;
line-height: 20px;
text-align: left;
}
.momentItem .images{
width: 100%;
margin-bottom: 10px;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
.images>image{
height:75px;
margin-top: 10px;
margin-right: 5px;
}
// pages/newQuanzi/newQuanzi.js
import Dialog from '../../dist/dialog/dialog';
import Notify from '../../dist/notify/notify';
var app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
circleId: 0,
title: '',
needCheck: false,
servicePlace: '',
isChangeFrontImg:false,
fileList: [],
frontImage: '',
comment:"",
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var that = this;
console.log(options)
if (options.circleId!=0){
this.setData({
circleId: options.circleId
})
}
// var location = wx.getStorageSync('location');
var config = wx.getStorageSync('config');
wx.request({
url: app.url +'ajax_get_circle_info.php',
data:{
unionId:config.unionId,
circleId: options.circleId
},
success(res){
console.log(res.data)
if(res.data.status='OK'){
var place = res.data.result.circleDat.province + res.data.result.circleDat.city + res.data.result.circleDat.district
that.setData({
servicePlace: place,
title:res.data.result.circleDat.title,
needCheck:res.data.result.circleDat.need_check,
comment: res.data.result.circleDat.comment,
fileList: [{ url: res.data.result.circleDat.front_image }],
})
}
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
//判断上传的图片类型
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);
},
afterRead(event) {
const { file } = event.detail;
const fileList = this.data[`fileList`];
this.setData({
[`fileList`]: fileList.concat(file),
frontImage: file[0].path
});
},
delete(event) {
const { index, name } = event.detail;
const fileList = this.data[`fileList`];
fileList.splice(index, 1);
this.setData({
[`fileList`]: fileList,
isChangeFrontImg:true
});
},
//获取圈子名称
onInputTitle(event) {
this.setData({
title: event.detail
})
},
//获取是否需要入圈审核
onChangeNeedCheck({ detail }) {
// 需要手动对 checked 状态进行更新
this.setData({
needCheck: detail
});
},
//获取圈子简介
onInputComment(event) {
this.setData({
comment: event.detail.value
})
},
//删除圈子
deleteCircle() {
//跳转到上传凭证页面
Dialog.confirm({
title: '',
message: '是否删除圈子以及相关数据?'
}).then(() => {
var that = this;
var config = wx.getStorageSync('config');
//调用删除接口
wx.request({
url: app.url + 'ajax_delete_circle.php',
data: {
unionId: config.unionId,
circleId: that.data.circleId
},
header: { 'content-type': 'application/json' },
method: 'GET',
dataType: 'json',
success: function (res) {
console.log(res)
if (res.statusCode == 200) {
if (res.data.status == "OK") {
//删除成功以后跳转到圈子模块首页
wx.switchTab({
url: '../circle/circle',
})
} else {
Notify(res.data.message)
return
}
}
},
fail: function (res) { },
complete: function (res) { },
})
}).catch(() => {
});
},
//提交数据【编辑】
editCircle() {
var that = this;
var config = wx.getStorageSync('config');
var location = wx.getStorageSync('location');
if (that.data.title == null || that.data.title.trim() == "") {
Notify('请输入圈子名称')
return
}
if (location == null || location.latitude == null) {
Notify('请重新定位位置')
return
}
if (that.data.comment == null || that.data.comment.trim() == "") {
Notify('请输入圈子简介')
return
}
if (that.data.fileList.length == 0) {
Notify('请上传圈子封面')
return
}
//提交数据
wx.request({
url: app.url + 'ajax_circle_edit.php',
data: {
unionId: config.unionId,
latitude: location.latitude,
longitude: location.longitude,
province: location.province,
city: location.city,
district: location.district,
title: that.data.title,
comment: that.data.comment,
needCheck: that.data.needCheck,
circleId:that.data.circleId
},
header: { 'content-type': 'application/json' },
method: 'GET',
dataType: 'json',
success: function (res) {
console.log(res)
if (res.statusCode == 200) {
if (res.data.status == "OK" && that.data.isChangeFrontImg==true) {
var filePath = that.data.fileList[0].path;
//上传头像
wx.uploadFile({
url: app.url + 'ajax_circle_edit.php?unionId=' + config.unionId + '&circleId=' + that.data.circleId,
filePath: filePath,
name: 'frontImage',
success: function (resp1) {
//成功以后跳转到下一页面[圈子动态]
wx.redirectTo({
url: '../newCircleMoment/newCircleMoment?circleId=' + that.data.circleId,
})
},
fail: function (err) {
console.log(err)
}
})
} else {
//跳转到圈子动态
wx.navigateTo({
url: '../newCircleMoment/newCircleMoment?circleId=' + that.data.circleId,
})
}
}
},
fail: function (res) { },
complete: function (res) { },
})
},
//重新定位
reLocation() {
var config = wx.getStorageSync('config');
var that = this;
wx.getLocation({
type: 'wgs84',
success: function (res) {
// console.log(res);
var latitude = res.latitude;
var longitude = res.longitude;
let location = {
latitude: res.latitude,
longitude: res.longitude
};
wx.setStorage({
key: 'location',
data: location,
})
wx.request({
url: app.url + 'ajax_get_location_place.php',
data: {
unionId: config.unionId,
latitude: latitude,
longitude: longitude
},
header: { 'content-type': 'application/json' },
method: 'GET',
dataType: 'json',
success: function (res) {
that.setData({
servicePlace: res.data.result.province + res.data.result.city + res.data.result.district,
})
//保存最新地理位置信息
location.province = res.data.result.province,
location.city = res.data.result.city,
location.district = res.data.result.district,
wx.setStorage({
key: 'location',
data: location,
})
},
fail: function (res) { },
complete: function (res) { },
})
}
})
}
})
\ No newline at end of file
......@@ -20,8 +20,30 @@
<view class='shenghe'>
开启后成员加入需圈主审核<van-switch checked="{{ needCheck }}" bind:change="onChangeNeedCheck" size="16px" />
</view>
<view class='newQuanzijianli' bindtap='circleNew1'>
确定
<view class='quanziImg'>
<text style="margin-top:10px;">圈子封面:</text>
<view>
<van-uploader file-list="{{ fileList }}"
max-count="1"
multiple
use-before-read="{{ true }}"
bind:before-read="beforeRead"
bind:after-read="afterRead"
bind:delete="delete"/>
</view>
</view>
<view class='quanziComment'>
<text style="margin-top:10px;">圈子简介:</text>
<textarea bindinput="onInputComment" value='{{comment}}'></textarea>
</view>
<view class='buttons'>
<view class='buttonDelete' bindtap='deleteCircle'>删除</view>
<view class='buttonEdit' bindtap='editCircle'>下一步</view>
</view>
<van-dialog id="van-dialog" />
<van-notify id="van-notify" />
</view>
......@@ -59,17 +59,69 @@ page{
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid #f5f5f5;
margin: 0 auto;
}
.quanziImg{
width: 85%;
height: 150px;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: left;
font-size: 14px;
border-bottom: 1px solid #f5f5f5;
margin: 0 auto;
}
.quanziComment{
width: 85%;
height: 150px;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: left;
font-size: 14px;
color: #666;
border-bottom: 1px solid #f5f5f5;
margin: 0 auto;
}
.newQuanzijianli{
.quanziComment>textarea{
width:90%;
height: 120px;
border: 1px solid #f0f0f0;
margin-top: 15px;
margin-bottom: 15px;
box-sizing: border-box;
padding: 10px;
}
.buttons{
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 40px;
display:flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
.buttonDelete{
width: 35%;
height: 40px;
font-size: 14px;
line-height: 40px;
text-align: center;
background:#8F8F8F;
color: #fff;
}
.buttonEdit{
width: 65%;
height: 40px;
font-size: 14px;
line-height: 40px;
text-align: center;
......
......@@ -11,6 +11,7 @@ Page({
fileList: [],
imageList: [],
headerImg: '',
introduction: '',
frontImage: '',
circleId: 0,
uploadCount: 0,
......@@ -26,8 +27,7 @@ Page({
})
var that = this;
var config = wx.getStorageSync('config');
// var location = wx.getStorageSync('location');
wx: wx.request({
wx.request({
url: app.url + 'ajax_get_circle_info.php',
data: {
unionId: config.unionId,
......
......@@ -11,32 +11,27 @@
</view>
<view class='bot_circleDetails'>
<text>圈子简介</text>
<textarea bindinput="onInputIntroduction" value='{{value}}'></textarea>
<view class='wordPic'>
<view class='con_wordPic'>
<van-button type="default" size='small'>文字</van-button>
<van-button type="default" size='small'>图片</van-button>
<van-button type="default" size='small' bindtap="plusText">文字</van-button>
<van-button type="default" size='small' bindtap="plusImg">图片</van-button>
</view>
</view>
<view class='circleWord'>
<view class='editAreaUp'>
<view class='topWord'>
<text></text>文字<image src='../../img/up.png'></image><image src='../../img/down.png'></image>
<text></text>文字
<image src='../../img/up.png' bindtap="upText"></image>
<image src='../../img/down.png' bindtap="downText"></image>
</view>
<textarea bindinput="onChange" value='{{value}}'></textarea>
<!-- <van-cell-group>
<van-field
value="{{ message }}"
label="留言"
type="textarea"
placeholder="请输入留言"
autosize
border="{{ false }}"
/>
</van-cell-group> -->
</view>
<view class='circleWord'>
<view class='editAreaDown'>
<view class='topWord'>
<text></text>图片<image src='../../img/up.png'></image><image src='../../img/down.png'></image>
<text></text>图片
<image src='../../img/up.png' bindtap="upImg"></image>
<image src='../../img/down.png' bindtap="downImg"></image>
</view>
<view class='addPic'>
<van-uploader file-list="{{ imageList }}"
......
......@@ -39,11 +39,19 @@
float: right;
margin-right: 15px;
}
.circleWord{
.editAreaUp{
width: 100%;
margin-top: 20px;
height: 170px;
}
.editAreaDown{
width: 100%;
margin-top: 20px;
height: 170px;
}
.topWord{
widows: 100%;
height: 30px;
......
......@@ -14,6 +14,7 @@ Page({
headerImg: '../../img/touxiang.png',
roleTitle:'',
unreadMessageCount:0,//未读消息数量
showFamily: false,
showSocial:false,
showNews: true,
......@@ -196,7 +197,8 @@ Page({
socialEventList: res.data.result.socialEventList,
mediaList: res.data.result.mediaList,
isvolunteerEventList: res.data.result.volunteerEventList.length>0?true:false,
ismediaList: res.data.result.mediaList.length>0?true:false
ismediaList: res.data.result.mediaList.length>0?true:false,
unreadMessageCount: res.data.result.unreadMessageCount
})
//是否显示志愿者活动
if (res.data.result.volunteerEventList && res.data.result.volunteerEventList.length>0) {
......
......@@ -26,6 +26,7 @@
<view>公益课堂</view>
</view>
<view wx:if="{{showNews}}" bindtap="news">
<text class="messageCount" wx:if="{{unreadMessageCount>0}}">{{unreadMessageCount}}</text>
<image src='../../img/4.png'></image>
<view>消息通知</view>
</view>
......
......@@ -78,6 +78,20 @@
text-align: center;
}
.messageCount {
position: relative;
width:20px;
height:20px;
line-height: 20px;
background: red;
color:#fff;
font-size: 12px;
border-radius: 10px;
text-align: center;
right:-50px;
top:-15px;
}
.topTitle{
width: 100%;
height: 30px;
......
......@@ -7,43 +7,22 @@ Page({
* 页面的初始数据
*/
data: {
title: '',
title:'',
needCheck: false,
servicePlace: '',
circleId:0
fileList: [],
frontImage: '',
comment: "",
servicePlace:''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var that = this;
console.log(options)
if (options.circleId!=0){
this.setData({
circleId: options.circleId
})
}
// var location = wx.getStorageSync('location');
var config = wx.getStorageSync('config');
wx.request({
url: app.url +'ajax_get_circle_info.php',
data:{
unionId:config.unionId,
circleId: options.circleId
},
success(res){
console.log(res.data)
if(res.data.status='OK'){
var place = res.data.result.circleDat.province + res.data.result.circleDat.city + res.data.result.circleDat.district
that.setData({
servicePlace: place,
title:res.data.result.circleDat.title,
needCheck:res.data.result.circleDat.need_check
})
}
}
var location = wx.getStorageSync('location');
var place = location.province + location.city + location.district
this.setData({
servicePlace:place,
})
},
......@@ -68,22 +47,44 @@ Page({
},
afterRead(event) {
const { file } = event.detail;
const fileList = this.data[`fileList`];
this.setData({
[`fileList`]: fileList.concat(file),
frontImage: file[0].path
});
},
delete(event) {
const { index, name } = event.detail;
const fileList = this.data[`fileList`];
fileList.splice(index, 1);
this.setData({ [`fileList`]: fileList });
},
//获取圈子名称
onInputTitle(event) {
this.setData({
title: event.detail
title:event.detail
})
},
//获取圈子简介
onInputComment(event) {
this.setData({
comment: event.detail.value
})
},
//获取是否需要入圈审核
onChangeNeedCheck({ detail }) {
onChangeNeedCheck({ detail }) {
// 需要手动对 checked 状态进行更新
this.setData({
needCheck: detail
});
needCheck: detail
});
},
//提交数据
circleNew1() {
circleNew1(){
var that = this;
var config = wx.getStorageSync('config');
var location = wx.getStorageSync('location');
......@@ -96,9 +97,19 @@ Page({
return
}
if (that.data.comment == null || that.data.comment.trim() == "") {
Notify('请输入圈子简介')
return
}
if (that.data.frontImage == null || that.data.frontImage.trim() == "") {
Notify('请上传圈子封面:')
return
}
//提交数据
wx.request({
url: app.url + 'ajax_circle_edit1.php',
url: app.url + 'ajax_circle_new.php',
data: {
unionId: config.unionId,
latitude: location.latitude,
......@@ -108,7 +119,7 @@ Page({
district: location.district,
title: that.data.title,
needCheck: that.data.needCheck,
circleId:that.data.circleId
comment: that.data.comment
},
header: { 'content-type': 'application/json' },
method: 'GET',
......@@ -119,10 +130,22 @@ Page({
if (res.data.status == "OK") {
//获取新建圈子的id
var circleId = res.data.result.circleDat.id
//成功以后跳转到下一页面
wx.navigateTo({
url: '../editCircle2/editCircle2?circleId=' + circleId,
})
//上传头像
wx.uploadFile({
url: app.url + 'ajax_circle_new.php?unionId=' + config.unionId + '&circleId=' + circleId,
filePath: that.data.fileList[0].path,
name: 'frontImage',
success: function (resp1) {
//成功以后跳转到下一页面[圈子动态]
wx.redirectTo({
url: '../newCircleMoment/newCircleMoment?circleId=' + circleId,
})
},
fail: function (err) {
console.log(err)
}
}
)
} else {
Notify(res.data.message)
return
......@@ -135,7 +158,7 @@ Page({
},
//重新定位
reLocation() {
reLocation(){
var config = wx.getStorageSync('config');
var that = this;
wx.getLocation({
......@@ -168,12 +191,12 @@ Page({
})
//保存最新地理位置信息
location.province = res.data.result.province,
location.city = res.data.result.city,
location.district = res.data.result.district,
wx.setStorage({
key: 'location',
data: location,
})
location.city = res.data.result.city,
location.district = res.data.result.district,
wx.setStorage({
key: 'location',
data: location,
})
},
fail: function (res) { },
complete: function (res) { },
......
......@@ -20,8 +20,20 @@
<view class='shenghe'>
开启后成员加入需圈主审核<van-switch checked="{{ needCheck }}" bind:change="onChangeNeedCheck" size="16px" />
</view>
<view class='newQuanzijianli' bindtap='circleNew1'>
确定
<view class='newQuanziImg'>
<text style="margin-top:10px;">圈子封面:</text>
<view>
<van-uploader file-list="{{ fileList }}"
max-count="1"
multiple
bind:after-read="afterRead"
bind:delete="delete"/>
</view>
</view>
<view class='newQuanziComment'>
<text style="margin-top:10px;">圈子简介:</text>
<textarea bindinput="onInputComment" value='{{comment}}'></textarea>
</view>
<view class='newQuanzijianli' bindtap='circleNew1'>下一步</view>
<van-notify id="van-notify" />
</view>
......@@ -19,6 +19,7 @@ page{
border-bottom: 1px solid #f5f5f5;
margin: 0 auto;
}
.top_newQuanzi>view{
font-size: 12px;
color: #0D76ED;
......@@ -39,6 +40,41 @@ page{
border-bottom: 1px solid #f5f5f5;
margin: 0 auto;
}
.newQuanziImg{
width: 85%;
height: 150px;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: left;
font-size: 14px;
border-bottom: 1px solid #f5f5f5;
margin: 0 auto;
}
.newQuanziComment{
width: 85%;
height: 150px;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: left;
font-size: 14px;
border-bottom: 1px solid #f5f5f5;
margin: 0 auto;
}
.newQuanziComment>textarea{
width:90%;
height: 120px;
border: 1px solid #f0f0f0;
margin-top: 15px;
margin-bottom: 15px;
box-sizing: border-box;
padding: 10px;
}
.newQuanziname>view{
flex: 1;
height: 30px;
......@@ -60,7 +96,6 @@ page{
justify-content: space-between;
align-items: center;
font-size: 14px;
color: #666;
border-bottom: 1px solid #f5f5f5;
margin: 0 auto;
}
......
// pages/newQuanzi/newQuanzi.js
import Notify from '../../dist/notify/notify';
var app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
title:'',
needCheck: false,
servicePlace:''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var location = wx.getStorageSync('location');
var place = location.province + location.city + location.district
this.setData({
servicePlace:place,
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
//获取圈子名称
onInputTitle(event) {
this.setData({
title:event.detail
})
},
//获取是否需要入圈审核
onChangeNeedCheck({ detail }) {
// 需要手动对 checked 状态进行更新
this.setData({
needCheck: detail
});
},
//提交数据
circleNew1(){
var that = this;
var config = wx.getStorageSync('config');
var location = wx.getStorageSync('location');
if (that.data.title == null || that.data.title.trim() == "") {
Notify('请输入圈子名称')
return
}
if (location == null || location.latitude == null) {
Notify('请重新定位位置')
return
}
//提交数据
wx.request({
url: app.url + 'ajax_circle_new1.php',
data: {
unionId: config.unionId,
latitude: location.latitude,
longitude: location.longitude,
province: location.province,
city: location.city,
district: location.district,
title: that.data.title,
needCheck: that.data.needCheck
},
header: { 'content-type': 'application/json' },
method: 'GET',
dataType: 'json',
success: function (res) {
console.log(res)
if (res.statusCode == 200) {
if (res.data.status == "OK") {
//获取新建圈子的id
var circleId = res.data.result.circleDat.id
//成功以后跳转到下一页面
wx.navigateTo({
url: '../newCircle2/newCircle2?circleId=' + circleId,
})
} else {
Notify(res.data.message)
return
}
}
},
fail: function (res) { },
complete: function (res) { },
})
},
//重新定位
reLocation(){
var config = wx.getStorageSync('config');
var that = this;
wx.getLocation({
type: 'wgs84',
success: function (res) {
// console.log(res);
var latitude = res.latitude;
var longitude = res.longitude;
let location = {
latitude: res.latitude,
longitude: res.longitude
};
wx.setStorage({
key: 'location',
data: location,
})
wx.request({
url: app.url + 'ajax_get_location_place.php',
data: {
unionId: config.unionId,
latitude: latitude,
longitude: longitude
},
header: { 'content-type': 'application/json' },
method: 'GET',
dataType: 'json',
success: function (res) {
that.setData({
servicePlace: res.data.result.province + res.data.result.city + res.data.result.district,
})
//保存最新地理位置信息
location.province = res.data.result.province,
location.city = res.data.result.city,
location.district = res.data.result.district,
wx.setStorage({
key: 'location',
data: location,
})
},
fail: function (res) { },
complete: function (res) { },
})
}
})
}
})
\ No newline at end of file
// pages/circleDetails/circleDetails.js
// pages/newCircleMoment/newCircleMoment.js
import Notify from '../../dist/notify/notify';
var app = getApp();
Page({
......@@ -7,11 +7,8 @@ Page({
* 页面的初始数据
*/
data: {
value:'',
comment:'',
fileList:[],
fileList1: [],
headerImg:'',
frontImage:'',
circleId:0,
uploadCount:0
},
......@@ -23,26 +20,6 @@ Page({
this.setData({
circleId: options.circleId
})
// var that = this;
// var config = wx.getStorageSync('config');
// // var location = wx.getStorageSync('location');
// wx: wx.request({
// url: app.url + 'ajax_get_circle_info.php',
// data: {
// unionId: config.unionId,
// circleId:7,
// userId:7
// },
// header: { 'content-type': 'application/json' },
// method: 'GET',
// dataType: 'json',
// success: function (res) {
// console.log(res)
// },
// fail: function (res) { },
// complete: function (res) { },
// })
},
/**
......@@ -60,13 +37,6 @@ Page({
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
......@@ -81,18 +51,21 @@ Page({
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
//判断上传的图片类型
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);
},
delete(event) {
const { index, name } = event.detail;
const fileList = this.data[`fileList`];
......@@ -102,43 +75,24 @@ Page({
afterRead(event) {
const { file } = event.detail;
const fileList = this.data[`fileList`];
this.setData({
[`fileList`]: fileList.concat(file),
headerImg: file[0].path
});
},
delete1(event) {
const { index, name } = event.detail;
const fileList1 = this.data[`fileList1`];
fileList1.splice(index, 1);
this.setData({ [`fileList1`]: fileList1 });
},
afterRead1(event) {
const { file } = event.detail;
const fileList1 = this.data[`fileList1`];
this.setData({
[`fileList1`]: fileList1.concat(file),
frontImage: file[0].path
[`fileList`]: fileList.concat(file),
});
},
onChange(event){
//获取输入文本框
onInputComment(event){
this.setData({
value: event.detail.value
comment: event.detail.value
})
},
btnCircle(){
console.log(this.data.headerImg,this.data.frontImage)
this.circleNew2();
},
circleNew2(){
//添加动态
circleMomentNew(){
var that = this;
if(that.data.fileList.length==0){
Notify('请选择圈子头像');
return;
}
if(that.data.value==''){
Notify('请填写圈子简介');
if(that.data.comment==''){
Notify('请输入圈子动态');
return;
}
wx.getStorage({
......@@ -146,70 +100,54 @@ Page({
success: function(res) {
if(res){
wx.request({
url: app.url + 'ajax_circle_new2.php',
url: app.url + 'ajax_circle_moment_new.php',
data: {
unionId: res.data.unionId,
circleId: that.data.circleId,
comment: that.data.value
comment: that.data.comment
},
method: 'GET',
success: function (resp) {
if (resp.data.status=='OK'){
wx.uploadFile({
url: app.url + 'ajax_circle_new2.php?unionId=' + res.data.unionId + '&circleId=' + that.data.circleId,
filePath: that.data.fileList[0].path,
name: 'frontImage',
success:function(resp1){
var result1=JSON.parse(resp1.data);
if (result1.status=='OK'){
if(that.data.fileList1.length>0){
for(var i in that.data.fileList1){
var file = that.data.fileList1[i];
wx.uploadFile({
url: app.url + 'ajax_circle_new2.php?unionId=' + res.data.unionId + '&circleId=' + that.data.circleId,
filePath: file.path,
name: 'image',
success: function (resp2) {
that.setData({
uploadCount: that.data.uploadCount + 1
}, function () {
that.finish();
})
}
})
}
}else{
wx.showToast({
title: '保存成功',
})
wx.redirectTo({
url: '/pages/circleDetails/circleDetails?circleId='+that.data.circleId,
})
if(that.data.fileList.length>0){
for(var i in that.data.fileList){
var file = that.data.fileList[i];
wx.uploadFile({
url: app.url + 'ajax_circle_moment_new.php?unionId=' + res.data.unionId + '&circleId=' + that.data.circleId,
filePath: file.path,
name: 'image',
success: function (resp2) {
that.setData({
uploadCount: that.data.uploadCount + 1
}),
//调用结束上传
that.finish()
},
fail: function (err) {
console.log(err)
}
}
},
fail:function(err){
console.log(err)
})
}
})
} else {
wx.showToast({
title: '保存成功',
})
wx.redirectTo({
url: '/pages/circleDetails/circleDetails?circleId='+that.data.circleId,
})
}
}
console.log(res)
// if (res.statusCode == 200) {
// that.setData({
// familyEventList: res.data.result.familyEventList
// })
// }
},
fail: function (res) { },
complete: function (res) { },
})
}
},
})
},
//结束上传
finish(){
var that=this;
if(this.data.uploadCount==this.data.fileList1.length){
if(this.data.uploadCount==this.data.fileList.length){
wx.showToast({
title: '保存成功',
});
......
{
"usingComponents": {}
"usingComponents": {},
"navigationBarTitleText": "圈子动态"
}
\ No newline at end of file
<!--pages/circleDetails/circleDetails.wxml-->
<!--pages/newCircleMoment/newCircleMoment.wxml-->
<view class='circleDetails'>
<view class='top_circleDetails'>
<view class='circleTitle'><text></text>圈子头图</view>
<view style='margin-left:20px;margin-top:10px;'>
<van-uploader file-list="{{ fileList }}"
max-count="1"
multiple
bind:after-read="afterRead"
bind:delete="delete"/>
</view>
</view>
<view class='bot_circleDetails'>
<view class='circleTitle'><text></text>圈子简介</view>
<!-- <view class='wordPic'>
<view class='con_wordPic'>
<van-button type="default" size='small'>文字</van-button>
<van-button type="default" size='small'>图片</van-button>
</view>
</view> -->
<view class='circleTitle'><text></text>添加动态</view>
<view class='circleWord'>
<textarea bindinput="onChange" value='{{value}}'></textarea>
<textarea bindinput="onInputComment" value='{{comment}}'></textarea>
</view>
<view class='circleWord'>
<view class='addPic'>
<van-uploader file-list="{{ fileList1 }}"
<van-uploader file-list="{{ fileList }}"
max-count="3"
multiple
bind:after-read="afterRead1"
bind:delete="delete1"
use-before-read="{{ true }}"
bind:before-read="beforeRead"
bind:after-read="afterRead"
bind:delete="delete"
sizeType="20"/>
</view>
<text>(可上传3张图片)</text>
</view>
</view>
<view class='btnCircle' bindtap='btnCircle'>保存进圈</view>
<view class='btnCircle' bindtap='circleMomentNew'>保存进圈</view>
</view>
<van-notify id="van-notify" />
/* pages/circleDetails/circleDetails.wxss */
/* pages/newCircleMoment/newCircleMoment.wxss */
.circleDetails{
padding-bottom: 50px;
}
......
......@@ -80,6 +80,13 @@
"pathName": "pages/donationIndex/donationIndex",
"query": "",
"scene": null
},
{
"id": -1,
"name": "圈子动态添加",
"pathName": "pages/newCircleMoment/newCircleMoment",
"query": "circleId=27",
"scene": null
}
]
}
......
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