123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183 |
- define(['jquery', 'bootstrap', 'backend', 'form', 'table'], function ($, undefined, Backend, Form, Table) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'wechat/vipreply/index',
- add_url: 'wechat/vipreply/add',
- del_url: 'wechat/vipreply/del',
- edit_url: 'wechat/vipreply/edit',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- sortName: 'id',
- columns: [
- [
- {field: 'state', checkbox: true, operate: false},
- {field: 'id', title: __('Id'), operate: false},
- // {field: 'title', title: __('Title'),operate:false},
- {field: 'text', title: '触发关键字', operate: false},
- {field: 'uv', title: '阅读人数', operate: false},
- {field: 'subscribe', title: '关注人数', operate: false},
- {field: 'money', title: '充值金额', operate: false},
- // {field: 'eventkey', title: __('Event key'),operate:false},
- // {field: 'remark', title: __('Remark'),operate:false},
- {
- field: 'createtime',
- title: __('Create time'),
- formatter: Table.api.formatter.datetime,
- operate: false
- },
- // {field: 'updatetime', title: __('Update time'), formatter: Table.api.formatter.datetime,operate:false},
- {field: 'status', title: __('Status'), formatter: Table.api.formatter.status, operate: false},
- {
- field: 'operate',
- title: __('Operate'),
- table: table,
- events: Table.api.events.operate,
- formatter: function (value, row, index) {
- if (row.title == 'subscribe') {
- return '请到被关注回复中修改';
- } else if (row.title == '签到') {
- return '请到签到自动回复中修改';
- } else {
- return '<a href="/admin/wechat/autoreply/edit/ids/' + row.id + '" class="btn btn-xs btn-success btn-editone" title="" data-table-id="table" data-field-index="9" data-row-index="1" data-button-index="1"><i class="fa fa-pencil"></i></a> <a href="javascript:;" class="btn btn-xs btn-danger btn-delone" title="" data-table-id="table" data-field-index="9" data-row-index="1" data-button-index="2"><i class="fa fa-trash"></i></a>';
- }
- }
- },
- {
- field: 'event',
- title: '详情',
- table: table,
- events: Table.api.events.operate,
- formatter: function (value, row, index) {
- return '<a href="/admin/wechat/vipreply/detail/ids/' + row.id + '" class="btn btn-xs btn-success layer-open">查看详情</a>';
- }
- }
- ]
- ]
- });
- $(document).on('click', '.layer-open', function () {
- Fast.api.open($(this).attr('href'), $(this).data('title') ? $(this).data('title') : '详细信息', {});
- return false;
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- },
- add: function () {
- require(['vue', 'component', 'ELEMENT'], function (Vue, component, ELEMENT) {
- Vue.use(ELEMENT);
- Vue.use(component);
- Form.api.bindevent($("#edit-form"));
- var Main = {
- el: '#reply-form-vip',
- data: function () {
- return {
- news: [],
- text: [],
- resource_type: 2,
- deploy_type: 1,
- text_tip_input: {
- text_tip: '@$user_nickname,欢迎关注「$gzh_name」,点击下方继续阅读',
- text_split: '',
- },
- keywords: '',
- save: function (res) {
- if (res.code === 0) {
- Toastr.error(res.msg)
- } else {
- Fast.api.close();
- parent.$('.fa.fa-refresh').trigger('click')
- }
- }
- }
- }
- };
- $('.loading').hide();
- new Vue(Main)
- });
- },
- edit: function () {
- require(['vue', 'component', 'ELEMENT'], function (Vue, component, ELEMENT) {
- Vue.use(ELEMENT);
- Vue.use(component);
- Form.api.bindevent($("#edit-form"));
- var Main = {
- el: '#reply-form-vip',
- data: function () {
- return {
- news: Config.row.news_content,
- text: Config.row.text_content,
- deploy_type: parseInt(Config.row.deploy_type),
- resource_type: parseInt(Config.row.resource_type),
- text_tip_input: Config.row.text_tip_word,
- selected: Config.row.selected ? Config.row.selected:{},
- keywords: Config.row.keywords,
- id: Config.row.id,
- save: function (res) {
- if (res.code === 0) {
- Toastr.error(res.msg)
- } else {
- Fast.api.close();
- parent.$('.fa.fa-refresh').trigger('click')
- }
- }
- }
- }
- };
- $('.loading').hide();
- new Vue(Main)
- });
- },
- detail: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'wechat/vipreply/detail',
- },
- search: false,
- });
- var table = $("#detail");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url + '?ids=' + Config.ids,
- sortName: 'id',
- columns: [
- [
- {field: 'id', title: __('Id'), operate: false},
- {field: 'nickname', title: '渠道昵称', operate: false},
- {field: 'a.nickname', title: '渠道昵称',visible:false, operate: 'LIKE'},
- {field: 'title', title: '触发关键字', operate: false},
- {field: 'uv', title: '阅读人数', operate: false},
- {field: 'subscribe', title: '关注人数', operate: false},
- {field: 'money', title: '充值金额', operate: false},
- {field: 'createtime', title: __('Create time'), formatter: Table.api.formatter.datetime, operate: false},
- {field: 'status', title: __('Status'), formatter: Table.api.formatter.status, operate: false}
- ]
- ]
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- }
- }
- };
- return Controller;
- });
|