作者 sgj
1 个管道 的构建 失败 耗费 3 秒

修改志愿者列表

@@ -21,6 +21,10 @@ class ClockController extends AdminBaseController @@ -21,6 +21,10 @@ class ClockController extends AdminBaseController
21 public function index(){ 21 public function index(){
22 $param=$this->request->param(); 22 $param=$this->request->param();
23 $map=[]; 23 $map=[];
  24 + if(!empty($param['keyword'])){
  25 + $map['c.activity_name']=['like',"%$param[keyword]%"];
  26 + }
  27 +
24 $data= db('clock')->alias('c') 28 $data= db('clock')->alias('c')
25 ->field('v.name as user_name,v.photo,c.*') 29 ->field('v.name as user_name,v.photo,c.*')
26 ->join('user u','u.id=c.user_id') 30 ->join('user u','u.id=c.user_id')
@@ -33,7 +37,9 @@ class ClockController extends AdminBaseController @@ -33,7 +37,9 @@ class ClockController extends AdminBaseController
33 $this->assign([ 37 $this->assign([
34 'data'=>$list, 38 'data'=>$list,
35 'page'=>$data->render(), 39 'page'=>$data->render(),
36 - ]); 40 + 'keyword'=>$param['keyword']??''
  41 + ]);
  42 +
37 return $this->fetch(); 43 return $this->fetch();
38 } 44 }
39 45
@@ -92,6 +92,20 @@ class OnlineTrainController extends AdminBaseController @@ -92,6 +92,20 @@ class OnlineTrainController extends AdminBaseController
92 } 92 }
93 93
94 /** 94 /**
  95 + * 删除对应问题
  96 + */
  97 + public function delete(){
  98 + $id=input('id');
  99 + $result=db('class_question')->where('id',$id)->delete();
  100 + if ($result){
  101 + $this->success('操作成功');
  102 + }else{
  103 + $this->error('操作失败');
  104 + }
  105 +
  106 + }
  107 +
  108 + /**
95 * 问题详情 109 * 问题详情
96 */ 110 */
97 public function questioninfo(){ 111 public function questioninfo(){
@@ -129,6 +129,7 @@ @@ -129,6 +129,7 @@
129 <if condition="$vo['status'] eq 1 or $vo['status'] eq 3 "> 129 <if condition="$vo['status'] eq 1 or $vo['status'] eq 3 ">
130 <font style="color: blue" onclick="doSelectCategory({$vo['id']})" href="{:url('activity/joinTime',array('id'=>$vo['id']))}">参加活动时间</font> 130 <font style="color: blue" onclick="doSelectCategory({$vo['id']})" href="{:url('activity/joinTime',array('id'=>$vo['id']))}">参加活动时间</font>
131 <font style="" onclick="userWork({$vo['id']})" href="{:url('activity/userWork',array('id'=>$vo['id']))}">查看工作汇报</font> 131 <font style="" onclick="userWork({$vo['id']})" href="{:url('activity/userWork',array('id'=>$vo['id']))}">查看工作汇报</font>
  132 + <a style="" href="{:url('clock/addclock',array('id'=>$vo['id']))}">添加打卡信息</a>
132 </if> 133 </if>
133 134
134 <else /> 135 <else />
@@ -9,12 +9,12 @@ @@ -9,12 +9,12 @@
9 <!--</li>--> 9 <!--</li>-->
10 10
11 </ul> 11 </ul>
12 - <!-- <form class="well form-inline margin-top-20" method="post" action="{:url('activity/index')}"> 12 + <form class="well form-inline margin-top-20" method="post" action="{:url('index')}">
13 关键字: 13 关键字:
14 <input type="text" class="form-control" name="keyword" style="width: 150px;" value="{$keyword|default=''}" placeholder="请输入关键字"> 14 <input type="text" class="form-control" name="keyword" style="width: 150px;" value="{$keyword|default=''}" placeholder="请输入关键字">
15 <input type="submit" class="btn btn-primary" value="搜索" /> 15 <input type="submit" class="btn btn-primary" value="搜索" />
16 - <a class="btn btn-danger" href="{:url('activity/index')}">清空</a>  
17 - </form>--> 16 + <a class="btn btn-danger" href="{:url('index')}">清空</a>
  17 + </form>
18 <form class="js-ajax-form" action="" method="post"> 18 <form class="js-ajax-form" action="" method="post">
19 <table class="table table-hover table-bordered"> 19 <table class="table table-hover table-bordered">
20 <thead> 20 <thead>
@@ -31,7 +31,6 @@ @@ -31,7 +31,6 @@
31 <tbody> 31 <tbody>
32 <foreach name="data" item="vo"> 32 <foreach name="data" item="vo">
33 <tr> 33 <tr>
34 -  
35 <td>{$vo.id}</td> 34 <td>{$vo.id}</td>
36 <td>{$vo.activity_name}</td> 35 <td>{$vo.activity_name}</td>
37 <td>{$vo.user_name}</td> 36 <td>{$vo.user_name}</td>
@@ -48,8 +48,11 @@ @@ -48,8 +48,11 @@
48 <td>{$vo.id}</td> 48 <td>{$vo.id}</td>
49 <td>{$vo.title}</td> 49 <td>{$vo.title}</td>
50 <td> 50 <td>
51 - <a href='{:url("questionInfo",array("id"=>$vo["id"]))}'>查看详情</a> 51 + <a href='{:url("questionInfo",array("id"=>$vo["id"]))}'>查看详情</a>|
  52 + <a class="js-ajax-dialog-btn" data-msg="确定删除吗?" href="{:url('delete',array('id'=>$vo['id']))}">删除</a>
52 </td> 53 </td>
  54 +
  55 +
53 </tr> 56 </tr>
54 </foreach> 57 </foreach>
55 58
@@ -22,52 +22,9 @@ @@ -22,52 +22,9 @@
22 min-height:767px; 22 min-height:767px;
23 } 23 }
24 </style> 24 </style>
25 - <script charset="utf-8" src="http://map.qq.com/api/js?v=2.exp"></script>  
26 - <script>  
27 - var markersArray=[];  
28 - var init = function() {  
29 - var map = new qq.maps.Map(document.getElementById("container"),{  
30 - center: new qq.maps.LatLng(39.916527,116.397128),  
31 - zoom: 13,  
32 - });  
33 - //添加监听事件  
34 - qq.maps.event.addListener(map, 'click', function(data) {  
35 -  
36 - for (i in markersArray) {  
37 - markersArray[i].setMap(null);  
38 - }  
39 -  
40 - var anchor = new qq.maps.Point(6, 6),  
41 - size = new qq.maps.Size(24, 24),  
42 - origin = new qq.maps.Point(0, 0),  
43 - marker = new qq.maps.Marker({  
44 - map: map,  
45 - position:data.latLng});  
46 - markersArray.push(marker);  
47 - console.log(data);  
48 - document.getElementById('pointInput').value=data.latLng;  
49 - setTimeout(function(){  
50 - // alert(data.latLng);  
51 - },200);  
52 -  
53 -  
54 - });  
55 - }  
56 -  
57 25
58 - function confirmSelect(){  
59 - var selectLocation = {};  
60 - var gpsAddr = document.getElementById('currentAddr');  
61 - var location = document.getElementById('pointInput');  
62 - /* selectLocation.gpsAddr = gpsAddr.innerHTML;*/  
63 - selectLocation.location = location.value;  
64 - console.log(selectLocation.location);  
65 - window.opener.SelectLocation.selectCallback(selectLocation);  
66 - window.close();  
67 - }  
68 - </script>  
69 </head> 26 </head>
70 -<body onload="init()"> 27 +<body onload="">
71 <div class="LogoCon clear" style="font-size:18px;"> 28 <div class="LogoCon clear" style="font-size:18px;">
72 29
73 <div style="display:block"> 30 <div style="display:block">
@@ -78,5 +35,136 @@ @@ -78,5 +35,136 @@
78 </div> 35 </div>
79 </div> 36 </div>
80 <div id="container"></div> 37 <div id="container"></div>
  38 +<!--<div id="searchPart">-->
  39 + <!--<input type="text" id="searchInput" placeholder="请输入">-->
  40 + <!--<button id="searchBtn">搜索</button>-->
  41 +<!--</div>-->
81 </body> 42 </body>
  43 +
  44 +<script src="https://map.qq.com/api/gljs?v=1.exp&key=OB4BZ-D4W3U-B7VVO-4PJWW-6TKDJ-WPB77"></script>
  45 +<!--<script charset="utf-8" src="http://map.qq.com/api/js?v=2.exp"></script>-->
  46 +<script>
  47 + // var markersArray=[];
  48 + // var init = function() {
  49 + // var map = new qq.maps.Map(document.getElementById("container"),{
  50 + // center: new qq.maps.LatLng(39.916527,116.397128),
  51 + // zoom: 13,
  52 + // });
  53 + // //添加监听事件
  54 + // qq.maps.event.addListener(map, 'click', function(data) {
  55 + //
  56 + // for (i in markersArray) {
  57 + // markersArray[i].setMap(null);
  58 + // }
  59 + //
  60 + // var anchor = new qq.maps.Point(6, 6),
  61 + // size = new qq.maps.Size(24, 24),
  62 + // origin = new qq.maps.Point(0, 0),
  63 + // marker = new qq.maps.Marker({
  64 + // map: map,
  65 + // position:data.latLng});
  66 + // markersArray.push(marker);
  67 + // console.log(data);
  68 + // document.getElementById('pointInput').value=data.latLng;
  69 + // setTimeout(function(){
  70 + // // alert(data.latLng);
  71 + // },200);
  72 + //
  73 + //
  74 + // });
  75 + // }
  76 +
  77 + var map, marker, infoWindow;
  78 + // 创建信息窗口
  79 +
  80 +
  81 +
  82 +
  83 +
  84 + var center = new TMap.LatLng(39.984104, 116.307503);//设置中心点坐标
  85 + //初始化地图
  86 + var map = new TMap.Map("container", {
  87 + center: center
  88 + });
  89 +
  90 + //初始化marker图层
  91 + var markerLayer = new TMap.MultiMarker({
  92 + id: 'marker-layer',
  93 + map: map
  94 + });
  95 +
  96 + //监听点击事件添加marker
  97 + map.on("click", (evt) => {
  98 +
  99 +
  100 + console.log(evt.latLng);
  101 + document.getElementById('pointInput').value=evt.latLng
  102 +
  103 + });
  104 +
  105 + function searchClick() {
  106 + let searchInput = document.getElementById('searchInput').value; // 获取搜索内容
  107 + let url = [
  108 + 'https://apis.map.qq.com/ws/place/v1/search',
  109 + '?boundary=nearby(39.984104,116.307503,1000,0)',
  110 + `&keyword=${searchInput}`,
  111 + '&page_size=10&page_index=1&orderby=_distance',
  112 + '&output=jsonp&callback=cb',
  113 + '&key=OB4BZ-D4W3U-B7VVO-4PJWW-6TKDJ-WPB77'
  114 + ].join('');
  115 + jsonp_request(url);
  116 + infoWindow.close(); // 关闭信息窗口
  117 + }
  118 + // 添加搜索按钮点击事件
  119 + const searchBtn = document.getElementById('searchBtn');
  120 + searchBtn.addEventListener('click', searchClick, false);
  121 +
  122 + function jsonp_request(url) {
  123 + let script = document.createElement('script');
  124 + script.src = url;
  125 + document.body.appendChild(script);
  126 + }
  127 +
  128 + function confirmSelect(){
  129 + var selectLocation = {};
  130 + var gpsAddr = document.getElementById('currentAddr');
  131 + var location = document.getElementById('pointInput');
  132 + /* selectLocation.gpsAddr = gpsAddr.innerHTML;*/
  133 + selectLocation.location = location.value;
  134 + console.log(selectLocation.location);
  135 + window.opener.SelectLocation.selectCallback(selectLocation);
  136 + window.close();
  137 + }
  138 +
  139 +
  140 + function cb(ret) {
  141 + let newBounds = new TMap.LatLngBounds();
  142 + let markerArr = [];
  143 + if(ret && ret.status===0 && ret.data.length>0) {
  144 + // 将搜索结果保存进数组中
  145 + ret.data.forEach( (item, index) => {
  146 + let position = new TMap.LatLng(item.location.lat, item.location.lng);
  147 + markerArr.push({
  148 + position: position,
  149 + properties: {
  150 + title: item.title,
  151 + address: item.address,
  152 + tel: item.tel!==' ' ? item.tel : '暂无'
  153 + }
  154 + });
  155 + // 寻找搜索结果的边界
  156 + newBounds.extend(position);
  157 + });
  158 + // 更新marker层,显示标记
  159 + marker.setGeometries(markerArr);
  160 + // 地图自适应边界
  161 + map.fitBounds(newBounds, {
  162 + padding: 100 // 边界与内容之间留的间距
  163 + });
  164 + }
  165 + }
  166 +
  167 +
  168 +
  169 +</script>
82 </html> 170 </html>