正在显示
50 个修改的文件
包含
1978 行增加
和
765 行删除
addons/summernote/.addonrc
已删除
100644 → 0
1 | -{"license":"regular","licenseto":"30453","licensekey":"MvLUpyxGr0cbewSd isolvNTM71vSlABVPUrVepKNIrz+w6D2adnw5fWgV5Q=","files":["public\\assets\\addons\\summernote\\css\\summernote.css","public\\assets\\addons\\summernote\\font\\summernote.eot","public\\assets\\addons\\summernote\\font\\summernote.ttf","public\\assets\\addons\\summernote\\font\\summernote.woff","public\\assets\\addons\\summernote\\js\\summernote.js","public\\assets\\addons\\summernote\\js\\summernote.min.js","public\\assets\\addons\\summernote\\lang\\summernote-zh-CN.js","public\\assets\\addons\\summernote\\lang\\summernote-zh-CN.min.js","public\\assets\\addons\\summernote\\lang\\summernote-zh-TW.js","public\\assets\\addons\\summernote\\lang\\summernote-zh-TW.min.js"]} |
addons/summernote/Summernote.php
已删除
100644 → 0
1 | -<?php | ||
2 | - | ||
3 | -namespace addons\summernote; | ||
4 | - | ||
5 | -use think\Addons; | ||
6 | - | ||
7 | -/** | ||
8 | - * Summernote富文本编辑器 | ||
9 | - */ | ||
10 | -class Summernote extends Addons | ||
11 | -{ | ||
12 | - | ||
13 | - /** | ||
14 | - * 插件安装方法 | ||
15 | - * @return bool | ||
16 | - */ | ||
17 | - public function install() | ||
18 | - { | ||
19 | - return true; | ||
20 | - } | ||
21 | - | ||
22 | - /** | ||
23 | - * 插件卸载方法 | ||
24 | - * @return bool | ||
25 | - */ | ||
26 | - public function uninstall() | ||
27 | - { | ||
28 | - return true; | ||
29 | - } | ||
30 | - | ||
31 | -} |
addons/summernote/bootstrap.js
已删除
100644 → 0
1 | -require.config({ | ||
2 | - paths: { | ||
3 | - 'summernote': '../addons/summernote/lang/summernote-zh-CN.min' | ||
4 | - }, | ||
5 | - shim: { | ||
6 | - 'summernote': ['../addons/summernote/js/summernote.min', 'css!../addons/summernote/css/summernote.css'], | ||
7 | - } | ||
8 | -}); | ||
9 | -require(['form', 'upload'], function (Form, Upload) { | ||
10 | - var _bindevent = Form.events.bindevent; | ||
11 | - Form.events.bindevent = function (form) { | ||
12 | - _bindevent.apply(this, [form]); | ||
13 | - try { | ||
14 | - //绑定summernote事件 | ||
15 | - if ($(".summernote,.editor", form).size() > 0) { | ||
16 | - require(['summernote'], function () { | ||
17 | - var imageButton = function (context) { | ||
18 | - var ui = $.summernote.ui; | ||
19 | - var button = ui.button({ | ||
20 | - contents: '<i class="fa fa-file-image-o"/>', | ||
21 | - tooltip: __('Choose'), | ||
22 | - click: function () { | ||
23 | - parent.Fast.api.open("general/attachment/select?element_id=&multiple=true&mimetype=image/*", __('Choose'), { | ||
24 | - callback: function (data) { | ||
25 | - var urlArr = data.url.split(/\,/); | ||
26 | - $.each(urlArr, function () { | ||
27 | - var url = Fast.api.cdnurl(this); | ||
28 | - context.invoke('editor.insertImage', url); | ||
29 | - }); | ||
30 | - } | ||
31 | - }); | ||
32 | - return false; | ||
33 | - } | ||
34 | - }); | ||
35 | - return button.render(); | ||
36 | - }; | ||
37 | - var attachmentButton = function (context) { | ||
38 | - var ui = $.summernote.ui; | ||
39 | - var button = ui.button({ | ||
40 | - contents: '<i class="fa fa-file"/>', | ||
41 | - tooltip: __('Choose'), | ||
42 | - click: function () { | ||
43 | - parent.Fast.api.open("general/attachment/select?element_id=&multiple=true&mimetype=*", __('Choose'), { | ||
44 | - callback: function (data) { | ||
45 | - var urlArr = data.url.split(/\,/); | ||
46 | - $.each(urlArr, function () { | ||
47 | - var url = Fast.api.cdnurl(this); | ||
48 | - var node = $("<a href='" + url + "'>" + url + "</a>"); | ||
49 | - context.invoke('insertNode', node[0]); | ||
50 | - }); | ||
51 | - } | ||
52 | - }); | ||
53 | - return false; | ||
54 | - } | ||
55 | - }); | ||
56 | - return button.render(); | ||
57 | - }; | ||
58 | - | ||
59 | - $(".summernote,.editor", form).summernote({ | ||
60 | - height: 250, | ||
61 | - lang: 'zh-CN', | ||
62 | - fontNames: [ | ||
63 | - 'Arial', 'Arial Black', 'Serif', 'Sans', 'Courier', | ||
64 | - 'Courier New', 'Comic Sans MS', 'Helvetica', 'Impact', 'Lucida Grande', | ||
65 | - "Open Sans", "Hiragino Sans GB", "Microsoft YaHei", | ||
66 | - '微软雅黑', '宋体', '黑体', '仿宋', '楷体', '幼圆', | ||
67 | - ], | ||
68 | - fontNamesIgnoreCheck: [ | ||
69 | - "Open Sans", "Microsoft YaHei", | ||
70 | - '微软雅黑', '宋体', '黑体', '仿宋', '楷体', '幼圆' | ||
71 | - ], | ||
72 | - toolbar: [ | ||
73 | - ['style', ['style', 'undo', 'redo']], | ||
74 | - ['font', ['bold', 'underline', 'strikethrough', 'clear']], | ||
75 | - ['fontname', ['color', 'fontname', 'fontsize']], | ||
76 | - ['para', ['ul', 'ol', 'paragraph', 'height']], | ||
77 | - ['table', ['table', 'hr']], | ||
78 | - ['insert', ['link', 'picture', 'video']], | ||
79 | - ['select', ['image', 'attachment']], | ||
80 | - ['view', ['fullscreen', 'codeview', 'help']], | ||
81 | - ], | ||
82 | - buttons: { | ||
83 | - image: imageButton, | ||
84 | - attachment: attachmentButton, | ||
85 | - }, | ||
86 | - dialogsInBody: true, | ||
87 | - followingToolbar: false, | ||
88 | - callbacks: { | ||
89 | - onChange: function (contents) { | ||
90 | - $(this).val(contents); | ||
91 | - $(this).trigger('change'); | ||
92 | - }, | ||
93 | - onInit: function () { | ||
94 | - }, | ||
95 | - onImageUpload: function (files) { | ||
96 | - var that = this; | ||
97 | - //依次上传图片 | ||
98 | - for (var i = 0; i < files.length; i++) { | ||
99 | - Upload.api.send(files[i], function (data) { | ||
100 | - var url = Fast.api.cdnurl(data.url); | ||
101 | - $(that).summernote("insertImage", url, 'filename'); | ||
102 | - }); | ||
103 | - } | ||
104 | - } | ||
105 | - } | ||
106 | - }); | ||
107 | - }); | ||
108 | - } | ||
109 | - } catch (e) { | ||
110 | - | ||
111 | - } | ||
112 | - | ||
113 | - }; | ||
114 | -}); |
addons/summernote/controller/Index.php
已删除
100644 → 0
addons/summernote/info.ini
已删除
100644 → 0
@@ -22,6 +22,7 @@ class Factory extends Backend | @@ -22,6 +22,7 @@ class Factory extends Backend | ||
22 | { | 22 | { |
23 | parent::_initialize(); | 23 | parent::_initialize(); |
24 | $this->model = new \app\admin\model\Factory; | 24 | $this->model = new \app\admin\model\Factory; |
25 | + $this->view->assign("hotdataList", $this->model->getHotdataList()); | ||
25 | 26 | ||
26 | } | 27 | } |
27 | 28 |
@@ -24,6 +24,9 @@ class Job extends Backend | @@ -24,6 +24,9 @@ class Job extends Backend | ||
24 | parent::_initialize(); | 24 | parent::_initialize(); |
25 | $this->model = new \app\admin\model\Job; | 25 | $this->model = new \app\admin\model\Job; |
26 | $this->view->assign("typeList", $this->model->getTypeList()); | 26 | $this->view->assign("typeList", $this->model->getTypeList()); |
27 | + $this->view->assign("lookdataList", $this->model->getLookdataList()); | ||
28 | + $this->view->assign("putdataList", $this->model->getPutdataList()); | ||
29 | + | ||
27 | } | 30 | } |
28 | 31 | ||
29 | public function import() | 32 | public function import() |
@@ -37,6 +37,8 @@ class User extends Backend | @@ -37,6 +37,8 @@ class User extends Backend | ||
37 | } | 37 | } |
38 | unset($v); | 38 | unset($v); |
39 | $this->view->assign("userdata", $userdata); | 39 | $this->view->assign("userdata", $userdata); |
40 | + $this->view->assign("roledataList", $this->model->getRoledataList()); | ||
41 | + | ||
40 | } | 42 | } |
41 | 43 | ||
42 | /** | 44 | /** |
@@ -9,5 +9,8 @@ return [ | @@ -9,5 +9,8 @@ return [ | ||
9 | 'Work_subsidy' => '工时补贴价格(元/时)', | 9 | 'Work_subsidy' => '工时补贴价格(元/时)', |
10 | 'Createtime' => '创建时间', | 10 | 'Createtime' => '创建时间', |
11 | 'Updatetime' => '更新时间', | 11 | 'Updatetime' => '更新时间', |
12 | + 'Hotdata' => '是否热门', | ||
13 | + 'Hotdata 0' => '否', | ||
14 | + 'Hotdata 1' => '是', | ||
12 | 'Weigh' => '权重' | 15 | 'Weigh' => '权重' |
13 | ]; | 16 | ]; |
@@ -11,6 +11,13 @@ return [ | @@ -11,6 +11,13 @@ return [ | ||
11 | 'Type 1' => '长期工', | 11 | 'Type 1' => '长期工', |
12 | 'Type 2' => '兼职', | 12 | 'Type 2' => '兼职', |
13 | 'Type 3' => '短期工', | 13 | 'Type 3' => '短期工', |
14 | + 'Lookdata' => '状态', | ||
15 | + 'Lookdata 0' => '全部可看', | ||
16 | + 'Lookdata 1' => '部分可看', | ||
17 | + 'Lookdata 2' => '部分不可看', | ||
18 | + 'Putdata' => '上下架', | ||
19 | + 'Putdata 0' => '上架', | ||
20 | + 'Putdata 1' => '下架', | ||
14 | 'Factory_price' => '工厂工价(元/时)', | 21 | 'Factory_price' => '工厂工价(元/时)', |
15 | 'Subsidy_price' => '平台补贴(元/时)', | 22 | 'Subsidy_price' => '平台补贴(元/时)', |
16 | 'Factory_price_total' => '补贴后工价(元/时)', | 23 | 'Factory_price_total' => '补贴后工价(元/时)', |
@@ -23,4 +30,5 @@ return [ | @@ -23,4 +30,5 @@ return [ | ||
23 | 'Createtime' => '创建时间', | 30 | 'Createtime' => '创建时间', |
24 | 'Updatetime' => '更新时间', | 31 | 'Updatetime' => '更新时间', |
25 | 'Weigh' => '权重', | 32 | 'Weigh' => '权重', |
33 | + 'Label_ids' => '标签', | ||
26 | ]; | 34 | ]; |
@@ -6,7 +6,8 @@ return [ | @@ -6,7 +6,8 @@ return [ | ||
6 | 'Realname' => '姓名', | 6 | 'Realname' => '姓名', |
7 | 'Mobile' => '手机号', | 7 | 'Mobile' => '手机号', |
8 | 'Idcard' => '身份证号', | 8 | 'Idcard' => '身份证号', |
9 | - 'Idcard_front' => '身份证正面', | 9 | +// 'Idcard_front' => '身份证正面', |
10 | + 'Idcard_front' => '收款码', | ||
10 | 'Idcard_back' => '身份证背面', | 11 | 'Idcard_back' => '身份证背面', |
11 | 'Status' => '状态', | 12 | 'Status' => '状态', |
12 | 'Status 0' => '待审核', | 13 | 'Status 0' => '待审核', |
@@ -34,9 +34,13 @@ return [ | @@ -34,9 +34,13 @@ return [ | ||
34 | 'Is_work' => '是否在职', | 34 | 'Is_work' => '是否在职', |
35 | 'Is_complete' => '补贴是否完成', | 35 | 'Is_complete' => '补贴是否完成', |
36 | 'Work_subsidy' => '工时补贴价格(元/时)', | 36 | 'Work_subsidy' => '工时补贴价格(元/时)', |
37 | - 'Recruit_subsidy'=> '招聘补贴上级价格(元/时)', | 37 | + 'Recruit_subsidy'=> '招聘补贴上一级价格(元/时)', |
38 | + 'Recruit_subsidy2'=> '招聘补贴上二级价格(元/时)', | ||
38 | 'Work_subsidy_month' => '工时月工资(元/月)', | 39 | 'Work_subsidy_month' => '工时月工资(元/月)', |
39 | 'Recruit_subsidy_month' => '招聘月工资(元/月)', | 40 | 'Recruit_subsidy_month' => '招聘月工资(元/月)', |
40 | 'Lower_num' => '可以看到几级下级', | 41 | 'Lower_num' => '可以看到几级下级', |
41 | 'Factory_id' => '入职工厂', | 42 | 'Factory_id' => '入职工厂', |
43 | + 'Roledata' =>'角色', | ||
44 | + 'Roledata 0' =>'用户', | ||
45 | + 'Roledata 1' =>'合伙人', | ||
42 | ]; | 46 | ]; |
@@ -25,7 +25,7 @@ class Factory extends Model | @@ -25,7 +25,7 @@ class Factory extends Model | ||
25 | 25 | ||
26 | // 追加属性 | 26 | // 追加属性 |
27 | protected $append = [ | 27 | protected $append = [ |
28 | - | 28 | + 'hotdata_text' |
29 | ]; | 29 | ]; |
30 | 30 | ||
31 | 31 | ||
@@ -37,7 +37,17 @@ class Factory extends Model | @@ -37,7 +37,17 @@ class Factory extends Model | ||
37 | }); | 37 | }); |
38 | } | 38 | } |
39 | 39 | ||
40 | - | 40 | + public function getHotdataList() |
41 | + { | ||
42 | + return ['0' => __('Hotdata 0'), '1' => __('Hotdata 1')]; | ||
43 | + } | ||
44 | + | ||
45 | + public function getHotdataTextAttr($value, $data) | ||
46 | + { | ||
47 | + $value = $value ? $value : (isset($data['hotdata']) ? $data['hotdata'] : ''); | ||
48 | + $list = $this->getHotdataList(); | ||
49 | + return isset($list[$value]) ? $list[$value] : ''; | ||
50 | + } | ||
41 | 51 | ||
42 | 52 | ||
43 | 53 |
@@ -25,7 +25,9 @@ class Job extends Model | @@ -25,7 +25,9 @@ class Job extends Model | ||
25 | 25 | ||
26 | // 追加属性 | 26 | // 追加属性 |
27 | protected $append = [ | 27 | protected $append = [ |
28 | - 'type_text' | 28 | + 'type_text', |
29 | + 'lookdata_text', | ||
30 | + 'putdata_text' | ||
29 | ]; | 31 | ]; |
30 | 32 | ||
31 | protected static function init() | 33 | protected static function init() |
@@ -49,6 +51,30 @@ class Job extends Model | @@ -49,6 +51,30 @@ class Job extends Model | ||
49 | return implode(',', array_intersect_key($list, array_flip($valueArr))); | 51 | return implode(',', array_intersect_key($list, array_flip($valueArr))); |
50 | } | 52 | } |
51 | 53 | ||
54 | + public function getLookdataList() | ||
55 | + { | ||
56 | + return ['0' => __('Lookdata 0'), '1' => __('Lookdata 1'),'2'=>__('Lookdata 2')]; | ||
57 | + } | ||
58 | + | ||
59 | + public function getLookdataTextAttr($value, $data) | ||
60 | + { | ||
61 | + $value = $value ? $value : (isset($data['lookdata']) ? $data['lookdata'] : ''); | ||
62 | + $list = $this->getLookdataList(); | ||
63 | + return isset($list[$value]) ? $list[$value] : ''; | ||
64 | + } | ||
65 | + | ||
66 | + | ||
67 | + public function getPutdataList() | ||
68 | + { | ||
69 | + return ['0' => __('Putdata 0'), '1' => __('Putdata 1')]; | ||
70 | + } | ||
71 | + | ||
72 | + public function getPutdataTextAttr($value, $data) | ||
73 | + { | ||
74 | + $value = $value ? $value : (isset($data['putdata']) ? $data['putdata'] : ''); | ||
75 | + $list = $this->getPutdataList(); | ||
76 | + return isset($list[$value]) ? $list[$value] : ''; | ||
77 | + } | ||
52 | protected function setTypeAttr($value) | 78 | protected function setTypeAttr($value) |
53 | { | 79 | { |
54 | return is_array($value) ? implode(',', $value) : $value; | 80 | return is_array($value) ? implode(',', $value) : $value; |
@@ -20,7 +20,8 @@ class User extends Model | @@ -20,7 +20,8 @@ class User extends Model | ||
20 | protected $append = [ | 20 | protected $append = [ |
21 | 'prevtime_text', | 21 | 'prevtime_text', |
22 | 'logintime_text', | 22 | 'logintime_text', |
23 | - 'jointime_text' | 23 | + 'jointime_text', |
24 | + 'roledata_text' | ||
24 | ]; | 25 | ]; |
25 | 26 | ||
26 | public function getOriginData() | 27 | public function getOriginData() |
@@ -68,6 +69,17 @@ class User extends Model | @@ -68,6 +69,17 @@ class User extends Model | ||
68 | return ['normal' => __('Normal'), 'hidden' => __('Hidden')]; | 69 | return ['normal' => __('Normal'), 'hidden' => __('Hidden')]; |
69 | } | 70 | } |
70 | 71 | ||
72 | + public function getRoledataList() | ||
73 | + { | ||
74 | + return ['0' => __('Roledata 0'), '1' => __('Roledata 1')]; | ||
75 | + } | ||
76 | + | ||
77 | + public function getRoledataTextAttr($value, $data) | ||
78 | + { | ||
79 | + $value = $value ? $value : (isset($data['roledata']) ? $data['roledata'] : ''); | ||
80 | + $list = $this->getRoledataList(); | ||
81 | + return isset($list[$value]) ? $list[$value] : ''; | ||
82 | + } | ||
71 | public function getPrevtimeTextAttr($value, $data) | 83 | public function getPrevtimeTextAttr($value, $data) |
72 | { | 84 | { |
73 | $value = $value ? $value : $data['prevtime']; | 85 | $value = $value ? $value : $data['prevtime']; |
@@ -30,6 +30,19 @@ | @@ -30,6 +30,19 @@ | ||
30 | <input id="c-work_subsidy" data-rule="requird" class="form-control" name="row[work_subsidy]" type="number" value="0.00"> | 30 | <input id="c-work_subsidy" data-rule="requird" class="form-control" name="row[work_subsidy]" type="number" value="0.00"> |
31 | </div> | 31 | </div> |
32 | </div> | 32 | </div> |
33 | + | ||
34 | + <div class="form-group"> | ||
35 | + <label class="control-label col-xs-12 col-sm-2">{:__('Hotdata')}:</label> | ||
36 | + <div class="col-xs-12 col-sm-8"> | ||
37 | + | ||
38 | + <div class="radio"> | ||
39 | + {foreach name="hotdataList" item="vo"} | ||
40 | + <label for="row[hotdata]-{$key}"><input id="row[hotdata]-{$key}" name="row[hotdata]" type="radio" value="{$key}" {in name="key" value="0"}checked{/in} /> {$vo}</label> | ||
41 | + {/foreach} | ||
42 | + </div> | ||
43 | + | ||
44 | + </div> | ||
45 | + </div> | ||
33 | <div class="form-group"> | 46 | <div class="form-group"> |
34 | <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label> | 47 | <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label> |
35 | <div class="col-xs-12 col-sm-8"> | 48 | <div class="col-xs-12 col-sm-8"> |
@@ -30,6 +30,19 @@ | @@ -30,6 +30,19 @@ | ||
30 | <input id="c-work_subsidy" data-rule="requird" class="form-control" name="row[work_subsidy]" type="number" value="{$row.work_subsidy|htmlentities}"> | 30 | <input id="c-work_subsidy" data-rule="requird" class="form-control" name="row[work_subsidy]" type="number" value="{$row.work_subsidy|htmlentities}"> |
31 | </div> | 31 | </div> |
32 | </div> | 32 | </div> |
33 | + | ||
34 | + <div class="form-group"> | ||
35 | + <label class="control-label col-xs-12 col-sm-2">{:__('Hotdata')}:</label> | ||
36 | + <div class="col-xs-12 col-sm-8"> | ||
37 | + | ||
38 | + <div class="radio"> | ||
39 | + {foreach name="hotdataList" item="vo"} | ||
40 | + <label for="row[hotdata]-{$key}"><input id="row[hotdata]-{$key}" name="row[hotdata]" type="radio" value="{$key}" {in name="key" value="$row.hotdata"}checked{/in} /> {$vo}</label> | ||
41 | + {/foreach} | ||
42 | + </div> | ||
43 | + | ||
44 | + </div> | ||
45 | + </div> | ||
33 | <div class="form-group"> | 46 | <div class="form-group"> |
34 | <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label> | 47 | <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label> |
35 | <div class="col-xs-12 col-sm-8"> | 48 | <div class="col-xs-12 col-sm-8"> |
@@ -121,9 +121,40 @@ | @@ -121,9 +121,40 @@ | ||
121 | </div> | 121 | </div> |
122 | </div> | 122 | </div> |
123 | <div class="form-group"> | 123 | <div class="form-group"> |
124 | + <label class="control-label col-xs-12 col-sm-2">{:__('Lookdata')}:</label> | ||
125 | + <div class="col-xs-12 col-sm-8"> | ||
126 | + | ||
127 | + <div class="radio"> | ||
128 | + {foreach name="lookdataList" item="vo"} | ||
129 | + <label for="row[lookdata]-{$key}"><input id="row[lookdata]-{$key}" name="row[lookdata]" type="radio" value="{$key}" {in name="key" value="0"}checked{/in} /> {$vo}</label> | ||
130 | + {/foreach} | ||
131 | + </div> | ||
132 | + | ||
133 | + </div> | ||
134 | + </div> | ||
135 | + <div class="form-group job hide"> | ||
124 | <label class="control-label col-xs-12 col-sm-2">{:__('User_ids')}:</label> | 136 | <label class="control-label col-xs-12 col-sm-2">{:__('User_ids')}:</label> |
125 | <div class="col-xs-12 col-sm-8"> | 137 | <div class="col-xs-12 col-sm-8"> |
126 | - <input id="c-user_ids" data-source="user/user/index" data-multiple="true" data-field="nickname" class="form-control selectpage" name="row[user_ids]" type="text" value=""> | 138 | + <input id="c-user_ids" data-source="user/user/index" data-params='{"custom[roledata]":"1"}' data-multiple="true" data-field="nickname" class="form-control selectpage" name="row[user_ids]" type="text" value=""> |
139 | + </div> | ||
140 | + </div> | ||
141 | + | ||
142 | + <div class="form-group"> | ||
143 | + <label class="control-label col-xs-12 col-sm-2">{:__('Putdata')}:</label> | ||
144 | + <div class="col-xs-12 col-sm-8"> | ||
145 | + | ||
146 | + <div class="radio"> | ||
147 | + {foreach name="putdataList" item="vo"} | ||
148 | + <label for="row[putdata]-{$key}"><input id="row[putdata]-{$key}" name="row[putdata]" type="radio" value="{$key}" {in name="key" value="0"}checked{/in} /> {$vo}</label> | ||
149 | + {/foreach} | ||
150 | + </div> | ||
151 | + | ||
152 | + </div> | ||
153 | + </div> | ||
154 | + <div class="form-group"> | ||
155 | + <label class="control-label col-xs-12 col-sm-2">{:__('Label_ids')}:</label> | ||
156 | + <div class="col-xs-12 col-sm-8"> | ||
157 | + <input id="c-label_ids" data-source="label/index" data-field="title" data-multiple="true" class="form-control selectpage" name="row[label_ids]" type="text" value=""> | ||
127 | </div> | 158 | </div> |
128 | </div> | 159 | </div> |
129 | <div class="form-group"> | 160 | <div class="form-group"> |
@@ -121,9 +121,41 @@ | @@ -121,9 +121,41 @@ | ||
121 | </div> | 121 | </div> |
122 | </div> | 122 | </div> |
123 | <div class="form-group"> | 123 | <div class="form-group"> |
124 | + <label class="control-label col-xs-12 col-sm-2">{:__('Lookdata')}:</label> | ||
125 | + <div class="col-xs-12 col-sm-8"> | ||
126 | + | ||
127 | + <div class="radio"> | ||
128 | + {foreach name="lookdataList" item="vo"} | ||
129 | + <label for="row[lookdata]-{$key}"><input id="row[lookdata]-{$key}" name="row[lookdata]" type="radio" value="{$key}" {in name="key" value="$row.lookdata"}checked{/in} /> {$vo}</label> | ||
130 | + {/foreach} | ||
131 | + </div> | ||
132 | + | ||
133 | + </div> | ||
134 | + </div> | ||
135 | + | ||
136 | + <div class="form-group job hide"> | ||
124 | <label class="control-label col-xs-12 col-sm-2">{:__('User_ids')}:</label> | 137 | <label class="control-label col-xs-12 col-sm-2">{:__('User_ids')}:</label> |
125 | <div class="col-xs-12 col-sm-8"> | 138 | <div class="col-xs-12 col-sm-8"> |
126 | - <input id="c-user_ids" data-source="user/user/index" data-multiple="true" data-field="nickname" class="form-control selectpage" name="row[user_ids]" type="text" value="{$row.user_ids|htmlentities}"> | 139 | + <input id="c-user_ids" data-source="user/user/index" data-params='{"custom[roledata]":"1"}' data-multiple="true" data-field="nickname" class="form-control selectpage" name="row[user_ids]" type="text" value="{$row.user_ids|htmlentities}"> |
140 | + </div> | ||
141 | + </div> | ||
142 | + | ||
143 | + <div class="form-group"> | ||
144 | + <label class="control-label col-xs-12 col-sm-2">{:__('Label_ids')}:</label> | ||
145 | + <div class="col-xs-12 col-sm-8"> | ||
146 | + <input id="c-label_ids" data-source="label/index" data-field="title" data-multiple="true" class="form-control selectpage" name="row[label_ids]" type="text" value="{$row.label_ids|htmlentities}"> | ||
147 | + </div> | ||
148 | + </div> | ||
149 | + <div class="form-group"> | ||
150 | + <label class="control-label col-xs-12 col-sm-2">{:__('Putdata')}:</label> | ||
151 | + <div class="col-xs-12 col-sm-8"> | ||
152 | + | ||
153 | + <div class="radio"> | ||
154 | + {foreach name="putdataList" item="vo"} | ||
155 | + <label for="row[putdata]-{$key}"><input id="row[putdata]-{$key}" name="row[putdata]" type="radio" value="{$key}" {in name="key" value="$row.putdata"}checked{/in} /> {$vo}</label> | ||
156 | + {/foreach} | ||
157 | + </div> | ||
158 | + | ||
127 | </div> | 159 | </div> |
128 | </div> | 160 | </div> |
129 | <div class="form-group"> | 161 | <div class="form-group"> |
@@ -58,6 +58,19 @@ | @@ -58,6 +58,19 @@ | ||
58 | {:build_radios('row[status]', ['normal'=>__('Normal'), 'hidden'=>__('拉黑')], $row['status'])} | 58 | {:build_radios('row[status]', ['normal'=>__('Normal'), 'hidden'=>__('拉黑')], $row['status'])} |
59 | </div> | 59 | </div> |
60 | </div> | 60 | </div> |
61 | + <div class="form-group"> | ||
62 | + <label class="control-label col-xs-12 col-sm-2">{:__('Roledata')}:</label> | ||
63 | + <div class="col-xs-12 col-sm-8"> | ||
64 | + | ||
65 | + <div class="radio"> | ||
66 | + {foreach name="roledataList" item="vo"} | ||
67 | + <label for="row[Roledata]-{$key}"><input id="row[roledata]-{$key}" name="row[roledata]" type="radio" value="{$key}" {in name="key" value="$row.roledata"}checked{/in} /> {$vo}</label> | ||
68 | + {/foreach} | ||
69 | + </div> | ||
70 | + | ||
71 | + </div> | ||
72 | + </div> | ||
73 | + | ||
61 | <!--<div class="form-group"> | 74 | <!--<div class="form-group"> |
62 | <label for="c-work_subsidy" class="control-label col-xs-12 col-sm-2">{:__('Work_subsidy')}:</label> | 75 | <label for="c-work_subsidy" class="control-label col-xs-12 col-sm-2">{:__('Work_subsidy')}:</label> |
63 | <div class="col-xs-12 col-sm-8"> | 76 | <div class="col-xs-12 col-sm-8"> |
@@ -7,6 +7,7 @@ use app\api\model\Factory; | @@ -7,6 +7,7 @@ use app\api\model\Factory; | ||
7 | use app\api\model\Job; | 7 | use app\api\model\Job; |
8 | use app\api\model\JobCollect; | 8 | use app\api\model\JobCollect; |
9 | use app\api\model\JobKeyword; | 9 | use app\api\model\JobKeyword; |
10 | +use app\common\model\Inform; | ||
10 | use app\common\model\User; | 11 | use app\common\model\User; |
11 | use fast\Tree; | 12 | use fast\Tree; |
12 | use app\common\controller\Wechat; | 13 | use app\common\controller\Wechat; |
@@ -14,6 +15,7 @@ use app\common\controller\Api; | @@ -14,6 +15,7 @@ use app\common\controller\Api; | ||
14 | 15 | ||
15 | /** | 16 | /** |
16 | * 首页接口 | 17 | * 首页接口 |
18 | + * @ApiWeigh(2) | ||
17 | */ | 19 | */ |
18 | class Index extends Api | 20 | class Index extends Api |
19 | { | 21 | { |
@@ -144,7 +146,11 @@ class Index extends Api | @@ -144,7 +146,11 @@ class Index extends Api | ||
144 | "subsidy_price": "40.00", //平台补贴(元/时) | 146 | "subsidy_price": "40.00", //平台补贴(元/时) |
145 | "factory_price_total": "40.00", //工价 | 147 | "factory_price_total": "40.00", //工价 |
146 | "salary": "6000~7000", //月收入 | 148 | "salary": "6000~7000", //月收入 |
147 | - "people_num": 23 //报名人数 | 149 | + "people_num": 23, //报名人数 |
150 | + "label_name": [ //标签 | ||
151 | + "包吃", | ||
152 | + "包住" | ||
153 | + ] | ||
148 | }] | 154 | }] |
149 | } | 155 | } |
150 | }) | 156 | }) |
@@ -182,19 +188,28 @@ class Index extends Api | @@ -182,19 +188,28 @@ class Index extends Api | ||
182 | } | 188 | } |
183 | $where .= "job_name like '%{$keyword}%'"; | 189 | $where .= "job_name like '%{$keyword}%'"; |
184 | } | 190 | } |
191 | + $where .= $where ? ' and ' : ''; | ||
192 | + $where .= "putdata = '0'"; | ||
185 | // 哪些人及其下级可查看 | 193 | // 哪些人及其下级可查看 |
186 | if($this->auth->id){ | 194 | if($this->auth->id){ |
187 | $parentsIds = Tree::instance()->init(collection(User::select())->toArray())->getParentsIds($this->auth->id, true); | 195 | $parentsIds = Tree::instance()->init(collection(User::select())->toArray())->getParentsIds($this->auth->id, true); |
196 | + // 部分可看 | ||
197 | + $findinset = []; | ||
188 | foreach ($parentsIds as $pid){ | 198 | foreach ($parentsIds as $pid){ |
189 | $findinset[] = "find_in_set({$pid},user_ids)"; | 199 | $findinset[] = "find_in_set({$pid},user_ids)"; |
190 | } | 200 | } |
201 | + // 部分不可看 | ||
202 | + $findinsetn = []; | ||
203 | + foreach ($parentsIds as $pid){ | ||
204 | + $findinsetn[] = "find_in_set({$pid},user_ids) = 0"; | ||
205 | + } | ||
191 | $where .= $where ? ' and ' : ''; | 206 | $where .= $where ? ' and ' : ''; |
192 | - $where .= "(".implode(' or ',$findinset)." or user_ids = '')"; | 207 | + $where .= "((".implode(' or ',$findinset)." and lookdata = '1') or (lookdata = '0') or (".implode(' or ',$findinsetn)." and lookdata = '2'))"; |
193 | } | 208 | } |
194 | // 附近 | 209 | // 附近 |
195 | - $distance = '1'; | 210 | + $juli = 0; |
196 | if($lng && $lat){ | 211 | if($lng && $lat){ |
197 | - $distance = "ROUND( | 212 | + $juli = "ROUND( |
198 | 6378.138 * 2 * ASIN( | 213 | 6378.138 * 2 * ASIN( |
199 | SQRT( | 214 | SQRT( |
200 | POW( | 215 | POW( |
@@ -213,7 +228,7 @@ class Index extends Api | @@ -213,7 +228,7 @@ class Index extends Api | ||
213 | 2 | 228 | 2 |
214 | ) | 229 | ) |
215 | ) | 230 | ) |
216 | - ) , 2 | 231 | + ) * 1000 |
217 | )"; | 232 | )"; |
218 | } | 233 | } |
219 | // 职位类型 | 234 | // 职位类型 |
@@ -222,11 +237,11 @@ class Index extends Api | @@ -222,11 +237,11 @@ class Index extends Api | ||
222 | $where .= "find_in_set({$type},type)"; | 237 | $where .= "find_in_set({$type},type)"; |
223 | } | 238 | } |
224 | $data = Job::where($where) | 239 | $data = Job::where($where) |
225 | - ->field("*,{$distance} distance") | ||
226 | - ->order(['distance'=>'asc','weigh'=>'desc']) | 240 | + ->field("*,$juli juli,if($juli > 1000,CONCAT(ROUND($juli/1000,1),'km'),CONCAT($juli,'m')) distance") |
241 | + ->order(['juli'=>'asc','weigh'=>'desc']) | ||
227 | ->paginate($page_num,false,['page'=>$page]) | 242 | ->paginate($page_num,false,['page'=>$page]) |
228 | ->each(function($v){ | 243 | ->each(function($v){ |
229 | - $v->visible(['id','cover','job_name','salary','people_num','factory_price_total','factory_price','subsidy_price']); | 244 | + $v->visible(['id','cover','job_name','salary','people_num','factory_price_total','factory_price','subsidy_price','label_ids'])->append(['distance']); |
230 | })->toArray(); | 245 | })->toArray(); |
231 | $this->success('成功',$data); | 246 | $this->success('成功',$data); |
232 | } | 247 | } |
@@ -303,7 +318,7 @@ class Index extends Api | @@ -303,7 +318,7 @@ class Index extends Api | ||
303 | $where .= $where ? ' and ' : ''; | 318 | $where .= $where ? ' and ' : ''; |
304 | $where .= "(".implode(' or ',$findinset)." or user_ids = '')"; | 319 | $where .= "(".implode(' or ',$findinset)." or user_ids = '')"; |
305 | } | 320 | } |
306 | - | 321 | + |
307 | $data = Job::alias('j') | 322 | $data = Job::alias('j') |
308 | ->join('job_collect jc','jc.job_id = j.id and user_id = '.$this->auth->id) | 323 | ->join('job_collect jc','jc.job_id = j.id and user_id = '.$this->auth->id) |
309 | ->where($where) | 324 | ->where($where) |
@@ -340,19 +355,32 @@ class Index extends Api | @@ -340,19 +355,32 @@ class Index extends Api | ||
340 | "subsidy_price": "10.00", //平台补贴价格 | 355 | "subsidy_price": "10.00", //平台补贴价格 |
341 | "factory_price_total": "70.00", //补贴后工价 | 356 | "factory_price_total": "70.00", //补贴后工价 |
342 | "salary": "5000~6000", // 月收入 | 357 | "salary": "5000~6000", // 月收入 |
343 | - "is_collect": 0 //是否收藏:0=否,1=是 | 358 | + "label_name": [ //标签 |
359 | + "包吃", | ||
360 | + "包住" | ||
361 | + ], | ||
362 | + "is_collect": 0 ,//是否收藏:0=否,1=是 | ||
363 | + "inform": {//通知 | ||
364 | + "id": 5, //通知id | ||
365 | + "content": "hi哈佛地方", //通知内容 | ||
366 | + "status": "1", | ||
367 | + "job_id": 7 | ||
368 | + } | ||
344 | } | 369 | } |
345 | }) | 370 | }) |
346 | */ | 371 | */ |
347 | public function jobInfo() | 372 | public function jobInfo() |
348 | { | 373 | { |
374 | + $user_id = $this->auth->id; //用户id | ||
349 | $job_id = $this->request->param('job_id'); | 375 | $job_id = $this->request->param('job_id'); |
350 | empty($job_id) && $this->error('缺少必需参数'); | 376 | empty($job_id) && $this->error('缺少必需参数'); |
351 | $info = Job::get($job_id); | 377 | $info = Job::get($job_id); |
352 | empty($info) && $this->error('职位信息不存在'); | 378 | empty($info) && $this->error('职位信息不存在'); |
353 | $collect = JobCollect::where('user_id',$this->auth->id)->where('job_id',$job_id)->find(); | 379 | $collect = JobCollect::where('user_id',$this->auth->id)->where('job_id',$job_id)->find(); |
354 | $info->is_collect = !empty($collect) ? 1 : 0; | 380 | $info->is_collect = !empty($collect) ? 1 : 0; |
355 | - $info->visible(['id','images','job_name','factory_price_total','factory_price','subsidy_price','salary','content'])->append(['is_collect']); | 381 | + $deposit = new Inform; |
382 | + $info['inform'] = $deposit->where(['status'=>'1','job_id'=>$job_id,'deletetime'=>null])->order('id desc')->field('id,content,status,job_id')->find(); | ||
383 | + $info->visible(['id','images','job_name','factory_price_total','factory_price','subsidy_price','salary','content','lng','lat','label_ids'])->append(['is_collect','inform']); | ||
356 | $this->success('成功',$info); | 384 | $this->success('成功',$info); |
357 | } | 385 | } |
358 | 386 | ||
@@ -421,50 +449,82 @@ class Index extends Api | @@ -421,50 +449,82 @@ class Index extends Api | ||
421 | $user_id = $this->auth->id > 0 ? $this->auth->id : 0; | 449 | $user_id = $this->auth->id > 0 ? $this->auth->id : 0; |
422 | $qrcode_id = "{$job_id}_{$user_id}"; | 450 | $qrcode_id = "{$job_id}_{$user_id}"; |
423 | $qrcode = $dir.'/qrcode_'.$qrcode_id.'.png'; | 451 | $qrcode = $dir.'/qrcode_'.$qrcode_id.'.png'; |
424 | - if(!file_exists($qrcode)){ | ||
425 | - $user_id = $this->auth->id > 0 ? $this->auth->id : 0; | 452 | +// $qrcode_width = 192; |
453 | + $qrcode_width = 1100; | ||
454 | + if(!file_exists($qrcode) || imagesx(imagecreatefromjpeg(ROOT_PATH.'public/'.$qrcode)) != $qrcode_width){ | ||
426 | $response = Wechat::miniProgram()->app_code->getUnlimit($qrcode_id, [ | 455 | $response = Wechat::miniProgram()->app_code->getUnlimit($qrcode_id, [ |
427 | 'page' => 'pages/zhiwei_xq/zhiwei_xq', | 456 | 'page' => 'pages/zhiwei_xq/zhiwei_xq', |
428 | - 'width' => 280, //最小宽度280 | 457 | + 'width' => $qrcode_width, //最小宽度280 |
429 | ]); | 458 | ]); |
430 | if ($response instanceof \EasyWeChat\Kernel\Http\StreamResponse) { | 459 | if ($response instanceof \EasyWeChat\Kernel\Http\StreamResponse) { |
431 | $response->saveAs($dir, str_replace($dir.'/','',$qrcode)); | 460 | $response->saveAs($dir, str_replace($dir.'/','',$qrcode)); |
432 | } | 461 | } |
433 | // 280不满足,再缩小 | 462 | // 280不满足,再缩小 |
434 | - \think\Image::open($qrcode)->thumb(120,120,\think\Image::THUMB_CENTER)->save($qrcode); | 463 | + \think\Image::open($qrcode)->thumb($qrcode_width,$qrcode_width,\think\Image::THUMB_CENTER)->save($qrcode); |
435 | } | 464 | } |
436 | - //将职位封面图保存到本地 | ||
437 | - $job_cover = $dir.'/cover_'.$job_id.'.png'; | ||
438 | - file_put_contents($job_cover,file_get_contents($job['cover'])); | ||
439 | - \think\Image::open($job_cover)->thumb(84,84,\think\Image::THUMB_CENTER)->save($job_cover); | ||
440 | - | ||
441 | - $path_ttf = ROOT_PATH.'public/assets/fonts/PingFang.ttf'; | ||
442 | - $filename = $dir.'/'.$job_id.'.png'; | ||
443 | - | ||
444 | - $image = \think\Image::open(ROOT_PATH.'public/assets/img/miniProgram/job_back.png'); | ||
445 | - // 职位名称居中 | ||
446 | - $size = 12; | ||
447 | - $box1 = imagettfbbox($size, 0, $path_ttf, $job['job_name']); | ||
448 | - $box1_minx = min($box1[0], $box1[2], $box1[4], $box1[6]); | ||
449 | - $box1_maxx = max($box1[0], $box1[2], $box1[4], $box1[6]); | ||
450 | - /* 计算文字初始坐标和尺寸 */ | ||
451 | - $w = $box1_maxx - $box1_minx; | ||
452 | - $box1_minx += ($image->width() - $w) / 2; | ||
453 | 465 | ||
454 | - // 备注居中 | ||
455 | - $last_text = '长安此图识别二维码,进入小程序'; | ||
456 | - $box2 = imagettfbbox($size, 0, $path_ttf, $last_text); | ||
457 | - $box2_minx = min($box2[0], $box2[2], $box2[4], $box2[6]); | ||
458 | - $box2_maxx = max($box2[0], $box2[2], $box2[4], $box2[6]); | ||
459 | - /* 计算文字初始坐标和尺寸 */ | ||
460 | - $w = $box2_maxx - $box2_minx; | ||
461 | - $box2_minx += ($image->width() - $w) / 2; | ||
462 | - $image->water($job_cover,[129,120]) | ||
463 | - ->text($job['job_name'],$path_ttf,$size,'#020202',[$box1_minx,215]) | ||
464 | - ->water($qrcode,[111,262]) | ||
465 | - ->text($last_text,$path_ttf,$size,'#969799',[$box2_minx,410]) | ||
466 | - ->save($filename); | ||
467 | - $url = request()->domain().'/'.$filename.'?v='.time(); | 466 | +// //将职位图片首图保存到本地 |
467 | +// $images = db('job')->where('id',$job_id)->value('images'); | ||
468 | +// $image = cdnurl(explode(',',$images)[0],true); | ||
469 | +// // $image = 'https://recruit.brofirst.cn'.explode(',',$images)[0]; | ||
470 | +// $job_image = $dir.'/image_'.$job_id.'.png'; | ||
471 | +// file_put_contents($job_image,file_get_contents($image)); | ||
472 | +// \think\Image::open($job_image)->thumb(637,352,\think\Image::THUMB_CENTER)->save($job_image); | ||
473 | +// | ||
474 | +// $path_ttf = ROOT_PATH.'public/assets/fonts/PingFang.ttf'; | ||
475 | +// $filename = $dir.'/'.$job_id.'.png'; | ||
476 | +// | ||
477 | +// $image = \think\Image::open(ROOT_PATH.'public/assets/img/miniProgram/job_back_v2.png'); | ||
478 | +// // 职位名称居中 | ||
479 | +// $size = 30; | ||
480 | +// $box1 = imagettfbbox($size, 0, $path_ttf, $job['job_name']); | ||
481 | +// $box1_minx = min($box1[0], $box1[2], $box1[4], $box1[6]); | ||
482 | +// $box1_maxx = max($box1[0], $box1[2], $box1[4], $box1[6]); | ||
483 | +// /* 计算文字初始坐标和尺寸 */ | ||
484 | +// $w = $box1_maxx - $box1_minx; | ||
485 | +// $box1_minx += ($image->width() - $w) / 2; | ||
486 | +// | ||
487 | +// // 工价 | ||
488 | +// $size_11 = 25; | ||
489 | +// $factory_price_total = '工价:'.$job['factory_price_total'].'元/小时'; | ||
490 | +// $box2 = imagettfbbox($size_11, 0, $path_ttf, $factory_price_total); | ||
491 | +// $box2_minx = min($box2[0], $box2[2], $box2[4], $box2[6]); | ||
492 | +// $box2_maxx = max($box2[0], $box2[2], $box2[4], $box2[6]); | ||
493 | +// /* 计算文字初始坐标和尺寸 */ | ||
494 | +// $w = $box2_maxx - $box2_minx; | ||
495 | +// $box2_minx += $image->width() - $w - 106; | ||
496 | +// | ||
497 | +// // 工资 | ||
498 | +// $salary = '工资:'.$job['salary']; | ||
499 | +// $box3 = imagettfbbox($size_11, 0, $path_ttf, $salary); | ||
500 | +// $box3_minx = min($box3[0], $box3[2], $box3[4], $box3[6]); | ||
501 | +// $box3_maxx = max($box3[0], $box3[2], $box3[4], $box3[6]); | ||
502 | +// /* 计算文字初始坐标和尺寸 */ | ||
503 | +// $w = $box3_maxx - $box3_minx; | ||
504 | +// $box3_minx += $image->width() - $w - 106; | ||
505 | +// | ||
506 | +// // 备注居中 | ||
507 | +// $last_text = '码上报名'; | ||
508 | +// $box4 = imagettfbbox($size, 0, $path_ttf, $last_text); | ||
509 | +// $box4_minx = min($box4[0], $box4[2], $box4[4], $box4[6]); | ||
510 | +// $box4_maxx = max($box4[0], $box4[2], $box4[4], $box4[6]); | ||
511 | +// /* 计算文字初始坐标和尺寸 */ | ||
512 | +// $w = $box4_maxx - $box4_minx; | ||
513 | +// $box4_minx += ($image->width() - $w) / 2; | ||
514 | +// | ||
515 | +// $image->water($job_image,[25,25]) | ||
516 | +// ->text($job['job_name'],$path_ttf,$size,'#323233',[$box1_minx,411]) | ||
517 | +// ->text($job['job_name'],$path_ttf,$size,'#323233',[$box1_minx+1,411]) //画两遍,加粗 | ||
518 | +// ->text($factory_price_total,$path_ttf,$size_11,'#323233',[$box2_minx,477]) | ||
519 | +// ->text($factory_price_total,$path_ttf,$size_11,'#323233',[$box2_minx+1,477]) | ||
520 | +// ->text($salary,$path_ttf,$size_11,'#323233',[$box3_minx,532]) | ||
521 | +// ->text($salary,$path_ttf,$size_11,'#323233',[$box3_minx+1,532]) | ||
522 | +// ->text($last_text,$path_ttf,$size,'#FE9515',[$box4_minx,641]) | ||
523 | +// ->text($last_text,$path_ttf,$size,'#FE9515',[$box4_minx+1,641]) | ||
524 | +// ->water($qrcode,[249,698]) | ||
525 | +// ->save($filename); | ||
526 | +// $url = request()->domain().'/'.$filename.'?v='.time(); | ||
527 | + $url = request()->domain().'/'.$qrcode.'?v='.time(); | ||
468 | $this->success('成功',compact('url')); | 528 | $this->success('成功',compact('url')); |
469 | } | 529 | } |
470 | 530 |
@@ -7,6 +7,7 @@ use fast\Random; | @@ -7,6 +7,7 @@ use fast\Random; | ||
7 | 7 | ||
8 | /** | 8 | /** |
9 | * Token接口 | 9 | * Token接口 |
10 | + * @ApiWeigh(2) | ||
10 | */ | 11 | */ |
11 | class Token extends Api | 12 | class Token extends Api |
12 | { | 13 | { |
@@ -14,8 +15,20 @@ class Token extends Api | @@ -14,8 +15,20 @@ class Token extends Api | ||
14 | protected $noNeedRight = '*'; | 15 | protected $noNeedRight = '*'; |
15 | 16 | ||
16 | /** | 17 | /** |
17 | - * 检测Token是否过期 | ||
18 | - * | 18 | + * @ApiWeigh (99) |
19 | + * @ApiTitle (检测Token是否过期) | ||
20 | + * @ApiSummary (检测Token是否过期) | ||
21 | + * @ApiMethod (GET) | ||
22 | + * @ApiHeaders (name="token", type="string", required=true, description="请求的Token") | ||
23 | + * @ApiReturn({ | ||
24 | + "code": 1, | ||
25 | + "msg": "", | ||
26 | + "time": "1621402970", | ||
27 | + "data": { | ||
28 | + "token": "545eed64-39c4-437e-8285-ac94c03e4921", //token | ||
29 | + "expires_in": 2591951 //剩余有效时间 | ||
30 | + } | ||
31 | + }) | ||
19 | */ | 32 | */ |
20 | public function check() | 33 | public function check() |
21 | { | 34 | { |
@@ -25,8 +38,20 @@ class Token extends Api | @@ -25,8 +38,20 @@ class Token extends Api | ||
25 | } | 38 | } |
26 | 39 | ||
27 | /** | 40 | /** |
28 | - * 刷新Token | ||
29 | - * | 41 | + * @ApiWeigh (97) |
42 | + * @ApiTitle (刷新Token) | ||
43 | + * @ApiSummary (刷新Token) | ||
44 | + * @ApiMethod (GET) | ||
45 | + * @ApiHeaders (name="token", type="string", required=true, description="请求的Token") | ||
46 | + * @ApiReturn({ | ||
47 | + "code": 1, | ||
48 | + "msg": "", | ||
49 | + "time": "1621403556", | ||
50 | + "data": { | ||
51 | + "token": "175c6d84-42af-4c59-bce0-ad8a66eb5f3f", //token | ||
52 | + "expires_in": 2592000 //剩余有效时间 | ||
53 | + } | ||
54 | + }) | ||
30 | */ | 55 | */ |
31 | public function refresh() | 56 | public function refresh() |
32 | { | 57 | { |
@@ -5,27 +5,40 @@ namespace app\api\controller; | @@ -5,27 +5,40 @@ namespace app\api\controller; | ||
5 | use app\common\controller\Api; | 5 | use app\common\controller\Api; |
6 | use app\common\library\Ems; | 6 | use app\common\library\Ems; |
7 | use app\common\library\Sms; | 7 | use app\common\library\Sms; |
8 | +use app\common\model\Inform; | ||
8 | use fast\Random; | 9 | use fast\Random; |
9 | use fast\Tree; | 10 | use fast\Tree; |
11 | +use think\Exception; | ||
12 | +use think\exception\PDOException; | ||
10 | use think\Validate; | 13 | use think\Validate; |
11 | use think\Db; | 14 | use think\Db; |
12 | use addons\third\model\Third; | 15 | use addons\third\model\Third; |
13 | use app\api\model\Realname; | 16 | use app\api\model\Realname; |
14 | use app\api\model\UserKeyword; | 17 | use app\api\model\UserKeyword; |
18 | +use app\api\model\UserWorkLog; | ||
19 | +use app\api\model\UserWorkSubsidyLog; | ||
20 | +use app\api\model\UserRecruitSubsidyLog; | ||
21 | +use app\api\model\UserSalary; | ||
22 | +use app\api\model\Factory; | ||
23 | +use app\api\model\FactoryUser; | ||
24 | +use app\api\model\UserBorrow; | ||
15 | use app\common\controller\Wechat; | 25 | use app\common\controller\Wechat; |
16 | 26 | ||
17 | /** | 27 | /** |
18 | * 会员接口 | 28 | * 会员接口 |
29 | + * @ApiWeigh(2) | ||
19 | */ | 30 | */ |
20 | class User extends Api | 31 | class User extends Api |
21 | { | 32 | { |
22 | - protected $noNeedLogin = ['login', 'mobilelogin', 'register', 'resetpwd', 'changeemail', 'changemobile', 'third','get_session_key','authority','getPhoneNumber','workSubsidyContent','recruitSubsidyContent']; | 33 | + protected $noNeedLogin = ['login', 'mobilelogin', 'register', 'resetpwd', 'changeemail', 'changemobile', 'third','get_session_key','authority','getPhoneNumber','workSubsidyContent','recruitSubsidyContent','factoryList']; |
23 | protected $noNeedRight = '*'; | 34 | protected $noNeedRight = '*'; |
24 | 35 | ||
25 | // 用户列表 | 36 | // 用户列表 |
26 | public $user_list = []; | 37 | public $user_list = []; |
27 | // 可查看几级下级 | 38 | // 可查看几级下级 |
28 | public $lower_num = 0; | 39 | public $lower_num = 0; |
40 | + // 我的下级用户ID | ||
41 | + public $my_children_ids = []; | ||
29 | 42 | ||
30 | public function _initialize() | 43 | public function _initialize() |
31 | { | 44 | { |
@@ -51,38 +64,125 @@ class User extends Api | @@ -51,38 +64,125 @@ class User extends Api | ||
51 | "nickname": "admin", //昵称 | 64 | "nickname": "admin", //昵称 |
52 | "mobile": "13888888888", //手机号 | 65 | "mobile": "13888888888", //手机号 |
53 | "avatar": "/uploads/20201123/8894d62100f2f920ffb2f38063b63f2d.jpg", //原始头像地址 | 66 | "avatar": "/uploads/20201123/8894d62100f2f920ffb2f38063b63f2d.jpg", //原始头像地址 |
54 | - "is_work": "0", //是否在职:0=否,1=是 | ||
55 | - "work_subsidy": "2.00", //工时补贴价格(元/时) | ||
56 | - "work_subsidy_month": "600.00", //工时月工资(元/月) | ||
57 | - "recruit_subsidy_month": "300.00", //招聘月工资(元/月) | ||
58 | - "url": "/u/1", | ||
59 | - "realname_status": "0", // 实名认证状态:-1=未申请,0=申请中,1=通过,2=未通过 | ||
60 | - "full_avatar": "http://www.recruit.top/uploads/20201123/8894d62100f2f920ffb2f38063b63f2d.jpg", //完整头像地址 | ||
61 | - }, | ||
62 | - "recruit_subsidy": { | ||
63 | - "hour": "1.00", //招聘补贴价格(元/时) | ||
64 | - "day": "10.00", //招聘补贴价格(元/天) | ||
65 | - "month": "300.00" //招聘补贴价格(元/月) | 67 | + "is_work": "1", //是否在职:0=否,1=是 |
68 | + "factory": { //工厂 | ||
69 | + "id": 1, //工厂ID | ||
70 | + "factory_shortname": "" //工厂简称 | ||
71 | + } | ||
66 | } | 72 | } |
67 | } | 73 | } |
68 | }) | 74 | }) |
69 | */ | 75 | */ |
70 | public function index() | 76 | public function index() |
71 | { | 77 | { |
72 | - $user = $this->auth->getUser(); | ||
73 | - // 格式化头像 | ||
74 | - $user->full_avatar = cdnurl($user->avatar,true); | ||
75 | - // 实名认证状态 | ||
76 | - $realname = Realname::get(['user_id'=>$this->auth->id]); | ||
77 | - $user->realname_status = empty($realname) ? '-1' : $realname['status']; | ||
78 | - $user->visible(['id','avatar','nickname','mobile','is_work','work_subsidy','work_subsidy_month','recruit_subsidy_month'])->append(['realname_status','full_avatar']); | ||
79 | - // 招聘补贴 | ||
80 | - $recruit_subsidy = [ | ||
81 | - 'hour' => sprintf("%.2f",config('site.recruit_subsidy')), | ||
82 | - 'day' => sprintf("%.2f",config('site.recruit_subsidy') * 10), | ||
83 | - 'month' => sprintf("%.2f",config('site.recruit_subsidy') * 10 * 30), | 78 | + $user = $this->model->get($this->auth->id,['factory']); |
79 | + // 未入职工厂 | ||
80 | + if(!$user->getRelation('factory')){ | ||
81 | + $user['is_work'] = '0'; | ||
82 | + $user['factory'] = ''; | ||
83 | + } | ||
84 | + $user->visible(['id','avatar','nickname','mobile','is_work','factory']); | ||
85 | + $this->success('成功', compact('user')); | ||
86 | + } | ||
87 | + | ||
88 | + /** | ||
89 | + * @ApiWeigh (97) | ||
90 | + * @ApiTitle (劳务管理-工资) | ||
91 | + * @ApiSummary (劳务管理-工资) | ||
92 | + * @ApiMethod (POST) | ||
93 | + * | ||
94 | + * @ApiHeaders (name=token, type=string, required=true, description="请求的Token") | ||
95 | + * | ||
96 | + * @ApiReturn({ | ||
97 | + "code": 1, | ||
98 | + "msg": "成功", | ||
99 | + "time": "1612234313", | ||
100 | + "data": { | ||
101 | + "work_hours_month": "0.0", //本月打卡总工时 | ||
102 | + "work_salary_month": "0.00", //本月打卡工资 | ||
103 | + "work_subsidy": "2.00", //工时补贴(元/小时) | ||
104 | + "work_subsidy_month": 0, //本月工时补贴 | ||
105 | + "lower_work_hours_month": 0, //下级打卡总工时 | ||
106 | + "recruit_subsidy_month": 0, //下级招聘补贴工资 | ||
107 | + "salary": 0 //本月共收入 | ||
108 | + "notice" : "通知内容" // 通知 | ||
109 | + } | ||
110 | + }) | ||
111 | + */ | ||
112 | + public function salary() | ||
113 | + { | ||
114 | + $user = $this->model->get($this->auth->id); | ||
115 | + // 我的下级本月总工时和本月返我的总招聘补贴 | ||
116 | + $lower_work_hours_month = $this->model | ||
117 | + ->where('pid',$user['id']) | ||
118 | + ->where('is_work','1') | ||
119 | + ->sum('work_hours_month'); | ||
120 | + // 我的本月共收入 | ||
121 | + $salary = UserSalary::where('user_id',$user['id']) | ||
122 | + ->where('year_month',date('Y-m')) | ||
123 | + ->value('salary'); | ||
124 | + if(!$salary){ | ||
125 | + $salary = $user['work_salary_month'] + $user['work_subsidy_month'] + $user['recruit_subsidy_month']; | ||
126 | + } | ||
127 | + $data = [ | ||
128 | + 'work_hours_month' => $user['work_hours_month'], | ||
129 | + 'work_salary_month' => $user['work_salary_month'], | ||
130 | + 'work_subsidy' => ($user['is_work'] == '1' && $user['factory']) ? $user['factory']['work_subsidy'] : 0, | ||
131 | + 'work_subsidy_month' => $user['work_subsidy_month'], | ||
132 | + 'lower_work_hours_month' => $lower_work_hours_month, | ||
133 | + 'recruit_subsidy_month' => $user['recruit_subsidy_month'], | ||
134 | + 'salary' => $salary, | ||
135 | + 'notice' => config('site.notice'), | ||
84 | ]; | 136 | ]; |
85 | - $this->success('成功', compact('user','recruit_subsidy')); | 137 | + $this->success('成功', $data); |
138 | + } | ||
139 | + | ||
140 | + /** | ||
141 | + * @ApiWeigh (97) | ||
142 | + * @ApiTitle (劳务管理-工资-历史收入) | ||
143 | + * @ApiSummary (劳务管理-工资-历史收入) | ||
144 | + * @ApiMethod (POST) | ||
145 | + * | ||
146 | + * @ApiHeaders (name=token, type=string, required=true, description="请求的Token") | ||
147 | + * @ApiParams (name="page", type="inter", required=false, description="当前页(默认1)") | ||
148 | + * @ApiParams (name="page_num", type="inter", required=false, description="每页显示数据个数(默认10)") | ||
149 | + * | ||
150 | + * @ApiReturn({ | ||
151 | + "code": 1, | ||
152 | + "msg": "成功", | ||
153 | + "time": "1620612745", | ||
154 | + "data": { | ||
155 | + "total": 1, | ||
156 | + "per_page": 15, | ||
157 | + "current_page": 1, | ||
158 | + "last_page": 1, | ||
159 | + "data": [{ | ||
160 | + "id": 32, | ||
161 | + "user_id": 711, | ||
162 | + "salary": "600.00", //总工资 | ||
163 | + "year_month": "2021年04月", //月份 | ||
164 | + "createtime": 1615769765, | ||
165 | + "updatetime": 1615769765, | ||
166 | + "work_hours": "0.0", //总工时 | ||
167 | + "work_subsidy": "0.00", //在职奖励 | ||
168 | + "recruit_subsidy": "0.00", //推荐奖励 | ||
169 | + "status": "0" //状态:0=待审核,1=已结算 | ||
170 | + }] | ||
171 | + } | ||
172 | + }) | ||
173 | + */ | ||
174 | + public function salaryList() | ||
175 | + { | ||
176 | + $page = $this->request->param('page', 1, 'intval'); | ||
177 | + $page_num = $this->request->param('page_num', 10, 'intval'); | ||
178 | + $data = UserSalary::where('user_id',$this->auth->id) | ||
179 | + ->order('createtime desc') | ||
180 | + ->paginate($page_num,false,['page'=>$page]) | ||
181 | + ->each(function($v){ | ||
182 | + // 格式化年月 | ||
183 | + $v->year_month = date('Y年m月',strtotime($v['year_month'])); | ||
184 | + }); | ||
185 | + $this->success('成功', $data); | ||
86 | } | 186 | } |
87 | 187 | ||
88 | /** | 188 | /** |
@@ -193,7 +293,7 @@ class User extends Api | @@ -193,7 +293,7 @@ class User extends Api | ||
193 | } | 293 | } |
194 | 294 | ||
195 | /** | 295 | /** |
196 | - * @ApiWeigh (97) | 296 | + * @ApiWeigh (95) |
197 | * @ApiTitle (编辑资料) | 297 | * @ApiTitle (编辑资料) |
198 | * @ApiSummary (编辑资料) | 298 | * @ApiSummary (编辑资料) |
199 | * @ApiMethod (POST) | 299 | * @ApiMethod (POST) |
@@ -381,7 +481,190 @@ class User extends Api | @@ -381,7 +481,190 @@ class User extends Api | ||
381 | } | 481 | } |
382 | 482 | ||
383 | /** | 483 | /** |
384 | - * @ApiWeigh (95) | 484 | + * @ApiWeigh (94) |
485 | + * @ApiTitle (工厂列表) | ||
486 | + * @ApiSummary (工厂列表) | ||
487 | + * @ApiMethod (POST) | ||
488 | + * @ApiReturn ({ | ||
489 | + "code": 1, | ||
490 | + "msg": "入职成功后,驻厂将会为您服务", | ||
491 | + "time": "1612233294", | ||
492 | + "data": [{ | ||
493 | + "id": 1, //工厂ID | ||
494 | + "factory_name": "新美亚电子(深圳)有限公司", //工厂名称 | ||
495 | + "factory_shortname": "" //工厂简称 | ||
496 | + }] | ||
497 | + }) | ||
498 | + */ | ||
499 | + public function factoryList() | ||
500 | + { | ||
501 | + $list = Factory::field('id,factory_name,factory_shortname')->select(); | ||
502 | + $this->success('入职成功后,驻厂将会为您服务',$list); | ||
503 | + } | ||
504 | + | ||
505 | + /** | ||
506 | + * @ApiTitle 热门工厂 | ||
507 | + * @ApiMethod (POST) | ||
508 | + * @ApiReturn ({ | ||
509 | + "code": 1, | ||
510 | + "msg": "成功", | ||
511 | + "time": "1620371474", | ||
512 | + "data": [{ | ||
513 | + "id": 20, //工厂id | ||
514 | + "factory_name": "中天世纪实业有限公司", //工厂名称 | ||
515 | + "factory_shortname": "中天世纪实业有限公司" //工厂简称 | ||
516 | + }] | ||
517 | + }) | ||
518 | + */ | ||
519 | + public function hot(){ | ||
520 | + $list = Factory::where(['hotdata'=>'1'])->field('id,factory_name,factory_shortname')->select(); | ||
521 | + $this->success('成功',$list); | ||
522 | + } | ||
523 | + | ||
524 | + | ||
525 | + /** | ||
526 | + * @ApiWeigh (94) | ||
527 | + * @ApiTitle (工厂搜索列表) | ||
528 | + * @ApiSummary (工厂搜索列表) | ||
529 | + * @ApiMethod (POST) | ||
530 | + * @ApiParams (name="factory_name", type="string", required=true, description="工厂名称") | ||
531 | + * @ApiParams (name="page", type="string", required=true, description="分页") | ||
532 | + * @ApiReturn ({ | ||
533 | + "code": 1, | ||
534 | + "msg": "入职成功后,驻厂将会为您服务", | ||
535 | + "time": "1620372317", | ||
536 | + "data": { | ||
537 | + "total": 2, | ||
538 | + "per_page": 15, | ||
539 | + "current_page": 1, | ||
540 | + "last_page": 1, | ||
541 | + "data": [{ | ||
542 | + "id": 1, //工厂id | ||
543 | + "factory_name": "新美亚电子(深圳)有限公司", //工厂名称 | ||
544 | + "factory_shortname": "新美亚" //工厂简称 | ||
545 | + }] | ||
546 | + } | ||
547 | + }) | ||
548 | + */ | ||
549 | + public function factory() | ||
550 | + { | ||
551 | + $factory_name = $this->request->param('factory_name'); | ||
552 | + $where= []; | ||
553 | + if (!empty($factory_name)){ | ||
554 | + $where['factory_name'] = ['like', '%' . $factory_name . '%']; | ||
555 | + } | ||
556 | + $list = Factory::where($where)->field('id,factory_name,factory_shortname')->paginate(); | ||
557 | + $this->success('入职成功后,驻厂将会为您服务',$list); | ||
558 | + } | ||
559 | + | ||
560 | + /** | ||
561 | + * @ApiWeigh (93) | ||
562 | + * @ApiTitle (确认入职) | ||
563 | + * @ApiSummary (确认入职) | ||
564 | + * @ApiMethod (POST) | ||
565 | + * @ApiHeaders (name="token", type="string", required=true, description="请求的Token") | ||
566 | + * @ApiParams (name="factory_id", type="inter", required=true, description="工厂ID") | ||
567 | + * @ApiParams (name="join_time", type="inter", required=true, description="入职时间") | ||
568 | + * @ApiReturn ({ | ||
569 | + 'code':'1', | ||
570 | + 'msg':'返回成功', | ||
571 | + "data": null | ||
572 | + }) | ||
573 | + */ | ||
574 | + public function joinFactory() | ||
575 | + { | ||
576 | + $user = $this->model->get($this->auth->id); | ||
577 | + $factory_id = $this->request->param('factory_id'); | ||
578 | + $join_time= $this->request->param('join_time'); | ||
579 | + empty($factory_id) && $this->error('缺少必需参数'); | ||
580 | + $factory = Factory::get($factory_id); | ||
581 | + empty($factory) && $this->error('工厂不存在'); | ||
582 | + if($user['is_work'] == '1' && $user['factory']){ | ||
583 | + $this->error('已入职,确认入职无效'); | ||
584 | + } | ||
585 | + $has = FactoryUser::where('user_id',$user['id'])->order('createtime desc')->find(); | ||
586 | + if(!empty($has)){ | ||
587 | + $has['status'] == '0' && $this->error('正在审核中,请勿重复操作'); | ||
588 | + } | ||
589 | + FactoryUser::create([ | ||
590 | + 'user_id' => $user['id'], | ||
591 | + 'factory_id' => $factory_id, | ||
592 | + 'join_time' =>$join_time, | ||
593 | + ]); | ||
594 | + $this->success('入职成功后,驻厂将会为您服务'); | ||
595 | + } | ||
596 | + | ||
597 | + /** | ||
598 | + * @ApiTitle 入职页面文本 | ||
599 | + * @ApiMethod (POST) | ||
600 | + * @ApiReturn ({ | ||
601 | + "code": 1, | ||
602 | + "msg": "成功", | ||
603 | + "time": "1620373282", | ||
604 | + "data": "1.输入入职工厂\r\n2.选择工厂,提交入职" //文本内容 | ||
605 | + }) | ||
606 | + */ | ||
607 | + public function con(){ | ||
608 | + $content = config('site.content'); | ||
609 | + $this->success('成功',$content); | ||
610 | + } | ||
611 | + | ||
612 | + | ||
613 | + /** | ||
614 | + * @ApiWeigh (91) | ||
615 | + * @ApiTitle (办理离职) | ||
616 | + * @ApiSummary (办理离职) | ||
617 | + * @ApiMethod (POST) | ||
618 | + * @ApiHeaders (name="token", type="string", required=true, description="请求的Token") | ||
619 | + * @ApiParams (name="factory_id", type="inter", required=true, description="工厂ID") | ||
620 | + * @ApiReturn ({ | ||
621 | + 'code':'1', | ||
622 | + 'msg':'返回成功', | ||
623 | + "data": null | ||
624 | + }) | ||
625 | + */ | ||
626 | + public function quitFactory() | ||
627 | + { | ||
628 | + $factory_id = $this->request->param('factory_id'); | ||
629 | + empty($factory_id) && $this->error('缺少必需参数'); | ||
630 | + $factory = Factory::get($factory_id); | ||
631 | + empty($factory) && $this->error('入职企业不存在'); | ||
632 | + $user = $this->auth->getUser(); | ||
633 | + if(empty($user['factory_id']) || $user['is_work'] == '0'){ | ||
634 | + $this->error('未入职'); | ||
635 | + } | ||
636 | + $user['factory_id'] != $factory_id && $this->error('未入职该工厂'); | ||
637 | + $factory_user = FactoryUser::where('user_id',$this->auth->id) | ||
638 | + ->where('factory_id',$factory_id) | ||
639 | + ->where('status','1') | ||
640 | + ->find(); | ||
641 | + if(!$factory_user){ | ||
642 | + $factory_user = new FactoryUser; | ||
643 | + } | ||
644 | + Db::startTrans(); | ||
645 | + try { | ||
646 | + // 记录离职状态 | ||
647 | + $factory_user->save([ | ||
648 | + 'factory_id' => $factory_id, | ||
649 | + 'user_id' => $this->auth->id, | ||
650 | + 'status' => '3', | ||
651 | + 'quit_time' => time(), | ||
652 | + ]); | ||
653 | + // 修改用户为未入职 | ||
654 | + $user->save(['is_work'=>'0','factory_id'=>0,'join_time'=>0]); | ||
655 | + Db::commit(); | ||
656 | + } catch (PDOException $e) { | ||
657 | + Db::rollback(); | ||
658 | + $this->error($e->getMessage()); | ||
659 | + } catch (Exception $e) { | ||
660 | + Db::rollback(); | ||
661 | + $this->error($e->getMessage()); | ||
662 | + } | ||
663 | + $this->success('离职后之前数据将会暂停'); | ||
664 | + } | ||
665 | + | ||
666 | + /** | ||
667 | + * @ApiWeigh (89) | ||
385 | * @ApiTitle (实名认证) | 668 | * @ApiTitle (实名认证) |
386 | * @ApiSummary (实名认证) | 669 | * @ApiSummary (实名认证) |
387 | * @ApiMethod (POST) | 670 | * @ApiMethod (POST) |
@@ -389,8 +672,7 @@ class User extends Api | @@ -389,8 +672,7 @@ class User extends Api | ||
389 | * @ApiParams (name="realname", type="string", required=true, description="姓名") | 672 | * @ApiParams (name="realname", type="string", required=true, description="姓名") |
390 | * @ApiParams (name="idcard", type="string", required=true, description="身份证号") | 673 | * @ApiParams (name="idcard", type="string", required=true, description="身份证号") |
391 | * @ApiParams (name="mobile", type="string", required=true, description="手机号") | 674 | * @ApiParams (name="mobile", type="string", required=true, description="手机号") |
392 | - * @ApiParams (name="idcard_front", type="string", required=true, description="上传身份证正面") | ||
393 | - * @ApiParams (name="idcard_back", type="string", required=true, description="上传身份证反面") | 675 | + * @ApiParams (name="idcard_front", type="string", required=true, description="上传收款码") |
394 | * @ApiReturn ({ | 676 | * @ApiReturn ({ |
395 | 'code':'1', | 677 | 'code':'1', |
396 | 'msg':'返回成功', | 678 | 'msg':'返回成功', |
@@ -402,11 +684,12 @@ class User extends Api | @@ -402,11 +684,12 @@ class User extends Api | ||
402 | $post = $this->request->param(); | 684 | $post = $this->request->param(); |
403 | empty($post['realname']) && $this->error('请填写姓名'); | 685 | empty($post['realname']) && $this->error('请填写姓名'); |
404 | empty($post['idcard']) && $this->error('请填写身份证号'); | 686 | empty($post['idcard']) && $this->error('请填写身份证号'); |
405 | - empty($post['realname']) && $this->error('请填写姓名'); | ||
406 | empty($post['mobile']) && $this->error('请填写手机号'); | 687 | empty($post['mobile']) && $this->error('请填写手机号'); |
407 | - empty($post['idcard_front']) && $this->error('请上传身份证正面'); | ||
408 | - empty($post['idcard_back']) && $this->error('请上传身份证反面'); | 688 | + empty($post['idcard_front']) && $this->error('请上传收款码'); |
689 | +// empty($post['idcard_back']) && $this->error('请上传身份证反面'); | ||
409 | $realname = Realname::get(['user_id'=>$this->auth->id]); | 690 | $realname = Realname::get(['user_id'=>$this->auth->id]); |
691 | + $realname['status'] == '0' && $this->error('认证正在审核中,请勿重复操作'); | ||
692 | + $realname['status'] == '1' && $this->error('实名认证已通过审核,请勿重复操作'); | ||
410 | if(empty($realname)){ | 693 | if(empty($realname)){ |
411 | $realname = new Realname; | 694 | $realname = new Realname; |
412 | } | 695 | } |
@@ -418,7 +701,52 @@ class User extends Api | @@ -418,7 +701,52 @@ class User extends Api | ||
418 | } | 701 | } |
419 | 702 | ||
420 | /** | 703 | /** |
421 | - * @ApiWeigh (93) | 704 | + * @ApiTitle 认证页面通知 |
705 | + * @ApiReturn ({ | ||
706 | + "code": 1, | ||
707 | + "msg": "成功", | ||
708 | + "time": "1620439310", | ||
709 | + "data": { | ||
710 | + "id": 3, //通知id | ||
711 | + "content": "认证通知" //通知内容 | ||
712 | + } | ||
713 | + }) | ||
714 | + */ | ||
715 | + public function give(){ | ||
716 | + $inform= new Inform; | ||
717 | + $reclist = $inform | ||
718 | + ->where(['status'=>'2']) | ||
719 | + ->order('id desc') | ||
720 | + ->field('id,content') | ||
721 | + ->find(); | ||
722 | + $this->success('成功',$reclist); | ||
723 | + } | ||
724 | + | ||
725 | + | ||
726 | + /** | ||
727 | + * @ApiWeigh (87) | ||
728 | + * @ApiTitle (实名认证状态) | ||
729 | + * @ApiSummary (实名认证状态) | ||
730 | + * @ApiMethod (POST) | ||
731 | + * @ApiHeaders (name="token", type="string", required=true, description="请求的Token") | ||
732 | + * @ApiReturn ({ | ||
733 | + 'code':'1', | ||
734 | + 'msg':'返回成功', | ||
735 | + "data": { | ||
736 | + 'status': '1', // 实名认证状态:0=申请中,1=通过,2=未申请 | ||
737 | + } | ||
738 | + }) | ||
739 | + */ | ||
740 | + public function realnameStatus() | ||
741 | + { | ||
742 | + // 实名认证状态 | ||
743 | + $info = Realname::get(['user_id'=>$this->auth->id]); | ||
744 | + $status = empty($info) ? '2' : $info['status']; | ||
745 | + $this->success('成功',compact('status')); | ||
746 | + } | ||
747 | + | ||
748 | + /** | ||
749 | + * @ApiWeigh (85) | ||
422 | * @ApiTitle (code获取session_key和openid) | 750 | * @ApiTitle (code获取session_key和openid) |
423 | * @ApiSummary (code获取session_key和openid) | 751 | * @ApiSummary (code获取session_key和openid) |
424 | * @ApiMethod (POST) | 752 | * @ApiMethod (POST) |
@@ -431,6 +759,7 @@ class User extends Api | @@ -431,6 +759,7 @@ class User extends Api | ||
431 | "data": { | 759 | "data": { |
432 | "session_key": "1qyMwZRVdlBmQLwRYtYSgA==", | 760 | "session_key": "1qyMwZRVdlBmQLwRYtYSgA==", |
433 | "token": "9e4648c7-c640-4e41-b758-dd1a8ef7a7ae", | 761 | "token": "9e4648c7-c640-4e41-b758-dd1a8ef7a7ae", |
762 | + "openid": "9e4648c7-c640-4e41-b758-dd1a8ef7a7ae", | ||
434 | } | 763 | } |
435 | }) | 764 | }) |
436 | */ | 765 | */ |
@@ -466,13 +795,14 @@ class User extends Api | @@ -466,13 +795,14 @@ class User extends Api | ||
466 | } | 795 | } |
467 | 796 | ||
468 | /** | 797 | /** |
469 | - * @ApiWeigh (91) | 798 | + * @ApiWeigh (83) |
470 | * @ApiTitle (用户授权登录) | 799 | * @ApiTitle (用户授权登录) |
471 | * @ApiSummary (用户授权登录) | 800 | * @ApiSummary (用户授权登录) |
472 | * @ApiMethod (POST) | 801 | * @ApiMethod (POST) |
473 | * @ApiParams (name="sessionKey", type="string", required=true, description="小程序sessionKey") | 802 | * @ApiParams (name="sessionKey", type="string", required=true, description="小程序sessionKey") |
474 | * @ApiParams (name="iv", type="string", required=true, description="小程序iv") | 803 | * @ApiParams (name="iv", type="string", required=true, description="小程序iv") |
475 | * @ApiParams (name="encryptData", type="string", required=true, description="小程序encryptData") | 804 | * @ApiParams (name="encryptData", type="string", required=true, description="小程序encryptData") |
805 | + * @ApiParams (name="openid", type="string", required=true, description="openid") | ||
476 | * @ApiParams (name="user_id", type="inter", required=false, description="扫码获取的用户ID") | 806 | * @ApiParams (name="user_id", type="inter", required=false, description="扫码获取的用户ID") |
477 | * @ApiReturnParams (name="code", type="integer", required=true, sample="0") | 807 | * @ApiReturnParams (name="code", type="integer", required=true, sample="0") |
478 | * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功") | 808 | * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功") |
@@ -488,6 +818,7 @@ class User extends Api | @@ -488,6 +818,7 @@ class User extends Api | ||
488 | { | 818 | { |
489 | $param = $this->request->param(); | 819 | $param = $this->request->param(); |
490 | $pid = isset($param['user_id']) ? $param['user_id'] : 0; //上级ID | 820 | $pid = isset($param['user_id']) ? $param['user_id'] : 0; //上级ID |
821 | + \think\Log::write('授权登录user_id:'.$pid); | ||
491 | $validate = new \think\Validate([ | 822 | $validate = new \think\Validate([ |
492 | 'sessionKey' => 'require', | 823 | 'sessionKey' => 'require', |
493 | 'iv' => 'require', | 824 | 'iv' => 'require', |
@@ -504,8 +835,14 @@ class User extends Api | @@ -504,8 +835,14 @@ class User extends Api | ||
504 | // 获取小程序配置 | 835 | // 获取小程序配置 |
505 | $app = Wechat::miniProgram(); | 836 | $app = Wechat::miniProgram(); |
506 | $user_info = $app->encryptor->decryptData($param['sessionKey'], $param['iv'], $param['encryptData']); | 837 | $user_info = $app->encryptor->decryptData($param['sessionKey'], $param['iv'], $param['encryptData']); |
838 | + | ||
839 | + // 2021年4月13之后的获取不到openid | ||
840 | + if(empty($user_info['openId'])){ | ||
841 | + empty($param['openid']) && $this->error('传参缺少openid'); | ||
842 | + $user_info['openId'] = $param['openid']; | ||
843 | + } | ||
844 | + | ||
507 | // 判断用户是否授权 | 845 | // 判断用户是否授权 |
508 | - $user_model = new \app\common\model\User(); | ||
509 | $where = [ | 846 | $where = [ |
510 | 'openid' => $user_info['openId'] | 847 | 'openid' => $user_info['openId'] |
511 | ]; | 848 | ]; |
@@ -516,10 +853,10 @@ class User extends Api | @@ -516,10 +853,10 @@ class User extends Api | ||
516 | $ip = request()->ip(); | 853 | $ip = request()->ip(); |
517 | $time = time(); | 854 | $time = time(); |
518 | // 更新用户信息 | 855 | // 更新用户信息 |
519 | - $user = $user_model->get($third['user_id']); | 856 | + $user = $this->model->get($third['user_id']); |
520 | // 账号被删除重新添加 | 857 | // 账号被删除重新添加 |
521 | if(!$user){ | 858 | if(!$user){ |
522 | - $user = $user_model; | 859 | + $user = $this->model; |
523 | $user->id = $third['user_id']; | 860 | $user->id = $third['user_id']; |
524 | $user->nickname = $user_info['nickName']; | 861 | $user->nickname = $user_info['nickName']; |
525 | $user->avatar = $user_info['avatarUrl']; | 862 | $user->avatar = $user_info['avatarUrl']; |
@@ -553,11 +890,11 @@ class User extends Api | @@ -553,11 +890,11 @@ class User extends Api | ||
553 | 'prevtime' => $time, | 890 | 'prevtime' => $time, |
554 | 'pid' => $this->model->get($pid) ? $pid : 0 //上级ID | 891 | 'pid' => $this->model->get($pid) ? $pid : 0 //上级ID |
555 | ]; | 892 | ]; |
556 | - $result = $user_model->save($user_insert); | ||
557 | - $user_id = $user_model->getLastInsID(); | 893 | + $result = $this->model->save($user_insert); |
894 | + $user_id = $this->model->getLastInsID(); | ||
558 | // 生成小程序二维码 | 895 | // 生成小程序二维码 |
559 | // $minicode = makeQrcode($user_id,'user_qrcode'.$user_id.'.png','pages/clock/clock'); | 896 | // $minicode = makeQrcode($user_id,'user_qrcode'.$user_id.'.png','pages/clock/clock'); |
560 | -// $user_model->isUpdate(true)->save(['qrcode'=>$minicode],['id'=>$user_id]); | 897 | +// $this->model->isUpdate(true)->save(['qrcode'=>$minicode],['id'=>$user_id]); |
561 | $third_insert = [ | 898 | $third_insert = [ |
562 | 'user_id' => $user_id, | 899 | 'user_id' => $user_id, |
563 | 'platform' => 'wechat', | 900 | 'platform' => 'wechat', |
@@ -591,7 +928,7 @@ class User extends Api | @@ -591,7 +928,7 @@ class User extends Api | ||
591 | } | 928 | } |
592 | 929 | ||
593 | /** | 930 | /** |
594 | - * @ApiWeigh (89) | 931 | + * @ApiWeigh (81) |
595 | * @ApiTitle (用户授权获取手机号) | 932 | * @ApiTitle (用户授权获取手机号) |
596 | * @ApiSummary (用户授权获取手机号) | 933 | * @ApiSummary (用户授权获取手机号) |
597 | * @ApiMethod (POST) | 934 | * @ApiMethod (POST) |
@@ -639,13 +976,13 @@ class User extends Api | @@ -639,13 +976,13 @@ class User extends Api | ||
639 | // 新用户绑定手机号 | 976 | // 新用户绑定手机号 |
640 | $third = Third::where('openid',$param['openid'])->find(); | 977 | $third = Third::where('openid',$param['openid'])->find(); |
641 | if(!empty($data['phoneNumber']) && $third){ | 978 | if(!empty($data['phoneNumber']) && $third){ |
642 | - Db::name('user')->where('id',$third['user_id'])->update(['mobile'=>$data['phoneNumber']]); | 979 | + $this->model->where('id',$third['user_id'])->update(['mobile'=>$data['phoneNumber']]); |
643 | } | 980 | } |
644 | $this->success('授权成功',$data); | 981 | $this->success('授权成功',$data); |
645 | } | 982 | } |
646 | 983 | ||
647 | /** | 984 | /** |
648 | - * @ApiWeigh (87) | 985 | + * @ApiWeigh (79) |
649 | * @ApiTitle (工时补贴介绍) | 986 | * @ApiTitle (工时补贴介绍) |
650 | * @ApiSummary (工时补贴介绍) | 987 | * @ApiSummary (工时补贴介绍) |
651 | * @ApiMethod (POST) | 988 | * @ApiMethod (POST) |
@@ -662,7 +999,7 @@ class User extends Api | @@ -662,7 +999,7 @@ class User extends Api | ||
662 | } | 999 | } |
663 | 1000 | ||
664 | /** | 1001 | /** |
665 | - * @ApiWeigh (85) | 1002 | + * @ApiWeigh (77) |
666 | * @ApiTitle (招聘补贴介绍) | 1003 | * @ApiTitle (招聘补贴介绍) |
667 | * @ApiSummary (招聘补贴介绍) | 1004 | * @ApiSummary (招聘补贴介绍) |
668 | * @ApiMethod (POST) | 1005 | * @ApiMethod (POST) |
@@ -679,7 +1016,370 @@ class User extends Api | @@ -679,7 +1016,370 @@ class User extends Api | ||
679 | } | 1016 | } |
680 | 1017 | ||
681 | /** | 1018 | /** |
682 | - * @ApiWeigh (85) | 1019 | + * @ApiWeigh (75) |
1020 | + * @ApiTitle (记一笔工时) | ||
1021 | + * @ApiSummary (记一笔工时) | ||
1022 | + * @ApiMethod (POST) | ||
1023 | + * @ApiHeaders (name="token", type="string", required=true, description="请求的Token") | ||
1024 | + * @ApiParams (name="work_date", type="string", required=true, description="工作日期") | ||
1025 | + * @ApiParams (name="work_hours", type="string", required=true, description="工作时长") | ||
1026 | + * @ApiParams (name="work_price", type="string", required=true, description="工价") | ||
1027 | + * @ApiParams (name="work_type", type="string", required=true, description="班次:1=白班,2=夜班,3=休班") | ||
1028 | + * @ApiReturn ({ | ||
1029 | + "code": 1, | ||
1030 | + "msg": "成功", | ||
1031 | + "time": "1606124276", | ||
1032 | + "data": "<p>招聘补贴富文本详情介绍</p>" //招聘补贴介绍 | ||
1033 | + }) | ||
1034 | + */ | ||
1035 | + public function logWork(){ | ||
1036 | + $user = $this->model->get($this->auth->id); | ||
1037 | + $post = $this->request->param(); | ||
1038 | + empty($post['work_date']) && $this->error('请选择工作日期'); | ||
1039 | + $post['work_date'] = strtotime($post['work_date']) + 1; //日期转时间戳,加1为了用whereTime | ||
1040 | + $post['work_date'] >= strtotime('+1days',strtotime(date('Y-m-d'))) && $this->error('打卡日期不能大于今天'); | ||
1041 | + empty($post['work_type']) && $this->error('请选择班次'); | ||
1042 | + $work_salary = 0; | ||
1043 | + if($post['work_type'] != '3'){ | ||
1044 | + empty($post['work_hours']) && $this->error('请选择工作时长'); | ||
1045 | + empty($post['work_price']) && $this->error('请填写工价'); | ||
1046 | + $work_salary = round($post['work_hours'] * $post['work_price'],2); | ||
1047 | + } | ||
1048 | + $log = UserWorkLog::where('user_id',$user['id'])->where('work_date',$post['work_date'])->find(); | ||
1049 | + if(!$log){ | ||
1050 | + $log = new UserWorkLog; | ||
1051 | + } | ||
1052 | + // 记录连续打卡天数 | ||
1053 | + $yesterday = UserWorkLog::where('user_id',$user['id']) | ||
1054 | + ->where('work_type','in','1,2') | ||
1055 | + ->whereTime('work_date','yesterday') | ||
1056 | + ->find(); | ||
1057 | + $today = UserWorkLog::where('user_id',$user['id']) | ||
1058 | + ->where('work_type','in','1,2') | ||
1059 | + ->whereTime('work_date','today') | ||
1060 | + ->find(); | ||
1061 | + $log_days = $user['log_days'] == 0 ? 1 : ($yesterday && !$today ? ($user['log_days'] + 1) : $user['log_days']); | ||
1062 | + Db::startTrans(); | ||
1063 | + try { | ||
1064 | + /*记录打卡*/ | ||
1065 | + $log->save(array_merge([ | ||
1066 | + 'user_id' => $user['id'], | ||
1067 | + 'work_salary' => $work_salary | ||
1068 | + ],$post)); | ||
1069 | + /*更新用户数据*/ | ||
1070 | + $update_data = []; | ||
1071 | + // 更新本月工时、本月打卡工资和本月打卡次数 | ||
1072 | + if(date('Y-m',$post['work_date']) == date('Y-m')){ | ||
1073 | + // 本月工时 | ||
1074 | + $update_data['work_hours_month'] = UserWorkLog::where('user_id',$user['id']) | ||
1075 | + ->where('work_type','in','1,2') | ||
1076 | + ->whereTime('work_date','month') | ||
1077 | + ->sum('work_hours'); | ||
1078 | + // 本月打卡工资 | ||
1079 | + $update_data['work_salary_month'] = UserWorkLog::where('user_id',$user['id']) | ||
1080 | + ->where('work_type','in','1,2') | ||
1081 | + ->whereTime('work_date','month') | ||
1082 | + ->sum('work_salary'); | ||
1083 | + // 记录入职打卡工厂 | ||
1084 | + if($user['is_work'] == '1' && !empty($user['factory'])){ | ||
1085 | + $log->isUpdate(true)->save(['factory_id'=>$user['factory']['id']]); | ||
1086 | + } | ||
1087 | + // 本月打卡次数 | ||
1088 | + $update_data['log_days_month'] = UserWorkLog::where('user_id',$user['id']) | ||
1089 | + ->whereTime('work_date','month') | ||
1090 | + ->count(); | ||
1091 | + } | ||
1092 | + $update_data['log_days'] = $log_days; | ||
1093 | + if($update_data){ | ||
1094 | + $user->save($update_data); | ||
1095 | + } | ||
1096 | + // 计算该月工资 | ||
1097 | + $this->salaryCalculate($log,$user); | ||
1098 | + Db::commit(); | ||
1099 | + } catch (PDOException $e) { | ||
1100 | + Db::rollback(); | ||
1101 | + $this->error($e->getMessage()); | ||
1102 | + } catch (Exception $e) { | ||
1103 | + Db::rollback(); | ||
1104 | + $this->error($e->getMessage()); | ||
1105 | + } | ||
1106 | + $this->success('打卡成功'); | ||
1107 | + } | ||
1108 | + | ||
1109 | + /** | ||
1110 | + * @ApiInternal | ||
1111 | + * @ApiTitle (计算该月工资) | ||
1112 | + * @ApiSummary (计算该月工资) | ||
1113 | + */ | ||
1114 | + private function salaryCalculate($log,$user){ | ||
1115 | + /*记录该月工时补贴和招聘补贴*/ | ||
1116 | + if(!empty($log['factory_id'])){ | ||
1117 | + // 工时补贴 | ||
1118 | + $find1 = UserWorkSubsidyLog::get(['user_work_log_id'=>$log['id']]); | ||
1119 | + if(!$find1){ | ||
1120 | + $find1 = new UserWorkSubsidyLog; | ||
1121 | + } | ||
1122 | + $work_subsidy = $log['factory'] ? $log['factory']['work_subsidy'] : 1; | ||
1123 | + $find1->save([ | ||
1124 | + 'user_id' => $user['id'], | ||
1125 | + 'work_subsidy' => round($work_subsidy * $log['work_hours'],2), | ||
1126 | + 'work_date' => $log['work_date'], | ||
1127 | + 'user_work_log_id' => $log['id'], | ||
1128 | + ]); | ||
1129 | + // 招聘补贴上一级 | ||
1130 | + $parent = $this->model->get($user['pid']); | ||
1131 | + if($parent){ | ||
1132 | + $find2 = UserRecruitSubsidyLog::get(['user_work_log_id'=>$log['id'],'leave'=>0]); | ||
1133 | + if(!$find2){ | ||
1134 | + $find2 = new UserRecruitSubsidyLog; | ||
1135 | + } | ||
1136 | + $find2->save([ | ||
1137 | + 'user_id' => $user['pid'], | ||
1138 | + 'recruit_subsidy' => round($user['recruit_subsidy'] * $log['work_hours'],2), | ||
1139 | + 'work_date' => $log['work_date'], | ||
1140 | + 'children_id' => $user['id'], | ||
1141 | + 'user_work_log_id' => $log['id'], | ||
1142 | + 'leave' => 0, | ||
1143 | + ]); | ||
1144 | + // 招聘补贴上二级 | ||
1145 | + $pid2 =$this->mobel->where(['id'=>$parent['pid']])->find(); | ||
1146 | + if($pid2){ | ||
1147 | + $find2 = UserRecruitSubsidyLog::get(['user_work_log_id'=>$log['id'],'leave'=>1]); | ||
1148 | + if(!$find2){ | ||
1149 | + $find2 = new UserRecruitSubsidyLog; | ||
1150 | + } | ||
1151 | + $find2->save([ | ||
1152 | + 'user_id' => $pid2['pid'], | ||
1153 | + 'recruit_subsidy' => round($user['recruit_subsidy2'] * $log['work_hours'],2), | ||
1154 | + 'work_date' => $log['work_date'], | ||
1155 | + 'children_id' => $user['id'], | ||
1156 | + 'user_work_log_id' => $log['id'], | ||
1157 | + 'leave' => 1, | ||
1158 | + ]); | ||
1159 | + } | ||
1160 | + } | ||
1161 | + } | ||
1162 | + /*记录该月总工资*/ | ||
1163 | + $year_month = date('Y-m',$log['work_date']); | ||
1164 | + $user_salary = UserSalary::where('user_id',$user['id']) | ||
1165 | + ->where('year_month',$year_month) | ||
1166 | + ->find(); | ||
1167 | + if(!$user_salary){ | ||
1168 | + $user_salary = new UserSalary; | ||
1169 | + } | ||
1170 | + $month_start = strtotime($year_month); | ||
1171 | + $month_end = strtotime('+1 month',$month_start); | ||
1172 | + $work_salary_total = UserWorkLog::where('user_id',$user['id']) | ||
1173 | + ->where('work_type','in','1,2') | ||
1174 | + ->where("work_date >= {$month_start} and work_date < {$month_end}") | ||
1175 | + ->sum('work_salary'); //月打卡总工资 | ||
1176 | + $work_hours = UserWorkLog::where('user_id',$user['id']) | ||
1177 | + ->where('work_type','in','1,2') | ||
1178 | + ->where("work_date >= {$month_start} and work_date < {$month_end}") | ||
1179 | + ->sum('work_hours'); //总工时 | ||
1180 | + $work_subsidy_total = UserWorkSubsidyLog::where('user_id',$user['id']) | ||
1181 | + ->where("work_date >= {$month_start} and work_date < {$month_end}") | ||
1182 | + ->sum('work_subsidy'); //月工时总补贴 | ||
1183 | + $recruit_subsidy_total = UserRecruitSubsidyLog::where('user_id',$user['id']) | ||
1184 | + ->where("work_date >= {$month_start} and work_date < {$month_end}") | ||
1185 | + ->sum('recruit_subsidy'); //月招聘总补贴 | ||
1186 | + $user_salary->save([ | ||
1187 | + 'user_id' => $user['id'], | ||
1188 | + 'salary' => round($work_salary_total + $work_subsidy_total + $recruit_subsidy_total,2), | ||
1189 | + 'year_month' => $year_month, | ||
1190 | + 'work_hours' => $work_hours, | ||
1191 | + 'work_subsidy' => $work_subsidy_total, | ||
1192 | + 'recruit_subsidy' => $recruit_subsidy_total, | ||
1193 | + 'status' => '0', | ||
1194 | + ]); | ||
1195 | + | ||
1196 | + // 本月的工时补贴和招聘补贴 | ||
1197 | + if($user['is_work'] == '1' && !empty($user['factory']) && $year_month == date('Y-m')){ | ||
1198 | + // 本月工时补贴统计 | ||
1199 | + $user->isUpdate(true)->save(['work_subsidy_month'=>$work_subsidy_total]); | ||
1200 | + // 给上级返招聘补贴 | ||
1201 | + $parent = $this->model->get($user['pid']); | ||
1202 | + if($parent){ | ||
1203 | + $parent->save(['recruit_subsidy_month'=>UserRecruitSubsidyLog::where('user_id',$user['pid']) | ||
1204 | + ->where("work_date >= {$month_start} and work_date < {$month_end}") | ||
1205 | + ->sum('recruit_subsidy')]); | ||
1206 | + } | ||
1207 | + } | ||
1208 | + return true; | ||
1209 | + } | ||
1210 | + | ||
1211 | + /** | ||
1212 | + * @ApiWeigh (73) | ||
1213 | + * @ApiTitle (工时详情) | ||
1214 | + * @ApiSummary (工时详情) | ||
1215 | + * @ApiMethod (POST) | ||
1216 | + * @ApiHeaders (name="token", type="string", required=true, description="请求的Token") | ||
1217 | + * @ApiParams (name="work_date", type="string", required=true, description="工作日期") | ||
1218 | + * @ApiReturn ({ | ||
1219 | + "code": 1, | ||
1220 | + "msg": "成功", | ||
1221 | + "time": "1612340182", | ||
1222 | + "data": { | ||
1223 | + "id": 18, //ID | ||
1224 | + "user_id": 72, | ||
1225 | + "work_date": "2021-02-02", //工作日期 | ||
1226 | + "work_hours": "4.5", //工时时长 | ||
1227 | + "work_price": "20.00", //工价 | ||
1228 | + "work_salary": "90.00", //今日收入 | ||
1229 | + "work_type": "1", //班次:1=白班,2=夜班,3=休班 | ||
1230 | + "createtime": 1612279627, | ||
1231 | + "updatetime": 1612279627 | ||
1232 | + } | ||
1233 | + }) | ||
1234 | + */ | ||
1235 | + public function workLogInfo(){ | ||
1236 | + $work_date = $this->request->param('work_date'); | ||
1237 | + $work_date = strtotime($work_date) + 1; | ||
1238 | + $info = UserWorkLog::where('user_id',$this->auth->id)->where('work_date',$work_date)->find(); | ||
1239 | + $info['work_date'] = empty($info) ? date('Y-m-d') : date('Y-m-d',$info['work_date']); | ||
1240 | + $this->success('成功',$info); | ||
1241 | + } | ||
1242 | + | ||
1243 | + /** | ||
1244 | + * @ApiWeigh (71) | ||
1245 | + * @ApiTitle (工时统计图) | ||
1246 | + * @ApiSummary (工时统计图) | ||
1247 | + * @ApiMethod (POST) | ||
1248 | + * @ApiHeaders (name="token", type="string", required=true, description="请求的Token") | ||
1249 | + * @ApiParams (name="month", type="string", required=true, description="年月") | ||
1250 | + * @ApiReturn ({ | ||
1251 | + "code": 1, | ||
1252 | + "msg": "打卡成功", | ||
1253 | + "time": "1612279947", | ||
1254 | + "data": { | ||
1255 | + "work_hours_month": 9, //工时时长 | ||
1256 | + "work_salary_month": 180, //收入 | ||
1257 | + "list": [{ //本月数据 | ||
1258 | + "id": 14, | ||
1259 | + "work_date": "01", //打卡日期 | ||
1260 | + "work_hours": "4.5", //工时 | ||
1261 | + "work_type": "1", //班次:1=白班,2=夜班,3=休班 | ||
1262 | + }] | ||
1263 | + } | ||
1264 | + }) | ||
1265 | + */ | ||
1266 | + public function workLogList(){ | ||
1267 | + $month = $this->request->param('month'); | ||
1268 | + empty($month) && $this->error('缺少必需参数'); | ||
1269 | + $starttime = strtotime($month); | ||
1270 | + $endtime = strtotime('+1 month',$starttime) - 1; | ||
1271 | + $list = UserWorkLog::where('user_id',$this->auth->id) | ||
1272 | + ->where('work_date','between',[$starttime,$endtime]) | ||
1273 | + ->field('id,work_date,work_hours,work_type,work_salary') | ||
1274 | + ->select(); | ||
1275 | + // 打卡日期只显示当月日 | ||
1276 | + $arr = ['1'=>'白班','2'=>'夜班','3'=>'休班']; | ||
1277 | + foreach ($list as $v){ | ||
1278 | + $v['work_date'] = date('d',$v['work_date']); | ||
1279 | + if($v['work_type'] == '3'){ | ||
1280 | + $v['work_hours'] = 0; | ||
1281 | + } | ||
1282 | + $v['work_type'] = !empty($arr[$v['work_type']]) ? $arr[$v['work_type']] : '错误'; | ||
1283 | + } | ||
1284 | + $work_hours_month = array_sum(array_column($list,'work_hours')); | ||
1285 | + $work_salary_month = array_sum(array_column($list,'work_salary')); | ||
1286 | + $this->success('打卡成功',compact('work_hours_month','work_salary_month','list')); | ||
1287 | + } | ||
1288 | + | ||
1289 | + /** | ||
1290 | + * @ApiWeigh (69) | ||
1291 | + * @ApiTitle (借支-打卡天数) | ||
1292 | + * @ApiSummary (借支-打卡天数) | ||
1293 | + * @ApiMethod (POST) | ||
1294 | + * @ApiHeaders (name="token", type="string", required=true, description="请求的Token") | ||
1295 | + * @ApiReturn ({ | ||
1296 | + "code": 1, | ||
1297 | + "msg": "成功", | ||
1298 | + "time": "1612319531", | ||
1299 | + "data": { | ||
1300 | + "log_days": 1, //连续打卡天数 | ||
1301 | + "limit_days": 7, //打卡满7天 | ||
1302 | + "borrow_money": "300.00" //借支金额 | ||
1303 | + } | ||
1304 | + }) | ||
1305 | + */ | ||
1306 | + public function logDays(){ | ||
1307 | + $user = $this->auth->getUser(); | ||
1308 | + if($user['is_work'] == '0' || !$user['factory_id']){ | ||
1309 | + $this->error('抱歉,未入职不可申请'); | ||
1310 | + } | ||
1311 | + $factory = Factory::get($user['factory_id']); | ||
1312 | + empty($factory) && $this->error('您入职的工厂已被删除,请选择其他工厂入职'); | ||
1313 | + $this->success('成功',[ | ||
1314 | + 'log_days' => $user['log_days'], | ||
1315 | + 'limit_days' => 7, | ||
1316 | + 'borrow_money' => $factory['borrow_money'] | ||
1317 | + ]); | ||
1318 | + } | ||
1319 | + | ||
1320 | + /** | ||
1321 | + * @ApiWeigh (67) | ||
1322 | + * @ApiTitle (借支) | ||
1323 | + * @ApiSummary (借支) | ||
1324 | + * @ApiMethod (POST) | ||
1325 | + * @ApiHeaders (name="token", type="string", required=true, description="请求的token") | ||
1326 | + * @ApiParams (name="is_confirm", type="inter", required=true, description="是否确认:0=否,1=是") | ||
1327 | + * @ApiReturn ({ | ||
1328 | + "code": 1, //1=完成,2=未满打卡,3=确认借支 | ||
1329 | + "msg": "成功", | ||
1330 | + "time": "1606124276", | ||
1331 | + "data": { | ||
1332 | + "log_days": 1, //连续打卡天数 | ||
1333 | + "limit_days": 7, //打卡满7天 | ||
1334 | + "borrow_money": "300.00" //借支金额 | ||
1335 | + } | ||
1336 | + }) | ||
1337 | + */ | ||
1338 | + public function borrow(){ | ||
1339 | + $user = $this->auth->getUser(); | ||
1340 | + $is_confirm = $this->request->param('is_confirm','0'); | ||
1341 | + if($user['is_work'] == '0' || !$user['factory_id']){ | ||
1342 | + $this->error('抱歉,未入职不可申请'); | ||
1343 | + } | ||
1344 | + $factory = Factory::get($user['factory_id']); | ||
1345 | + empty($factory) && $this->error('您入职的工厂已被删除,请选择其他工厂入职'); | ||
1346 | + $user_borrow = UserBorrow::where('user_id',$user['id']) | ||
1347 | + ->where('factory_id',$user['factory_id']) | ||
1348 | + ->where('status','0') | ||
1349 | + ->order('createtime desc') | ||
1350 | + ->find(); | ||
1351 | + !empty($user_borrow) && $this->error('借支正在审核中,无法再次申请'); | ||
1352 | + $limit_days = 7; | ||
1353 | + $data = [ | ||
1354 | + 'log_days' => $user['log_days'], | ||
1355 | + 'limit_days' => $limit_days, | ||
1356 | + 'borrow_money' => $factory['borrow_money'] | ||
1357 | + ]; | ||
1358 | + $user['log_days'] < $limit_days && $this->error('您已打卡'.$user['log_days'].'天,不满'.$limit_days.'天,条件不足无法申请借支',$data,2); | ||
1359 | + if(!$is_confirm){ | ||
1360 | + $this->error('您已打卡满'.$user['log_days'].'天,可借'.$factory['borrow_money'].'元,是否申请借支?',$data,3); | ||
1361 | + } | ||
1362 | + Db::startTrans(); | ||
1363 | + try { | ||
1364 | + $user->save(['log_days'=>0]); | ||
1365 | + UserBorrow::create([ | ||
1366 | + 'user_id' => $user['id'], | ||
1367 | + 'factory_id' => $user['factory_id'], | ||
1368 | + 'borrow_money' => $factory['borrow_money'] | ||
1369 | + ]); | ||
1370 | + Db::commit(); | ||
1371 | + } catch (PDOException $e) { | ||
1372 | + Db::rollback(); | ||
1373 | + $this->error($e->getMessage()); | ||
1374 | + } catch (Exception $e) { | ||
1375 | + Db::rollback(); | ||
1376 | + $this->error($e->getMessage()); | ||
1377 | + } | ||
1378 | + $this->success('本次借支已完成,请重新打卡满'.$limit_days.'天可申请借支',$data); | ||
1379 | + } | ||
1380 | + | ||
1381 | + /** | ||
1382 | + * @ApiWeigh (65) | ||
683 | * @ApiTitle (分享) | 1383 | * @ApiTitle (分享) |
684 | * @ApiSummary (分享) | 1384 | * @ApiSummary (分享) |
685 | * @ApiMethod (POST) | 1385 | * @ApiMethod (POST) |
@@ -694,7 +1394,7 @@ class User extends Api | @@ -694,7 +1394,7 @@ class User extends Api | ||
694 | */ | 1394 | */ |
695 | public function userPoster() | 1395 | public function userPoster() |
696 | { | 1396 | { |
697 | - $user = \app\api\model\User::get($this->auth->id); | 1397 | + $user = $this->model->get($this->auth->id); |
698 | empty($user['avatar']) && $this->error('请先上传头像'); | 1398 | empty($user['avatar']) && $this->error('请先上传头像'); |
699 | !url_exists($user['avatar']) && $this->error('头像失效,请更新头像'); | 1399 | !url_exists($user['avatar']) && $this->error('头像失效,请更新头像'); |
700 | // 本地路径 | 1400 | // 本地路径 |
@@ -702,50 +1402,153 @@ class User extends Api | @@ -702,50 +1402,153 @@ class User extends Api | ||
702 | if (!file_exists($dir)){ | 1402 | if (!file_exists($dir)){ |
703 | mkdir($dir,0777,true); | 1403 | mkdir($dir,0777,true); |
704 | } | 1404 | } |
705 | - | 1405 | + |
706 | // 用户小程序码 | 1406 | // 用户小程序码 |
707 | $qrcode = $dir.'/qrcode_'.$user['id'].'.png'; | 1407 | $qrcode = $dir.'/qrcode_'.$user['id'].'.png'; |
708 | - if(!file_exists($qrcode)){ | 1408 | +// $qrcode_width = 338; |
1409 | + $qrcode_width = 1100; | ||
1410 | + if(!file_exists($qrcode) || imagesx(imagecreatefromjpeg(ROOT_PATH.'public/'.$qrcode)) != $qrcode_width){ | ||
709 | $response = Wechat::miniProgram()->app_code->getUnlimit($user['id'], [ | 1411 | $response = Wechat::miniProgram()->app_code->getUnlimit($user['id'], [ |
710 | 'page' => 'pages/indexone/indexone', | 1412 | 'page' => 'pages/indexone/indexone', |
711 | - 'width' => 280, //最小宽度280 | 1413 | + 'width' => $qrcode_width, //最小宽度280 |
712 | ]); | 1414 | ]); |
713 | if ($response instanceof \EasyWeChat\Kernel\Http\StreamResponse) { | 1415 | if ($response instanceof \EasyWeChat\Kernel\Http\StreamResponse) { |
714 | $response->saveAs($dir, str_replace($dir.'/','',$qrcode)); | 1416 | $response->saveAs($dir, str_replace($dir.'/','',$qrcode)); |
715 | } | 1417 | } |
716 | // 280不满足,再缩小 | 1418 | // 280不满足,再缩小 |
717 | - \think\Image::open($qrcode)->thumb(169,169,\think\Image::THUMB_CENTER)->save($qrcode); | ||
718 | - } | ||
719 | - | ||
720 | - //将用户头像保存到本地 | ||
721 | - $avatar = $dir.'/avatar_'.$user['id'].'.png'; | ||
722 | - file_put_contents($avatar,file_get_contents($user['avatar'])); | ||
723 | - \think\Image::open($avatar)->thumb(64,64,\think\Image::THUMB_CENTER)->save($avatar); | ||
724 | - createRoundImg($avatar); | ||
725 | - | ||
726 | - $path_ttf = ROOT_PATH.'public/assets/fonts/PingFang.ttf'; | ||
727 | - $filename = $dir.'/'.$user['id'].'.png'; | ||
728 | - | ||
729 | - $image = \think\Image::open(ROOT_PATH.'public/assets/img/miniProgram/user_back.png'); | ||
730 | - // 昵称居中 | ||
731 | - $nickname = $user['nickname']; | ||
732 | - $size = 12; | ||
733 | - $box1 = imagettfbbox($size, 0, $path_ttf, $nickname); | ||
734 | - $box1_minx = min($box1[0], $box1[2], $box1[4], $box1[6]); | ||
735 | - $box1_maxx = max($box1[0], $box1[2], $box1[4], $box1[6]); | ||
736 | - /* 计算文字初始坐标和尺寸 */ | ||
737 | - $w = $box1_maxx - $box1_minx; | ||
738 | - $box1_minx += ($image->width() - $w) / 2; | ||
739 | - $image->water($avatar,[156,52]) | ||
740 | - ->text($nickname,$path_ttf,$size,'#020202',[$box1_minx,131]) | ||
741 | - ->water($qrcode,[103,181]) | ||
742 | - ->save($filename); | ||
743 | - $url = request()->domain().'/'.$filename.'?v='.time(); | 1419 | + \think\Image::open($qrcode)->thumb($qrcode_width,$qrcode_width,\think\Image::THUMB_CENTER)->save($qrcode); //压缩kb |
1420 | + } | ||
1421 | + | ||
1422 | +// //将用户头像保存到本地 | ||
1423 | +// $avatar = $dir.'/avatar_'.$user['id'].'.png'; | ||
1424 | +// file_put_contents($avatar,file_get_contents($user['avatar'])); | ||
1425 | +// \think\Image::open($avatar)->thumb(128,128,\think\Image::THUMB_CENTER)->save($avatar); | ||
1426 | +// createRoundImg($avatar); | ||
1427 | +// | ||
1428 | +// $path_ttf = ROOT_PATH.'public/assets/fonts/PingFang.ttf'; | ||
1429 | +// $filename = $dir.'/'.$user['id'].'.png'; | ||
1430 | +// | ||
1431 | +// $image = \think\Image::open(ROOT_PATH.'public/assets/img/miniProgram/user_back_v2.png'); | ||
1432 | +// // 昵称居中 | ||
1433 | +// $nickname = $user['nickname']; | ||
1434 | +// $size = 30; | ||
1435 | +// $box1 = imagettfbbox($size, 0, $path_ttf, $nickname); | ||
1436 | +// $box1_minx = min($box1[0], $box1[2], $box1[4], $box1[6]); | ||
1437 | +// $box1_maxx = max($box1[0], $box1[2], $box1[4], $box1[6]); | ||
1438 | +// /* 计算文字初始坐标和尺寸 */ | ||
1439 | +// $w = $box1_maxx - $box1_minx; | ||
1440 | +// $box1_minx += ($image->width() - $w) / 2; | ||
1441 | +// $image->water($avatar,[312,104]) | ||
1442 | +// ->text($nickname,$path_ttf,$size,'#000000',[$box1_minx,262]) | ||
1443 | +// ->water($qrcode,[206,362]) | ||
1444 | +// ->save($filename); | ||
1445 | +// $url = request()->domain().'/'.$filename.'?v='.time(); | ||
1446 | + $url = request()->domain().'/'.$qrcode.'?v='.time(); | ||
744 | $this->success('成功',compact('url')); | 1447 | $this->success('成功',compact('url')); |
745 | } | 1448 | } |
746 | 1449 | ||
1450 | +// /** | ||
1451 | +// * @ApiWeigh (63) | ||
1452 | +// * @ApiTitle (下级) | ||
1453 | +// * @ApiSummary (下级) | ||
1454 | +// * @ApiMethod (POST) | ||
1455 | +// * @ApiHeaders (name="token", type="string", required=true, description="请求的token") | ||
1456 | +// * @ApiParams (name="page", type="inter", required=false, description="当前页(默认1)") | ||
1457 | +// * @ApiParams (name="page_num", type="inter", required=false, description="每页显示数据个数(默认10)") | ||
1458 | +// * @ApiParams (name="is_work", type="string", required=false, description="是否在职:0=否,1=是") | ||
1459 | +// * @ApiParams (name="keyword", type="string", required=false, description="关键字搜索") | ||
1460 | +// * @ApiReturn ({ | ||
1461 | +// "code": 1, | ||
1462 | +// "msg": "成功", | ||
1463 | +// "time": "1606359935", | ||
1464 | +// "data": { | ||
1465 | +// "total": 2, //总人数 | ||
1466 | +// "per_page": 15, | ||
1467 | +// "current_page": 1, | ||
1468 | +// "last_page": 1, | ||
1469 | +// "data": [{ | ||
1470 | +// "id": 3, //用户ID | ||
1471 | +// "nickname": "admin2", //昵称 | ||
1472 | +// "mobile": "13888888888", //手机号 | ||
1473 | +// "avatar": "http://www.recruit.top/uploads/20201123/8894d62100f2f920ffb2f38063b63f2d.jpg", //头像 | ||
1474 | +// "is_work": "0", //是否在职 | ||
1475 | +// "is_complete": "0", //补贴是否完成:0=否,1=是 | ||
1476 | +// "give_recruit_subsidy": 2, //工资 | ||
1477 | +// "work_hours_month": "0.0", //本月总工时 | ||
1478 | +// "factory": { //工厂 | ||
1479 | +// "id": 1, //工厂ID | ||
1480 | +// "factory_shortname": "" //工厂简称 | ||
1481 | +// } | ||
1482 | +// }] | ||
1483 | +// } | ||
1484 | +// }) | ||
1485 | +// */ | ||
1486 | +// public function aaa() | ||
1487 | +// { | ||
1488 | +// $user = $this->auth->getUser(); | ||
1489 | +// $page = $this->request->param('page', 1, 'intval'); | ||
1490 | +// $page_num = $this->request->param('page_num', 10, 'intval'); | ||
1491 | +// $is_work = $this->request->param('is_work'); //是否在职:0=否,1=是 | ||
1492 | +// $keyword = $this->request->param('keyword'); | ||
1493 | +// // 可查看下级 | ||
1494 | +// if(!$this->my_children_ids){ | ||
1495 | +// $this->user_list = $this->model->where('status','normal')->field('id,pid')->select(); | ||
1496 | +//// $this->lower_num = $this->auth->lower_num; | ||
1497 | +// $this->lower_num = 2; | ||
1498 | +// $this->my_children_ids = $this->getChildrenIds($this->auth->id); | ||
1499 | +// } | ||
1500 | +// $where['id'] = ['in',$this->my_children_ids]; | ||
1501 | +//// $where['pid'] = $user['id']; //下一级 | ||
1502 | +// if($is_work != ''){ | ||
1503 | +// $where['is_work'] = $is_work; | ||
1504 | +// } | ||
1505 | +// // 关键字 | ||
1506 | +// if(!empty($keyword)){ | ||
1507 | +// // 记录搜索关键词 | ||
1508 | +// if($this->auth->id){ | ||
1509 | +// $has = UserKeyword::where('user_id',$this->auth->id) | ||
1510 | +// ->where('keyword',$keyword) | ||
1511 | +// ->find(); | ||
1512 | +// if(!$has){ | ||
1513 | +// $keyword_list = UserKeyword::order('createtime asc')->select(); | ||
1514 | +// // 超过10条的删除 | ||
1515 | +// if(count($keyword_list) > 10){ | ||
1516 | +// UserKeyword::where('id',$keyword_list[0]['id'])->delete(); | ||
1517 | +// } | ||
1518 | +// UserKeyword::create([ | ||
1519 | +// 'user_id' => $this->auth->id, | ||
1520 | +// 'keyword' => $keyword | ||
1521 | +// ]); | ||
1522 | +// }else{ | ||
1523 | +// $has->updatetime = time(); | ||
1524 | +// $has->save(); | ||
1525 | +// } | ||
1526 | +// } | ||
1527 | +// $where['nickname'] = ['like','%'.$keyword.'%']; | ||
1528 | +// } | ||
1529 | +// $data = $this->model | ||
1530 | +// ->with(['factory']) | ||
1531 | +// ->where($where) | ||
1532 | +// ->order('createtime desc') | ||
1533 | +// ->paginate($page_num,false,['page'=>$page]) | ||
1534 | +// ->each(function($v){ | ||
1535 | +// if(Validate::regex($v['mobile'], "^1\d{10}$")){ | ||
1536 | +// $v['mobile'] = substr_replace($v['mobile'],'*****',3,5); | ||
1537 | +// } | ||
1538 | +// $v->give_recruit_subsidy = round($v['recruit_subsidy']*$v['work_hours_month'],2); | ||
1539 | +// // 未入职工厂 | ||
1540 | +// if(!$v->getRelation('factory')){ | ||
1541 | +// $v['is_work'] = '0'; | ||
1542 | +// $v['factory'] = ''; | ||
1543 | +// } | ||
1544 | +// $v->visible(['id','avatar','nickname','is_work','mobile','is_complete','work_hours_month','factory'])->append(['give_recruit_subsidy']); | ||
1545 | +// }); | ||
1546 | +// $this->success('成功',$data); | ||
1547 | +// } | ||
1548 | + | ||
1549 | + | ||
747 | /** | 1550 | /** |
748 | - * @ApiWeigh (83) | 1551 | + * @ApiWeigh (63) |
749 | * @ApiTitle (下级) | 1552 | * @ApiTitle (下级) |
750 | * @ApiSummary (下级) | 1553 | * @ApiSummary (下级) |
751 | * @ApiMethod (POST) | 1554 | * @ApiMethod (POST) |
@@ -770,6 +1573,13 @@ class User extends Api | @@ -770,6 +1573,13 @@ class User extends Api | ||
770 | "avatar": "http://www.recruit.top/uploads/20201123/8894d62100f2f920ffb2f38063b63f2d.jpg", //头像 | 1573 | "avatar": "http://www.recruit.top/uploads/20201123/8894d62100f2f920ffb2f38063b63f2d.jpg", //头像 |
771 | "is_work": "0", //是否在职 | 1574 | "is_work": "0", //是否在职 |
772 | "is_complete": "0", //补贴是否完成:0=否,1=是 | 1575 | "is_complete": "0", //补贴是否完成:0=否,1=是 |
1576 | + "give_recruit_subsidy": 2, //工资 | ||
1577 | + "work_hours_month": "0.0", //本月总工时 | ||
1578 | + "num":'a', //标识:a为一级,b为二级 | ||
1579 | + "factory": { //工厂 | ||
1580 | + "id": 1, //工厂ID | ||
1581 | + "factory_shortname": "" //工厂简称 | ||
1582 | + } | ||
773 | }] | 1583 | }] |
774 | } | 1584 | } |
775 | }) | 1585 | }) |
@@ -777,14 +1587,23 @@ class User extends Api | @@ -777,14 +1587,23 @@ class User extends Api | ||
777 | public function lowerList() | 1587 | public function lowerList() |
778 | { | 1588 | { |
779 | $user = $this->auth->getUser(); | 1589 | $user = $this->auth->getUser(); |
1590 | +// var_dump($user['id']); | ||
780 | $page = $this->request->param('page', 1, 'intval'); | 1591 | $page = $this->request->param('page', 1, 'intval'); |
781 | $page_num = $this->request->param('page_num', 10, 'intval'); | 1592 | $page_num = $this->request->param('page_num', 10, 'intval'); |
782 | $is_work = $this->request->param('is_work'); //是否在职:0=否,1=是 | 1593 | $is_work = $this->request->param('is_work'); //是否在职:0=否,1=是 |
783 | $keyword = $this->request->param('keyword'); | 1594 | $keyword = $this->request->param('keyword'); |
784 | - $this->user_list = $this->model->where('status','normal')->field('id,pid')->select(); | ||
785 | - $this->lower_num = $user['lower_num']; | ||
786 | - $childrenIds = $this->getChildrenIds($user['id']); | ||
787 | - $where['id'] = ['in',$childrenIds]; | 1595 | +// $where['pid'] = $user['id']; //下一级 |
1596 | + // 下二级 | ||
1597 | + $xia_ids = $this->model | ||
1598 | + ->where('pid',$user['id']) | ||
1599 | + ->column('id'); | ||
1600 | + if(!empty($xia_ids)){ | ||
1601 | + $xia_xia_ids = $this->model | ||
1602 | + ->where('pid','in',$xia_ids) | ||
1603 | + ->column('id'); | ||
1604 | + $xia_ids = $xia_xia_ids ? array_merge($xia_ids,$xia_xia_ids) : $xia_ids; | ||
1605 | + } | ||
1606 | + $where['id'] = $xia_ids ? ['in',$xia_ids] : 0; | ||
788 | if($is_work != ''){ | 1607 | if($is_work != ''){ |
789 | $where['is_work'] = $is_work; | 1608 | $where['is_work'] = $is_work; |
790 | } | 1609 | } |
@@ -813,6 +1632,7 @@ class User extends Api | @@ -813,6 +1632,7 @@ class User extends Api | ||
813 | $where['nickname'] = ['like','%'.$keyword.'%']; | 1632 | $where['nickname'] = ['like','%'.$keyword.'%']; |
814 | } | 1633 | } |
815 | $data = $this->model | 1634 | $data = $this->model |
1635 | + ->with(['factory']) | ||
816 | ->where($where) | 1636 | ->where($where) |
817 | ->order('createtime desc') | 1637 | ->order('createtime desc') |
818 | ->paginate($page_num,false,['page'=>$page]) | 1638 | ->paginate($page_num,false,['page'=>$page]) |
@@ -820,13 +1640,24 @@ class User extends Api | @@ -820,13 +1640,24 @@ class User extends Api | ||
820 | if(Validate::regex($v['mobile'], "^1\d{10}$")){ | 1640 | if(Validate::regex($v['mobile'], "^1\d{10}$")){ |
821 | $v['mobile'] = substr_replace($v['mobile'],'*****',3,5); | 1641 | $v['mobile'] = substr_replace($v['mobile'],'*****',3,5); |
822 | } | 1642 | } |
823 | - $v->visible(['id','avatar','nickname','is_work','mobile','is_complete']); | ||
824 | - })->toArray(); | 1643 | + $v->give_recruit_subsidy = round($v['recruit_subsidy']*$v['work_hours_month'],2); |
1644 | + // 未入职工厂 | ||
1645 | + if(!$v->getRelation('factory')){ | ||
1646 | + $v['is_work'] = '0'; | ||
1647 | + $v['factory'] = ''; | ||
1648 | + } | ||
1649 | + if ($v['pid'] == $this->auth->id){ | ||
1650 | + $v['num'] ='a'; | ||
1651 | + }else{ | ||
1652 | + $v['num'] ='b'; | ||
1653 | + } | ||
1654 | + $v->visible(['id','avatar','nickname','is_work','mobile','is_complete','work_hours_month','factory'])->append(['give_recruit_subsidy','num']); | ||
1655 | + }); | ||
825 | $this->success('成功',$data); | 1656 | $this->success('成功',$data); |
826 | } | 1657 | } |
827 | 1658 | ||
828 | /** | 1659 | /** |
829 | - * @ApiWeigh (81) | 1660 | + * @ApiWeigh (61) |
830 | * @ApiTitle (搜索历史) | 1661 | * @ApiTitle (搜索历史) |
831 | * @ApiSummary (搜索历史) | 1662 | * @ApiSummary (搜索历史) |
832 | * @ApiMethod (POST) | 1663 | * @ApiMethod (POST) |
@@ -852,7 +1683,7 @@ class User extends Api | @@ -852,7 +1683,7 @@ class User extends Api | ||
852 | } | 1683 | } |
853 | 1684 | ||
854 | /** | 1685 | /** |
855 | - * @ApiWeigh (79) | 1686 | + * @ApiWeigh (59) |
856 | * @ApiTitle (搜索历史-清空) | 1687 | * @ApiTitle (搜索历史-清空) |
857 | * @ApiSummary (搜索历史-清空) | 1688 | * @ApiSummary (搜索历史-清空) |
858 | * @ApiMethod (POST) | 1689 | * @ApiMethod (POST) |
@@ -873,7 +1704,7 @@ class User extends Api | @@ -873,7 +1704,7 @@ class User extends Api | ||
873 | } | 1704 | } |
874 | 1705 | ||
875 | /** | 1706 | /** |
876 | - * @ApiWeigh (77) | 1707 | + * @ApiWeigh (57) |
877 | * @ApiTitle (下级的下级) | 1708 | * @ApiTitle (下级的下级) |
878 | * @ApiSummary (下级的下级) | 1709 | * @ApiSummary (下级的下级) |
879 | * @ApiMethod (POST) | 1710 | * @ApiMethod (POST) |
@@ -893,6 +1724,10 @@ class User extends Api | @@ -893,6 +1724,10 @@ class User extends Api | ||
893 | "avatar": "http://www.recruit.top/uploads/20201123/8894d62100f2f920ffb2f38063b63f2d.jpg", //头像 | 1724 | "avatar": "http://www.recruit.top/uploads/20201123/8894d62100f2f920ffb2f38063b63f2d.jpg", //头像 |
894 | "is_work": "0", //是否在职:0=否,1=是 | 1725 | "is_work": "0", //是否在职:0=否,1=是 |
895 | "is_complete": "0", //补贴是否完成:0=否,1=是 | 1726 | "is_complete": "0", //补贴是否完成:0=否,1=是 |
1727 | + "factory": { //工厂 | ||
1728 | + "id": 1, //工厂ID | ||
1729 | + "factory_shortname": "" //工厂简称 | ||
1730 | + } | ||
896 | }, | 1731 | }, |
897 | "list": { //下级的下级 | 1732 | "list": { //下级的下级 |
898 | "total": 3, //总数据 | 1733 | "total": 3, //总数据 |
@@ -906,6 +1741,12 @@ class User extends Api | @@ -906,6 +1741,12 @@ class User extends Api | ||
906 | "avatar": "", //头像 | 1741 | "avatar": "", //头像 |
907 | "is_work": "1", //是否在职:0=否,1=是 | 1742 | "is_work": "1", //是否在职:0=否,1=是 |
908 | "is_complete": "0", //补贴是否完成:0=否,1=是 | 1743 | "is_complete": "0", //补贴是否完成:0=否,1=是 |
1744 | + "give_recruit_subsidy": 2, //工资 | ||
1745 | + "work_hours_month": "0.0", //本月总工时 | ||
1746 | + "factory": { //工厂 | ||
1747 | + "id": 1, //工厂ID | ||
1748 | + "factory_shortname": "" //工厂简称 | ||
1749 | + } | ||
909 | }] | 1750 | }] |
910 | } | 1751 | } |
911 | } | 1752 | } |
@@ -917,17 +1758,24 @@ class User extends Api | @@ -917,17 +1758,24 @@ class User extends Api | ||
917 | $page = $this->request->param('page', 1, 'intval'); | 1758 | $page = $this->request->param('page', 1, 'intval'); |
918 | $page_num = $this->request->param('page_num', 10, 'intval'); | 1759 | $page_num = $this->request->param('page_num', 10, 'intval'); |
919 | $is_work = $this->request->param('is_work'); //是否在职:0=否,1=是 | 1760 | $is_work = $this->request->param('is_work'); //是否在职:0=否,1=是 |
920 | - $this->user_list = $this->model->where('status','normal')->field('id,pid')->select(); | ||
921 | empty($user_id) && $this->error('缺少必需参数'); | 1761 | empty($user_id) && $this->error('缺少必需参数'); |
922 | - $user = $this->model->get($user_id); | 1762 | + $user = $this->model->get($user_id,['factory']); |
923 | empty($user) && $this->error('下级用户信息不存在'); | 1763 | empty($user) && $this->error('下级用户信息不存在'); |
924 | - $this->lower_num = $user['lower_num']; | ||
925 | - $childrenIds = $this->getChildrenIds($user['id']); | ||
926 | - $where['id'] = ['in',$childrenIds]; | 1764 | + |
1765 | + // 可查看下级 | ||
1766 | + if(!$this->my_children_ids){ | ||
1767 | + $this->user_list = $this->model->where('status','normal')->field('id,pid')->select(); | ||
1768 | + $this->lower_num = $this->auth->lower_num; | ||
1769 | + $this->my_children_ids = $this->getChildrenIds($this->auth->id); | ||
1770 | + } | ||
1771 | + $where['id'] = ['in',$this->my_children_ids]; | ||
1772 | + | ||
1773 | + $where['pid'] = $user_id; | ||
927 | if($is_work != ''){ | 1774 | if($is_work != ''){ |
928 | $where['is_work'] = $is_work; | 1775 | $where['is_work'] = $is_work; |
929 | } | 1776 | } |
930 | $list = $this->model | 1777 | $list = $this->model |
1778 | + ->with(['factory']) | ||
931 | ->where($where) | 1779 | ->where($where) |
932 | ->order('createtime desc') | 1780 | ->order('createtime desc') |
933 | ->paginate($page_num,false,['page'=>$page]) | 1781 | ->paginate($page_num,false,['page'=>$page]) |
@@ -935,12 +1783,18 @@ class User extends Api | @@ -935,12 +1783,18 @@ class User extends Api | ||
935 | if(Validate::regex($v['mobile'], "^1\d{10}$")){ | 1783 | if(Validate::regex($v['mobile'], "^1\d{10}$")){ |
936 | $v['mobile'] = substr_replace($v['mobile'],'*****',3,5); | 1784 | $v['mobile'] = substr_replace($v['mobile'],'*****',3,5); |
937 | } | 1785 | } |
938 | - $v->visible(['id','avatar','nickname','is_work','mobile','is_complete']); | ||
939 | - })->toArray(); | 1786 | + $v->give_recruit_subsidy = round($v['recruit_subsidy']*$v['work_hours_month'],2); |
1787 | + // 未入职工厂 | ||
1788 | + if(!$v->getRelation('factory')){ | ||
1789 | + $v['is_work'] = '0'; | ||
1790 | + $v['factory'] = ''; | ||
1791 | + } | ||
1792 | + $v->visible(['id','avatar','nickname','is_work','mobile','is_complete','work_hours_month','factory'])->append(['give_recruit_subsidy']); | ||
1793 | + }); | ||
940 | if(Validate::regex($user['mobile'], "^1\d{10}$")){ | 1794 | if(Validate::regex($user['mobile'], "^1\d{10}$")){ |
941 | $user['mobile'] = substr_replace($user['mobile'],'*****',3,5); | 1795 | $user['mobile'] = substr_replace($user['mobile'],'*****',3,5); |
942 | } | 1796 | } |
943 | - $user->visible(['id','avatar','nickname','is_work','mobile','is_complete']); | 1797 | + $user->visible(['id','avatar','nickname','is_work','mobile','is_complete','factory']); |
944 | $this->success('成功',compact('user','list')); | 1798 | $this->success('成功',compact('user','list')); |
945 | } | 1799 | } |
946 | 1800 | ||
@@ -967,4 +1821,42 @@ class User extends Api | @@ -967,4 +1821,42 @@ class User extends Api | ||
967 | } | 1821 | } |
968 | return $newarr; | 1822 | return $newarr; |
969 | } | 1823 | } |
1824 | + | ||
1825 | + /** | ||
1826 | + * @ApiTitle 劳务管理通知 | ||
1827 | + * @ApiReturn ({ | ||
1828 | + "code": 1, | ||
1829 | + "msg": "成功", | ||
1830 | + "time": "1620294367", | ||
1831 | + "data": { | ||
1832 | + "id": 680, //通知id | ||
1833 | + "content": "恭喜您入驻搜房帝平台!" //通知内容 | ||
1834 | + } | ||
1835 | + }) | ||
1836 | + */ | ||
1837 | + public function record(){ | ||
1838 | + $is_work = $this->auth->is_work; //是否在职:0=否,1=是 | ||
1839 | + if ($is_work == 0){ //未入职 | ||
1840 | + $where['status'] = '0'; | ||
1841 | + $where['deletetime']=null; | ||
1842 | + $inform= new Inform; | ||
1843 | + $reclist = $inform | ||
1844 | + ->where($where) | ||
1845 | + ->order('id desc') | ||
1846 | + ->field('id,content') | ||
1847 | + ->find(); | ||
1848 | + } | ||
1849 | + if ($is_work == 1){ | ||
1850 | + $factory_id = $this->auth->factory_id; //工厂id//已入职 | ||
1851 | + $where['factory_id']=$factory_id; | ||
1852 | + $inform= new Inform; | ||
1853 | + $reclist = $inform | ||
1854 | + ->where($where) | ||
1855 | + ->order('id desc') | ||
1856 | + ->field('id,content') | ||
1857 | + ->find(); | ||
1858 | + } | ||
1859 | + $this->success('成功',$reclist); | ||
1860 | + } | ||
1861 | + | ||
970 | } | 1862 | } |
@@ -15,8 +15,20 @@ class Token extends Api | @@ -15,8 +15,20 @@ class Token extends Api | ||
15 | protected $noNeedRight = '*'; | 15 | protected $noNeedRight = '*'; |
16 | 16 | ||
17 | /** | 17 | /** |
18 | - * 检测Token是否过期 | ||
19 | - * | 18 | + * @ApiWeigh (99) |
19 | + * @ApiTitle (检测Token是否过期) | ||
20 | + * @ApiSummary (检测Token是否过期) | ||
21 | + * @ApiMethod (GET) | ||
22 | + * @ApiHeaders (name="token", type="string", required=true, description="请求的Token") | ||
23 | + * @ApiReturn({ | ||
24 | + "code": 1, | ||
25 | + "msg": "", | ||
26 | + "time": "1621402970", | ||
27 | + "data": { | ||
28 | + "token": "545eed64-39c4-437e-8285-ac94c03e4921", //token | ||
29 | + "expires_in": 2591951 //剩余有效时间 | ||
30 | + } | ||
31 | + }) | ||
20 | */ | 32 | */ |
21 | public function check() | 33 | public function check() |
22 | { | 34 | { |
@@ -26,8 +38,20 @@ class Token extends Api | @@ -26,8 +38,20 @@ class Token extends Api | ||
26 | } | 38 | } |
27 | 39 | ||
28 | /** | 40 | /** |
29 | - * 刷新Token | ||
30 | - * | 41 | + * @ApiWeigh (97) |
42 | + * @ApiTitle (刷新Token) | ||
43 | + * @ApiSummary (刷新Token) | ||
44 | + * @ApiMethod (GET) | ||
45 | + * @ApiHeaders (name="token", type="string", required=true, description="请求的Token") | ||
46 | + * @ApiReturn({ | ||
47 | + "code": 1, | ||
48 | + "msg": "", | ||
49 | + "time": "1621403556", | ||
50 | + "data": { | ||
51 | + "token": "175c6d84-42af-4c59-bce0-ad8a66eb5f3f", //token | ||
52 | + "expires_in": 2592000 //剩余有效时间 | ||
53 | + } | ||
54 | + }) | ||
31 | */ | 55 | */ |
32 | public function refresh() | 56 | public function refresh() |
33 | { | 57 | { |
@@ -12,12 +12,28 @@ class Job extends Model | @@ -12,12 +12,28 @@ class Job extends Model | ||
12 | // 定义时间戳字段名 | 12 | // 定义时间戳字段名 |
13 | protected $createTime = 'createtime'; | 13 | protected $createTime = 'createtime'; |
14 | protected $updateTime = 'updatetime'; | 14 | protected $updateTime = 'updatetime'; |
15 | + protected $append = [ | ||
16 | + 'label_name', | ||
17 | + ]; | ||
15 | 18 | ||
16 | // 格式化封面图 | 19 | // 格式化封面图 |
17 | public function getCoverAttr($value){ | 20 | public function getCoverAttr($value){ |
18 | return empty($value) ? '' : cdnurl($value,true); | 21 | return empty($value) ? '' : cdnurl($value,true); |
19 | } | 22 | } |
20 | 23 | ||
24 | + //标签 | ||
25 | + public function getLabelNameAttr($value,$data){ | ||
26 | + if (empty($data['label_ids'])){ | ||
27 | + return []; | ||
28 | + } | ||
29 | + $project_ids = explode(",", $data['label_ids']); | ||
30 | + $project = []; | ||
31 | + foreach ($project_ids as $j){ | ||
32 | + $project[]= model('\app\common\model\Label')->where(['id'=>$j])->value('title'); | ||
33 | + } | ||
34 | + return $project; | ||
35 | + } | ||
36 | + | ||
21 | // 格式化图片 | 37 | // 格式化图片 |
22 | public function getImagesAttr($value,$data){ | 38 | public function getImagesAttr($value,$data){ |
23 | $arr = []; | 39 | $arr = []; |
@@ -82,7 +82,7 @@ if (!function_exists('cdnurl')) { | @@ -82,7 +82,7 @@ if (!function_exists('cdnurl')) { | ||
82 | * @param boolean $domain 是否显示域名 或者直接传入域名 | 82 | * @param boolean $domain 是否显示域名 或者直接传入域名 |
83 | * @return string | 83 | * @return string |
84 | */ | 84 | */ |
85 | - function cdnurl($url, $domain = false) | 85 | + function cdnurl($url, $domain = true) |
86 | { | 86 | { |
87 | $regex = "/^((?:[a-z]+:)?\/\/|data:image\/)(.*)/i"; | 87 | $regex = "/^((?:[a-z]+:)?\/\/|data:image\/)(.*)/i"; |
88 | $url = preg_match($regex, $url) ? $url : \think\Config::get('upload.cdnurl') . $url; | 88 | $url = preg_match($regex, $url) ? $url : \think\Config::get('upload.cdnurl') . $url; |
@@ -26,7 +26,7 @@ class Auth | @@ -26,7 +26,7 @@ class Auth | ||
26 | //默认配置 | 26 | //默认配置 |
27 | protected $config = []; | 27 | protected $config = []; |
28 | protected $options = []; | 28 | protected $options = []; |
29 | - protected $allowFields = ['id', 'username', 'nickname', 'mobile', 'avatar', 'score']; | 29 | + protected $allowFields = ['id', 'username', 'nickname', 'mobile', 'avatar', 'score','is_work','factory_id']; |
30 | 30 | ||
31 | public function __construct($options = []) | 31 | public function __construct($options = []) |
32 | { | 32 | { |
@@ -28,9 +28,12 @@ return [ | @@ -28,9 +28,12 @@ return [ | ||
28 | 'mail_smtp_pass' => 'password', | 28 | 'mail_smtp_pass' => 'password', |
29 | 'mail_verify_type' => '2', | 29 | 'mail_verify_type' => '2', |
30 | 'mail_from' => '10000@qq.com', | 30 | 'mail_from' => '10000@qq.com', |
31 | - 'recruit_subsidy_content' => '<p>由于网络招聘由工厂直招直接对接求职者省去中间环节,取代中间劳务费用,把利润补贴给求职者,达到双赢效果。</p><p><img src="http://recruit.t.brotop.cn//uploads/20201218/a17a7a8cb9aa711d05c8b6c185240d08.jpg" data-filename="filename" style="width: 665px;"><br></p><p><br></p>', | 31 | + 'recruit_subsidy_content' => '<p>由于网络招聘由工厂直招直接对接求职者省去中间环节,取代中间劳务费用,把利润补贴给求职者,达到双赢效果。</p><p><img src="http://recruit.t.brotop.cn//uploads/20201218/a17a7a8cb9aa711d05c8b6c185240d08.jpg" style="width: 665px;"/><br/></p><p><br/></p>', |
32 | 'recruit_subsidy' => '1', | 32 | 'recruit_subsidy' => '1', |
33 | - 'work_subsidy_content' => '<div>由本平台小程序入职员工,可获得平台工时补贴,</div><div>补贴给求职者本人1-3元/时,</div><div>工资比其他人多300-1000元/月。</div><div><img src="http://recruit.t.brotop.cn//uploads/20201218/2b24ef40e14b31003e8f6a8fca6bdc49.jpg" data-filename="filename" style="width: 665px;"><br></div>', | ||
34 | - 'agent_content' => '<p><img src="http://recruit.t.brotop.cn//uploads/20201218/12936b5ad8e4a2b8861d154f8899338c.jpg" data-filename="filename" style="width: 665px;"><br></p>', | ||
35 | - 'notice' => '巴山楚水凄凉地,responsibility', | 33 | + 'work_subsidy_content' => '<div>由本平台小程序入职员工,可获得平台工时补贴,</div><div>补贴给求职者本人1-3元/时,</div><div>工资比其他人多300-1000元/月。</div><div><img src="http://recruit.t.brotop.cn//uploads/20201218/2b24ef40e14b31003e8f6a8fca6bdc49.jpg" style="width: 665px;"/><br/></div>', |
34 | + 'agent_content' => '', | ||
35 | + 'notice' => '工时每满300个小时,平台补贴300元', | ||
36 | + 'link' => 'https://mp.weixin.qq.com/s?__biz=MzkwNTIzOTMyMA==&mid=100000003&idx=1&sn=2c2f7a3d14016a5cab1bc926f9827789&chksm=40fb8f74778c06625363df68550c8a6e3b7b77c3a37a9acb0d45ca67473d1b3bfbe019946fe7&mpshare=1&scene=1&srcid=0517B23dia4DeM9arotlNkYL&sharer_sharetime=1621246415044&sharer_shareid=0222b3ff489427a506473cee3e8233b9#rd', | ||
37 | + 'guanzhu' => '关注公众号', | ||
38 | + 'guan' => '关注公众号', | ||
36 | ]; | 39 | ]; |
此 diff 太大无法显示。
1 | -@font-face{font-family:"summernote";font-style:normal;font-weight:normal;src:url("../font/summernote.eot?dbafe969167589eda84514394d126413");src:url("../font/summernote.eot?#iefix") format("embedded-opentype"),url("../font/summernote.woff?dbafe969167589eda84514394d126413") format("woff"),url("../font/summernote.ttf?dbafe969167589eda84514394d126413") format("truetype")}[class^="note-icon-"]:before,[class*=" note-icon-"]:before{display:inline-block;font:normal normal normal 14px summernote;font-size:inherit;-webkit-font-smoothing:antialiased;text-decoration:inherit;text-rendering:auto;text-transform:none;vertical-align:middle;speak:none;-moz-osx-font-smoothing:grayscale}.note-icon-align-center:before,.note-icon-align-indent:before,.note-icon-align-justify:before,.note-icon-align-left:before,.note-icon-align-outdent:before,.note-icon-align-right:before,.note-icon-align:before,.note-icon-arrow-circle-down:before,.note-icon-arrow-circle-left:before,.note-icon-arrow-circle-right:before,.note-icon-arrow-circle-up:before,.note-icon-arrows-alt:before,.note-icon-arrows-h:before,.note-icon-arrows-v:before,.note-icon-bold:before,.note-icon-caret:before,.note-icon-chain-broken:before,.note-icon-circle:before,.note-icon-close:before,.note-icon-code:before,.note-icon-col-after:before,.note-icon-col-before:before,.note-icon-col-remove:before,.note-icon-eraser:before,.note-icon-font:before,.note-icon-frame:before,.note-icon-italic:before,.note-icon-link:before,.note-icon-magic:before,.note-icon-menu-check:before,.note-icon-minus:before,.note-icon-orderedlist:before,.note-icon-pencil:before,.note-icon-picture:before,.note-icon-question:before,.note-icon-redo:before,.note-icon-row-above:before,.note-icon-row-below:before,.note-icon-row-remove:before,.note-icon-special-character:before,.note-icon-square:before,.note-icon-strikethrough:before,.note-icon-subscript:before,.note-icon-summernote:before,.note-icon-superscript:before,.note-icon-table:before,.note-icon-text-height:before,.note-icon-trash:before,.note-icon-underline:before,.note-icon-undo:before,.note-icon-unorderedlist:before,.note-icon-video:before{display:inline-block;font-family:"summernote";font-style:normal;font-weight:normal;text-decoration:inherit}.note-icon-align-center:before{content:"\f101"}.note-icon-align-indent:before{content:"\f102"}.note-icon-align-justify:before{content:"\f103"}.note-icon-align-left:before{content:"\f104"}.note-icon-align-outdent:before{content:"\f105"}.note-icon-align-right:before{content:"\f106"}.note-icon-align:before{content:"\f107"}.note-icon-arrow-circle-down:before{content:"\f108"}.note-icon-arrow-circle-left:before{content:"\f109"}.note-icon-arrow-circle-right:before{content:"\f10a"}.note-icon-arrow-circle-up:before{content:"\f10b"}.note-icon-arrows-alt:before{content:"\f10c"}.note-icon-arrows-h:before{content:"\f10d"}.note-icon-arrows-v:before{content:"\f10e"}.note-icon-bold:before{content:"\f10f"}.note-icon-caret:before{content:"\f110"}.note-icon-chain-broken:before{content:"\f111"}.note-icon-circle:before{content:"\f112"}.note-icon-close:before{content:"\f113"}.note-icon-code:before{content:"\f114"}.note-icon-col-after:before{content:"\f115"}.note-icon-col-before:before{content:"\f116"}.note-icon-col-remove:before{content:"\f117"}.note-icon-eraser:before{content:"\f118"}.note-icon-font:before{content:"\f119"}.note-icon-frame:before{content:"\f11a"}.note-icon-italic:before{content:"\f11b"}.note-icon-link:before{content:"\f11c"}.note-icon-magic:before{content:"\f11d"}.note-icon-menu-check:before{content:"\f11e"}.note-icon-minus:before{content:"\f11f"}.note-icon-orderedlist:before{content:"\f120"}.note-icon-pencil:before{content:"\f121"}.note-icon-picture:before{content:"\f122"}.note-icon-question:before{content:"\f123"}.note-icon-redo:before{content:"\f124"}.note-icon-row-above:before{content:"\f125"}.note-icon-row-below:before{content:"\f126"}.note-icon-row-remove:before{content:"\f127"}.note-icon-special-character:before{content:"\f128"}.note-icon-square:before{content:"\f129"}.note-icon-strikethrough:before{content:"\f12a"}.note-icon-subscript:before{content:"\f12b"}.note-icon-summernote:before{content:"\f12c"}.note-icon-superscript:before{content:"\f12d"}.note-icon-table:before{content:"\f12e"}.note-icon-text-height:before{content:"\f12f"}.note-icon-trash:before{content:"\f130"}.note-icon-underline:before{content:"\f131"}.note-icon-undo:before{content:"\f132"}.note-icon-unorderedlist:before{content:"\f133"}.note-icon-video:before{content:"\f134"}.note-editor{position:relative}.note-editor .note-dropzone{position:absolute;z-index:100;display:none;color:#87cefa;background-color:#fff;opacity:.95}.note-editor .note-dropzone .note-dropzone-message{display:table-cell;font-size:28px;font-weight:700;text-align:center;vertical-align:middle}.note-editor .note-dropzone.hover{color:#098ddf}.note-editor.dragover .note-dropzone{display:table}.note-editor .note-editing-area{position:relative}.note-editor .note-editing-area .note-editable{outline:0}.note-editor .note-editing-area .note-editable sup{vertical-align:super}.note-editor .note-editing-area .note-editable sub{vertical-align:sub}.note-editor .note-editing-area img.note-float-left{margin-right:10px}.note-editor .note-editing-area img.note-float-right{margin-left:10px}.note-editor.note-frame{border:1px solid #a9a9a9}.note-editor.note-frame.codeview .note-editing-area .note-editable{display:none}.note-editor.note-frame.codeview .note-editing-area .note-codable{display:block}.note-editor.note-frame .note-editing-area{overflow:hidden}.note-editor.note-frame .note-editing-area .note-editable{padding:10px;overflow:auto;color:#000;word-wrap:break-word;background-color:#fff}.note-editor.note-frame .note-editing-area .note-editable[contenteditable="false"]{background-color:#e5e5e5}.note-editor.note-frame .note-editing-area .note-codable{display:none;width:100%;padding:10px;margin-bottom:0;font-family:Menlo,Monaco,monospace,sans-serif;font-size:14px;color:#ccc;background-color:#222;border:0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;box-shadow:none;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box;resize:none}.note-editor.note-frame.fullscreen{position:fixed;top:0;left:0;z-index:1050;width:100%!important}.note-editor.note-frame.fullscreen .note-editable{background-color:#fff}.note-editor.note-frame.fullscreen .note-resizebar{display:none}.note-editor.note-frame .note-status-output{display:block;width:100%;height:20px;margin-bottom:0;font-size:14px;line-height:1.42857143;color:#000;border:0;border-top:1px solid #e2e2e2}.note-editor.note-frame .note-status-output:empty{height:0;border-top:0 solid transparent}.note-editor.note-frame .note-status-output .pull-right{float:right!important}.note-editor.note-frame .note-status-output .text-muted{color:#777}.note-editor.note-frame .note-status-output .text-primary{color:#286090}.note-editor.note-frame .note-status-output .text-success{color:#3c763d}.note-editor.note-frame .note-status-output .text-info{color:#31708f}.note-editor.note-frame .note-status-output .text-warning{color:#8a6d3b}.note-editor.note-frame .note-status-output .text-danger{color:#a94442}.note-editor.note-frame .note-status-output .alert{padding:7px 10px 2px 10px;margin:-7px 0 0 0;color:#000;background-color:#f5f5f5;border-radius:0}.note-editor.note-frame .note-status-output .alert .note-icon{margin-right:5px}.note-editor.note-frame .note-status-output .alert-success{color:#3c763d!important;background-color:#dff0d8!important}.note-editor.note-frame .note-status-output .alert-info{color:#31708f!important;background-color:#d9edf7!important}.note-editor.note-frame .note-status-output .alert-warning{color:#8a6d3b!important;background-color:#fcf8e3!important}.note-editor.note-frame .note-status-output .alert-danger{color:#a94442!important;background-color:#f2dede!important}.note-editor.note-frame .note-statusbar{background-color:#f5f5f5;border-top:1px solid #ddd;border-bottom-right-radius:4px;border-bottom-left-radius:4px}.note-editor.note-frame .note-statusbar .note-resizebar{width:100%;height:9px;padding-top:1px;cursor:ns-resize}.note-editor.note-frame .note-statusbar .note-resizebar .note-icon-bar{width:20px;margin:1px auto;border-top:1px solid #a9a9a9}.note-editor.note-frame .note-statusbar.locked .note-resizebar{cursor:default}.note-editor.note-frame .note-statusbar.locked .note-resizebar .note-icon-bar{display:none}.note-editor.note-frame .note-placeholder{padding:10px}.note-popover.popover{max-width:none}.note-popover.popover .popover-content a{display:inline-block;max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:middle}.note-popover.popover .arrow{left:20px!important}.note-toolbar{position:relative;z-index:99}.note-popover .popover-content,.panel-heading.note-toolbar{padding:0 0 5px 5px;margin:0}.note-popover .popover-content>.btn-group,.panel-heading.note-toolbar>.btn-group{margin-top:5px;margin-right:5px;margin-left:0}.note-popover .popover-content .btn-group .note-table,.panel-heading.note-toolbar .btn-group .note-table{min-width:0;padding:5px}.note-popover .popover-content .btn-group .note-table .note-dimension-picker,.panel-heading.note-toolbar .btn-group .note-table .note-dimension-picker{font-size:18px}.note-popover .popover-content .btn-group .note-table .note-dimension-picker .note-dimension-picker-mousecatcher,.panel-heading.note-toolbar .btn-group .note-table .note-dimension-picker .note-dimension-picker-mousecatcher{position:absolute!important;z-index:3;width:10em;height:10em;cursor:pointer}.note-popover .popover-content .btn-group .note-table .note-dimension-picker .note-dimension-picker-unhighlighted,.panel-heading.note-toolbar .btn-group .note-table .note-dimension-picker .note-dimension-picker-unhighlighted{position:relative!important;z-index:1;width:5em;height:5em;background:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASAgMAAAAroGbEAAAACVBMVEUAAIj4+Pjp6ekKlAqjAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfYAR0BKhmnaJzPAAAAG0lEQVQI12NgAAOtVatWMTCohoaGUY+EmIkEAEruEzK2J7tvAAAAAElFTkSuQmCC') repeat}.note-popover .popover-content .btn-group .note-table .note-dimension-picker .note-dimension-picker-highlighted,.panel-heading.note-toolbar .btn-group .note-table .note-dimension-picker .note-dimension-picker-highlighted{position:absolute!important;z-index:2;width:1em;height:1em;background:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASAgMAAAAroGbEAAAACVBMVEUAAIjd6vvD2f9LKLW+AAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfYAR0BKwNDEVT0AAAAG0lEQVQI12NgAAOtVatWMTCohoaGUY+EmIkEAEruEzK2J7tvAAAAAElFTkSuQmCC') repeat}.note-popover .popover-content .note-style .dropdown-style blockquote,.panel-heading.note-toolbar .note-style .dropdown-style blockquote,.note-popover .popover-content .note-style .dropdown-style pre,.panel-heading.note-toolbar .note-style .dropdown-style pre{padding:5px 10px;margin:0}.note-popover .popover-content .note-style .dropdown-style h1,.panel-heading.note-toolbar .note-style .dropdown-style h1,.note-popover .popover-content .note-style .dropdown-style h2,.panel-heading.note-toolbar .note-style .dropdown-style h2,.note-popover .popover-content .note-style .dropdown-style h3,.panel-heading.note-toolbar .note-style .dropdown-style h3,.note-popover .popover-content .note-style .dropdown-style h4,.panel-heading.note-toolbar .note-style .dropdown-style h4,.note-popover .popover-content .note-style .dropdown-style h5,.panel-heading.note-toolbar .note-style .dropdown-style h5,.note-popover .popover-content .note-style .dropdown-style h6,.panel-heading.note-toolbar .note-style .dropdown-style h6,.note-popover .popover-content .note-style .dropdown-style p,.panel-heading.note-toolbar .note-style .dropdown-style p{padding:0;margin:0}.note-popover .popover-content .note-color .dropdown-toggle,.panel-heading.note-toolbar .note-color .dropdown-toggle{width:20px;padding-left:5px}.note-popover .popover-content .note-color .dropdown-menu,.panel-heading.note-toolbar .note-color .dropdown-menu{min-width:337px}.note-popover .popover-content .note-color .dropdown-menu .note-palette,.panel-heading.note-toolbar .note-color .dropdown-menu .note-palette{display:inline-block;width:160px;margin:0}.note-popover .popover-content .note-color .dropdown-menu .note-palette:first-child,.panel-heading.note-toolbar .note-color .dropdown-menu .note-palette:first-child{margin:0 5px}.note-popover .popover-content .note-color .dropdown-menu .note-palette .note-palette-title,.panel-heading.note-toolbar .note-color .dropdown-menu .note-palette .note-palette-title{margin:2px 7px;font-size:12px;text-align:center;border-bottom:1px solid #eee}.note-popover .popover-content .note-color .dropdown-menu .note-palette .note-color-reset,.panel-heading.note-toolbar .note-color .dropdown-menu .note-palette .note-color-reset{width:100%;padding:0 3px;margin:3px;font-size:11px;cursor:pointer;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.note-popover .popover-content .note-color .dropdown-menu .note-palette .note-color-row,.panel-heading.note-toolbar .note-color .dropdown-menu .note-palette .note-color-row{height:20px}.note-popover .popover-content .note-color .dropdown-menu .note-palette .note-color-reset:hover,.panel-heading.note-toolbar .note-color .dropdown-menu .note-palette .note-color-reset:hover{background:#eee}.note-popover .popover-content .note-para .dropdown-menu,.panel-heading.note-toolbar .note-para .dropdown-menu{min-width:216px;padding:5px}.note-popover .popover-content .note-para .dropdown-menu>div:first-child,.panel-heading.note-toolbar .note-para .dropdown-menu>div:first-child{margin-right:5px}.note-popover .popover-content .dropdown-menu,.panel-heading.note-toolbar .dropdown-menu{min-width:90px}.note-popover .popover-content .dropdown-menu.right,.panel-heading.note-toolbar .dropdown-menu.right{right:0;left:auto}.note-popover .popover-content .dropdown-menu.right::before,.panel-heading.note-toolbar .dropdown-menu.right::before{right:9px;left:auto!important}.note-popover .popover-content .dropdown-menu.right::after,.panel-heading.note-toolbar .dropdown-menu.right::after{right:10px;left:auto!important}.note-popover .popover-content .dropdown-menu.note-check li a i,.panel-heading.note-toolbar .dropdown-menu.note-check li a i{color:deepskyblue;visibility:hidden}.note-popover .popover-content .dropdown-menu.note-check li a.checked i,.panel-heading.note-toolbar .dropdown-menu.note-check li a.checked i{visibility:visible}.note-popover .popover-content .note-fontsize-10,.panel-heading.note-toolbar .note-fontsize-10{font-size:10px}.note-popover .popover-content .note-color-palette,.panel-heading.note-toolbar .note-color-palette{line-height:1}.note-popover .popover-content .note-color-palette div .note-color-btn,.panel-heading.note-toolbar .note-color-palette div .note-color-btn{width:20px;height:20px;padding:0;margin:0;border:1px solid #fff}.note-popover .popover-content .note-color-palette div .note-color-btn:hover,.panel-heading.note-toolbar .note-color-palette div .note-color-btn:hover{border:1px solid #000}.note-dialog>div{display:none}.note-dialog .form-group{margin-right:0;margin-left:0}.note-dialog .note-modal-form{margin:0}.note-dialog .note-image-dialog .note-dropzone{min-height:100px;margin-bottom:10px;font-size:30px;line-height:4;color:lightgray;text-align:center;border:4px dashed lightgray}@-moz-document url-prefix(){.note-image-input{height:auto}}.note-placeholder{position:absolute;display:none;color:gray}.note-handle .note-control-selection{position:absolute;display:none;border:1px solid #000}.note-handle .note-control-selection>div{position:absolute}.note-handle .note-control-selection .note-control-selection-bg{width:100%;height:100%;background-color:#000;-webkit-opacity:.3;-khtml-opacity:.3;-moz-opacity:.3;opacity:.3;-ms-filter:alpha(opacity=30);filter:alpha(opacity=30)}.note-handle .note-control-selection .note-control-handle{width:7px;height:7px;border:1px solid #000}.note-handle .note-control-selection .note-control-holder{width:7px;height:7px;border:1px solid #000}.note-handle .note-control-selection .note-control-sizing{width:7px;height:7px;background-color:#fff;border:1px solid #000}.note-handle .note-control-selection .note-control-nw{top:-5px;left:-5px;border-right:0;border-bottom:0}.note-handle .note-control-selection .note-control-ne{top:-5px;right:-5px;border-bottom:0;border-left:none}.note-handle .note-control-selection .note-control-sw{bottom:-5px;left:-5px;border-top:0;border-right:0}.note-handle .note-control-selection .note-control-se{right:-5px;bottom:-5px;cursor:se-resize}.note-handle .note-control-selection .note-control-se.note-control-holder{cursor:default;border-top:0;border-left:none}.note-handle .note-control-selection .note-control-selection-info{right:0;bottom:0;padding:5px;margin:5px;font-size:12px;color:#fff;background-color:#000;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;-webkit-opacity:.7;-khtml-opacity:.7;-moz-opacity:.7;opacity:.7;-ms-filter:alpha(opacity=70);filter:alpha(opacity=70)}.note-hint-popover{min-width:100px;padding:2px}.note-hint-popover .popover-content{max-height:150px;padding:3px;overflow:auto}.note-hint-popover .popover-content .note-hint-group .note-hint-item{display:block!important;padding:3px}.note-hint-popover .popover-content .note-hint-group .note-hint-item.active,.note-hint-popover .popover-content .note-hint-group .note-hint-item:hover{display:block;clear:both;font-weight:400;line-height:1.4;color:#fff;text-decoration:none;white-space:nowrap;cursor:pointer;background-color:#428bca;outline:0} |
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
此 diff 太大无法显示。
此 diff 太大无法显示。
1 | -(function($) { | ||
2 | - $.extend($.summernote.lang, { | ||
3 | - 'zh-CN': { | ||
4 | - font: { | ||
5 | - bold: '粗体', | ||
6 | - italic: '斜体', | ||
7 | - underline: '下划线', | ||
8 | - clear: '清除格式', | ||
9 | - height: '行高', | ||
10 | - name: '字体', | ||
11 | - strikethrough: '删除线', | ||
12 | - subscript: '下标', | ||
13 | - superscript: '上标', | ||
14 | - size: '字号' | ||
15 | - }, | ||
16 | - image: { | ||
17 | - image: '图片', | ||
18 | - insert: '插入图片', | ||
19 | - resizeFull: '缩放至 100%', | ||
20 | - resizeHalf: '缩放至 50%', | ||
21 | - resizeQuarter: '缩放至 25%', | ||
22 | - floatLeft: '靠左浮动', | ||
23 | - floatRight: '靠右浮动', | ||
24 | - floatNone: '取消浮动', | ||
25 | - shapeRounded: '形状: 圆角', | ||
26 | - shapeCircle: '形状: 圆', | ||
27 | - shapeThumbnail: '形状: 缩略图', | ||
28 | - shapeNone: '形状: 无', | ||
29 | - dragImageHere: '将图片拖拽至此处', | ||
30 | - dropImage: 'Drop image or Text', | ||
31 | - selectFromFiles: '从本地上传', | ||
32 | - maximumFileSize: '文件大小最大值', | ||
33 | - maximumFileSizeError: '文件大小超出最大值。', | ||
34 | - url: '图片地址', | ||
35 | - remove: '移除图片', | ||
36 | - original: 'Original' | ||
37 | - }, | ||
38 | - video: { | ||
39 | - video: '视频', | ||
40 | - videoLink: '视频链接', | ||
41 | - insert: '插入视频', | ||
42 | - url: '视频地址', | ||
43 | - providers: '(优酷, 腾讯, Instagram, DailyMotion, Youtube等)' | ||
44 | - }, | ||
45 | - link: { | ||
46 | - link: '链接', | ||
47 | - insert: '插入链接', | ||
48 | - unlink: '去除链接', | ||
49 | - edit: '编辑链接', | ||
50 | - textToDisplay: '显示文本', | ||
51 | - url: '链接地址', | ||
52 | - openInNewWindow: '在新窗口打开' | ||
53 | - }, | ||
54 | - table: { | ||
55 | - table: '表格', | ||
56 | - addRowAbove: 'Add row above', | ||
57 | - addRowBelow: 'Add row below', | ||
58 | - addColLeft: 'Add column left', | ||
59 | - addColRight: 'Add column right', | ||
60 | - delRow: 'Delete row', | ||
61 | - delCol: 'Delete column', | ||
62 | - delTable: 'Delete table' | ||
63 | - }, | ||
64 | - hr: { | ||
65 | - insert: '水平线' | ||
66 | - }, | ||
67 | - style: { | ||
68 | - style: '样式', | ||
69 | - p: '普通', | ||
70 | - blockquote: '引用', | ||
71 | - pre: '代码', | ||
72 | - h1: '标题 1', | ||
73 | - h2: '标题 2', | ||
74 | - h3: '标题 3', | ||
75 | - h4: '标题 4', | ||
76 | - h5: '标题 5', | ||
77 | - h6: '标题 6' | ||
78 | - }, | ||
79 | - lists: { | ||
80 | - unordered: '无序列表', | ||
81 | - ordered: '有序列表' | ||
82 | - }, | ||
83 | - options: { | ||
84 | - help: '帮助', | ||
85 | - fullscreen: '全屏', | ||
86 | - codeview: '源代码' | ||
87 | - }, | ||
88 | - paragraph: { | ||
89 | - paragraph: '段落', | ||
90 | - outdent: '减少缩进', | ||
91 | - indent: '增加缩进', | ||
92 | - left: '左对齐', | ||
93 | - center: '居中对齐', | ||
94 | - right: '右对齐', | ||
95 | - justify: '两端对齐' | ||
96 | - }, | ||
97 | - color: { | ||
98 | - recent: '最近使用', | ||
99 | - more: '更多', | ||
100 | - background: '背景', | ||
101 | - foreground: '前景', | ||
102 | - transparent: '透明', | ||
103 | - setTransparent: '透明', | ||
104 | - reset: '重置', | ||
105 | - resetToDefault: '默认' | ||
106 | - }, | ||
107 | - shortcut: { | ||
108 | - shortcuts: '快捷键', | ||
109 | - close: '关闭', | ||
110 | - textFormatting: '文本格式', | ||
111 | - action: '动作', | ||
112 | - paragraphFormatting: '段落格式', | ||
113 | - documentStyle: '文档样式', | ||
114 | - extraKeys: '额外按键' | ||
115 | - }, | ||
116 | - help: { | ||
117 | - insertParagraph: '插入段落', | ||
118 | - undo: '撤销', | ||
119 | - redo: '重做', | ||
120 | - tab: '增加缩进', | ||
121 | - untab: '减少缩进', | ||
122 | - bold: '粗体', | ||
123 | - italic: '斜体', | ||
124 | - underline: '下划线', | ||
125 | - strikethrough: '删除线', | ||
126 | - removeFormat: '清除格式', | ||
127 | - justifyLeft: '左对齐', | ||
128 | - justifyCenter: '居中对齐', | ||
129 | - justifyRight: '右对齐', | ||
130 | - justifyFull: '两端对齐', | ||
131 | - insertUnorderedList: '无序列表', | ||
132 | - insertOrderedList: '有序列表', | ||
133 | - outdent: '减少缩进', | ||
134 | - indent: '增加缩进', | ||
135 | - formatPara: '设置选中内容样式为 普通', | ||
136 | - formatH1: '设置选中内容样式为 标题1', | ||
137 | - formatH2: '设置选中内容样式为 标题2', | ||
138 | - formatH3: '设置选中内容样式为 标题3', | ||
139 | - formatH4: '设置选中内容样式为 标题4', | ||
140 | - formatH5: '设置选中内容样式为 标题5', | ||
141 | - formatH6: '设置选中内容样式为 标题6', | ||
142 | - insertHorizontalRule: '插入水平线', | ||
143 | - 'linkDialog.show': '显示链接对话框' | ||
144 | - }, | ||
145 | - history: { | ||
146 | - undo: '撤销', | ||
147 | - redo: '重做' | ||
148 | - }, | ||
149 | - specialChar: { | ||
150 | - specialChar: 'SPECIAL CHARACTERS', | ||
151 | - select: 'Select Special characters' | ||
152 | - } | ||
153 | - } | ||
154 | - }); | ||
155 | -})(jQuery); |
1 | -/*! Summernote v0.8.10 | (c) 2013- Alan Hong and other contributors | MIT license */ | ||
2 | - | ||
3 | -!function(e){e.extend(e.summernote.lang,{"zh-CN":{font:{bold:"粗体",italic:"斜体",underline:"下划线",clear:"清除格式",height:"行高",name:"字体",strikethrough:"删除线",subscript:"下标",superscript:"上标",size:"字号"},image:{image:"图片",insert:"插入图片",resizeFull:"缩放至 100%",resizeHalf:"缩放至 50%",resizeQuarter:"缩放至 25%",floatLeft:"靠左浮动",floatRight:"靠右浮动",floatNone:"取消浮动",shapeRounded:"形状: 圆角",shapeCircle:"形状: 圆",shapeThumbnail:"形状: 缩略图",shapeNone:"形状: 无",dragImageHere:"将图片拖拽至此处",dropImage:"Drop image or Text",selectFromFiles:"从本地上传",maximumFileSize:"文件大小最大值",maximumFileSizeError:"文件大小超出最大值。",url:"图片地址",remove:"移除图片",original:"Original"},video:{video:"视频",videoLink:"视频链接",insert:"插入视频",url:"视频地址",providers:"(优酷, 腾讯, Instagram, DailyMotion, Youtube等)"},link:{link:"链接",insert:"插入链接",unlink:"去除链接",edit:"编辑链接",textToDisplay:"显示文本",url:"链接地址",openInNewWindow:"在新窗口打开"},table:{table:"表格",addRowAbove:"Add row above",addRowBelow:"Add row below",addColLeft:"Add column left",addColRight:"Add column right",delRow:"Delete row",delCol:"Delete column",delTable:"Delete table"},hr:{insert:"水平线"},style:{style:"样式",p:"普通",blockquote:"引用",pre:"代码",h1:"标题 1",h2:"标题 2",h3:"标题 3",h4:"标题 4",h5:"标题 5",h6:"标题 6"},lists:{unordered:"无序列表",ordered:"有序列表"},options:{help:"帮助",fullscreen:"全屏",codeview:"源代码"},paragraph:{paragraph:"段落",outdent:"减少缩进",indent:"增加缩进",left:"左对齐",center:"居中对齐",right:"右对齐",justify:"两端对齐"},color:{recent:"最近使用",more:"更多",background:"背景",foreground:"前景",transparent:"透明",setTransparent:"透明",reset:"重置",resetToDefault:"默认"},shortcut:{shortcuts:"快捷键",close:"关闭",textFormatting:"文本格式",action:"动作",paragraphFormatting:"段落格式",documentStyle:"文档样式",extraKeys:"额外按键"},help:{insertParagraph:"插入段落",undo:"撤销",redo:"重做",tab:"增加缩进",untab:"减少缩进",bold:"粗体",italic:"斜体",underline:"下划线",strikethrough:"删除线",removeFormat:"清除格式",justifyLeft:"左对齐",justifyCenter:"居中对齐",justifyRight:"右对齐",justifyFull:"两端对齐",insertUnorderedList:"无序列表",insertOrderedList:"有序列表",outdent:"减少缩进",indent:"增加缩进",formatPara:"设置选中内容样式为 普通",formatH1:"设置选中内容样式为 标题1",formatH2:"设置选中内容样式为 标题2",formatH3:"设置选中内容样式为 标题3",formatH4:"设置选中内容样式为 标题4",formatH5:"设置选中内容样式为 标题5",formatH6:"设置选中内容样式为 标题6",insertHorizontalRule:"插入水平线","linkDialog.show":"显示链接对话框"},history:{undo:"撤销",redo:"重做"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Select Special characters"}}})}(jQuery); |
1 | -(function($) { | ||
2 | - $.extend($.summernote.lang, { | ||
3 | - 'zh-TW': { | ||
4 | - font: { | ||
5 | - bold: '粗體', | ||
6 | - italic: '斜體', | ||
7 | - underline: '底線', | ||
8 | - clear: '清除格式', | ||
9 | - height: '行高', | ||
10 | - name: '字體', | ||
11 | - strikethrough: '刪除線', | ||
12 | - subscript: '下標', | ||
13 | - superscript: '上標', | ||
14 | - size: '字號' | ||
15 | - }, | ||
16 | - image: { | ||
17 | - image: '圖片', | ||
18 | - insert: '插入圖片', | ||
19 | - resizeFull: '縮放至100%', | ||
20 | - resizeHalf: '縮放至 50%', | ||
21 | - resizeQuarter: '縮放至 25%', | ||
22 | - floatLeft: '靠左浮動', | ||
23 | - floatRight: '靠右浮動', | ||
24 | - floatNone: '取消浮動', | ||
25 | - shapeRounded: '形狀: 圓角', | ||
26 | - shapeCircle: '形狀: 圓', | ||
27 | - shapeThumbnail: '形狀: 縮略圖', | ||
28 | - shapeNone: '形狀: 無', | ||
29 | - dragImageHere: '將圖片拖曳至此處', | ||
30 | - dropImage: 'Drop image or Text', | ||
31 | - selectFromFiles: '從本機上傳', | ||
32 | - maximumFileSize: '文件大小最大值', | ||
33 | - maximumFileSizeError: '文件大小超出最大值。', | ||
34 | - url: '圖片網址', | ||
35 | - remove: '移除圖片', | ||
36 | - original: 'Original' | ||
37 | - }, | ||
38 | - video: { | ||
39 | - video: '影片', | ||
40 | - videoLink: '影片連結', | ||
41 | - insert: '插入影片', | ||
42 | - url: '影片網址', | ||
43 | - providers: '(優酷, Instagram, DailyMotion, Youtube等)' | ||
44 | - }, | ||
45 | - link: { | ||
46 | - link: '連結', | ||
47 | - insert: '插入連結', | ||
48 | - unlink: '取消連結', | ||
49 | - edit: '編輯連結', | ||
50 | - textToDisplay: '顯示文字', | ||
51 | - url: '連結網址', | ||
52 | - openInNewWindow: '在新視窗開啟' | ||
53 | - }, | ||
54 | - table: { | ||
55 | - table: '表格', | ||
56 | - addRowAbove: 'Add row above', | ||
57 | - addRowBelow: 'Add row below', | ||
58 | - addColLeft: 'Add column left', | ||
59 | - addColRight: 'Add column right', | ||
60 | - delRow: 'Delete row', | ||
61 | - delCol: 'Delete column', | ||
62 | - delTable: 'Delete table' | ||
63 | - }, | ||
64 | - hr: { | ||
65 | - insert: '水平線' | ||
66 | - }, | ||
67 | - style: { | ||
68 | - style: '樣式', | ||
69 | - p: '一般', | ||
70 | - blockquote: '引用區塊', | ||
71 | - pre: '程式碼區塊', | ||
72 | - h1: '標題 1', | ||
73 | - h2: '標題 2', | ||
74 | - h3: '標題 3', | ||
75 | - h4: '標題 4', | ||
76 | - h5: '標題 5', | ||
77 | - h6: '標題 6' | ||
78 | - }, | ||
79 | - lists: { | ||
80 | - unordered: '項目清單', | ||
81 | - ordered: '編號清單' | ||
82 | - }, | ||
83 | - options: { | ||
84 | - help: '幫助', | ||
85 | - fullscreen: '全螢幕', | ||
86 | - codeview: '原始碼' | ||
87 | - }, | ||
88 | - paragraph: { | ||
89 | - paragraph: '段落', | ||
90 | - outdent: '取消縮排', | ||
91 | - indent: '增加縮排', | ||
92 | - left: '靠右對齊', | ||
93 | - center: '靠中對齊', | ||
94 | - right: '靠右對齊', | ||
95 | - justify: '左右對齊' | ||
96 | - }, | ||
97 | - color: { | ||
98 | - recent: '字型顏色', | ||
99 | - more: '更多', | ||
100 | - background: '背景', | ||
101 | - foreground: '前景', | ||
102 | - transparent: '透明', | ||
103 | - setTransparent: '透明', | ||
104 | - reset: '重設', | ||
105 | - resetToDefault: '默認' | ||
106 | - }, | ||
107 | - shortcut: { | ||
108 | - shortcuts: '快捷鍵', | ||
109 | - close: '關閉', | ||
110 | - textFormatting: '文字格式', | ||
111 | - action: '動作', | ||
112 | - paragraphFormatting: '段落格式', | ||
113 | - documentStyle: '文件格式', | ||
114 | - extraKeys: '額外按鍵' | ||
115 | - }, | ||
116 | - help: { | ||
117 | - 'insertParagraph': 'Insert Paragraph', | ||
118 | - 'undo': 'Undoes the last command', | ||
119 | - 'redo': 'Redoes the last command', | ||
120 | - 'tab': 'Tab', | ||
121 | - 'untab': 'Untab', | ||
122 | - 'bold': 'Set a bold style', | ||
123 | - 'italic': 'Set a italic style', | ||
124 | - 'underline': 'Set a underline style', | ||
125 | - 'strikethrough': 'Set a strikethrough style', | ||
126 | - 'removeFormat': 'Clean a style', | ||
127 | - 'justifyLeft': 'Set left align', | ||
128 | - 'justifyCenter': 'Set center align', | ||
129 | - 'justifyRight': 'Set right align', | ||
130 | - 'justifyFull': 'Set full align', | ||
131 | - 'insertUnorderedList': 'Toggle unordered list', | ||
132 | - 'insertOrderedList': 'Toggle ordered list', | ||
133 | - 'outdent': 'Outdent on current paragraph', | ||
134 | - 'indent': 'Indent on current paragraph', | ||
135 | - 'formatPara': 'Change current block\'s format as a paragraph(P tag)', | ||
136 | - 'formatH1': 'Change current block\'s format as H1', | ||
137 | - 'formatH2': 'Change current block\'s format as H2', | ||
138 | - 'formatH3': 'Change current block\'s format as H3', | ||
139 | - 'formatH4': 'Change current block\'s format as H4', | ||
140 | - 'formatH5': 'Change current block\'s format as H5', | ||
141 | - 'formatH6': 'Change current block\'s format as H6', | ||
142 | - 'insertHorizontalRule': 'Insert horizontal rule', | ||
143 | - 'linkDialog.show': 'Show Link Dialog' | ||
144 | - }, | ||
145 | - history: { | ||
146 | - undo: '復原', | ||
147 | - redo: '取消復原' | ||
148 | - }, | ||
149 | - specialChar: { | ||
150 | - specialChar: 'SPECIAL CHARACTERS', | ||
151 | - select: 'Select Special characters' | ||
152 | - } | ||
153 | - } | ||
154 | - }); | ||
155 | -})(jQuery); |
1 | -/*! Summernote v0.8.10 | (c) 2013- Alan Hong and other contributors | MIT license */ | ||
2 | - | ||
3 | -!function(e){e.extend(e.summernote.lang,{"zh-TW":{font:{bold:"粗體",italic:"斜體",underline:"底線",clear:"清除格式",height:"行高",name:"字體",strikethrough:"刪除線",subscript:"下標",superscript:"上標",size:"字號"},image:{image:"圖片",insert:"插入圖片",resizeFull:"縮放至100%",resizeHalf:"縮放至 50%",resizeQuarter:"縮放至 25%",floatLeft:"靠左浮動",floatRight:"靠右浮動",floatNone:"取消浮動",shapeRounded:"形狀: 圓角",shapeCircle:"形狀: 圓",shapeThumbnail:"形狀: 縮略圖",shapeNone:"形狀: 無",dragImageHere:"將圖片拖曳至此處",dropImage:"Drop image or Text",selectFromFiles:"從本機上傳",maximumFileSize:"文件大小最大值",maximumFileSizeError:"文件大小超出最大值。",url:"圖片網址",remove:"移除圖片",original:"Original"},video:{video:"影片",videoLink:"影片連結",insert:"插入影片",url:"影片網址",providers:"(優酷, Instagram, DailyMotion, Youtube等)"},link:{link:"連結",insert:"插入連結",unlink:"取消連結",edit:"編輯連結",textToDisplay:"顯示文字",url:"連結網址",openInNewWindow:"在新視窗開啟"},table:{table:"表格",addRowAbove:"Add row above",addRowBelow:"Add row below",addColLeft:"Add column left",addColRight:"Add column right",delRow:"Delete row",delCol:"Delete column",delTable:"Delete table"},hr:{insert:"水平線"},style:{style:"樣式",p:"一般",blockquote:"引用區塊",pre:"程式碼區塊",h1:"標題 1",h2:"標題 2",h3:"標題 3",h4:"標題 4",h5:"標題 5",h6:"標題 6"},lists:{unordered:"項目清單",ordered:"編號清單"},options:{help:"幫助",fullscreen:"全螢幕",codeview:"原始碼"},paragraph:{paragraph:"段落",outdent:"取消縮排",indent:"增加縮排",left:"靠右對齊",center:"靠中對齊",right:"靠右對齊",justify:"左右對齊"},color:{recent:"字型顏色",more:"更多",background:"背景",foreground:"前景",transparent:"透明",setTransparent:"透明",reset:"重設",resetToDefault:"默認"},shortcut:{shortcuts:"快捷鍵",close:"關閉",textFormatting:"文字格式",action:"動作",paragraphFormatting:"段落格式",documentStyle:"文件格式",extraKeys:"額外按鍵"},help:{insertParagraph:"Insert Paragraph",undo:"Undoes the last command",redo:"Redoes the last command",tab:"Tab",untab:"Untab",bold:"Set a bold style",italic:"Set a italic style",underline:"Set a underline style",strikethrough:"Set a strikethrough style",removeFormat:"Clean a style",justifyLeft:"Set left align",justifyCenter:"Set center align",justifyRight:"Set right align",justifyFull:"Set full align",insertUnorderedList:"Toggle unordered list",insertOrderedList:"Toggle ordered list",outdent:"Outdent on current paragraph",indent:"Indent on current paragraph",formatPara:"Change current block's format as a paragraph(P tag)",formatH1:"Change current block's format as H1",formatH2:"Change current block's format as H2",formatH3:"Change current block's format as H3",formatH4:"Change current block's format as H4",formatH5:"Change current block's format as H5",formatH6:"Change current block's format as H6",insertHorizontalRule:"Insert horizontal rule","linkDialog.show":"Show Link Dialog"},history:{undo:"復原",redo:"取消復原"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Select Special characters"}}})}(jQuery); |
@@ -30,133 +30,619 @@ define([], function () { | @@ -30,133 +30,619 @@ define([], function () { | ||
30 | }); | 30 | }); |
31 | }); | 31 | }); |
32 | 32 | ||
33 | +if (Config.modulename === 'index' && Config.controllername === 'user' && ['login', 'register'].indexOf(Config.actionname) > -1 && $("#register-form,#login-form").size() > 0) { | ||
34 | + $('<style>.social-login{display:flex}.social-login a{flex:1;margin:0 2px;}.social-login a:first-child{margin-left:0;}.social-login a:last-child{margin-right:0;}</style>').appendTo("head"); | ||
35 | + $("#register-form,#login-form").append('<div class="form-group social-login"></div>'); | ||
36 | + if (Config.third.status.indexOf("wechat") > -1) { | ||
37 | + $('<a class="btn btn-success" href="' + Fast.api.fixurl('/third/connect/wechat') + '"><i class="fa fa-wechat"></i> 微信登录</a>').appendTo(".social-login"); | ||
38 | + } | ||
39 | + if (Config.third.status.indexOf("qq") > -1) { | ||
40 | + $('<a class="btn btn-info" href="' + Fast.api.fixurl('/third/connect/qq') + '"><i class="fa fa-qq"></i> QQ登录</a>').appendTo(".social-login"); | ||
41 | + } | ||
42 | + if (Config.third.status.indexOf("weibo") > -1) { | ||
43 | + $('<a class="btn btn-danger" href="' + Fast.api.fixurl('/third/connect/weibo') + '"><i class="fa fa-weibo"></i> 微博登录</a>').appendTo(".social-login"); | ||
44 | + } | ||
45 | +} | ||
46 | + | ||
47 | +window.UEDITOR_HOME_URL = Config.__CDN__ + "/assets/addons/ueditor/"; | ||
33 | require.config({ | 48 | require.config({ |
34 | paths: { | 49 | paths: { |
35 | - 'summernote': '../addons/summernote/lang/summernote-zh-CN.min' | 50 | + 'ueditor.config': '../addons/ueditor/ueditor.config', |
51 | + 'ueditor': '../addons/ueditor/ueditor.all.min', | ||
52 | + 'ueditor.zh': '../addons/ueditor/lang/zh-cn/zh-cn', | ||
53 | + 'zeroclipboard': '../addons/ueditor/third-party/zeroclipboard/ZeroClipboard.min', | ||
36 | }, | 54 | }, |
37 | shim: { | 55 | shim: { |
38 | - 'summernote': ['../addons/summernote/js/summernote.min', 'css!../addons/summernote/css/summernote.css'], | 56 | + 'ueditor': { |
57 | + deps: ['zeroclipboard', 'ueditor.config'], | ||
58 | + exports: 'UE', | ||
59 | + init: function (ZeroClipboard) { | ||
60 | + //导出到全局变量,供ueditor使用 | ||
61 | + window.ZeroClipboard = ZeroClipboard; | ||
62 | + }, | ||
63 | + }, | ||
64 | + 'ueditor.zh': ['ueditor'] | ||
39 | } | 65 | } |
40 | }); | 66 | }); |
41 | -require(['form', 'upload'], function (Form, Upload) { | ||
42 | - var _bindevent = Form.events.bindevent; | ||
43 | - Form.events.bindevent = function (form) { | ||
44 | - _bindevent.apply(this, [form]); | ||
45 | - try { | ||
46 | - //绑定summernote事件 | ||
47 | - if ($(".summernote,.editor", form).size() > 0) { | ||
48 | - require(['summernote'], function () { | ||
49 | - var imageButton = function (context) { | ||
50 | - var ui = $.summernote.ui; | ||
51 | - var button = ui.button({ | ||
52 | - contents: '<i class="fa fa-file-image-o"/>', | ||
53 | - tooltip: __('Choose'), | ||
54 | - click: function () { | ||
55 | - parent.Fast.api.open("general/attachment/select?element_id=&multiple=true&mimetype=image/*", __('Choose'), { | ||
56 | - callback: function (data) { | ||
57 | - var urlArr = data.url.split(/\,/); | ||
58 | - $.each(urlArr, function () { | ||
59 | - var url = Fast.api.cdnurl(this); | ||
60 | - context.invoke('editor.insertImage', url); | ||
61 | - }); | 67 | +require(['form', 'upload', 'ueditor', 'ueditor.zh'], function (Form, Upload, UE, undefined) { |
68 | + UE.plugin.register('simpleupload', function () { | ||
69 | + var me = this, | ||
70 | + isLoaded = false, | ||
71 | + containerBtn; | ||
72 | + | ||
73 | + function initUploadBtn() { | ||
74 | + var w = containerBtn.offsetWidth || 20, | ||
75 | + h = containerBtn.offsetHeight || 20, | ||
76 | + btnIframe = document.createElement('iframe'), | ||
77 | + btnStyle = 'display:block;width:' + w + 'px;height:' + h + 'px;overflow:hidden;border:0;margin:0;padding:0;position:absolute;top:0;left:0;filter:alpha(opacity=0);-moz-opacity:0;-khtml-opacity: 0;opacity: 0;cursor:pointer;'; | ||
78 | + | ||
79 | + UE.dom.domUtils.on(btnIframe, 'load', function () { | ||
80 | + | ||
81 | + var timestrap = (+new Date()).toString(36), | ||
82 | + wrapper, | ||
83 | + btnIframeDoc, | ||
84 | + btnIframeBody; | ||
85 | + | ||
86 | + btnIframeDoc = (btnIframe.contentDocument || btnIframe.contentWindow.document); | ||
87 | + btnIframeBody = btnIframeDoc.body; | ||
88 | + wrapper = btnIframeDoc.createElement('div'); | ||
89 | + | ||
90 | + wrapper.innerHTML = '<form id="edui_form_' + timestrap + '" target="edui_iframe_' + timestrap + '" method="POST" enctype="multipart/form-data" action="' + me.getOpt('serverUrl') + '" ' + | ||
91 | + 'style="' + btnStyle + '">' + | ||
92 | + '<input id="edui_input_' + timestrap + '" type="file" accept="image/*" name="' + me.options.imageFieldName + '" ' + | ||
93 | + 'style="' + btnStyle + '">' + | ||
94 | + '</form>' + | ||
95 | + '<iframe id="edui_iframe_' + timestrap + '" name="edui_iframe_' + timestrap + '" style="display:none;width:0;height:0;border:0;margin:0;padding:0;position:absolute;"></iframe>'; | ||
96 | + | ||
97 | + wrapper.className = 'edui-' + me.options.theme; | ||
98 | + wrapper.id = me.ui.id + '_iframeupload'; | ||
99 | + btnIframeBody.style.cssText = btnStyle; | ||
100 | + btnIframeBody.style.width = w + 'px'; | ||
101 | + btnIframeBody.style.height = h + 'px'; | ||
102 | + btnIframeBody.appendChild(wrapper); | ||
103 | + | ||
104 | + if (btnIframeBody.parentNode) { | ||
105 | + btnIframeBody.parentNode.style.width = w + 'px'; | ||
106 | + btnIframeBody.parentNode.style.height = w + 'px'; | ||
107 | + } | ||
108 | + | ||
109 | + var form = btnIframeDoc.getElementById('edui_form_' + timestrap); | ||
110 | + var input = btnIframeDoc.getElementById('edui_input_' + timestrap); | ||
111 | + var iframe = btnIframeDoc.getElementById('edui_iframe_' + timestrap); | ||
112 | + | ||
113 | + UE.dom.domUtils.on(input, 'change', function () { | ||
114 | + if (!input.value) return; | ||
115 | + var loadingId = 'loading_' + (+new Date()).toString(36); | ||
116 | + var params = UE.utils.serializeParam(me.queryCommandValue('serverparam')) || ''; | ||
117 | + | ||
118 | + var imageActionUrl = me.getActionUrl(me.getOpt('imageActionName')); | ||
119 | + var allowFiles = me.getOpt('imageAllowFiles'); | ||
120 | + | ||
121 | + me.focus(); | ||
122 | + me.execCommand('inserthtml', '<img class="loadingclass" id="' + loadingId + '" src="' + me.options.themePath + me.options.theme + '/images/spacer.gif" title="' + (me.getLang('simpleupload.loading') || '') + '" >'); | ||
123 | + | ||
124 | + function showErrorLoader(title) { | ||
125 | + if (loadingId) { | ||
126 | + var loader = me.document.getElementById(loadingId); | ||
127 | + loader && UE.dom.domUtils.remove(loader); | ||
128 | + me.fireEvent('showmessage', { | ||
129 | + 'id': loadingId, | ||
130 | + 'content': title, | ||
131 | + 'type': 'error', | ||
132 | + 'timeout': 4000 | ||
133 | + }); | ||
134 | + } | ||
135 | + } | ||
136 | + | ||
137 | + // 判断文件格式是否错误 | ||
138 | + var filename = input.value, | ||
139 | + fileext = filename ? filename.substr(filename.lastIndexOf('.')) : ''; | ||
140 | + if (!fileext || (allowFiles && (allowFiles.join('') + '.').indexOf(fileext.toLowerCase() + '.') == -1)) { | ||
141 | + showErrorLoader(me.getLang('simpleupload.exceedTypeError')); | ||
142 | + return; | ||
143 | + } | ||
144 | + for (var i = 0; i < this.files.length; i++) { | ||
145 | + Upload.api.send(this.files[i], function (data) { | ||
146 | + var url = Fast.api.cdnurl(data.url); | ||
147 | + loader = me.document.getElementById(loadingId); | ||
148 | + loader.setAttribute('src', url); | ||
149 | + loader.setAttribute('_src', url); | ||
150 | + loader.setAttribute('title', ''); | ||
151 | + loader.setAttribute('alt', ''); | ||
152 | + loader.removeAttribute('id'); | ||
153 | + UE.dom.domUtils.removeClasses(loader, 'loadingclass'); | ||
154 | + form.reset(); | ||
155 | + }); | ||
156 | + } | ||
157 | + }); | ||
158 | + | ||
159 | + var stateTimer; | ||
160 | + me.addListener('selectionchange', function () { | ||
161 | + clearTimeout(stateTimer); | ||
162 | + stateTimer = setTimeout(function () { | ||
163 | + var state = me.queryCommandState('simpleupload'); | ||
164 | + if (state == -1) { | ||
165 | + input.disabled = 'disabled'; | ||
166 | + } else { | ||
167 | + input.disabled = false; | ||
168 | + } | ||
169 | + }, 400); | ||
170 | + }); | ||
171 | + isLoaded = true; | ||
172 | + }); | ||
173 | + | ||
174 | + btnIframe.style.cssText = btnStyle; | ||
175 | + containerBtn.appendChild(btnIframe); | ||
176 | + } | ||
177 | + | ||
178 | + return { | ||
179 | + bindEvents: { | ||
180 | + 'ready': function () { | ||
181 | + //设置loading的样式 | ||
182 | + UE.utils.cssRule('loading', | ||
183 | + '.loadingclass{display:inline-block;cursor:default;background: url(\'' + | ||
184 | + this.options.themePath + | ||
185 | + this.options.theme + '/images/loading.gif\') no-repeat center center transparent;border:1px solid #cccccc;margin-right:1px;height: 22px;width: 22px;}\n' + | ||
186 | + '.loaderrorclass{display:inline-block;cursor:default;background: url(\'' + | ||
187 | + this.options.themePath + | ||
188 | + this.options.theme + '/images/loaderror.png\') no-repeat center center transparent;border:1px solid #cccccc;margin-right:1px;height: 22px;width: 22px;' + | ||
189 | + '}', | ||
190 | + this.document); | ||
191 | + }, | ||
192 | + /* 初始化简单上传按钮 */ | ||
193 | + 'simpleuploadbtnready': function (type, container) { | ||
194 | + containerBtn = container; | ||
195 | + me.afterConfigReady(initUploadBtn); | ||
196 | + } | ||
197 | + }, | ||
198 | + outputRule: function (root) { | ||
199 | + UE.utils.each(root.getNodesByTagName('img'), function (n) { | ||
200 | + if (/\b(loaderrorclass)|(bloaderrorclass)\b/.test(n.getAttr('class'))) { | ||
201 | + n.parentNode.removeChild(n); | ||
202 | + } | ||
203 | + }); | ||
204 | + }, | ||
205 | + commands: { | ||
206 | + 'simpleupload': { | ||
207 | + queryCommandState: function () { | ||
208 | + return isLoaded ? 0 : -1; | ||
209 | + } | ||
210 | + } | ||
211 | + } | ||
212 | + } | ||
213 | + }); | ||
214 | + UE.plugin.register('autoupload', function () { | ||
215 | + | ||
216 | + function sendAndInsertFile(file, editor) { | ||
217 | + var me = editor; | ||
218 | + //模拟数据 | ||
219 | + var fieldName, urlPrefix, maxSize, allowFiles, actionUrl, | ||
220 | + loadingHtml, errorHandler, successHandler, | ||
221 | + filetype = /image\/\w+/i.test(file.type) ? 'image' : 'file', | ||
222 | + loadingId = 'loading_' + (+new Date()).toString(36); | ||
223 | + | ||
224 | + fieldName = me.getOpt(filetype + 'FieldName'); | ||
225 | + urlPrefix = me.getOpt(filetype + 'UrlPrefix'); | ||
226 | + maxSize = me.getOpt(filetype + 'MaxSize'); | ||
227 | + allowFiles = me.getOpt(filetype + 'AllowFiles'); | ||
228 | + actionUrl = me.getActionUrl(me.getOpt(filetype + 'ActionName')); | ||
229 | + errorHandler = function (title) { | ||
230 | + var loader = me.document.getElementById(loadingId); | ||
231 | + loader && UE.dom.domUtils.remove(loader); | ||
232 | + me.fireEvent('showmessage', { | ||
233 | + 'id': loadingId, | ||
234 | + 'content': title, | ||
235 | + 'type': 'error', | ||
236 | + 'timeout': 4000 | ||
237 | + }); | ||
238 | + }; | ||
239 | + | ||
240 | + if (filetype == 'image') { | ||
241 | + loadingHtml = '<img class="loadingclass" id="' + loadingId + '" src="' + | ||
242 | + me.options.themePath + me.options.theme + | ||
243 | + '/images/spacer.gif" title="' + (me.getLang('autoupload.loading') || '') + '" >'; | ||
244 | + successHandler = function (data) { | ||
245 | + var link = urlPrefix + data.url, | ||
246 | + loader = me.document.getElementById(loadingId); | ||
247 | + if (loader) { | ||
248 | + loader.setAttribute('src', link); | ||
249 | + loader.setAttribute('_src', link); | ||
250 | + loader.setAttribute('title', data.title || ''); | ||
251 | + loader.setAttribute('alt', data.original || ''); | ||
252 | + loader.removeAttribute('id'); | ||
253 | + UE.dom.domUtils.removeClasses(loader, 'loadingclass'); | ||
254 | + } | ||
255 | + }; | ||
256 | + } else { | ||
257 | + loadingHtml = '<p>' + | ||
258 | + '<img class="loadingclass" id="' + loadingId + '" src="' + | ||
259 | + me.options.themePath + me.options.theme + | ||
260 | + '/images/spacer.gif" title="' + (me.getLang('autoupload.loading') || '') + '" >' + | ||
261 | + '</p>'; | ||
262 | + successHandler = function (data) { | ||
263 | + var link = urlPrefix + data.url, | ||
264 | + loader = me.document.getElementById(loadingId); | ||
265 | + | ||
266 | + var rng = me.selection.getRange(), | ||
267 | + bk = rng.createBookmark(); | ||
268 | + rng.selectNode(loader).select(); | ||
269 | + me.execCommand('insertfile', { | ||
270 | + 'url': link | ||
271 | + }); | ||
272 | + rng.moveToBookmark(bk).select(); | ||
273 | + }; | ||
274 | + } | ||
275 | + | ||
276 | + /* 插入loading的占位符 */ | ||
277 | + me.execCommand('inserthtml', loadingHtml); | ||
278 | + | ||
279 | + /* 判断后端配置是否没有加载成功 */ | ||
280 | + if (!me.getOpt(filetype + 'ActionName')) { | ||
281 | + errorHandler(me.getLang('autoupload.errorLoadConfig')); | ||
282 | + return; | ||
283 | + } | ||
284 | + /* 判断文件大小是否超出限制 */ | ||
285 | + if (file.size > maxSize) { | ||
286 | + errorHandler(me.getLang('autoupload.exceedSizeError')); | ||
287 | + return; | ||
288 | + } | ||
289 | + /* 判断文件格式是否超出允许 */ | ||
290 | + var fileext = file.name ? file.name.substr(file.name.lastIndexOf('.')) : ''; | ||
291 | + if ((fileext && filetype != 'image') || (allowFiles && (allowFiles.join('') + '.').indexOf(fileext.toLowerCase() + '.') == -1)) { | ||
292 | + errorHandler(me.getLang('autoupload.exceedTypeError')); | ||
293 | + return; | ||
294 | + } | ||
295 | + try { | ||
296 | + Upload.api.send(file, function (data) { | ||
297 | + var url = Fast.api.cdnurl(data.url); | ||
298 | + successHandler({ | ||
299 | + "state": "SUCCESS", | ||
300 | + "url": url, | ||
301 | + "title": file.name, | ||
302 | + "original": file.name, | ||
303 | + "type": fileext, | ||
304 | + "size": file['size'] | ||
305 | + }); | ||
306 | + }); | ||
307 | + } catch (er) { | ||
308 | + errorHandler(me.getLang('autoupload.loadError')); | ||
309 | + } | ||
310 | + } | ||
311 | + | ||
312 | + function getPasteImage(e) { | ||
313 | + return e.clipboardData && e.clipboardData.items && e.clipboardData.items.length == 1 && /^image\//.test(e.clipboardData.items[0].type) ? e.clipboardData.items : null; | ||
314 | + } | ||
315 | + | ||
316 | + function getDropImage(e) { | ||
317 | + return e.dataTransfer && e.dataTransfer.files ? e.dataTransfer.files : null; | ||
318 | + } | ||
319 | + | ||
320 | + return { | ||
321 | + outputRule: function (root) { | ||
322 | + UE.utils.each(root.getNodesByTagName('img'), function (n) { | ||
323 | + if (/\b(loaderrorclass)|(bloaderrorclass)\b/.test(n.getAttr('class'))) { | ||
324 | + n.parentNode.removeChild(n); | ||
325 | + } | ||
326 | + }); | ||
327 | + UE.utils.each(root.getNodesByTagName('p'), function (n) { | ||
328 | + if (/\bloadpara\b/.test(n.getAttr('class'))) { | ||
329 | + n.parentNode.removeChild(n); | ||
330 | + } | ||
331 | + }); | ||
332 | + }, | ||
333 | + bindEvents: { | ||
334 | + //插入粘贴板的图片,拖放插入图片 | ||
335 | + 'ready': function (e) { | ||
336 | + var me = this; | ||
337 | + if (window.FormData && window.FileReader) { | ||
338 | + UE.dom.domUtils.on(me.body, 'paste drop', function (e) { | ||
339 | + var hasImg = false, | ||
340 | + items; | ||
341 | + //获取粘贴板文件列表或者拖放文件列表 | ||
342 | + items = e.type == 'paste' ? getPasteImage(e) : getDropImage(e); | ||
343 | + if (items) { | ||
344 | + var len = items.length, | ||
345 | + file; | ||
346 | + while (len--) { | ||
347 | + file = items[len]; | ||
348 | + if (file.getAsFile) file = file.getAsFile(); | ||
349 | + if (file && file.size > 0) { | ||
350 | + sendAndInsertFile(file, me); | ||
351 | + hasImg = true; | ||
62 | } | 352 | } |
63 | - }); | ||
64 | - return false; | 353 | + } |
354 | + hasImg && e.preventDefault(); | ||
65 | } | 355 | } |
356 | + | ||
66 | }); | 357 | }); |
67 | - return button.render(); | ||
68 | - }; | ||
69 | - var attachmentButton = function (context) { | ||
70 | - var ui = $.summernote.ui; | ||
71 | - var button = ui.button({ | ||
72 | - contents: '<i class="fa fa-file"/>', | ||
73 | - tooltip: __('Choose'), | ||
74 | - click: function () { | ||
75 | - parent.Fast.api.open("general/attachment/select?element_id=&multiple=true&mimetype=*", __('Choose'), { | ||
76 | - callback: function (data) { | ||
77 | - var urlArr = data.url.split(/\,/); | ||
78 | - $.each(urlArr, function () { | ||
79 | - var url = Fast.api.cdnurl(this); | ||
80 | - var node = $("<a href='" + url + "'>" + url + "</a>"); | ||
81 | - context.invoke('insertNode', node[0]); | ||
82 | - }); | ||
83 | - } | ||
84 | - }); | ||
85 | - return false; | 358 | + //取消拖放图片时出现的文字光标位置提示 |
359 | + UE.dom.domUtils.on(me.body, 'dragover', function (e) { | ||
360 | + if (e.dataTransfer.types[0] == 'Files') { | ||
361 | + e.preventDefault(); | ||
86 | } | 362 | } |
87 | }); | 363 | }); |
88 | - return button.render(); | ||
89 | - }; | ||
90 | 364 | ||
91 | - $(".summernote,.editor", form).summernote({ | ||
92 | - height: 250, | ||
93 | - lang: 'zh-CN', | ||
94 | - fontNames: [ | ||
95 | - 'Arial', 'Arial Black', 'Serif', 'Sans', 'Courier', | ||
96 | - 'Courier New', 'Comic Sans MS', 'Helvetica', 'Impact', 'Lucida Grande', | ||
97 | - "Open Sans", "Hiragino Sans GB", "Microsoft YaHei", | ||
98 | - '微软雅黑', '宋体', '黑体', '仿宋', '楷体', '幼圆', | ||
99 | - ], | ||
100 | - fontNamesIgnoreCheck: [ | ||
101 | - "Open Sans", "Microsoft YaHei", | ||
102 | - '微软雅黑', '宋体', '黑体', '仿宋', '楷体', '幼圆' | ||
103 | - ], | ||
104 | - toolbar: [ | ||
105 | - ['style', ['style', 'undo', 'redo']], | ||
106 | - ['font', ['bold', 'underline', 'strikethrough', 'clear']], | ||
107 | - ['fontname', ['color', 'fontname', 'fontsize']], | ||
108 | - ['para', ['ul', 'ol', 'paragraph', 'height']], | ||
109 | - ['table', ['table', 'hr']], | ||
110 | - ['insert', ['link', 'picture', 'video']], | ||
111 | - ['select', ['image', 'attachment']], | ||
112 | - ['view', ['fullscreen', 'codeview', 'help']], | ||
113 | - ], | ||
114 | - buttons: { | ||
115 | - image: imageButton, | ||
116 | - attachment: attachmentButton, | ||
117 | - }, | ||
118 | - dialogsInBody: true, | ||
119 | - followingToolbar: false, | ||
120 | - callbacks: { | ||
121 | - onChange: function (contents) { | ||
122 | - $(this).val(contents); | ||
123 | - $(this).trigger('change'); | ||
124 | - }, | ||
125 | - onInit: function () { | ||
126 | - }, | ||
127 | - onImageUpload: function (files) { | ||
128 | - var that = this; | ||
129 | - //依次上传图片 | ||
130 | - for (var i = 0; i < files.length; i++) { | ||
131 | - Upload.api.send(files[i], function (data) { | ||
132 | - var url = Fast.api.cdnurl(data.url); | ||
133 | - $(that).summernote("insertImage", url, 'filename'); | 365 | + //设置loading的样式 |
366 | + UE.utils.cssRule('loading', | ||
367 | + '.loadingclass{display:inline-block;cursor:default;background: url(\'' + | ||
368 | + this.options.themePath + | ||
369 | + this.options.theme + '/images/loading.gif\') no-repeat center center transparent;border:1px solid #cccccc;margin-left:1px;height: 22px;width: 22px;}\n' + | ||
370 | + '.loaderrorclass{display:inline-block;cursor:default;background: url(\'' + | ||
371 | + this.options.themePath + | ||
372 | + this.options.theme + '/images/loaderror.png\') no-repeat center center transparent;border:1px solid #cccccc;margin-right:1px;height: 22px;width: 22px;' + | ||
373 | + '}', | ||
374 | + this.document); | ||
375 | + } | ||
376 | + } | ||
377 | + } | ||
378 | + } | ||
379 | + }); | ||
380 | + | ||
381 | + /** | ||
382 | + * 远程图片抓取,当开启本插件时所有不符合本地域名的图片都将被抓取成为本地服务器上的图片 | ||
383 | + */ | ||
384 | + UE.plugins['catchremoteimage'] = function () { | ||
385 | + var me = this, | ||
386 | + ajax = UE.ajax; | ||
387 | + | ||
388 | + /* 设置默认值 */ | ||
389 | + if (me.options.catchRemoteImageEnable === false) return; | ||
390 | + me.setOpt({ | ||
391 | + catchRemoteImageEnable: false | ||
392 | + }); | ||
393 | + | ||
394 | + me.addListener("afterpaste", function () { | ||
395 | + me.fireEvent("catchRemoteImage"); | ||
396 | + }); | ||
397 | + | ||
398 | + me.addListener("catchRemoteImage", function () { | ||
399 | + | ||
400 | + var catcherLocalDomain = me.getOpt('catcherLocalDomain'), | ||
401 | + catcherActionUrl = me.getActionUrl(me.getOpt('catcherActionName')), | ||
402 | + catcherUrlPrefix = me.getOpt('catcherUrlPrefix'), | ||
403 | + catcherFieldName = me.getOpt('catcherFieldName'); | ||
404 | + var remoteImages = [], | ||
405 | + imgs = UE.dom.domUtils.getElementsByTagName(me.document, "img"), | ||
406 | + test = function (src, urls) { | ||
407 | + if (src.indexOf(location.host) != -1 || /(^\.)|(^\/)/.test(src)) { | ||
408 | + return true; | ||
409 | + } | ||
410 | + if (urls) { | ||
411 | + for (var j = 0, url; url = urls[j++];) { | ||
412 | + if (src.indexOf(url) !== -1) { | ||
413 | + return true; | ||
414 | + } | ||
415 | + } | ||
416 | + } | ||
417 | + return false; | ||
418 | + }; | ||
419 | + | ||
420 | + for (var i = 0, ci; ci = imgs[i++];) { | ||
421 | + if (ci.getAttribute("word_img")) { | ||
422 | + continue; | ||
423 | + } | ||
424 | + var src = ci.getAttribute("_src") || ci.src || ""; | ||
425 | + if (/^(https?|ftp):/i.test(src) && !test(src, catcherLocalDomain)) { | ||
426 | + remoteImages.push(src); | ||
427 | + } | ||
428 | + } | ||
429 | + | ||
430 | + if (remoteImages.length) { | ||
431 | + catchremoteimage(remoteImages, { | ||
432 | + //成功抓取 | ||
433 | + success:async function (r) { | ||
434 | + try { | ||
435 | + var info = r.state !== undefined ? r:eval("(" + r.responseText + ")"); | ||
436 | + } catch (e) { | ||
437 | + return; | ||
438 | + } | ||
439 | + | ||
440 | + /* 获取源路径和新路径 */ | ||
441 | + var i, j, ci, cj, oldSrc, newSrc, list = info.list; | ||
442 | + | ||
443 | + for (i = 0; ci = imgs[i++];) { | ||
444 | + oldSrc = ci.getAttribute("_src") || ci.src || ""; | ||
445 | + for (j = 0; cj = list[j++];) { | ||
446 | + //抓取失败时不做替换处理 | ||
447 | + if (oldSrc == cj.source && cj.state == "SUCCESS") { | ||
448 | + var file = dataURLtoFile(cj.base64Data, (new Date()).valueOf() + '.jpg'); | ||
449 | + var imgUrl=await getLoaclImg(file); | ||
450 | + newSrc = Fast.api.cdnurl(imgUrl); | ||
451 | + UE.dom.domUtils.setAttributes(ci, { | ||
452 | + "src": newSrc, | ||
453 | + "_src": newSrc | ||
134 | }); | 454 | }); |
455 | + break; | ||
135 | } | 456 | } |
136 | } | 457 | } |
137 | } | 458 | } |
138 | - }); | 459 | + me.fireEvent('catchremotesuccess') |
460 | + }, | ||
461 | + //回调失败,本次请求超时 | ||
462 | + error: function () { | ||
463 | + me.fireEvent("catchremoteerror"); | ||
464 | + } | ||
139 | }); | 465 | }); |
140 | } | 466 | } |
141 | - } catch (e) { | ||
142 | - | ||
143 | - } | ||
144 | 467 | ||
468 | + async function getLoaclImg(file){ | ||
469 | + const promise =new Promise((resolve,reject) => { | ||
470 | + Upload.api.send(file, function (res) { | ||
471 | + resolve(res.url); | ||
472 | + }) | ||
473 | + }) | ||
474 | + return promise; | ||
475 | + } | ||
476 | + | ||
477 | + /** | ||
478 | + * base64转file | ||
479 | + * @param {base64数据} data | ||
480 | + * @param {文件名} filename | ||
481 | + */ | ||
482 | + function dataURLtoFile(data, filename) { | ||
483 | + var arr = data.split(','), | ||
484 | + mime = arr[0].match(/:(.*?);/)[1], | ||
485 | + bstr = atob(arr[1]), | ||
486 | + n = bstr.length, | ||
487 | + u8arr = new Uint8Array(n); | ||
488 | + while (n--) { | ||
489 | + u8arr[n] = bstr.charCodeAt(n); | ||
490 | + } | ||
491 | + return new File([u8arr], filename, { | ||
492 | + type: mime | ||
493 | + }); | ||
494 | + } | ||
495 | + /** | ||
496 | + *获取base64 | ||
497 | + * | ||
498 | + * @param {*} img | ||
499 | + * @param {*} callbacks | ||
500 | + */ | ||
501 | + function catchremoteimage(img, callbacks) { | ||
502 | + var params = UE.utils.serializeParam(me.queryCommandValue('serverparam')) || '', | ||
503 | + url = UE.utils.formatUrl(catcherActionUrl + (catcherActionUrl.indexOf('?') == -1 ? '?':'&') + params), | ||
504 | + isJsonp = UE.utils.isCrossDomainUrl(url), | ||
505 | + opt = { | ||
506 | + 'method': 'POST', | ||
507 | + 'dataType': isJsonp ? 'jsonp':'', | ||
508 | + 'timeout': 60000, //单位:毫秒,回调请求超时设置。目标用户如果网速不是很快的话此处建议设置一个较大的数值 | ||
509 | + 'onsuccess': callbacks["success"], | ||
510 | + 'onerror': callbacks["error"] | ||
511 | + }; | ||
512 | + opt[catcherFieldName] = img; | ||
513 | + ajax.request(url, opt); | ||
514 | + } | ||
515 | + }); | ||
145 | }; | 516 | }; |
146 | -}); | ||
147 | 517 | ||
148 | -if (Config.modulename === 'index' && Config.controllername === 'user' && ['login', 'register'].indexOf(Config.actionname) > -1 && $("#register-form,#login-form").size() > 0) { | ||
149 | - $('<style>.social-login{display:flex}.social-login a{flex:1;margin:0 2px;}.social-login a:first-child{margin-left:0;}.social-login a:last-child{margin-right:0;}</style>').appendTo("head"); | ||
150 | - $("#register-form,#login-form").append('<div class="form-group social-login"></div>'); | ||
151 | - if (Config.third.status.indexOf("wechat") > -1) { | ||
152 | - $('<a class="btn btn-success" href="' + Fast.api.fixurl('/third/connect/wechat') + '"><i class="fa fa-wechat"></i> 微信登录</a>').appendTo(".social-login"); | ||
153 | - } | ||
154 | - if (Config.third.status.indexOf("qq") > -1) { | ||
155 | - $('<a class="btn btn-info" href="' + Fast.api.fixurl('/third/connect/qq') + '"><i class="fa fa-qq"></i> QQ登录</a>').appendTo(".social-login"); | ||
156 | - } | ||
157 | - if (Config.third.status.indexOf("weibo") > -1) { | ||
158 | - $('<a class="btn btn-danger" href="' + Fast.api.fixurl('/third/connect/weibo') + '"><i class="fa fa-weibo"></i> 微博登录</a>').appendTo(".social-login"); | ||
159 | - } | ||
160 | -} | 518 | + $(".editor").each(function () { |
519 | + var id = $(this).attr("id"); | ||
520 | + $(this).removeClass('form-control'); | ||
521 | + UE.list[id] = UE.getEditor(id, { | ||
522 | + serverUrl: Fast.api.fixurl('/addons/ueditor/api/'), | ||
523 | + allowDivTransToP: false, //阻止div自动转p标签 | ||
524 | + initialFrameWidth: '100%', | ||
525 | + zIndex: 90, | ||
526 | + xssFilterRules: false, | ||
527 | + outputXssFilter: false, | ||
528 | + inputXssFilter: false, | ||
529 | + catchRemoteImageEnable: true | ||
530 | + }); | ||
531 | + //监听图片上传事件 | ||
532 | + UE.list[id].addListener("uploadBtn.click", function (e, up, editor) { | ||
533 | + var filesObj = up.getFiles(); | ||
534 | + for (var i = 0; i < filesObj.length; i++) { | ||
535 | + (function (j) { | ||
536 | + var file = filesObj[j]; | ||
537 | + var id = filesObj[j].id; | ||
538 | + var name = filesObj[j].name; | ||
539 | + Upload.api.send(file.source.source, function (data) { | ||
540 | + var pic = { | ||
541 | + url: Fast.api.cdnurl(data.url), | ||
542 | + state: "SUCCESS", | ||
543 | + title: name | ||
544 | + }; | ||
545 | + editor.fireEvent("upload.success", id, pic, file); | ||
546 | + }); | ||
547 | + })(i); | ||
548 | + } | ||
549 | + }); | ||
550 | + //打开图片管理 | ||
551 | + UE.list[id].addListener("upload.online", function (e, editor, dialog) { | ||
552 | + dialog.close(false); | ||
553 | + Fast.api.open("general/attachment/select?element_id=&multiple=true&mimetype=image/*", "选择", { | ||
554 | + callback: function (data) { | ||
555 | + var urlArr = data.url.split(/\,/); | ||
556 | + urlArr.forEach(function (item, index) { | ||
557 | + var url = Fast.api.cdnurl(item); | ||
558 | + editor.execCommand('insertimage', { | ||
559 | + src: url | ||
560 | + }); | ||
561 | + }); | ||
562 | + } | ||
563 | + }); | ||
564 | + }); | ||
565 | + // 涂画 | ||
566 | + UE.list[id].addListener("upload.scrawl", function (e, editor, base64, dialog) { | ||
567 | + function dataURLtoFile(dataurl, filename) { | ||
568 | + var arr = dataurl.split(','), | ||
569 | + mime = arr[0].match(/:(.*?);/)[1], | ||
570 | + bstr = atob(arr[1]), | ||
571 | + n = bstr.length, | ||
572 | + u8arr = new Uint8Array(n); | ||
573 | + while (n--) { | ||
574 | + u8arr[n] = bstr.charCodeAt(n); | ||
575 | + } | ||
576 | + return new File([u8arr], filename, { | ||
577 | + type: mime | ||
578 | + }); | ||
579 | + } | ||
161 | 580 | ||
581 | + var file = dataURLtoFile('data:image/png;base64,' + base64, editor.getOpt('scrawlFieldName') + '.png'); | ||
582 | + Upload.api.send(file, function (data) { | ||
583 | + editor.execCommand('insertimage', { | ||
584 | + src: Fast.api.cdnurl(data.url) | ||
585 | + }); | ||
586 | + dialog.close(false); | ||
587 | + }) | ||
588 | + }) | ||
589 | + //视频上传 | ||
590 | + UE.list[id].addListener("upload.video", function (e, up, editor) { | ||
591 | + var filesObj = up.getFiles(); | ||
592 | + for (var i = 0; i < filesObj.length; i++) { | ||
593 | + (function (j) { | ||
594 | + var file = filesObj[j]; | ||
595 | + var id = filesObj[j].id; | ||
596 | + var name = filesObj[j].name; | ||
597 | + Upload.api.send(file.source.source, function (data) { | ||
598 | + var pic = { | ||
599 | + url: Fast.api.cdnurl(data.url), | ||
600 | + state: "SUCCESS", | ||
601 | + title: name | ||
602 | + }; | ||
603 | + editor.fireEvent("video.file.success", id, pic, file); | ||
604 | + }); | ||
605 | + })(i); | ||
606 | + } | ||
607 | + }); | ||
608 | + // 附件上传 | ||
609 | + UE.list[id].addListener("upload.attachment", function (e, up, editor) { | ||
610 | + var filesObj = up.getFiles(); | ||
611 | + for (var i = 0; i < filesObj.length; i++) { | ||
612 | + (function (j) { | ||
613 | + var file = filesObj[j]; | ||
614 | + var id = filesObj[j].id; | ||
615 | + var name = filesObj[j].name; | ||
616 | + Upload.api.send(file.source.source, function (data) { | ||
617 | + var pic = { | ||
618 | + url: Fast.api.cdnurl(data.url), | ||
619 | + state: "SUCCESS", | ||
620 | + title: name | ||
621 | + }; | ||
622 | + editor.fireEvent("attachment.file.success", id, pic, file); | ||
623 | + }); | ||
624 | + })(i); | ||
625 | + } | ||
626 | + }); | ||
627 | + //打开附件管理 | ||
628 | + UE.list[id].addListener("file.online", function (e, editor, dialog) { | ||
629 | + dialog.close(false); | ||
630 | + Fast.api.open("general/attachment/select?element_id=&multiple=true&mimetype=application/*", "选择", { | ||
631 | + callback: function (data) { | ||
632 | + var urlArr = data.url.split(/\,/); | ||
633 | + urlArr.forEach(function (item, index) { | ||
634 | + var url = Fast.api.cdnurl(item); | ||
635 | + editor.execCommand('insertfile', { | ||
636 | + url: url | ||
637 | + }); | ||
638 | + }); | ||
639 | + } | ||
640 | + }); | ||
641 | + }); | ||
642 | + // 修复cms提取关键词和违禁词检测 | ||
643 | + UE.list[id].addListener("contentChange", function () { | ||
644 | + $('#' + id).val(this.getContent()); | ||
645 | + }) | ||
646 | + }); | ||
647 | +}); | ||
162 | }); | 648 | }); |
@@ -51,6 +51,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -51,6 +51,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
51 | }, | 51 | }, |
52 | edit: function () { | 52 | edit: function () { |
53 | Controller.api.bindevent(); | 53 | Controller.api.bindevent(); |
54 | + setTimeout(function () { | ||
55 | + $('input[name="row[lookdata]"]').trigger("change"); | ||
56 | + }, 100); | ||
54 | }, | 57 | }, |
55 | api: { | 58 | api: { |
56 | bindevent: function () { | 59 | bindevent: function () { |
@@ -60,6 +63,18 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -60,6 +63,18 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
60 | var A = parseFloat($("#c-factory_price").val()) + parseFloat($("#c-subsidy_price").val()); | 63 | var A = parseFloat($("#c-factory_price").val()) + parseFloat($("#c-subsidy_price").val()); |
61 | $("#c-factory_price_total").val(A); | 64 | $("#c-factory_price_total").val(A); |
62 | }); | 65 | }); |
66 | + | ||
67 | + $(document).on("change", 'input[name="row[lookdata]"]', function () { | ||
68 | + var status = $('input[name="row[lookdata]"]:checked').val(); | ||
69 | + if(status == 0){ | ||
70 | + $('.job').addClass('hide'); | ||
71 | + }else{ | ||
72 | + $('.job').removeClass('hide'); | ||
73 | + } | ||
74 | + }); | ||
75 | + // Form.api.bindevent($("form[role=form]")); | ||
76 | + | ||
77 | + | ||
63 | } | 78 | } |
64 | } | 79 | } |
65 | }; | 80 | }; |
@@ -30,7 +30,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -30,7 +30,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
30 | {field: 'mobile', title: __('Mobile'), operate: 'LIKE'}, | 30 | {field: 'mobile', title: __('Mobile'), operate: 'LIKE'}, |
31 | {field: 'idcard', title: __('Idcard'), operate: 'LIKE'}, | 31 | {field: 'idcard', title: __('Idcard'), operate: 'LIKE'}, |
32 | {field: 'idcard_front', title: __('Idcard_front'), events: Table.api.events.image, formatter: Table.api.formatter.image, operate: false}, | 32 | {field: 'idcard_front', title: __('Idcard_front'), events: Table.api.events.image, formatter: Table.api.formatter.image, operate: false}, |
33 | - {field: 'idcard_back', title: __('Idcard_back'), events: Table.api.events.image, formatter: Table.api.formatter.image, operate: false}, | 33 | + // {field: 'idcard_back', title: __('Idcard_back'), events: Table.api.events.image, formatter: Table.api.formatter.image, operate: false}, |
34 | {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status}, | 34 | {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status}, |
35 | {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, | 35 | {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, |
36 | {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'}, | 36 | {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'}, |
@@ -54,6 +54,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -54,6 +54,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
54 | {field: 'is_complete', title: __('Is_complete'), formatter: Table.api.formatter.status, searchList: {0: __('否'), 1: __('是')}}, | 54 | {field: 'is_complete', title: __('Is_complete'), formatter: Table.api.formatter.status, searchList: {0: __('否'), 1: __('是')}}, |
55 | // {field: 'work_subsidy', title: __('Work_subsidy'), operate: false}, | 55 | // {field: 'work_subsidy', title: __('Work_subsidy'), operate: false}, |
56 | {field: 'recruit_subsidy', title: __('Recruit_subsidy'), operate: false}, | 56 | {field: 'recruit_subsidy', title: __('Recruit_subsidy'), operate: false}, |
57 | + {field: 'recruit_subsidy2', title: __('Recruit_subsidy2'), operate: false}, | ||
57 | {field: 'work_subsidy_month', title: __('Work_subsidy_month'), operate: false}, | 58 | {field: 'work_subsidy_month', title: __('Work_subsidy_month'), operate: false}, |
58 | {field: 'recruit_subsidy_month', title: __('Recruit_subsidy_month'), operate: false}, | 59 | {field: 'recruit_subsidy_month', title: __('Recruit_subsidy_month'), operate: false}, |
59 | {field: 'lower_num', title: __('Lower_num'), operate: false}, | 60 | {field: 'lower_num', title: __('Lower_num'), operate: false}, |
-
请 注册 或 登录 后发表评论