Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9bcf645b43 |
@@ -80,7 +80,7 @@ class Common extends CI_Controller
|
||||
if ($url == 'search') {
|
||||
$province = $this->filter($this->area_model->province());
|
||||
} else {
|
||||
$province_limit = $province_limit ? true :false;
|
||||
$province_limit = $province_limit ? true : false;
|
||||
$province = $this->area_model->province($province_limit);
|
||||
}
|
||||
$this->data = $province;
|
||||
@@ -1161,11 +1161,12 @@ class Common extends CI_Controller
|
||||
return $this->show_json(SYS_CODE_SUCCESS);
|
||||
}
|
||||
|
||||
public function auto_search(){
|
||||
public function auto_search()
|
||||
{
|
||||
$name = $this->input->get('name');
|
||||
$lists = [];
|
||||
|
||||
if($name){
|
||||
if ($name) {
|
||||
$where = array(
|
||||
"name like '%{$name}%'" => null,
|
||||
"status" => 1
|
||||
@@ -1183,4 +1184,15 @@ class Common extends CI_Controller
|
||||
$this->data = $lists;
|
||||
return $this->show_json(SYS_CODE_SUCCESS);
|
||||
}
|
||||
|
||||
public function get_paic_users()
|
||||
{
|
||||
$this->load->model('app/paic/app_paic_users_model');
|
||||
$where = [
|
||||
'status' => App_paic_users_model::STATUS_NORMAL
|
||||
];
|
||||
$rows = $this->app_paic_users_model->select($where, 'id desc', 0, 0, 'id,name');
|
||||
$this->data = $rows;
|
||||
return $this->show_json(SYS_CODE_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ class Clues extends HD_Controller
|
||||
$this->load->model('area_model');
|
||||
$this->load->model('auto/auto_brand_model');
|
||||
$this->load->model('auto/auto_series_model');
|
||||
$this->load->model('app/paic/app_paic_users_model');
|
||||
|
||||
$this->log_dir = 'receiver_clues';
|
||||
}
|
||||
@@ -414,7 +415,7 @@ class Clues extends HD_Controller
|
||||
$this->data['action'] = $action;
|
||||
|
||||
$this->data['_title'] = $title;
|
||||
return $this->show_view('receiver/clues/get');
|
||||
return $this->show_view('receiver/clues/get',true);
|
||||
}
|
||||
|
||||
//添加单条数据
|
||||
@@ -458,6 +459,7 @@ class Clues extends HD_Controller
|
||||
$info['biz_id'] && $add['status'] = 1;
|
||||
$info['biz_id'] && $add['status2'] = 1;
|
||||
$info['biz_id'] && $add['p_time'] = date('Y-m-d H:i:s');
|
||||
$info['cf_pid'] && $add['cf_pid'] = $info['cf_pid'];
|
||||
$ret = $this->clues_model->add($add);
|
||||
if ($ret) {
|
||||
$log = '新增线索';
|
||||
@@ -495,6 +497,7 @@ class Clues extends HD_Controller
|
||||
$info['province_id'] && $add['province_id'] = $info['province_id'];
|
||||
$info['city_id'] && $add['city_id'] = $info['city_id'];
|
||||
$info['county_id'] && $add['county_id'] = $info['county_id'];
|
||||
$info['cf_pid'] && $add['cf_pid'] = $info['cf_pid'];
|
||||
|
||||
$customers_id = $this->customers_model->add($add);
|
||||
if ($customers_id) {
|
||||
@@ -675,7 +678,9 @@ class Clues extends HD_Controller
|
||||
$up['brand_id'] = $info['brand_id'];
|
||||
$up['series_id'] = $info['series_id'];
|
||||
}
|
||||
|
||||
if ($info['cf_pid'] != $re['cf_pid']) {
|
||||
$up['cf_pid'] = $info['cf_pid'];
|
||||
}
|
||||
$ret = $this->clues_model->update($up, array('id' => $info['id']));
|
||||
|
||||
if (!$ret) {
|
||||
@@ -738,6 +743,7 @@ class Clues extends HD_Controller
|
||||
'series_id' => $re['series_id'],
|
||||
'p_time' => $re['p_time'],
|
||||
'cont_time' => $re['cont_time'],
|
||||
'cf_pid' => $re['cf_pid'],
|
||||
'c_time' => $re['c_time'],
|
||||
);
|
||||
|
||||
@@ -927,7 +933,8 @@ class Clues extends HD_Controller
|
||||
'of2_id' => 37,
|
||||
'cf_id' => $clues_row['cf_id'],
|
||||
'p_time' => date('Y-m-d H:i:s'),
|
||||
'c_time' => $clues_row['en_time'] == '0000-00-00 00:00:00' ? $clues_row['c_time'] : strtotime($clues_row['en_time'])
|
||||
'c_time' => $clues_row['en_time'] == '0000-00-00 00:00:00' ? $clues_row['c_time'] : strtotime($clues_row['en_time']),
|
||||
'cf_pid' => $clues_row['cf_pid'],
|
||||
];
|
||||
$customers_id = $this->customers_model->add($add_data);
|
||||
if ($customers_id) {
|
||||
|
||||
@@ -30,6 +30,7 @@ class Customer extends HD_Controller
|
||||
$this->load->model('area_model');
|
||||
$this->load->model('auto/auto_brand_model');
|
||||
$this->load->model('auto/auto_series_model');
|
||||
$this->load->model('app/paic/app_paic_users_model');
|
||||
|
||||
$this->log_dir = 'receiver_' . get_class($this);
|
||||
}
|
||||
@@ -631,6 +632,10 @@ class Customer extends HD_Controller
|
||||
$series = $this->auto_series_model->get(['id' => $row['series_id']]);
|
||||
$series && $brand_detail .= '-' . $series['name'];
|
||||
}
|
||||
$paic_user = '';
|
||||
if ($row['cf_pid']) {
|
||||
$paic_user = $this->app_paic_users_model->get(['id' => $row['cf_pid']]);
|
||||
}
|
||||
$info = array(
|
||||
'id' => $row['id'],
|
||||
'name' => $row['name'],
|
||||
@@ -648,7 +653,8 @@ class Customer extends HD_Controller
|
||||
'biz' => $row_biz['biz_name'],
|
||||
'time_name' => $row['clue_id'] ? '派单时间' : '建档时间',
|
||||
'brand_detail' => $brand_detail,
|
||||
'role' => $this->role
|
||||
'role' => $this->role,
|
||||
'cf_name' => $paic_user ? $paic_user['name'] : ''
|
||||
);
|
||||
|
||||
//到店信息
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
<script type="text/javascript" src="/static/js/common/vuedraggable.umd.min.js?t=2020221"></script>
|
||||
<script type="text/javascript" src="/static/js/common/jquery.form.js?t=2020410"></script>
|
||||
<script type="text/javascript" src="/static/js/plugin/viewer/viewer.js?t=4"></script>
|
||||
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
|
||||
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
|
||||
<script>window.ROOT_URL = '';</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
<style>
|
||||
.el-input__inner {
|
||||
background-color: white!important;
|
||||
}
|
||||
.el-input__inner {
|
||||
height: 36.8px; /* 设置输入框高度 */
|
||||
</style>
|
||||
</style>
|
||||
<div class="am-form am-form-horizontal" style="width: 98%;padding-top: 10px">
|
||||
<div id="vue-edit">
|
||||
<div class="am-g">
|
||||
@@ -86,9 +94,19 @@
|
||||
<td class="table-td">
|
||||
<div class="input-group-addon">关注车型:</div>
|
||||
<div class="input-group-addon">
|
||||
<el-select v-model="info.brand_id" filterable placeholder="请选择" clearable>
|
||||
<el-option
|
||||
v-for="item in brandAry"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<!--
|
||||
<select name="info.brand_id" v-model="info.brand_id">
|
||||
<option :value="v.id" v-for="(v,i) in brandAry">{{v.name}}</option>
|
||||
</select>
|
||||
-->
|
||||
</div>
|
||||
<div class="input-group-addon" style="width:160px;">
|
||||
<select name="info.series_id" v-model="info.series_id" class="ml5">
|
||||
@@ -149,6 +167,25 @@
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="table-td">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">平安推荐:</div>
|
||||
<el-select v-model="info.cf_pid" filterable placeholder="请选择" clearable>
|
||||
<el-option
|
||||
v-for="item in paicUser"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</td>
|
||||
<td class="table-td">
|
||||
<div class="input-group">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="table-td">
|
||||
<div class="input-group" style="margin-left: 30px;">
|
||||
@@ -293,6 +330,7 @@
|
||||
brandAry: [],
|
||||
seryAry: [],
|
||||
admins: {provinceAry: <?=json_encode($provinces, JSON_UNESCAPED_UNICODE)?>, cityAry: [], countyAry: [], bizAry: []},
|
||||
paicUser: [],
|
||||
},
|
||||
mounted: function () {
|
||||
var that = this;
|
||||
@@ -303,6 +341,7 @@
|
||||
that.init_provinces();
|
||||
that.init_brands();
|
||||
that.get_series();
|
||||
this.loadPaicUser();
|
||||
},
|
||||
computed: {},
|
||||
created: function () {
|
||||
@@ -310,6 +349,12 @@
|
||||
updated: function () {
|
||||
},
|
||||
methods: {
|
||||
loadPaicUser() {
|
||||
let that = this
|
||||
$.get('/common/get_paic_users', {}, function (response) {
|
||||
that.paicUser = response.data
|
||||
})
|
||||
},
|
||||
init_brands: function () {
|
||||
var vm = this;
|
||||
$.get('/common/auto', {'type': 1, 'tp': 0}, function (response) {
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
<style>
|
||||
.el-input__inner {
|
||||
background-color: white!important;
|
||||
}
|
||||
</style>
|
||||
<form class="am-form am-form-horizontal ptb20 pr20 mt10" data-auto="true" method="post"
|
||||
style="padding-top: 10px;padding-bottom: 10px;"
|
||||
action="" id="edit-form">
|
||||
@@ -7,8 +12,10 @@
|
||||
<input type="text" placeholder="输入姓名" v-model="info.name" name="name"/>
|
||||
</div>
|
||||
<div class="am-para-inline w100">
|
||||
<input type="radio" v-model="info.sex" name="sex" value="先生"> <label style="text-align: center;font-size: 1.6rem;line-height: 37px;">先生</label>
|
||||
<input type="radio" v-model="info.sex" name="sex" value="女士"><label style="text-align: center;font-size: 1.6rem;line-height: 37px;">女士</label>
|
||||
<input type="radio" v-model="info.sex" name="sex" value="先生"> <label
|
||||
style="text-align: center;font-size: 1.6rem;line-height: 37px;">先生</label>
|
||||
<input type="radio" v-model="info.sex" name="sex" value="女士"><label
|
||||
style="text-align: center;font-size: 1.6rem;line-height: 37px;">女士</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
@@ -81,12 +88,22 @@
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">关注车型:</label>
|
||||
<div class="am-para-inline w160">
|
||||
<el-select v-model="info.brand_id" filterable placeholder="请选择" clearable>
|
||||
<el-option
|
||||
v-for="item in brandAry"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<!--
|
||||
<input type="text" v-model="inputValue" @input="handleInput" placeholder="输入品牌">
|
||||
<ul class="am-dropdown-content" :style="'display:'+[showSelect?'block':'none']">
|
||||
<li v-for="item in inputSelect">
|
||||
<a href="javascript:;" @click="selectInput(item)">{{item.name}}</a>
|
||||
</li>
|
||||
</ul>
|
||||
-->
|
||||
</div>
|
||||
<div class="am-para-inline w160">
|
||||
<select name="series_id" v-model="info.series_id">
|
||||
@@ -94,6 +111,19 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">平安推荐:</label>
|
||||
<div class="am-para-inline">
|
||||
<el-select v-model="info.cf_pid" filterable placeholder="请选择" clearable>
|
||||
<el-option
|
||||
v-for="item in paicUser"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">填写小记:</label>
|
||||
<div class="am-para-inline">
|
||||
@@ -115,13 +145,13 @@
|
||||
el: '#edit-form',
|
||||
data: {
|
||||
info: {},
|
||||
province_id:350000,
|
||||
city_id:0,
|
||||
county_id:0,
|
||||
province_id_admin:350000,
|
||||
city_id_admin:0,
|
||||
county_id_admin:0,
|
||||
biz_id_admin:0,
|
||||
province_id: 350000,
|
||||
city_id: 0,
|
||||
county_id: 0,
|
||||
province_id_admin: 350000,
|
||||
city_id_admin: 0,
|
||||
county_id_admin: 0,
|
||||
biz_id_admin: 0,
|
||||
cfromAry: [],
|
||||
cfromAry2: [],
|
||||
provinceAry: [],
|
||||
@@ -129,13 +159,20 @@
|
||||
countyAry: [],
|
||||
brandAry: [],
|
||||
seryAry: [],
|
||||
admins: {provinceAry: <?=json_encode($provinces, JSON_UNESCAPED_UNICODE)?>, cityAry: [], countyAry: [], bizAry: []},
|
||||
admins: {
|
||||
provinceAry: <?=json_encode($provinces, JSON_UNESCAPED_UNICODE)?>,
|
||||
cityAry: [],
|
||||
countyAry: [],
|
||||
bizAry: []
|
||||
},
|
||||
action: "",
|
||||
inputValue: "",
|
||||
showSelect: false,
|
||||
inputSelect: []
|
||||
inputSelect: [],
|
||||
paicUser: []
|
||||
},
|
||||
mounted: function () {
|
||||
this.get_brand();
|
||||
this.init_provinces();
|
||||
this.init_citys();
|
||||
this.init_countys();
|
||||
@@ -143,29 +180,43 @@
|
||||
this.info = <?=json_encode($info, JSON_UNESCAPED_UNICODE)?>;
|
||||
this.cfromAry = <?=json_encode($cfromAry, JSON_UNESCAPED_UNICODE)?>;
|
||||
this.action = "<?=$action?>";
|
||||
this.loadPaicUser();
|
||||
// this.init_brands();
|
||||
// this.get_series();
|
||||
},
|
||||
methods: {
|
||||
selectInput: function (item){
|
||||
console.log(item)
|
||||
this.inputValue = item.name
|
||||
this.info.brand_id = item.id
|
||||
this.showSelect = false
|
||||
loadPaicUser() {
|
||||
let that = this
|
||||
$.get('/common/get_paic_users', {}, function (response) {
|
||||
that.paicUser = response.data
|
||||
})
|
||||
},
|
||||
handleInput: function (event) {
|
||||
console.log('输入值:', this.inputValue);
|
||||
// 请求接口
|
||||
var that = this;
|
||||
$.get('/common/auto_search', {'name': this.inputValue}, function (response) {
|
||||
that.inputSelect = response.data;
|
||||
setTimeout(function (){
|
||||
if(that.inputSelect && that.inputSelect.length>0){
|
||||
that.showSelect = true
|
||||
}else{
|
||||
that.showSelect = false
|
||||
}
|
||||
},100)
|
||||
// selectInput: function (item) {
|
||||
// console.log(item)
|
||||
// this.inputValue = item.name
|
||||
// this.info.brand_id = item.id
|
||||
// this.showSelect = false
|
||||
// },
|
||||
// handleInput: function (event) {
|
||||
// console.log('输入值:', this.inputValue);
|
||||
// // 请求接口
|
||||
// var that = this;
|
||||
// $.get('/common/auto_search', {'name': this.inputValue}, function (response) {
|
||||
// that.inputSelect = response.data;
|
||||
// setTimeout(function () {
|
||||
// if (that.inputSelect && that.inputSelect.length > 0) {
|
||||
// that.showSelect = true
|
||||
// } else {
|
||||
// that.showSelect = false
|
||||
// }
|
||||
// }, 100)
|
||||
// })
|
||||
// },
|
||||
get_brand: function () {
|
||||
var vm = this;
|
||||
vm.brandAry = {};
|
||||
$.get('/common/auto', {'type': 1, 'tp': 0}, function (response) {
|
||||
vm.brandAry = response.data;
|
||||
})
|
||||
},
|
||||
get_series: function () {
|
||||
@@ -254,7 +305,7 @@
|
||||
icon: 1,
|
||||
time: 2000
|
||||
}, function () {
|
||||
window.location.reload();
|
||||
$.form.href('/receiver/clues');
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
|
||||
@@ -1,4 +1,13 @@
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/font-awesome.min.css?v=1581252500">
|
||||
<style>
|
||||
.el-input__inner {
|
||||
background-color: white !important;
|
||||
}
|
||||
|
||||
.el-input__inner {
|
||||
height: 32.4px !important; /* 设置输入框高度 */
|
||||
}
|
||||
</style>
|
||||
<div class="bs-example bs-example-tabs" data-example-id="togglable-tabs" style="font-size:15px;">
|
||||
<div id="recom-stat"></div>
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
@@ -132,9 +141,20 @@
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">重点关注车型:</label>
|
||||
<div class="am-para-inline w120">
|
||||
<input type="hidden" name="brand_id" v-model="brand_id">
|
||||
<el-select v-model="brand_id" filterable placeholder="请选择" clearable size="small">
|
||||
<el-option
|
||||
v-for="item in brandAry"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<!--
|
||||
<select name="brand_id" v-model="brand_id">
|
||||
<option :value="v.id" v-for="(v,i) in brandAry">{{v.name}}</option>
|
||||
</select>
|
||||
-->
|
||||
</div>
|
||||
<div class="am-para-inline w120">
|
||||
<select name="series_id" v-model="series_id">
|
||||
@@ -225,7 +245,7 @@
|
||||
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="button" class="am-btn am-btn-success am-btn-sm w100"
|
||||
data-modal="/receiver/clues/get_add" data-title="新增线索">新增
|
||||
data-open="/receiver/clues/get_add" data-title="新增线索">新增
|
||||
</button>
|
||||
<button type="button" class="am-btn am-btn-success am-btn-sm w100" @click="export_out()"
|
||||
title="最多500条" v-if="export_button">导出
|
||||
@@ -317,7 +337,7 @@
|
||||
biz_id_admin: <?=$params['biz_id_admin'] ? $params['biz_id_admin'] : 0?>,
|
||||
cfrom_id: <?=$params['cfrom_id'] ? $params['cfrom_id'] : 0?>,
|
||||
cfrom_id2: <?=$params['cfrom_id2'] ? $params['cfrom_id2'] : 0?>,
|
||||
brand_id: <?=$params['brand_id'] ? $params['brand_id'] : 0?>,
|
||||
brand_id: '<?=$params['brand_id'] ? $params['brand_id'] : ''?>',
|
||||
series_id: <?=$params['series_id'] ? $params['series_id'] : 0?>,
|
||||
cfroms: [],
|
||||
cfroms2: [],
|
||||
|
||||
@@ -44,8 +44,10 @@
|
||||
<tr>
|
||||
<td class="table-td"><span class="mr5">客户姓名:</span>{{info.name}}</td>
|
||||
<td class="table-td"><span class="mr5">客户电话:</span>{{info.mobile}}
|
||||
<a href="javascript:void(0);" data-modal="/common/bind_mobile?id=<?= $info['id'] ?>&type=customer"
|
||||
class="am-btn am-btn-sm am-btn-success ml5" data-title="获取手机号" v-if="info.role!=8">
|
||||
<a href="javascript:void(0);"
|
||||
data-modal="/common/bind_mobile?id=<?= $info['id'] ?>&type=customer"
|
||||
class="am-btn am-btn-sm am-btn-success ml5" data-title="获取手机号"
|
||||
v-if="info.role!=8">
|
||||
拨打
|
||||
</a>
|
||||
</td>
|
||||
@@ -64,13 +66,7 @@
|
||||
<td class="table-td"><span class="mr5">重点关注车型:</span>{{info.brand_detail}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="am-form-inline" style="padding-right: 30px;padding-top: 10px;">
|
||||
<div class="text-left pt10" v-if="edit_index==2">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="table-td"><span class="mr5">平安推荐:</span>{{info.cf_name}}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
defined('WXAPP_APP') or exit('No direct script access allowed');
|
||||
|
||||
require_once APPPATH . 'controllers/wxapp/Wxapp.php';
|
||||
|
||||
class Paic extends Wxapp
|
||||
{
|
||||
|
||||
function __construct($inputs, $app_key)
|
||||
{
|
||||
parent::__construct($inputs, $app_key);
|
||||
|
||||
$this->login_white = array();//登录白名单
|
||||
$this->check_status = array();//用户状态校验
|
||||
$this->check_mobile = array();//需要手机号
|
||||
$this->check_headimg = array();//授权微信信息
|
||||
$this->load->model('app/paic/app_paic_users_model');
|
||||
|
||||
}
|
||||
|
||||
//获取车系
|
||||
protected function get()
|
||||
{
|
||||
$page = $this->input_param('page');
|
||||
$size = $this->input_param('size');
|
||||
$keyword = $this->input_param('keyword');
|
||||
!$page && $page = 1;
|
||||
!$size && $size = 100;
|
||||
|
||||
$where = [
|
||||
'status' => App_paic_users_model::STATUS_NORMAL
|
||||
];
|
||||
if ($keyword) {
|
||||
$where["name like '%{$keyword}%'"] = null;
|
||||
}
|
||||
$count = $this->app_paic_users_model->count($where);
|
||||
$list = $this->app_paic_users_model->select($where, 'id desc', $page, $size, 'id,name');
|
||||
$data = [
|
||||
'list' => $list,
|
||||
'total' => $count
|
||||
];
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,7 @@ class Customers extends Wxapp
|
||||
$this->load->model('auto/auto_brand_model');
|
||||
$this->load->model("biz/biz_model");
|
||||
$this->load->library('receiver/customers_entity');
|
||||
$this->load->model('app/paic/app_paic_users_model');
|
||||
$this->biz_id = $this->get_biz_id();
|
||||
}
|
||||
|
||||
@@ -123,6 +124,8 @@ class Customers extends Wxapp
|
||||
}
|
||||
$brand = $this->auto_brand_model->get(['id' => $row['brand_id']]);
|
||||
$of_title = $row['of_id'] ? $this->get_cfTitle($row) : '';
|
||||
$paic_user = '';
|
||||
$row['cf_pid'] && $paic_user = $this->app_paic_users_model->get(['id' => $row['cf_pid']]);
|
||||
$data['baseinfo'] = [
|
||||
'name' => ['value' => $row['name'], 'cn' => '客户姓名'],
|
||||
'mobile' => ['value' => $this->get_mobile(['mobile' => $row['mobile'], 'rid' => $row['rid']]), 'cn' => '客户电话'],
|
||||
@@ -134,6 +137,8 @@ class Customers extends Wxapp
|
||||
'wxgrimg_url' => $row['wxgrimg'] ? build_qiniu_image_url($row['wxgrimg']) : '',
|
||||
'brand' => ['id' => $row['brand_id'], 'name' => $brand['name']],
|
||||
'series_id' => $row['series_id'],
|
||||
'cf_pid' => $row['cf_pid'],
|
||||
'cf_name' => $paic_user['name'] ?: '',
|
||||
];
|
||||
return $data;
|
||||
}
|
||||
@@ -226,6 +231,7 @@ class Customers extends Wxapp
|
||||
$wxgrimg = $this->input_param('wxgrimg'); //个微截图
|
||||
$brand_id = (int)$this->input_param('brand_id');
|
||||
$series_id = (int)$this->input_param('series_id');
|
||||
$cf_pid = (int)$this->input_param('cf_pid');
|
||||
$row = $this->customers_model->get(['id' => $id]);
|
||||
if (!$row) {
|
||||
throw new Exception('参数错误', ERR_PARAMS_ERROR);
|
||||
@@ -260,6 +266,7 @@ class Customers extends Wxapp
|
||||
$update['level'] = $this->customers_entity->cal_level($buy_time);
|
||||
$update['buy_time'] = $buy_time;
|
||||
}
|
||||
$update['cf_pid'] = $cf_pid ?: 0;
|
||||
$update && $this->customers_model->update($update, ['id' => $id]);
|
||||
//客户标签
|
||||
if ($tag) {
|
||||
@@ -326,6 +333,7 @@ class Customers extends Wxapp
|
||||
$brand_id = $this->input_param('brand_id');
|
||||
$series_id = $this->input_param('series_id');
|
||||
$car_id = $this->input_param('car_id');
|
||||
$cf_pid = $this->input_param('cf_pid');
|
||||
if (!mobile_valid($mobile)) throw new Exception('请输入正确的手机号码', ERR_PARAMS_ERROR);
|
||||
if (!$city_id || !$county_id) {
|
||||
throw new Exception('请选择城市与行政区', API_CODE_FAIL);
|
||||
@@ -393,6 +401,7 @@ class Customers extends Wxapp
|
||||
$of2_id && $add_data['of2_id'] = $of2_id;
|
||||
$brand_id && $add_data['brand_id'] = $brand_id;
|
||||
$series_id && $add_data['series_id'] = $series_id;
|
||||
$cf_pid && $add_data['cf_pid'] = $cf_pid;
|
||||
$id = $this->customers_model->add($add_data);
|
||||
if ($id) {
|
||||
//客户标签
|
||||
@@ -768,7 +777,7 @@ class Customers extends Wxapp
|
||||
];
|
||||
}
|
||||
|
||||
if($this->biz_id == 10){
|
||||
if ($this->biz_id == 10) {
|
||||
$lists[] = ['id' => 20, 'name' => '中台直播'];
|
||||
}
|
||||
|
||||
|
||||
@@ -956,7 +956,7 @@ if (!function_exists('http_host_com')) {
|
||||
if ($type == 'api') {
|
||||
$url = 'https://api.ss.haodian.cn/';
|
||||
} else if ($type == 'home') {
|
||||
$url = "";
|
||||
$url = "http://www.ss.haodian.cn/";
|
||||
} else if ($type == 'admin') {
|
||||
$url = "http://admin.ss.haodian.cn/";
|
||||
}
|
||||
@@ -964,7 +964,7 @@ if (!function_exists('http_host_com')) {
|
||||
if ($type == 'api') {
|
||||
$url = "https://sapi.liche.cn/";
|
||||
} else if ($type == 'home') {
|
||||
$url = "";
|
||||
$url = "https://space.liche.cn/";
|
||||
} else if ($type == 'admin') {
|
||||
$url = "https://sadmin.liche.cn/";
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Date: 2020/4/14
|
||||
* Time: 21:54
|
||||
*/
|
||||
class Hd_exception extends Exception{
|
||||
class Hd_exception extends CI_Exceptions{
|
||||
public function __construct($message = "", $code = 0, Exception $previous = null){
|
||||
parent::__construct($message, $code, $previous);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class App_paic_users_model extends HD_Model
|
||||
{
|
||||
private $table_name = 'lc_app_paic_users';
|
||||
|
||||
const BELONG_TO_LIST = ['电销', '创展', '寿险'];
|
||||
const STATUS_NORMAL = 0; //状态正常
|
||||
const STATUS_DISABLE = 0; //状态禁用
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct($this->table_name, 'default');
|
||||
}
|
||||
}
|
||||
@@ -8,5 +8,5 @@
|
||||
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
//服务号
|
||||
$config['liche']['appid'] = '';
|
||||
$config['liche']['appSecret'] = '';
|
||||
$config['default']['appid'] = 'wxd090c4eea5cc3493';
|
||||
$config['default']['appSecret'] = '69a2f3583eaab9ed96146cd7b2e7ef90';
|
||||
@@ -10,8 +10,4 @@ class Welcome extends CI_Controller
|
||||
{
|
||||
$this->load->view('welcome_message');
|
||||
}
|
||||
|
||||
public function test()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class Common extends HD_Controller
|
||||
{
|
||||
private $smsSign = '理车宝';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('area_model');
|
||||
$this->load->model('app/paic/app_paic_users_model');
|
||||
}
|
||||
|
||||
public function getAreaList()
|
||||
{
|
||||
$redis = load_cache();
|
||||
$cache_key = "area_list_h5";
|
||||
$data = $redis->get($cache_key);
|
||||
if (!$data) {
|
||||
$county_list = $city_list = $province_list = [];
|
||||
$where = [];
|
||||
$province_rows = $this->area_model->select($where, null, null, null, 'distinct(province_id), province_name');
|
||||
foreach ($province_rows as $province_row) {
|
||||
$province_list[$province_row['province_id']] = $province_row['province_name'];
|
||||
}
|
||||
$city_rows = $this->area_model->select($where, null, null, null, 'distinct(city_id), city_name');
|
||||
foreach ($city_rows as $city_row) {
|
||||
$city_list[$city_row['city_id']] = $city_row['city_name'];
|
||||
}
|
||||
$county_rows = $this->area_model->select($where, null, null, null, 'distinct(city_id), city_name');
|
||||
foreach ($county_rows as $county_row) {
|
||||
$county_list[$county_row['city_id']] = $county_row['city_name'];
|
||||
}
|
||||
$data = [
|
||||
'province_list' => $province_list,
|
||||
'city_list' => $city_list,
|
||||
'county_list' => $county_list
|
||||
];
|
||||
$redis->save($cache_key, $data, 24 * 60 * 60);
|
||||
}
|
||||
$this->success($data, '');
|
||||
}
|
||||
|
||||
public function Sms()
|
||||
{
|
||||
try {
|
||||
$mc = &load_cache();
|
||||
$mobile = $this->input->post('mobile');
|
||||
$type = $this->input->post('type');
|
||||
if (!mobile_valid($mobile)) {
|
||||
throw new Exception('请输入正确的手机号码');
|
||||
}
|
||||
$user = $this->app_paic_users_model->get(['mobile' => $mobile, 'status' => App_paic_users_model::STATUS_NORMAL]);
|
||||
if ($type == 'login') {
|
||||
if (!$user) {
|
||||
throw new Exception('手机号未注册');
|
||||
}
|
||||
$key = "paic_login_code_" . $mobile;
|
||||
} else {
|
||||
if ($user) {
|
||||
throw new Exception('手机号已注册');
|
||||
}
|
||||
$key = "paic_reg_code_" . $mobile;
|
||||
}
|
||||
if (!$code = $mc->get($key)) {
|
||||
$this->load->helper('string');
|
||||
$code = random_string('numeric', 4);
|
||||
$mc->save($key, $code, 600);
|
||||
}
|
||||
$content = "【{$this->smsSign}】" . "您的验证码为:{$code},请勿泄露于他人!";
|
||||
b2m_send_sms($mobile, $content);
|
||||
$this->success('', '发送成功');
|
||||
} catch (Exception $e) {
|
||||
$this->fail('', $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
<?php
|
||||
defined('APPPATH') or exit('No direct script access allowed');
|
||||
|
||||
abstract class Base extends HD_Controller
|
||||
{
|
||||
protected $log_dir = 'paic';
|
||||
const OPEN_ID_SESSION_KEY = "OPEN_ID_SESSION_KEY";
|
||||
const LOGIN_USER_INFO = "LOGIN_USER_INFO";
|
||||
protected $open_id = '';
|
||||
public $uid = '';
|
||||
protected $white_login_method = []; //授权白名单
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->library('session');
|
||||
$this->load->model('app/paic/app_paic_users_model', 'user_model');
|
||||
$this->load->library('hd_exception');
|
||||
if (checkua() == 'wx') {
|
||||
if (!$this->session->has_userdata(self::OPEN_ID_SESSION_KEY) && !$this->session->userdata(self::LOGIN_USER_INFO)) {
|
||||
$req = $this->set_auth();
|
||||
$this->open_id = $req['openid'];
|
||||
$this->session->set_userdata(self::OPEN_ID_SESSION_KEY, $this->open_id);
|
||||
if ($this->open_id) {
|
||||
$user = $this->user_model->get(['open_id' => $this->open_id, 'status' => App_paic_users_model::STATUS_NORMAL]);
|
||||
if ($user) {
|
||||
$this->session->set_userdata(self::LOGIN_USER_INFO, $user);
|
||||
$this->uid = $user['id'];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->open_id = $this->session->userdata(self::OPEN_ID_SESSION_KEY);
|
||||
$user = $this->session->userdata(self::LOGIN_USER_INFO);
|
||||
$this->uid = $user['id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function _remap($method)
|
||||
{
|
||||
try {
|
||||
$user = $this->session->userdata(self::LOGIN_USER_INFO);
|
||||
$this->uid = $user['id'];
|
||||
if (!in_array($method, $this->white_login_method) && !$user && !$this->uid) {
|
||||
if (checkua() == 'wx') {
|
||||
if (!$this->session->userdata(self::OPEN_ID_SESSION_KEY)) {
|
||||
$req = $this->set_auth();
|
||||
$this->open_id = $req['openid'];
|
||||
$this->session->set_userdata(self::OPEN_ID_SESSION_KEY, $this->open_id);
|
||||
}
|
||||
if ($this->open_id) {
|
||||
$user = $this->user_model->get(['open_id' => $this->open_id, 'status' => App_paic_users_model::STATUS_NORMAL]);
|
||||
if ($user) {
|
||||
$this->session->set_userdata(self::LOGIN_USER_INFO, $user);
|
||||
$this->uid = $user['id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
header('Location:/h5/paic/login');
|
||||
exit;
|
||||
}
|
||||
return $this->$method();
|
||||
} catch (Exception $e) {//处理异常
|
||||
$msg = $e->getMessage();
|
||||
$data = array('heading' => 'Warning', 'message' => $msg);
|
||||
return $this->load->view('errors/html/error_404', $data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $url 回调url地址
|
||||
* @param $auth 是否信息授权
|
||||
* @return void
|
||||
* @throws Hd_exception
|
||||
*/
|
||||
protected function set_auth($url = '', $auth = 0)
|
||||
{
|
||||
$this->load->config('wechat');
|
||||
$config = $this->config->item('default');
|
||||
$code = $this->input->get('code');
|
||||
!$url && $url = http_host_com('home') . $_SERVER['REQUEST_URI'];
|
||||
$auth && $url = $_SERVER['QUERY_STRING'] ? $url . "&auth={$auth}" : $url . "?auth={$auth}";
|
||||
if ($code) {//授权码获取微信信息
|
||||
$auth_url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid={$config['appid']}&secret={$config['appSecret']}&code={$code}&grant_type=authorization_code";
|
||||
$res = file_get_contents($auth_url);
|
||||
$ret = json_decode($res, true);
|
||||
if ($ret['errcode'] == 40163) { //code已被使用
|
||||
$param_arr = explode("&", $_SERVER['QUERY_STRING']);
|
||||
$query = [];
|
||||
$query_string = '';
|
||||
if ($param_arr) {
|
||||
foreach ($param_arr as $item) {
|
||||
if (strpos($item, 'code') === false && strpos($item, 'state=STATE')) {
|
||||
$query[] = $item;
|
||||
}
|
||||
}
|
||||
$query && $query_string = '?' . implode('&', $query);
|
||||
}
|
||||
$url = http_host_com('home') . $_SERVER['PATH_INFO'] . $query_string;
|
||||
redirect($url);
|
||||
}
|
||||
$access_token = $ret['access_token'];
|
||||
$openid = $ret['openid'];
|
||||
$unionid = $ret['unionid'];
|
||||
if ($this->input->get('auth') && $access_token) {
|
||||
$u_info_url = "https://api.weixin.qq.com/sns/userinfo?access_token={$access_token}&openid={$openid}&lang=zh_CN";
|
||||
$u_ret = file_get_contents($u_info_url);
|
||||
$ret = json_decode($u_ret, true);
|
||||
}
|
||||
if (!$openid) {
|
||||
debug_log("[error]# " . $res, __FUNCTION__, $this->log_dir);
|
||||
//异常处理
|
||||
}
|
||||
return $ret;
|
||||
} elseif ($auth) {//信息授权获取用户微信昵称/头像
|
||||
$redirect_uri = urlencode($url);
|
||||
$auth_url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={$config['appid']}&redirect_uri={$redirect_uri}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect&forcePopup=true";
|
||||
redirect($auth_url);
|
||||
} else {//静默授权获取用户openid
|
||||
$redirect_uri = urlencode($url);
|
||||
$auth_url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={$config['appid']}&redirect_uri={$redirect_uri}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect";
|
||||
redirect($auth_url);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $view
|
||||
*/
|
||||
protected function show_view($view)
|
||||
{
|
||||
$this->load->view('h5/paic/header', $this->data);
|
||||
$this->load->view($view);
|
||||
$this->load->view('h5/paic/footer');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,215 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require_once 'Base.php';
|
||||
|
||||
class Home extends Base
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('receiver/receiver_customers_model', 'customers_model');
|
||||
$this->load->model('auto/auto_series_model');
|
||||
$this->load->model('auto/auto_brand_model');
|
||||
$this->load->model('app/licheb/app_licheb_users_model', 'app_user_model');
|
||||
$this->load->model('receiver/receiver_clues_cfrom_model', 'clues_cfrom_model');
|
||||
$this->load->model('receiver/receiver_customer_oplogs_model', 'customer_oplogs_model');
|
||||
$this->load->model('receiver/receiver_yx_model');
|
||||
$this->load->model('receiver/receiver_xz_model');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$tabList = [];
|
||||
$rows = $this->customers_model->get_status();
|
||||
if ($rows) {
|
||||
foreach ($rows as $key => $val) {
|
||||
if ($key != -1) {
|
||||
$tabList[] = ['type' => $key, 'title' => $val];
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->data['tabList'] = $tabList;
|
||||
$this->data['_title'] = '我的推广';
|
||||
$this->show_view('h5/paic/home/enroll');
|
||||
}
|
||||
|
||||
public function getLists()
|
||||
{
|
||||
$page = intval($this->input->get('page'));
|
||||
$status = $this->input->get('status');
|
||||
$s_time = $this->input->get('s_time');
|
||||
$e_time = $this->input->get('e_time');
|
||||
!$page && $page = 1;
|
||||
$size = 20;
|
||||
$lists = [];
|
||||
$where = [
|
||||
'cf_pid' => $this->uid,
|
||||
'status>=' => 0
|
||||
];
|
||||
strlen($status) && $where['status'] = $status;
|
||||
if ($s_time && $e_time) {
|
||||
$where["p_time>='{$s_time} 00:00:00'"] = null;
|
||||
$where["p_time<='{$e_time} 23:59:59'"] = null;
|
||||
}
|
||||
$total = $this->customers_model->count($where);
|
||||
if ($total) {
|
||||
$fileds = 'id,rid,name,admin_id,mobile,level,car_json,is_top,cf_title,brand_id,cont_time,c_time,p_time,if_defeat
|
||||
,of_id,of2_id,wxqy,status,biz_id,county_id,cid,brand_id,series_id';
|
||||
$rows = $this->customers_model->select($where, 'id desc', $page, $size, $fileds);
|
||||
//获取管理员
|
||||
$admin_ids = implode(',', array_unique(array_column($rows, 'admin_id')));
|
||||
if ($admin_ids) {
|
||||
$admins = $this->app_user_model->map('id', '', ["id in ({$admin_ids})" => null], '', '', '', 'id,uname');
|
||||
}
|
||||
foreach ($rows as $key => $val) {
|
||||
$brand_name = '';
|
||||
if ($val['brand_id']) {
|
||||
$brand_row = $this->auto_brand_model->get(['id' => intval($val['brand_id'])]);
|
||||
$brand_name = $brand_row['name'] ? $brand_row['name'] : '';
|
||||
}
|
||||
if ($val['series_id']) {
|
||||
$series_row = $this->auto_series_model->get(['id' => intval($val['series_id'])]);
|
||||
$series_name = $series_row['name'] ? $series_row['name'] : '';
|
||||
$series_name && $brand_name .= '-' . $series_name;
|
||||
}
|
||||
$other_data['关注车型'] = $brand_name ?: '';
|
||||
// $other_data['客户来源'] = $this->get_cfTitle($val);
|
||||
$other_data['建档时间'] = date('Y-m-d', strtotime($val['p_time']));
|
||||
$other_data['车管家'] = isset($admins[$val['admin_id']]) ? $admins[$val['admin_id']][0]['uname'] : '';
|
||||
$tmp = [
|
||||
'id' => $val['id'],
|
||||
'cid' => $val['cid'],
|
||||
'name' => $val['name'],
|
||||
'mobile' => $val['mobile'],
|
||||
'time' => date('Y-m-d', strtotime($val['p_time'])),
|
||||
'other_data' => $other_data,
|
||||
];
|
||||
$lists[] = $tmp;
|
||||
}
|
||||
}
|
||||
$data['list'] = $lists;
|
||||
$data['total'] = $total;
|
||||
$this->success($data);
|
||||
}
|
||||
|
||||
public function detail()
|
||||
{
|
||||
$id = $this->input->get('id');
|
||||
$where = [
|
||||
'id' => $id,
|
||||
'cf_pid' => $this->uid,
|
||||
];
|
||||
$row = $this->customers_model->get($where);
|
||||
if (!$row) {
|
||||
throw new Exception('数据不存在');
|
||||
}
|
||||
$admin = $this->app_user_model->get(['id' => $row['admin_id']], 'id,uname');
|
||||
$tags = [$row['level'] . '级用户'];
|
||||
$status_name = $this->customers_model->get_status();
|
||||
$tip = $status_name[$row['status']] ? $status_name[$row['status']] : '';
|
||||
// $other_data = ['客户等级' => $row['level']];
|
||||
// $other_data['客户来源'] = $this->get_cfTitle($row);
|
||||
$brand_name = '';
|
||||
if ($row['brand_id']) {
|
||||
$brand_row = $this->auto_brand_model->get(['id' => intval($row['brand_id'])]);
|
||||
$brand_name = $brand_row['name'] ? $brand_row['name'] : '';
|
||||
}
|
||||
if ($row['series_id']) {
|
||||
$series_row = $this->auto_series_model->get(['id' => intval($row['series_id'])]);
|
||||
$series_name = $series_row['name'] ? $series_row['name'] : '';
|
||||
$series_name && $brand_name .= '-' . $series_name;
|
||||
}
|
||||
$other_data['关注车型'] = $brand_name ?: '';
|
||||
$other_data['建档时间'] = date('Y-m-d', strtotime($row['p_time']));
|
||||
$other_data['车管家'] = isset($admin) ? $admin['uname'] : '';
|
||||
$jsondata = $row['jsondata'] ? json_decode($row['jsondata'], true) : array();
|
||||
$info = [
|
||||
'id' => $row['id'],
|
||||
'cid' => $row['cid'],
|
||||
'name' => $row['name'],
|
||||
'mobile' => $row['mobile'],
|
||||
'tip' => $tip,
|
||||
'is_top' => $row['is_top'],
|
||||
'status' => $row['status'],
|
||||
'defeat' => $jsondata['defeat'],
|
||||
'other_data' => $other_data,
|
||||
'is_weChat' => $row['wxqy'] == 1 ? true : false,
|
||||
'generate_order' => $this->myuid == $row['admin_id'] ? true : false,
|
||||
'level' => $row['level'],
|
||||
'tags' => $tags,
|
||||
'wxgr' => $row['wxgr'],
|
||||
'wxgrimg' => $row['wxgrimg'],
|
||||
'wxgrimg_url' => $row['wxgrimg'] ? build_qiniu_image_url($row['wxgrimg']) : '',
|
||||
'time' => date('Y-m-d', strtotime($row['p_time'])),
|
||||
];
|
||||
$this->data['info'] = $info;
|
||||
$this->data['_title'] = '详情';
|
||||
$this->show_view('h5/paic/home/detail');
|
||||
}
|
||||
|
||||
public function customerLogs()
|
||||
{
|
||||
$id = $this->input->get('id');
|
||||
$page = $this->input->get('page');
|
||||
$size = $this->input->get('size');
|
||||
!$page && $page = 1;
|
||||
!$size && $size = 20;
|
||||
$where = [
|
||||
'customer_id' => $id
|
||||
];
|
||||
$count = $this->customer_oplogs_model->count($where);
|
||||
$lists = [];
|
||||
if ($count) {
|
||||
$rows = $this->customer_oplogs_model->select($where, 'id desc', $page, $size, 'id,log,uname,type,c_time,imgs,sub_type');
|
||||
foreach ($rows as $key => $val) {
|
||||
$record = '';
|
||||
$second = 0;
|
||||
$content = $val['log'];
|
||||
$img_json = json_decode($val['imgs'], true);
|
||||
$imgs = [];
|
||||
if ($img_json) {
|
||||
foreach ($img_json as $val2) {
|
||||
$imgs[] = build_qiniu_image_url($val2);
|
||||
}
|
||||
}
|
||||
if ($val['type'] == 2) {
|
||||
$content = '拨打电话';
|
||||
if ($val['sub_type'] == Receiver_customer_oplogs_model::SUB_TYPE_XZ) {
|
||||
$rec_row = $this->receiver_xz_model->get(['id' => $val['log']], 'rec_url,duration');
|
||||
$rec_row['rec_url'] && $record = $rec_row['rec_url'];
|
||||
$rec_row['duration'] && $second = intval($rec_row['duration'] / 1000);
|
||||
} else {
|
||||
$rec_row = $this->receiver_yx_model->get(['id' => $val['log']], 'rec_url,duration');
|
||||
$rec_row['rec_url'] && $record = get_yx_video($rec_row['rec_url']);
|
||||
$rec_row['duration'] && $second = intval($rec_row['duration']);
|
||||
}
|
||||
!$rec_row['duration'] && $content .= '(未接通)';
|
||||
}
|
||||
$lists[] = [
|
||||
'id' => $val['id'],
|
||||
'content' => "【{$val['uname']}】" . $content,
|
||||
'record_url' => $record,
|
||||
'second' => $second,
|
||||
'imgs' => $imgs,
|
||||
'type_name' => $this->customer_oplogs_model->typeAry($val['type']),
|
||||
'c_time' => date('Y.m.d H:i', $val['c_time'])
|
||||
];
|
||||
}
|
||||
}
|
||||
$data = [
|
||||
'list' => $lists,
|
||||
'total' => $count
|
||||
];
|
||||
$this->success($data);
|
||||
}
|
||||
|
||||
private function get_cfTitle($params)
|
||||
{
|
||||
$map_cfrom2 = $this->clues_cfrom_model->get(array('id' => $params['of2_id']));
|
||||
$map_cfrom = $this->clues_cfrom_model->get(array('id' => $map_cfrom2['pid']));
|
||||
$title = $map_cfrom['title'] . '-' . $map_cfrom2['title'];
|
||||
|
||||
return $title;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require_once 'Base.php';
|
||||
|
||||
class Login extends Base
|
||||
{
|
||||
|
||||
protected $log_dir = 'paic';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->white_login_method = ['index', 'logout'];
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
if($this->uid){
|
||||
header('Location:/h5/paic/home');
|
||||
}
|
||||
if ($this->input->is_ajax_request()) {
|
||||
$redis = &load_cache('redis');
|
||||
$code = $this->input->post('code');
|
||||
$mobile = $this->input->post('mobile');
|
||||
$key = "paic_login_code_" . $mobile;
|
||||
if (!$code || $code != $redis->get($key)) {
|
||||
$this->fail('', '请输入正确的验证码');
|
||||
}
|
||||
$user = $this->user_model->get(['mobile' => $mobile, 'status' => App_paic_users_model::STATUS_NORMAL]);
|
||||
if (!$user) {
|
||||
$this->fail('', '用户不存在');
|
||||
}
|
||||
$this->session->set_userdata(self::LOGIN_USER_INFO, $user);
|
||||
$this->uid = $user['id'];
|
||||
$redis->delete($key);
|
||||
if ($this->open_id) { //绑定openid
|
||||
$req = $this->bind_openid($mobile);
|
||||
}
|
||||
$this->success('', '登录成功');
|
||||
} else {
|
||||
$this->load->view('h5/paic/login');
|
||||
}
|
||||
}
|
||||
|
||||
//绑定微信openid
|
||||
private function bind_openid($mobile)
|
||||
{
|
||||
if (!$this->open_id) {
|
||||
return ['code' => 0, 'msg' => '不存在公众号信息,无需绑定'];
|
||||
}
|
||||
if (!$mobile) {
|
||||
return ['code' => 0, 'msg' => '参数错误'];
|
||||
}
|
||||
$is_bind = $this->user_model->count(["open_id!=''" => null, 'status' => App_paic_users_model::STATUS_NORMAL, 'mobile' => $mobile]); //已被绑定
|
||||
if ($is_bind) {
|
||||
$row = $this->user_model->get(['mobile' => $mobile, "open_id!=''" => null, 'status' => App_paic_users_model::STATUS_NORMAL]);
|
||||
if ($row['openid'] != $this->open_id) {
|
||||
return ['code' => 0, 'msg' => '该公众号已存在绑定账号'];
|
||||
}
|
||||
}
|
||||
$update = [
|
||||
'open_id' => $this->open_id
|
||||
];
|
||||
$this->user_model->update($update, ['mobile' => $mobile, 'status' => App_paic_users_model::STATUS_NORMAL]);
|
||||
return ['code' => 1, 'msg' => '绑定成功'];
|
||||
}
|
||||
|
||||
public function logout()
|
||||
{
|
||||
// $_SESSION[self::SESSION_KEY] = '';
|
||||
$this->show_json('', 200, '退出成功');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require_once 'Base.php';
|
||||
|
||||
class Reg extends Base
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->white_login_method = ['index'];
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
if ($this->input->is_ajax_request()) {
|
||||
$redis = &load_cache('redis');
|
||||
$code = $this->input->post('code');
|
||||
$name = $this->input->post('name');
|
||||
$mobile = $this->input->post('mobile');
|
||||
$province_id = $this->input->post('province_id');
|
||||
$city_id = $this->input->post('city_id');
|
||||
$belong_to = $this->input->post('belong_to');
|
||||
$cache_key = "paic_reg_code_" . $mobile;
|
||||
|
||||
if (!$name) {
|
||||
$this->fail('', '请填写真实姓名');
|
||||
}
|
||||
|
||||
if (!$mobile || !mobile_valid($mobile)) {
|
||||
$this->fail('', '请输入正确的手机号');
|
||||
}
|
||||
if (!$province_id || !$city_id) {
|
||||
$this->fail('', '请选择省市');
|
||||
}
|
||||
if (!strlen($belong_to)) {
|
||||
$this->fail('', '请选择归属');
|
||||
}
|
||||
if (!$code || $code != $redis->get($cache_key)) {
|
||||
$this->fail('', '请输入正确的验证码');
|
||||
}
|
||||
|
||||
$add = array(
|
||||
'name' => $name,
|
||||
'mobile' => $mobile,
|
||||
'province_id' => $province_id,
|
||||
'city_id' => $city_id,
|
||||
'belong_to' => intval($belong_to),
|
||||
);
|
||||
$req = $this->user_model->add($add);
|
||||
if (!$req) {
|
||||
$this->fail('', '注册失败');
|
||||
}
|
||||
$redis->delete($cache_key);
|
||||
$this->success('', '注册成功');
|
||||
} else {
|
||||
$data['belong_to_list'] = App_paic_users_model::BELONG_TO_LIST;
|
||||
$this->load->view('h5/paic/reg', $data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
</html>
|
||||
@@ -0,0 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport"
|
||||
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title><?=$_title?></title>
|
||||
<link rel="stylesheet" href="/css/h5/paic/h5.css?20221106">
|
||||
<link rel="stylesheet" href="/js/swiper/swiper.min.css">
|
||||
<script type="text/javascript" src="/js/jquery.3.4.1.min.js"></script>
|
||||
<script type="text/javascript" src="/js/vue.2.6.10.min.js"></script>
|
||||
<script type="text/javascript" src="/js/mDialog.js"></script>
|
||||
<script type="text/javascript" src="/js/swiper/swiper.min.js"></script>
|
||||
<link rel="stylesheet" href="/js/vant/index.css"/>
|
||||
<script src="/js/vant/vant.min.js"></script>
|
||||
<script src="/js/vue-mugen-scroll.js"></script>
|
||||
<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
|
||||
</head>
|
||||
@@ -0,0 +1,108 @@
|
||||
<link rel="stylesheet" href="/css/h5/paic/enroll.css">
|
||||
<style>
|
||||
.parent-div .van-tag {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 5vw;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<div id="app" style="min-height: 100vh;" class="bg-f6 relative">
|
||||
<!-- 列表 -->
|
||||
<div class="relative pb30">
|
||||
<div class="card-module overflowhidden">
|
||||
<div class="parent-div">
|
||||
<van-tag type="success" size="medium">{{info.tip}}</van-tag>
|
||||
</div>
|
||||
<h3 class="font-32 pt30">{{info.name}} {{info.mobile}}</h3>
|
||||
<p class="font-24 color-999 mt20">编号 {{info.cid}}</p>
|
||||
<template v-if="info.other_data">
|
||||
<van-row class="font-30 color-999 mt20" v-for="(item,index) in info.other_data">
|
||||
<van-col span="6">
|
||||
<span>{{index}}</span>
|
||||
</van-col>
|
||||
<van-col span="18" class="text-right">
|
||||
<span>{{item}}</span>
|
||||
</van-col>
|
||||
</van-row>
|
||||
</template>
|
||||
|
||||
</div>
|
||||
<div class="card-module overflowhidden">
|
||||
<van-tabs>
|
||||
<van-tab title="跟进记录">
|
||||
<div>
|
||||
<van-list
|
||||
v-model="loading"
|
||||
:finished="finished"
|
||||
finished-text="没有更多了"
|
||||
:error.sync="error"
|
||||
error-text="请求失败,点击重新加载"
|
||||
@load="onLoad"
|
||||
>
|
||||
<van-steps direction="vertical" active="0">
|
||||
<van-step v-for="(item, index) in list" :key="index">
|
||||
<!-- 步骤内容 -->
|
||||
<p>{{item.c_time}}</p>
|
||||
<div class="mt10">
|
||||
<template v-if="item.second>0 && item.record_url">
|
||||
<audio :src="item.record_url" controls></audio>
|
||||
</template>
|
||||
<h3 v-else>{{item.content}}</h3>
|
||||
</div>
|
||||
</van-step>
|
||||
</van-steps>
|
||||
</van-list>
|
||||
</div>
|
||||
|
||||
</van-tab>
|
||||
</van-tabs>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
let app = new Vue({
|
||||
el: '#app',
|
||||
data() {
|
||||
return {
|
||||
info: {},
|
||||
loading: false,
|
||||
finished: false,
|
||||
page: 1,
|
||||
error: false,
|
||||
list: []
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.info = <?=json_encode($info, JSON_UNESCAPED_UNICODE)?>
|
||||
},
|
||||
methods: {
|
||||
onLoad() {
|
||||
let that = this
|
||||
//请求接口
|
||||
$.get('/h5/paic/home/customerLogs', {
|
||||
page: that.page,
|
||||
id: that.info.id,
|
||||
}, function (res) {
|
||||
that.loading = false;
|
||||
if (res.code == 200) {
|
||||
that.page = that.page + 1
|
||||
that.list = that.list.concat(res.data.list);
|
||||
if (that.list.length >= res.data.total) {
|
||||
that.finished = true;
|
||||
}
|
||||
} else {
|
||||
that.error = true;
|
||||
msgDia = mDialog.msg({
|
||||
duration: 250,
|
||||
pause: 2000,
|
||||
content: res.msg
|
||||
});
|
||||
}
|
||||
|
||||
}, 'json');
|
||||
},
|
||||
},
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
@@ -0,0 +1,194 @@
|
||||
<link rel="stylesheet" href="/css/h5/paic/enroll.css">
|
||||
<style>
|
||||
.custom-border .van-field__control {
|
||||
border: 1px solid #dcdcdc; /* 设置边框颜色和宽度 */
|
||||
border-radius: 5px; /* 可选:设置边框圆角 */
|
||||
}
|
||||
|
||||
.field-container {
|
||||
display: flex; /* 使用Flexbox布局 */
|
||||
align-items: center; /* 垂直居中 */
|
||||
padding-right: 4vw;
|
||||
}
|
||||
|
||||
.field {
|
||||
flex: 1; /* 让输入框平分剩余空间(除了按钮占据的空间) */
|
||||
margin-right: 0; /* 可选:为输入框之间及输入框与按钮之间添加一些间距 */
|
||||
}
|
||||
|
||||
.confirm-button {
|
||||
flex-shrink: 0; /* 防止按钮在空间不足时缩小 */
|
||||
/* 将按钮推到行尾 */
|
||||
/*margin-left: auto; */
|
||||
margin-right: 5px;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<div id="app" style="min-height: 100vh;" class="bg-f6 relative">
|
||||
<!-- 列表 -->
|
||||
<div class="relative pb30">
|
||||
<van-tabs v-model="active" sticky color="#000" @click="onChange">
|
||||
<van-tab v-for="(item,index) in tab_list" :title="item.title"></van-tab>
|
||||
</van-tabs>
|
||||
<div class="field-container">
|
||||
<!-- 开始时间输入框 -->
|
||||
<van-field class="custom-border field" v-model="startTime" readonly @click="showStartTimePicker = true"
|
||||
placeholder="开始时间">
|
||||
</van-field>
|
||||
<!-- 时间选择器(开始时间) -->
|
||||
<van-popup v-model="showStartTimePicker" position="bottom">
|
||||
<van-datetime-picker
|
||||
value-format="YYYY-MM-DD"
|
||||
v-model="selectedStartTime"
|
||||
type="date"
|
||||
title="选择开始时间"
|
||||
@cancel="showStartTimePicker = false"
|
||||
@confirm="confirmStartTime"
|
||||
>
|
||||
</van-datetime-picker>
|
||||
</van-popup>
|
||||
~
|
||||
<van-field class="custom-border field" v-model="endTime" readonly @click="showEndTimePicker = true"
|
||||
placeholder="结束时间">
|
||||
</van-field>
|
||||
<!-- 时间选择器(结束时间) -->
|
||||
<van-popup v-model="showEndTimePicker" position="bottom">
|
||||
<van-datetime-picker
|
||||
value-format="YYYY-MM-DD"
|
||||
v-model="selectedEndTime"
|
||||
type="date"
|
||||
title="选择结束时间"
|
||||
@cancel="showEndTimePicker = false"
|
||||
@confirm="confirmEndTime"
|
||||
:min-date="miniEndTime"
|
||||
>
|
||||
</van-datetime-picker>
|
||||
</van-popup>
|
||||
<van-button size="small" plain type="primary" class="confirm-button" @click="reset">重置</van-button>
|
||||
<van-button size="small" plain type="primary" class="confirm-button" @click="search">搜索</van-button>
|
||||
</div>
|
||||
<div class="list">
|
||||
<van-list
|
||||
v-model="loading"
|
||||
:finished="finished"
|
||||
finished-text="没有更多了"
|
||||
:error.sync="error"
|
||||
error-text="请求失败,点击重新加载"
|
||||
@load="onLoad"
|
||||
>
|
||||
<div v-for="(item,index) in list" class="card-module overflowhidden" @click="goDetail(item.id)">
|
||||
<h3 class="font-32">{{item.name}} {{item.mobile}}</h3>
|
||||
<p class="font-24 color-999 mt20">编号 {{item.cid}}</p>
|
||||
|
||||
<van-row class="font-30 color-999 mt20" v-for="(item,index) in item.other_data">
|
||||
<van-col span="6">
|
||||
<span>{{index}}</span>
|
||||
</van-col>
|
||||
<van-col span="18" class="text-right">
|
||||
<span>{{item}}</span>
|
||||
</van-col>
|
||||
</van-row>
|
||||
<!--
|
||||
<p class="mt20 font-22">来源:
|
||||
<span v-for="(it, idx) in item.source" :key="index"
|
||||
:class="[' pt5 pb5 pl15 pr15 ulib-r750 mr10',it.class]">{{it.name}}</span>
|
||||
</p>
|
||||
<span :class="['ulib-rtr20 ulib-rbl20 absolute right-0 top-0 font-24 pt5 pb5 pl15 pr15', item.status.class]">{{item.status.name}}</span>
|
||||
-->
|
||||
</div>
|
||||
</van-list>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
let app = new Vue({
|
||||
el: '#app',
|
||||
data() {
|
||||
return {
|
||||
tab_list: <?=json_encode($tabList, JSON_UNESCAPED_UNICODE)?>,
|
||||
active: 0,
|
||||
list: [],
|
||||
loading: false,
|
||||
finished: false,
|
||||
page: 1,
|
||||
error: false,
|
||||
startTime: '', // 开始时间输入框的值
|
||||
showStartTimePicker: false, // 控制开始时间选择器显示的标志
|
||||
selectedStartTime: new Date(), // 用户选择的开始时间(在确认前)
|
||||
endTime: '', // 开始时间输入框的值
|
||||
showEndTimePicker: false, // 控制开始时间选择器显示的标志
|
||||
selectedEndTime: null, // 用户选择的开始时间(在确认前)
|
||||
miniEndTime: new Date(2019, 10, 1),
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
search() {
|
||||
this.page = 1
|
||||
this.list = []
|
||||
this.onLoad()
|
||||
},
|
||||
onChange() {
|
||||
this.page = 1
|
||||
this.list = []
|
||||
this.onLoad()
|
||||
},
|
||||
onLoad() {
|
||||
let that = this
|
||||
let type = 0
|
||||
if (that.active) {
|
||||
type = that.tab_list[that.active].type
|
||||
}
|
||||
//请求接口
|
||||
$.get('/h5/paic/home/getLists', {
|
||||
page: that.page,
|
||||
status: type,
|
||||
's_time': this.startTime,
|
||||
'e_time': this.endTime
|
||||
}, function (res) {
|
||||
that.loading = false;
|
||||
if (res.code == 200) {
|
||||
if (that.page === 1) {
|
||||
this.tab_list = res.data.tabList
|
||||
}
|
||||
that.page = that.page + 1
|
||||
that.list = that.list.concat(res.data.list);
|
||||
if (that.list.length >= res.data.total) {
|
||||
that.finished = true;
|
||||
}
|
||||
} else {
|
||||
that.error = true;
|
||||
msgDia = mDialog.msg({
|
||||
duration: 250,
|
||||
pause: 2000,
|
||||
content: res.msg
|
||||
});
|
||||
}
|
||||
|
||||
}, 'json');
|
||||
},
|
||||
confirmStartTime(value) {
|
||||
const date = new Date(+new Date(value) + 8 * 3600 * 1000)
|
||||
const isoString = date.toISOString(); // ISO格式为"YYYY-MM-DDTHH:mm:ss.sssZ"
|
||||
this.startTime = isoString.slice(0, 10);
|
||||
this.showStartTimePicker = false; // 隐藏时间选择器
|
||||
this.miniEndTime = value
|
||||
this.selectedEndTime = value
|
||||
},
|
||||
confirmEndTime(value) {
|
||||
const date = new Date(+new Date(value) + 8 * 3600 * 1000)
|
||||
const isoString = date.toISOString(); // ISO格式为"YYYY-MM-DDTHH:mm:ss.sssZ"
|
||||
this.endTime = isoString.slice(0, 10);
|
||||
this.showEndTimePicker = false; // 隐藏时间选择器
|
||||
},
|
||||
reset() {
|
||||
this.startTime = ''
|
||||
this.endTime = ''
|
||||
},
|
||||
goDetail(id) {
|
||||
window.location.href = '/h5/paic/home/detail?id=' + id
|
||||
}
|
||||
},
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
@@ -0,0 +1,151 @@
|
||||
<?$this->load->view('h5/paic/header');?>
|
||||
<body class="bg-fff">
|
||||
<div class="height-500 fixed left-0 right-0 top-0 z-index-0 bg-1a1a1a"></div>
|
||||
<div class="bg-fff" id="app" ref="app">
|
||||
<div class="container relative bg-repeat-y bg-size-fullwidth bg-pos-center"
|
||||
style="background-image:url(https://qs.haodian.cn/web/images/project/H5-ShiYu/loginbg2.jpg?v=221008)">
|
||||
<div class="absolute box-middle left-0 right-0 pl80 pr80 pb220">
|
||||
<div class="color-fff">
|
||||
<div class="font-52">手机号登录</div>
|
||||
<!-- <div class="mt20 font-28">欢迎使用理车宝-私域活动系统</div>-->
|
||||
</div>
|
||||
<div>
|
||||
<div class="relative mt50 bg-fff-op15 ulib-r750">
|
||||
<input class="wp100 pt30 pb30 pl40 pr20 bg-transparent border-none font-32 color-fff placeholder-color-ccc"
|
||||
type="tel" v-model="telPhone" placeholder="请输入手机号"/>
|
||||
</div>
|
||||
<div class="relative mt50 bg-fff-op15 ulib-r750">
|
||||
<input class="wp100 pt30 pb30 pl40 pr40 bg-transparent border-none font-32 color-fff placeholder-color-ccc"
|
||||
type="number" oninput="if(value.length>4)value=value.slice(0,4)" v-model="vCode"
|
||||
placeholder="请输入验证码"/>
|
||||
<div class="absolute right-0 box-middle mr30 font-32 color-fff" @click="getcode()">{{codeTx}}</div>
|
||||
</div>
|
||||
<button class="mt50 wp100 bg-fff-op80 border-none pt30 pb30 font-32 color-333 ulib-r750"
|
||||
@click="submit()">立即登录
|
||||
</button>
|
||||
<!--
|
||||
<div class="mt50 text-center font-24 color-fff">
|
||||
<label>
|
||||
<input type="checkbox" class="checkbox-input" v-model="rememberMe" />
|
||||
<span>记住账号</span>
|
||||
</label>
|
||||
</div>
|
||||
-->
|
||||
</div>
|
||||
</div>
|
||||
<div class="absolute bottom-0 left-0 right-0 pl40 pr40 pb80 text-center color-fff">
|
||||
<!-- <div class="font-22">powered by haodian.cn</div>-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var app = new Vue({
|
||||
el: '#app',
|
||||
data: {
|
||||
telPhone: '',
|
||||
vCode: '',
|
||||
codeState: true,
|
||||
codeTx: '获取验证码',
|
||||
isSubmiting: false,
|
||||
rememberMe: true,
|
||||
},
|
||||
computed: {},
|
||||
mounted() {
|
||||
var Timer;
|
||||
},
|
||||
beforeDestroy() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
|
||||
countDownTime(time) {
|
||||
let that = this;
|
||||
if (time > 1) {
|
||||
time--;
|
||||
this.codeState = false;
|
||||
this.codeTx = time + "s后重新获取";
|
||||
Timer = setTimeout(function () {
|
||||
that.countDownTime(time);
|
||||
}, 1000)
|
||||
} else {
|
||||
clearTimeout(Timer);
|
||||
that.codeState = true;
|
||||
that.codeTx = "获取验证码";
|
||||
}
|
||||
},
|
||||
|
||||
getcode() {
|
||||
if (!this.codeState) return;
|
||||
if (!/^1[3456789]\d{9}$/.test(this.telPhone)) {
|
||||
//alert('请输入正确手机号')
|
||||
mDialog.msg({
|
||||
duration: 250,
|
||||
pause: 2000,
|
||||
content: "请输入正确手机号"
|
||||
});
|
||||
} else {
|
||||
//按钮倒计时
|
||||
var that = this;
|
||||
$.post('/h5/common/sms', {'mobile': this.telPhone, 'type': 'login'}, function (response) {
|
||||
mDialog.msg({
|
||||
duration: 250,
|
||||
pause: 2000,
|
||||
content: response.msg
|
||||
});
|
||||
if (response.code == 200) {
|
||||
that.countDownTime(91)
|
||||
}
|
||||
}, 'json')
|
||||
}
|
||||
},
|
||||
submit() {
|
||||
if (this.isSubmiting) return;
|
||||
if (!/^1[3456789]\d{9}$/.test(this.telPhone)) {
|
||||
mDialog.msg({
|
||||
duration: 250,
|
||||
pause: 2000,
|
||||
content: "请输入正确手机号"
|
||||
});
|
||||
} else if (!this.vCode) {
|
||||
mDialog.msg({
|
||||
duration: 250,
|
||||
pause: 2000,
|
||||
content: "请输入验证码"
|
||||
});
|
||||
} else {
|
||||
// this.isSubmiting = true
|
||||
$.post('/h5/paic/login', {
|
||||
'mobile': this.telPhone,
|
||||
'code': this.vCode,
|
||||
'remember': this.rememberMe
|
||||
}, function (response) {
|
||||
if (response.code == 200) {
|
||||
mDialog.msg({
|
||||
duration: 250,
|
||||
pause: 2000,
|
||||
content: response.msg,
|
||||
onClose: function () {
|
||||
window.location = "/h5/paic/home"
|
||||
}
|
||||
});
|
||||
} else {
|
||||
mDialog.msg({
|
||||
duration: 250,
|
||||
pause: 2000,
|
||||
content: response.msg
|
||||
});
|
||||
}
|
||||
}, 'json')
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
},
|
||||
})
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,261 @@
|
||||
<? $this->load->view('h5/paic/header'); ?>
|
||||
<style>
|
||||
.select-container {
|
||||
display: flex;
|
||||
flex-wrap: wrap; /* 使下拉框在空间不足时换行 */
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
select {
|
||||
font-size: 4.267vw;
|
||||
padding: 4vw 5.333vw;
|
||||
border: none;
|
||||
border-radius: 100vw;
|
||||
background-color: rgba(255, 255, 255, 0.2);
|
||||
color: white;
|
||||
appearance: none;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
background-image: url("data:image/svg+xml;utf8,<svg fill='white' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>");
|
||||
background-repeat: no-repeat;
|
||||
background-position: right 10px center;
|
||||
width: 100%; /* 先让下拉框占满父容器宽度 */
|
||||
/*min-width: 150px;*/
|
||||
}
|
||||
|
||||
select option {
|
||||
color: #666;
|
||||
}
|
||||
|
||||
@media (min-width: 600px) {
|
||||
select {
|
||||
width: auto;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<body class="bg-fff">
|
||||
<div class="height-500 fixed left-0 right-0 top-0 z-index-0 bg-1a1a1a"></div>
|
||||
<div class="bg-fff" id="app" ref="app">
|
||||
<div class="container relative bg-repeat-y bg-size-fullwidth bg-pos-center"
|
||||
style="background-image:url(https://qs.haodian.cn/web/images/project/H5-ShiYu/loginbg2.jpg?v=221008)">
|
||||
<div class="absolute box-middle left-0 right-0 pl80 pr80 pb220">
|
||||
<div class="color-fff">
|
||||
<div class="font-52">用户注册</div>
|
||||
<!--
|
||||
<div class="mt20 font-28">欢迎注册好店云-私域活动系统</div>
|
||||
-->
|
||||
</div>
|
||||
<div>
|
||||
<div class="relative mt50 bg-fff-op15 ulib-r750">
|
||||
<input class="wp100 pt30 pb30 pl40 pr20 bg-transparent border-none font-32 color-fff placeholder-color-ccc"
|
||||
type="text" v-model="name" placeholder="请输入真实姓名" maxlength="5"/>
|
||||
</div>
|
||||
<div class="relative mt50 bg-fff-op15 ulib-r750">
|
||||
<input class="wp100 pt30 pb30 pl40 pr20 bg-transparent border-none font-32 color-fff placeholder-color-ccc"
|
||||
type="tel" v-model="telPhone" placeholder="请输入手机号" maxlength="11"/>
|
||||
</div>
|
||||
<div class="relative mt50 bg-fff-op15 ulib-r750">
|
||||
<input class="wp100 pt30 pb30 pl40 pr20 bg-transparent border-none font-32 color-fff placeholder-color-ccc"
|
||||
readonly v-model="areaName" type="text" placeholder="点击选择省/市"
|
||||
@click="showArea = true"/>
|
||||
</div>
|
||||
<div class="relative mt50 bg-fff-op15 ulib-r750">
|
||||
<input class="wp100 pt30 pb30 pl40 pr20 bg-transparent border-none font-32 color-fff placeholder-color-ccc"
|
||||
readonly v-model="belong_to_name" type="text" placeholder="点击选择归属"
|
||||
@click="showPicker = true"/>
|
||||
</div>
|
||||
<div class="relative mt50 bg-fff-op15 ulib-r750">
|
||||
<input class="wp100 pt30 pb30 pl40 pr40 bg-transparent border-none font-32 color-fff placeholder-color-ccc"
|
||||
type="number" oninput="if(value.length>4)value=value.slice(0,4)" v-model="vCode"
|
||||
placeholder="请输入验证码"/>
|
||||
<div class="absolute right-0 box-middle mr30 font-32 color-fff" @click="getcode()">{{codeTx}}</div>
|
||||
</div>
|
||||
<button class="mt50 wp100 bg-fff-op80 border-none pt30 pb30 font-32 color-333 ulib-r750"
|
||||
@click="submit()">立即注册
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<van-popup v-model="showArea" position="bottom">
|
||||
<van-area
|
||||
:area-list="areaList"
|
||||
@confirm="onConfirm"
|
||||
@cancel="showArea = false"
|
||||
:columns-num="2"
|
||||
:value="city_id"
|
||||
/>
|
||||
</van-popup>
|
||||
<van-popup v-model="showPicker" position="bottom">
|
||||
<van-picker
|
||||
show-toolbar
|
||||
:columns="belong_to_list"
|
||||
@confirm="selectBelong"
|
||||
@cancel="showPicker = false"
|
||||
/>
|
||||
</van-popup>
|
||||
|
||||
<div class="absolute bottom-0 left-0 right-0 pl40 pr40 pb80 text-center color-fff">
|
||||
<!--
|
||||
<div class="font-22">powered by haodian.cn</div>
|
||||
-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var app = new Vue({
|
||||
el: '#app',
|
||||
data: {
|
||||
name: '',
|
||||
telPhone: '',
|
||||
belong_to: '',
|
||||
vCode: '',
|
||||
codeState: true,
|
||||
codeTx: '获取验证码',
|
||||
isSubmiting: false,
|
||||
rememberMe: true,
|
||||
belong_to_list: [],
|
||||
areaName: '',
|
||||
showArea: false,
|
||||
areaList: {
|
||||
province_list: {},
|
||||
city_list: {},
|
||||
},
|
||||
province_id: '350000',
|
||||
city_id: '350200',
|
||||
showPicker: false,
|
||||
belong_to_name: ''
|
||||
},
|
||||
computed: {},
|
||||
mounted() {
|
||||
var Timer;
|
||||
this.belong_to_list = <?=$belong_to_list ? json_encode($belong_to_list, JSON_UNESCAPED_UNICODE) : "[]"?>;
|
||||
this.loadAreaList()
|
||||
},
|
||||
methods: {
|
||||
loadAreaList() {
|
||||
var that = this
|
||||
$.get('/h5/common/getAreaList', {}, function (result) {
|
||||
that.areaList.province_list = result.data.province_list
|
||||
that.areaList.city_list = result.data.city_list
|
||||
}, 'json')
|
||||
},
|
||||
countDownTime(time) {
|
||||
let that = this;
|
||||
if (time > 1) {
|
||||
time--;
|
||||
this.codeState = false;
|
||||
this.codeTx = time + "s后重新获取";
|
||||
Timer = setTimeout(function () {
|
||||
that.countDownTime(time);
|
||||
}, 1000)
|
||||
} else {
|
||||
clearTimeout(Timer);
|
||||
that.codeState = true;
|
||||
that.codeTx = "获取验证码";
|
||||
}
|
||||
},
|
||||
getcode() {
|
||||
if (!this.codeState) return;
|
||||
if (!/^1[3456789]\d{9}$/.test(this.telPhone)) {
|
||||
//alert('请输入正确手机号')
|
||||
mDialog.msg({
|
||||
duration: 250,
|
||||
pause: 2000,
|
||||
content: "请输入正确手机号"
|
||||
});
|
||||
} else {
|
||||
//按钮倒计时
|
||||
var that = this;
|
||||
$.post('/h5/common/sms', {'mobile': this.telPhone}, function (response) {
|
||||
mDialog.msg({
|
||||
duration: 250,
|
||||
pause: 2000,
|
||||
content: response.msg
|
||||
});
|
||||
if (response.code == 200) {
|
||||
that.countDownTime(91)
|
||||
}
|
||||
}, 'json')
|
||||
}
|
||||
},
|
||||
submit() {
|
||||
if (this.isSubmiting) return;
|
||||
|
||||
if (!this.name) {
|
||||
mDialog.msg({
|
||||
duration: 250,
|
||||
pause: 2000,
|
||||
content: "请输入真实姓名"
|
||||
});
|
||||
} else if (!/^1[3456789]\d{9}$/.test(this.telPhone)) {
|
||||
mDialog.msg({
|
||||
duration: 250,
|
||||
pause: 2000,
|
||||
content: "请输入正确手机号"
|
||||
});
|
||||
} else if (!this.vCode) {
|
||||
mDialog.msg({
|
||||
duration: 250,
|
||||
pause: 2000,
|
||||
content: "请输入验证码"
|
||||
});
|
||||
} else if (this.belong_to === '' || this.belong_to === null) {
|
||||
mDialog.msg({
|
||||
duration: 250,
|
||||
pause: 2000,
|
||||
content: "请选择归属"
|
||||
});
|
||||
} else if (!this.province_id || !this.city_id || !this.areaName) {
|
||||
mDialog.msg({
|
||||
duration: 250,
|
||||
pause: 2000,
|
||||
content: "请选择省市"
|
||||
});
|
||||
} else {
|
||||
var that = this
|
||||
that.isSubmiting = true
|
||||
$.post('/h5/paic/reg', {
|
||||
'name': this.name,
|
||||
'mobile': this.telPhone,
|
||||
'province_id': this.province_id,
|
||||
'city_id': this.city_id,
|
||||
'belong_to': this.belong_to,
|
||||
'code': this.vCode,
|
||||
}, function (response) {
|
||||
that.isSubmiting = false
|
||||
if (response.code == 200) {
|
||||
mDialog.msg({
|
||||
duration: 250,
|
||||
pause: 2000,
|
||||
content: response.msg,
|
||||
onClose: function () {
|
||||
window.location = "/h5/paic/login"
|
||||
}
|
||||
});
|
||||
} else {
|
||||
mDialog.msg({
|
||||
duration: 250,
|
||||
pause: 2000,
|
||||
content: response.msg
|
||||
});
|
||||
}
|
||||
}, 'json')
|
||||
}
|
||||
|
||||
},
|
||||
onConfirm(values) {
|
||||
this.province_id = values[0]['code']
|
||||
this.city_id = values[1]['code']
|
||||
this.areaName = values.filter((item) => !!item).map((item) => item.name).join('/');
|
||||
this.showArea = false;
|
||||
},
|
||||
selectBelong(value, index) {
|
||||
this.belong_to = index
|
||||
this.belong_to_name = value
|
||||
this.showPicker = false;
|
||||
}
|
||||
},
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,60 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>下拉框示例</title>
|
||||
</head>
|
||||
<link rel="stylesheet" href="/css/h5/paic/h5.css?20221106">
|
||||
<link rel="stylesheet" href="https://qs.haodian.cn/web/javascript/swiper/css/swiper.min.css">
|
||||
<script type="text/javascript" src="https://qs.haodian.cn/web/javascript/jquery.3.4.1.min.js"></script>
|
||||
<script type="text/javascript" src="https://qs.haodian.cn/web/javascript/vue.2.6.10.min.js"></script>
|
||||
<script type="text/javascript" src="https://qs.haodian.cn/web/javascript/mDialog.js"></script>
|
||||
<script type="text/javascript" src="https://qs.haodian.cn/web/javascript/swiper/js/swiper.min.js"></script>
|
||||
<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
|
||||
<link rel="stylesheet" href="https://unpkg.com/vant@2.12/lib/index.css"/>
|
||||
<script src="https://unpkg.com/vue@2.6/dist/vue.min.js"></script>
|
||||
<script src="https://unpkg.com/vant@2.12/lib/vant.min.js"></script>
|
||||
<body>
|
||||
<div id="app">
|
||||
<van-button @click="showPicker = true">打开选择器</van-button>
|
||||
<van-popup v-model="showPicker" position="bottom">
|
||||
<van-picker
|
||||
show-toolbar
|
||||
v-model="currentValue"
|
||||
:columns="columns"
|
||||
@confirm="onConfirm"
|
||||
@cancel="showPicker = false"
|
||||
/>
|
||||
</van-popup>
|
||||
|
||||
<p>选中的值: {{ selectedValue }}</p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
<script type="text/javascript">
|
||||
var app = new Vue({
|
||||
el: '#app',
|
||||
data: {
|
||||
showPicker: false,
|
||||
currentValue: [0], // 默认选中的索引
|
||||
columns: ['选项1', '选项2', '选项3'],
|
||||
selectedValue: ''
|
||||
},
|
||||
computed: {
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
onConfirm(values) {
|
||||
console.log(values)
|
||||
// values 是一个数组,包含了每个列选中的值
|
||||
this.selectedValue = values[0];
|
||||
this.showPicker = false;
|
||||
}
|
||||
},
|
||||
})
|
||||
</script>
|
||||
</html>
|
||||
@@ -0,0 +1 @@
|
||||
Slb9FNpnUFmQI5wZ
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Vendored
+3
File diff suppressed because one or more lines are too long
@@ -0,0 +1,710 @@
|
||||
|
||||
;
|
||||
(function($, window, document, undefined) {
|
||||
var mDialog = {
|
||||
v: '0.0.1',
|
||||
stack: {},
|
||||
zIndex: 100000,
|
||||
defaults: {
|
||||
title: "",
|
||||
top: false,
|
||||
bottom: false,
|
||||
autoClose: false,
|
||||
pause: false,
|
||||
duration: 250,
|
||||
isPreventMove: true,
|
||||
shade: true,
|
||||
width: "auto",
|
||||
height: "auto",
|
||||
maxWidth: "85%",
|
||||
maxHeight: "80%",
|
||||
offset: ["auto", "auto"],
|
||||
animIn: "mDialogZoomIn",
|
||||
animOut: "mDialogZoomOut",
|
||||
shadeClose: true,
|
||||
content: "",
|
||||
closeBtn: true,
|
||||
buttons: {},
|
||||
baseViewWidth: 750,
|
||||
baseViewHeight: 1344,
|
||||
scrollTop:0,
|
||||
hasInput:false,
|
||||
onBeforeShow: function() {},
|
||||
onShow: function() {},
|
||||
onBeforeClose: function() {},
|
||||
onClose: function() {}
|
||||
}
|
||||
}
|
||||
var ExtraFunc = {
|
||||
colorToRgba: function(colorStr, opacity) {
|
||||
colorStr = !!colorStr ? colorStr : "#000";
|
||||
var sColor = colorStr.toLowerCase();
|
||||
//没有传递,那么默认的是
|
||||
var sOpacity = (opacity === 0 || !!opacity) ? ((opacity > 1) ? 1 : ((opacity <= 0) ? 0 : opacity)) : 0.8;
|
||||
if (sColor && /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(sColor)) {
|
||||
if (sColor.length === 4) {
|
||||
var sColorNew = "#";
|
||||
for (var i = 1; i < 4; i += 1) {
|
||||
sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1));
|
||||
}
|
||||
sColor = sColorNew;
|
||||
}
|
||||
//处理六位的颜色值
|
||||
var sColorChange = [];
|
||||
for (var i = 1; i < 7; i += 2) {
|
||||
sColorChange.push(parseInt("0x" + sColor.slice(i, i + 2)));
|
||||
}
|
||||
return "rgba(" + sColorChange.join(",") + "," + sOpacity + ")";
|
||||
} else {
|
||||
return sColor;
|
||||
}
|
||||
},
|
||||
dealCssEvent:function(eventNameArr, callback,duration) {
|
||||
var events = eventNameArr,
|
||||
called=false,
|
||||
Timer=null,
|
||||
i, dom = this; // jshint ignore:line
|
||||
|
||||
function fireCallBack(e) {
|
||||
/*jshint validthis:true */
|
||||
called=true;
|
||||
if (e.target !== this) return;
|
||||
callback.call(this, e);
|
||||
for (i = 0; i < events.length; i++) {
|
||||
dom.off(events[i], fireCallBack);
|
||||
}
|
||||
}
|
||||
if (callback) {
|
||||
for (i = 0; i < events.length; i++) {
|
||||
dom.on(events[i], fireCallBack);
|
||||
Timer=setTimeout(function(){
|
||||
clearTimeout(Timer);
|
||||
!called &&callback();
|
||||
},duration)
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
uuid: function() {
|
||||
var s = [];
|
||||
var hexDigits = "0123456789abcdef";
|
||||
for (var i = 0; i < 36; i++) {
|
||||
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
|
||||
}
|
||||
s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010
|
||||
s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
|
||||
s[8] = s[13] = s[18] = s[23] = "-";
|
||||
|
||||
var uuid = s.join("");
|
||||
return uuid;
|
||||
},
|
||||
isPercent: function(str) {
|
||||
/*return /^((\d+\.?\d*)|(\d*\.\d+))\%$/.test(str);*/
|
||||
return (typeof str == "string") ? ((str.indexOf("%") == -1) ? false : true) : false;
|
||||
},
|
||||
isRem: function(str) {
|
||||
// return /^((\d+\.?\d*rem)|(\d*\.\d+))*rem$/.test(str);
|
||||
return (typeof str == "string") ? ((str.indexOf("rem") == -1) ? false : true) : false;
|
||||
},
|
||||
isPx: function(str) {
|
||||
return (typeof str == "string") ? ((str.indexOf("px") == -1) ? false : true) : false;
|
||||
},
|
||||
removeAllSpace: function(str) {
|
||||
return str.replace(/\s+/g, "");
|
||||
},
|
||||
getNumber: function(str) {
|
||||
return str.match(/\d+(\.\d{0,2})?/)[0]
|
||||
}
|
||||
};
|
||||
|
||||
var deviceUtil = (function() {
|
||||
var UA = window.navigator.userAgent,
|
||||
win = window,
|
||||
isAndroid = /android|adr/gi.test(UA),
|
||||
isIOS = /iphone|ipod|ipad/gi.test(UA) && !isAndroid,
|
||||
isIPhone = win.navigator.appVersion.match(/iphone/gi),
|
||||
isMobile = isAndroid || isIOS,
|
||||
isSupportTouch = "ontouchend" in document ? true : false;
|
||||
return {
|
||||
tapEvent: isMobile && isSupportTouch ? 'touchstart' : 'click',
|
||||
isIPhone: isIPhone
|
||||
}
|
||||
})();
|
||||
|
||||
|
||||
|
||||
if (!$.fn.AnimationEnd) {
|
||||
$.fn.AnimationEnd = function(callback,duration) {
|
||||
var called=ExtraFunc.dealCssEvent.call(this, ['webkitAnimationEnd', 'animationend'], callback,duration);
|
||||
return this;
|
||||
};
|
||||
}
|
||||
if (!$.fn.outerWidth) {
|
||||
['width', 'height'].forEach(function(dimension) {
|
||||
var Dimension = dimension.replace(/./, function(m) {
|
||||
return m[0].toUpperCase();
|
||||
});
|
||||
$.fn['outer' + Dimension] = function(margin) {
|
||||
var elem = this;
|
||||
if (elem) {
|
||||
var size = elem[dimension]();
|
||||
var sides = {
|
||||
'width': ['left', 'right'],
|
||||
'height': ['top', 'bottom']
|
||||
};
|
||||
sides[dimension].forEach(function(side) {
|
||||
if (margin) size += parseInt(elem.css('margin-' + side), 10);
|
||||
});
|
||||
return size;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function titleRender(opts) {
|
||||
var title = "";
|
||||
if (!!opts.title) {
|
||||
if ($.isPlainObject(opts.title)) {
|
||||
title = '<div class="mDialog-layer-title ' + (!!opts.title.className ? opts.title.className : '') + '" style="' + (!!opts.title.style ? opts.title.style : '') + '">' + opts.title.text + '</div>'
|
||||
} else {
|
||||
title = '<div class="mDialog-layer-title">' + opts.title + '</div>';
|
||||
}
|
||||
}
|
||||
return title;
|
||||
}
|
||||
|
||||
function closeBtnRender(opts, indicator) {
|
||||
var $close = null;
|
||||
if (!!opts.closeBtn) {
|
||||
$close = $('<span class="mDialog-close"></span>');
|
||||
$close.on(deviceUtil.tapEvent, function() {
|
||||
|
||||
indicator.close();
|
||||
})
|
||||
}
|
||||
return $close;
|
||||
|
||||
};
|
||||
|
||||
function buttonRender(opts, type, indicator) {
|
||||
var $btnContainer = ($.isArray(opts.buttons) || type == "confirm") ? $('<div class="mDialog-layer-btns"></div>') : null,
|
||||
_this = this;
|
||||
if ($.isArray(opts.buttons) && !!opts.buttons.length) {
|
||||
$.each(opts.buttons, function(index, obj) {
|
||||
obj.class = !!obj.class ? obj.class : "";
|
||||
var $btn = $('<a href="javascript:void(0);" class="mDialog-btn ' + (obj.className ? obj.className : "") + '">' + obj.text + '</a>');
|
||||
if (!!obj.callback) {
|
||||
$btn.on(deviceUtil.tapEvent, function(event) {
|
||||
event.preventDefault();
|
||||
obj.callback.call(indicator);
|
||||
})
|
||||
}
|
||||
$btn.appendTo($btnContainer);
|
||||
});
|
||||
}
|
||||
return $btnContainer;
|
||||
};
|
||||
|
||||
function setElemPos($elem, opts, $title, $main, $footer) {
|
||||
//maxWidth、maxHeight 传递进来的值可能是 auto 80% 400px;
|
||||
//width、height 传递进来的值可能是 auto 80% 400px;
|
||||
|
||||
var elemW, elemH, winW, winH, realW, realH, maxW, maxH, offsetX, isOffsetX, offsetY, isOffsetY, titleH = 0,
|
||||
contentH = 0,
|
||||
footerH = 0,
|
||||
fullClassName = "mDialog-layer-main-full",
|
||||
dpr, isFull, mainH,
|
||||
standardRatio, //flexible 基准缩放比
|
||||
isFlexible = !!(document.documentElement.style.fontSize && document.body.style.fontSize),
|
||||
unitRemPx = isFlexible ? "rem" : "px";
|
||||
|
||||
winW = $(window).width();
|
||||
winH = $(window).height();
|
||||
dpr = document.documentElement.getAttribute('data-dpr');
|
||||
|
||||
|
||||
opts.offset[0] = (opts.offset[0] == "auto" || opts.offset[0] == "center") ? "auto" : ((opts.offset[0] == 0) ? "0px" : opts.offset[0].toLowerCase());
|
||||
opts.offset[1] = (opts.offset[1] == "auto" || opts.offset[1] == "center") ? "auto" : ((opts.offset[1] == 0) ? "0px" : opts.offset[1].toLowerCase());
|
||||
|
||||
isOffsetX = (opts.offset[0] == "auto") ? false : true;
|
||||
isOffsetY = (opts.offset[1] == "auto") ? false : true;
|
||||
|
||||
//进行宽度计算
|
||||
elemW = $elem.outerWidth();
|
||||
opts.maxWidth = !!opts.maxWidth ? ((opts.maxWidth == "auto") ? "85%" : opts.maxWidth) : "85%";
|
||||
maxW = ExtraFunc.isPx(opts.maxWidth) ? ExtraFunc.getNumber(opts.maxWidth) : winW * ExtraFunc.getNumber(opts.maxWidth) / 100;
|
||||
|
||||
//对于百分比(%) auto px 的时候进行宽度的计算,
|
||||
if (opts.width == "auto" || !opts.width) {
|
||||
realW = (elemW > maxW) ? maxW : elemW;
|
||||
standardRatio = (dpr == 1 && winW > 540) ? 540 : winW;
|
||||
} else if (ExtraFunc.isPercent(opts.width)) {
|
||||
realW = winW * ExtraFunc.getNumber(opts.width) / 100;
|
||||
if (realW > maxW) {
|
||||
realW = maxW;
|
||||
}
|
||||
standardRatio = (dpr == 1 && winW > 540) ? 540 : winW;
|
||||
|
||||
} else if (ExtraFunc.isPx(opts.width)) {
|
||||
realW = ExtraFunc.getNumber(opts.width);
|
||||
if (isFlexible) {
|
||||
if (realW > opts.baseViewWidth * ExtraFunc.getNumber(opts.maxWidth) / 100) {
|
||||
realW = maxW;
|
||||
standardRatio = (dpr == 1 && winW > 540) ? 540 : winW;
|
||||
} else {
|
||||
standardRatio = opts.baseViewWidth;
|
||||
}
|
||||
} else {
|
||||
realW = (realW > winW) ? maxW : realW;
|
||||
}
|
||||
}
|
||||
if (isFlexible) {
|
||||
realW = realW / standardRatio * 10;
|
||||
}
|
||||
if (isOffsetX) {
|
||||
if (ExtraFunc.isPx(opts.offset[0])) {
|
||||
offsetX = ExtraFunc.isPx(opts.offset[0]) ? ExtraFunc.getNumber(opts.offset[0]) : winW * ExtraFunc.getNumber(opts.offset[0]) / 100;
|
||||
isFlexible && (offsetX = offsetX / standardRatio * 10);
|
||||
$elem.css({
|
||||
left: offsetX + unitRemPx
|
||||
})
|
||||
} else if (ExtraFunc.isPercent(opts.offset[0])) {
|
||||
$elem.css({
|
||||
left: opts.offset[0],
|
||||
})
|
||||
} else if (opts.offset[0] == "left") {
|
||||
$elem.css({
|
||||
left: 0,
|
||||
})
|
||||
} else if (opts.offset[0] == "right") {
|
||||
$elem.css({
|
||||
right: 0,
|
||||
})
|
||||
} else {
|
||||
$elem.css({
|
||||
left: "50%",
|
||||
"marginLeft": -realW / 2 + unitRemPx
|
||||
})
|
||||
}
|
||||
|
||||
} else {
|
||||
$elem.css({
|
||||
left: "50%",
|
||||
"marginLeft": -realW / 2 + unitRemPx
|
||||
})
|
||||
}
|
||||
|
||||
$elem.css({
|
||||
width: realW + unitRemPx,
|
||||
})
|
||||
|
||||
|
||||
|
||||
elemH = $elem.outerHeight();
|
||||
opts.maxHeight = !!opts.maxHeight ? ((opts.maxHeight == "auto") ? "80%" : opts.maxHeight) : "80%";
|
||||
maxH = ExtraFunc.isPx(opts.maxHeight) ? ExtraFunc.getNumber(opts.maxHeight) : winH * ExtraFunc.getNumber(opts.maxHeight) / 100;
|
||||
|
||||
if (opts.height == "auto" || !opts.height) {
|
||||
realH = (elemH > maxH) ? maxH : elemH;
|
||||
standardRatio = (dpr == 1 && winW > 540) ? 540 : winW;
|
||||
} else if (ExtraFunc.isPercent(opts.height)) {
|
||||
realH = winH * ExtraFunc.getNumber(opts.height) / 100;
|
||||
if (realH > maxH) {
|
||||
realH = maxH;
|
||||
}
|
||||
standardRatio = (dpr == 1 && winW > 540) ? 540 : winW;
|
||||
} else if (ExtraFunc.isPx(opts.height)) {
|
||||
realH = ExtraFunc.getNumber(opts.height);
|
||||
if (isFlexible) {
|
||||
if (realH > opts.baseViewHeight * ExtraFunc.getNumber(opts.maxHeight) / 100) {
|
||||
realH = maxH;
|
||||
standardRatio = (dpr == 1 && winW > 540) ? 540 : winW;
|
||||
} else {
|
||||
standardRatio = opts.baseViewWidth;
|
||||
}
|
||||
} else {
|
||||
realH = (realH > maxH) ? maxH : realH;
|
||||
}
|
||||
}
|
||||
|
||||
!!$title && !!$title.length && (titleH = $title.outerHeight());
|
||||
!!$footer && !!$footer.length && (footerH = $footer.outerHeight());
|
||||
mainH = ((realH - titleH - footerH) > 0) ? (realH - titleH - footerH) : 0;
|
||||
|
||||
|
||||
|
||||
if (isFlexible) {
|
||||
realH = realH / standardRatio * 10;
|
||||
mainH = mainH / standardRatio * 10;
|
||||
}
|
||||
|
||||
|
||||
if ((realH > maxH) || elemH > realH) {
|
||||
$main.addClass(fullClassName);
|
||||
}
|
||||
if (opts.width == opts.height && opts.width == "100%") {
|
||||
$elem.addClass('mDialog-layer-container-full')
|
||||
}
|
||||
|
||||
$main.css({
|
||||
height: mainH + unitRemPx
|
||||
});
|
||||
$elem.css({
|
||||
height: realH + unitRemPx
|
||||
});
|
||||
|
||||
if (isOffsetY) {
|
||||
if (ExtraFunc.isPx(opts.offset[1])) {
|
||||
offsetY = ExtraFunc.isPx(opts.offset[1]) ? ExtraFunc.getNumber(opts.offset[1]) : winH * ExtraFunc.getNumber(opts.offset[1]) / 100;
|
||||
isFlexible && (offsetY = offsetY / standardRatio * 10);
|
||||
$elem.css({
|
||||
top: offsetY + unitRemPx,
|
||||
})
|
||||
} else if (ExtraFunc.isPercent(opts.offset[1])) {
|
||||
$elem.css({
|
||||
top: opts.offset[1],
|
||||
})
|
||||
} else if (opts.offset[1] == "top") {
|
||||
$elem.css({
|
||||
top: 0
|
||||
})
|
||||
} else if (opts.offset[1] == "bottom") {
|
||||
$elem.css({
|
||||
bottom: 0
|
||||
})
|
||||
} else {
|
||||
$elem.css({
|
||||
top: "50%",
|
||||
"marginTop": -realH / 2 + unitRemPx
|
||||
})
|
||||
}
|
||||
} else {
|
||||
$elem.css({
|
||||
top: "50%",
|
||||
"marginTop": -realH / 2 + unitRemPx
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
function setAnim($elem, animInClass, animOutClass, duration, type, callback) {
|
||||
var called = false;
|
||||
animInClass = !!animInClass ? animInClass : "";
|
||||
animOutClass = !!animOutClass ? animOutClass : "";
|
||||
switch (type) {
|
||||
case "in":
|
||||
$elem.css({ "animation-duration": duration + "ms" }).removeClass(animOutClass).addClass(animInClass);
|
||||
break;
|
||||
case "out":
|
||||
$elem.removeClass(animInClass).addClass(animOutClass);
|
||||
break;
|
||||
default:
|
||||
$elem.css({ "animation-duration": duration + "ms" }).removeClass(animOutClass).addClass(animInClass);
|
||||
}
|
||||
|
||||
$elem.AnimationEnd(function() {
|
||||
!!callback && callback.call();
|
||||
},duration)
|
||||
|
||||
}
|
||||
|
||||
var createClass = function(options, type) {
|
||||
this.opts = $.extend({}, mDialog.defaults, options);
|
||||
this.opts._type = type;
|
||||
this._init();
|
||||
};
|
||||
createClass.prototype._init = function() {
|
||||
this.opts.uid = ExtraFunc.uuid();
|
||||
mDialog.stack[this.opts.uid] = [];
|
||||
|
||||
if (!this.opts.duration) {
|
||||
this.opts.animIn = this.opts.animOut = false;
|
||||
}
|
||||
this._renderContainer();
|
||||
|
||||
if (!!this.opts.shade) {
|
||||
this._renderShade();
|
||||
}
|
||||
|
||||
}
|
||||
createClass.prototype._renderContainer = function() {
|
||||
var _this = this,
|
||||
opts = this.opts,
|
||||
containerStr = "", //容器
|
||||
title = "", //标题
|
||||
content = "", //内容
|
||||
|
||||
$container,
|
||||
$main,
|
||||
$closeBtn,
|
||||
$footerButton,
|
||||
|
||||
containerClassName = "mDialog-layer-container",
|
||||
mainClassName = "mDialog-layer-main",
|
||||
titleClassName = "mDialog-layer-title",
|
||||
|
||||
containerCloseHandle,
|
||||
contentCloseHandle;
|
||||
|
||||
|
||||
title = titleRender(opts);
|
||||
$closeBtn = closeBtnRender(opts, this);
|
||||
$footerButton = buttonRender(opts, this.opts, this);
|
||||
|
||||
if (!opts._type) {
|
||||
//如果没有type参数,那么说明 调用的方式是open()
|
||||
//判断 content的内容是不是页面的元素内容
|
||||
if (opts.content instanceof $ || $.zepto.isZ(opts.content)) {
|
||||
//如果内容是jquery 或者zepto 对象,实行把容器包起来
|
||||
$title = $(title);
|
||||
opts.content.css({
|
||||
visibility: "visible",
|
||||
display: "block",
|
||||
clear: "both"
|
||||
});
|
||||
opts.content.wrap('<div class="' + containerClassName + '"><div class="mDialog-layer-main"></div></div>');
|
||||
$main = opts.content.parent();
|
||||
$container = $main.parent();
|
||||
!!title && $container.prepend($title);
|
||||
contentCloseHandle = function() {
|
||||
$main.siblings().remove();
|
||||
opts.content.css({
|
||||
visibility: "hidden",
|
||||
display: "none",
|
||||
float: "none"
|
||||
});
|
||||
for (var i = 0; i < 2; i++) {
|
||||
opts.content.unwrap();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
content = '<div class="mDialog-default-section">' + opts.content + '</div>';
|
||||
|
||||
}
|
||||
} else {
|
||||
switch (opts._type) {
|
||||
case "load":
|
||||
content = '<div class="mDialog-loading-section' + (!opts.text ? ' loading-notext' : '') + '"><div class="loading-icon"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div>' + (!!opts.text ? (typeof opts.text == "string" ? '<p class="loading-txt">' + opts.text + '</p>' : '<p class="loading-txt">加载中...</p>') : '') + '</div>';
|
||||
break;
|
||||
case "comfirm":
|
||||
content = '<div class="mDialog-confirm-section">' + opts.content + '</div>';
|
||||
break;
|
||||
case "msg":
|
||||
content = '<div class="mDialog-msg-section">' + opts.content + '</div>';
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!$container) {
|
||||
containerStr = '<div class="' + containerClassName + '">' +
|
||||
title +
|
||||
'<div class="' + mainClassName + '">' +
|
||||
content +
|
||||
'</div>' +
|
||||
'</div>';
|
||||
$container = $(containerStr);
|
||||
$container.appendTo($('body'));
|
||||
|
||||
$title = $container.children('.' + titleClassName);
|
||||
$main = $container.children('.' + mainClassName);
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (!!opts.isPreventMove) {
|
||||
$container.on("touchmove", function(event) {
|
||||
event.preventDefault();
|
||||
})
|
||||
}
|
||||
|
||||
!!$closeBtn && $closeBtn.appendTo($container);
|
||||
!!$footerButton && $footerButton.appendTo($container);
|
||||
$container.css({ "zIndex": mDialog.zIndex + 1, "visibility": "visible" });
|
||||
containerCloseHandle = function() {
|
||||
if(!!opts.hasInput){
|
||||
$("html,body").css({"height":"auto","overflow":"visible"});
|
||||
$(window).scrollTop(opts.scrollTop);
|
||||
}
|
||||
|
||||
!!opts.onBeforeClose && opts.onBeforeClose();
|
||||
if (opts.animOut) {
|
||||
|
||||
setAnim($container, opts.animIn, opts.animOut, opts.duration, "out", function() {
|
||||
|
||||
!!contentCloseHandle && contentCloseHandle();
|
||||
$container.remove();
|
||||
opts.onClose();
|
||||
});
|
||||
} else {
|
||||
setTimeout(function() {
|
||||
!!contentCloseHandle && contentCloseHandle();
|
||||
$container.remove();
|
||||
opts.onClose();
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
setElemPos($container, opts, $title, $main, $footerButton);
|
||||
|
||||
!!opts.onBeforeShow && opts.onBeforeShow();
|
||||
$container.css({ "zIndex": mDialog.zIndex + 1, "visibility": "visible" });
|
||||
if (opts.animIn) {
|
||||
setAnim($container, opts.animIn, opts.animOut, opts.duration, "in", function() {
|
||||
opts.onShow();
|
||||
!!opts.pause && setTimeout(function() {
|
||||
_this.close();
|
||||
|
||||
}, opts.pause)
|
||||
});
|
||||
} else {
|
||||
!!opts.onShow && opts.onShow();
|
||||
!!opts.pause && setTimeout(function() {
|
||||
_this.close();
|
||||
|
||||
}, opts.pause)
|
||||
}
|
||||
if(!!opts.hasInput){
|
||||
opts.scrollTop=$(window).scrollTop();
|
||||
$("html,body").css({"height":"100%","overflow":"hidden"});
|
||||
}
|
||||
$container.removeSelf = containerCloseHandle;
|
||||
mDialog.stack[this.opts.uid].push($container);
|
||||
};
|
||||
|
||||
createClass.prototype._renderShade = function() {
|
||||
//opts.shade=true 如果需要遮罩
|
||||
var _this = this,
|
||||
opts = this.opts,
|
||||
defaultOpacity = 0.75,
|
||||
defaultColor = "#000",
|
||||
shadeCloseHandle = $.noop(),
|
||||
styles = {
|
||||
"animation-duration": this.opts.duration + "ms",
|
||||
"zIndex": mDialog.zIndex,
|
||||
},
|
||||
$shade = $('<div class="mDialog-shade in"></div>');
|
||||
//如果是{color:"",opacity:""} 传入的是颜色和透明值
|
||||
ropacity = (!!opts.shade.opacity || opts.shade.opacity == 0) ? opts.shade.opacity : defaultOpacity;
|
||||
rcolor = !!opts.shade.bgColor ? opts.shade.bgColor : defaultColor;
|
||||
styles["background-color"] = ExtraFunc.colorToRgba(rcolor, ropacity);
|
||||
|
||||
|
||||
shadeCloseHandle = function() {
|
||||
if (!!opts.duration) {
|
||||
!!$shade && $shade.removeClass("in").addClass('out');
|
||||
$shade.AnimationEnd(function() {
|
||||
$shade.remove();
|
||||
},opts.duration)
|
||||
} else {
|
||||
$shade.remove();
|
||||
}
|
||||
}
|
||||
|
||||
if (this.opts.shadeClose) {
|
||||
//如果需要点击关闭遮罩层, 遮罩要关闭,主体要关闭
|
||||
$shade.removeSelf = shadeCloseHandle;
|
||||
$shade.on(deviceUtil.tapEvent, function(event) {
|
||||
event.stopPropagation();
|
||||
_this.close();
|
||||
});
|
||||
} else {
|
||||
$shade.on(deviceUtil.tapEvent, function(event) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
$shade.on("touchmove", function(event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
})
|
||||
}
|
||||
$shade.css(styles);
|
||||
|
||||
if (opts._type == "load") {
|
||||
|
||||
$shade.removeSelfOnlyFinal = shadeCloseHandle;
|
||||
}
|
||||
$shade.appendTo($("body"));
|
||||
mDialog.stack[this.opts.uid].push($shade);
|
||||
};
|
||||
|
||||
|
||||
|
||||
/******************************************************************/
|
||||
/**
|
||||
* *
|
||||
* 通过调用 mDialog.close() 来关闭
|
||||
*/
|
||||
createClass.prototype.close = function(index) {
|
||||
|
||||
var _this = this;
|
||||
sindex = !!index ? index : this.opts.uid;
|
||||
$.each(mDialog.stack[sindex], function(index, obj) {
|
||||
!!obj.removeSelf ? obj.removeSelf() : (!!obj.removeSelfOnlyFinal && obj.removeSelfOnlyFinal());
|
||||
if (index == mDialog.stack[sindex].length - 1) {
|
||||
delete mDialog.stack[sindex];
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
mDialog.open = function(options, type) {
|
||||
mDialog.zIndex++;
|
||||
var o = new createClass(options, type);
|
||||
return o;
|
||||
};
|
||||
|
||||
mDialog.load = function(opts) {
|
||||
//load加载弹出框 不需要 title(标题) 关闭按钮(closeBnt) button(按钮组)
|
||||
//参数 是否显示遮罩 是否显示文字
|
||||
var options = !!$.isPlainObject(opts) ? opts : {};
|
||||
options.title = false;
|
||||
options.closeBtn = false;
|
||||
options.buttons = false;
|
||||
options.text = options.text === undefined ? true : (!!options.text ? options.text : false);
|
||||
return mDialog.open(options, "load");
|
||||
};
|
||||
mDialog.confirm = function(opts) {
|
||||
var options = !!$.isPlainObject(opts) ? opts : {};
|
||||
options.closeBtn = false;
|
||||
options.animIn = !!opts.animIn ? opts.animIn : "mDialogBigIn";
|
||||
options.animOut = !!opts.animOut ? opts.animOut : "mDialogBigOut";
|
||||
options.duration = !!opts.duration ? opts.duration : 150;
|
||||
options.width = !!opts.width ? opts.width : "80%";
|
||||
options.buttons = ($.isArray(opts.buttons) && !!opts.buttons.length) ? opts.buttons : [{
|
||||
text: "取消",
|
||||
callback: function() {
|
||||
this.close();
|
||||
}
|
||||
},
|
||||
{
|
||||
text: "确认",
|
||||
callback: !!opts.yes ? opts.yes : function() {}
|
||||
}
|
||||
]
|
||||
return mDialog.open(options, "comfirm")
|
||||
};
|
||||
mDialog.msg = function(opts) {
|
||||
var options = !!$.isPlainObject(opts) ? opts : {};
|
||||
options.closeBtn = false;
|
||||
options.shade = !!opts.shade ? opts.shade : false;
|
||||
options.pause = !!opts.pause ? opts.pause : 2000;
|
||||
return mDialog.open(options, "msg")
|
||||
};
|
||||
mDialog.close = function(obj) {
|
||||
obj.close();
|
||||
};
|
||||
mDialog.closeAll = function() {
|
||||
$.each(mDialog.stack, function(index1, obj1) {
|
||||
$.each(obj1, function(index2, obj2) {
|
||||
obj2.removeSelf();
|
||||
if (index2 == mDialog.stack[index1].length - 1) {
|
||||
delete mDialog.stack[index1];
|
||||
}
|
||||
})
|
||||
});
|
||||
};
|
||||
window.mDialog = mDialog;
|
||||
})(window.jQuery || window.Zepto, window, document);
|
||||
Vendored
+13
File diff suppressed because one or more lines are too long
Vendored
+14
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Vendored
+7
File diff suppressed because one or more lines are too long
@@ -0,0 +1,159 @@
|
||||
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||
typeof define === 'function' && define.amd ? define(factory) :
|
||||
(global.MugenScroll = factory());
|
||||
}(this, (function () { 'use strict';
|
||||
|
||||
var _throttleit_1_0_0_throttleit = throttle;
|
||||
|
||||
/**
|
||||
* Returns a new function that, when invoked, invokes `func` at most once per `wait` milliseconds.
|
||||
*
|
||||
* @param {Function} func Function to wrap.
|
||||
* @param {Number} wait Number of milliseconds that must elapse between `func` invocations.
|
||||
* @return {Function} A new function that wraps the `func` function passed in.
|
||||
*/
|
||||
|
||||
function throttle (func, wait) {
|
||||
var ctx, args, rtn, timeoutID; // caching
|
||||
var last = 0;
|
||||
|
||||
return function throttled () {
|
||||
ctx = this;
|
||||
args = arguments;
|
||||
var delta = new Date() - last;
|
||||
if (!timeoutID)
|
||||
{ if (delta >= wait) { call(); }
|
||||
else { timeoutID = setTimeout(call, wait - delta); } }
|
||||
return rtn;
|
||||
};
|
||||
|
||||
function call () {
|
||||
timeoutID = 0;
|
||||
last = +new Date();
|
||||
rtn = func.apply(ctx, args);
|
||||
ctx = null;
|
||||
args = null;
|
||||
}
|
||||
}
|
||||
|
||||
var index = function (element, ref) {
|
||||
if ( ref === void 0 ) { ref = {}; }
|
||||
var offset = ref.offset; if ( offset === void 0 ) { offset = 0; }
|
||||
var threshold = ref.threshold; if ( threshold === void 0 ) { threshold = 0; }
|
||||
|
||||
var ref$1 = element.getBoundingClientRect();
|
||||
var top = ref$1.top;
|
||||
var right = ref$1.right;
|
||||
var bottom = ref$1.bottom;
|
||||
var left = ref$1.left;
|
||||
var width = ref$1.width;
|
||||
var height = ref$1.height;
|
||||
|
||||
var intersection = {
|
||||
t: bottom,
|
||||
r: window.innerWidth - left,
|
||||
b: window.innerHeight - top,
|
||||
l: right
|
||||
};
|
||||
|
||||
var elementThreshold = {
|
||||
x: threshold * width,
|
||||
y: threshold * height
|
||||
};
|
||||
|
||||
return (
|
||||
intersection.t >= (offset.top || offset + elementThreshold.y) &&
|
||||
intersection.r >= (offset.right || offset + elementThreshold.x) &&
|
||||
intersection.b >= (offset.bottom || offset + elementThreshold.y) &&
|
||||
intersection.l >= (offset.left || offset + elementThreshold.x)
|
||||
)
|
||||
};
|
||||
|
||||
var elementInView_common = index;
|
||||
|
||||
var triggers = ['scroll', 'resize'];
|
||||
|
||||
var MugenScroll = {
|
||||
name: 'mugen-scroll',
|
||||
props: {
|
||||
handler: {
|
||||
type: Function,
|
||||
required: true
|
||||
},
|
||||
shouldHandle: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
threshold: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
handleOnMount: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
scrollContainer: {
|
||||
type: String
|
||||
}
|
||||
},
|
||||
mounted: function mounted() {
|
||||
this.checkInView();
|
||||
},
|
||||
methods: {
|
||||
checkInView: function checkInView() {
|
||||
var this$1 = this;
|
||||
|
||||
var execute = function () {
|
||||
var inView = elementInView_common(this$1.$refs.scroll, {
|
||||
threshold: this$1.threshold
|
||||
});
|
||||
if (this$1.shouldHandle && inView) {
|
||||
this$1.handler();
|
||||
}
|
||||
};
|
||||
|
||||
// checkInView right after this component is mounted
|
||||
if (this.handleOnMount) {
|
||||
execute();
|
||||
}
|
||||
|
||||
if (this.scrollContainer) {
|
||||
var parent = this;
|
||||
while ((parent = parent.$parent) && !this._scrollContainer) {
|
||||
this$1._scrollContainer = parent.$refs[this$1.scrollContainer];
|
||||
}
|
||||
// Ensure it's html element (ref could be component)
|
||||
if (this._scrollContainer && this._scrollContainer.$el) {
|
||||
this._scrollContainer = this._scrollContainer.$el;
|
||||
}
|
||||
}
|
||||
|
||||
this._scrollContainer = this._scrollContainer || window;
|
||||
|
||||
// Add event listeners
|
||||
this.check = _throttleit_1_0_0_throttleit(execute, 200);
|
||||
triggers.forEach(function (event) { return this$1._scrollContainer.addEventListener(event, this$1.check); });
|
||||
}
|
||||
},
|
||||
render: function render(h) {
|
||||
return h('div', {
|
||||
staticClass: 'mugen-scroll',
|
||||
ref: 'scroll'
|
||||
}, this.$slots.default)
|
||||
},
|
||||
beforeDestroy: function beforeDestroy() {
|
||||
var this$1 = this;
|
||||
|
||||
triggers.forEach(function (event) { return this$1._scrollContainer.removeEventListener(event, this$1.check); });
|
||||
}
|
||||
};
|
||||
|
||||
if (typeof window !== 'undefined' && window.Vue) {
|
||||
window.Vue.component(MugenScroll.name, MugenScroll);
|
||||
}
|
||||
|
||||
return MugenScroll;
|
||||
|
||||
})));
|
||||
Vendored
+6
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user