Your Name 9 months ago
parent
commit
00bb3d48a5

+ 9
- 0
application/admin/conf/auth_rule.php View File

@@ -50,6 +50,15 @@ return [
50 50
         'sort_order'    => 100,
51 51
         'auths' => 'Other@*,AdPosition@*',
52 52
     ],
53
+    [
54
+        'id' => 48, // 复制广告管理  职称问答流程
55
+        'menu_id' => 1006,
56
+        'menu_id2' => 0,
57
+        'name'  => '允许操作',
58
+        'is_modules'    => 1,
59
+        'sort_order'    => 100,
60
+        'auths' => 'Other@*,ZcPosition@*',
61
+    ],
53 62
     [
54 63
         'id' => 4,
55 64
         'menu_id' => 2001,

+ 15
- 0
application/admin/conf/menu.php View File

@@ -370,6 +370,21 @@ return  array(
370 370
                 'is_subshowmenu'=>0,
371 371
                 'child' => array(),
372 372
             ),
373
+            '1006' => array(
374
+                'id'=>1006,
375
+                'parent_id'=>1000,
376
+                'name' => '职称管理',
377
+                'controller'=>'ZcPosition',
378
+                'action'=>'index',
379
+                'url'=>'',
380
+                'target'=>'workspace',
381
+                'icon'=>'iconfont e-guanggao',
382
+                'grade'=>1,
383
+                'is_menu'=>1,
384
+                'is_modules'=>1,
385
+                'is_subshowmenu'=>0,
386
+                'child' => array(),
387
+            ),
373 388
         ),
374 389
     ),
375 390
         

+ 845
- 0
application/admin/controller/ZcPosition.php View File

@@ -0,0 +1,845 @@
1
+<?php
2
+/**
3
+ * 易优CMS
4
+ * ============================================================================
5
+ * 版权所有 2016-2028 海南赞赞网络科技有限公司,并保留所有权利。
6
+ * 网站地址: http://www.eyoucms.com
7
+ * ----------------------------------------------------------------------------
8
+ * 如果商业用途务必到官方购买正版授权, 以免引起不必要的法律纠纷.
9
+ * ============================================================================
10
+ * Author: 小虎哥 <1105415366@qq.com>
11
+ * Date: 2018-4-3
12
+ */
13
+
14
+namespace app\admin\controller;
15
+
16
+use think\Page;
17
+use think\Db;
18
+use think\Cache;
19
+
20
+class ZcPosition extends Base
21
+{
22
+    private $ad_position_system_id = array(); // 系统默认位置ID,不可删除
23
+
24
+    public function _initialize() {
25
+        parent::_initialize();
26
+    }
27
+
28
+    public function index()
29
+    {
30
+        $list = array();
31
+        $get = input('get.');
32
+        $keywords = input('keywords/s');
33
+        $condition = [];
34
+        // 应用搜索条件
35
+        foreach (['keywords', 'type'] as $key) {
36
+            $get[$key] = addslashes(trim($get[$key]));
37
+            if (isset($get[$key]) && $get[$key] !== '') {
38
+                if ($key == 'keywords') {
39
+                    $condition['a.title'] = array('LIKE', "%{$get[$key]}%");
40
+                } else {
41
+                    $tmp_key = 'a.'.$key;
42
+                    $condition[$tmp_key] = array('eq', $get[$key]);
43
+                }
44
+            }
45
+        }
46
+
47
+        // 多语言
48
+        $condition['a.lang'] = array('eq', $this->admin_lang);
49
+
50
+        $adPositionM =  Db::name('ad_position');
51
+        $count = $adPositionM->alias('a')->where($condition)->count();// 查询满足要求的总记录数
52
+        $Page = new Page($count, config('paginate.list_rows'));// 实例化分页类 传入总记录数和每页显示的记录数
53
+        $list = $adPositionM->alias('a')->where($condition)->order('id desc')->limit($Page->firstRow.','.$Page->listRows)->getAllWithIndex('id');
54
+
55
+        // 每组获取三张图片
56
+        $pids = get_arr_column($list, 'id');
57
+        $ad = Db::name('ad')->where(['pid' => ['IN', $pids], 'lang' => $this->admin_lang])->order('pid asc, id asc')->select();
58
+        foreach ($list as $k => $v) {
59
+            if (1 == $v['type']) {
60
+                // 图片封面图片
61
+                $v['ad'] = [];
62
+                foreach ($ad as $m => $n) {
63
+                    if ($v['id'] == $n['pid']) {
64
+                        $n['litpic'] = get_default_pic($n['litpic']); // 支持子目录
65
+                        $v['ad'][] = $n;
66
+                        unset($ad[$m]);
67
+                    } else {
68
+                        continue;
69
+                    }
70
+                }
71
+                // 若没有内容则显示默认图片
72
+                if (empty($v['ad'])) {
73
+                    $v['ad_count'] = 0;
74
+                    $v['ad'][]['litpic'] = ROOT_DIR . '/public/static/common/images/not_adv.jpg';
75
+                } else {
76
+                    $v['ad_count'] = count($v['ad']);
77
+                }
78
+                // 广告类型
79
+                $v['type_name'] = '图片';
80
+            } else if (2 == $v['type']) {
81
+                // 多媒体封面图片
82
+                $v['ad'][]['litpic'] = ROOT_DIR . '/public/static/admin/images/ad_type_media.png';
83
+                // 广告类型
84
+                $v['type_name'] = '多媒体';
85
+            } else if (3 == $v['type']) {
86
+                // HTML代码封面图片
87
+                $v['ad'][]['litpic'] = ROOT_DIR . '/public/static/admin/images/ad_type_html.png';
88
+                // 广告类型
89
+                $v['type_name'] = 'HTML代码';
90
+            }
91
+            $list[$k] = $v;
92
+        }
93
+
94
+        $show = $Page->show();// 分页显示输出
95
+        $this->assign('page',$show);// 赋值分页输出
96
+        $this->assign('list',$list);// 赋值数据集
97
+        $this->assign('pager',$Page);// 赋值分页对象
98
+
99
+        /*多语言模式下,广告位ID显示主体语言的ID和属性title名称*/
100
+        $main_adv_list = [];
101
+        if ($this->admin_lang != $this->main_lang && empty($this->globalConfig['language_split'])) {
102
+            $attr_values = get_arr_column($list, 'id');
103
+            $languageAttrRow = Db::name('language_attr')->field('attr_name,attr_value')->where([
104
+                    'attr_value'    => ['IN', $attr_values],
105
+                    'attr_group'    => 'ad_position',
106
+                    'lang'          => $this->admin_lang,
107
+                ])->getAllWithIndex('attr_value');
108
+            $ids = [];
109
+            foreach ($languageAttrRow as $key => $val) {
110
+                $tid_tmp = str_replace('adp', '', $val['attr_name']);
111
+                array_push($ids, intval($tid_tmp));
112
+            }
113
+            $main_advRow = Db::name('ad_position')->field("id,title,CONCAT('adp', id) AS attr_name")
114
+                ->where([
115
+                    'id'    => ['IN', $ids],
116
+                    'lang'  => $this->main_lang,
117
+                ])->getAllWithIndex('attr_name');
118
+            foreach ($list as $key => $val) {
119
+                $key_tmp = !empty($languageAttrRow[$val['id']]['attr_name']) ? $languageAttrRow[$val['id']]['attr_name'] : '';
120
+                $main_adv_list[$val['id']] = [
121
+                    'id'        => !empty($main_advRow[$key_tmp]['id']) ? $main_advRow[$key_tmp]['id'] : '',
122
+                    'title'  => !empty($main_advRow[$key_tmp]['title']) ? $main_advRow[$key_tmp]['title'] : '',
123
+                ];
124
+            }
125
+        }
126
+        $this->assign('main_adv_list', $main_adv_list);
127
+        /*end*/
128
+
129
+        return $this->fetch();
130
+    }
131
+    
132
+    /**
133
+     * 新增
134
+     */
135
+    public function add()
136
+    {
137
+        //防止php超时
138
+        function_exists('set_time_limit') && set_time_limit(0);
139
+
140
+        if (is_language() && empty($this->globalConfig['language_split'])) {
141
+            $this->language_access(); // 多语言功能操作权限
142
+        }
143
+
144
+        if (IS_POST) {
145
+            $post = input('post.');
146
+            $map = array(
147
+                'title' => trim($post['title']),
148
+                'lang'  => $this->admin_lang,
149
+            );
150
+            if(Db::name('ad_position')->where($map)->count() > 0){
151
+                $this->error('该广告名称已存在,请检查', url('AdPosition/index'));
152
+            }
153
+
154
+            // 添加广告位置表信息
155
+            $data = array(
156
+                'title'       => trim($post['title']),
157
+                'type'        => $post['type'],
158
+                'intro'       => $post['intro'],
159
+                'admin_id'    => session('admin_id'),
160
+                'lang'        => $this->admin_lang,
161
+                'add_time'    => getTime(),
162
+                'update_time' => getTime(),
163
+            );
164
+            $insertID = Db::name('ad_position')->insertGetId($data);
165
+
166
+            if (!empty($insertID)) {
167
+                // 同步广告位置ID到多语言的模板变量里,添加多语言广告位
168
+                $this->syn_add_language_attribute($insertID);
169
+
170
+                // 读取组合广告位的图片及信息
171
+                $AdData = [];
172
+                if (1 == $post['type'] && !empty($post['img_litpic'])) { // 图片类型
173
+                    $i = 1;
174
+                    foreach ($post['img_litpic'] as $key => $value) {
175
+                        if (!empty($value)) {
176
+                            // 去掉http:
177
+                            $value = str_replace("http:", "", $value);
178
+                            // 去掉https:
179
+                            $value = str_replace("https:", "", $value);
180
+                            // 主要参数
181
+                            $AdData['litpic'] = $value;
182
+                            $AdData['pid']    = $insertID;
183
+                            $AdData['title']  = trim($post['img_title'][$key]);
184
+                            $AdData['links']  = $post['img_links'][$key];
185
+                            $AdData['intro']  = $post['img_intro'][$key];
186
+                            $target = !empty($post['img_target'][$key]) ? 1 : 0;
187
+                            $AdData['target'] = $target;
188
+                            // 其他参数
189
+                            $AdData['media_type']  = 1;
190
+                            $AdData['admin_id']    = session('admin_id');
191
+                            $AdData['lang']        = $this->admin_lang;
192
+                            $AdData['sort_order']  = $i++;
193
+                            $AdData['add_time']    = getTime();
194
+                            $AdData['update_time'] = getTime();
195
+                            // 添加到广告图表
196
+                            $ad_id = Db::name('ad')->add($AdData);
197
+                            // 同步多语言
198
+                            $this->syn_add_ad_language_attribute($ad_id);
199
+                        }
200
+                    }
201
+
202
+                } else if (2 == $post['type'] && !empty($post['video_litpic'])) { // 媒体类型
203
+                    // 去掉http:
204
+                    $video_litpic = str_replace("http:", "", $post['video_litpic']);
205
+                    // 去掉https:
206
+                    $video_litpic = str_replace("https:", "", $post['video_litpic']);
207
+                    // 主要参数
208
+                    $AdData['litpic'] = $video_litpic;
209
+                    $AdData['pid']    = $insertID;
210
+                    $AdData['title']  = trim($post['title']);
211
+                    // 其他参数
212
+                    $AdData['intro']       = '';
213
+                    $AdData['links']       = '';
214
+                    $AdData['target']      = 0;
215
+                    $AdData['media_type']  = 2;
216
+                    $AdData['admin_id']    = session('admin_id');
217
+                    $AdData['lang']        = $this->admin_lang;
218
+                    $AdData['sort_order']  = 1;
219
+                    $AdData['add_time']    = getTime();
220
+                    $AdData['update_time'] = getTime();
221
+                    // 添加到广告图表
222
+                    $ad_id = Db::name('ad')->add($AdData);
223
+                    // 同步多语言
224
+                    $this->syn_add_ad_language_attribute($ad_id);
225
+
226
+                } else if (3 == $post['type'] && !empty($post['html_intro'])) { // HTML代码
227
+                    // 主要参数
228
+                    $AdData['pid']   = $insertID;
229
+                    $AdData['title'] = trim($post['title']);
230
+                    $AdData['intro'] = $post['html_intro'];
231
+                    // 其他参数
232
+                    $AdData['litpic']      = '';
233
+                    $AdData['links']       = '';
234
+                    $AdData['target']      = 0;
235
+                    $AdData['media_type']  = 3;
236
+                    $AdData['admin_id']    = session('admin_id');
237
+                    $AdData['lang']        = $this->admin_lang;
238
+                    $AdData['sort_order']  = 1;
239
+                    $AdData['add_time']    = getTime();
240
+                    $AdData['update_time'] = getTime();
241
+                    // 添加到广告图表
242
+                    $ad_id = Db::name('ad')->add($AdData);
243
+                    // 同步多语言
244
+                    $this->syn_add_ad_language_attribute($ad_id);
245
+
246
+                }
247
+                Cache::clear('ad');
248
+                adminLog('新增广告:'.$post['title']);
249
+                $this->success("操作成功", url('AdPosition/index'));
250
+            } else {
251
+                $this->error("操作失败", url('AdPosition/index'));
252
+            }
253
+        }
254
+
255
+        // 上传通道
256
+        $WeappConfig = Db::name('weapp')->field('code, status')->where('code', 'IN', ['Qiniuyun', 'AliyunOss', 'Cos'])->select();
257
+        $WeappOpen = [];
258
+        foreach ($WeappConfig as $value) {
259
+            if ('Qiniuyun' == $value['code']) {
260
+                $WeappOpen['qny_open'] = $value['status'];
261
+            } else if ('AliyunOss' == $value['code']) {
262
+                $WeappOpen['oss_open'] = $value['status'];
263
+            } else if ('Cos' == $value['code']) {
264
+                $WeappOpen['cos_open'] = $value['status'];
265
+            }
266
+        }
267
+        $this->assign('WeappOpen', $WeappOpen);
268
+
269
+        // 系统最大上传视频的大小
270
+        $upload_max_filesize = upload_max_filesize();
271
+        $this->assign('upload_max_filesize', $upload_max_filesize);
272
+
273
+        // 视频类型
274
+        $media_type = tpCache('global.media_type');
275
+        $media_type = !empty($media_type) ? $media_type : config('global.media_ext');
276
+        $media_type = str_replace(",", "|", $media_type);
277
+        $this->assign('media_type', $media_type);
278
+
279
+
280
+
281
+
282
+        return $this->fetch();
283
+    }
284
+
285
+    
286
+    /**
287
+     * 编辑
288
+     */
289
+    public function edit()
290
+    {
291
+        if (IS_POST) {
292
+            $post = input('post.');
293
+            if (!empty($post['id'])) {
294
+                $post['id'] = intval($post['id']);
295
+                if (array_key_exists($post['id'], $this->ad_position_system_id)) {
296
+                    $this->error("不可更改系统预定义位置", url('AdPosition/edit',array('id'=>$post['id'])));
297
+                }
298
+
299
+                /* 判断除自身外是否还有相同广告名称已存在 */
300
+                $map = array(
301
+                    'id'    => array('NEQ', $post['id']),
302
+                    'title' => trim($post['title']),
303
+                    'lang'  => $this->admin_lang,
304
+                );
305
+                if (Db::name('ad_position')->where($map)->count() > 0) $this->error('该广告名称已存在,请检查');
306
+                /* END */
307
+
308
+                /* 判断广告是否切换广告类型 */
309
+                // $where = [
310
+                //     'id'   => $post['id'],
311
+                //     'type' => $post['type'],
312
+                //     'lang' => $this->admin_lang
313
+                // ];
314
+                // if (Db::name('ad_position')->where($where)->count() == 0) {
315
+                //     // 已切换广告类型,清除广告中的广告内容
316
+                //     $where = [
317
+                //         'pid'  => $post['id'],
318
+                //         'lang' => $this->admin_lang
319
+                //     ];
320
+                //     Db::name('ad')->where($where)->delete();
321
+                // }
322
+                /* END */
323
+
324
+                /* 修改广告主体信息 */
325
+                $data = array(
326
+                    'id'          => $post['id'],
327
+                    'title'       => trim($post['title']),
328
+                    'type'        => $post['type'],
329
+                    'intro'       => $post['intro'],
330
+                    'update_time' => getTime(),
331
+                );
332
+                $resultID = Db::name('ad_position')->update($data);
333
+                /* END */
334
+            }
335
+
336
+            if (!empty($resultID)) {
337
+                $ad_db = Db::name('ad');
338
+                if (1 == $post['type'] && !empty($post['img_litpic'])) { // 图片类型
339
+                    // 读取组合广告位的图片及信息
340
+                    $i = 1;
341
+                    foreach ($post['img_litpic'] as $key => $value) {
342
+                        if (!empty($value)) {
343
+                            // 去掉http:
344
+                            $value = str_replace("http:", "", $value);
345
+                            // 去掉https:
346
+                            $value = str_replace("https:", "", $value);
347
+                            // 是否新窗口打开
348
+                            $target = !empty($post['img_target'][$key]) ? 1 : 0;
349
+                            // 广告位ID,为空则表示添加
350
+                            $ad_id = $post['img_id'][$key];
351
+                            if (!empty($ad_id)) {
352
+                                // 查询更新条件
353
+                                $where = [
354
+                                    'id'   => $ad_id,
355
+                                    'lang' => $this->admin_lang,
356
+                                ];
357
+                                if ($ad_db->where($where)->count() > 0) {
358
+                                    // 主要参数
359
+                                    $AdData['litpic']      = $value;
360
+                                    $AdData['title']       = $post['img_title'][$key];
361
+                                    $AdData['links']       = $post['img_links'][$key];
362
+                                    $AdData['intro']       = $post['img_intro'][$key];
363
+                                    $AdData['target']      = $target;
364
+                                    // 其他参数
365
+                                    $AdData['sort_order']  = $i++;
366
+                                    $AdData['update_time'] = getTime();
367
+                                    // 更新,不需要同步多语言
368
+                                    $ad_db->where($where)->update($AdData);
369
+                                } else {
370
+                                    // 主要参数
371
+                                    $AdData['litpic']      = $value;
372
+                                    $AdData['pid']         = $post['id'];
373
+                                    $AdData['title']       = $post['img_title'][$key];
374
+                                    $AdData['links']       = $post['img_links'][$key];
375
+                                    $AdData['intro']       = $post['img_intro'][$key];
376
+                                    $AdData['target']      = $target;
377
+                                    // 其他参数
378
+                                    $AdData['media_type']  = 1;
379
+                                    $AdData['admin_id']    = session('admin_id');
380
+                                    $AdData['lang']        = $this->admin_lang;
381
+                                    $AdData['sort_order']  = $i++;
382
+                                    $AdData['add_time']    = getTime();
383
+                                    $AdData['update_time'] = getTime();
384
+                                    $ad_id = $ad_db->add($AdData);
385
+                                    // 同步多语言
386
+                                    $this->syn_add_ad_language_attribute($ad_id);
387
+                                }
388
+                            } else {
389
+                                // 主要参数
390
+                                $AdData['litpic']      = $value;
391
+                                $AdData['pid']         = $post['id'];
392
+                                $AdData['title']       = $post['img_title'][$key];
393
+                                $AdData['links']       = $post['img_links'][$key];
394
+                                $AdData['intro']       = $post['img_intro'][$key];
395
+                                $AdData['target']      = $target;
396
+                                // 其他参数
397
+                                $AdData['media_type']  = 1;
398
+                                $AdData['admin_id']    = session('admin_id');
399
+                                $AdData['lang']        = $this->admin_lang;
400
+                                $AdData['sort_order']  = $i++;
401
+                                $AdData['add_time']    = getTime();
402
+                                $AdData['update_time'] = getTime();
403
+                                $ad_id = $ad_db->add($AdData);
404
+                                // 同步多语言
405
+                                $this->syn_add_ad_language_attribute($ad_id);
406
+                            }
407
+                        }
408
+                    }
409
+
410
+                } else if (2 == $post['type'] && !empty($post['video_litpic'])) { // 媒体类型
411
+                    // 去掉http:
412
+                    $video_litpic = str_replace("http:", "", $post['video_litpic']);
413
+                    // 去掉https:
414
+                    $video_litpic = str_replace("https:", "", $post['video_litpic']);
415
+                    if (!empty($post['video_id'])) {
416
+                        // 更新广告内容
417
+                        $AdData['litpic']      = $video_litpic;
418
+                        $AdData['title']       = trim($post['title']);
419
+                        $AdData['media_type']  = 2;
420
+                        $AdData['update_time'] = getTime();
421
+                        $ad_db->where('id', $post['video_id'])->update($AdData);
422
+                    } else {
423
+                        // 新增广告内容
424
+                        $AdData['litpic']      = $video_litpic;
425
+                        $AdData['pid']         = $post['id'];
426
+                        $AdData['title']       = trim($post['title']);
427
+                        $AdData['links']       = '';
428
+                        $AdData['intro']       = '';
429
+                        $AdData['target']      = 0;
430
+                        $AdData['media_type']  = 2;
431
+                        $AdData['admin_id']    = session('admin_id');
432
+                        $AdData['lang']        = $this->admin_lang;
433
+                        $AdData['sort_order']  = 1;
434
+                        $AdData['add_time']    = getTime();
435
+                        $AdData['update_time'] = getTime();
436
+                        $ad_id = $ad_db->add($AdData);
437
+                        // 同步多语言
438
+                        $this->syn_add_ad_language_attribute($ad_id);
439
+                    }
440
+                    
441
+                } else if (3 == $post['type'] && !empty($post['html_intro'])) { // HTML代码
442
+                    if (!empty($post['html_id'])) {
443
+                        // 更新广告内容
444
+                        $AdData['title']       = trim($post['title']);
445
+                        $AdData['intro']       = $post['html_intro'];
446
+                        $AdData['media_type']  = 3;
447
+                        $AdData['update_time'] = getTime();
448
+                        $ad_db->where('id', $post['html_id'])->update($AdData);
449
+                    } else {
450
+                        // 新增广告内容
451
+                        $AdData['litpic']      = '';
452
+                        $AdData['pid']         = $post['id'];
453
+                        $AdData['title']       = trim($post['title']);
454
+                        $AdData['intro']       = $post['html_intro'];
455
+                        $AdData['links']       = '';
456
+                        $AdData['target']      = 0;
457
+                        $AdData['media_type']  = 3;
458
+                        $AdData['admin_id']    = session('admin_id');
459
+                        $AdData['lang']        = $this->admin_lang;
460
+                        $AdData['sort_order']  = 1;
461
+                        $AdData['add_time']    = getTime();
462
+                        $AdData['update_time'] = getTime();
463
+                        $ad_id = $ad_db->add($AdData);
464
+                        // 同步多语言
465
+                        $this->syn_add_ad_language_attribute($ad_id);
466
+                    }
467
+                    
468
+                }
469
+                Cache::clear('ad');
470
+                adminLog('编辑广告:'.$post['title']);
471
+                $this->success("操作成功", url('AdPosition/index'));
472
+            } else {
473
+                $this->error("操作失败");
474
+            }
475
+        }
476
+
477
+        $assign_data = array();
478
+
479
+        $id = input('id/d');
480
+        $field = Db::name('ad_position')->field('a.*')->alias('a')->where(array('a.id'=>$id))->find();
481
+        if (empty($field)) $this->error('广告不存在,请联系管理员!');
482
+        switch ($field['type']) {
483
+            case '1':
484
+                $field['type_name'] = '图片';
485
+                break;
486
+            case '2':
487
+                $field['type_name'] = '多媒体';
488
+                break;
489
+            case '3':
490
+                $field['type_name'] = 'HTML代码';
491
+                break;
492
+        }
493
+        $assign_data['field'] = $field;
494
+
495
+        // 广告
496
+        $ad_data = Db::name('ad')->where(array('pid'=>$field['id']))->order('sort_order asc')->select();
497
+        foreach ($ad_data as $key => $val) {
498
+            if (1 == $val['media_type']) {
499
+                $ad_data[$key]['litpic'] = get_default_pic($val['litpic']); // 支持子目录
500
+            }
501
+        }
502
+        $assign_data['ad_data'] = $ad_data;
503
+
504
+        // 上传通道
505
+        $WeappConfig = Db::name('weapp')->field('code, status')->where('code', 'IN', ['Qiniuyun', 'AliyunOss', 'Cos'])->select();
506
+        $WeappOpen = [];
507
+        foreach ($WeappConfig as $value) {
508
+            if ('Qiniuyun' == $value['code']) {
509
+                $WeappOpen['qny_open'] = $value['status'];
510
+            } else if ('AliyunOss' == $value['code']) {
511
+                $WeappOpen['oss_open'] = $value['status'];
512
+            } else if ('Cos' == $value['code']) {
513
+                $WeappOpen['cos_open'] = $value['status'];
514
+            }
515
+        }
516
+        $this->assign('WeappOpen', $WeappOpen);
517
+
518
+        // 系统最大上传视频的大小
519
+        $file_size  = tpCache('global.file_size');
520
+        $postsize   = @ini_get('file_uploads') ? ini_get('post_max_size') : -1;
521
+        $fileupload = @ini_get('file_uploads') ? ini_get('upload_max_filesize') : -1;
522
+        $min_size   = strval($file_size) < strval($postsize) ? $file_size : $postsize;
523
+        $min_size   = strval($min_size) < strval($fileupload) ? $min_size : $fileupload;
524
+        $upload_max_filesize = intval($min_size) * 1024 * 1024;
525
+        $assign_data['upload_max_filesize'] = $upload_max_filesize;
526
+
527
+        // 视频类型
528
+        $media_type = tpCache('global.media_type');
529
+        $media_type = !empty($media_type) ? $media_type : config('global.media_ext');
530
+        $media_type = str_replace(",", "|", $media_type);
531
+        $assign_data['media_type'] = $media_type;
532
+
533
+        $this->assign($assign_data);
534
+        return $this->fetch();
535
+    }
536
+
537
+    /**
538
+     * 删除广告图片
539
+     */
540
+    public function del_imgupload()
541
+    {
542
+        if (is_language() && empty($this->globalConfig['language_split'])) {
543
+            $this->language_access(); // 多语言功能操作权限
544
+        }
545
+
546
+        $id_arr = input('del_id/a');
547
+        $id_arr = eyIntval($id_arr);
548
+        if(IS_POST && !empty($id_arr)){
549
+            /*多语言*/
550
+            $attr_name_arr = [];
551
+            if (empty($this->globalConfig['language_split'])) {
552
+                foreach ($id_arr as $key => $val) {
553
+                    $attr_name_arr[] = 'ad'.$val;
554
+                }
555
+                if (is_language()) {
556
+                    $new_id_arr = Db::name('language_attr')->where([
557
+                            'attr_name'  => ['IN', $attr_name_arr],
558
+                            'attr_group'    => 'ad',
559
+                        ])->column('attr_value');
560
+                    !empty($new_id_arr) && $id_arr = $new_id_arr;
561
+                }
562
+            } else {
563
+                if (get_admin_lang() == get_main_lang()) {
564
+                    foreach ($id_arr as $key => $val) {
565
+                        $attr_name_arr[] = 'ad'.$val;
566
+                    }
567
+                }
568
+            }
569
+            /*--end*/
570
+
571
+            $r = Db::name('ad')->where([
572
+                    'id' => ['IN', $id_arr],
573
+                ])
574
+                ->delete();
575
+            if ($r !== false) {
576
+                /*多语言*/
577
+                if (!empty($attr_name_arr)) {
578
+                    Db::name('language_attr')->where([
579
+                            'attr_name' => ['IN', $attr_name_arr],
580
+                            'attr_group'    => 'ad',
581
+                        ])->delete();
582
+
583
+                    Db::name('language_attribute')->where([
584
+                            'attr_name' => ['IN', $attr_name_arr],
585
+                            'attr_group'    => 'ad',
586
+                        ])->delete();
587
+                }
588
+                /*--end*/
589
+                Cache::clear('ad');
590
+                adminLog('删除广告-id:'.implode(',', $id_arr));
591
+            }
592
+        }
593
+    }
594
+
595
+    /**
596
+     * 删除
597
+     */
598
+    public function del()
599
+    {
600
+        if (is_language() && empty($this->globalConfig['language_split'])) {
601
+            $this->language_access(); // 多语言功能操作权限
602
+        }
603
+
604
+        $id_arr = input('del_id/a');
605
+        $id_arr = eyIntval($id_arr);
606
+        if(IS_POST && !empty($id_arr)){
607
+            foreach ($id_arr as $key => $val) {
608
+                if(array_key_exists($val, $this->ad_position_system_id)){
609
+                    $this->error('系统预定义,不能删除');
610
+                }
611
+            }
612
+
613
+            /*多语言*/
614
+            $attr_name_arr = [];
615
+            foreach ($id_arr as $key => $val) {
616
+                $attr_name_arr[] = 'adp'.$val;
617
+            }
618
+            if (is_language() && empty($this->globalConfig['language_split'])) {
619
+                $new_id_arr = Db::name('language_attr')->where([
620
+                        'attr_name' => ['IN', $attr_name_arr],
621
+                        'attr_group'    => 'ad_position',
622
+                    ])->column('attr_value');
623
+                !empty($new_id_arr) && $id_arr = $new_id_arr;
624
+            }
625
+            /*--end*/
626
+            $r = Db::name('ad_position')->where('id','IN',$id_arr)->delete();
627
+            if ($r !== false) {
628
+
629
+                /*多语言*/
630
+                if (!empty($attr_name_arr)) {
631
+                    if (get_admin_lang() == get_main_lang()) {
632
+                        Db::name('language_attribute')->where([
633
+                                'attr_name' => ['IN', $attr_name_arr],
634
+                                'attr_group'    => 'ad_position',
635
+                            ])->delete();
636
+                    }
637
+                    if (empty($this->globalConfig['language_split'])) {
638
+                        Db::name('language_attr')->where([
639
+                                'attr_name' => ['IN', $attr_name_arr],
640
+                                'attr_group'    => 'ad_position',
641
+                            ])->delete();
642
+                    } else {
643
+                        Db::name('language_attr')->where([
644
+                                'attr_value' => ['IN', $id_arr],
645
+                                'attr_group'    => 'ad_position',
646
+                            ])->delete();
647
+                    }
648
+                }
649
+                /*--end*/
650
+
651
+                $ad_ids = Db::name('ad')->where(['pid'=>['IN', $id_arr]])->column('id');
652
+                $attr_name_arr = [];
653
+                foreach ($ad_ids as $key => $val) {
654
+                    $attr_name_arr[] = "ad{$val}";
655
+                }
656
+                $r1 = Db::name('ad')->where('pid','IN',$id_arr)->delete();
657
+                if ($r1 !== false) {
658
+                    /*多语言*/
659
+                    if (!empty($attr_name_arr)) {
660
+                        if (get_admin_lang() == get_main_lang()) {
661
+                            Db::name('language_attribute')->where([
662
+                                    'attr_name' => ['IN', $attr_name_arr],
663
+                                    'attr_group'    => 'ad',
664
+                                ])->delete();
665
+                        }
666
+                        if (empty($this->globalConfig['language_split'])) {
667
+                            Db::name('language_attr')->where([
668
+                                    'attr_name' => ['IN', $attr_name_arr],
669
+                                    'attr_group'    => 'ad',
670
+                                ])->delete();
671
+                        } else {
672
+                            Db::name('language_attr')->where([
673
+                                    'attr_value' => ['IN', $ad_ids],
674
+                                    'attr_group'    => 'ad',
675
+                                ])->delete();
676
+                        }
677
+                    }
678
+                    /*--end*/
679
+                }
680
+
681
+                Cache::clear('ad');
682
+                adminLog('删除广告-id:'.implode(',', $id_arr));
683
+                $this->success('删除成功');
684
+            } else {
685
+                $this->error('删除失败');
686
+            }
687
+        }else{
688
+            $this->error('参数有误');
689
+        }
690
+    }
691
+
692
+    /**
693
+     * 打开预览视频
694
+     */
695
+    public function open_preview_video()
696
+    {
697
+        $post = input('post.');
698
+        $video_litpic = $post['video_litpic'];
699
+        if (!is_http_url($video_litpic)) {
700
+            $video_litpic = request()->domain() . handle_subdir_pic($video_litpic, 'media');
701
+        }
702
+        $this->success('执行成功', $video_litpic);
703
+    }
704
+
705
+    /**
706
+     * 检测广告名称是否存在重复
707
+     */
708
+    public function detection_title_repeat()
709
+    {
710
+        if (IS_AJAX_POST) {
711
+            $post = input('post.');
712
+            $where = [
713
+                'id'    => ['NEQ', $post['id']],
714
+                'title' => trim($post['title']),
715
+                'lang'  => $this->admin_lang,
716
+            ];
717
+            $count = Db::name('ad_position')->where($where)->count();
718
+            if (empty($count)) {
719
+                $this->success('检测通过');
720
+            } else {
721
+                $this->error('该广告名称已存在,请检查');
722
+            }
723
+        }
724
+    }
725
+
726
+    /**
727
+     * 同步新增广告位置ID到多语言的模板变量里
728
+     */
729
+    private function syn_add_language_attribute($adp_id)
730
+    {
731
+        /*单语言情况下不执行多语言代码*/
732
+        if (!is_language() || tpCache('language.language_split')) {
733
+            return true;
734
+        }
735
+        /*--end*/
736
+
737
+        $attr_group = 'ad_position';
738
+        $admin_lang = $this->admin_lang;
739
+        $main_lang = $this->main_lang;
740
+        $languageRow = Db::name('language')->field('mark')->order('id asc')->select();
741
+        if (!empty($languageRow) && $admin_lang == $main_lang) { // 当前语言是主体语言,即语言列表最早新增的语言
742
+            $ad_position_db = Db::name('ad_position');
743
+            $result = $ad_position_db->find($adp_id);
744
+            $attr_name = 'adp'.$adp_id;
745
+            $r = Db::name('language_attribute')->save([
746
+                'attr_title'    => $result['title'],
747
+                'attr_name'     => $attr_name,
748
+                'attr_group'    => $attr_group,
749
+                'add_time'      => getTime(),
750
+                'update_time'   => getTime(),
751
+            ]);
752
+            if (false !== $r) {
753
+                $data = [];
754
+                foreach ($languageRow as $key => $val) {
755
+                    /*同步新广告位置到其他语言广告位置列表*/
756
+                    if ($val['mark'] != $admin_lang) {
757
+                        $addsaveData = $result;
758
+                        $addsaveData['lang']  = $val['mark'];
759
+                        $addsaveData['title'] = $val['mark'].$addsaveData['title'];
760
+                        unset($addsaveData['id']);
761
+                        $adp_id = $ad_position_db->insertGetId($addsaveData);
762
+                    }
763
+                    /*--end*/
764
+                    
765
+                    /*所有语言绑定在主语言的ID容器里*/
766
+                    $data[] = [
767
+                        'attr_name' => $attr_name,
768
+                        'attr_value'    => $adp_id,
769
+                        'lang'  => $val['mark'],
770
+                        'attr_group'    => $attr_group,
771
+                        'add_time'      => getTime(),
772
+                        'update_time'   => getTime(),
773
+                    ];
774
+                    /*--end*/
775
+                }
776
+                if (!empty($data)) {
777
+                    model('LanguageAttr')->saveAll($data);
778
+                }
779
+            }
780
+        }
781
+    }
782
+
783
+    /**
784
+     * 同步新增广告ID到多语言的模板变量里
785
+     */
786
+   private function syn_add_ad_language_attribute($ad_id)
787
+    {
788
+        /*单语言情况下不执行多语言代码*/
789
+        if (!is_language() || tpCache('language.language_split')) {
790
+            return true;
791
+        }
792
+        /*--end*/
793
+
794
+        $attr_group = 'ad';
795
+        $admin_lang = $this->admin_lang;
796
+        $main_lang = get_main_lang();
797
+        $languageRow = Db::name('language')->field('mark')->order('id asc')->select();
798
+        if (!empty($languageRow) && $admin_lang == $main_lang) { // 当前语言是主体语言,即语言列表最早新增的语言
799
+            $ad_db = Db::name('ad');
800
+            $result = $ad_db->find($ad_id);
801
+            $attr_name = 'ad'.$ad_id;
802
+            $r = Db::name('language_attribute')->save([
803
+                'attr_title'    => $result['title'],
804
+                'attr_name'     => $attr_name,
805
+                'attr_group'    => $attr_group,
806
+                'add_time'      => getTime(),
807
+                'update_time'   => getTime(),
808
+            ]);
809
+            if (false !== $r) {
810
+                $data = [];
811
+                foreach ($languageRow as $key => $val) {
812
+                    /*同步新广告到其他语言广告列表*/
813
+                    if ($val['mark'] != $admin_lang) {
814
+                        $addsaveData = $result;
815
+                        $addsaveData['lang'] = $val['mark'];
816
+                        $newPid = Db::name('language_attr')->where([
817
+                                'attr_name' => 'adp'.$result['pid'],
818
+                                'attr_group'    => 'ad_position',
819
+                                'lang'  => $val['mark'],
820
+                            ])->getField('attr_value');
821
+                        $addsaveData['pid']   = $newPid;
822
+                        $addsaveData['title'] = $val['mark'].$addsaveData['title'];
823
+                        unset($addsaveData['id']);
824
+                        $ad_id = $ad_db->insertGetId($addsaveData);
825
+                    }
826
+                    /*--end*/
827
+                    
828
+                    /*所有语言绑定在主语言的ID容器里*/
829
+                    $data[] = [
830
+                        'attr_name'   => $attr_name,
831
+                        'attr_value'  => $ad_id,
832
+                        'lang'        => $val['mark'],
833
+                        'attr_group'  => $attr_group,
834
+                        'add_time'    => getTime(),
835
+                        'update_time' => getTime(),
836
+                    ];
837
+                    /*--end*/
838
+                }
839
+                if (!empty($data)) {
840
+                    model('LanguageAttr')->saveAll($data);
841
+                }
842
+            }
843
+        }
844
+    }
845
+}

+ 22
- 0
application/admin/template/index/switch_map.htm View File

@@ -319,6 +319,28 @@
319 319
                              </li>
320 320
                          {/eq}
321 321
 
322
+
323
+                         <!--新增职称管理模块--->
324
+                         {eq name="'ZcPosition@index'|is_check_access" value="1"}
325
+                         <li class="more_li" id="li_1006" {if condition="in_array('1006',$admin_menu_id_arr) || in_array('1006',$not_role_menu_id_arr)"}style="display:none"{/if}>
326
+                         <div class="flex-dir-row flex-a-center">
327
+                             <div class="icon_bg icon_bg_no">
328
+                                 <i class="iconfont e-guanggao f-20 col-848484" ></i>
329
+                             </div>
330
+                             <div class="ml-8 white-space">
331
+                                 <a href="javascript:void(0);" data-href="{:url('ZcPosition/index')}"  onclick="gourl2(this,1);">职称管理</a>
332
+                             </div>
333
+                         </div>
334
+                         {notempty name="$is_founder"}
335
+                         <div class="icon-link_add">
336
+                             <div title="加入导航显示" data-menu_id="1006" class="iconfont e-jiahao2"></div>
337
+                         </div>
338
+                         {/notempty}
339
+                         </li>
340
+                         {/eq}
341
+
342
+
343
+
322 344
                          {eq name="'Tags@index'|is_check_access" value="1"}
323 345
                              <li class="more_li" id="li_2004011" {if condition="in_array('2004011',$admin_menu_id_arr) || in_array('2004011',$not_role_menu_id_arr)"}style="display:none"{/if}>
324 346
                                  <div class="flex-dir-row flex-a-center">

+ 746
- 0
application/admin/template/zc_position/add.htm View File

@@ -0,0 +1,746 @@
1
+{include file="public/layout" /}
2
+
3
+<body class="bodystyle" style="overflow-y: scroll;">
4
+<div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
5
+<div id="append_parent"></div>
6
+<div id="ajaxwaitid"></div>
7
+<div class="page min-hg-c-10">
8
+    <form class="form-horizontal" id="post_form" action="{:url('AdPosition/add')}" method="post">
9
+        <div class="ncap-form-default">
10
+            <dl class="row">
11
+                <dt class="tit"> <label for="title"><em>*</em>广告名称</label> </dt>
12
+                <dd class="opt">
13
+                    <input type="text" name="title" id="title" onkeyup="DetectionTitleRepeat(this);" class="input-txt" autocomplete="off">
14
+                    <span class="err"></span>
15
+                    <p class="notic2 red" id="title_tips"></p>
16
+                </dd>
17
+            </dl>
18
+
19
+            <dl class="row">
20
+                <dt class="tit"> <label for="type">广告类型</label> </dt>
21
+                <dd class="opt">
22
+                    <label class="curpoin"><input type="radio" id="type1" name="type" value="1" onclick="TypeSwitch(1);">图片</label>
23
+                    &nbsp; &nbsp;
24
+                    <label class="curpoin"><input type="radio" id="type2" name="type" value="2" onclick="TypeSwitch(2);">多媒体</label>
25
+                    &nbsp; &nbsp;
26
+                    <label class="curpoin"><input type="radio" id="type3" name="type" value="3" onclick="TypeSwitch(3);">HTML代码</label>
27
+                    <span class="err"></span>
28
+                    <p class="notic"></p>
29
+                </dd>
30
+            </dl>
31
+
32
+            <dl class="row 1615775137_dl" style="display: none;" id="1615775137_1">
33
+                <dt class="tit"> <label>广告内容</label> </dt>
34
+                <dd class="opt">
35
+                    <div class="tab-pane" id="tab_imgupload">
36
+                        <table class="table table-bordered">
37
+                            <tbody>
38
+                            <tr>
39
+                                <td >
40
+                                    <div class="sort-list">
41
+                                        <div class="images_upload">
42
+                                        </div>
43
+                                    </div>
44
+                                    <a href="javascript:void(0);" onClick="GetUploadify(30,'','allimg','imgupload_call_back');" class="img-upload b-img-upload mb15" title="点击上传">
45
+                                        <div class="y-line"></div>
46
+                                        <div class="x-line"></div>
47
+                                    </a>
48
+                                </td>
49
+                            </tr>
50
+                            </tbody>
51
+                        </table>
52
+                    </div>
53
+                    <!-- 上传图片显示的样板 start -->
54
+                    <div class="images_upload_tpl none">
55
+                        <div class="images_upload ic">
56
+                            <div class="ic">
57
+                                <div class='upimg' title="拖动修改排序" onmouseover="upimgMouseover(this);" onmouseout="upimgMouseout(this);">
58
+                                    <div class='icaction' style="display: none">
59
+                                        <span class="load_images" onclick="">
60
+                                            <a href="javascript:void(0);" style="color: white">
61
+                                                <i class='fa fa-search-plus'></i>大图
62
+                                            </a>
63
+                                        </span>
64
+                                        <span class="load_images" onclick="">
65
+                                            <i class='fa fa-file-text-o'></i>信息
66
+                                        </span>
67
+                                    </div>
68
+                                    <div class='cover-bg' style="display: none"></div>
69
+                                    <img src="__STATIC__/admin/images/add-button.jpg"/>
70
+                                     <a class="delect" href="javascript:void(0);" title="删除"></a>
71
+                                </div>
72
+
73
+                                <div class="load_input" data-showOrHide="hide">
74
+                                    <input type="hidden"/>
75
+                                    <span class="span_input"> <input type="hidden"/> </span>
76
+                                    <textarea placeholder="请输入标题..." style="height: 28px;"></textarea>
77
+                                    <textarea placeholder="请输入链接网址..." style="height: 28px;"></textarea>
78
+                                    <textarea placeholder="广告注释:支持HTML代码" style="height: 64px;"></textarea>
79
+                                    <div class="operation">
80
+                                        <a href="javascript:void(0)">&nbsp;&nbsp;</a>
81
+                                        <a href="javascript:void(0)">&nbsp;&nbsp;</a>
82
+                                        <a style="width: 32%;" href="javascript:void(0);">&nbsp;&nbsp;</a>
83
+                                    </div>
84
+                                 </div>    
85
+                            </div>
86
+                        </div>
87
+                    </div>
88
+                    <!-- 上传图片显示的样板 end -->
89
+                </dd>
90
+            </dl>
91
+
92
+            <dl class="row 1615775137_dl" style="display: none;" id="1615775137_2">
93
+                <dt class="tit"> <label for="type">广告内容</label> </dt>
94
+                <dd class="opt">
95
+                    <input type="text" name="video_litpic" id="video_litpic" class="input-txt">
96
+                    <input type="file" id="courseware_file" data-type='local' onchange="upload_video_litpic_1615775137(this)" style="display: none;">
97
+                    {eq name="$WeappOpen.qny_open" value="1"}
98
+                    &nbsp;<a href="javascript:void(0);" class="ncap-btn ncap-btn-green" id="upload_video_litpic_qiniu" onclick="$('#courseware_file').attr('data-type', 'qiniu').trigger('click');">七牛云上传</a>
99
+                    {/eq}
100
+                    {eq name="$WeappOpen.oss_open" value="1"}
101
+                    &nbsp;<a href="javascript:void(0);" class="ncap-btn ncap-btn-green" id="upload_video_litpic_oss" onclick="$('#courseware_file').attr('data-type', 'oss').trigger('click');">oss上传</a>
102
+                    {/eq}
103
+                    {eq name="$WeappOpen.cos_open" value="1"}
104
+                    &nbsp;<a href="javascript:void(0);" class="ncap-btn ncap-btn-green" id="upload_video_litpic_cos" onclick="$('#courseware_file').attr('data-type', 'cos').trigger('click');">cos上传</a>
105
+                    {/eq}
106
+                    &nbsp;<a href="javascript:void(0);" class="ncap-btn ncap-btn-green " id="upload_video_litpic_local" onclick="$('#courseware_file').attr('data-type', 'local').trigger('click');">本地上传</a>
107
+                    <input type="hidden" id="OpenPreviewVideoUrl" value="{:url('AdPosition/open_preview_video')}">
108
+                    &nbsp;<a href="javascript:void(0);" class="ncap-btn ncap-btn-green" id="PreviewVideo" onclick="OpenPreviewVideo();">预览</a>
109
+                </dd>
110
+            </dl>
111
+
112
+            <dl class="row 1615775137_dl" style="display: none;" id="1615775137_3">
113
+                <dt class="tit"> <label for="type">广告内容</label> </dt>
114
+                <dd class="opt">
115
+                    <textarea rows="5" cols="60" id="html_intro" name="html_intro" style="height: 200px;"></textarea>
116
+                    <span class="err"></span>
117
+                    <p class="notic"></p>
118
+                </dd>
119
+            </dl>
120
+
121
+            <dl class="row">
122
+                <dt class="tit">
123
+                    <label>备注信息</label>
124
+                </dt>
125
+                <dd class="opt">          
126
+                    <textarea rows="5" cols="60" id="intro" name="intro" style="height:60px;"></textarea>
127
+                    <span class="err"></span>
128
+                    <p class="notic"></p>
129
+                </dd>
130
+            </dl> 
131
+
132
+            <div class="bot"><a href="JavaScript:void(0);" onclick="checkForm();" class="ncap-btn-big ncap-btn-green" id="submitBtn">确认提交</a></div>
133
+        </div>
134
+    </form>
135
+</div>
136
+
137
+<script type="text/javascript">
138
+    var SelectedType = 1;
139
+    $(function() {
140
+        // 新增时,广告类型默认选中图片类型
141
+        $('#type1').prop('checked', 'checked');
142
+        // 新增时,默认显示图片上传
143
+        $('#1615775137_1').show();
144
+        // 多媒体类型 && 广告内容不为空 则执行显示 否则 执行隐藏
145
+        VideoLitpicValue('#video_litpic');
146
+    });
147
+
148
+    // 切换广告类型
149
+    function TypeSwitch(typeValue) {
150
+        // 隐藏全部类型内容
151
+        $('.1615775137_dl').hide();
152
+        // 显示指定类型内容
153
+        $('#1615775137_'+typeValue).show();
154
+        // 切换类型后设置为当前切换的类型
155
+        SelectedType = typeValue;
156
+        // 多媒体类型 && 广告内容不为空 则执行显示 否则 执行隐藏
157
+        VideoLitpicValue('#video_litpic');
158
+    }
159
+
160
+    // 多媒体类型 && 广告内容不为空 则执行显示 否则 执行隐藏
161
+    function VideoLitpicValue(obj) {
162
+        // 获取广告内容(多媒体为播放链接)
163
+        // var video_litpic = $(obj).val();
164
+        // 判断隐藏/显示预览按钮if (2 == SelectedType && video_litpic)
165
+        if (2 == SelectedType) {
166
+            $('#PreviewVideo').show();
167
+        } else {
168
+            $('#PreviewVideo').hide();
169
+        }
170
+    }
171
+
172
+    // 打开预览视频
173
+    function OpenPreviewVideo() {
174
+        // 获取视频链接
175
+        var video_litpic = $('#video_litpic').val();
176
+        if (video_litpic == '') {
177
+            $('#video_litpic').focus();
178
+            showErrorMsg('请先上传视频');
179
+            return false;
180
+        }
181
+
182
+        /* 视频链接后缀验证处理 */
183
+        var fileExt = video_litpic.substr(video_litpic.lastIndexOf('.')).toLowerCase();
184
+        var fileExt = judgeExt(fileExt);
185
+        if (fileExt == -1) {
186
+            $('#video_litpic').focus();
187
+            showErrorMsg('不支持的视频格式,可在附件设置中修改');
188
+            return false;
189
+        }
190
+        /* END */
191
+
192
+        /* 视频链接是否存在斜杠处理 */
193
+        var fileInfo = video_litpic.lastIndexOf('/');
194
+        if (fileInfo == -1) {
195
+            $('#video_litpic').focus();
196
+            showErrorMsg('视频链接不完整,无法正常预览');
197
+            return false;
198
+        }
199
+        /* END */
200
+
201
+        // 打开视频播放
202
+        $.ajax({
203
+            type : 'post',
204
+            url  : $('#OpenPreviewVideoUrl').val(),
205
+            data : {video_litpic: video_litpic},
206
+            dataType : 'json',
207
+            success : function(res) {
208
+                if (1 == res.code) {
209
+                    var PreviewVideo = "<video style='width:100%; height:100%;' src='"+res.url+"' controls preload='auto' oncontextmenu='return fase' autoplay></video>";
210
+                    layer.open({
211
+                        type: 1,
212
+                        title: false,
213
+                        fixed: true, //不固定
214
+                        shadeClose: false,
215
+                        shade: layer_shade,
216
+                        area: ['80%', '80%'],
217
+                        content: PreviewVideo
218
+                    });
219
+                } else {
220
+                    showErrorMsg(res.msg);
221
+                }
222
+            },
223
+            error: function(e) {
224
+                showErrorAlert(e.responseText);
225
+            }
226
+        });
227
+    }
228
+
229
+    // 上传媒体文件
230
+    function upload_video_litpic_1615775137(e) {
231
+        var data_type = $(e).attr('data-type');
232
+        if ('qiniu' == data_type) {
233
+            // 七牛云上传
234
+            upload_video_litpic_qiniu(e);
235
+        } else if ('oss' == data_type) {
236
+             // OSS上传
237
+            upload_video_litpic_oss(e);
238
+        } else if ('cos' == data_type) {
239
+             // COS上传
240
+            upload_video_litpic_cos(e);
241
+        } else {
242
+            // 本地上传
243
+            upload_video_litpic_local(e);
244
+        }
245
+    }
246
+
247
+    // 七牛云上传
248
+    function upload_video_litpic_qiniu(e) {
249
+        // 获取文件路径名
250
+        var file = $(e)[0].files[0];
251
+
252
+        // 验证上传格式
253
+        var fileName = file.name;
254
+        var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
255
+        var ext = judgeExt(fileExt);
256
+        if (ext == -1) {
257
+            showErrorMsg('不支持选中的视频格式,可在附件设置中修改');
258
+            return false;
259
+        }
260
+
261
+        // 验证上传大小
262
+        var size = "{$upload_max_filesize}";
263
+        if (file.size > size) {
264
+            showErrorMsg('视频大小超过限制,可在附件设置中修改');
265
+            return false;
266
+        }
267
+
268
+        // 执行上传
269
+        layer_loading('上传本地');
270
+        $.ajax({
271
+            type: 'POST',
272
+            url: '__ROOT_DIR__/index.php?m=plugins&c=Qiniuyun&a=qiniu_upload',
273
+            data: {_ajax: 1},
274
+            dataType: "JSON",
275
+            success: function(res1) {
276
+                if (1 == res1.code) {
277
+                    var token  = res1.data.token;
278
+                    var formData = new FormData();
279
+                    formData.append('file', file);
280
+                    formData.append('token', token);
281
+
282
+                    fileName = res1.data.filePath + fileExt;
283
+                    formData.append('key', fileName);
284
+                    $.ajax({
285
+                        url: res1.data.uphost,
286
+                        type: 'POST',
287
+                        dataType: 'JSON',
288
+                        data: formData,
289
+                        timeout: 1200000,
290
+                        cache: false,
291
+                        processData: false,
292
+                        contentType: false,
293
+                        xhr: function () {
294
+                            myXhr = $.ajaxSettings.xhr();
295
+                            if (myXhr.upload) {
296
+                                myXhr.upload.addEventListener('progress', function(e){
297
+                                    var curr = e.loaded;
298
+                                    var total = e.total;
299
+                                    process = parseInt(curr / total * 100);
300
+                                    $("#upload_video_litpic_qiniu").text('上传中...'+process+"%");
301
+                                });
302
+                            }
303
+                            return myXhr;
304
+                        },
305
+                        success: function(res2) {
306
+                            layer.closeAll();
307
+                            $("#upload_video_litpic_qiniu").text('上传成功');
308
+                            setTimeout(function() {
309
+                                $('#upload_video_litpic_qiniu').text('七牛云上传');
310
+                            }, 2000);
311
+                            var video_url = res1.data.domain + "/" + res2.key;
312
+                            $("#video_litpic").val(video_url);
313
+                        },
314
+                        error: function(e) {
315
+                            layer.closeAll();
316
+                            showErrorMsg(e.responseText);
317
+                            return false;
318
+                        }
319
+                    });
320
+                } else {
321
+                    layer.closeAll();
322
+                    showErrorMsg(res1.msg);
323
+                }
324
+            },
325
+            error: function(e) {
326
+                layer.closeAll();
327
+                showErrorMsg(e.responseText);
328
+            }
329
+        });
330
+    }
331
+
332
+    // 阿里云OSS上传
333
+    function upload_video_litpic_oss(e) {
334
+        // 获取文件路径名
335
+        var file = $(e)[0].files[0];
336
+
337
+        // 验证上传格式
338
+        var fileName = file.name;
339
+        var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
340
+        var ext = judgeExt(fileExt);
341
+        if (ext == -1) {
342
+            showErrorMsg('不支持选中的视频格式,可在附件设置中修改');
343
+            return false;
344
+        }
345
+
346
+        // 验证上传大小
347
+        var size = "{$upload_max_filesize}";
348
+        if (file.size > size) {
349
+            showErrorMsg('视频大小超过限制,可在附件设置中修改');
350
+            return false;
351
+        }
352
+
353
+        // 执行上传
354
+        layer_loading('上传阿里云OSS');
355
+        $.ajax({
356
+            type: 'POST',
357
+            url: '__ROOT_DIR__/index.php?m=plugins&c=AliyunOss&a=oss_upload',
358
+            data: {_ajax: 1},
359
+            dataType: "JSON",
360
+            success: function(res1){
361
+                if (1 == res1.code){
362
+                    fileName = res1.data.filePath + fileExt;
363
+                    //组装发送数据
364
+                    var request = new FormData();
365
+                    request.append("OSSAccessKeyId",res1.data.accessid);
366
+                    request.append("policy",res1.data.policy);
367
+                    request.append("Signature",res1.data.signature);
368
+                    request.append("key",fileName);
369
+                    request.append("success_action_status",201);
370
+                    request.append('file', file);
371
+
372
+                    $.ajax({
373
+                        url : res1.data.host,
374
+                        data : request,
375
+                        processData: false,
376
+                        cache: false,
377
+                        contentType: false,
378
+                        dataType: 'xml',
379
+                        type : 'post',
380
+                        xhr: function () {
381
+                            myXhr = $.ajaxSettings.xhr();
382
+                            if (myXhr.upload) {
383
+                                myXhr.upload.addEventListener('progress', function(e){
384
+                                    var curr = e.loaded;
385
+                                    var total = e.total;
386
+                                    var process = parseInt(curr / total * 100);
387
+                                    $("#upload_video_litpic_oss").text('上传中...'+process+"%");
388
+                                });
389
+                            }
390
+                            return myXhr;
391
+                        },
392
+                        success : function(data) {
393
+                            layer.closeAll();
394
+                            var res = $(data).find('PostResponse');
395
+                            if (res) {
396
+                                var key = res.find('Key').text();
397
+                                $("#upload_video_litpic_oss").text('上传成功');
398
+                                setTimeout(function() {
399
+                                    $('#upload_video_litpic_oss').text('oss上传');
400
+                                }, 2000);
401
+                                var video_url = res1.data.domain + "/" + key;
402
+                                $("#video_litpic").val(video_url);
403
+                            } else {
404
+                                $("#upload_video_litpic_oss").text('上传失败');
405
+                                setTimeout(function() {
406
+                                    $('#upload_video_litpic_oss').text('oss上传');
407
+                                }, 2000);
408
+                            }
409
+                        },
410
+                        error : function(e) {
411
+                            layer.closeAll();
412
+                            console.log(e.responseText);
413
+                        }
414
+                    });
415
+                } else {
416
+                    layer.closeAll();
417
+                    showErrorMsg(res1.msg);
418
+                }
419
+            },
420
+            error: function(e) {
421
+                layer.closeAll();
422
+                showErrorMsg(e.responseText);
423
+            }
424
+        });
425
+    }
426
+
427
+    // 腾讯云COS上传
428
+    function upload_video_litpic_cos(e) {
429
+        // 获取文件路径名
430
+        var file = $(e)[0].files[0];
431
+
432
+        // 验证上传格式
433
+        var fileName = file.name;
434
+        var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
435
+        var ext = judgeExt(fileExt);
436
+        if (ext == -1) {
437
+            showErrorMsg('不支持选中的视频格式,可在附件设置中修改');
438
+            return false;
439
+        }
440
+
441
+        // 验证上传大小
442
+        var size = "{$upload_max_filesize}";
443
+        if (file.size > size) {
444
+            showErrorMsg('视频大小超过限制,可在附件设置中修改');
445
+            return false;
446
+        }
447
+
448
+        // 上传参数
449
+        var formData = new FormData();
450
+            formData.append('file', file);
451
+            formData.append('file_ext', fileExt);
452
+
453
+        // 执行上传
454
+        $.ajax({
455
+            type: 'post',
456
+            url: '__ROOT_DIR__/index.php?m=plugins&c=Cos&a=cos_upload&_ajax=1',
457
+            data: formData,
458
+            contentType: false,
459
+            processData: false,
460
+            dataType: 'json',
461
+            xhr: function () {
462
+                myXhr = $.ajaxSettings.xhr();
463
+                if (myXhr.upload) {
464
+                    myXhr.upload.addEventListener('progress', function(e){
465
+                        var curr = e.loaded;
466
+                        var total = e.total;
467
+                        process = parseInt(curr / total * 100);
468
+                        if (100 == process) {
469
+                            process = 99;
470
+                            layer_loading('上传腾讯云');
471
+                        }
472
+                        $("#upload_video_litpic_cos").text('上传中...'+process+"%");
473
+                        
474
+                    });
475
+                }
476
+                return myXhr;
477
+            },
478
+            success: function(res) {
479
+                layer.closeAll();
480
+                if (1 == res.code) {
481
+                    $("#video_litpic").val(res.data.url);
482
+                    $("#upload_video_litpic_cos").text('上传成功');
483
+                } else {
484
+                    $("#upload_video_litpic_cos").text('上传失败');
485
+                }
486
+                setTimeout(function() {
487
+                    $('#upload_video_litpic_cos').text('cos上传');
488
+                }, 2000);
489
+            },
490
+            error: function(e) {
491
+                layer.closeAll();
492
+                showErrorMsg(e.responseText);
493
+            }
494
+        });
495
+    }
496
+
497
+    // 本地上传
498
+    function upload_video_litpic_local(e) {
499
+        // 获取文件路径名
500
+        var file = $(e)[0].files[0];
501
+
502
+        // 验证上传格式
503
+        var fileName = file.name;
504
+        var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
505
+        var ext = judgeExt(fileExt);
506
+        if (ext == -1) {
507
+            showErrorMsg('不支持选中的视频格式,可在附件设置中修改');
508
+            return false;
509
+        }
510
+
511
+        // 验证上传大小
512
+        var size = "{$upload_max_filesize}";
513
+        if (file.size > size) {
514
+            showErrorMsg('视频大小超过限制,可在附件设置中修改');
515
+            return false;
516
+        }
517
+
518
+        // 定义上传数据
519
+        var formData = new FormData();
520
+        formData.append('file', file);
521
+
522
+        // 执行上传
523
+        layer_loading('上传本地');
524
+        $.ajax({
525
+            type: 'post',
526
+            url : "{:url('Ueditor/upVideo', ['savepath'=>'media'])}",
527
+            data: formData,
528
+            contentType: false,
529
+            processData: false,
530
+            dataType: 'json',
531
+            xhr: function () {
532
+                myXhr = $.ajaxSettings.xhr();
533
+                if (myXhr.upload) {
534
+                    myXhr.upload.addEventListener('progress', function(e){
535
+                        var curr = e.loaded;
536
+                        var total = e.total;
537
+                        process = parseInt(curr / total * 100);
538
+                        $("#upload_video_litpic_local").html('上传中...'+process+"%");
539
+                    });
540
+                }
541
+                return myXhr;
542
+            },
543
+            success: function (res) {
544
+                layer.closeAll();
545
+                $("#upload_video_litpic_local").html('上传成功');
546
+                setTimeout(function() {
547
+                    $('#upload_video_litpic_local').html('本地上传');
548
+                }, 2000);
549
+                if ("SUCCESS" == res.state) {
550
+                    $("#video_litpic").val(res.url);
551
+                } else {
552
+                    showErrorMsg(res.msg);
553
+                }
554
+            }
555
+        });
556
+    }
557
+
558
+    // 验证格式
559
+    function judgeExt(ext) {
560
+        var type = "{$media_type}";
561
+        var extArr = [];
562
+        extArr = type.split("|");
563
+        var ext = ext.replace(".","");
564
+        return extArr.indexOf(ext);
565
+    }
566
+</script>
567
+
568
+<script type="text/javascript">
569
+	var parentObj = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
570
+    // 勾选新窗口打开链接
571
+    function CheckedTarget(t){
572
+        if ($(t).is(':checked')) {
573
+            $(t).parent().find('input[name="img_target[]"]').val(1);
574
+        }else{
575
+            $(t).parent().find('input[name="img_target[]"]').val(0);
576
+        }
577
+    }
578
+    // 鼠标事件,加载查看大图和更新图片
579
+    function upimgMouseover(obj)
580
+    {
581
+        $(obj).find('div.icaction').show();
582
+        $(obj).find('div.cover-bg').show();
583
+    }
584
+    function upimgMouseout(obj)
585
+    {
586
+        $(obj).find('div.icaction').hide();
587
+        $(obj).find('div.cover-bg').hide();
588
+    }
589
+
590
+    // 检测广告名称是否存在重复
591
+    function DetectionTitleRepeat(obj) {
592
+        // 当前广告ID
593
+        var id = 0;
594
+        // 传入的广告名称
595
+        var title = $(obj).val();
596
+        // 执行检测
597
+        $.ajax({
598
+            type: 'post',
599
+            url : "{:url('AdPosition/detection_title_repeat', ['_ajax'=>1])}",
600
+            data: {id: id, title: title},
601
+            dataType: 'json',
602
+            success: function(res) {
603
+                if (0 == res.code) {
604
+                    $('#title_tips').show().html(res.msg);
605
+                } else {
606
+                    $('#title_tips').hide().html('');
607
+                }
608
+            },
609
+            error: function(e){
610
+                layer.closeAll();
611
+                showErrorAlert(e.responseText);
612
+            }
613
+        });
614
+    }
615
+
616
+    // 判断输入框是否为空
617
+    function checkForm(){
618
+        if($('input[name=title]').val() == ''){
619
+            layer.msg('广告位名称不能为空!', {icon: 2,time: 1000});
620
+            return false;
621
+        }
622
+        layer_loading('正在处理');
623
+        $.ajax({
624
+            type : 'post',
625
+            url : "{:url('AdPosition/add', ['_ajax'=>1])}",
626
+            data : $('#post_form').serialize(),
627
+            dataType : 'json',
628
+            success : function(res) {
629
+                layer.closeAll();
630
+                if (1 == res.code) {
631
+                    var _parent = parent;
632
+                    _parent.layer.close(parentObj);
633
+                    _parent.layer.msg(res.msg, {icon: 1, shade: layer_shade, time: 1000}, function() {
634
+                        _parent.window.location.reload();
635
+                    });
636
+                } else {
637
+                    showErrorMsg(res.msg);
638
+                }
639
+            },
640
+            error: function(e) {
641
+                layer.closeAll();
642
+                showErrorAlert(e.responseText);
643
+            }
644
+        });
645
+    }
646
+
647
+    // 显示信息输入框
648
+    function ShowInput(id) {
649
+        var obj = $("#"+id+"_ShowInput");
650
+        var showOrHide = obj.attr('data-showOrHide');
651
+        if ('hide' == showOrHide) {
652
+            obj.show().attr('data-showOrHide', 'show');
653
+        } else {
654
+            obj.hide().attr('data-showOrHide', 'hide');
655
+        }
656
+    }
657
+
658
+    // 隐藏信息输入
659
+    function HideInput(id) {
660
+        $("#"+id+"_ShowInput").hide().attr('data-showOrHide', 'hide');
661
+    }
662
+
663
+    // 上传图集相册回调函数
664
+    function imgupload_call_back(paths){
665
+        var last_div = $(".images_upload_tpl").html();
666
+        var inputs   = $('.span_input input');
667
+        var timestamp = 0;
668
+
669
+        for (var i=0; i<paths.length; i++){
670
+            // 生成新的时间戳
671
+            timestamp = (new Date()).getTime();
672
+            // 插入一个 新图片
673
+            $(".images_upload:eq(0)").before(last_div);
674
+            // 处理他的链接地址
675
+            $(".images_upload:eq(0)").find('span:eq(0)').attr('onclick',"Images('"+paths[i]+"', 900, 600);");
676
+            // 处理信息显示隐藏按钮
677
+            $(".images_upload:eq(0)").find('span:eq(1)').attr('onclick', "ShowInput('"+timestamp+"');");
678
+            // 处理他的图片路径
679
+            $(".images_upload:eq(0)").find('img').attr('src',paths[i]);
680
+            // 处理删除按钮
681
+            $(".images_upload:eq(0)").find('a:eq(1)').attr('onclick', "ClearPicArr(this, '"+paths[i]+"', 0);");
682
+            // 处理图片信息框ID
683
+            $(".images_upload:eq(0)").find('.load_input:eq(0)').attr('id', timestamp+'_ShowInput');
684
+
685
+            // 处理图片路径及隐藏域
686
+            if (inputs.length > '0') {
687
+                // 修改隐藏域,提交ID隐藏域
688
+                $(".images_upload:eq(0)").find('input:eq(0)').attr('name','img_id[]').attr('value',''); 
689
+                // 修改隐藏域,提交图片隐藏域
690
+                $(".span_input:eq(0)").find('input:eq(0)').attr('name','img_litpic[]').attr('value',paths[i]);
691
+                // 提交标题
692
+                $(".images_upload:eq(0)").find('textarea:eq(0)').attr('name','img_title[]');
693
+                // 提交跳转链接
694
+                $(".images_upload:eq(0)").find('textarea:eq(1)').attr('name','img_links[]');
695
+                // 处理内容描述
696
+                $(".images_upload:eq(0)").find('textarea:eq(2)').attr('name','img_intro[]');
697
+                // 提交新窗口选项
698
+                $(".images_upload:eq(0)").find('div.operation a:eq(0)').html("<label><input type='checkbox' title='在新窗口打开' onclick='CheckedTarget(this)'/>新窗口<input type='hidden' name='img_target[]' value='0'></label>");
699
+                // 处理收回按钮
700
+                $(".images_upload:eq(0)").find('div.operation a:eq(2)').attr('onclick', "HideInput('"+timestamp+"');").attr('title', "收回").html('<i style="font-size:16px;" class="fa fa-angle-double-up"></i>');
701
+            }
702
+        }
703
+    }
704
+
705
+    // 上传之后删除组图input
706
+    function ClearPicArr(obj,path)
707
+    {
708
+        $(obj).parent().parent().parent().remove(); // 删除完服务器的, 再删除 html上的图片
709
+        $.ajax({
710
+            type:'POST',
711
+            url:"{:url('Uploadimgnew/delupload')}",
712
+            data:{action:"del", filename:path, _ajax:1},
713
+            success:function(){}
714
+        }); 
715
+    }
716
+
717
+    // 代码调用js
718
+    function copyToClipBoard(id) {
719
+        var adstr = "{eyou:ad aid='" + id + "'}\r\n   <a href='{$"+"field.links}' {$"+"field.target}><img src='{$"+"field.litpic}' alt='{$"+"field.title}' /></a>\r\n{/eyou:ad";
720
+        var contentdiv = '<div class="dialog_content" style="margin: 0px; padding: 0px;"><dl style="padding:10px 30px;line-height:30px"><dd>标签 ad 调用:</dd>'
721
+        contentdiv += '<textarea rows="4" cols="60" style="width:400px;height:80px;">' + adstr + '}</textarea>'
722
+        contentdiv += '<dd style="border-top: dotted 1px #E7E7E7; color: #F60;">请将对应标签代码复制并粘贴到对应模板文件中!</dd></dl></div>'
723
+        layer.open({
724
+            title: '代码调用',
725
+            type: 1,
726
+            shade: layer_shade,
727
+            skin: 'layui-layer-demo',
728
+            area: ['480px', '240px'], //宽高
729
+            content: contentdiv
730
+        });
731
+    }
732
+
733
+    // 图集相册的拖动排序相关 js
734
+    $( ".sort-list" ).sortable({
735
+        start: function( event, ui) {
736
+        
737
+        }
738
+        ,stop: function( event, ui ) {
739
+
740
+        }
741
+    });
742
+    //因为他们要拖动,所以尽量设置他们的文字不能选择。  
743
+    // $( ".sort-list" ).disableSelection();
744
+</script>
745
+
746
+{include file="public/footer" /}

+ 827
- 0
application/admin/template/zc_position/edit.htm View File

@@ -0,0 +1,827 @@
1
+{include file="public/layout" /}
2
+
3
+<body class="ad_postion bodystyle" style="overflow-y: scroll;">
4
+<div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
5
+<div id="append_parent"></div>
6
+<div id="ajaxwaitid"></div>
7
+<div class="page min-hg-c-10">
8
+    <form class="form-horizontal" id="post_form" action="{:url('AdPosition/edit')}" method="post">
9
+        <div class="ncap-form-default">
10
+            <dl class="row">
11
+                <dt class="tit"> <label for="title"><em>*</em>广告名称</label> </dt>
12
+                <dd class="opt">
13
+                    <input type="text" name="title" value="{$field.title}" id="title" onkeyup="DetectionTitleRepeat(this);" class="input-txt" autocomplete="off">
14
+                    <span class="err"></span>
15
+                    <p class="notic2 red" id="title_tips"></p>
16
+                </dd>
17
+            </dl>
18
+
19
+            <dl class="row">
20
+                <dt class="tit"> <label for="type">广告类型</label> </dt>
21
+                <dd class="opt">
22
+                    <input type="hidden" name="type" value="{$field.type}"> {$field.type_name} 
23
+                </dd>
24
+            </dl>
25
+
26
+            <dl class="row 1615775137_dl" style="display: none;" id="1615775137_1" style="z-index: 2">
27
+                <dt class="tit"> <label>广告内容</label> </dt>
28
+                <dd class="opt">
29
+                    <div class="tab-pane" id="tab_imgupload">
30
+                        <table class="table table-bordered">
31
+                            <tbody>
32
+                            <tr>
33
+                                <td>
34
+                                    <div class="sort-list">
35
+                                        {volist name="ad_data" id="vo" key="k"}
36
+                                            {eq name="$vo.media_type" value="1"}
37
+                                                <div class="images_upload">
38
+                                                    <div class="ic">
39
+                                                        <div class='upimg' title="拖动修改排序" onmouseover="upimgMouseover(this);" onmouseout="upimgMouseout(this);">
40
+                                                            <div class='icaction' style="display: none" >
41
+                                                                <span class="load_images" onclick="Images('{$vo['litpic']}', 900, 600);">
42
+                                                                    <a href="javascript:void(0);" style="color:white">
43
+                                                                        <i class='fa fa-search-plus'></i>大图
44
+                                                                    </a>
45
+                                                                </span>
46
+                                                                <span class="load_images" onclick="LoadImagesId('{$vo['id']}');">
47
+                                                                    <i class='fa fa-photo'></i>更换
48
+                                                                </span>
49
+                                                                <span class="load_images" onclick="ShowInput('{$vo['id']}');">
50
+                                                                    <i class='fa fa-file-text-o'></i>信息
51
+                                                                </span>
52
+                                                            </div>
53
+                                                            <div class='cover-bg' style="display: none" ></div>
54
+                                                            <img id="{$vo['id']}_Id" src="{$vo['litpic']}"/>
55
+                                                            {if condition="$main_lang == $admin_lang || !empty($global['language_split'])"}
56
+                                                                <a class="delect" href="javascript:void(0);" onclick="ClearPicArr(this,'{$vo['litpic']}','{$vo['id']}');" title="删除">
57
+                                                                </a>
58
+                                                            {/if}
59
+                                                        </div>
60
+                                                        
61
+                                                        <div class="load_input" id="{$vo['id']}_ShowInput" data-showOrHide="hide">
62
+                                                            <input type="hidden" name="img_id[]" value="{$vo['id']}"/>
63
+                                                            <span class="span_input">
64
+                                                                <input type="hidden" id="{$vo['id']}_Litpic" name="img_litpic[]" value="{$vo['litpic']}"/>
65
+                                                            </span>
66
+                                                            <textarea name="img_title[]" placeholder="请输入标题..." style="height: 28px;">{$vo.title}</textarea>
67
+                                                            <textarea name="img_links[]" placeholder="请输入链接网址..." style="height: 28px;">{$vo.links}</textarea>
68
+                                                            <textarea name="img_intro[]" placeholder="广告注释:支持HTML代码" style="height: 64px;">{$vo.intro}</textarea>
69
+                                                            <div class="operation">
70
+                                                                <a href="javascript:void(0);">
71
+                                                                    <label>
72
+                                                                        <input type="checkbox" {eq name="$vo['target']" value="1"} checked="checked" {/eq} title="在新窗口打开" onclick="CheckedTarget(this)"/>新窗口
73
+                                                                        <input type="hidden" name="img_target[]" value="{$vo['target']}">
74
+                                                                    </label>
75
+                                                                </a>
76
+                                                                <a href="javascript:void(0);" onclick="copyToClipBoard({$vo['id']});">
77
+                                                                    <i class="fa fa-file-code-o"></i>标签调用
78
+                                                                </a>
79
+                                                                <a onclick="HideInput('{$vo['id']}');" style="width: 32%;" href="javascript:void(0);" title="收回"><i style="font-size:16px;" class="fa fa-angle-double-up"></i></a>
80
+                                                            </div>
81
+                                                        </div>
82
+                                                    </div>
83
+                                                </div>
84
+                                            {/eq}
85
+                                        {/volist}
86
+                                        <div class="images_upload"></div>
87
+                                    </div> 
88
+                                    {if condition="$main_lang == $admin_lang || !empty($global['language_split'])"}
89
+                                        <a href="javascript:void(0);" onClick="GetUploadify(30,'','allimg','imgupload_call_back');" class="img-upload b-img-upload mb15" title="点击上传">
90
+                                            <div class="y-line"></div>
91
+                                            <div class="x-line"></div>
92
+                                        </a>
93
+                                    {/if}
94
+                                    <input type="hidden" id="ImagesId">
95
+                                </td>
96
+                            </tr>
97
+                            </tbody>
98
+                        </table>
99
+                    </div>
100
+                    <!-- 上传图片显示的样板 start -->
101
+                    <div class="images_upload_tpl none">
102
+                        <div class="images_upload ic">
103
+                            <div class="ic">
104
+                                <div class='upimg' title="拖动修改排序" onmouseover="upimgMouseover(this);" onmouseout="upimgMouseout(this);">
105
+                                    <div class='icaction' style="display: none">
106
+                                        <span class="load_images" onclick="">
107
+                                            <a href="javascript:void(0);" style="color: white">
108
+                                                <i class='fa fa-search-plus'></i>大图
109
+                                            </a>
110
+                                        </span>
111
+                                        <span class="load_images" onclick="">
112
+                                            <i class='fa fa-file-text-o'></i>信息
113
+                                        </span>
114
+                                    </div>
115
+                                    <div class='cover-bg' style="display: none"></div>
116
+                                    <img src="__STATIC__/admin/images/add-button.jpg"/>
117
+                                    <a class="delect" href="javascript:void(0);" title="删除"></a>
118
+                                </div>
119
+
120
+                                <div class="load_input" data-showOrHide="hide">
121
+                                    <input type="hidden"/>
122
+                                    <span class="span_input"> <input type="hidden"/> </span>
123
+                                    <textarea placeholder="请输入标题..." style="height: 28px;"></textarea>
124
+                                    <textarea placeholder="请输入链接网址..." style="height: 28px;"></textarea>
125
+                                    <textarea placeholder="广告注释:支持HTML代码" style="height: 64px;"></textarea>
126
+                                    <div class="operation">
127
+                                        <a href="javascript:void(0);">&nbsp;&nbsp;</a>
128
+                                        <a href="javascript:void(0);">&nbsp;&nbsp;</a>
129
+                                        <a style="width: 32%;" href="javascript:void(0);">&nbsp;&nbsp;</a>
130
+                                    </div> 
131
+                                </div>
132
+                            </div>
133
+                        </div>
134
+                    </div>
135
+                    <!-- 上传图片显示的样板 end -->
136
+                </dd>
137
+            </dl>
138
+
139
+            <dl class="row 1615775137_dl" style="display: none;" id="1615775137_2" style="z-index: 2">
140
+                <dt class="tit"> <label for="type">广告内容</label> </dt>
141
+                <dd class="opt">
142
+                    <input type="hidden" name="video_id" {eq name="$ad_data.0.media_type" value="2"} value="{$ad_data.0.id}" {/eq} class="input-txt">
143
+                    <input type="text" name="video_litpic" id="video_litpic" {eq name="$ad_data.0.media_type" value="2"} value="{$ad_data.0.litpic}" {/eq} class="input-txt">
144
+                    <input type="file" id="courseware_file" data-type='local' onchange="upload_video_litpic_1615775137(this)" style="display: none;">
145
+                    {eq name="$WeappOpen.qny_open" value="1"}
146
+                    &nbsp;<a href="javascript:void(0);" class="ncap-btn ncap-btn-green" id="upload_video_litpic_qiniu" onclick="$('#courseware_file').attr('data-type', 'qiniu').trigger('click');">七牛云上传</a>
147
+                    {/eq}
148
+                    {eq name="$WeappOpen.oss_open" value="1"}
149
+                    &nbsp;<a href="javascript:void(0);" class="ncap-btn ncap-btn-green" id="upload_video_litpic_oss" onclick="$('#courseware_file').attr('data-type', 'oss').trigger('click');">oss上传</a>
150
+                    {/eq}
151
+                    {eq name="$WeappOpen.cos_open" value="1"}
152
+                    &nbsp;<a href="javascript:void(0);" class="ncap-btn ncap-btn-green" id="upload_video_litpic_cos" onclick="$('#courseware_file').attr('data-type', 'cos').trigger('click');">cos上传</a>
153
+                    {/eq}
154
+                    &nbsp;<a href="javascript:void(0);" class="ncap-btn ncap-btn-green " id="upload_video_litpic_local" onclick="$('#courseware_file').attr('data-type', 'local').trigger('click');">本地上传</a>
155
+                    <input type="hidden" id="OpenPreviewVideoUrl" value="{:url('AdPosition/open_preview_video')}">
156
+                    &nbsp;<a href="javascript:void(0);" class="ncap-btn ncap-btn-green" id="PreviewVideo" onclick="OpenPreviewVideo();">预览</a>
157
+                </dd>
158
+            </dl>
159
+
160
+            <dl class="row 1615775137_dl" style="display: none;" id="1615775137_3" style="z-index: 2">
161
+                <dt class="tit"> <label for="type">广告内容</label> </dt>
162
+                <dd class="opt">
163
+                    <input type="hidden" name="html_id" {eq name="$ad_data.0.media_type" value="3"} value="{$ad_data.0.id}" {/eq} class="input-txt">
164
+                    <textarea rows="5" cols="60" id="html_intro" name="html_intro" style="height: 200px;">{eq name="$ad_data.0.media_type" value="3"}{$ad_data.0.intro}{/eq}</textarea>
165
+                    <span class="err"></span>
166
+                    <p class="notic"></p>
167
+                </dd>
168
+            </dl>
169
+
170
+            <dl class="row">
171
+                <dt class="tit">
172
+                    <label>备注信息</label>
173
+                </dt>
174
+                <dd class="opt">          
175
+                    <textarea rows="5" cols="60" id="intro" name="intro" style="height:60px;">{$field.intro}</textarea>
176
+                    <span class="err"></span>
177
+                    <p class="notic"></p>
178
+                </dd>
179
+            </dl>
180
+
181
+            <div class="bot">
182
+                <input type="hidden" name="id" id="1615775137_id" value="{$field.id}">
183
+                <a href="JavaScript:void(0);" onclick="checkForm();" class="ncap-btn-big ncap-btn-green" id="submitBtn">确认提交</a>
184
+            </div>
185
+        </div>
186
+    </form>
187
+</div>
188
+
189
+<script type="text/javascript">
190
+    var SelectedType = '{$field.type}';
191
+    $(function() {
192
+        // 新增时,广告类型默认选中图片类型
193
+        // $('#type'+SelectedType).prop('checked', 'checked');
194
+        // 新增时,默认显示图片上传
195
+        $('#1615775137_'+SelectedType).show();
196
+        // 多媒体类型 && 广告内容不为空 则执行显示 否则 执行隐藏
197
+        VideoLitpicValue('#video_litpic');
198
+    });
199
+
200
+    // 切换广告类型
201
+    function TypeSwitch(typeValue) {
202
+        // 隐藏全部类型内容
203
+        $('.1615775137_dl').hide();
204
+        // 显示指定类型内容
205
+        $('#1615775137_'+typeValue).show();
206
+        // 切换类型后设置为当前切换的类型
207
+        SelectedType = typeValue;
208
+        
209
+        // var ad_type = '{$field.type}';
210
+        // if (typeValue != ad_type) {
211
+        //     // 切换至不同类型则显示
212
+        //     $('.notic2').show();
213
+        // } else {
214
+        //     // 切换至相同类型则隐藏
215
+        //     $('.notic2').hide();
216
+        // }
217
+    }
218
+
219
+    // 多媒体类型 && 广告内容不为空 则执行显示 否则 执行隐藏
220
+    function VideoLitpicValue(obj) {
221
+        // 获取广告内容(多媒体为播放链接)
222
+        // var video_litpic = $(obj).val();
223
+        // 判断隐藏显示预览按钮if (2 == SelectedType && video_litpic)
224
+        if (2 == SelectedType) {
225
+            $('#PreviewVideo').show();
226
+        } else {
227
+            $('#PreviewVideo').hide();
228
+        }
229
+    }
230
+
231
+    // 打开预览视频
232
+    function OpenPreviewVideo() {
233
+        // 获取视频链接
234
+        var video_litpic = $('#video_litpic').val();
235
+        if (video_litpic == '') {
236
+            $('#video_litpic').focus();
237
+            showErrorMsg('请先上传视频');
238
+            return false;
239
+        }
240
+
241
+        /* 视频链接后缀验证处理 */
242
+        var fileExt = video_litpic.substr(video_litpic.lastIndexOf('.')).toLowerCase();
243
+        var fileExt = judgeExt(fileExt);
244
+        if (fileExt == -1) {
245
+            $('#video_litpic').focus();
246
+            showErrorMsg('不支持的视频格式,可在附件设置中修改');
247
+            return false;
248
+        }
249
+        /* END */
250
+
251
+        /* 视频链接是否存在斜杠处理 */
252
+        var fileInfo = video_litpic.lastIndexOf('/');
253
+        if (fileInfo == -1) {
254
+            $('#video_litpic').focus();
255
+            showErrorMsg('视频链接不完整,无法正常预览');
256
+            return false;
257
+        }
258
+        /* END */
259
+
260
+        // 打开视频播放
261
+        $.ajax({
262
+            type : 'post',
263
+            url  : $('#OpenPreviewVideoUrl').val(),
264
+            data : {video_litpic: video_litpic},
265
+            dataType : 'json',
266
+            success : function(res) {
267
+                if (1 == res.code) {
268
+                    var PreviewVideo = "<video style='width:100%; height:100%;' src='"+res.url+"' controls preload='auto' oncontextmenu='return fase' autoplay></video>";
269
+                    layer.open({
270
+                        type: 1,
271
+                        title: false,
272
+                        fixed: true, //不固定
273
+                        shadeClose: false,
274
+                        shade: layer_shade,
275
+                        area: ['80%', '80%'],
276
+                        content: PreviewVideo
277
+                    });
278
+                } else {
279
+                    showErrorMsg(res.msg);
280
+                }
281
+            },
282
+            error: function(e) {
283
+                showErrorAlert(e.responseText);
284
+            }
285
+        });
286
+    }
287
+
288
+    // 上传媒体文件
289
+    function upload_video_litpic_1615775137(e) {
290
+        var data_type = $(e).attr('data-type');
291
+        if ('qiniu' == data_type) {
292
+            // 七牛云上传
293
+            upload_video_litpic_qiniu(e);
294
+        } else if ('oss' == data_type) {
295
+             // OSS上传
296
+            upload_video_litpic_oss(e);
297
+        } else if ('cos' == data_type) {
298
+             // COS上传
299
+            upload_video_litpic_cos(e);
300
+        } else {
301
+            // 本地上传
302
+            upload_video_litpic_local(e);
303
+        }
304
+    }
305
+
306
+    // 七牛云上传
307
+    function upload_video_litpic_qiniu(e) {
308
+        // 获取文件路径名
309
+        var file = $(e)[0].files[0];
310
+
311
+        // 验证上传格式
312
+        var fileName = file.name;
313
+        var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
314
+        var ext = judgeExt(fileExt);
315
+        if (ext == -1) {
316
+            showErrorMsg('不支持选中的视频格式,可在附件设置中修改');
317
+            return false;
318
+        }
319
+
320
+        // 验证上传大小
321
+        var size = "{$upload_max_filesize}";
322
+        if (file.size > size) {
323
+            showErrorMsg('视频大小超过限制,可在附件设置中修改');
324
+            return false;
325
+        }
326
+
327
+        // 执行上传
328
+        layer_loading('上传七牛云');
329
+        $.ajax({
330
+            type: 'POST',
331
+            url: '__ROOT_DIR__/index.php?m=plugins&c=Qiniuyun&a=qiniu_upload',
332
+            data: {_ajax: 1},
333
+            dataType: "JSON",
334
+            success: function(res1) {
335
+                if (1 == res1.code) {
336
+                    var token  = res1.data.token;
337
+                    var formData = new FormData();
338
+                    formData.append('file', file);
339
+                    formData.append('token', token);
340
+
341
+                    fileName = res1.data.filePath + fileExt;
342
+                    formData.append('key', fileName);
343
+                    $.ajax({
344
+                        url: res1.data.uphost,
345
+                        type: 'POST',
346
+                        dataType: 'JSON',
347
+                        data: formData,
348
+                        timeout: 1200000,
349
+                        cache: false,
350
+                        processData: false,
351
+                        contentType: false,
352
+                        xhr: function () {
353
+                            myXhr = $.ajaxSettings.xhr();
354
+                            if (myXhr.upload) {
355
+                                myXhr.upload.addEventListener('progress', function(e){
356
+                                    var curr = e.loaded;
357
+                                    var total = e.total;
358
+                                    process = parseInt(curr / total * 100);
359
+                                    $("#upload_video_litpic_qiniu").text('上传中...'+process+"%");
360
+                                });
361
+                            }
362
+                            return myXhr;
363
+                        },
364
+                        success: function(res2) {
365
+                            layer.closeAll();
366
+                            $("#upload_video_litpic_qiniu").text('上传成功');
367
+                            setTimeout(function() {
368
+                                $('#upload_video_litpic_qiniu').text('七牛云上传');
369
+                            }, 2000);
370
+                            var video_url = res1.data.domain + "/" + res2.key;
371
+                            $("#video_litpic").empty().val(video_url);
372
+                        },
373
+                        error: function(e) {
374
+                            layer.closeAll();
375
+                            showErrorMsg(e.responseText);
376
+                            return false;
377
+                        }
378
+                    });
379
+                } else {
380
+                    layer.closeAll();
381
+                    showErrorMsg(res1.msg);
382
+                }
383
+            },
384
+            error: function(e) {
385
+                layer.closeAll();
386
+                showErrorMsg(e.responseText);
387
+            }
388
+        });
389
+    }
390
+
391
+    // 阿里云OSS上传
392
+    function upload_video_litpic_oss(e) {
393
+        // 获取文件路径名
394
+        var file = $(e)[0].files[0];
395
+        
396
+        // 验证上传格式
397
+        var fileName = file.name;
398
+        var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
399
+        var ext = judgeExt(fileExt);
400
+        if (ext == -1) {
401
+            showErrorMsg('不支持选中的视频格式,可在附件设置中修改');
402
+            return false;
403
+        }
404
+
405
+        // 验证上传大小
406
+        var size = "{$upload_max_filesize}";
407
+        if (file.size > size) {
408
+            showErrorMsg('视频大小超过限制,可在附件设置中修改');
409
+            return false;
410
+        }
411
+
412
+        // 执行上传
413
+        layer_loading('上传阿里云OSS');
414
+        $.ajax({
415
+            type: 'POST',
416
+            url: '__ROOT_DIR__/index.php?m=plugins&c=AliyunOss&a=oss_upload',
417
+            data: {_ajax: 1},
418
+            dataType: "JSON",
419
+            success: function(res1){
420
+                if (1 == res1.code){
421
+                    fileName = res1.data.filePath + fileExt;
422
+                    //组装发送数据
423
+                    var request = new FormData();
424
+                    request.append("OSSAccessKeyId",res1.data.accessid);
425
+                    request.append("policy",res1.data.policy);
426
+                    request.append("Signature",res1.data.signature);
427
+                    request.append("key",fileName);
428
+                    request.append("success_action_status",201);
429
+                    request.append('file', file);
430
+
431
+                    $.ajax({
432
+                        url : res1.data.host,
433
+                        data : request,
434
+                        processData: false,
435
+                        cache: false,
436
+                        contentType: false,
437
+                        dataType: 'xml',
438
+                        type : 'post',
439
+                        xhr: function () {
440
+                            myXhr = $.ajaxSettings.xhr();
441
+                            if (myXhr.upload) {
442
+                                myXhr.upload.addEventListener('progress', function(e){
443
+                                    var curr = e.loaded;
444
+                                    var total = e.total;
445
+                                    var process = parseInt(curr / total * 100);
446
+                                    $("#upload_video_litpic_oss").text('上传中...'+process+"%");
447
+                                });
448
+                            }
449
+                            return myXhr;
450
+                        },
451
+                        success : function(data) {
452
+                            layer.closeAll();
453
+                            var res = $(data).find('PostResponse');
454
+                            if (res) {
455
+                                var key = res.find('Key').text();
456
+                                $("#upload_video_litpic_oss").text('上传成功');
457
+                                setTimeout(function() {
458
+                                    $('#upload_video_litpic_oss').text('oss上传');
459
+                                }, 2000);
460
+                                var video_url = res1.data.domain + "/" + key;
461
+                                $("#video_litpic").val(video_url);
462
+                            } else {
463
+                                $("#upload_video_litpic_oss").text('上传失败');
464
+                                setTimeout(function() {
465
+                                    $('#upload_video_litpic_oss').text('oss上传');
466
+                                }, 2000);
467
+                            }
468
+                        },
469
+                        error : function(e) {
470
+                            layer.closeAll();
471
+                            console.log(e.responseText);
472
+                        }
473
+                    });
474
+                } else {
475
+                    layer.closeAll();
476
+                    showErrorMsg(res1.msg);
477
+                }
478
+            },
479
+            error: function(e) {
480
+                layer.closeAll();
481
+                showErrorMsg(e.responseText);
482
+            }
483
+        });
484
+    }
485
+
486
+    // 腾讯云COS上传
487
+    function upload_video_litpic_cos(e) {
488
+        // 获取文件路径名
489
+        var file = $(e)[0].files[0];
490
+        
491
+        // 验证上传格式
492
+        var fileName = file.name;
493
+        var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
494
+        var ext = judgeExt(fileExt);
495
+        if (ext == -1) {
496
+            showErrorMsg('不支持选中的视频格式,可在附件设置中修改');
497
+            return false;
498
+        }
499
+
500
+        // 验证上传大小
501
+        var size = "{$upload_max_filesize}";
502
+        if (file.size > size) {
503
+            showErrorMsg('视频大小超过限制,可在附件设置中修改');
504
+            return false;
505
+        }
506
+
507
+        // 上传参数
508
+        var formData = new FormData();
509
+            formData.append('file', file);
510
+            formData.append('file_ext', fileExt);
511
+
512
+        // 执行上传
513
+        $.ajax({
514
+            type: 'post',
515
+            url: '__ROOT_DIR__/index.php?m=plugins&c=Cos&a=cos_upload&_ajax=1',
516
+            data: formData,
517
+            contentType: false,
518
+            processData: false,
519
+            dataType: 'json',
520
+            xhr: function () {
521
+                myXhr = $.ajaxSettings.xhr();
522
+                if (myXhr.upload) {
523
+                    myXhr.upload.addEventListener('progress', function(e){
524
+                        var curr = e.loaded;
525
+                        var total = e.total;
526
+                        process = parseInt(curr / total * 100);
527
+                        if (100 == process) {
528
+                            process = 99;
529
+                            layer_loading('上传腾讯云COS');
530
+                        }
531
+                        $("#upload_video_litpic_cos").text('上传中...'+process+"%");
532
+                        
533
+                    });
534
+                }
535
+                return myXhr;
536
+            },
537
+            success: function(res) {
538
+                layer.closeAll();
539
+                if (1 == res.code) {
540
+                    $("#video_litpic").val(res.data.url);
541
+                    $("#upload_video_litpic_cos").text('上传成功');
542
+                } else {
543
+                    $("#upload_video_litpic_cos").text('上传失败');
544
+                }
545
+                setTimeout(function() {
546
+                    $('#upload_video_litpic_cos').text('cos上传');
547
+                }, 2000);
548
+            },
549
+            error: function(e) {
550
+                layer.closeAll();
551
+                showErrorMsg(e.responseText);
552
+            }
553
+        });
554
+    }
555
+
556
+    // 本地上传
557
+    function upload_video_litpic_local(e) {
558
+        // 获取文件路径名
559
+        var file = $(e)[0].files[0];
560
+
561
+        // 验证上传格式
562
+        var fileName = file.name;
563
+        var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
564
+        var ext = judgeExt(fileExt);
565
+        if (ext == -1) {
566
+            showErrorMsg('不支持选中的视频格式,可在附件设置中修改');
567
+            return false;
568
+        }
569
+
570
+        // 验证上传大小
571
+        var size = "{$upload_max_filesize}";
572
+        if (file.size > size) {
573
+            showErrorMsg('视频大小超过限制,可在附件设置中修改');
574
+            return false;
575
+        }
576
+
577
+        // 定义上传数据
578
+        var formData = new FormData();
579
+        formData.append('file', file);
580
+
581
+        // 执行上传
582
+        layer_loading('上传本地');
583
+        $.ajax({
584
+            type: 'post',
585
+            url : "{:url('Ueditor/upVideo', ['savepath'=>'media'])}",
586
+            data: formData,
587
+            contentType: false,
588
+            processData: false,
589
+            dataType: 'json',
590
+            xhr: function () {
591
+                myXhr = $.ajaxSettings.xhr();
592
+                if (myXhr.upload) {
593
+                    myXhr.upload.addEventListener('progress', function(e){
594
+                        var curr = e.loaded;
595
+                        var total = e.total;
596
+                        process = parseInt(curr / total * 100);
597
+                        $("#upload_video_litpic_local").html('上传中...'+process+"%");
598
+                    });
599
+                }
600
+                return myXhr;
601
+            },
602
+            success: function (res) {
603
+                layer.closeAll();
604
+                $("#upload_video_litpic_local").html('上传成功');
605
+                setTimeout(function() {
606
+                    $('#upload_video_litpic_local').html('本地上传');
607
+                }, 2000);
608
+                if ("SUCCESS" == res.state) {
609
+                    $("#video_litpic").val(res.url);
610
+                } else {
611
+                    showErrorMsg(res.msg);
612
+                }
613
+            }
614
+        });
615
+    }
616
+
617
+    // 验证格式
618
+    function judgeExt(ext) {
619
+        var type = "{$media_type}";
620
+        var extArr = [];
621
+        extArr = type.split("|");
622
+        var ext = ext.replace(".","");
623
+        return extArr.indexOf(ext);
624
+    }
625
+</script>
626
+
627
+<script type="text/javascript">
628
+    // 勾选新窗口打开链接
629
+    function CheckedTarget(t){
630
+        if ($(t).is(':checked')) {
631
+            $(t).parent().find('input[name="img_target[]"]').val(1);
632
+        }else{
633
+            $(t).parent().find('input[name="img_target[]"]').val(0);
634
+        }
635
+    }
636
+    // 鼠标事件,加载查看大图和更新图片
637
+    function upimgMouseover(obj)
638
+    {
639
+        $(obj).find('div.icaction').show();
640
+        $(obj).find('div.cover-bg').show();
641
+    }
642
+    function upimgMouseout(obj)
643
+    {
644
+        $(obj).find('div.icaction').hide();
645
+        $(obj).find('div.cover-bg').hide();
646
+    }
647
+
648
+    // 检测广告名称是否存在重复
649
+    function DetectionTitleRepeat(obj) {
650
+        // 当前广告ID
651
+        var id = $('#1615775137_id').val();
652
+        // 传入的广告名称
653
+        var title = $(obj).val();
654
+        // 执行检测
655
+        $.ajax({
656
+            type: 'post',
657
+            url : "{:url('AdPosition/detection_title_repeat', ['_ajax'=>1])}",
658
+            data: {id: id, title: title},
659
+            dataType: 'json',
660
+            success: function(res) {
661
+                if (0 == res.code) {
662
+                    $('#title_tips').show().html(res.msg);
663
+                } else {
664
+                    $('#title_tips').hide().html('');
665
+                }
666
+            },
667
+            error: function(e){
668
+                layer.closeAll();
669
+                showErrorAlert(e.responseText);
670
+            }
671
+        });
672
+    }
673
+
674
+    // 判断输入框是否为空
675
+    function checkForm(){
676
+        if($('input[name=title]').val() == ''){
677
+            layer.msg('广告位名称不能为空!', {icon: 2,time: 1000});
678
+            return false;
679
+        }
680
+        layer_loading('正在处理');
681
+        $.ajax({
682
+            type : 'post',
683
+            url : "{:url('AdPosition/edit', ['_ajax'=>1])}",
684
+            data : $('#post_form').serialize(),
685
+            dataType : 'json',
686
+            success : function(res){
687
+                layer.closeAll();
688
+                if (res.code == 1) {
689
+                    layer.msg(res.msg, {icon: 1, shade: layer_shade, time: 1000}, function(){
690
+                        window.location.reload();
691
+                    });
692
+                } else {
693
+                    showErrorMsg(res.msg);
694
+                }
695
+            },
696
+            error: function(e){
697
+                layer.closeAll();
698
+                showErrorAlert(e.responseText);
699
+            }
700
+        });
701
+    }
702
+
703
+    // 获取点击更新图片的ID并加载隐藏域
704
+    function LoadImagesId(id){
705
+        // 加载ID到隐藏域
706
+        $('#ImagesId').val(id);
707
+        // 调用图片上传JS
708
+        GetUploadify(1,'','allimg','UpdataImages');
709
+    }
710
+
711
+    // 更新图片
712
+    function UpdataImages(path){
713
+        // 获取点击的ID
714
+        var id = $('#ImagesId').val();
715
+        // 加载图片到显示层
716
+        $("#"+id+"_Id").attr('src', path);
717
+        // 加载图片到提交的隐藏域
718
+        $("#"+id+"_Litpic").val(path);
719
+    }
720
+
721
+    // 显示信息输入框
722
+    function ShowInput(id) {
723
+        var obj = $("#"+id+"_ShowInput");
724
+        var showOrHide = obj.attr('data-showOrHide');
725
+        if ('hide' == showOrHide) {
726
+            obj.show().attr('data-showOrHide', 'show');
727
+        } else {
728
+            obj.hide().attr('data-showOrHide', 'hide');
729
+        }
730
+    }
731
+
732
+    // 隐藏信息输入
733
+    function HideInput(id) {
734
+        $("#"+id+"_ShowInput").hide().attr('data-showOrHide', 'hide');
735
+    }
736
+
737
+    // 上传图集相册回调函数
738
+    function imgupload_call_back(paths){
739
+        var last_div = $(".images_upload_tpl").html();
740
+        var inputs   = $('.span_input input');
741
+        var timestamp = 0;
742
+
743
+        // 图片数据处理
744
+        for (var i=0; i<paths.length; i++) {
745
+            // 生成新的时间戳
746
+            timestamp = (new Date()).getTime();
747
+            // 插入一个 新图片
748
+            $(".images_upload:eq(0)").before(last_div);
749
+            // 处理他的链接地址
750
+            $(".images_upload:eq(0)").find('span:eq(0)').attr('onclick', "Images('"+paths[i]+"', 900, 600);");
751
+            // 处理信息显示隐藏按钮
752
+            $(".images_upload:eq(0)").find('span:eq(1)').attr('onclick', "ShowInput('"+timestamp+"');");
753
+            // 处理他的图片路径
754
+            $(".images_upload:eq(0)").find('img').attr('src', paths[i]);
755
+            // 处理删除按钮
756
+            $(".images_upload:eq(0)").find('a:eq(1)').attr('onclick', "ClearPicArr(this, '"+paths[i]+"', 0);");
757
+            // 处理图片信息框ID
758
+            $(".images_upload:eq(0)").find('.load_input:eq(0)').attr('id', timestamp+'_ShowInput');
759
+            
760
+            // 处理图片路径及隐藏域
761
+            if (inputs.length > 0) {
762
+                // 修改隐藏域
763
+                $(".images_upload:eq(0)").find('input:eq(0)').attr('name', 'img_id[]').attr('value', '');
764
+                $(".span_input:eq(0)").find('input:eq(0)').attr('name', 'img_litpic[]').attr('value', paths[i]);
765
+                // 处理标题
766
+                $(".images_upload:eq(0)").find('textarea:eq(0)').attr('name', 'img_title[]');
767
+                // 处理跳转链接
768
+                $(".images_upload:eq(0)").find('textarea:eq(1)').attr('name', 'img_links[]');
769
+                // 处理内容描述
770
+                $(".images_upload:eq(0)").find('textarea:eq(2)').attr('name', 'img_intro[]');
771
+                // 处理新窗口选项
772
+                $(".images_upload:eq(0)").find('div.operation a:eq(0)').html("<label><input type='checkbox' title='在新窗口打开' onclick='CheckedTarget(this);'/>新窗口<input type='hidden' name='img_target[]' value='0'></label>");
773
+                // 处理收回按钮
774
+                $(".images_upload:eq(0)").find('div.operation a:eq(2)').attr('onclick', "HideInput('"+timestamp+"');").attr('title', "收回").html('<i style="font-size:16px;" class="fa fa-angle-double-up"></i>');
775
+            }
776
+        }
777
+    }
778
+
779
+    // 上传之后删除组图input
780
+    function ClearPicArr(obj, path, id) {
781
+        // 删除数据库记录
782
+        $.ajax({
783
+            type:'POST',
784
+            url:"{:url('AdPosition/del_imgupload')}",
785
+            data:{del_id:id,_ajax:1},
786
+            success:function(){
787
+                $(obj).parent().parent().parent().remove(); // 删除完服务器的, 再删除 html上的图片
788
+                $.ajax({
789
+                    type:'POST',
790
+                    url:"{:url('Uploadimgnew/delupload')}",
791
+                    data:{action:"del", filename:path,_ajax:1},
792
+                    success:function(){}
793
+                }); 
794
+            }
795
+        });
796
+    }
797
+
798
+    // 代码调用js
799
+    function copyToClipBoard(id) {
800
+        var adstr = "{eyou:ad aid='" + id + "'}\r\n   <a href='{$"+"field.links}' {$"+"field.target}><img src='{$"+"field.litpic}' alt='{$"+"field.title}' /></a>\r\n   广告注释:{$"+"field.intro}\r\n{/eyou:ad";
801
+        var contentdiv = '<div class="dialog_content" style="margin: 0px; padding: 0px;"><dl style="padding:10px 30px;line-height:30px"><dd>标签 ad 调用:</dd>';
802
+        contentdiv += '<textarea rows="4" cols="60" style="width:400px;height:100px;">' + adstr + '}</textarea>';
803
+        contentdiv += '<dd style="border-top: dotted 1px #E7E7E7; color: #F60;">请将对应标签代码复制并粘贴到对应模板文件中!</dd></dl></div>';
804
+        layer.open({
805
+            title: '代码调用',
806
+            type: 1,
807
+            shade: layer_shade,
808
+            skin: 'layui-layer-demo',
809
+            area: ['480px', '260px'], //宽高
810
+            content: contentdiv
811
+        });
812
+    }
813
+
814
+    // 图集相册的拖动排序相关 js
815
+    $( ".sort-list" ).sortable({
816
+        start: function( event, ui) {
817
+        
818
+        }
819
+        ,stop: function( event, ui ) {
820
+
821
+        }
822
+    });
823
+    //因为他们要拖动,所以尽量设置他们的文字不能选择。  
824
+    // $( ".sort-list" ).disableSelection();
825
+</script>
826
+
827
+{include file="public/footer" /}

+ 248
- 0
application/admin/template/zc_position/index.htm View File

@@ -0,0 +1,248 @@
1
+{include file="public/layout" /}
2
+
3
+<body class="bodystyle" style="cursor: default; -moz-user-select: inherit;">
4
+<div id="append_parent"></div>
5
+<div id="ajaxwaitid"></div>
6
+<div class="page min-hg-c-10">
7
+    <div class="flexigrid">
8
+        <div class="mDiv">
9
+            <div class="ftitle">
10
+				{if condition="$main_lang == $admin_lang || !empty($global['language_split'])"}
11
+				    {eq name="$Think.const.CONTROLLER_NAME.'@add'|is_check_access" value="1"}
12
+        				 <div class="fbutton">
13
+        				     <a href="javascript:void(0);" data-href="{:url('AdPosition/add')}" onclick="openFullframe(this, '新增广告222', '100%', '100%');">
14
+        				         <div class="add">
15
+        				             <span><i class="layui-icon layui-icon-addition"></i>新增职称</span>
16
+        				         </div>
17
+        				     </a>
18
+        				 </div>
19
+				    {/eq}
20
+				 {/if}
21
+            </div>
22
+            <form id="searchForm" class="navbar-form form-inline" action="{:url('AdPosition/index')}" method="get" onsubmit="layer_loading('正在处理');">
23
+                {$searchform.hidden|default=''}
24
+                <div class="sDiv">
25
+                    <div class="sDiv2">
26
+                        <select name="type" class="select" style="margin:0px 5px;">
27
+                            <option value="">--广告类型--</option>
28
+                            <option value="1" {eq name="$Request.param.type" value="1"}selected{/eq}>图片</option>
29
+                            <option value="2" {eq name="$Request.param.type" value="2"}selected{/eq}>多媒体</option>
30
+                            <option value="3" {eq name="$Request.param.type" value="3"}selected{/eq}>HTML代码</option>
31
+                        </select>
32
+                    </div>
33
+                    <div class="sDiv2">
34
+                        <input type="text" size="30" name="keywords" value="{$Request.param.keywords}" class="qsbox" placeholder="名称搜索...">
35
+                        <input type="submit" class="btn" value="搜索">
36
+						<i class="iconfont e-sousuo"></i>
37
+                    </div>
38
+                </div>
39
+            </form>
40
+        </div>
41
+
42
+        <div class="hDiv">
43
+            <div class="hDivBox">
44
+                <table cellspacing="0" cellpadding="0" style="width: 100%">
45
+                    <thead>
46
+                        <tr>
47
+                            {if condition="$main_lang == $admin_lang || !empty($global['language_split'])"}
48
+                                <th class="sign w40" axis="col0">
49
+                                    <div class="tc"><input type="checkbox" class="checkAll"></div>
50
+                                </th>
51
+                            {/if}
52
+
53
+                            <th abbr="article_title" axis="col3" class="w60">
54
+                                <div class="tc">ID</div>
55
+                            </th>
56
+
57
+                            <th abbr="article_title" axis="col3">
58
+                                <div class="tl text-l10" style="width: 100%">广告名称</div>
59
+                            </th>
60
+
61
+                            <th abbr="article_title" axis="col3" class="w100">
62
+                                <div class="tc">广告类型</div>
63
+                            </th>
64
+
65
+                            <th abbr="article_title" axis="col3" class="w120">
66
+                                <div class="tc">封面图片</div>
67
+                            </th>
68
+
69
+                            <th abbr="article_time" axis="col6" class="w60">
70
+                                <div class="tc">启用</div>
71
+                            </th>
72
+
73
+                            <th axis="col1" class="w180">
74
+                                <div class="tc">操作</div>
75
+                            </th>
76
+                        </tr>
77
+                    </thead>
78
+                </table>
79
+            </div>
80
+        </div>
81
+
82
+        <div class="bDiv" style="height: auto;">
83
+            <div id="flexigrid" cellpadding="0" cellspacing="0" border="0">
84
+                <table style="width: 100%">
85
+                    <tbody>
86
+                    {empty name="list"}
87
+                        <tr>
88
+                            <td class="no-data" align="center" axis="col0" colspan="50">
89
+                                <div class="no_row">
90
+                                    <div class="no_pic"><img src="__SKIN__/images/null-data.png"></div>
91
+                                </div>
92
+                            </td>
93
+                        </tr>
94
+                    {else/}
95
+                        {foreach name="list" item="vo" key="k" }
96
+                            <tr>
97
+                                {if condition="$main_lang == $admin_lang || !empty($global['language_split'])"}
98
+                                <td class="sign">
99
+                                    <div class="w40 tc"> <input type="checkbox" name="ids[]" value="{$vo.id}"> </div>
100
+                                </td>
101
+                                {/if}
102
+                                <td>
103
+                                    <div class="tc w60">
104
+                                    {eq name='$main_lang' value='$admin_lang'}
105
+                                        {$vo.id}
106
+                                    {else /}
107
+                                        {$main_adv_list[$vo['id']]['id']|default=$vo['id']}
108
+                                    {/eq}
109
+                                    </div>
110
+                                </td>
111
+
112
+                                <td align="left" style="width:100%;">
113
+                                    <div class="tl text-l10">
114
+                                        {eq name="$Think.const.CONTROLLER_NAME.'@edit'|is_check_access" value="1"}
115
+                                            <a href="javascript:void(0);" data-href="{:url('AdPosition/edit',array('id'=>$vo['id']))}" data-closereload="1" onclick="openFullframe(this, '编辑广告', '100%', '100%');">{$vo.title}</a>
116
+                                        {else /}
117
+                                            {$vo.title}
118
+                                        {/eq}
119
+                                    </div>
120
+                                </td>
121
+                                <td>
122
+                                    <div class="tc w100"> {$vo.type_name} </div>
123
+                                </td>
124
+                                <td>
125
+                                    <div class="tc w120">
126
+                                        <ul class="adpic">
127
+                                            {volist name="$vo.ad" id="vs" length="1" }
128
+                                                <li>
129
+                                                    <img src="{$vs.litpic}"> {eq name="$vo.type" value="1"}<span>{$vo.ad_count}</span>{/eq}
130
+                                                </li>
131
+                                            {/volist}
132
+                                        </ul>
133
+                                    </div>
134
+                                </td>
135
+                                <td>
136
+                                    <div class="tc w60">
137
+                                        {if condition="$vo['status'] eq 1"}
138
+                                            <span class="yes" {eq name="$Think.const.CONTROLLER_NAME.'@edit'|is_check_access" value="1"}onClick="changeTableVal('ad_position','id','{$vo.id}','status',this);"{/eq} ><i class="fa fa-check-circle"></i>是</span>
139
+                                        {else /}
140
+                                            <span class="no" {eq name="$Think.const.CONTROLLER_NAME.'@edit'|is_check_access" value="1"}onClick="changeTableVal('ad_position','id','{$vo.id}','status',this);"{/eq} ><i class="fa fa-ban"></i>否</span>
141
+                                        {/if}
142
+                                    </div>
143
+                                </td>
144
+                                <td class="operation">
145
+                                    <div class="w180 tc">
146
+                                        {eq name="$Think.const.CONTROLLER_NAME.'@edit'|is_check_access" value="1"}
147
+                                            <a href="javascript:void(0);" data-href="{:url('AdPosition/edit',array('id'=>$vo['id']))}" data-closereload="1" class="btn blue" onclick="openFullframe(this, '编辑广告', '100%', '100%');">编辑</a> <i></i>
148
+                                        {/eq}
149
+
150
+                                        {if condition="$main_lang == $admin_lang || !empty($global['language_split'])"}
151
+                                            {eq name="$Think.const.CONTROLLER_NAME.'@del'|is_check_access" value="1"}
152
+                                                <a class="btn red"  href="javascript:void(0);" data-url="{:url('AdPosition/del')}" data-id="{$vo.id}" onClick="delfun(this);">删除</a>
153
+                                            {/eq} <i></i>
154
+                                        {/if}
155
+    									
156
+                                        <a class="btn blue" href="javascript:void(0);" onclick="copyToClipBoard({$main_adv_list[$vo['id']]['id']|default=$vo['id']}, 1, {$vo['type']})">标签调用</a>
157
+                                    </div>
158
+                                </td>
159
+                            </tr>
160
+                        {/foreach}
161
+                    {/empty}
162
+                    </tbody>
163
+                </table>
164
+            </div>
165
+            <div class="iDiv" style="display: none;"></div>
166
+        </div>
167
+        {notempty name="list"}
168
+        <div class="tDiv">
169
+            <div class="tDiv2">
170
+                {if condition="$main_lang == $admin_lang || !empty($global['language_split'])"}
171
+                    <div class="fbutton checkboxall"> <input type="checkbox" class="checkAll"> </div>
172
+                    {eq name="$Think.const.CONTROLLER_NAME.'@del'|is_check_access" value="1"}
173
+                        <div class="fbutton">
174
+                            <a onclick="batch_del(this, 'ids');" data-url="{:url('AdPosition/del')}" class="layui-btn layui-btn-primary">批量删除</a>
175
+                        </div>
176
+                    {/eq}
177
+                {/if}
178
+                <!-- 分页 -->
179
+                {include file="public/page" /}
180
+            </div>
181
+            <div style="clear:both"></div>
182
+        </div>
183
+        {/notempty}
184
+    </div>
185
+</div>
186
+
187
+<script type="text/javascript">
188
+    $(function() {
189
+        $('input[name*=ids]').click(function() {
190
+            if ($('input[name*=ids]').length == $('input[name*=ids]:checked').length) {
191
+                $('.checkAll').prop('checked', 'checked');
192
+            } else {
193
+                $('.checkAll').prop('checked', false);
194
+            }
195
+        });
196
+        $('input[type=checkbox].checkAll').click(function() {
197
+            $('input[type=checkbox]').prop('checked', this.checked);
198
+        });
199
+    });
200
+    
201
+    $(document).ready(function() {
202
+        // 表格行点击选中切换
203
+        $('#flexigrid > table>tbody >tr').click(function() {
204
+            $(this).toggleClass('trSelected');
205
+        });
206
+
207
+        // 点击刷新数据
208
+        $('.fa-refresh').click(function() {
209
+            location.href = location.href;
210
+        });
211
+
212
+        $('#searchForm select[name=type]').change(function(){
213
+            $('#searchForm').submit();
214
+        });
215
+    });
216
+
217
+    /**
218
+     * 代码调用js
219
+     * @param id  id
220
+     * @param limit 条数
221
+     */
222
+    function copyToClipBoard(id, limit, type) {
223
+        var advstr = '';
224
+        if (1 == type) {
225
+            advstr = "{eyou:adv pid='" + id + "'}\r\n   <img src='{$"+"field.litpic}' alt='{$"+"field.title}' />\r\n{/eyou:adv";
226
+        } else if (2 == type) {
227
+            advstr = "{eyou:adv pid='" + id + "'}\r\n   <video src='{$"+"field.litpic}' controls preload='auto' oncontextmenu='return fase'></video>\r\n{/eyou:adv";
228
+        } else if (3 == type) {
229
+            advstr = "{eyou:adv pid='" + id + "'}\r\n   {$"+"field.intro}\r\n{/eyou:adv";
230
+        }
231
+        var contentdiv = '<div class="dialog_content" style="margin: 0px; padding: 0px;"><dl style="padding:10px 30px;line-height:30px"><dd>标签 adv 调用:</dd>';
232
+        contentdiv += '<textarea rows="4" cols="60" style="width:400px;height:60px;">' + advstr + '}</textarea>';
233
+        contentdiv += '<dd>JavaScript:</dd>';
234
+        contentdiv += '<dd><input type="text" style=" width:400px;" value="<script type=&quot;text/javascript&quot; src=&quot;http://' + '{$Think.server.http_host}' + '__ROOT_DIR__/index.php?m=api&amp;c=Other&amp;a=other_show&amp;pid=' + id + '&amp;row='+limit+'&quot;><\/script>"></dd>';
235
+        contentdiv += '<dd style="border-top: dotted 1px #E7E7E7; color: #F60;">请将标签adv或JavaScript代码复制并粘贴到对应模板文件中!</dd></dl></div>';
236
+        layer.open({
237
+            title: '代码调用',
238
+            type: 1,
239
+            shade: layer_shade,
240
+            skin: 'layui-layer-demo',
241
+            area: ['480px', '280px'], //宽高
242
+            content: contentdiv
243
+        });
244
+    }
245
+
246
+</script>
247
+
248
+{include file="public/footer" /}

+ 32
- 2
template/pc/components/index/content.htm View File

@@ -132,7 +132,8 @@
132 132
                         </style>
133 133
 
134 134
                         <span class="layui-tab-title" style="position:absolute;top: 13px;left: 11%;border-bottom-style:none;height: 30px;">
135
-                                    <li class="layui-this">山东</li>
135
+                                    <li class="layui-this">综合</li>
136
+                                    <li>山东</li>
136 137
                                     <li>广东</li>
137 138
                                     <li>上海</li>
138 139
                                     <li>广西</li>
@@ -155,7 +156,8 @@
155 156
                         </style>
156 157
 
157 158
                         <span class="layui-tab-title" style="position:absolute;top: 8px;left: 29%;border-bottom-style:none;height: 30px;">
158
-                                    <li class="layui-this">山东</li>
159
+                                    <li class="layui-this">综合</li>
160
+                                    <li>山东</li>
159 161
                                     <li>广东</li>
160 162
                                     <li>上海</li>
161 163
                                     <li>广西</li>
@@ -173,8 +175,36 @@
173 175
 
174 176
                     <div class="layui-tab-content" style="height: auto;">
175 177
 
178
+
176 179
                         <div class="layui-tab-item layui-show">
177 180
 
181
+
182
+                            <div class="items">
183
+                                <div class="row">
184
+                                    <?php
185
+                                    $where = " typeid=1232 and is_del=0 and status=1 "; //and is_recom=1
186
+                                    $sql = "select aid from ey_archives where $where order by update_time desc limit 0,12";
187
+                                    ?>
188
+                                    {eyou:sql sql='$sql' cachetime='3600' id="listSql"}
189
+                                    {eyou:arcview aid='$listSql.aid'}
190
+
191
+                                    <?php
192
+                                    $a_url = get_tid_url_2($field['arcurl'],$field['typeid'],$field['stypeid'],'0','',0,$field['area_tag_id'],$field['city_id']);
193
+                                    ?>
194
+
195
+                                    {eyou:include file='/template/pc/components/goods/zc.htm' /}
196
+
197
+                                    {/eyou:arcview}
198
+                                    {/eyou:sql}
199
+
200
+                                </div>
201
+                            </div>
202
+
203
+
204
+
205
+                        </div>
206
+                        <div class="layui-tab-item">
207
+
178 208
                             <div class="items">
179 209
                                 <div class="row">
180 210
                                     <?php

Loading…
Cancel
Save