admin_material_1015
This commit is contained in:
@@ -74,16 +74,23 @@ class Template extends HD_Controller
|
||||
$id = $this->input->get('id');
|
||||
$info['app_id'] = intval($this->input->get('app_id'));
|
||||
$info['status'] = 1;
|
||||
$info['type'] = 1;
|
||||
$info['type'] = 4;
|
||||
$info['cover'] = array('value' => '', 'src' => '');
|
||||
$brands = $tgsp_list = $lbhb_list = $pyqwa_list = array();
|
||||
$info['moments'] = '';
|
||||
$json_lists = $json_item = $brands = $pyqwa_list = array();
|
||||
foreach ($this->mdTemplate->typeAry() as $key => $value) {
|
||||
$json_lists[$key] = array();
|
||||
$json_item[$key] = array();
|
||||
}
|
||||
if ($id) {
|
||||
$re = $this->mdTemplate->get(array('id' => $id));
|
||||
if (!$re || empty($re)) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '模板不存在!');
|
||||
}
|
||||
$moments = '';
|
||||
if ($re['json_data']) {
|
||||
$json_data = json_decode($re['json_data'], true);
|
||||
$json_data['moments'] && $moments = $json_data['moments'];
|
||||
$lists = array();
|
||||
foreach ($json_data['lists'] as $key => $value) {
|
||||
if ($re['type'] == 1) {
|
||||
@@ -96,7 +103,7 @@ class Template extends HD_Controller
|
||||
$value['img_url'] = $value['img'] ? build_qiniu_image_url($value['img']) : '';
|
||||
$value['video_file_url'] = $value['video_url'] = $value['video_cover'] = '';
|
||||
}
|
||||
} else if ($re['type'] == 2) {
|
||||
} else if ($re['type'] == 2 || $re['type'] == 4) {
|
||||
$value['img_url'] = $value['img'] ? build_qiniu_image_url($value['img']) : '';
|
||||
} else if ($re['type'] == 3) {
|
||||
if ($value['brands']) {
|
||||
@@ -108,15 +115,18 @@ class Template extends HD_Controller
|
||||
$lists[] = $value;
|
||||
}
|
||||
if ($re['type'] == 1) {
|
||||
$tgsp_list = $lists;
|
||||
$json_lists[1] = $lists;
|
||||
} else if ($re['type'] == 2) {
|
||||
$lbhb_list = $lists;
|
||||
$json_lists[2] = $lists;
|
||||
} else if ($re['type'] == 3) {
|
||||
$pyqwa_list = $lists;
|
||||
} else if ($re['type'] == 4) {
|
||||
$json_lists[4] = $lists;
|
||||
}
|
||||
unset($re['json_data']);
|
||||
}
|
||||
$info = $re;
|
||||
$info['moments'] = $moments;
|
||||
$info['cover'] = $info['cover'] ? array('value' => $info['cover'], 'src' => build_qiniu_image_url($info['cover']))
|
||||
: array('value' => '', 'src' => '');
|
||||
if ($info['brand_ids']) {
|
||||
@@ -132,9 +142,9 @@ class Template extends HD_Controller
|
||||
$showInfo['statusAry'] = $this->mdTemplate->statusAry();
|
||||
$showInfo['typeAry'] = $this->mdTemplate->typeAry();
|
||||
$showInfo['brands'] = $brands;
|
||||
$showInfo['tgsp_list'] = $tgsp_list;
|
||||
$showInfo['lbhb_list'] = $lbhb_list;
|
||||
$showInfo['pyqwa_list'] = $pyqwa_list;
|
||||
$showInfo['json_lists'] = $json_lists;
|
||||
$showInfo['json_item'] = $json_item;
|
||||
$this->data['info'] = $info;
|
||||
$this->data['showInfo'] = $showInfo;
|
||||
$this->data['edit_url'] = $edit_url;
|
||||
@@ -175,8 +185,8 @@ class Template extends HD_Controller
|
||||
$brand_ids .= ',0';
|
||||
}
|
||||
}
|
||||
$json_data['moments'] = $info['moments'];
|
||||
if ($info['lists']) {
|
||||
$json_data = $info['json_data'];
|
||||
$lists = array();
|
||||
foreach ($info['lists'] as $key => $value) {
|
||||
if ($info['type'] == 1) {
|
||||
@@ -188,7 +198,7 @@ class Template extends HD_Controller
|
||||
unset($value['video_url']);
|
||||
unset($value['video_cover']);
|
||||
unset($value['img_url']);
|
||||
} else if ($info['type'] == 2) {
|
||||
} else if ($info['type'] == 2 || $info['type'] == 4) {
|
||||
unset($value['img_url']);
|
||||
} else if ($info['type'] == 3) {
|
||||
$brands = '';
|
||||
@@ -201,8 +211,8 @@ class Template extends HD_Controller
|
||||
$lists[] = $value;
|
||||
}
|
||||
$json_data['lists'] = $lists;
|
||||
$editData['json_data'] = json_encode($json_data, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
$editData['json_data'] = json_encode($json_data, JSON_UNESCAPED_UNICODE);
|
||||
$editData['app_id'] = $info['app_id'];
|
||||
$editData['title'] = $info['title'];
|
||||
$editData['cover'] = $info['cover']['value'];
|
||||
@@ -232,16 +242,20 @@ class Template extends HD_Controller
|
||||
$brand_ids .= ',0';
|
||||
}
|
||||
}
|
||||
$json_data['moments'] = $info['moments'];
|
||||
if ($info['lists']) {
|
||||
$json_data = $info['json_data'];
|
||||
$lists = array();
|
||||
foreach ($info['lists'] as $key => $value) {
|
||||
if ($info['type'] == 1) {
|
||||
$value['video'] = $value['video_file_url'];
|
||||
if ($value['video_type'] == 1) {
|
||||
$value['video'] = $value['video_file_url'];
|
||||
unset($value['img']);
|
||||
}
|
||||
unset($value['video_file_url']);
|
||||
unset($value['video_url']);
|
||||
unset($value['video_cover']);
|
||||
} else if ($info['type'] == 2) {
|
||||
unset($value['img_url']);
|
||||
} else if ($info['type'] == 2 || $info['type'] == 4) {
|
||||
unset($value['img_url']);
|
||||
} else if ($info['type'] == 3) {
|
||||
$brands = '';
|
||||
@@ -254,8 +268,8 @@ class Template extends HD_Controller
|
||||
$lists[] = $value;
|
||||
}
|
||||
$json_data['lists'] = $lists;
|
||||
$editData['json_data'] = json_encode($json_data, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
$editData['json_data'] = json_encode($json_data, JSON_UNESCAPED_UNICODE);
|
||||
$editData['title'] = $info['title'];
|
||||
$editData['cover'] = $info['cover']['value'];
|
||||
$editData['type'] = $info['type'];
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<div id="vue-edit" class="am-form am-form-horizontal" style="width: 100%;padding: 10px">
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">模版名称:</label>
|
||||
<div class="am-para-input" style="width: 50%"><input type="text" placeholder="模版名称" v-model="info.title"/></div>
|
||||
<div class="am-para-input" style="width: 60%"><input type="text" placeholder="模版名称" v-model="info.title"/></div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">状态:</label>
|
||||
@@ -31,7 +31,9 @@
|
||||
<label class="am-para-label">模版分类:</label>
|
||||
<div class="am-para-input" style="width: 15%">
|
||||
<select v-model="info.type">
|
||||
<option :value="i" v-for="(v,i) in showInfo.typeAry">{{v}}</option>
|
||||
<?php foreach ($showInfo['typeAry'] as $key => $value) { ?>
|
||||
<option value="<?= $key ?>"><?= $value ?></option>
|
||||
<? } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@@ -49,11 +51,17 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">朋友圈文案:</label>
|
||||
<div class="am-para-input" style="width: 60%">
|
||||
<textarea rows="3" v-model="info.moments" placeholder="请输入朋友圈文案"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="app-editor">
|
||||
<div class="app-editor-inner panel panel-default" v-if="info.type ==1">
|
||||
<div class="panel-body">
|
||||
<div class="page-header">
|
||||
<div class="page-header-name"><h4>推广视频列表</h4></div>
|
||||
<div class="page-header-name"><h4>{{showInfo.typeAry[1]}}列表</h4></div>
|
||||
<div class="page-header-option">
|
||||
<small class="text-muted"></small>
|
||||
</div>
|
||||
@@ -84,7 +92,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<template v-for="(item,index) in tgsp_list">
|
||||
<template v-for="(item,index) in json_lists[1]">
|
||||
<tr>
|
||||
<td>
|
||||
<a href="javascript:void(0)" v-if="item.video_type==1"
|
||||
@@ -99,11 +107,11 @@
|
||||
<td class="text-center" v-if="item.video_type==1">视频</td>
|
||||
<td class="text-center" v-else>图片</td>
|
||||
<td class="text-center">
|
||||
<div :id="'group_name_txt_tgsp_'+index">{{item.order_view}} <a
|
||||
<div :id="'group_name1_txt_'+index">{{item.order_view}} <a
|
||||
href="javascript:"
|
||||
@click="showGroupEditForm(index)"><i
|
||||
class="fa fa-edit"></i></a></div>
|
||||
<input :id="'group_name_tgsp_'+index" @blur="editGroupName(index,item.id)"
|
||||
<input :id="'group_name1_'+index" @blur="editGroupName(index,item.id)"
|
||||
style="display: none;" type="number" class="form-control"
|
||||
v-model="item.order_view" placeholder="请输入排序值">
|
||||
</td>
|
||||
@@ -118,7 +126,7 @@
|
||||
</template>
|
||||
</tbody>
|
||||
</table>
|
||||
<template v-if="tgsp_list.length <=0">
|
||||
<template v-if="json_lists[1].length <=0">
|
||||
<div style="text-align: center;">无数据</div>
|
||||
</template>
|
||||
</div>
|
||||
@@ -127,7 +135,7 @@
|
||||
<div class="form-group" style="margin-left: 0px;margin-right: 0px;">
|
||||
<label class="col-sm-2 control-label">标题</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" v-model="tgsp_item.title"
|
||||
<input type="text" class="form-control" v-model="json_item[1].title"
|
||||
placeholder="请输入标题">
|
||||
</div>
|
||||
</div>
|
||||
@@ -135,11 +143,11 @@
|
||||
<label class="col-sm-2 control-label">类型</label>
|
||||
<div class="col-sm-8">
|
||||
<label class="am-checkbox-inline">
|
||||
<input type="radio" value="1" v-model="tgsp_item.video_type"
|
||||
<input type="radio" value="1" v-model="json_item[1].video_type"
|
||||
@change="showVideo"> 视频
|
||||
</label>
|
||||
<label class="am-checkbox-inline">
|
||||
<input type="radio" value="2" v-model="tgsp_item.video_type"
|
||||
<input type="radio" value="2" v-model="json_item[1].video_type"
|
||||
@change="showVideo"> 图片
|
||||
</label>
|
||||
</div>
|
||||
@@ -173,15 +181,15 @@
|
||||
<label class="col-sm-2 control-label">图片</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group" style="width: 100%">
|
||||
<input type="text" style="width: 65%" name="tgsp_img" id="tgsp_img"
|
||||
<input type="text" style="width: 65%" name="json1_img" id="json1_img"
|
||||
onchange="$(this).next('img').attr('src', $(this).data('srcs') || this.value)"
|
||||
class="form-control">
|
||||
<img data-tips-image name="tgsp_img_url" id="tgsp_img_url"
|
||||
<img data-tips-image name="json1_img_url" id="json1_img_url"
|
||||
style="height:auto;max-height:31px;min-width:31px;margin-left: 5px;margin-right: 5px;"
|
||||
/>
|
||||
<button type="button" class="am-btn am-btn-default am-btn-sm"
|
||||
data-file="1" data-type="jpg,png,gif,png,jpeg"
|
||||
data-uptype="qiniu" data-field="tgsp_img">上传图片
|
||||
data-uptype="qiniu" data-field="json1_img">上传图片
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -190,14 +198,14 @@
|
||||
<div class="form-group" style="margin-left: 0px;margin-right: 0px;">
|
||||
<label class="col-sm-2 control-label">链接</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" v-model="tgsp_item.link"
|
||||
<input type="text" class="form-control" v-model="json_item[1].link"
|
||||
placeholder="请输入链接">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" style="margin-left: 0px;margin-right: 0px;">
|
||||
<label class="col-sm-2 control-label">排序值</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="number" class="form-control" v-model="tgsp_item.order_view"
|
||||
<input type="number" class="form-control" v-model="json_item[1].order_view"
|
||||
placeholder="请输入排序">
|
||||
</div>
|
||||
<div style="padding-top:7px;">
|
||||
@@ -212,7 +220,7 @@
|
||||
<div class="app-editor-inner panel panel-default" v-else-if="info.type ==2">
|
||||
<div class="panel-body">
|
||||
<div class="page-header">
|
||||
<div class="page-header-name"><h4>轮播海报列表</h4></div>
|
||||
<div class="page-header-name"><h4>{{showInfo.typeAry[2]}}列表</h4></div>
|
||||
<div class="page-header-option">
|
||||
<small class="text-muted"></small>
|
||||
</div>
|
||||
@@ -241,16 +249,17 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<template v-for="(item,index) in lbhb_list">
|
||||
<template v-for="(item,index) in json_lists[2]">
|
||||
<tr>
|
||||
<td><img data-tips-image :src="item.img_url"
|
||||
style="height:auto;max-height:36px;min-width:64px;"></td>
|
||||
<td class="text-center">{{item.title}}</td>
|
||||
<td class="text-center">
|
||||
<div :id="'group_name_txt_'+index">{{item.order_view}} <a href="javascript:"
|
||||
@click="showGroupEditForm(index)"><i
|
||||
<div :id="'group_name2_txt_'+index">{{item.order_view}} <a
|
||||
href="javascript:"
|
||||
@click="showGroupEditForm(index)"><i
|
||||
class="fa fa-edit"></i></a></div>
|
||||
<input :id="'group_name_'+index" @blur="editGroupName(index,item.id)"
|
||||
<input :id="'group_name2_'+index" @blur="editGroupName(index,item.id)"
|
||||
style="display: none;" type="number" class="form-control"
|
||||
v-model="item.order_view" placeholder="请输入排序值">
|
||||
</td>
|
||||
@@ -265,7 +274,7 @@
|
||||
</template>
|
||||
</tbody>
|
||||
</table>
|
||||
<template v-if="lbhb_list.length <=0">
|
||||
<template v-if="json_lists[2].length <=0">
|
||||
<div style="text-align: center;">无数据</div>
|
||||
</template>
|
||||
</div>
|
||||
@@ -274,7 +283,7 @@
|
||||
<div class="form-group" style="margin-left: 0px;margin-right: 0px;">
|
||||
<label class="col-sm-2 control-label">标题</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" v-model="lbhb_item.title"
|
||||
<input type="text" class="form-control" v-model="json_item[2].title"
|
||||
placeholder="请输入标题">
|
||||
</div>
|
||||
</div>
|
||||
@@ -282,15 +291,15 @@
|
||||
<label class="col-sm-2 control-label">图片</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group" style="width: 100%">
|
||||
<input type="text" style="width: 60%" name="lbhb_img" id="lbhb_img"
|
||||
<input type="text" style="width: 60%" name="json2_img" id="json2_img"
|
||||
onchange="$(this).next('img').attr('src', $(this).data('srcs') || this.value)"
|
||||
class="form-control">
|
||||
<img data-tips-image name="lbhb_img_url" id="lbhb_img_url"
|
||||
<img data-tips-image name="json2_img_url" id="json2_img_url"
|
||||
style="height:auto;max-height:31px;min-width:31px;margin-left: 5px;margin-right: 5px;"
|
||||
/>
|
||||
<button type="button" class="am-btn am-btn-default am-btn-sm"
|
||||
data-file="1" data-type="jpg,png,gif,png,jpeg"
|
||||
data-uptype="qiniu" data-field="lbhb_img">上传图片
|
||||
data-uptype="qiniu" data-field="json2_img">上传图片
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -299,14 +308,14 @@
|
||||
<div class="form-group" style="margin-left: 0px;margin-right: 0px;">
|
||||
<label class="col-sm-2 control-label">链接</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" v-model="lbhb_item.link"
|
||||
<input type="text" class="form-control" v-model="json_item[2].link"
|
||||
placeholder="请输入链接">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" style="margin-left: 0px;margin-right: 0px;">
|
||||
<label class="col-sm-2 control-label">排序值</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="number" class="form-control" v-model="lbhb_item.order_view"
|
||||
<input type="number" class="form-control" v-model="json_item[2].order_view"
|
||||
placeholder="请输入排序">
|
||||
</div>
|
||||
<div style="padding-top:7px;">
|
||||
@@ -321,7 +330,7 @@
|
||||
<div class="app-editor-inner panel panel-default" v-else-if="info.type ==3">
|
||||
<div class="panel-body">
|
||||
<div class="page-header">
|
||||
<div class="page-header-name"><h4>朋友圈文案列表</h4></div>
|
||||
<div class="page-header-name"><h4>{{showInfo.typeAry[3]}}列表</h4></div>
|
||||
<div class="page-header-option">
|
||||
<small class="text-muted"></small>
|
||||
</div>
|
||||
@@ -421,6 +430,116 @@
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="app-editor-inner panel panel-default" v-else-if="info.type ==4">
|
||||
<div class="panel-body">
|
||||
<div class="page-header">
|
||||
<div class="page-header-name"><h4>{{showInfo.typeAry[4]}}列表</h4></div>
|
||||
<div class="page-header-option">
|
||||
<small class="text-muted"></small>
|
||||
</div>
|
||||
</div>
|
||||
<form class="form-horizontal" style="padding-left: 50px;padding-right: 50px;">
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12">
|
||||
<table class="table table-hover table-middle" style="table-layout:fixed">
|
||||
<colgroup>
|
||||
<col width="80px"/>
|
||||
<col width="30%">
|
||||
<col width="15%">
|
||||
<col width="30%"/>
|
||||
<col width="">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center">图片</th>
|
||||
<th class="text-center">标题</th>
|
||||
<th class="text-center">排序</th>
|
||||
<th class="text-center">链接</th>
|
||||
<th class="text-right">
|
||||
<a href="javascript:" style="margin-top: 2px;" class="btn btn-primary btn-sm"
|
||||
@click='addModal()'>添加</a>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<template v-for="(item,index) in json_lists[4]">
|
||||
<tr>
|
||||
<td><img data-tips-image :src="item.img_url"
|
||||
style="height:auto;max-height:36px;min-width:64px;"></td>
|
||||
<td class="text-center">{{item.title}}</td>
|
||||
<td class="text-center">
|
||||
<div :id="'group_name4_txt_'+index">{{item.order_view}} <a
|
||||
href="javascript:"
|
||||
@click="showGroupEditForm(index)"><i
|
||||
class="fa fa-edit"></i></a></div>
|
||||
<input :id="'group_name4_'+index" @blur="editGroupName(index,item.id)"
|
||||
style="display: none;" type="number" class="form-control"
|
||||
v-model="item.order_view" placeholder="请输入排序值">
|
||||
</td>
|
||||
<td class="text-center">{{item.link}}</td>
|
||||
<td class="text-right">
|
||||
<a href="javascript:void(0);" style="margin-top:2px;"
|
||||
class="btn btn-default btn-sm" @click='addModal(item)'>编辑</a>
|
||||
<a href="javascript:void(0);" style="margin-top:2px;"
|
||||
class="btn btn-danger btn-sm" @click='removeAdd(index)'>删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</tbody>
|
||||
</table>
|
||||
<template v-if="json_lists[4].length <=0">
|
||||
<div style="text-align: center;">无数据</div>
|
||||
</template>
|
||||
</div>
|
||||
<div id="ad-modal-4" style="display: none;">
|
||||
<div class="form-horizontal" style="padding-top: 20px;">
|
||||
<div class="form-group" style="margin-left: 0px;margin-right: 0px;">
|
||||
<label class="col-sm-2 control-label">标题</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" v-model="json_item[4].title"
|
||||
placeholder="请输入标题">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" style="margin-left: 0px;margin-right: 0px;">
|
||||
<label class="col-sm-2 control-label">图片</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group" style="width: 100%">
|
||||
<input type="text" style="width: 60%" name="json4_img" id="json4_img"
|
||||
onchange="$(this).next('img').attr('src', $(this).data('srcs') || this.value)"
|
||||
class="form-control">
|
||||
<img data-tips-image name="json4_img_url" id="json4_img_url"
|
||||
style="height:auto;max-height:31px;min-width:31px;margin-left: 5px;margin-right: 5px;"
|
||||
/>
|
||||
<button type="button" class="am-btn am-btn-default am-btn-sm"
|
||||
data-file="1" data-type="jpg,png,gif,png,jpeg"
|
||||
data-uptype="qiniu" data-field="json4_img">上传图片
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" style="margin-left: 0px;margin-right: 0px;">
|
||||
<label class="col-sm-2 control-label">链接</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" v-model="json_item[4].link"
|
||||
placeholder="请输入链接">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" style="margin-left: 0px;margin-right: 0px;">
|
||||
<label class="col-sm-2 control-label">排序值</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="number" class="form-control" v-model="json_item[4].order_view"
|
||||
placeholder="请输入排序">
|
||||
</div>
|
||||
<div style="padding-top:7px;">
|
||||
<small class="text-muted">越大越靠前</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<a href="javascript:void(0);" @click='saveEdit();'
|
||||
@@ -493,11 +612,9 @@
|
||||
info: [],
|
||||
showInfo: [],
|
||||
brands: [],
|
||||
tgsp_list: [],
|
||||
tgsp_item: {},
|
||||
lbhb_list: [],
|
||||
lbhb_item: {},
|
||||
pyqwa_list: [],
|
||||
json_lists: [],
|
||||
json_item: [],
|
||||
pyqwa_item: {"brands": []},
|
||||
modal_brand: {title: '', lists: [], selected: [], page: 1, size: 10, total: 0}
|
||||
},
|
||||
@@ -506,9 +623,9 @@
|
||||
that.info = <?=json_encode($info, JSON_UNESCAPED_UNICODE)?>;
|
||||
that.showInfo = <?=json_encode($showInfo, JSON_UNESCAPED_UNICODE)?>;
|
||||
that.brands = <?=json_encode($showInfo['brands'], JSON_UNESCAPED_UNICODE)?>;
|
||||
that.tgsp_list = <?=json_encode($showInfo['tgsp_list'], JSON_UNESCAPED_UNICODE)?>;
|
||||
that.lbhb_list = <?=json_encode($showInfo['lbhb_list'], JSON_UNESCAPED_UNICODE)?>;
|
||||
that.pyqwa_list = <?=json_encode($showInfo['pyqwa_list'], JSON_UNESCAPED_UNICODE)?>;
|
||||
that.json_lists = <?=json_encode($showInfo['json_lists'], JSON_UNESCAPED_UNICODE)?>;
|
||||
that.json_item = <?=json_encode($showInfo['json_item'], JSON_UNESCAPED_UNICODE)?>;
|
||||
},
|
||||
computed: {},
|
||||
created: function () {
|
||||
@@ -617,46 +734,20 @@
|
||||
// 修改排序
|
||||
showGroupEditForm: function (index) {
|
||||
var vm = this;
|
||||
if (vm.info.type == 1) {
|
||||
$("#group_name_tgsp_" + index).show();
|
||||
$("#group_name_txt_tgsp_" + index).hide();
|
||||
$('#group_name_tgsp_' + index).focus();
|
||||
} else if (vm.info.type == 2) {
|
||||
$("#group_name_" + index).show();
|
||||
$("#group_name_txt_" + index).hide();
|
||||
$('#group_name_' + index).focus();
|
||||
} else if (vm.info.type == 3) {
|
||||
if (vm.info.type == 3) {
|
||||
$("#group_name_pyqwa_" + index).show();
|
||||
$("#group_name_txt_pyqwa_" + index).hide();
|
||||
$('#group_name_pyqwa_' + index).focus();
|
||||
} else {
|
||||
$("#group_name" + vm.info.type + "_" + index).show();
|
||||
$("#group_name" + vm.info.type + "_txt_" + index).hide();
|
||||
$("#group_name" + vm.info.type + "_" + index).focus();
|
||||
}
|
||||
},
|
||||
// 排序
|
||||
editGroupName: function (index, group_id) {
|
||||
var vm = this;
|
||||
if (vm.info.type == 1) {
|
||||
var order_view = $("#group_name_tgsp_" + index).val();
|
||||
if (order_view == '') {
|
||||
layer.msg("排序值不能为空!", {icon: 2});
|
||||
return false;
|
||||
}
|
||||
vm.tgsp_list.sort(function (a, b) {
|
||||
return b.order_view - a.order_view;
|
||||
})
|
||||
$("#group_name_tgsp_" + index).hide();
|
||||
$("#group_name_txt_tgsp_" + index).show();
|
||||
} else if (vm.info.type == 2) {
|
||||
var order_view = $("#group_name_" + index).val();
|
||||
if (order_view == '') {
|
||||
layer.msg("排序值不能为空!", {icon: 2});
|
||||
return false;
|
||||
}
|
||||
vm.lbhb_list.sort(function (a, b) {
|
||||
return b.order_view - a.order_view;
|
||||
})
|
||||
$("#group_name_" + index).hide();
|
||||
$("#group_name_txt_" + index).show();
|
||||
} else if (vm.info.type == 3) {
|
||||
if (vm.info.type == 3) {
|
||||
var order_view = $("#group_name_pyqwa_" + index).val();
|
||||
if (order_view == '') {
|
||||
layer.msg("排序值不能为空!", {icon: 2});
|
||||
@@ -667,11 +758,22 @@
|
||||
})
|
||||
$("#group_name_pyqwa_" + index).hide();
|
||||
$("#group_name_txt_pyqwa_" + index).show();
|
||||
} else {
|
||||
var order_view = $("#group_name" + vm.info.type + "_" + index).val();
|
||||
if (order_view == '') {
|
||||
layer.msg("排序值不能为空!", {icon: 2});
|
||||
return false;
|
||||
}
|
||||
vm.json_lists[vm.info.type].sort(function (a, b) {
|
||||
return b.order_view - a.order_view;
|
||||
})
|
||||
$("#group_name" + vm.info.type + "_" + index).hide();
|
||||
$("#group_name" + vm.info.type + "_txt_" + index).show();
|
||||
}
|
||||
},
|
||||
showVideo: function () {
|
||||
var that = this;
|
||||
if (that.tgsp_item.video_type == 1) {
|
||||
if (that.json_item[1].video_type == 1) {
|
||||
$("#show_video1").show();
|
||||
$("#show_video2").hide();
|
||||
} else {
|
||||
@@ -682,8 +784,8 @@
|
||||
addModal: function (item) {
|
||||
var that = this;
|
||||
if (that.info.type == 1) {
|
||||
var _title = '新增推广视频';
|
||||
that.tgsp_item = {
|
||||
var _title = '新增' + that.showInfo.typeAry[1];
|
||||
that.json_item[1] = {
|
||||
"title": "",
|
||||
"video_file_url": "",
|
||||
"video_url": "",
|
||||
@@ -695,8 +797,8 @@
|
||||
"order_view": 50
|
||||
};
|
||||
if (item) {
|
||||
_title = '编辑推广视频';
|
||||
that.tgsp_item = item;
|
||||
_title = '编辑' + that.showInfo.typeAry[1];
|
||||
that.json_item[1] = item;
|
||||
that.info.video_file_url = item.video_file_url;
|
||||
that.info.video_url = item.video_url;
|
||||
that.info.video_cover = item.video_cover;
|
||||
@@ -705,8 +807,8 @@
|
||||
that.info.video_url = "";
|
||||
that.info.video_cover = "";
|
||||
}
|
||||
$('#tgsp_img').val(that.tgsp_item.img);
|
||||
$("#tgsp_img_url").attr('src', that.tgsp_item.img_url);
|
||||
$('#json1_img').val(that.json_item[1].img);
|
||||
$("#json1_img_url").attr('src', that.json_item[1].img_url);
|
||||
that.showVideo();
|
||||
layer.open({
|
||||
type: 1,
|
||||
@@ -716,22 +818,22 @@
|
||||
shade: false,
|
||||
btn: ['确定', '取消'],
|
||||
yes: function (index) {
|
||||
var _img = $('#tgsp_img').val();
|
||||
var _img_url = $("#tgsp_img_url")[0].src;
|
||||
var _img = $('#json1_img').val();
|
||||
var _img_url = $("#json1_img_url")[0].src;
|
||||
if (!item) {
|
||||
that.tgsp_list.push({
|
||||
title: that.tgsp_item.title,
|
||||
that.json_lists[1].push({
|
||||
title: that.json_item[1].title,
|
||||
video_file_url: that.info.video_file_url,
|
||||
video_url: that.info.video_url,
|
||||
video_cover: that.info.video_cover,
|
||||
video_type: that.tgsp_item.video_type,
|
||||
video_type: that.json_item[1].video_type,
|
||||
img: _img,
|
||||
img_url: _img_url,
|
||||
link: that.tgsp_item.link,
|
||||
order_view: that.tgsp_item.order_view
|
||||
link: that.json_item[1].link,
|
||||
order_view: that.json_item[1].order_view
|
||||
});
|
||||
} else {
|
||||
if (that.tgsp_item.video_type == 1) {
|
||||
if (that.json_item[1].video_type == 1) {
|
||||
item.video_file_url = that.info.video_file_url;
|
||||
item.video_url = that.info.video_url;
|
||||
item.video_cover = that.info.video_cover;
|
||||
@@ -740,27 +842,27 @@
|
||||
item.img_url = _img_url;
|
||||
}
|
||||
}
|
||||
that.tgsp_list.sort(function (a, b) {
|
||||
that.json_lists[1].sort(function (a, b) {
|
||||
return b.order_view - a.order_view;
|
||||
})
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
} else if (that.info.type == 2) {
|
||||
var _title = '新增轮播海报';
|
||||
that.lbhb_item = {};
|
||||
var _title = '新增' + that.showInfo.typeAry[2];
|
||||
that.json_item[2] = {};
|
||||
var _img = '';
|
||||
var _img_url = '';
|
||||
if (item) {
|
||||
that.lbhb_item = item;
|
||||
_title = '编辑轮播海报';
|
||||
that.json_item[2] = item;
|
||||
_title = '编辑' + that.showInfo.typeAry[2];
|
||||
_img = item.img;
|
||||
_img_url = item.img_url;
|
||||
} else {
|
||||
that.lbhb_item = {"order_view": 50};
|
||||
that.json_item[2] = {"order_view": 50};
|
||||
}
|
||||
$('#lbhb_img').val(_img);
|
||||
$("#lbhb_img_url").attr('src', _img_url);
|
||||
$('#json2_img').val(_img);
|
||||
$("#json2_img_url").attr('src', _img_url);
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: ['50%'], //宽高
|
||||
@@ -769,21 +871,21 @@
|
||||
shade: false,
|
||||
btn: ['确定', '取消'],
|
||||
yes: function (index) {
|
||||
_img = $('#lbhb_img').val();
|
||||
_img_url = $("#lbhb_img_url")[0].src;
|
||||
_img = $('#json2_img').val();
|
||||
_img_url = $("#json2_img_url")[0].src;
|
||||
if (!item) {
|
||||
that.lbhb_list.push({
|
||||
title: that.lbhb_item.title,
|
||||
that.json_lists[2].push({
|
||||
title: that.json_item[2].title,
|
||||
img: _img,
|
||||
img_url: _img_url,
|
||||
link: that.lbhb_item.link,
|
||||
order_view: that.lbhb_item.order_view
|
||||
link: that.json_item[2].link,
|
||||
order_view: that.json_item[2].order_view
|
||||
});
|
||||
} else {
|
||||
item.img = _img;
|
||||
item.img_url = _img_url;
|
||||
}
|
||||
that.lbhb_list.sort(function (a, b) {
|
||||
that.json_lists[2].sort(function (a, b) {
|
||||
return b.order_view - a.order_view;
|
||||
})
|
||||
layer.close(index);
|
||||
@@ -819,16 +921,57 @@
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
} else if (that.info.type == 4) {
|
||||
var _title = '新增' + that.showInfo.typeAry[4];
|
||||
that.json_item[4] = {};
|
||||
var _img = '';
|
||||
var _img_url = '';
|
||||
if (item) {
|
||||
that.json_item[4] = item;
|
||||
_title = '编辑' + that.showInfo.typeAry[4];
|
||||
_img = item.img;
|
||||
_img_url = item.img_url;
|
||||
} else {
|
||||
that.json_item[4] = {"order_view": 50};
|
||||
}
|
||||
$('#json4_img').val(_img);
|
||||
$("#json4_img_url").attr('src', _img_url);
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: ['50%'], //宽高
|
||||
content: $('#ad-modal-4'),
|
||||
title: _title,
|
||||
shade: false,
|
||||
btn: ['确定', '取消'],
|
||||
yes: function (index) {
|
||||
_img = $('#json4_img').val();
|
||||
_img_url = $("#json4_img_url")[0].src;
|
||||
if (!item) {
|
||||
that.json_lists[4].push({
|
||||
title: that.json_item[4].title,
|
||||
img: _img,
|
||||
img_url: _img_url,
|
||||
link: that.json_item[4].link,
|
||||
order_view: that.json_item[4].order_view
|
||||
});
|
||||
} else {
|
||||
item.img = _img;
|
||||
item.img_url = _img_url;
|
||||
}
|
||||
that.json_lists[4].sort(function (a, b) {
|
||||
return b.order_view - a.order_view;
|
||||
})
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
removeAdd: function (index) {
|
||||
var vm = this;
|
||||
if (vm.info.type == 1) {
|
||||
vm.tgsp_list.splice(index, 1);
|
||||
} else if (vm.info.type == 2) {
|
||||
vm.lbhb_list.splice(index, 1);
|
||||
} else if (vm.info.type == 3) {
|
||||
if (vm.info.type == 3) {
|
||||
vm.pyqwa_list.splice(index, 1);
|
||||
} else {
|
||||
vm.json_lists[vm.info.type].splice(index, 1);
|
||||
}
|
||||
},
|
||||
btn_video: function () {
|
||||
@@ -842,12 +985,10 @@
|
||||
brand_ids.push(vm.brands[i]['id']);
|
||||
}
|
||||
vm.info.brand_ids = brand_ids;
|
||||
if (vm.info.type == 1) {
|
||||
vm.info.lists = vm.tgsp_list;
|
||||
} else if (vm.info.type == 2) {
|
||||
vm.info.lists = vm.lbhb_list;
|
||||
} else if (vm.info.type == 3) {
|
||||
if (vm.info.type == 3) {
|
||||
vm.info.lists = vm.pyqwa_list;
|
||||
} else {
|
||||
vm.info.lists = vm.json_lists[vm.info.type];
|
||||
}
|
||||
$.ajax({
|
||||
url: <?=json_encode($edit_url)?>,
|
||||
|
||||
@@ -100,13 +100,22 @@ class Home extends Wxapp
|
||||
}
|
||||
$where[' (' . $or_str . ') '] = null;
|
||||
$total = $this->mdTemplate->count($where);
|
||||
$fileds = 'id,title,cover';
|
||||
$fileds = 'id,title,cover,json_data';
|
||||
$res = $this->mdTemplate->select($where, "id desc", $page, $size, $fileds);
|
||||
foreach ($res as $key2 => $value2) {
|
||||
$value2['cover'] = $value2['cover'] ? build_qiniu_image_url($value2['cover']) : '';
|
||||
$setValue = array();
|
||||
$moments = '';
|
||||
$re_biz = $this->mdMaterialBiz->get(array('app_id' => $this->app_id, 't_id' => $value2['id'], 'biz_id' => $this->biz_id));
|
||||
$value2['if_add'] = $re_biz ? 1 : 0;
|
||||
$lists[] = $value2;
|
||||
$setValue['id'] = intval($value2['id']);
|
||||
$setValue['title'] = $value2['title'];
|
||||
$setValue['cover'] = $value2['cover'] ? build_qiniu_image_url($value2['cover']) : '';
|
||||
$setValue['if_add'] = $re_biz ? 1 : 0;
|
||||
if ($value2['json_data']) {
|
||||
$json_data = json_decode($value2['json_data'], true);
|
||||
$json_data['moments'] && $moments = $json_data['moments'];
|
||||
}
|
||||
$setValue['moments'] = $moments;
|
||||
$lists[] = $setValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ class Topic extends Wxapp
|
||||
$setValue['img'] = $value['img'] ? build_qiniu_image_url($value['img']) : '';
|
||||
$setValue['link'] = $value['link'];
|
||||
}
|
||||
} else if ($re['type'] == 2) {
|
||||
} else {
|
||||
$setValue['img'] = $value['img'] ? build_qiniu_image_url($value['img']) : '';
|
||||
$setValue['link'] = $value['link'];
|
||||
}
|
||||
|
||||
@@ -23,7 +23,8 @@ class Material_template_model extends HD_Model
|
||||
*/
|
||||
public function typeAry()
|
||||
{
|
||||
return array(1 => '推广视频', 2 => '轮播海报', 3 => '朋友圈文案');
|
||||
return array(4 => '图片海报', 1 => '推广视频', 2 => '朋友圈海报');
|
||||
//return array(4 => '图片海报', 1 => '推广视频', 2 => '朋友圈海报', 3 => '朋友圈文案');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user