admin_topics_316

This commit is contained in:
dengbw
2023-03-16 15:52:44 +08:00
parent 670489a89b
commit fd76e114fc
4 changed files with 137 additions and 19 deletions
+31 -9
View File
@@ -28,6 +28,7 @@ Class Topics extends AppBase
$this->load->model('topics/topic_module_button_model', 'mdModuleButton');
$this->load->model('topics/topic_user_log_model', 'mdUserLog');
$this->load->model("sys/sys_admin_model", 'mdSysAdmin');
$this->load->model('receiver/receiver_clues_cfrom_model', 'mdCluesCfrom');
}
/**
@@ -346,12 +347,22 @@ Class Topics extends AppBase
if (!$re || empty($re)) {
return $this->show_json(SYS_CODE_FAIL, '专题不存在!');
}
$re['bg_img_url'] = build_qiniu_image_url($re['bg_img']);
$info = $re;
$json = $info['jsondata'] ? json_decode($info['jsondata'], true) : '';
$info['cf_id'] = $json['cf_id'] ? $json['cf_id'] : "";
$info['mp_app_id'] = $json['mp_app_id'] ? $json['mp_app_id'] : "";
$info['ebiz'] = $json['ebiz'] ? $json['ebiz'] : "";
if ($re['cf_id']) {
$re_cf = $this->mdCluesCfrom->get(['id' => $re['cf_id']]);
if ($re_cf) {
if ($re_cf['pid'] == 0) {
$info['cfrom_id'] = $re_cf['id'];
$info['cfrom_id2'] = 0;
} else {
$info['cfrom_id'] = $re_cf['pid'];
$info['cfrom_id2'] = $re_cf['id'];
}
}
}
$jsonData = $info['jsondata'] ? json_decode($info['jsondata'], true) : '';
$info['bg_img_url'] = $re['bg_img'] ? build_qiniu_image_url($re['bg_img']) : '';
$info['share_img_url'] = $jsonData['share_img'] ? build_qiniu_image_url($jsonData['share_img']) : '';
$_title = '编辑专题';
$edit_url = '/topics/topics/edit';
} else {
@@ -359,9 +370,9 @@ Class Topics extends AppBase
$edit_url = '/topics/topics/add';
$info['id'] = $id;
$info['app_id'] = $app_id;
$info['cf_id'] = "";
$info['mp_app_id'] = "";
$info['ebiz'] = 0;
$info['share_img_url'] = '';
$info['cfrom_id'] = 0;
$info['cfrom_id2'] = 0;
}
$info['spm'] = $this->input->get('spm');
$info['edit_url'] = $edit_url;
@@ -384,13 +395,18 @@ Class Topics extends AppBase
}
$bg_color = $this->input->post('bg_color');
$bg_img = $this->input->post('bg_img');
$share_img = $this->input->post('share_img');
$cfrom_id = intval($this->input->post('cfrom_id'));
$cfrom_id2 = intval($this->input->post('cfrom_id2'));
$jsonData['share_img'] = $share_img ? $share_img : '';
$dataItems['app_id'] = $app_id;
$dataItems['title'] = $title;
$dataItems['bg_color'] = $bg_color;
$dataItems['bg_img'] = $bg_img;
$dataItems['status'] = 1;
$dataItems['c_time'] = time();
$dataItems['cf_id'] = $cfrom_id2 ? $cfrom_id2 : $cfrom_id;
$dataItems['jsondata'] = json_encode($jsonData, JSON_UNESCAPED_UNICODE);
$id = $this->mdTopics->add($dataItems);
if (!$id) {
return $this->show_json(SYS_CODE_FAIL, '添加失败');
@@ -410,9 +426,15 @@ Class Topics extends AppBase
}
$bg_color = $this->input->post('bg_color');
$bg_img = $this->input->post('bg_img');
$share_img = $this->input->post('share_img');
$cfrom_id = intval($this->input->post('cfrom_id'));
$cfrom_id2 = intval($this->input->post('cfrom_id2'));
$jsonData['share_img'] = $share_img ? $share_img : '';
$dataItems['title'] = $title;
$dataItems['bg_color'] = $bg_color;
$dataItems['bg_img'] = $bg_img;
$dataItems['cf_id'] = $cfrom_id2 ? $cfrom_id2 : $cfrom_id;
$dataItems['jsondata'] = json_encode($jsonData, JSON_UNESCAPED_UNICODE);
$re = $this->mdTopics->update($dataItems, array('id' => $id));
if (!$re) {
return $this->show_json(SYS_CODE_FAIL, '修改失败');
+91
View File
@@ -38,6 +38,44 @@
</div>
</div>
</div>
</div>
<div class="form-group row" id="vue-cfrom">
<label for="" class="col-sm-1 control-label" style="line-height:32px;"></label>
<div class="col-sm-2" style="padding-right: 6px;">
<div class="input-group">
<div class="input-group-addon">线索来源</div>
<select class="form-control" name="cfrom_id" v-model="cfrom_id">
<option value=0>请选择</option>
<template v-for="(v,i) in cfroms">
<option :value="v.id">{{v.title}}</option>
</template>
</select>
</div>
</div>
<div class="col-sm-2" style="padding-left: 0px;">
<select class="form-control" name="cfrom_id2" v-model="cfrom_id2">
<option value=0>请选择</option>
<template v-for="(v,i) in cfroms2">
<option :value="v.id">{{v.title}}</option>
</template>
</select>
</div>
<div class="col-sm-2">
<div class="input-group">
<div class="am-form-group am-form-file">
<button type="button" class="am-btn am-btn-default am-btn-sm"
data-file="1" data-type="jpg,png,gif,png,jpeg"
data-uptype="qiniu" data-field="share_img"><i class="am-icon-cloud-upload"></i> 分享图<span
style="color: blue">(宽750)</span>
</button>
<input type="hidden" name="share_img" id="share_img"
onchange="$(this).next('img').attr('src', $(this).data('srcs') || this.value)"
value="<?= $info['share_img'] ?>" class="layui-input">
<img data-tips-image style="height:auto;max-height:32px;min-width:32px"
src="<?= $info['share_img_url'] ?>"/>
</div>
</div>
</div>
<div class="col-sm-2">
<div class="input-group">
<button class="btn btn-primary" type="submit">保存</button>
@@ -46,6 +84,59 @@
</div>
</form>
</div>
<script>
$(function () {
vue_obj = new Vue({
el: '#vue-cfrom',
data: {
cfrom_id:<?=$info['cfrom_id'] ? $info['cfrom_id'] : 0?>,
cfrom_id2:<?=$info['cfrom_id2'] ? $info['cfrom_id2'] : 0?>,
cfroms: [],
cfroms2: [],
},
mounted: function () {
this.getCfroms();
},
methods: {
getCfroms: function () {
var that = this;
$.get('/receiver/clues/get_cfroms', function (result) {
that.cfroms = result.data.data
});
if (that.cfrom_id > 0) {
$.get('/receiver/clues/get_cfroms', {'id': that.cfrom_id}, function (result) {
that.cfroms2 = result.data.data
});
}
}
},
watch: {
'cfrom_id': function (nv, ov) {
var that = this;
if (nv == '') {
that.cfrom_id2 = 0;
that.cfroms = [];
} else {
$.get('/receiver/clues/get_cfroms', {'id': nv}, function (result) {
that.cfroms2 = result.data.data;
if (that.cfrom_id2 > 0) {
var cfrom_id2 = '0';
for (var i in that.cfroms) {
var county = that.cfroms[i];
if (county.id == that.cfrom_id2) {
cfrom_id2 = county.id;
break;
}
}
that.cfrom_id2 = cfrom_id2;
}
});
}
}
}
});
});
</script>
<? if ($info['id'] > 0) { ?>
<div id="vue-app">
<div class="app-design clearfix">
+9 -9
View File
@@ -161,20 +161,20 @@
<label for="" class="col-sm-2 control-label"></label>
<div class="col-sm-6">
<div class="input-group">
<div class="input-group-addon">{{params.app_id==6 ? 'h5跳转链接': '跳转链接'}}</div>
<div class="input-group-addon">跳转链接</div>
<input type="text" class="form-control" v-model="params.module_jsondata.url"/>
</div>
</div>
</div>
<div class="form-group" v-if="params.app_id==6">
<label for="" class="col-sm-2 control-label"></label>
<div class="col-sm-8">
<div class="input-group">
<div class="input-group-addon">小程序跳转链接</div>
<input type="text" class="form-control" v-model="params.module_jsondata.url_mini"/>
</div>
</template>
<div class="form-group">
<label for="" class="col-sm-2 control-label"></label>
<div class="col-sm-6">
<div class="input-group">
<div class="input-group-addon">提示文案</div>
<input type="text" class="form-control" v-model="params.module_jsondata.prompt"/>
</div>
</div>
</template>
</div>
</div>
</template>
+6 -1
View File
@@ -130,17 +130,22 @@ class Topics extends Wxapp
'img' => $jsondata['img'] ? build_qiniu_image_url($jsondata['img']) : '',
'color' => $jsondata['color'] ? $jsondata['color'] : '',
'descrip' => $module['descrip'] ? $module['descrip'] : '',
'prompt' => $jsondata['prompt'] ? $jsondata['prompt'] : '',
];
break;
default:
}
}
}
$jsonData = $re['jsondata'] ? json_decode($re['jsondata'], true) : '';
$share_img = $jsonData['share_img'] ? build_qiniu_image_url($jsonData['share_img']) : '';
$bg_img = $re['bg_img'] ? build_qiniu_image_url($re['bg_img']) : '';
$data = [
'id' => $re['id'],
'title' => $re['title'],
'bg_img' => build_qiniu_image_url($re['bg_img']),
'bg_img' => $bg_img,
'bg_color' => $re['bg_color'],
'share_img' => $share_img,
'list' => $list,
'mButton' => $mButton
];