Commit 6c9a359f by biao

1111

parent d1535e5e
...@@ -46,6 +46,9 @@ define("WECHAT_AUTH_TOKEN","COMPASS"); ...@@ -46,6 +46,9 @@ define("WECHAT_AUTH_TOKEN","COMPASS");
define("WECHAT_PAY_MCHID","1371137902"); define("WECHAT_PAY_MCHID","1371137902");
define("WECHAT_PAY_KEY","a1b2c3defghijKlmnopqrstuvwx4y5z6"); define("WECHAT_PAY_KEY","a1b2c3defghijKlmnopqrstuvwx4y5z6");
//DEBUG MODE
define("DEBUG_MODE", true);
//腾讯lbs //腾讯lbs
define("LBS_KEY","TMJBZ-MTX3G-MPFQT-INGZP-VQVTK-WLFM3"); define("LBS_KEY","TMJBZ-MTX3G-MPFQT-INGZP-VQVTK-WLFM3");
define("LBS_SECRET","BYLkXP9bZaQhI1ELr6HWkHRuKm1YPU"); define("LBS_SECRET","BYLkXP9bZaQhI1ELr6HWkHRuKm1YPU");
......
...@@ -12,6 +12,10 @@ $needCheck = ParamUtil::getRequestBoolean("needCheck", false);//圈子名称 ...@@ -12,6 +12,10 @@ $needCheck = ParamUtil::getRequestBoolean("needCheck", false);//圈子名称
$longitude = ParamUtil::getRequestString("longitude");//用户位置的经度 $longitude = ParamUtil::getRequestString("longitude");//用户位置的经度
$latitude = ParamUtil::getRequestString("latitude");//用户位置的纬度 $latitude = ParamUtil::getRequestString("latitude");//用户位置的纬度
$province = ParamUtil::getRequestString("province");
$city = ParamUtil::getRequestString("city");
$district = ParamUtil::getRequestString("district");
$result = array(); $result = array();
//参数检查 //参数检查
...@@ -43,22 +47,6 @@ if($circleCount > 0) { ...@@ -43,22 +47,6 @@ if($circleCount > 0) {
responseNG($result); responseNG($result);
} }
//调用腾讯LGS服务解析用户地址信息
$tmpUrl = '/ws/geocoder/v1?key=' . LBS_KEY . '&location=' . $latitude . ',' . $longitude . LBS_SECRET;
$md5Str = md5($tmpUrl);
$lbsUrl = 'https://apis.map.qq.com/ws/geocoder/v1?key=' . LBS_KEY . '&location=' . $latitude . ',' . $longitude . '&sig=' . $md5Str;
$lbsObj = file_get_contents($lbsUrl);
$jsonObj = json_decode($lbsObj); //对JSON格式的字符串进行编码
$lbsArray = get_object_vars($jsonObj);//转换成数组
$resultObj = $lbsArray['result'];
//地理位置获取正常的情况下设定。 156:中国代码
if($lbsArray['status'] == "0" && $resultObj->ad_info->nation_code==156) {
//保存到用户当前地理位置中
$province = $resultObj->address_component->province;
$city = $resultObj->address_component->city;
$district = $resultObj->address_component->district;
}
//建立圈子 //建立圈子
$circleDat = new CircleDat(); $circleDat = new CircleDat();
$circleDat->title = $title; $circleDat->title = $title;
......
...@@ -70,7 +70,7 @@ if($courseMediaDat->course_id == 0) { ...@@ -70,7 +70,7 @@ if($courseMediaDat->course_id == 0) {
if(!empty($tmpList)) { if(!empty($tmpList)) {
foreach($tmpList as $tmp) { foreach($tmpList as $tmp) {
$tmp->haveBuy = false; $tmp->haveBuy = false;
if(!$tmp->is_free) { if(!$tmp->is_free==false) {
//收费课程的情况下,判断用户是否已经购买本课程 //收费课程的情况下,判断用户是否已经购买本课程
$param = array(); $param = array();
$param['user_id'] = $userMst->id; $param['user_id'] = $userMst->id;
......
<?php
// 根据经纬度换取省市等信息
require_once ("../user_include.inc");
ErrorLogger::doOutput("Compass...ajax_get_location_place.php....Start.", 0);
//获取参数
$unionId = ParamUtil::getRequestString("unionId");
$longitude = ParamUtil::getRequestString("longitude");//用户位置的经度
$latitude = ParamUtil::getRequestString("latitude");//用户位置的纬度
$result = array();
//用户所在【省市区】
//调用腾讯LGS服务解析用户地址信息
$tmpUrl = '/ws/geocoder/v1?key=' . LBS_KEY . '&location=' . $latitude . ',' . $longitude . LBS_SECRET;
$md5Str = md5($tmpUrl);
$lbsUrl = 'https://apis.map.qq.com/ws/geocoder/v1?key=' . LBS_KEY . '&location=' . $latitude . ',' . $longitude . '&sig=' . $md5Str;
$lbsObj = file_get_contents($lbsUrl);
$jsonObj = json_decode($lbsObj); //对JSON格式的字符串进行编码
$lbsArray = get_object_vars($jsonObj);//转换成数组
if(isset($lbsArray['result'])) {
$resultObj = $lbsArray['result'];
//地理位置获取正常的情况下设定。 156:中国代码
if($lbsArray['status'] == "0" && $resultObj->ad_info->nation_code==156) {
//保存到用户当前地理位置中
$result["province"] = $resultObj->address_component->province;
$result["city"] = $resultObj->address_component->city;
$result["district"] = $resultObj->address_component->district;
}
} else {
$result["message"] = "参数错误!";
responseNG($result);
}
ErrorLogger::doOutput("Compass...ajax_get_location_place.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
<?php
// 根据课程id获取课程详细信息
require_once ("../user_include.inc");
ErrorLogger::doOutput("Compass...ajax_get_play_media_detail.php....Start.", 0);
//获取参数
$unionId = ParamUtil::getRequestString("unionId");
$mediaId = ParamUtil::getRequestNumber("mediaId", 0);
//参数检查
if(empty($unionId) || empty($mediaId)) {
$result["message"] = "参数错误!";
responseNG($result);
}
//判断用户是否存在
$param = array();
$param['unionid'] = $unionId;
$param['delete_flg'] = false;
$userMstList = UserMst::getList($param,'id','desc', 0, 1);
if(empty($userMstList)) {
$result["message"] = "用户不存在!";
responseNG($result);
}
$userMst = $userMstList[0];
$result = array();
//判断视频是否存在
$courseMediaDat = CourseMediaDat::getById($mediaId);
if(empty($courseMediaDat)) {
$result["message"] = "视频不存在!";
responseNG($result);
}
$courseMediaDat->haveBuy = false;
//付费会员、教育局领导、学校负责人、班级负责人可以免费观看
if($userMst->is_member || $userMst->role == 4 || $userMst->school_owner || $userMst->class_owner) {
$courseMediaDat->haveBuy = false;
} else {
//收费课程判断用户是否已经购买
if($courseMediaDat->is_free==false) {
//收费课程的情况下,判断用户是否已经购买本课程
$param = array();
$param['user_id'] = $userMst->id;
$param['media_id'] = $courseMediaDat->id;
$param['is_free'] = false;
$param['status'] = 'SUCCESS';
$param['delete_flg'] = false;
$userMstBuyList = UserMediaDat::getList($param, "id", "desc", 0, 1);
if(!empty($userMstBuyList)) {
$courseMediaDat->haveBuy = true;
}
}
}
//添加播放次数[观看次数+1]
$courseMediaDat->view_count++;
$courseMediaDat->save();
//添加用户播放记录
//添加用户观看记录(已经观看过则更新时间变成最后观看)
$param['user_id'] = $userMst->id;
$param['course_id'] = $courseMediaDat->course_id;
$param['media_id'] = $mediaId;
$param['delete_flg'] = false;
$tmpUserMediaDatList = UserMediaDat::getList($param,'id','desc', 0, 1);
if(empty($tmpUserMediaDatList)) {
//第一次观看则添加记录
$userMstMediaDat = new UserMediaDat();
$userMstMediaDat->user_id = $userMst->id;
$userMstMediaDat->course_id = $courseMediaDat->course_id;
$userMstMediaDat->media_id = $mediaId;
$userMstMediaDat->is_free = $courseMediaDat->is_free;
$userMstMediaDat->money = $courseMediaDat->price;
$userMstMediaDat->save();
} else {
//以前有观看记录则修改观看时间
$tmpUserMediaDatList[0]->registration_date = date("Y-m-d H:i:s");
$tmpUserMediaDatList[0]->save();
}
//接口返回数据
$result["courseMediaDat"] = $courseMediaDat;
ErrorLogger::doOutput("Compass...ajax_get_play_media_detail.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
...@@ -42,9 +42,11 @@ $userMst = $userList[0]; ...@@ -42,9 +42,11 @@ $userMst = $userList[0];
//志愿者活动 //志愿者活动
$param = array(); $param = array();
$param['province'] = $province; if(DEBUG_MODE==false) {
$param['city'] = $city; $param['province'] = $province;
$param['district'] = $district; $param['city'] = $city;
$param['district'] = $district;
}
$param['status'] = "OK"; $param['status'] = "OK";
$param['delete_flg'] = false; $param['delete_flg'] = false;
//社会用户和机构用户的时候,添加【是否允许社会人士参加】 //社会用户和机构用户的时候,添加【是否允许社会人士参加】
......
{ {
"pages": [ "pages": [
"pages/my/my", "pages/circle/circle",
"pages/index/index", "pages/index/index",
"pages/my/my",
"pages/familyEvent/familyEvent", "pages/familyEvent/familyEvent",
"pages/socialEvent/socialEvent", "pages/socialEvent/socialEvent",
"pages/checkJoinCircle/checkJoinCircle", "pages/checkJoinCircle/checkJoinCircle",
...@@ -12,7 +13,6 @@ ...@@ -12,7 +13,6 @@
"pages/donationDetail/donationDetail", "pages/donationDetail/donationDetail",
"pages/donationIndex/donationIndex", "pages/donationIndex/donationIndex",
"pages/userDonation/userDonation", "pages/userDonation/userDonation",
"pages/circle/circle",
"pages/searchCircle/searchCircle", "pages/searchCircle/searchCircle",
"pages/newCircleEvent/newCircleEvent", "pages/newCircleEvent/newCircleEvent",
"pages/circleDetails/circleDetails", "pages/circleDetails/circleDetails",
...@@ -80,6 +80,7 @@ ...@@ -80,6 +80,7 @@
}, },
"tabBar": { "tabBar": {
"selectedColor": "#1296db", "selectedColor": "#1296db",
"borderStyle":"white",
"list": [ "list": [
{ {
"pagePath": "pages/index/index", "pagePath": "pages/index/index",
......
...@@ -43,6 +43,14 @@ video, live-player, live-pusher, open-data, web-view { ...@@ -43,6 +43,14 @@ video, live-player, live-pusher, open-data, web-view {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
flex-wrap: wrap;
}
.listVolunteers>view>text{
display: block;
width: 90%;
height: 1px;
background: #f6f6f6;
margin: 0 auto;
} }
.activelist{ .activelist{
width: 92%; width: 92%;
...@@ -188,6 +196,14 @@ video, live-player, live-pusher, open-data, web-view { ...@@ -188,6 +196,14 @@ video, live-player, live-pusher, open-data, web-view {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
flex-wrap: wrap;
}
.listPractice>view>text{
display: block;
width: 90%;
height: 1px;
background: #f6f6f6;
margin: 0 auto;
} }
.left_listPractice{ .left_listPractice{
width: 30%; width: 30%;
...@@ -214,19 +230,26 @@ video, live-player, live-pusher, open-data, web-view { ...@@ -214,19 +230,26 @@ video, live-player, live-pusher, open-data, web-view {
color: #000; color: #000;
} }
.listPublicWelfare>view{ .listPublicWelfare>view{
width: 94%; width: 90%;
height: 110px; height: 110px;
margin: 0 auto; margin: 0 auto;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
flex-wrap: wrap;
}
.listPublicWelfare>view>text{
display: block;
width: 90%;
height: 1px;
background: #f6f6f6;
margin: 0 auto;
} }
.left_listPublicWelfare{ .left_listPublicWelfare{
width: 30%; width: 30%;
height: 80px; height: 80px;
border-radius: 5px; border-radius: 5px;
overflow: hidden; overflow: hidden;
margin-left: 15px;
position: relative; position: relative;
} }
.left_listPublicWelfare>image{ .left_listPublicWelfare>image{
...@@ -241,7 +264,12 @@ video, live-player, live-pusher, open-data, web-view { ...@@ -241,7 +264,12 @@ video, live-player, live-pusher, open-data, web-view {
} }
.right_listPublicWelfare>text{ .right_listPublicWelfare>text{
display: block; display: block;
margin-top: 5px; font-size: 12px;
}
.right_listPublicWelfare .activeTitle{
font-size: 13px;
font-weight: bold;
color: #000;
} }
.right_listPublicWelfare>view{ .right_listPublicWelfare>view{
height: 35px; height: 35px;
...@@ -260,11 +288,10 @@ video, live-player, live-pusher, open-data, web-view { ...@@ -260,11 +288,10 @@ video, live-player, live-pusher, open-data, web-view {
color: #666; color: #666;
} }
.conSwiper{ .conSwiper{
width: 92%; width: 90%;
height: 40px; height: 40px;
margin: 20px auto; margin: 20px auto;
display: flex; display: flex;
justify-content: space-between;
align-items: center; align-items: center;
font-size: 12px; font-size: 12px;
background: #f6f6f6; background: #f6f6f6;
...@@ -272,13 +299,21 @@ video, live-player, live-pusher, open-data, web-view { ...@@ -272,13 +299,21 @@ video, live-player, live-pusher, open-data, web-view {
box-sizing: border-box; box-sizing: border-box;
padding: 0 10px; padding: 0 10px;
} }
.conSwiper>image{
width: 20px;
height: 20px;
margin-right: 5px;
}
.conSwiper>view{ .conSwiper>view{
width: 60px; flex: 1;
height: 25px; height: 25px;
background: #0D76ED; color: #F2A508;
color: #fff;
font-size: 12px; font-size: 12px;
line-height: 25px; line-height: 25px;
text-align: center; text-align: right;
border-radius: 5px; border-radius: 5px;
}
.lookmore{
color: #599eff!important;
} }
\ No newline at end of file
{ {
"usingComponents": {} "usingComponents": {
},
"navigationBarBackgroundColor": "#5c5bf4"
} }
\ No newline at end of file
<!--pages/index/index.wxml--> <!--pages/index/index.wxml-->
<view class='indexBox'> <view class='indexBox'>
<view class="indexSwiper page-section-spacing swiper"> <view class="indexHeader">
<swiper indicator-dots="{{false}}" <view class='con_indexHeader'>
autoplay="true" interval="2000" duration="500">
<swiper-item>
<image src='../../img/1.jpg'></image> <image src='../../img/1.jpg'></image>
</swiper-item> </view>
</swiper> <view class='title' bindtap='authorize'><image src='../../img/touxiang.png'></image>{{roleTitle}}欢迎回来</view>
<!-- <image src='../../img/1.jpg'></image> --> </view>
<text class='title' bindtap='authorize'>欢迎回来·{{roleTitle}}</text> <view class='girdList'>
</view> <view bindtap="volunteers">
<van-grid> <image src='../../img/1.png'></image>
<van-grid-item icon="../../img/1.png" text="志愿活动" bindtap="volunteers" /> <view>志愿活动</view>
<van-grid-item icon="../../img/2.png" text="社会实践" wx:if="{{showSocial}}" bindtap="socialEvent" /> </view>
<van-grid-item icon="../../img/2.png" text="亲子活动" wx:if="{{showFamily}}" bindtap="familyEvent" /> <view wx:if="{{showSocial}}" bindtap="socialEvent">
<van-grid-item icon="../../img/3.png" text="公益课堂" bindtap="mediaCourse" /> <image src='../../img/2.png'></image>
<van-grid-item icon="../../img/4.png" text="消息通知" wx:if="{{showNews}}" bindtap="news" /> <view>社会实践</view>
<van-grid-item icon="../../img/4.png" text="区域管理" bindtap="area" wx:if="{{role==4}}" /> </view>
</van-grid> <view wx:if="{{showFamily}}" bindtap="familyEvent">
<image src='../../img/2.png'></image>
<view>亲子活动</view>
</view>
<view bindtap="mediaCourse">
<image src='../../img/3.png'></image>
<view>公益课堂</view>
</view>
<view wx:if="{{showNews}}" bindtap="news">
<image src='../../img/4.png'></image>
<view>消息通知</view>
</view>
<view bindtap="area" wx:if="{{role==4}}">
<image src='../../img/4.png'></image>
<view>区域管理</view>
</view>
</view>
<view class='conSwiper'> <view class='conSwiper'>
购买中国志愿者会员,公益视频免费看!<view bindtap='memberChange'>详情</view> <image src='../../img/dongNews.png'></image>购买中国志愿者会员,公益视频免费看!<view bindtap='memberChange'>详情</view>
</view> </view>
<view class='volunteers'> <view class='volunteers'>
<view class='topTitle'> <view class='topTitle'>
<view> <view>
<view class='line'></view> <view class='leftLine'></view>
<text>志愿者活动</text> <text>志愿者活动</text>
<view class='rightLine'></view>
</view> </view>
<text class='lookmore' bindtap='moreVolunteers'>查看更多</text> <text class='lookmore' bindtap='moreVolunteers'>更多</text>
</view> </view>
<view class='listVolunteers'> <view class='listVolunteers'>
<view bindtap='volunteersEventDetail' wx:for="{{volunteerEventList}}" data-index='{{item.id}}' wx:key="{{index}}"> <view bindtap='volunteersEventDetail' wx:for="{{volunteerEventList}}" data-index='{{item.id}}' wx:key="{{index}}">
...@@ -44,6 +59,7 @@ ...@@ -44,6 +59,7 @@
<text>报名截止:{{item.enroll_time}}</text> <text>报名截止:{{item.enroll_time}}</text>
</view> </view>
</view> </view>
<text></text>
</view> </view>
</view> </view>
<!-- 社会实践 --> <!-- 社会实践 -->
...@@ -51,8 +67,9 @@ ...@@ -51,8 +67,9 @@
<view> <view>
<view class='topTitle'> <view class='topTitle'>
<view> <view>
<view class='line'></view> <view class='leftLine'></view>
<text>社会实践</text> <text>社会实践</text>
<view class='rightLine'></view>
</view> </view>
<!-- <text class='lookmore'>查看更多</text> --> <!-- <text class='lookmore'>查看更多</text> -->
</view> </view>
...@@ -68,6 +85,7 @@ ...@@ -68,6 +85,7 @@
</view> </view>
<text>{{item.author}}</text> <text>{{item.author}}</text>
</view> </view>
<text></text>
</view> </view>
</view> </view>
</view> </view>
...@@ -78,8 +96,9 @@ ...@@ -78,8 +96,9 @@
<view> <view>
<view class='topTitle'> <view class='topTitle'>
<view> <view>
<view class='line'></view> <view class='leftLine'></view>
<text>亲子活动</text> <text>亲子活动</text>
<view class='rightLine'></view>
</view> </view>
<!-- <text class='lookmore'>查看更多</text> --> <!-- <text class='lookmore'>查看更多</text> -->
</view> </view>
...@@ -95,6 +114,7 @@ ...@@ -95,6 +114,7 @@
</view> </view>
<text>{{item.author}}</text> <text>{{item.author}}</text>
</view> </view>
<text></text>
</view> </view>
</view> </view>
</view> </view>
...@@ -103,8 +123,9 @@ ...@@ -103,8 +123,9 @@
<view class='publicWelfare'> <view class='publicWelfare'>
<view class='topTitle'> <view class='topTitle'>
<view> <view>
<view class='line'></view> <view class='leftLine'></view>
<text>公益课堂</text> <text>公益课堂</text>
<view class='rightLine'></view>
</view> </view>
<!-- <text class='lookmore'>查看更多</text> --> <!-- <text class='lookmore'>查看更多</text> -->
</view> </view>
...@@ -114,7 +135,7 @@ ...@@ -114,7 +135,7 @@
<image src='{{item.front_image}}'></image> <image src='{{item.front_image}}'></image>
</view> </view>
<view class='right_listPublicWelfare'> <view class='right_listPublicWelfare'>
<text>{{item.title}}</text> <text class='activeTitle'>{{item.title}}</text>
<view> <view>
<van-button type="default" size="mini">小学课堂</van-button> <van-button type="default" size="mini">小学课堂</van-button>
<image src='../../img/kefu.png'></image> <image src='../../img/kefu.png'></image>
...@@ -122,6 +143,7 @@ ...@@ -122,6 +143,7 @@
</view> </view>
<text>主讲教师:{{item.teacher}}</text> <text>主讲教师:{{item.teacher}}</text>
</view> </view>
<text></text>
</view> </view>
</view> </view>
</view> </view>
......
/* pages/index/index.wxss */ /* pages/index/index.wxss */
.indexBox{ .indexHeader{
/* padding-bottom: 50px; */
}
.indexSwiper{
position: relative; position: relative;
width: 100%; width: 100%;
height: 150px;
border-radius: 0 0 10px 10px;
background: #7474e4;
background: linear-gradient(to bottom, #5c5bf4, #7474e4);
margin-bottom: 80px
} }
.indexSwiper>swiper{ .con_indexHeader{
width: 100%; position: absolute;
} bottom: -70px;
.indexSwiper image{ left: 0;
width: 100%; right: 0;
margin: auto;
width: 90%;
height: 150px; height: 150px;
background: #fff;
border-radius: 15px;
}
.con_indexHeader>image{
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
width: 95%;
height: 134px;
border-radius: 8px;
} }
.title{ .title{
position: absolute; position: absolute;
top: 10px; top: 10px;
right: 10px; left: 7%;
font-size: 13px;
display: flex;
align-items: center;
height: 50px;
color: #fff;
}
.title>image{
width: 40px;
height: 40px;
border-radius: 50%;
margin-right: 10px;
}
.girdList{
width: 90%;
margin: 0 auto;
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
font-size: 12px; font-size: 12px;
} }
.van-icon--image{ .girdList>view{
width: 1.6em!important; width: 25%;
height: 1.6em!important; height: 73px;
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
} }
.girdList>view>image{
width: 42px;
height: 42px;
}
.girdList>view>view{
width: 100%;
text-align: center;
}
.topTitle{ .topTitle{
width: 100%; width: 100%;
height: 30px; height: 30px;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
position: relative;
} }
.topTitle>view{ .topTitle>view{
display: flex; display: flex;
align-items: center; align-items: center;
margin-left: 15px;
font-size: 14px; font-size: 14px;
width: 100%;
justify-content: center;
}
.topTitle>view>text{
margin: 0 10px;
font-size: 15px;
color: #000;
font-weight: bold;
} }
.line{ .leftLine{
width: 5px; width: 18%;
height: 20px; height: 2px;
background: #79B0D9; background: linear-gradient(to left, #599eff, #fff);
margin-right: 5px; }
.rightLine{
width: 18%;
height: 2px;
background: linear-gradient(to right, #599eff, #fff);
} }
.topTitle>text{ .topTitle>text{
position: absolute;
top: 0;
bottom: 0;
right: 5%;
margin: auto;
font-size: 12px; font-size: 12px;
color: #666; color: #666;
margin-right: 15px; display: flex;
align-items: center;
} }
.practice>view{ .practice>view{
width: 100%; width: 100%;
} }
// pages/newQuanzi/newQuanzi.js // pages/newQuanzi/newQuanzi.js
var app = getApp(); import Notify from '../../dist/notify/notify';
var app = getApp()
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
value:'', title:'',
checked: false, needCheck: false,
fuwuplace:'' servicePlace:'',
}, },
/** /**
...@@ -18,7 +19,7 @@ Page({ ...@@ -18,7 +19,7 @@ Page({
var location = wx.getStorageSync('location'); var location = wx.getStorageSync('location');
var place = location.province + location.city + location.district var place = location.province + location.city + location.district
this.setData({ this.setData({
fuwuplace:place servicePlace:place,
}) })
}, },
...@@ -37,63 +38,52 @@ Page({ ...@@ -37,63 +38,52 @@ Page({
}, },
/** /**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage: function () { onShareAppMessage: function () {
}, },
onChange(event) {
//获取圈子名称
onInputTitle(event) {
this.setData({ this.setData({
value:event.detail title:event.detail
}) })
}, },
onChange1({ detail }) { //获取是否需要入圈审核
onChangeNeedCheck({ detail }) {
// 需要手动对 checked 状态进行更新 // 需要手动对 checked 状态进行更新
this.setData({ checked: detail }); this.setData({
}, needCheck: detail
newQuanzijianli(){ });
this.circleNew1()
}, },
//提交数据
circleNew1(){ circleNew1(){
var that = this; var that = this;
var config = wx.getStorageSync('config'); var config = wx.getStorageSync('config');
var jingweidu = wx.getStorageSync('jingweidu'); var location = wx.getStorageSync('location');
wx: wx.request({ 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', url: app.url + 'ajax_circle_new1.php',
data: { data: {
unionId: config.unionId, unionId: config.unionId,
latitude: jingweidu.latitude, latitude: location.latitude,
longitude: jingweidu.longitude, longitude: location.longitude,
title: that.data.value, province: location.province,
needCheck: 1 city: location.city,
district: location.district,
title: that.data.title,
needCheck: that.data.needCheck
}, },
header: { 'content-type': 'application/json' }, header: { 'content-type': 'application/json' },
method: 'GET', method: 'GET',
...@@ -101,19 +91,26 @@ Page({ ...@@ -101,19 +91,26 @@ Page({
success: function (res) { success: function (res) {
console.log(res) console.log(res)
if (res.statusCode == 200) { if (res.statusCode == 200) {
if (res.data.status == "OK") {
//获取新建圈子的id
var circleId = res.data.result.circleDat.id
//成功以后跳转到下一页面
wx.navigateTo({ wx.navigateTo({
url: '../newCircle2/newCircle2', url: '../newCircle2/newCircle2?circleId=' + circleId,
})
wx.setNavigationBarTitle({
title: '我的圈子'
}) })
} else {
Notify(res.data.message)
return
}
} }
}, },
fail: function (res) { }, fail: function (res) { },
complete: function (res) { }, complete: function (res) { },
}) })
}, },
dingwei(){
//重新定位
reLocation(){
var config = wx.getStorageSync('config'); var config = wx.getStorageSync('config');
var that = this; var that = this;
wx.getLocation({ wx.getLocation({
...@@ -122,16 +119,16 @@ Page({ ...@@ -122,16 +119,16 @@ Page({
// console.log(res); // console.log(res);
var latitude = res.latitude; var latitude = res.latitude;
var longitude = res.longitude; var longitude = res.longitude;
let jingweidu = { let location = {
latitude: res.latitude, latitude: res.latitude,
longitude: res.longitude longitude: res.longitude
}; };
wx.setStorage({ wx.setStorage({
key: 'jingweidu', key: 'location',
data: jingweidu, data: location,
}) })
wx: wx.request({ wx.request({
url: app.url + 'ajax_get_user_role.php', url: app.url + 'ajax_get_location_place.php',
data: { data: {
unionId: config.unionId, unionId: config.unionId,
latitude: latitude, latitude: latitude,
...@@ -141,15 +138,13 @@ Page({ ...@@ -141,15 +138,13 @@ Page({
method: 'GET', method: 'GET',
dataType: 'json', dataType: 'json',
success: function (res) { success: function (res) {
var place = res.data.result.province + res.data.result.city + res.data.result.district;
that.setData({ that.setData({
fuwuplace:place servicePlace: res.data.result.province + res.data.result.city + res.data.result.district,
}) })
let location = { //保存最新地理位置信息
province: res.data.result.province, location.province = res.data.result.province,
city: res.data.result.city, location.city = res.data.result.city,
district: res.data.result.district location.district = res.data.result.district,
}
wx.setStorage({ wx.setStorage({
key: 'location', key: 'location',
data: location, data: location,
......
{ {
"usingComponents": {} "usingComponents": {},
"navigationBarTitleText": "创建圈子"
} }
\ No newline at end of file
<!--pages/newQuanzi/newQuanzi.wxml--> <!--pages/newQuanzi/newQuanzi.wxml-->
<view class='newQuanzi'> <view class='newQuanzi'>
<view class='top_newQuanzi'> <view class='top_newQuanzi'>
服务区域:{{fuwuplace}} 服务区域:{{servicePlace}}
<van-button type="default" size='mini' bindtap='dingwei'>重新定位</van-button> <van-button type="default" size='mini' bindtap='reLocation'>重新定位</van-button>
</view> </view>
<view class='newQuanziname'> <view class='newQuanziname'>
圈子名称: 圈子名称:
<view> <view>
<van-cell-group> <van-cell-group>
<van-field <van-field
value="{{ value }}" value="{{ title }}"
placeholder="请输入圈子名称" placeholder="请输入圈子名称"
border="{{ false }}" border="{{ false }}"
bind:change="onChange" bind:change="onInputTitle"
/> />
</van-cell-group> </van-cell-group>
</view> </view>
</view> </view>
<view class='shenghe'> <view class='shenghe'>
开启后成员加入需圈主审核<van-switch checked="{{ checked }}" bind:change="onChange1" size="16px" /> 开启后成员加入需圈主审核<van-switch checked="{{ checked }}" bind:change="onChangeNeedCheck" size="16px" />
</view> </view>
<view class='newQuanzijianli' bindtap='newQuanzijianli'> <view class='newQuanzijianli' bindtap='circleNew1'>
建立 建立
</view> </view>
<van-notify id="van-notify" />
</view> </view>
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