admin_topics_802

This commit is contained in:
dengbw
2021-08-02 11:44:24 +08:00
committed by lccsw
parent deabbe77c4
commit d6d372277f
21 changed files with 3889 additions and 5 deletions
+18 -5
View File
@@ -1,24 +1,27 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Created by Vim.
* User: lcc
* Date: 2019/12/06
* Time: 10:02
*/
class Main extends HD_Controller
{
class Main extends HD_Controller{
public function __construct(){
public function __construct()
{
$this->app_id = 1;
parent::__construct();
$this->load->model('app/liche/App_liche_cms_model', 'cmsM');
$this->load->model('app/liche/App_liche_users_model', 'userM');
$this->load->model('topics/topics_model', 'mdTopics');
$this->load->model('Subjects_model', 'subM');
}
public function index(){
public function index()
{
/*应用状况*/
$conditions = array();
@@ -50,6 +53,16 @@ class Main extends HD_Controller{
array('name' => '查看详情', 'url' => '/app/liche/cms/index'),
),
);
$value = $this->mdTopics->count(array('app_id' => $this->app_id));
$list[] = array(
'title' => '专题(个)',
'value' => $value,
'btns' => array(
array('name' => '查看详情', 'url' => '/topics/topics?app_id=' . $this->app_id),
//array('name' => '查看详情', 'url' => '/sys/company?app_id=' . $this->app_id),
),
);
$conditions[] = array('icon' => 'am-icon-home', 'list' => $list);
/*小程序设置 end*/
+329
View File
@@ -0,0 +1,329 @@
<?php
/**
* Notes:报名管理
* Created on: 2020/5/18 12:45
* Created by: dengbw
* @return bool
*/
Class Enroll extends HD_Controller
{
private $statusAry = array(-1 => '已失效', 0 => '未核销', 1 => '已核销');
public function __construct()
{
parent::__construct();
$this->load->model('topics/topics_model', 'mdTopics');
$this->load->model('topics/topic_modules_model', 'mdTopicModules');
$this->load->model('topics/topic_module_enroll_model', 'mdModuleEnroll');
$this->load->model('topics/topic_module_enrolldata_model', 'mdModuleEnrolldata');
}
public function index()
{
return $this->lists();
}
public function lists()
{
$params = $this->input->get();
$params['page'] = $params['page'] ? intval($params['page']) : 1;
$params['size'] = $params['size'] ? intval($params['size']) : 20;
$params['module_id'] = intval($params['module_id']);
$res = $this->dataSelect($params);
if ($res['code'] == 0) {
return $this->show_json(SYS_CODE_FAIL, $res['msg']);
}
$lists = $res['lists'];
$count = $res['count'];
$this->data['params'] = $res['params'];
$this->data['_title'] = $res['title'] . '列表';
$this->data['type'] = $res['type'];
$this->data['statusAry'] = $this->statusAry;
$this->data['pager'] = array('count' => ceil($count / $params['size']), 'curr' => $params['page'], 'totle' => $count);
$this->data['lists'] = $lists;
return $this->show_view('topics/enroll/lists', true);
}
/**
* 报名活动列表
* @return bool
*/
public function lists_module()
{
$params = $this->input->get();
$page = $params['page'] ? $params['page'] : 1;
$size = $params['size'] ? $params['size'] : 20;
$app_id = $params['app_id'];
$search_ary = array("title" => "标题", "module_id" => "ID");
//根据应用获取模块
$where = array('app_id' => $app_id);
$rows_topic = $this->mdTopics->select($where);
$module_ids = array();
if ($rows_topic) {
foreach ($rows_topic as $v) {
if ($v['module_ids']) {
$ids = explode(',', $v['module_ids']);
if ($ids) {
$module_ids = array_merge($module_ids, $ids);
}
}
}
}
$total = 0;
$lists = array();
if ($module_ids) {
$str_ids = implode(',', $module_ids);
$where = array("module_id in ({$str_ids})" => null);
if ($params['search_v']) {
if ('title' == $params['search_k']) {
$where["m.title like '%{$params['search_v']}%'"] = null;
} else {
$where["m.{$params['search_k']}"] = $params['search_v'];
}
}
!$params['search_k'] && $params['search_k'] = 'title';
if (strlen($params['status']) > 0) {
$where['j.status'] = $params['status'];
} else {
$where['j.status>=0'] = null;
$params['status'] = '';
}
$total = $this->mdModuleEnroll->count_status($where);
if ($total) {
$orderby = 'id desc';
$select = "module_id, title, es_time, ee_time, as_time, ae_time, j.status";
$rows = $this->mdModuleEnroll->select_status($where, $orderby, $page, $size, $select);
foreach ($rows as $v) {
$lists[] = array(
'id' => $v['module_id'],
'title' => $v['title'],
'e_time' => "{$v['es_time']}~{$v['ee_time']}",
'a_time' => "{$v['as_time']}~{$v['ae_time']}",
'status' => $v['status'],
'statusion' => 1 == $v['status'] ? "正常" : "下架",
);
}
}
}
$this->data['params'] = $params;
$this->data['lists'] = $lists;
$this->data['search_ary'] = $search_ary;
$this->data['_title'] = '报名活动管理';
$this->data['pager'] = array('count' => ceil($total / $size), 'curr' => $page, 'totle' => $total);
return $this->show_view('topics/enroll/lists_module', true);
}
/**
* Notes:查找报名数据
* Created on: 2020/5/19 16:37
* Created by: dengbw
* @param $params
* @return array
*/
private function dataSelect($params)
{
$where = $lists = array();
$title = '活动报名';
$type = 0;
if ($params['module_id']) {
$where['module_id'] = $params['module_id'];
$row_en = $this->mdModuleEnroll->get(array('module_id' => $params['module_id']), 'title,type');
$title = $row_en['title'];
$type = $row_en['type'];
} else {
//根据应用获取报名列表
$app_id = $params['app_id'];
$where_topic = array('app_id' => $app_id);
$rows_topic = $this->mdTopics->select($where_topic);
$module_ids = array();
if ($rows_topic) {
foreach ($rows_topic as $v) {
if ($v['module_ids']) {
$ids = explode(',', $v['module_ids']);
if ($ids) {
$module_ids = array_merge($module_ids, $ids);
}
}
}
}
if ($module_ids) {
$str_ids = implode(',', $module_ids);
$where["module_id in ({$str_ids})"] = null;
} else {
$where['module_id'] = -1;
}
}
if (status_verify($params['status'])) {
$where['status'] = $params['status'];
} else {
$params['status'] = -99;
}
if ($params['name']) {
$where['name like "%' . $params['name'] . '%"'] = null;
}
if ($params['mobile']) {
$where['mobile'] = $params['mobile'];
}
if ($params['code']) {
$where['code'] = $params['code'];
}
if ($params['time']) {
$time = explode(' ~ ', $params['time']);
$time[0] && $where["c_time >="] = strtotime($time[0] . ' 00:00:00');
$time[1] && $where["c_time <="] = strtotime($time[1] . ' 23:59:59');
}
$count = $this->mdModuleEnrolldata->count($where);
if ($count) {
$select = "id,module_id,name,mobile,code,status,c_time,jsondata";
$lists = $this->mdModuleEnrolldata->select($where, "id desc", $params['page'], $params['size'], $select);
$map_module = array();
if ($lists) {
$module_ids = array_unique(array_column($lists, 'module_id'));
$str_ids = implode(',', $module_ids);
$where_module = array("module_id in ({$str_ids})" => null);
$map_module = $this->mdModuleEnroll->map('module_id', '*', $where_module, '', 0, 0, 'module_id, title, descrip');
}
foreach ($lists as $key => $value) {
$json = json_decode($value['jsondata'], true);
$module = $map_module[$value['module_id']];
$lists[$key]['c_time'] = date('Y-m-d H:i', $value['c_time']);
$lists[$key]['status_name'] = $this->statusAry[$value['status']];
$lists[$key]['remark'] = $json['remark'] ? $json['remark'] : '';
$lists[$key]['title'] = $module['descrip'] ? $module['descrip'] : $module['title'];
}
}
$data['code'] = SYS_CODE_SUCCESS;
$data['type'] = $type;
$data['title'] = $title;
$data['lists'] = $lists;
$data['count'] = $count;
$data['params'] = $params;
return $data;
}
public function get()
{
$id = intval($this->input->get('id'));
$module_id = intval($this->input->get('module_id'));
if (!$id || !$module_id) {
return $this->show_json(SYS_CODE_FAIL, '参数错误!');
}
$re = $this->mdModuleEnrolldata->get(array("id" => $id));
if (!$re || empty($re)) {
return $this->show_json(SYS_CODE_FAIL, '报名详情不存在!');
}
$reEn = $this->mdModuleEnroll->get(array('module_id' => $module_id), 'enroll_json,type');
$enroll_json = array();
if ($reEn['enroll_json'] && $re['jsondata']) {
$enroll_json = json_decode($reEn['enroll_json'], true);
$jsondata = json_decode($re['jsondata'], true);
foreach ($enroll_json as $key => $value) {
$jsondata[$key] && $enroll_json[$key]['value'] = $jsondata[$key];
}
}
$re['enroll_json'] = $enroll_json;
$re['type'] = $reEn['type'];
$re['c_time'] = date('Y-m-d H:i', $re['c_time']);
$re['status_name'] = $this->statusAry[$re['status']];
$this->data['info'] = $re;
return $this->show_view('topics/enroll/edit');
}
public function del()
{
// TODO: Implement del() method.
}
public function batch()
{
}
public function export()
{
$params = $this->input->get();
$params['page'] = 1;
$params['size'] = 10000;
$params['export'] = 1;
$data = $indexs = array();
$res = $this->dataSelect($params);
if ($params['module_id']) {
if ($params['type'] == 1) {
$fileName = '活动报名用户';
foreach ($res['lists'] as $key => $value) {
$temp['name'] = $value['name'];
$temp['mobile'] = $value['mobile'];
$temp['code'] = $value['code'];
$temp['status_name'] = $value['status_name'];
$temp['c_time'] = $value['c_time'];
$temp['remark'] = $value['remark'];
$data[] = $temp;
}
$indexs = [
'name' => '姓名',
'mobile' => '手机号',
'code' => '核销码',
'status_name' => '状态',
'c_time' => '报名时间',
"remark" => "备注",
];
} else {
$fileName = '报名用户';
foreach ($res['lists'] as $key => $value) {
$temp['name'] = $value['name'];
$temp['mobile'] = $value['mobile'];
$temp['c_time'] = $value['c_time'];
$temp['remark'] = $value['remark'];
$data[] = $temp;
}
$indexs = [
'name' => '姓名',
'mobile' => '手机号',
'c_time' => '报名时间',
"remark" => "备注",
];
}
} else {
$fileName = '活动报名';
foreach ($res['lists'] as $key => $value) {
$temp['title'] = $value['title'];
$temp['name'] = $value['name'];
$temp['mobile'] = $value['mobile'];
$temp['c_time'] = $value['c_time'];
$temp['remark'] = $value['remark'];
$data[] = $temp;
}
$indexs = [
'title' => '活动名称',
'name' => '姓名',
'mobile' => '手机号',
'c_time' => '报名时间',
"remark" => "备注",
];
}
array_unshift($data, $indexs);
$this->load->library('excel');
$this->excel->out_csv($data, $indexs, $fileName . "_" . date('YmdHis'));
}
public function add()
{
// TODO: Implement add() method.
}
public function edit()
{
// TODO: Implement edit() method.
}
}
+959
View File
@@ -0,0 +1,959 @@
<?php
/**
* Notes:专题管理
* Created on: 2020/2/9 12:45
* Created by: dengbw
* @return bool
*/
defined('BASEPATH') OR exit('No direct script access allowed');
require_once(dirname(__DIR__) . '/AppBase.php');
Class Topics extends AppBase
{
private $statusAry = array('0' => '下架', '1' => '上架');
private $moduleAry = array(
array('name' => '文本模块', 'tag' => 'text'),
array('name' => '广告模块', 'tag' => 'ad'),
array('name' => '报名模块', 'tag' => 'enroll')
);
public function __construct()
{
parent::__construct();
$this->load->model('topics/topics_model', 'mdTopics');
$this->load->model('topics/topic_modules_model', 'mdTopicModules');
$this->load->model('topics/topic_module_text_model', 'mdModuleText');
$this->load->model('topics/topic_module_ad_model', 'mdModuleAd');
$this->load->model('topics/topic_module_enroll_model', 'mdModuleEnroll');
$this->load->model('topics/topic_module_enrolldata_model', 'mdModuleEnrolldata');
$this->load->model('topics/topic_user_log_model', 'mdUserLog');
$this->load->model("sys/sys_admin_model", 'mdSysAdmin');
}
/**
* 调用所有函数前
* @param $method
* @return mixed
*/
function _remap($method)
{
return $this->$method();
}
public function index()
{
return $this->lists();
}
public function lists()
{
$params = $this->input->get();
$params['page'] = $params['page'] ? intval($params['page']) : 1;
$size = 20;
$where = array();
$lists = array();
$statusAry = $this->statusAry;
if ($params['status'] || $params['status'] == '0') {
$where['status'] = $params['status'];
} else {
$params['status'] = -99;
$where['status > -1'] = null;
}
if ($params['app_id']) {
$where['app_id'] = $params['app_id'];
}
if ($params['title']) {
$where['title like "%' . $params['title'] . '%"'] = null;
}
$res = $this->mdTopics->select($where, "id desc", $params['page'], $size);
$count = $this->mdTopics->count($where);
$view_where["c_time > UNIX_TIMESTAMP(DATE_SUB(DATE_FORMAT(NOW(),'%Y-%m-%d'),INTERVAL 7 day))"] = null;
$view_select = "tid, count(id) as doc_count, count(distinct app_uid) as doc_count_uid";
$user_log_arr = $this->mdUserLog->map_groupby('tid', '*', $view_where, $view_select, 'tid');
if ($res) {
foreach ($res as $key => $value) {
$setValue = array();
$setValue['id'] = $value['id'];
$setValue['title'] = $value['title'];
if ($value['status'] == 0) {
$setValue['che_status'] = 1;
$setValue['che_status_name'] = $this->statusAry[1];
} else {
$setValue['che_status'] = 0;
$setValue['che_status_name'] = $this->statusAry[0];
}
$setValue['status_name'] = $statusAry[$value['status']];
$setValue['c_time'] = date('Y-m-d H:i', $value['c_time']);
$setValue['count_view'] = $user_log_arr[$value['id']]['doc_count'] ?: 0;
$setValue['count_view_uid'] = $user_log_arr[$value['id']]['doc_count_uid'] ?: 0;
$lists[] = $setValue;
}
}
$this->data['appList'] = $this->app_list();
$this->data['_title'] = '专题列表';
$this->data['statusAry'] = $statusAry;
$this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $params['page'], 'totle' => $count);
$this->data['lists'] = $lists;
$this->data['params'] = $params;
return $this->show_view('topics/lists', true);
}
/**
* 访问用户概况
* @return bool
*/
public function lists_userc()
{
$params = $this->input->get();
$id = $params['id'];
$where = array('tid' => $id);
if ($params['time']) {
list($s_time, $e_time) = explode(" ~ ", $params['time']);
$s_time = strtotime($s_time . ' 00:00:00');
$e_time = strtotime($e_time . ' 23:59:59');
$where["c_time > {$s_time}"] = null;
$where["c_time < {$e_time}"] = null;
}
$lists = array();
$select = "cf_suid, count(id) as row_num";
$this->mdUserLog->db->group_by('cf_suid');
$rows = $this->mdUserLog->select($where, "cf_suid desc", 0, 0, $select);
$map_admin = array();
if ($rows) {
$uids = array_diff(array_column($rows, "cf_suid"), array(0));
$uids && $uids = array_unique($uids);
$map_coupon = array();
if ($uids) {
$ids_str = implode(',', $uids);
$where_admin = array("id in ({$ids_str})" => null);
$select = "id, username, mobile";
$map_admin = $this->mdSysAdmin->map('id', "*", $where_admin, 'id desc', 0, 0, $select);
}
$sum_view = 0;
$sum_couponc = 0;
foreach ($rows as $v) {
$cf_suid = $v["cf_suid"];
$admin = $map_admin[$cf_suid];
$mobile = $admin ? $admin['mobile'] : "";
$mobile && 1 != $this->role && $mobile = substr_replace($mobile, "*****", 3, 5);
$viewc = intval($v['row_num']);
$couponc = intval($map_coupon[$cf_suid]);
$sum_view += $viewc;
$sum_couponc += $couponc;
$lists[] = array(
"id" => $cf_suid,
"uname" => $admin ? $admin['username'] : (0 == $cf_suid ? "其他" : ""),
"mobile" => $mobile,
"count" => $viewc,
"couponc" => $couponc,
);
}
$lists[] = array("id" => "+", "uname" => "合计", "count" => $sum_view, "couponc" => $sum_couponc);
}
$total = count($lists);
$this->data['_title'] = '专题访问用户概况';
$this->data['pager'] = array('count' => ceil($total / 20), 'curr' => 1, 'totle' => $total);
$this->data['lists'] = $lists;
$this->data['params'] = $params;
return $this->show_view('topics/lists_userc', true);
}
/**
* 按天统计
* @return bool
*/
public function lists_by_day()
{
$params = $this->input->get();
$id = $params['id'];
$page = intval($params['page']) ?: 1;
$size = intval($params['size']) ?: 10;
$where = array();
$where['tid'] = $id;
if ($params['time']) {
list($s_time, $e_time) = explode(" ~ ", $params['time']);
$s_time = strtotime($s_time . ' 00:00:00');
$e_time = strtotime($e_time . ' 23:59:59');
$where["c_time > {$s_time}"] = null;
$where["c_time < {$e_time}"] = null;
} else {
$where['c_time > UNIX_TIMESTAMP(DATE_SUB(DATE_FORMAT(NOW(),\'%Y-%m-%d\'),INTERVAL 7 day))'] = null;
}
$select = "tid, count(id) as doc_count, count(distinct app_uid) as doc_count_uid, FROM_UNIXTIME(c_time, '%Y-%m-%d') as date";
$this->mdUserLog->db->group_by("FROM_UNIXTIME(c_time, '%Y-%m-%d')");
$rows = $this->mdUserLog->select($where, "FROM_UNIXTIME(c_time, '%Y-%m-%d') desc", $page, $size, $select);
//debug_log("[debug] ".$this->mdUserLog->db->last_query(), __FUNCTION__ );
$lists = array();
//debug_log("[debug] ".var_export($rows,1), __FUNCTION__ );
if ($rows) {
foreach ($rows as $v) {
$lists[] = array(
"date" => $v['date'],
"count" => intval($v['doc_count']),
"count_uid" => intval($v['doc_count_uid']), //访问用户数
);
}
}
$this->mdUserLog->db->group_by("FROM_UNIXTIME(c_time, '%Y-%m-%d')");
$countList = $this->mdUserLog->select($where, "FROM_UNIXTIME(c_time, '%Y-%m-%d') desc", 0, 0, $select);
if ($countList) {
$sum_view = 0;
$sum_view_uid = 0;
foreach ($countList as $v) {
$sum_view += intval($v['doc_count']);
$sum_view_uid += intval($v['doc_count_uid']);
}
$lists[] = array("date" => "合计", "count" => $sum_view, "count_uid" => $sum_view_uid);
}
$total = count($countList);
$topicInfo = $this->mdTopics->get(array('id' => $id), 'title');
$this->data['_title'] = $topicInfo['title'] . '-按天统计';
$this->data['pager'] = array('count' => ceil($total / $size), 'curr' => $page, 'totle' => $total);
$this->data['lists'] = $lists;
$this->data['params'] = $params;
return $this->show_view('topics/lists_by_day', true);
}
/**
* 访问用户列表
* @return bool
*/
public function lists_user()
{
$params = $this->input->get();
$id = $params['id'];
$page = $params['page'] = $params['page'] ? intval($params['page']) : 1;
$size = 20;
$this->load->library('entity/user_entity');
$where = array('tid' => $id);
$lists = array();
$searchTpAry = array('uname' => '用户姓名', 'mobile' => '用户手机号', 'suid' => "源头用户ID", 'sname' => '源头用户姓名', "smobile" => "源头手机号");
$row_topic = $this->mdTopics->get(array('id' => $id));
$app_id = $row_topic['app_id'];
$this->user_entity->init($app_id);
if ($params['search_tp'] && isset($params['title'])) {
$where_user = array();
$where_admin = array();
switch ($params['search_tp']) {
case "uname":
$where_user["uname like '%{$params['title']}%'"] = null;
break;
case "sname":
$where_admin["uname like '%{$params['title']}%'"] = null;
break;
case "mobile":
$where_user['mobile'] = $params['title'];
break;
case "smobile":
$where_admin['mobile'] = $params['title'];
break;
case "suid":
$where['cf_suid'] = $params['title'];
break;
}
if ($where_user) {
$rows_user = $this->user_entity->select($where_user);
$ids_str = $rows_user ? implode(',', array_column($rows_user, 'id')) : "-1";
$where["app_uid in ({$ids_str})"] = null;
}
if ($where_admin) {
$select = "id";
$row_admin = $this->mdSysAdmin->select($where_admin, 'id desc', 0, 0, $select);
$ids_str = $row_admin ? implode(',', array_column($row_admin, 'id')) : "-1";
$where["cf_suid in ({$ids_str})"] = null;
}
}
if ($params['time']) {
list($s_time, $e_time) = explode(" ~ ", $params['time']);
$s_time = strtotime($s_time . ' 00:00:00');
$e_time = strtotime($e_time . ' 23:59:59');
$where["c_time > {$s_time}"] = null;
$where["c_time < {$e_time}"] = null;
}
$total = $this->mdUserLog->count($where);
if ($total) {
$select = "id, app_uid, cf_suid, c_time";
$rows = $this->mdUserLog->select($where, 'id desc', $page, $size, $select);
$map_user = array();
$map_admin = array();
if ($rows) {
//获取用户信息
$uids = array_column($rows, "app_uid");
$uids = array_diff($uids, array(0));
$uids && $uids = array_unique($uids);
if ($uids) {
$ids_str = implode(',', $uids);
$where_user = array("id in({$ids_str})" => null);
$select_u = "id, nickname as uname, mobile";
if ($app_id == 2 || $app_id == 1 || $app_id == 5) {
$select_u = "id, uname, mobile";
}
$map_user = $this->user_entity->map('id', "*", $where_user, 'id desc', 0, 0, $select_u);
}
//获取管理员信息
$suids = array_column($rows, "cf_suid");
$suids = array_diff($suids, array(0));
$suids && $suids = array_unique($suids);
if ($suids) {
$ids_str = implode(',', $suids);
$where_admin = array("id in({$ids_str})" => null);
$select = "id, username, mobile";
$map_admin = $this->mdSysAdmin->map('id', "*", $where_admin, 'id desc', 0, 0, $select);
}
foreach ($rows as $v) {
$user = $map_user[$v['app_uid']];
$amdin = $map_admin[$v['cf_suid']];
$mobile = $user ? $user['mobile'] : "";
$smobile = $amdin ? $amdin['mobile'] : "";
$smobile && 1 != $this->role && $smobile = substr_replace($smobile, "*****", 3, 5);
$lists[] = array(
"id" => $v['id'],
"uname" => $user ? $user['uname'] : "",
"mobile" => $mobile,
"suname" => $amdin ? $amdin['username'] : "",
"smobile" => $smobile,
"c_time" => date('Y-m-d H:i:s', $v['c_time']),
);
}
}
}
$this->data['_title'] = '专题访问用户';
$this->data['pager'] = array('count' => ceil($total / $size), 'curr' => $page, 'totle' => $total);
$this->data['ary']['searchTpAry'] = $searchTpAry;
$this->data['lists'] = $lists;
$this->data['params'] = $params;
return $this->show_view('topics/lists_user', true);
}
public function get()
{
$id = intval($this->input->get('id'));
$app_id = intval($this->input->get('app_id'));
!$app_id && $app_id = $this->app_id;
if ($id > 0) {
$re = $this->mdTopics->get(array('id' => $id));
if (!$re || empty($re)) {
return $this->show_json(SYS_CODE_FAIL, '专题不存在!');
}
$re['bg_img_url'] = build_qiniu_image_url($re['bg_img']);
$info = $re;
$json = $info['jsondata'] ? json_decode($info['jsondata'], true) : '';
$info['cf_id'] = $json['cf_id'] ? $json['cf_id'] : "";
$info['mp_app_id'] = $json['mp_app_id'] ? $json['mp_app_id'] : "";
$info['ebiz'] = $json['ebiz'] ? $json['ebiz'] : "";
$_title = '编辑专题';
$edit_url = '/topics/topics/edit';
} else {
$_title = '新增专题';
$edit_url = '/topics/topics/add';
$info['id'] = $id;
$info['app_id'] = $app_id;
$info['cf_id'] = "";
$info['mp_app_id'] = "";
$info['ebiz'] = 0;
}
$info['spm'] = $this->input->get('spm');
$info['edit_url'] = $edit_url;
$info['moduleAry'] = $this->moduleAry;
$this->data['info'] = $info;
$this->data['_title'] = $_title;
return $this->show_view('topics/edit', true);
}
public function add()
{
$app_id = $this->input->post('app_id');
if (!$app_id) {
return $this->show_json(SYS_CODE_FAIL, '非法参数');
}
$spm = $this->input->post('spm');
$title = $this->input->post('title');
if (!$title) {
return $this->show_json(SYS_CODE_FAIL, '请输入专题名称');
}
$bg_color = $this->input->post('bg_color');
$bg_img = $this->input->post('bg_img');
$dataItems['app_id'] = $app_id;
$dataItems['title'] = $title;
$dataItems['bg_color'] = $bg_color;
$dataItems['bg_img'] = $bg_img;
$dataItems['status'] = 1;
$dataItems['c_time'] = time();
$id = $this->mdTopics->add($dataItems);
if (!$id) {
return $this->show_json(SYS_CODE_FAIL, '添加失败');
}
return $this->show_json(SYS_CODE_SUCCESS, '添加成功!', '#/topics/topics/get?id=' . $id . '&spm=' . $spm);
}
public function edit()
{
$id = $this->input->post('id');
if (!$id) {
return $this->show_json(SYS_CODE_FAIL, '非法参数');
}
$title = $this->input->post('title');
if (!$title) {
return $this->show_json(SYS_CODE_FAIL, '请输入专题名称');
}
$bg_color = $this->input->post('bg_color');
$bg_img = $this->input->post('bg_img');
$dataItems['title'] = $title;
$dataItems['bg_color'] = $bg_color;
$dataItems['bg_img'] = $bg_img;
$re = $this->mdTopics->update($dataItems, array('id' => $id));
if (!$re) {
return $this->show_json(SYS_CODE_FAIL, '修改失败');
}
return $this->show_json(SYS_CODE_SUCCESS, '修改成功!');
}
/**
* Notes:获取模块列表
* Created on: 2020/2/10 19:01
* Created by: dengbw
*/
public function get_module()
{
$page_id = $this->input->get('page_id');
$moduleList = array();
$re = $this->mdTopics->get(array('id' => $page_id), 'app_id,module_ids');
if ($re['module_ids']) {
$where['status>-1'] = null;
$where['id in (' . $re['module_ids'] . ')'] = null;
$resM = $this->mdTopicModules->select($where, 'sort DESC', 0, 0, 'id,type,sort');
foreach ($resM as $key => $value) {
$style = 'none';//none,block(隐藏,显示content富文本)
$title = $mdModule = '';
switch ($value['type']) {
case "text":
$title = '文本模块';
$mdModule = $this->mdModuleText;
$style = 'block';
break;
case "ad":
$title = '广告模块';
$mdModule = $this->mdModuleAd;
break;
case "enroll":
$title = '报名模块';
$mdModule = $this->mdModuleEnroll;
$style = 'block';
break;
default:
}
if ($mdModule) {
$re = $mdModule->get(array('module_id' => $value['id']), 'title');
if ($re) {
$setValue['id'] = $value['id'];
$setValue['page_id'] = $page_id;
$setValue['name'] = $re['title'] ? $re['title'] : $title;
$setValue['tag'] = $value['type'];
$setValue['order_view'] = $value['sort'];
$setValue['style'] = $style;
$moduleList[] = $setValue;
}
}
}
}
$this->data = $moduleList;
return $this->show_json(SYS_CODE_SUCCESS, '获取成功!');
}
/**
* Notes:保存添加模块
* Created on: 2020/2/10 18:06
* Created by: dengbw
*/
public function edit_add_module()
{
$page_id = intval($this->input->post('page_id'));
$add_sys_shop_module = $this->input->post('add_sys_shop_module');
$reT = $this->mdTopics->get(array('id' => $page_id), 'module_ids');
if (!$reT) {
return $this->show_json(SYS_CODE_FAIL, '添加失败!');
}
$module_ids = $reT['module_ids'];
$sort = 100;
if ($module_ids) {
$where['status>-1'] = null;
$where['id in (' . $module_ids . ')'] = null;
$reM = $this->mdTopicModules->min('sort', $where);//获取最小排序
if ($reM['sort']) {
$sort = $reM['sort'] - 1;
}
}
$dataM['sort'] = $sort;
$dataM['type'] = $add_sys_shop_module['tag'];
$dataM['status'] = 1;
//添加模块
$mid = $this->mdTopicModules->add($dataM);
if ($mid <= 0) {
return $this->show_json(SYS_CODE_FAIL, '添加失败!');
}
//添加各模块
$dataI['module_id'] = $mid;
$dataI['title'] = $add_sys_shop_module['name'];
if ($add_sys_shop_module['tag'] == 'text') {
$this->mdModuleText->add($dataI);
} else if ($add_sys_shop_module['tag'] == 'ad') {
$this->mdModuleAd->add($dataI);
} else if ($add_sys_shop_module['tag'] == 'enroll') {
$this->mdModuleEnroll->add($dataI);
}
//更新专题
$module_ids = $module_ids ? $module_ids . ',' . $mid : $mid;
$this->mdTopics->update(array('module_ids' => $module_ids), array('id' => $page_id));
return $this->show_json(SYS_CODE_SUCCESS, '添加成功!');
}
/**
* Notes:保存模块排序
* Created on: 2020/2/21 15:59
* Created by: dengbw
*/
public function edit_sort_module()
{
$module_list = $this->input->post('module_list');
if (!$module_list) {
return $this->show_json(SYS_CODE_FAIL, '排序失败!');
}
foreach ($module_list as $key => $value) {
$this->mdTopicModules->update(array('sort' => $value['order_view']), array('id' => $value['id']));
}
return $this->show_json(SYS_CODE_SUCCESS, '保存成功!');
}
/**
* Notes:软删除已保存的模块
* Created on: 2020/2/11 14:36
* Created by: dengbw
*/
public function edit_delete_module()
{
$id = intval($this->input->post('id'));
if (!$id) {
return $this->show_json(SYS_CODE_FAIL, '非法参数!');
}
$this->mdTopicModules->update(array('status' => -1), array('id' => $id));
return $this->show_json(SYS_CODE_SUCCESS, '删除成功!');
}
/**
* Notes:获取文本模块信息
* Created on: 2020/2/13 12:48
* Created by: dengbw
*/
public function get_text_setting()
{
$module_id = intval($this->input->get('module_id'));
$re = $this->mdModuleText->get(array('module_id' => $module_id));
$setting = array();
$status = 0;
$module_title = $module_desc = $module_content = $bg_img = $bg_color = "";
$title_img = $title_bgcolor = $title_color = $border_color = "";
if ($re) {
$reM = $this->mdTopicModules->get(array('id' => $module_id), 'status, jsondata');
$json_topic = json_decode($reM['jsondata'], true);
$status = $reM ? $reM['status'] : 0;
$module_title = $re['title'];
$module_desc = $re['descrip'];
$module_content = $re['content'];
$title_img = strval($json_topic['title_img']);
$title_bgcolor = strval($json_topic['title_bgcolor']);
$title_color = strval($json_topic['title_color']);
$bg_img = strval($json_topic['bg_img']);
$bg_color = strval($json_topic['bg_color']);
$border_color = strval($json_topic['border_color']);
}
$setting['status'] = $status;
$setting['module_title'] = $module_title;
$setting["module_title_img"] = strval($title_img);
$setting["module_title_img_url"] = $title_img ? build_qiniu_image_url($title_img) : "";
$setting["module_title_bgcolor"] = strval($title_bgcolor);
$setting["module_title_color"] = strval($title_color);
$setting['module_desc'] = $module_desc;
$setting['module_content'] = $module_content;
$setting['module_bg_img'] = $bg_img;
$setting['module_bg_img_url'] = $bg_img ? build_qiniu_image_url($bg_img) : "";
$setting['module_bg_color'] = $bg_color;
$setting["module_border_color"] = strval($border_color);
$this->data['setting'] = $setting;
return $this->show_json(SYS_CODE_SUCCESS, '获取成功!');
}
/**
* Notes:保存文本模块
* Created on: 2020/2/13 12:35
* Created by: dengbw
*/
public function edit_save_text()
{
$save_data = $this->input->post('save_data');
if (!$save_data['module_id']) {
return $this->show_json(SYS_CODE_FAIL, '非法参数!');
}
$row_text = $this->mdModuleText->get(array('module_id' => $save_data['module_id']));
$dataI['title'] = $save_data['setting']['module_title'];
$dataI['descrip'] = $save_data['setting']['module_desc'];
$dataI['content'] = $save_data['setting']['module_content'];
$this->mdModuleText->update($dataI, array('module_id' => $save_data['module_id']));
//更新其他参数
$title_img = $save_data['setting']['module_title_img'];
$title_bgcolor = $save_data['setting']['module_title_bgcolor'];
$title_color = $save_data['setting']['module_title_color'];
$border_color = $save_data['setting']['module_border_color'];
$bg_img = $save_data['setting']['module_bg_img'];
$bg_color = $save_data['setting']['module_bg_color'];
$where = array('id' => $save_data['module_id']);
$row_topic = $this->mdTopicModules->get($where);
$json = json_decode($row_topic['jsondata'], true);
if ($title_img) {
$json['title_img'] = $title_img;
} else {
unset($json['title_img']);
}
if ($title_bgcolor) {
$json['title_bgcolor'] = $title_bgcolor;
} else {
unset($json['title_bgcolor']);
}
if ($title_color) {
$json['title_color'] = $title_color;
} else {
unset($json['title_color']);
}
if ($border_color) {
$json['border_color'] = $border_color;
} else {
unset($json['border_color']);
}
if ($bg_img) {
$json['bg_img'] = $bg_img;
} else {
unset($json['bg_img']);
}
if ($bg_color) {
$json['bg_color'] = $bg_color;
} else {
unset($json['bg_color']);
}
$upd = array('status' => $save_data['setting']['status'], "jsondata" => json_encode($json, JSON_UNESCAPED_UNICODE));
$this->mdTopicModules->update($upd, $where);
return $this->show_json(SYS_CODE_SUCCESS, '保存成功!');
}
/**
* Notes:获取广告信息
* Created on: 2020/5/12 22:48
* Created by: dengbw
*/
public function get_ad_setting()
{
$module_id = intval($this->input->get('module_id'));
$re = $this->mdModuleAd->get(array('module_id' => $module_id));
$setting = $list = array();
if ($re) {
$reM = $this->mdTopicModules->get(array('id' => $module_id), 'status, jsondata');
$json_topic = json_decode($reM['jsondata'], true);
$setting = array(
"module_title_img" => strval($json_topic['title_img']),
"module_title_img_url" => $json_topic['title_img'] ? build_qiniu_image_url($json_topic['title_img']) : "",
"module_title_bgcolor" => strval($json_topic['title_bgcolor']),
"module_title_color" => strval($json_topic['title_color']),
"module_bg_img" => strval($json_topic['bg_img']),
"module_bg_img_url" => $json_topic['bg_img'] ? build_qiniu_image_url($json_topic['bg_img']) : "",
"module_bg_color" => strval($json_topic['bg_color']),
"module_border_color" => strval($json_topic['border_color']),
);
$setting['status'] = $reM ? $reM['status'] : 0;
$setting['module_title'] = $re['title'];
$setting['module_desc'] = $re['descrip'];
$setting['style'] = $re['style'];
$img_json = $re['img_json'] ? json_decode($re['img_json'], true) : array();
foreach ($img_json as $key => $value) {
$setValue = $value;
$setValue['img_url'] = build_qiniu_image_url($value['img'], 690, 390);
$setValue['order_view'] = $value['order_view'] ? $value['order_view'] : 50;
$setValue['jump_type'] = intval($value['jump_type']);
$list[] = $setValue;
}
}
$this->data['setting'] = $setting;
$this->data['ad_list'] = $list;
return $this->show_json(SYS_CODE_SUCCESS, '获取成功!');
}
/**
* Notes:保存广告模块
* Created on: 2020/5/12 12:35
* Created by: dengbw
*/
public function edit_save_ad()
{
$save_data = $this->input->post('save_data');
if (!$save_data['module_id']) {
return $this->show_json(SYS_CODE_FAIL, '非法参数!');
}
$dataI['title'] = $save_data['setting']['module_title'];
$dataI['descrip'] = $save_data['setting']['module_desc'];
$dataI['style'] = $save_data['setting']['style'];
$dataI['img_json'] = $save_data['ads'] ? json_encode($save_data['ads'], JSON_UNESCAPED_UNICODE) : null;
$this->mdModuleAd->update($dataI, array('module_id' => $save_data['module_id']));
//更新其他参数
$title_img = $save_data['setting']['module_title_img'];
$title_bgcolor = $save_data['setting']['module_title_bgcolor'];
$title_color = $save_data['setting']['module_title_color'];
$border_color = $save_data['setting']['module_border_color'];
$bg_img = $save_data['setting']['module_bg_img'];
$bg_color = $save_data['setting']['module_bg_color'];
$where = array('id' => $save_data['module_id']);
$row_topic = $this->mdTopicModules->get($where);
$json = json_decode($row_topic['jsondata'], true);
if ($title_img) {
$json['title_img'] = $title_img;
} else {
unset($json['title_img']);
}
if ($title_bgcolor) {
$json['title_bgcolor'] = $title_bgcolor;
} else {
unset($json['title_bgcolor']);
}
if ($title_color) {
$json['title_color'] = $title_color;
} else {
unset($json['title_color']);
}
if ($border_color) {
$json['border_color'] = $border_color;
} else {
unset($json['border_color']);
}
if ($bg_img) {
$json['bg_img'] = $bg_img;
} else {
unset($json['bg_img']);
}
if ($bg_color) {
$json['bg_color'] = $bg_color;
} else {
unset($json['bg_color']);
}
$upd = array('status' => $save_data['setting']['status'], "jsondata" => json_encode($json, JSON_UNESCAPED_UNICODE));
$this->mdTopicModules->update($upd, $where);
return $this->show_json(SYS_CODE_SUCCESS, '保存成功!');
}
/**
* Notes:获取报名信息
* Created on: 2020/5/12 22:48
* Created by: dengbw
*/
public function get_enroll_setting()
{
$module_id = intval($this->input->get('module_id'));
$re = $this->mdModuleEnroll->get(array('module_id' => $module_id));
$setting = $list = array();
if ($re) {
$reM = $this->mdTopicModules->get(array('id' => $module_id), 'status, jsondata');
$json_topic = json_decode($reM['jsondata'], true);
$setting['status'] = $reM ? $reM['status'] : 0;
$setting['module_title'] = $re['title'];
$setting['module_desc'] = $re['descrip'];
$setting['module_banner'] = $re['banner'];
$setting['module_banner_url'] = $re['banner'] ? build_qiniu_image_url($re['banner']) : '';
$setting['module_limit_num'] = $re['limit_num'];
$setting['module_type'] = $re['type'];
$setting['module_content'] = $re['content'];
$setting['module_title_img'] = strval($json_topic['title_img']);
$setting['module_title_img_url'] = $json_topic['title_img'] ? build_qiniu_image_url($json_topic['title_img']) : "";
//设置黑名单,风格
$jsondata = $re['jsondata'] ? json_decode($re['jsondata'], true) : array();
$setting['user_black'] = intval($jsondata['user_black']);
$setting['style'] = intval($jsondata['style']);
$setting['show_type'] = intval($jsondata['show_type']);
$setting['if_code'] = intval($jsondata['if_code']);
$setting['if_module'] = intval($jsondata['if_module']);
$time = '';
if ($re['type'] == 1) {
if ($re['as_time'] != '0000-00-00 00:00:00') {
$time = $re['as_time'] . " ~ " . $re['ae_time'];
}
$this->load->model('biz/biz_model', 'mdBiz');
$ids = 0;
$resBiz = $this->mdModuleEnrollbiz->select(array('module_id' => $module_id), 'id desc', 0, 0, 'biz_id');
$resBiz && $ids = implode(',', array_column($resBiz, 'biz_id'));
$where["id in ({$ids})"] = null;
$res = $this->mdBiz->select($where, ' field(id,' . $ids . ')', 0, 0, 'id,biz_name');
if ($res) {
foreach ($res as $key => $value) {
$setValue = array();
$setValue['id'] = $value['id'];
$setValue['name'] = $value['biz_name'];
$list[] = $setValue;
}
}
}
$etime = '';
if ($re['es_time'] != '0000-00-00 00:00:00') {
$etime = $re['es_time'] . " ~ " . $re['ee_time'];
}
$setting['module_time'] = $time;//核销时间
$setting['module_etime'] = $etime;//报名时间
}
$this->data['setting'] = $setting;
$this->data['goods'] = $list;
return $this->show_json(SYS_CODE_SUCCESS, '获取成功!');
}
/**
* Notes:保存报名模块
* Created on: 2020/5/12 12:35
* Created by: dengbw
*/
public function edit_save_enroll()
{
$save_data = $this->input->post('save_data');
$module_id = $save_data['module_id'];
if (!$module_id) {
return $this->show_json(SYS_CODE_FAIL, '非法参数!');
}
$dataI['title'] = $save_data['setting']['module_title'];
$dataI['descrip'] = $save_data['setting']['module_desc'];
$dataI['banner'] = $save_data['setting']['module_banner'];
$dataI['content'] = $save_data['setting']['module_content'];
$dataI['limit_num'] = intval($save_data['setting']['module_limit_num']);
$dataI['type'] = $save_data['setting']['module_type'];
//报名时间
$es_time = $ee_time = '0000-00-00 00:00:00';
if ($save_data['setting']['module_etime']) {
$module_time = explode(' ~ ', $save_data['setting']['module_etime']);
$es_time = $module_time[0];
$ee_time = $module_time[1];
}
//核销时间
$as_time = $ae_time = '0000-00-00 00:00:00';
if ($save_data['setting']['module_time']) {
$module_time = explode(' ~ ', $save_data['setting']['module_time']);
$as_time = $module_time[0];
$ae_time = $module_time[1];
}
//核销商家
if ($dataI['type'] == 1) {
$dataI['as_time'] = $as_time;
$dataI['ae_time'] = $ae_time;
$addBiz = array();
if ($save_data['enrolls']) {
foreach ($save_data['enrolls'] as $key => $value) {
$setValue = array();
$setValue['module_id'] = $module_id;
$setValue['biz_id'] = $value['id'];
$addBiz[] = $setValue;
}
}
$this->mdModuleEnrollbiz->delete(array("module_id" => $module_id));
$addBiz && $this->mdModuleEnrollbiz->add_batch($addBiz);
}
$dataI['es_time'] = $es_time;
$dataI['ee_time'] = $ee_time;
//jsondata
$row = $this->mdModuleEnroll->get(array('module_id' => $save_data['module_id']));
$jsondata = $row['jsondata'] ? json_decode($row['jsondata'], true) : array();
if (0 == $save_data['setting']['user_black']) {//不限制黑名单
unset($jsondata['user_black']);
} else {
$jsondata['user_black'] = 1;
}
if (0 == $save_data['setting']['style']) {
unset($jsondata['style']);
} else {
$jsondata['style'] = 1;
}
$jsondata['show_type'] = $save_data['setting']['show_type'];
$jsondata['if_code'] = $save_data['setting']['if_code'];
$jsondata['if_module'] = $save_data['setting']['if_module'];
$dataI['jsondata'] = $jsondata ? json_encode($jsondata, JSON_UNESCAPED_UNICODE) : null;
//更新其他参数
$where = array('id' => $save_data['module_id']);
$row_topic = $this->mdTopicModules->get($where);
$json = json_decode($row_topic['jsondata'], true);
$title_img = $save_data['setting']['module_title_img'];
if ($title_img) {
$json['title_img'] = $title_img;
} else {
unset($json['title_img']);
}
//$enroll_json['gender'] = array("name" => '性别', "field" => 'radio', "values" => array('男', '女'));
$enroll_json['remark'] = array("name" => '备注', "field" => 'textarea');
$dataI['enroll_json'] = json_encode($enroll_json);
$this->mdModuleEnroll->update($dataI, array('module_id' => $save_data['module_id']));
$this->mdTopicModules->update(array('status' => $save_data['setting']['status'], "jsondata" => json_encode($json, JSON_UNESCAPED_UNICODE)
), array('id' => $save_data['module_id']));
return $this->show_json(SYS_CODE_SUCCESS, '保存成功!');
}
/**
* Notes:修改状态 0下架,1正常
* Created on: 2019/12/3 15:48
* Created by: dengbw
*/
public function edit_status()
{
$id = intval($this->input->post('id'));
$status = intval($this->input->post('status'));
$where['id'] = $id;
$data['status'] = $status;
$re = $this->mdTopics->update($data, $where);
if (!$re) {
return $this->show_json(SYS_CODE_FAIL, '修改失败');
}
return $this->show_json(SYS_CODE_SUCCESS, '修改成功!');
}
public
function del()
{
// TODO: Implement del() method.
}
public
function batch()
{
}
public
function export()
{
// TODO: Implement export() method.
}
}
+309
View File
@@ -0,0 +1,309 @@
<link rel="stylesheet" type="text/css" href="/static/css/font-awesome.min.css?v=1581252500">
<link rel="stylesheet" type="text/css" href="/static/css/appitem/AdminLTE.min.css?v=1581252500">
<link rel="stylesheet" type="text/css" href="/static/css/appitem/hd.css?v=1581252500">
<div class="app-design clearfix">
<form id="vue-edit" action="<?= $info['edit_url'] ?>" data-auto="true" method="post">
<input type="hidden" name="id" value="<?= $info['id'] ?>"/>
<input type="hidden" name="app_id" value="<?= $info['app_id'] ?>"/>
<input type="hidden" name="spm" value="<?= $info['spm'] ?>"/>
<div class="form-group row">
<label for="" class="col-sm-1 control-label" style="line-height:32px;">专题信息</label>
<div class="col-sm-4">
<div class="input-group">
<div class="input-group-addon">专题名称</div>
<input type="text" name="title" value="<?= $info['title'] ?>" class="form-control"
placeholder="专题名称"/>
</div>
</div>
<div class="col-sm-2">
<div class="input-group">
<div class="input-group-addon">背景色</div>
<input type="text" name="bg_color" value="<?= $info['bg_color'] ?>" class="form-control"
placeholder="背景色"/>
</div>
</div>
<div class="col-sm-3">
<div class="input-group">
<div class="am-form-group am-form-file">
<button type="button" class="am-btn am-btn-default am-btn-sm"
data-file="1" data-type="jpg,png,gif,png,jpeg"
data-uptype="qiniu" data-field="bg_img"><i class="am-icon-cloud-upload"></i> 背景图<span
style="color: blue">(宽750)</span>
</button>
<input type="hidden" name="bg_img" id="bg_img"
onchange="$(this).next('img').attr('src', $(this).data('srcs') || this.value)"
value="<?= $info['bg_img'] ?>" class="layui-input">
<img data-tips-image style="height:auto;max-height:32px;min-width:32px"
src="<?= $info['bg_img_url'] ?>"/>
</div>
</div>
</div>
<div class="col-sm-2">
<div class="input-group">
<button class="btn btn-primary" type="submit">保存</button>
</div>
</div>
</div>
</form>
</div>
<? if ($info['id'] > 0) { ?>
<div id="vue-app">
<div class="app-design clearfix">
<div class="app-simulator">
<div class="app-simulator-inner">
<draggable class="app-simulator-inner" v-model="module_list" group="module"
@start="drag=true" @end="drag=false" @sort="sort">
<div v-for="(module,index) in module_list" @click="moduleSwitch(index)"
:key="module.id" :class="module.active ? 'active':''"
class="app-simulator-field">
<a class="btn btn-app"><i class="fa" :class="module.icon"></i>
{{module.name}}</a>
<div class="app-simulator-field-action"></div>
</div>
</draggable>
</div>
</div>
<div class="app-editor">
<div class="app-editor-inner panel panel-default">
<div class="panel-body">
<div class="page-header">
<div class="page-header-name"><h4>{{ module.name }}</h4></div>
<div class="page-header-option">
<small class="text-muted"></small>
</div>
</div>
<form class="form-horizontal">
<template v-if="module.tag !== 'add_module'">
<!-- 组件 -->
<v-text ref="text" v-if="module.tag === 'text'" :module="module"
:is_template="is_template" @text-title="changeModuleName"></v-text>
<v-ad ref="ad" v-if="module.tag === 'ad'" :module="module"
:is_template="is_template" @ad-title="changeModuleName"></v-ad>
<v-enroll ref="enroll" v-if="module.tag === 'enroll'" :module="module"
:is_template="is_template" @enroll-title="changeModuleName"></v-enroll>
</template>
<div v-else class="form-group">
<label for="" class="col-sm-2 control-label">模块类型</label>
<div class="col-sm-10">
<div class="btn-dock-wrap btn-dock-sm">
<div class="row">
<div class="col-sm-3"
@click="add_sys_shop_module = item"
v-for="(item,index) in sys_shop_module">
<a href="javascript:" class="btn-dock"
:class="add_sys_shop_module.tag === item.tag ? 'active': ''">{{item.name}}</a>
</div>
</div>
</div>
</div>
</div>
<div class="form-group" :style="'display:'+module.style">
<label for="" class="col-sm-2 control-label">详情</label>
<div class="col-sm-9">
<textarea id="editor" name="content" class="am-para-input input-left"></textarea>
</div>
</div>
<div class="form-group">
<div class="col-sm-10 col-sm-offset-2">
<hr>
<template v-if="module.tag !== 'add_module'">
<a href="javascript:" @click="saveModule" class="btn btn-primary">保存</a>
<a href="javascript:" @click="deleteModule"
class="btn btn-danger btn-stroke pull-right">删除模块</a>
</template>
<a v-else href="javascript:" @click="saveAddModule"
class="btn btn-primary">确定添加</a>
</div>
</div>
</form>
</template>
</div>
</div>
</div>
</div>
</div>
<!--模版操作-->
<!-- v-text -->
<? load_view("/topics/module_text") ?>
<!-- v-ad -->
<? load_view("/topics/module_ad") ?>
<!-- v-enroll -->
<? load_view("/topics/module_enroll") ?>
<!--模块操作-->
<script type="text/javascript">
var content_html;
require(['ckeditor'], function (ckeditor) {
content_html = window.createEditor('[name="content"]');
});
var layer_open;
var vm;
var loading = false;
$(document).ready(function () {
vm = new Vue({
el: '#vue-app',
data: {
page_id: <?= $info['id'] ?>,
sys_shop_module: <?=json_encode($info['moduleAry'])?>, // 可配置模块项
module: { // 当前操作的 module 信息
tag: '',
name: ''
},
module_list: [],
add_sys_shop_module: {}, // 添加模块 sys_shop_module 数组中的一项
edit_page_modal: false,
wx_page: {},
wx_page_title: '',
is_template: '0',
drag: null,
page_url: '',
minicode: '',
pop_config: {},
popConfigLoading: 0,
pop_config_goods: [],
popGoodsKeyword: '',
pop_config_page: 1,
pop_config_total_page: 0,
popGoodsModal: false,
pop_config_saving: 0,
page_diy_index: '0',
weshop_mp_follow: '0',
},
mounted: function () {
this.getModuleList(this.page_id, 0);
},
methods: {
// 保存按钮触发、通知子组件
saveModule: function () {
this.$refs[this.module.tag].save();
},
// 保存添加模块
saveAddModule: function () {
if (JSON.stringify(this.add_sys_shop_module) === "{}") {
layer.msg('请选择模块类型', {icon: 2});
return false;
}
$.ajax('/topics/topics/edit_add_module', {
type: 'POST',
data: {
page_id: this.page_id,
add_sys_shop_module: this.add_sys_shop_module
},
success: function (r) {
vm.getModuleList(vm.page_id, -2);
}
})
},
// 软删除已保存的模块
deleteModule: function () {
if (confirm('确认删除?')) {
var id = this.module.id;
$.ajax('/topics/topics/edit_delete_module', {
type: 'post',
data: {
id: id
},
success: function (re) {
if (re.code) {
vm.getModuleList(vm.page_id, 0);
layer.msg(re.msg, {icon: 1});
} else {
layer.msg(re.msg, {icon: 2});
}
}
})
}
},
/**
* 获取模块列表
* @param page_id
* @param side_index 侧边栏选中 负数则为尾部开始选择
*/
getModuleList: function (page_id, side_index) {
$.ajax('/topics/topics/get_module', {
data: {
page_id: page_id
},
success: function (re) {
if (re.code && re.data) {
vm.module_list = re.data;
vm.module_list.map(function (item) {
item.icon = vm.iconList(item.tag);
});
vm.module_list.push(vm.getAddButton());
vm.moduleSwitch(side_index < 0 ? vm.module_list.length + side_index : side_index);
}
}
})
},
// 返回添加按钮
getAddButton: function () {
return {
name: '添加模块',
tag: 'add_module',
style: 'none',
icon: 'fa-plus'
}
},
// 图标列表
iconList: function (tag) {
if (tag === 'text') return 'fa-file';
if (tag === 'ad') return 'fa-photo';
if (tag === 'enroll') return 'fa-sign-out';
},
// 模块排序
sort: function () {
var module_list = [];
this.module_list.map(function (item, index) {
var arr = {};
arr.id = item.id;
arr.order_view = (index / -1) + 100; // 逆转排序顺序
module_list.push(arr);
});
$.ajax({
url: '/topics/topics/edit_sort_module',
type: 'post',
dataType: 'json',
data: {
module_list: module_list
},
success: function (re) {
if (re.code) {
layer.msg(re.msg, {icon: 1});
} else {
vm.getModuleList(vm.page_id, 0); // 如果排序失败,从新获取模块列表
layer.msg(re.msg, {icon: 2});
}
}
});
},
// 模块切换
moduleSwitch: function (index) {
// 模块样式切换
this.module_list.map(function (item) {
vm.$set(item, 'active', 0);
});
this.module_list[index].active = 1;
this.module = this.module_list[index];
},
// 模块组件更改模块名
changeModuleName: function (obj) {
for (var i = 0; i < this.module_list.length; i++) {
if (this.module_list[i].id === obj.module_id) {
this.module_list[i].name = obj.module_name;
break;
}
}
}
}
});
});
</script>
<? } ?>
+45
View File
@@ -0,0 +1,45 @@
<form id="vue-edit" class="am-form am-form-horizontal" data-auto="true" method="post"
style="width: 90%;padding-top: 10px;padding-bottom: 10px;">
<div class="am-form-group" style="margin-bottom: 0px;">
<label class="am-para-label">姓名:</label>
<div class="am-para-input">
<label class="am-para-label" style="text-align: left;width: 90%;"><?= $info['name'] ?></label>
</div>
</div>
<div class="am-form-group" style="margin-bottom: 0px;">
<label class="am-para-label">手机号:</label>
<div class="am-para-input">
<label class="am-para-label" style="text-align: left;width: 90%;"><?= $info['mobile'] ?></label>
</div>
</div>
<? if ($info['type'] == 1) { ?>
<div class="am-form-group" style="margin-bottom: 0px;">
<label class="am-para-label">核销码:</label>
<div class="am-para-input">
<label class="am-para-label" style="text-align: left;width: 90%;"><?= $info['code'] ?></label>
</div>
</div>
<div class="am-form-group" style="margin-bottom: 0px;">
<label class="am-para-label">状态:</label>
<div class="am-para-input">
<label class="am-para-label" style="text-align: left;width: 90%;"><?= $info['status_name'] ?></label>
</div>
</div>
<? } ?>
<div class="am-form-group" style="margin-bottom: 0px;">
<label class="am-para-label">报名时间:</label>
<div class="am-para-input">
<label class="am-para-label" style="text-align: left;width: 90%;"><?= $info['c_time'] ?></label>
</div>
</div>
<? if ($info['enroll_json']) {
foreach ($info['enroll_json'] as $v) { ?>
<div class="am-form-group" style="margin-bottom: 0px;">
<label class="am-para-label"><?= $v['name'] ?></label>
<div class="am-para-input">
<label class="am-para-label" style="text-align: left;width: 90%;"><?= $v['value'] ?></label>
</div>
</div>
<? }
} ?>
</form>
+176
View File
@@ -0,0 +1,176 @@
<div class="coms-table-wrap mt10">
<form class=" form-search coms-table-hd clearfix no-border" onsubmit="return false"
action="/topics/enroll/lists">
<input type="hidden" name="module_id" value="<?= $params['module_id'] ?>"/>
<input type="hidden" name="type" value="<?= $type ?>"/>
<input type="hidden" name="app_id" value="<?= $params['app_id'] ?>"/>
<div class="am-form am-form-horizontal">
<div class="am-form-group fl">
<label class="am-para-label w100">姓名:</label>
<div class="am-para-inline w200">
<input type="text" name="name" value="<?= $params['name'] ?>"/>
</div>
</div>
<div class="am-form-group fl">
<label class="am-para-label w100">手机号:</label>
<div class="am-para-inline w200">
<input type="text" name="mobile" value="<?= $params['mobile'] ?>" placeholder="手机号"/>
</div>
</div>
<? if ($type == 1) { ?>
<div class="am-form-group fl">
<label class="am-para-label w100">核销码:</label>
<div class="am-para-inline w200">
<input type="text" name="code" value="<?= $params['code'] ?>"/>
</div>
</div>
<div class="am-form-group fl">
<label class="am-para-label w100">状态:</label>
<div class="am-form-group am-para-inline w120">
<select name="status">
<option value="">选择状态</option>
<?php foreach ($statusAry as $key => $value) { ?>
<option value="<?= $key ?>"
<?= $key == $params['status'] ? 'selected' : '' ?>><?= $value ?></option>
<? } ?>
</select>
</div>
</div>
<? } ?>
<div class="am-form-group fl ml10">
<div class="am-form-group fl">
<div class="am-para-inline w300">
<input id="order-lists-time" type="text" name="time" value="<?= $params['time'] ?>"
placeholder="报名日期范围"/>
</div>
</div>
<div class="am-form-group fl mb10" style="margin-top: 5px">
<div class="am-para-inline w300">
<a class="mr10 order-lists-time-btn" href="javascript:void (0);" data-date="today">今天</a>
<a class="mr10 order-lists-time-btn" href="javascript:void (0);"
data-date="yesterday">昨日</a>
<a class="mr10 order-lists-time-btn" href="javascript:void (0);" data-date="7day">最近7天</a>
<a class="mr10 order-lists-time-btn" href="javascript:void (0);" data-date="30day">最近30天</a>
</div>
</div>
<div class="am-form-group fl ml10">
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
</div>
<div class="am-form-group fl ml20">
<button type="button" id="export" class="am-btn am-btn-success am-btn-sm w100">导出</button>
</div>
</div>
</form>
<div class="coms-table-bd" id="vue-app" style="margin-top: 15px;">
<table class="am-table am-table-bordered">
<thead>
<tr>
<th width="5%"><span>ID</span></th>
<?if(!$params['module_id']){?>
<th width="20%"><span>活动名称</span></th>
<?}?>
<th width="10%"><span>姓名</span></th>
<th width="10%"><span>手机号</span></th>
<? if ($type == 1) { ?>
<th width="10%"><span>核销码</span></th>
<th width="6%"><span>状态</span></th>
<? } ?>
<th width="10%"><span>报名时间</span></th>
<th width="20%"><span>备注</span></th>
<th width="15%"><span>操作</span></th>
</tr>
</thead>
<tbody>
<template v-for="(item,index) in list">
<tr>
<td>{{item.id}}</td>
<?if(!$params['module_id']){?>
<td>{{item.title}}</td>
<?}?>
<td>{{item.name}}</td>
<td>{{item.mobile}}</td>
<? if ($type == 1) { ?>
<td>{{item.code}}</td>
<td>{{item.status_name}}</td>
<? } ?>
<td>{{item.c_time}}</td>
<td>{{item.remark}}</td>
<td>
<a class="am-btn am-btn-primary am-btn-xs" style="margin-top: 5px;"
:data-modal="'/topics/enroll/get?id='+item.id+'&module_id='+item.module_id"
:data-title="item.name+'详情'">查看详情</a>
</td>
</tr>
</template>
</tbody>
</table>
</div>
<div class="coms-table-ft clearfix">
<div class="hander am-form">
</div>
<div class="coms-pagination fr mr20">
<?php page_view($pager) ?>
</div>
</div>
</div>
<script>
require(['laydate', 'autocomplete'], function (laydate) {
//日期范围
laydate.render({
elem: '#order-lists-time'
, range: '~'
});
$('.order-lists-time-btn').click(function () {
var type = $(this).data('date'), date = '', d_obj = new Date();
switch (type) {
case 'today':
date = d_obj.Format('yyyy-MM-dd');
date = date + ' ~ ' + date;
break;
case 'yesterday':
date = (new Date(d_obj.getTime() - 86400000)).Format('yyyy-MM-dd');
date = date + ' ~ ' + date;
break;
case '7day':
date = (new Date(d_obj.getTime() - 86400000 * 7)).Format('yyyy-MM-dd') + ' ~ ' + d_obj.Format('yyyy-MM-dd');
break;
case '30day':
date = (new Date(d_obj.getTime() - 86400000 * 30)).Format('yyyy-MM-dd') + ' ~ ' + d_obj.Format('yyyy-MM-dd');
break;
}
$('#order-lists-time').val(date);
});
});
var layer_open;
var vue_obj;
var loading = false;
$(document).ready(function () {
vue_obj = new Vue({
el: '#vue-app',
data: {
list: []
},
mounted:function() {
var that = this;
that.list = <?=json_encode($lists)?>;
},
computed: {},
created: function () {
},
updated: function () {
},
methods: {}
});
});
$('#export').on('click', function () {
var count = <?=$pager['totle']?>;
if (count > 10000) {
layer.msg('单次导出数据不能超过10000');
return false;
}
var href = $.menu.parseUri(window.location.href);
href = href.replace("lists", "export");
window.location.href = href;
});
</script>
@@ -0,0 +1,97 @@
<div class="coms-table-wrap mt10" id="vue-app">
<form class=" form-search coms-table-hd clearfix no-border" onsubmit="return false"
action="/topics/enroll/lists_module">
<input type="hidden" name="app_id" v-model="params.app_id"/>
<div class="am-form am-form-horizontal">
<div class="am-form-group fl">
<label class="am-para-label w100">搜索:</label>
<div class="am-para-inline w120">
<select name="search_k" v-model="params.search_k" >
<option v-for="(v,i) in search_ary" :value="i">{{v}}</option>
</select>
</div>
<div class="am-form-group fl">
<div class="am-para-inline w300">
<input id="search_v" name="search_v" type="text" v-model="params.search_v"/>
</div>
</div>
</div>
<div class="am-form-group fl">
<div class="am-para-inline w120">
<select name="status" v-model="params.status" >
<option value="">状态</option>
<option value="0">下架</option>
<option value="1">正常</option>
</select>
</div>
</div>
<div class="am-form-group fl ml10">
<button type="button" class="am-btn am-btn-success am-btn-sm w100" @click="saveEdit">搜索</button>
</div>
</div>
</form>
<div class="coms-table-bd">
<table class="am-table am-table-bordered">
<thead>
<tr>
<th width="5%"><span>ID</span></th>
<th width="20%"><span>标题</span></th>
<th width="25%"><span>时间</span></th>
<th width="10%"><span>状态</span></th>
<th width=""><span>操作</span></th>
</tr>
</thead>
<tbody>
<template v-for="(v,i) in lists">
<tr>
<td>{{v.id}}</td>
<td>{{v.title}}</td>
<td>
<span>报名:{{v.e_time}}</span>
<br/>
<span>活动:{{v.a_time}}</span>
</td>
<td>{{v.statusion}}</td>
<td>
<a :data-open="'/appitem/topics/enroll/lists?module_id='+v.id" class="am-btn am-btn-primary am-btn-xs" data-title="查看报名">报名列表</a>
</td>
</tr>
</template>
</tbody>
</table>
</div>
<div class="coms-table-ft clearfix">
<div class="coms-pagination fr mr20">
<?php page_view($pager) ?>
</div>
</div>
</div>
<script>
var vue_obj;
var loading = false;
$(function () {
vue_obj = new Vue({
el: '#vue-app',
data: {
params:[],
search_ary:[],
lists:[]
},
mounted:function() {
var vm = this;
vm.params = <?=json_encode($params)?>;
vm.search_ary = <?=json_encode($search_ary)?>;
vm.lists = <?=json_encode($lists)?>;
},
methods:{
saveEdit:function(){
$("form").submit();
}
},
watch:{}
});
<?php page_script($pager) ?>
});
</script>
+122
View File
@@ -0,0 +1,122 @@
<div class="coms-table-wrap mt10">
<form class=" form-search coms-table-hd clearfix no-border" onsubmit="return false"
action="/topics/topics">
<div class="am-form am-form-horizontal">
<div class="am-form-group fl">
<label class="am-para-label w100">名称:</label>
<div class="am-para-inline w200">
<input type="text" name="title" value="<?= $params['title'] ?>" placeholder="专题名称"/>
</div>
</div>
<div class="am-form-group fl">
<label class="am-para-label w140">状态:</label>
<div class="am-form-group am-para-inline w150">
<select name="status">
<option value="">选择状态</option>
<?php foreach ($statusAry as $key => $value) { ?>
<option value="<?= $key ?>"
<?= $key == $params['status'] ? 'selected' : '' ?>><?= $value ?></option>
<? } ?>
</select>
</div>
</div>
<div class="am-form-group fl">
<label class="am-para-label w140">来源:</label>
<div class="am-form-group am-para-inline w120">
<select name="app_id">
<?php foreach ($appList as $key => $value) { ?>
<option value="<?= $value['id'] ?>"
<?= $value['id'] == $params['app_id'] ? 'selected' : '' ?>><?= $value['name'] ?></option>
<? } ?>
</select>
</div>
</div>
<div class="am-form-group fl">
<div class="am-form-group fl ml30">
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
</div>
<div class="am-form-group fl ml30">
<button type="button" data-open="/topics/topics/get?app_id=<?= $params['app_id'] ?>"
class="am-btn am-btn-success am-btn-sm w100">新增
</button>
</div>
</div>
</form>
<div class="coms-table-bd" id="vue-app">
<table class="am-table am-table-bordered">
<thead>
<tr>
<th width="5%"><span>ID</span></th>
<th width="20%"><span>专题名称</span></th>
<th width="6%"><span>状态</span></th>
<th width="10%"><span>创建时间</span></th>
<th width="15%"><span>七天内 访问次数/访问用户数</span></th>
</tr>
</thead>
<tbody>
<template v-for="(item,index) in list">
<tr>
<td>{{item.id}}</td>
<td>{{item.title}}</td>
<td>{{item.status_name}}</td>
<td>{{item.c_time}}</td>
<td>{{item.count_view}}/{{item.count_view_uid}}</td>
</tr>
<tr>
<td colspan="5" class="align-r">
<!-- <a class="am-btn am-btn-primary am-btn-xs"-->
<!-- :data-modal="'/common/share_link?id='+item.id+'&app_id=--><?//= $params['app_id'] ?><!--&pages=special'"-->
<!-- data-title="分享连接">分享链接</a>-->
<a class="am-btn am-btn-primary am-btn-xs" :data-open="'/topics/topics/lists_userc?id='+item.id"
data-title="记录概况">记录概况</a>
<a class="am-btn am-btn-primary am-btn-xs"
:data-open="'/topics/topics/lists_by_day?id='+item.id" data-title="按天统计">按天统计</a>
<input type="button" class="am-btn am-btn-xs am-btn-danger"
data-ajax="post" data-action="/topics/topics/edit_status"
:data-params-id="item.id" :data-params-status="item.che_status"
:value="item.che_status_name"/>
<a :data-open="'/topics/topics/get?id='+item.id"
class="am-btn am-btn-primary am-btn-xs">编辑</a>
</td>
</tr>
</template>
</tbody>
</table>
</div>
<div class="coms-table-ft clearfix">
<div class="hander am-form">
<label class="checkall">
<input type="checkbox" data-check-target=".order-ids">全选</label>
</div>
<div class="coms-pagination fr mr20">
<?php page_view($pager) ?>
</div>
</div>
</div>
<script>
var layer_open;
var vue_obj;
var loading = false;
$(document).ready(function () {
vue_obj = new Vue({
el: '#vue-app',
data: {
list: [],
},
mounted() {
var that = this;
that.list = <?=json_encode($lists)?>;
},
computed: {},
created: function () {
},
updated: function () {
},
methods: {}
});
});
</script>
+110
View File
@@ -0,0 +1,110 @@
<div class="coms-table-wrap mt10">
<form class=" form-search coms-table-hd clearfix no-border" onsubmit="return false"
action="/topics/topics/lists_by_day">
<input name="id" type="hidden" value="<?= $params['id'] ?>"/>
<div class="am-form am-form-horizontal">
<div class="am-form-group fl ml10">
<div class="am-form-group fl">
<div class="am-para-inline w300">
<input id="lists-time" type="text" name="time" value="<?= $params['time'] ?>"
placeholder="日期范围"/>
</div>
</div>
<div class="am-form-group fl mb10" style="margin-top: 5px">
<div class="am-para-inline w300">
<a class="mr10 lists-time-btn" href="javascript:void (0);" data-date="today">今天</a>
<a class="mr10 lists-time-btn" href="javascript:void (0);"
data-date="yesterday">昨日</a>
<a class="mr10 lists-time-btn seven" href="javascript:void (0);" data-date="7day">最近7天</a>
<a class="mr10 lists-time-btn" href="javascript:void (0);" data-date="30day">最近30天</a>
</div>
</div>
<div class="am-form-group fl ml10">
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
</div>
</div>
</div>
</form>
<div class="coms-table-bd" id="vue-app">
<table class="am-table am-table-bordered">
<thead>
<tr>
<th width="5%"><span>日期</span></th>
<th width="20%"><span>访问次数</span></th>
<th width="20%"><span>访问用户数</span></th>
</tr>
</thead>
<tbody>
<template v-for="(item,index) in list">
<tr>
<td>{{item.date}}</td>
<td>{{item.count}}</td>
<td>{{item.count_uid}}</td>
</tr>
</template>
</tbody>
</table>
</div>
<div class="coms-table-ft clearfix">
<div class="coms-pagination fr mr20">
<?php page_view($pager) ?>
</div>
</div>
</div>
<script>
var layer_open;
var vue_obj;
var loading = false;
$(document).ready(function () {
vue_obj = new Vue({
el: '#vue-app',
data: {
params:[],
list: []
},
mounted:function() {
var that = this;
that.params = <?=json_encode($params, JSON_UNESCAPED_UNICODE)?>;
that.list = <?=json_encode($lists, JSON_UNESCAPED_UNICODE)?>;
},
computed: {},
created: function () {
},
updated: function () {
},
methods: {}
});
});
require(['laydate', 'autocomplete'], function (laydate) {
//日期范围
laydate.render({
elem: '#lists-time'
, range: '~'
});
$('.lists-time-btn').click(function () {
var type = $(this).data('date'), date = '', d_obj = new Date();
switch (type) {
case 'today':
date = d_obj.Format('yyyy-MM-dd');
date = date + ' ~ ' + date;
break;
case 'yesterday':
date = (new Date(d_obj.getTime() - 86400000)).Format('yyyy-MM-dd');
date = date + ' ~ ' + date;
break;
case '7day':
date = (new Date(d_obj.getTime() - 86400000 * 7)).Format('yyyy-MM-dd') + ' ~ ' + d_obj.Format('yyyy-MM-dd');
break;
case '30day':
date = (new Date(d_obj.getTime() - 86400000 * 30)).Format('yyyy-MM-dd') + ' ~ ' + d_obj.Format('yyyy-MM-dd');
break;
}
$('#lists-time').val(date);
});
if ($('#lists-time').val() == ""){
$('.seven').click();
}
});
</script>
+127
View File
@@ -0,0 +1,127 @@
<div class="coms-table-wrap mt10">
<form class=" form-search coms-table-hd clearfix no-border" onsubmit="return false"
action="/topics/topics/lists_user">
<input name="id" type="hidden" value="<?= $params['id'] ?>"/>
<div class="am-form am-form-horizontal">
<div class="am-form-group fl">
<label class="am-para-label w100">搜索:</label>
<div class="am-para-inline w120">
<select name="search_tp" id="search_tp" onchange="searchTp(this,1);">
<?php foreach ($ary['searchTpAry'] as $key => $value) { ?>
<option value="<?= $key ?>"
<?= $key == $params['search_tp'] ? 'selected' : '' ?>><?= $value ?></option>
<? } ?>
</select>
</div>
</div>
<div class="am-form-group fl">
<div class="am-para-inline w300">
<input id="title" name="title" type="text" value="<?= $params['title'] ?>"/>
</div>
</div>
<div class="am-form-group fl ml10">
<div class="am-form-group fl">
<div class="am-para-inline w300">
<input id="lists-time" type="text" name="time" value="<?= $params['time'] ?>"
placeholder="日期范围"/>
</div>
</div>
<div class="am-form-group fl mb10" style="margin-top: 5px">
<div class="am-para-inline w300">
<a class="mr10 lists-time-btn" href="javascript:void (0);" data-date="today">今天</a>
<a class="mr10 lists-time-btn" href="javascript:void (0);"
data-date="yesterday">昨日</a>
<a class="mr10 lists-time-btn" href="javascript:void (0);" data-date="7day">最近7天</a>
<a class="mr10 lists-time-btn" href="javascript:void (0);" data-date="30day">最近30天</a>
</div>
</div>
</div>
<div class="am-form-group fl">
<div class="am-form-group fl ml30">
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
</div>
</div>
</form>
<div class="coms-table-bd" id="vue-app">
<table class="am-table am-table-bordered">
<thead>
<tr>
<th width="5%"><span>ID</span></th>
<th width="20%"><span>用户姓名</span></th>
<th width="20%"><span>用户手机号</span></th>
<th width="20%"><span>源头用户</span></th>
<th width="10%"><span>源头手机号</span></th>
<th width="20%"><span>访问日期</span></th>
</tr>
</thead>
<tbody>
<template v-for="(item,index) in list">
<tr>
<td>{{item.id}}</td>
<td>{{item.uname}}</td>
<td>{{item.mobile}}</td>
<td>{{item.suname}}</td>
<td>{{item.smobile}}</td>
<td>{{item.c_time}}</td>
</tr>
</template>
</tbody>
</table>
</div>
<div class="coms-table-ft clearfix">
<div class="coms-pagination fr mr20">
<?php page_view($pager) ?>
</div>
</div>
</div>
<script>
var layer_open;
var vue_obj;
var loading = false;
$(document).ready(function () {
vue_obj = new Vue({
el: '#vue-app',
data: {
list: []
},
mounted:function() {
var that = this;
that.list = <?=json_encode($lists)?>;
},
computed: {},
created: function () {
},
updated: function () {
},
methods: {}
});
});
require(['laydate', 'autocomplete'], function (laydate) {
//日期范围
laydate.render({
elem: '#lists-time'
, range: '~'
});
$('.lists-time-btn').click(function () {
var type = $(this).data('date'), date = '', d_obj = new Date();
switch (type) {
case 'today':
date = d_obj.Format('yyyy-MM-dd');
date = date + ' ~ ' + date;
break;
case 'yesterday':
date = (new Date(d_obj.getTime() - 86400000)).Format('yyyy-MM-dd');
date = date + ' ~ ' + date;
break;
case '7day':
date = (new Date(d_obj.getTime() - 86400000 * 7)).Format('yyyy-MM-dd') + ' ~ ' + d_obj.Format('yyyy-MM-dd');
break;
case '30day':
date = (new Date(d_obj.getTime() - 86400000 * 30)).Format('yyyy-MM-dd') + ' ~ ' + d_obj.Format('yyyy-MM-dd');
break;
}
$('#lists-time').val(date);
});
});
</script>
+114
View File
@@ -0,0 +1,114 @@
<div class="coms-table-wrap mt10">
<form class=" form-search coms-table-hd clearfix no-border" onsubmit="return false"
action="/topics/topics/lists_userc">
<input name="id" type="hidden" value="<?= $params['id'] ?>"/>
<div class="am-form am-form-horizontal">
<div class="am-form-group fl ml10">
<div class="am-form-group fl">
<div class="am-para-inline w300">
<input id="lists-time" type="text" name="time" value="<?= $params['time'] ?>"
placeholder="日期范围"/>
</div>
</div>
<div class="am-form-group fl mb10" style="margin-top: 5px">
<div class="am-para-inline w300">
<a class="mr10 lists-time-btn" href="javascript:void (0);" data-date="today">今天</a>
<a class="mr10 lists-time-btn" href="javascript:void (0);"
data-date="yesterday">昨日</a>
<a class="mr10 lists-time-btn" href="javascript:void (0);" data-date="7day">最近7天</a>
<a class="mr10 lists-time-btn" href="javascript:void (0);" data-date="30day">最近30天</a>
</div>
</div>
<div class="am-form-group fl ml10">
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
</div>
</div>
</div>
</form>
<div class="coms-table-bd" id="vue-app">
<table class="am-table am-table-bordered">
<thead>
<tr>
<th width="5%"><span>ID</span></th>
<th width="20%"><span>管理员姓名</span></th>
<th width="20%"><span>管理员手机号</span></th>
<th width="20%"><span>访问用户数</span></th>
<th width="20%" v-if="params.show_coupon"><span>领券用户数</span></th>
<th width=""><span>操作</span></th>
</tr>
</thead>
<tbody>
<template v-for="(item,index) in list">
<tr>
<td>{{item.id}}</td>
<td>{{item.uname}}</td>
<td>{{item.mobile}}</td>
<td>{{item.count}}</td>
<td v-if="params.show_coupon">{{item.couponc}}</td>
<td>
<a class="am-btn am-btn-primary am-btn-xs" :data-open="'/topics/topics/lists_user?id=<?= $params['id'] ?>&search_tp=suid&title='+item.id" data-title="记录详情">记录详情</a>
</td>
</tr>
</template>
</tbody>
</table>
</div>
<div class="coms-table-ft clearfix">
<div class="coms-pagination fr mr20">
<?php page_view($pager) ?>
</div>
</div>
</div>
<script>
var layer_open;
var vue_obj;
var loading = false;
$(document).ready(function () {
vue_obj = new Vue({
el: '#vue-app',
data: {
params:[],
list: []
},
mounted:function() {
var that = this;
that.params = <?=json_encode($params, JSON_UNESCAPED_UNICODE)?>;
that.list = <?=json_encode($lists, JSON_UNESCAPED_UNICODE)?>;
},
computed: {},
created: function () {
},
updated: function () {
},
methods: {}
});
});
require(['laydate', 'autocomplete'], function (laydate) {
//日期范围
laydate.render({
elem: '#lists-time'
, range: '~'
});
$('.lists-time-btn').click(function () {
var type = $(this).data('date'), date = '', d_obj = new Date();
switch (type) {
case 'today':
date = d_obj.Format('yyyy-MM-dd');
date = date + ' ~ ' + date;
break;
case 'yesterday':
date = (new Date(d_obj.getTime() - 86400000)).Format('yyyy-MM-dd');
date = date + ' ~ ' + date;
break;
case '7day':
date = (new Date(d_obj.getTime() - 86400000 * 7)).Format('yyyy-MM-dd') + ' ~ ' + d_obj.Format('yyyy-MM-dd');
break;
case '30day':
date = (new Date(d_obj.getTime() - 86400000 * 30)).Format('yyyy-MM-dd') + ' ~ ' + d_obj.Format('yyyy-MM-dd');
break;
}
$('#lists-time').val(date);
});
});
</script>
+409
View File
@@ -0,0 +1,409 @@
<script>
Vue.component('v-ad', {
props: ['module', 'is_template'],
data: function () {
return {
ad_list: [],
ad_item: {},
params: {
data: {},
status: 0,
filter_rule: {
goods_type: '',
status: '',
search_rule: ''
},
sort_rule: {
open_default: true,
open_fujin: true,
open_hot: true,
},
}
}
},
mounted: function () {
this.initData();
},
updated: function () {
},
methods: {
initData: function () {
var vm = this;
if (vm.module.id) {
$.ajax({
url: '/topics/topics/get_ad_setting',
type: 'get',
dataType: 'json',
data: {
module_id: vm.module.id
},
success: function (re) {
vm.params = re.data.setting;
vm.ad_list = re.data.ad_list;
$("#module_title_img").val(vm.params.module_title_img);
$("#module_bg_img").val(vm.params.module_bg_img);
}
});
}
},
// 修改排序
showGroupEditForm: function (index) {
$("#group_name_" + index).show();
$("#group_name_txt_" + index).hide();
$('#group_name_' + index).focus();
},
// 排序
editGroupName: function (index, group_id) {
var order_view = $("#group_name_" + index).val();
if (order_view == '') {
layer.msg("排序值不能为空!", {icon: 2});
return false;
}
this.ad_list.sort(function (a, b) {
return b.order_view - a.order_view;
})
$("#group_name_" + index).hide();
$("#group_name_txt_" + index).show();
},
adModal: function (item) {
var that = this;
var _title = '新增广告';
that.ad_item = {};
var _img = '';
var _img_url = '';
if (item) {
that.ad_item = item;
_title = '编辑广告';
_img = item.img;
_img_url = item.img_url;
} else {
that.ad_item = {"order_view": 50, "jump_type": 0};
}
$('#ad_img').val(_img);
$("#ad_img_url").attr('src', _img_url);
layer.open({
type: 1,
area: ['50%', '38%'], //宽高
content: $('#ad-modal'),
title: _title,
shade: false,
btn: ['确定', '取消'],
yes: function (index) {
_img = $('#ad_img').val();
_img_url = $("#ad_img_url")[0].src;
if (!item) {
that.ad_list.push({
title: that.ad_item.title,
img: _img,
img_url: _img_url,
link: that.ad_item.link,
order_view: that.ad_item.order_view,
jump_type: that.ad_item.jump_type
});
} else {
item.img = _img;
item.img_url = _img_url;
}
that.ad_list.sort(function (a, b) {
return b.order_view - a.order_view;
})
layer.close(index);
}
});
},
removeAd: function (index) {
var vm = this;
vm.ad_list.splice(index, 1);
},
save: function () {
var that = this;
that.params.module_title_img = $("#module_title_img").val();
that.params.module_bg_img = $("#module_bg_img").val();
var save_data = {
module_id: that.module.id,
setting: that.params,
ads: that.ad_list
}
$.ajax({
url: '/topics/topics/edit_save_ad',
type: 'post',
dataType: 'json',
data: {save_data: save_data},
beforeSend: function () {
layer.load(1, {
shade: [0.1, '#fff'] //0.1透明度的白色背景
});
},
success: function (re) {
if (re.code) {
layer.msg(re.msg, {icon: 1});
} else {
layer.msg(re.msg, {icon: 2});
}
},
complete: function () {
layer.closeAll('loading');
}
});
}
},
watch: {
'module.id': function (newValue, oldValue) {
this.$nextTick(function () {
if (newValue != oldValue) {
this.ad_list = [];
}
this.initData();
})
},
'params.module_title': function (newValue, oldValue) {
if (!newValue) newValue = '广告模块';
var obj = {};
obj.module_id = this.module.id;
obj.module_name = newValue;
this.$emit('ad-title', obj);
},
},
computed: {},
template: '#v-ad'
})
</script>
<template id="v-ad">
<div>
<div class="form-group">
<label for="" class="col-sm-2 control-label">模块状态</label>
<div class="col-sm-2">
<div class="radio"><label><input type="radio" name="modulestatus"
value="1" v-model="params.status"> 正常</label></div>
</div>
<div class="col-sm-2">
<div class="radio"><label><input type="radio" name="modulestatus" value="0" v-model="params.status">
下架</label></div>
</div>
</div>
<div class="form-group">
<label for="" class="col-sm-2 control-label">标题信息</label>
<div class="col-sm-3">
<div class="input-group">
<div class="input-group-addon">标题</div>
<input type="text" class="form-control" v-model="params.module_title" placeholder="标题文案"/>
</div>
</div>
<div class="col-sm-3">
<div class="input-group">
<div class="am-form-group am-form-file">
<button type="button" class="am-btn am-btn-default am-btn-sm"
data-file="1" data-type="jpg,png,gif,png,jpeg"
data-uptype="qiniu" data-field="module_title_img"><i class="am-icon-cloud-upload"></i>标题头图<span
style="color: blue">(700*125)</span>
</button>
<input type="hidden" name="module_title_img" id="module_title_img"
onchange="$(this).next('img').attr('src', $(this).data('srcs') || this.value)"
value="" class="layui-input">
<img data-tips-image style="height:auto;max-height:32px;min-width:32px"
:src="params.module_title_img_url"/>
</div>
</div>
</div>
</div>
<div class="form-group">
<label for="" class="col-sm-2 control-label"></label>
<div class="col-sm-3">
<div class="input-group">
<div class="input-group-addon">背景色</div>
<input type="text" name="module_title_bgcolor" v-model="params.module_title_bgcolor"
class="form-control" placeholder="标题背景颜色"/>
</div>
</div>
<div class="col-sm-3">
<div class="input-group">
<div class="input-group-addon">文字颜色</div>
<input type="text" name="module_title_color" v-model="params.module_title_color"
class="form-control" placeholder="标题文字颜色"/>
</div>
</div>
</div>
<div class="form-group">
<label for="" class="col-sm-2 control-label">模块信息</label>
<div class="col-sm-3">
<div class="input-group">
<div class="input-group-addon">背景色</div>
<input type="text" name="module_bg_color" v-model="params.module_bg_color" class="form-control"
placeholder="背景颜色"/>
</div>
</div>
<div class="col-sm-3">
<div class="input-group">
<div class="am-form-group am-form-file">
<button type="button" class="am-btn am-btn-default am-btn-sm"
data-file="1" data-type="jpg,png,gif,png,jpeg"
data-uptype="qiniu" data-field="module_bg_img"><i
class="am-icon-cloud-upload"></i>背景图<span
style="color: blue">(590x590)</span>
</button>
<input type="hidden" name="module_bg_img" id="module_bg_img"
onchange="$(this).next('img').attr('src', $(this).data('srcs') || this.value)"
value="" class="layui-input">
<img data-tips-image style="height:auto;max-height:32px;min-width:32px"
:src="params.module_bg_img_url"/>
</div>
</div>
</div>
<div class="col-sm-3">
<div class="input-group">
<div class="input-group-addon">边框色</div>
<input type="text" name="module_border_color" v-model="params.module_border_color"
class="form-control"
placeholder="边框颜色"/>
</div>
</div>
</div>
<div class="form-group">
<label for="" class="col-sm-2 control-label"></label>
<div class="col-sm-6">
<div class="input-group">
<div class="input-group-addon">简介</div>
<input type="text" class="form-control" placeholder="" v-model="params.module_desc"/>
</div>
</div>
</div>
<div class="form-group">
<label for="" class="col-sm-2 control-label">显示数据</label>
<div class="col-sm-2">
<div class="radio">
<label><input type="radio" name="show_type" v-model="params.style" value="0">单图</label>
</div>
</div>
<div class="col-sm-2">
<div class="radio"><label><input type="radio" v-model="params.style" value="1">两图</label>
</div>
</div>
<div class="col-sm-2">
<div class="radio"><label><input type="radio" v-model="params.style" value="2">三图</label>
</div>
</div>
<div class="col-sm-2">
<div class="radio"><label><input type="radio" v-model="params.style" value="3">多图轮播</label>
</div>
</div>
<div class="col-sm-2">
<div class="radio"><label><input type="radio" v-model="params.style" value="4">icon</label>
</div>
</div>
</div>
<div class="form-group">
<label for="" class="col-sm-2 control-label">广告列表</label>
<div class="col-sm-10">
<table class="table table-hover table-middle" style="table-layout:fixed">
<colgroup>
<col width="80px"/>
<col width="30%">
<col width="15%">
<col width="30%"/>
<col width="">
</colgroup>
<thead>
<tr>
<th class="text-center">图片</th>
<th class="text-center">标题</th>
<th class="text-center">排序</th>
<th class="text-center">链接</th>
<th class="text-right">
<a href="javascript:" style="margin-top: 2px;" class="btn btn-primary btn-sm"
@click='adModal()'>添加</a>
</th>
</tr>
</thead>
<tbody>
<template v-for="(item,index) in ad_list">
<tr>
<td><img data-tips-image :src="item.img_url"></td>
<td class="text-center">{{item.title}}</td>
<td class="text-center">
<div :id="'group_name_txt_'+index">{{item.order_view}} <a href="javascript:"
@click="showGroupEditForm(index)"><i
class="fa fa-edit"></i></a></div>
<input :id="'group_name_'+index" @blur="editGroupName(index,item.id)"
style="display: none;" type="number" class="form-control"
v-model="item.order_view" placeholder="请输入排序值">
</td>
<td class="text-center" v-if="item.jump_type==1">报名弹窗</td>
<td class="text-center" v-else>{{item.link}}</td>
<td class="text-right">
<a href="javascript:void(0);" style="margin-top:2px;"
class="btn btn-default btn-sm" @click='adModal(item)'>编辑</a>
<a href="javascript:void(0);" style="margin-top:2px;"
class="btn btn-danger btn-sm" @click='removeAd(index)'>删除</a>
</td>
</tr>
</template>
</tbody>
</table>
<template v-if="ad_list.length <=0">
<div style="text-align: center;">无数据</div>
</template>
</div>
<div id="ad-modal" style="display: none;">
<div class="form-horizontal" style="padding-top: 20px;">
<div class="form-group" style="margin-left: 0px;margin-right: 0px;">
<label class="col-sm-2 control-label">标题</label>
<div class="col-sm-8">
<input type="text" class="form-control" v-model="ad_item.title"
placeholder="请输入标题">
</div>
</div>
<div class="form-group" style="margin-left: 0px;margin-right: 0px;">
<label class="col-sm-2 control-label">图片</label>
<div class="col-sm-8">
<div class="input-group" style="width: 100%">
<input type="text" style="width: 60%" name="ad_img" id="ad_img"
onchange="$(this).next('img').attr('src', $(this).data('srcs') || this.value)"
class="form-control">
<img data-tips-image name="ad_img_url" id="ad_img_url"
style="height:auto;max-height:31px;min-width:31px;margin-left: 5px;margin-right: 5px;"
/>
<button type="button" class="am-btn am-btn-default am-btn-sm"
data-file="1" data-type="jpg,png,gif,png,jpeg"
data-uptype="qiniu" data-field="ad_img">上传图片
</button>
</div>
</div>
</div>
</div>
<div class="form-group" style="margin-left: 0px;margin-right: 0px;">
<label class="col-sm-2 control-label">跳转</label>
<div class="col-sm-2">
<div class="radio"><label><input type="radio" value="0" v-model="ad_item.jump_type"> 链接</label>
</div>
</div>
<div class="col-sm-8">
<div class="radio"><label><input type="radio" value="1" v-model="ad_item.jump_type">
报名弹窗<span class="f12 clr999">(报名模块需设成弹窗展示)</span></label>
</div>
</div>
</div>
<div class="form-group" style="margin-left: 0px;margin-right: 0px;" v-if="ad_item.jump_type==0">
<label class="col-sm-2 control-label">链接</label>
<div class="col-sm-8">
<input type="text" class="form-control" v-model="ad_item.link"
placeholder="请输入链接">
</div>
</div>
<div class="form-group" style="margin-left: 0px;margin-right: 0px;">
<label class="col-sm-2 control-label">排序值</label>
<div class="col-sm-4">
<input type="number" class="form-control" v-model="ad_item.order_view"
placeholder="请输入排序">
</div>
<div style="padding-top:7px;">
<small class="text-muted">越大越靠前</small>
</div>
</div>
</div>
</div>
</div>
<div class="form-group">
<label for="" class="col-sm-2 control-label"></label>
</div>
</div>
</template>
+658
View File
@@ -0,0 +1,658 @@
<script>
Vue.component('v-enroll', {
props: ['module', 'is_template'],
data: function () {
return {
pickGoods: [],
params: {
data: {},
status: 0,
filter_rule: {
goods_type: '',
status: '',
search_rule: ''
},
sort_rule: {
open_default: true,
open_fujin: true,
open_hot: true,
},
}
}
},
mounted: function () {
require(['laydate'], function (laydate) {
//日期范围
laydate.render({
elem: '#enroll_time_id', range: '~', type: 'datetime'
, done: function (value, date, endDate) {
if (endDate.hours == "0" && endDate.minutes == "0" && endDate.seconds == "0") {
// 改变结束时间默认值
$(".layui-laydate-footer [lay-type='datetime'].laydate-btns-time").click();
$(".laydate-main-list-1 .layui-laydate-content li ol li:last-child").click();
$(".layui-laydate-footer [lay-type='date'].laydate-btns-time").click();
}
}
});
laydate.render({
elem: '#enroll_etime_id', range: '~', type: 'datetime'
, done: function (value, date, endDate) {
if (endDate.hours == "0" && endDate.minutes == "0" && endDate.seconds == "0") {
// 改变结束时间默认值
$(".layui-laydate-footer [lay-type='datetime'].laydate-btns-time").click();
$(".laydate-main-list-1 .layui-laydate-content li ol li:last-child").click();
$(".layui-laydate-footer [lay-type='date'].laydate-btns-time").click();
}
}
});
});
this.initData();
},
updated: function () {
},
methods: {
initData: function () {
var vm = this;
if (vm.module.id) {
$.ajax({
url: '/topics/topics/get_enroll_setting',
type: 'get',
dataType: 'json',
data: {
module_id: vm.module.id
},
success: function (re) {
vm.params = re.data.setting;
vm.pickGoods = re.data.goods;
$('#enroll_banner').val(re.data.setting.module_banner);
$("#enroll_banner_url").attr('src', re.data.setting.module_banner_url);
$('#enroll_time_id').val(re.data.setting.module_time);
$('#enroll_etime_id').val(re.data.setting.module_etime);
$("#module_title_img").val(vm.params.module_title_img);
if (content_html) {
content_html.setData(re.data.setting.module_content);
} else {
setTimeout(function () {
content_html.setData(re.data.setting.module_content);
}, 1000);
}
}
});
}
},
save: function () {
var that = this;
that.params.module_content = content_html.getData();
that.params.module_banner = $('#enroll_banner').val();
that.params.module_time = $('#enroll_time_id').val();
that.params.module_etime = $('#enroll_etime_id').val();
that.params.module_title_img = $("#module_title_img").val();
var save_data = {
module_id: that.module.id,
setting: that.params,
enrolls: that.pickGoods.map(function (item) {
return {id: item.id, sort: item.sort_order}
})
}
$.ajax({
url: '/topics/topics/edit_save_enroll',
type: 'post',
dataType: 'json',
data: {save_data: save_data},
beforeSend: function () {
layer.load(1, {
shade: [0.1, '#fff'] //0.1透明度的白色背景
});
},
success: function (re) {
if (re.code) {
layer.msg(re.msg, {icon: 1});
} else {
layer.msg(re.msg, {icon: 2});
}
},
complete: function () {
layer.closeAll('loading');
}
});
}
},
watch: {
'module.id': function (newValue, oldValue) {
this.$nextTick(function () {
if (newValue != oldValue) {
this.pickGoods = [];
}
this.initData();
})
},
'params.sort_rule': function (newValue, oldValue) {
if (!newValue) {
this.params.sort_rule = {}
}
},
'params.module_title': function (newValue, oldValue) {
if (!newValue) newValue = '报名模块';
var obj = {};
obj.module_id = this.module.id;
obj.module_name = newValue;
this.$emit('enroll-title', obj);
}
},
computed: {},
template: '#v-enroll'
})
</script>
<template id="v-enroll">
<div>
<div class="form-group">
<label for="" class="col-sm-2 control-label">报名列表</label>
<div class="col-sm-2">
<div class="input-group">
<button type="button"
:data-open="'/topics/enroll/lists?module_id='+module.id"
class="am-btn am-btn-default am-btn-sm">查看报名列表
</button>
</div>
</div>
</div>
<div class="form-group">
<label for="" class="col-sm-2 control-label">模块状态</label>
<div class="col-sm-2">
<div class="radio"><label><input type="radio" name="modulestatus"
value="1" v-model="params.status"> 正常</label></div>
</div>
<div class="col-sm-2">
<div class="radio"><label><input type="radio" name="modulestatus" value="0" v-model="params.status">
下架</label></div>
</div>
</div>
<div class="form-group">
<label for="" class="col-sm-2 control-label">模块信息</label>
<div class="col-sm-4">
<div class="input-group">
<div class="input-group-addon">标题</div>
<input type="text" class="form-control" v-model="params.module_title" placeholder=""/>
</div>
</div>
<div class="col-sm-6">
<div class="input-group">
<div class="input-group-addon">简介</div>
<input type="text" class="form-control" placeholder="" v-model="params.module_desc"/>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label"></label>
<div class="col-sm-4">
<div class="input-group">
<div class="am-form-group am-form-file">
<button type="button" class="am-btn am-btn-default am-btn-sm"
data-file="1" data-type="jpg,png,gif,png,jpeg"
data-uptype="qiniu" data-field="module_title_img"><i class="am-icon-cloud-upload"></i>标题头图<span
style="color: blue">(700*125)</span>
</button>
<input type="hidden" name="module_title_img" id="module_title_img"
onchange="$(this).next('img').attr('src', $(this).data('srcs') || this.value)"
value="" class="layui-input">
<img data-tips-image style="height:auto;max-height:32px;min-width:32px"
:src="params.module_title_img_url"/>
</div>
</div>
</div>
</div>
<div class="form-group">
<label for="" class="col-sm-2 control-label">人数限制</label>
<div class="col-sm-2">
<div class="input-group">
<input type="text" class="form-control" v-model="params.module_limit_num"/>
</div>
</div>
<span class="f12 clr999 lh-default">0无限制</span>
</div>
<div class="form-group">
<label for="" class="col-sm-2 control-label">黑名单限制</label>
<div class="col-sm-2">
<select class="form-control" v-model="params.user_black">
<option value="0"></option>
<option value="1"></option>
</select>
</div>
</div>
<? if (1 == $info['app_id']) { ?>
<div class="form-group">
<label for="" class="col-sm-2 control-label">报名按钮悬浮底部</label>
<div class="col-sm-2">
<select class="form-control" v-model="params.style">
<option value="0">否</option>
<option value="1">是</option>
</select>
</div>
</div>
<? } ?>
<div class="form-group">
<label for="" class="col-sm-2 control-label">报名类型</label>
<div class="col-sm-2">
<div class="radio"><label><input type="radio" value="0" v-model="params.module_type"> 仅报名</label>
</div>
</div>
<div class="col-sm-8">
<div class="radio"><label><input type="radio" value="1" v-model="params.module_type"> 活动
<span class="f12 clr999">(前期报名发码,后期核码参与活动)</span></label>
</div>
</div>
</div>
<div class="form-group">
<label for="" class="col-sm-2 control-label">显示模块</label>
<div class="col-sm-2">
<div class="radio"><label><input type="radio" value="0" v-model="params.if_module"> 显示</label>
</div>
</div>
<div class="col-sm-8">
<div class="radio"><label><input type="radio" value="1" v-model="params.if_module"> 隐藏</label>
</div>
</div>
</div>
<div class="form-group">
<label for="" class="col-sm-2 control-label">展示方式</label>
<div class="col-sm-2">
<div class="radio"><label><input type="radio" value="0" v-model="params.show_type"> 正常</label>
</div>
</div>
<div class="col-sm-8">
<div class="radio"><label><input type="radio" value="1" v-model="params.show_type"> 弹窗</label>
</div>
</div>
</div>
<? if (6 == $info['app_id'] || 15 == $info['app_id'] || 2 == $info['app_id']) { ?>
<div class="form-group">
<label for="" class="col-sm-2 control-label">手机验证码</label>
<div class="col-sm-2">
<div class="radio"><label><input type="radio" value="0" v-model="params.if_code"> 开启</label>
</div>
</div>
<div class="col-sm-8">
<div class="radio"><label><input type="radio" value="1" v-model="params.if_code"> 关闭</label>
</div>
</div>
</div>
<? } ?>
<div class="form-group">
<label for="" class="col-sm-2 control-label">
<template>报名时间</template>
</label>
<div class="col-sm-6">
<div class="input-group" style="width: 100%">
<input id="enroll_etime_id" type="text" class="form-control" style="width: 70%"
placeholder="开始日期 ~ 结束日期"/>
</div>
</div>
</div>
<div class="form-group" :style="params.module_type==1 ? 'display: block' : 'display: none'">
<label for="" class="col-sm-2 control-label">活动(核销)时间</label>
<div class="col-sm-6">
<div class="input-group" style="width: 100%">
<input id="enroll_time_id" type="text" class="form-control" style="width: 70%"
:value="params.module_time"
placeholder="开始日期 ~ 结束日期"/>
</div>
</div>
</div>
<div class="form-group" v-if="params.module_type==1">
<label for="" class="col-sm-2 control-label">适用门店</label>
<div class="col-sm-10">
<v-enroll-select :goods.sync="pickGoods"></v-enroll-select>
</div>
</div>
<div class="form-group">
<label for="" class="col-sm-2 control-label"></label>
</div>
</div>
</template>
<!--选择报名商家-->
<script>
Vue.component('v-enroll-select', {
props: {
'selectedLimit': {
type: Number,
default: 100
},
'goods': {
type: Array,
default: function () {
return []
}
}
},
template: '#v-enroll-select',
data: function () {
return {
inputSearchKeyword: '',
searchKeyword: '',
selectedPage: 1,
selectedItems: this.goods,
goodsName: '',
goodsFields: [],
goodsItems: [],
goodsPage: [],
goodsThPage: 0,
sale_type_list: {},
sale_type: -1,
sys_cate_id: 0,
sysCateList: [],
edit_shop: [],
}
},
mounted: function () {
var that = this;
that.getSysCate();
},
methods: {
startSearch: function () {
this.selectedPage = 1;
this.$nextTick(function () {
this.searchKeyword = this.inputSearchKeyword;
});
},
editOrder: function (item) {
item.edit_mode = 1;
var cloneItems = $.extend(true, [], this.selectedItems);
this.selectedItems = cloneItems;
},
changeOrder: function (item, e) {
item.sort = e.target.value;
item.edit_mode = 0;
this.selectedItems.map(function (m) {
if (m.id == item.id) {
m.sort = item.sort;
m.reason = item.reason;
m.edit_mode = 0;
}
});
this.$emit('update:goods', this.selectedItems)
},
hideGoodsModal: function () {
},
showGoodsModal: function () {
this.goodsThPage = 0;
this.goodsName = '';
this.changePage(1);
},
searchByGoodsName: function () {
this.changePage(1);
},
loadGoods: function () {
var that = this;
layer.open({
type: 1,
area: ['45%', '80%'], //宽高
content: $('#goods-modal'),
title: '选择门店',
shade: false,
btn: ['选好了'],
yes: function (index) {
layer.close(index);
}
});
$.ajax({
url: '/common/cooperation_shop_app',
type: 'post',
dataType: 'json',
data: {
page: that.goodsThPage,
app_id: <?= $info['app_id'] ?>,
cate_id: that.sys_cate_id,
name: that.goodsName
},
success: function (json) {
var goodsItems = json.data.shopList;
that.goodsPage = json.data.shopPage;
goodsItems.map(function (_item, _index) {
for (var index in that.selectedItems) {
var item = that.selectedItems[index];
if (item.id == _item.id) {
goodsItems[_index].selected = 1;
goodsItems[_index].sort = item.sort;
goodsItems[_index].reason = item.reason;
break;
} else {
goodsItems[_index].selected = 0;
}
}
goodsItems[_index].edit_mode = 0;
})
that.goodsItems = goodsItems;
}
});
},
beforeShopPage: function () {
var vm = this;
if (vm.goodsThPage == 1) {
alert('已经是第一页了');
return;
}
vm.goodsThPage--;
return this.loadGoods();
},
afterShopPage: function () {
var vm = this;
vm.goodsThPage++;
return this.loadGoods();
},
changeSelectedPage: function (page) {
this.selectedPage = page;
},
changePage: function (page) {
var that = this;
that.goodsThPage = page;
return this.loadGoods();
},
addItem: function (item, index) {
item.edit_mode = 0;
item.reason = '';
this.selectedItems.push(item);
this.$set(this.goodsItems[index], 'selected', 1);
this.$emit('update:goods', this.selectedItems)
},
removeItem: function (item, index) {
var that = this;
this.selectedItems = this.selectedItems.filter(function (_item) {
return _item.id != item.id;
})
this.goodsItems.map(function (_item, _index) {
if (item.id == _item.id) {
that.goodsItems[_index].selected = 0;
}
})
this.$emit('update:goods', this.selectedItems)
},
//系统分类
getSysCate: function () {
var vm = this;
$.ajax({
url: '/common/category_app',
type: 'post',
dataType: 'json',
data: {
app_id: <?= $info['app_id'] ?>,
},
success: function (data) {
if (data.data) {
vm.sysCateList = data.data;
}
},
});
},
},
computed: {
selectTotalCount: function () {
if (this.searchKeyword) {
return this.filterItems.length;
} else {
return this.selectedItems.length;
}
},
filterItems: function () {
var that = this;
var orderedItems = this.selectedItems.filter(function (value, index) {
return value.name.indexOf(that.searchKeyword) >= 0
});
return orderedItems;
},
selectedTotalPage: function () {
var that = this;
var total = Math.ceil(that.selectedItems.length / that.selectedLimit);
if (this.searchKeyword) {
total = Math.ceil(that.filterItems.length / that.selectedLimit);
}
return total;
},
showItems: function () {
var that = this;
var orderedItems = this.selectedItems.sort(function (a, b) {
if (a.sort == undefined) {
a.sort = 50;
}
var order = Math.floor(b.sort) - Math.floor(a.sort);
if (order == 0) {
return b.id - a.id;
}
return order;
}).filter(function (value, index) {
return value.name.indexOf(that.searchKeyword) >= 0
});
var offset = Math.floor((this.selectedPage - 1) * this.selectedLimit);
var end = offset + this.selectedLimit;
if (that.selectedItems.length) {
if (end >= (that.selectedItems.length)) {
end = undefined;
}
}
if (end < 0) {
end = undefined;
}
return orderedItems.slice(offset, end);
},
selectedData: function () {
var items = [];
this.selectedItems.map(function (value) {
items.push({
id: value.id,
sort: value.sort,
reason: value.reason
});
})
return items;
}
},
watch: {
'goods': function (newValue, oldValue) {
this.selectedItems = newValue;
}
}
});
</script>
<template id="v-enroll-select">
<div>
<div>
<div class="am-form-inline">
<button type="button" class="btn btn-default btn-stroke btn-sm" @click="showGoodsModal()">选择指定门店
</button>
<span class="f12 clr999 lh-default ml5">买家可到已选门店使用,已选
<strong class="text-danger" v-if="showItems">{{showItems.length}}</strong>个门店</span>
</div>
<div class="label-group-wrap label-group-sortable">
<div class="label-group" v-for="(v,i) in showItems">
<span class="label label-default sort-shop-list">{{v.name}}</span>
<a href="javascript:void(0);" @click="removeItem(v)" class="label label-default"><i
class="fa fa-remove"></i></a>
</div>
</div>
</div>
<div id="goods-modal" style="display: none;">
<div class="modal-body">
<div class="header">
<form class="form-inline" style="margin-left: 20px;">
<div class="form-group">
<div class="input-group">
<select class="form-control" @change='searchByGoodsName();' v-model="sys_cate_id">
<template v-for="(v,i) in sysCateList">
<option :value="v.id">{{v.name}}</option>
</template>
</select>
</div>
<div class="input-group">
<input type="text" class="form-control" v-model="goodsName" placeholder="商家名"/>
<div class="input-group-btn"><a href="javascript:"
class="btn btn-primary btn-stroke"
@click="searchByGoodsName()"><i
class="fa fa-search"></i></a></div>
</div>
</div>
</form>
</div>
<div class="">
<div class="vuetable-body-wrapper">
<table class="vuetable table table-middle table-hover fixed">
<colgroup>
<col class="vuetable-col-title" style="width: 50%;">
<col class="vuetable-col-actions text-right">
</colgroup>
<thead>
<tr>
<th class="vuetable-th-slot-title" style="width: 50%;">门店</th>
<th class="vuetable-th-slot-actions text-right">操作</th>
</tr>
</thead>
<tfoot></tfoot>
<tbody class="vuetable-body">
<tr v-for="(v,i) in goodsItems">
<td class="vuetable-slot" style="width: 36%;">
<div>
{{v.name}}
</div>
</td>
<td class="vuetable-slot text-right">
<button
type='button'
v-if="v.selected==0 || !v.selected"
class="btn btn-sm btn-success"
@click="addItem(v, i)"
>添加
</button>
<button
type='button'
v-if="v.selected==1"
class="btn btn-sm btn-danger"
@click="removeItem(v, i)"
>删除
</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="clearfix">
<span class="pull-left text-muted">第{{goodsPage.page}}页(每页{{goodsPage.pageLimit}}条,共{{goodsPage.pageCount}}条)</span>
<nav class="pull-right" aria-label="Page navigation">
<ul class="pagination pagination-sm">
<li>
<a href="javascript:void(0);" @click="beforeShopPage();" aria-label="上一页">
<span class="glyphicon glyphicon-menu-left"></span>
</a>
</li>
<li v-if="goodsPage.hasNext">
<a href="javascript:void(0);" @click="afterShopPage();" aria-label="下一页">
<span class="glyphicon glyphicon-menu-right"></span>
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
</div>
</template>
+189
View File
@@ -0,0 +1,189 @@
<script>
Vue.component('v-text', {
props: ['module', 'is_template'],
data: function () {
return {
params: {}
}
},
mounted: function () {
this.initData();
},
updated: function () {
},
methods: {
initData: function () {
var vm = this;
if (vm.module.id) {
$.ajax({
url: '/topics/topics/get_text_setting',
type: 'get',
dataType: 'json',
data: {
module_id: vm.module.id
},
success: function (re) {
vm.params = re.data.setting;
if($("#module_title_img").length > 0){
$("#module_title_img").val(vm.params.module_title_img);
}
if($("#module_bg_img").length > 0){
$("#module_bg_img").val(vm.params.module_bg_img);
}
if (content_html) {
content_html.setData(re.data.setting.module_content);
} else {
setTimeout(function () {
content_html.setData(re.data.setting.module_content);
}, 1000);
}
}
});
}
},
save: function () {
var vm = this;
vm.params.module_title_img = $("#module_title_img").val();
vm.params.module_bg_img = $("#module_bg_img").val();
vm.params.module_content = content_html.getData();
var save_data = {
module_id: vm.module.id,
setting: vm.params
};
$.ajax({
url: '/topics/topics/edit_save_text',
type: 'post',
dataType: 'json',
data: {
save_data: save_data
},
beforeSend: function () {
layer.load(1, {
shade: [0.1, '#fff'] //0.1透明度的白色背景
});
},
success: function (re) {
if (re.code) {
layer.msg(re.msg, {icon: 1});
} else {
layer.msg(re.msg, {icon: 2});
}
},
complete: function () {
layer.closeAll('loading');
}
});
}
},
watch: {
'module.id': function (newValue, oldValue) {
console.log(newValue, oldValue);
this.initData();
},
'params.module_title': function (newValue, oldValue) {
if (!newValue) newValue = '文本模块';
var obj = {};
obj.module_id = this.module.id;
obj.module_name = newValue;
this.$emit('text-title', obj);
}
},
computed: {},
template: '#v-text'
})
</script>
<template id="v-text">
<div>
<div class="form-group">
<label for="" class="col-sm-2 control-label">模块状态</label>
<div class="col-sm-2">
<div class="radio"><label><input type="radio" value="1" v-model="params.status"> 正常</label>
</div>
</div>
<div class="col-sm-2">
<div class="radio"><label><input type="radio" value="0" v-model="params.status">
下架</label></div>
</div>
</div>
<div class="form-group">
<label for="" class="col-sm-2 control-label">模块信息</label>
<div class="col-sm-3">
<div class="input-group">
<div class="input-group-addon">标题</div>
<input type="text" class="form-control" v-model="params.module_title" placeholder=""/>
</div>
</div>
<div class="col-sm-3">
<div class="input-group">
<div class="am-form-group am-form-file">
<button type="button" class="am-btn am-btn-default am-btn-sm"
data-file="1" data-type="jpg,png,gif,png,jpeg"
data-uptype="qiniu" data-field="module_title_img"><i class="am-icon-cloud-upload"></i>标题图<span
style="color: blue">(700*125)</span>
</button>
<input type="hidden" name="module_title_img" id="module_title_img"
onchange="$(this).next('img').attr('src', $(this).data('srcs') || this.value)"
value="" class="layui-input">
<img data-tips-image style="height:auto;max-height:32px;min-width:32px" :src="params.module_title_img_url"/>
</div>
</div>
</div>
</div>
<div class="form-group">
<label for="" class="col-sm-2 control-label"></label>
<div class="col-sm-3">
<div class="input-group">
<div class="input-group-addon">背景色</div>
<input type="text" name="module_title_bgcolor" v-model="params.module_title_bgcolor" class="form-control" placeholder="标题背景颜色"/>
</div>
</div>
<div class="col-sm-3">
<div class="input-group">
<div class="input-group-addon">文字颜色</div>
<input type="text" name="module_title_color" v-model="params.module_title_color" class="form-control" placeholder="标题文字颜色"/>
</div>
</div>
</div>
<div class="form-group">
<label for="" class="col-sm-2 control-label"></label>
<div class="col-sm-3">
<div class="input-group">
<div class="input-group-addon">背景色</div>
<input type="text" name="module_bg_color" v-model="params.module_bg_color" class="form-control"
placeholder="背景颜色"/>
</div>
</div>
<div class="col-sm-3">
<div class="input-group">
<div class="am-form-group am-form-file">
<button type="button" class="am-btn am-btn-default am-btn-sm"
data-file="1" data-type="jpg,png,gif,png,jpeg"
data-uptype="qiniu" data-field="module_bg_img"><i class="am-icon-cloud-upload"></i>背景图<span
style="color: blue">(590x590)</span>
</button>
<input type="hidden" name="module_bg_img" id="module_bg_img"
onchange="$(this).next('img').attr('src', $(this).data('srcs') || this.value)"
value="" class="layui-input">
<img data-tips-image style="height:auto;max-height:32px;min-width:32px" :src="params.module_bg_img_url"/>
</div>
</div>
</div>
<div class="col-sm-3">
<div class="input-group">
<div class="input-group-addon">边框色</div>
<input type="text" name="module_border_color" v-model="params.module_border_color" class="form-control"
placeholder="边框颜色"/>
</div>
</div>
</div>
<div class="form-group">
<label for="" class="col-sm-2 control-label"></label>
<div class="col-sm-6">
<div class="input-group">
<div class="input-group-addon">简介</div>
<input type="text" class="form-control" placeholder="" v-model="params.module_desc"/>
</div>
</div>
</div>
</div>
</template>
@@ -0,0 +1,17 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Notes:专题模块-广告表
* Created on: 2020/5/11 13:46
* Created by: dengbw
*/
class Topic_module_ad_model extends HD_Model
{
private $table_name = 'lc_topic_module_ad';
public function __construct()
{
parent::__construct($this->table_name, 'default');
}
}
@@ -0,0 +1,82 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Notes:专题模块-报名表
* Created on: 2020/5/14 13:46
* Created by: dengbw
*/
class Topic_module_enroll_model extends HD_Model
{
private $table_name = 'lc_topic_module_enroll';
public function __construct()
{
parent::__construct($this->table_name, 'default');
}
/**
* 数量
* @param array $where
* @param string $distinct
* @return mixed
*/
function count_status($where = array(), $distinct = ''){
$this->db->from("hd_topic_module_enroll as m");
$this->db->join("hd_topic_modules as j", "j.id=m.module_id and j.type='enroll'", 'left');
if($where)
{
$this->db->where($where);
}
if($distinct)
{
$this->db->distinct();
$this->db->select($distinct, false);
}
return $this->db->count_all_results();
}
/**
* @param array $where
* @param string $order
* @param int $page
* @param int $page_size
* @param string $select
* @return mixed
*/
function select_status($where = array(), $order = '', $page = 0, $page_size = 20, $select = ''){
$this->db->from("hd_topic_module_enroll as m");
$this->db->join("hd_topic_modules as j", "j.id=m.module_id and j.type='enroll'", 'left');
if($select)
{
$this->db->select($select, false);
}
if($where)
{
$this->db->where($where);
}
if($order)
{
$this->db->order_by($order);
}
if($page)
{
$offset = ($page - 1) * $page_size;
$limit = $page_size;
}
else
{
$offset = null;
$limit = null;
}
return $this->db->get(null, $limit, $offset)->result_array();
}
}
@@ -0,0 +1,17 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Notes:专题模块-报名数据表
* Created on: 2020/5/14 13:46
* Created by: dengbw
*/
class Topic_module_enrolldata_model extends HD_Model
{
private $table_name = 'lc_topic_module_enrolldata';
public function __construct()
{
parent::__construct($this->table_name, 'default');
}
}
@@ -0,0 +1,17 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Notes:专题模块-文本表
* Created on: 2020/2/9 13:46
* Created by: dengbw
*/
class Topic_module_text_model extends HD_Model
{
private $table_name = 'lc_topic_module_text';
public function __construct()
{
parent::__construct($this->table_name, 'default');
}
}
@@ -0,0 +1,17 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Notes:专题模块表
* Created on: 2020/2/9 13:46
* Created by: dengbw
*/
class Topic_modules_model extends HD_Model
{
private $table_name = 'lc_topic_modules';
public function __construct()
{
parent::__construct($this->table_name, 'default');
}
}
@@ -0,0 +1,60 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Created by PhpStorm.
* User: xuxb
* Date: 2020/9/16
* Time: 17:47
*/
class Topic_user_log_model extends HD_Model{
private $table_name = 'lc_topic_user_log';
public function __construct()
{
parent::__construct($this->table_name, 'default');
}
/**
* @param string $map_key
* @param string $map_value
* @param array $where
* @param string $select
* @param $groupby
* @return array
*/
public function map_groupby($map_key = 'id', $map_value = '', $where = array(), $select = '', $groupby){
$map = array();
if($select)
{
$this->db->select($select, false);
}
if($where)
{
$this->db->where($where);
}
$this->db->group_by($groupby);
$list = $this->db->get($this->table_name)->result_array();
if($list)
{
foreach($list as $item)
{
if($map_value)
{
$map[$item[$map_key]] = $item[$map_value] ? $item[$map_value] : $item;
}
else
{
$map[$item[$map_key]][] = $item;
}
}
}
return $map;
}
}
+17
View File
@@ -0,0 +1,17 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Notes:专题表
* Created on: 2020/2/9 13:46
* Created by: dengbw
*/
class Topics_model extends HD_Model
{
private $table_name = 'lc_topics';
public function __construct()
{
parent::__construct($this->table_name, 'default');
}
}