edit-admin-liche-cms

This commit is contained in:
lccsw
2021-08-25 19:02:16 +08:00
parent b5b90d42c2
commit c047cc9bf6
2 changed files with 42 additions and 5 deletions
+24 -3
View File
@@ -71,7 +71,19 @@ class Cms extends HD_Controller
$row['btn_type'] = $json['btn_type'] ? $json['btn_type'] : 1;
$row['bg_img'] = $json['bg_img'] ? $json['bg_img'] : '';
$row['bg_img_src'] = $json['bg_img'] ? build_qiniu_image_url($json['bg_img']) : '';
$row['cfrom_id'] = $json['cfrom_id'] ? $json['cfrom_id']:0;
$cfrom_id2 = $cfrom_id = 0;
if($json['cfrom_id']){
$c_row = $this->clues_cfrom_model->get(['id'=>$json['cfrom_id']],'id,pid');
if($c_row['pid']){
$f_row = $this->clues_cfrom_model->get(['id'=>$c_row['pid']],'id');
$cfrom_id = $f_row['id'];
$cfrom_id2 = $c_row['id'];
}else{
$cfrom_id = $json['cfrom_id'];
}
}
$row['cfrom_id'] = $cfrom_id;
$row['cfrom_id2'] = $cfrom_id2;
$row['link'] = $row['url'];
$row['s_time'] = date('Y-m-d H:i:s', $row['s_time']);
$row['e_time'] = date('Y-m-d H:i:s', $row['e_time']);
@@ -79,13 +91,13 @@ class Cms extends HD_Controller
$title = "编辑{$row['title']}";
} else {
$row = array('position' => '', 'type' => 1,'btn_type'=>1,'cfrom_id' => 0);
$row = array('position' => '', 'type' => 1,'btn_type'=>1,'cfrom_id' => 0,'cfrom_id2'=>0);
$opration = 'add';
$title = '添加推送信息';
$covers = array();
}
//列表
$this->data['cfroms'] = $this->clues_cfrom_model->select(['status'=>1],'id desc','','','id,title');
$this->data['cfroms'] = $this->clues_cfrom_model->select(['status'=>1,'pid'=>0],'id desc','','','id,title');
$this->data['app_id'] = 3;
$this->data['info'] = $row;
$this->data['pos_arr'] = $this->pos_arr;
@@ -125,6 +137,7 @@ class Cms extends HD_Controller
$json = array();
$input['cfrom_id'] && $json['cfrom_id'] = $input['cfrom_id'];
$input['cfrom_id2'] && $json['cfrom_id'] = $input['cfrom_id2'];
$input['btn_type'] && $json['btn_type'] = $input['btn_type'];
$input['bg_img'] && $json['bg_img'] = $input['bg_img'];
if($json){
@@ -158,6 +171,7 @@ class Cms extends HD_Controller
$input['btn_type'] && $json['btn_type'] = $input['btn_type'];
$input['bg_img'] && $json['bg_img'] = $input['bg_img'];
$input['cfrom_id'] && $json['cfrom_id'] = $input['cfrom_id'];
$input['cfrom_id2'] && $json['cfrom_id'] = $input['cfrom_id2'];
$upd = [
'title' => $input['title'] ? $input['title'] : '',
'url' => $input['link'] ? $input['link'] : '',
@@ -210,4 +224,11 @@ class Cms extends HD_Controller
$this->data['data'] = $info;
return $this->show_json(SYS_CODE_SUCCESS);
}
public function get_cfroms(){
$id = $this->input->get('id');
$rows = $this->clues_cfrom_model->select(['pid'=>$id,'status'=>1],'id desc','','','id,title');
$this->data['data'] = $rows;
return $this->show_json(SYS_CODE_SUCCESS);
}
}
+18 -2
View File
@@ -45,13 +45,19 @@
</div>
<div class="am-form-group" v-if="info.position == 2">
<label class="am-para-label">线索来源:</label>
<div class="am-para-input wp60" style="width:20%">
<select name="cfrom_id" v-model="info.cfrom_id">
<div class="am-para-input wp60">
<select name="cfrom_id" v-model="info.cfrom_id" style="width:150px;display:inline" @change="getCfroms()">
<option value=0>请选择</option>
<template v-for="(v,i) in cfroms">
<option :value="v.id">{{v.title}}</option>
</template>
</select>
<select name="cfrom_id2" v-model="info.cfrom_id2" style="width:150px;display:inline">
<option value=0>请选择</option>
<template v-for="(v,i) in cfroms2">
<option :value="v.id">{{v.title}}</option>
</template>
</select>
</div>
</div>
<div class="am-form-group" v-if="info.position >2 && info.position<8">
@@ -356,6 +362,7 @@
covers:[],
app_id:0,
cfroms:[],
cfroms2:[],
},
mounted: function(){
var that = this;
@@ -365,8 +372,17 @@
that.covers = <?=json_encode($covers, JSON_UNESCAPED_UNICODE)?>;
that.app_id = <?=$app_id?>;
that.cfroms = <?=$cfroms ? json_encode($cfroms,JSON_UNESCAPED_UNICODE): []?>;
that.getCfroms()
},
methods: {
getCfroms: function(){
var that = this
if(that.info.cfrom_id){
$.get('/app/liche/cms/get_cfroms',{'id':that.info.cfrom_id},function(result){
that.cfroms2 = result.data.data
});
}
},
saveEdit: function () {
if (loading) {
return;