正在显示
5 个修改的文件
包含
68 行增加
和
19 行删除
@@ -121,13 +121,29 @@ | @@ -121,13 +121,29 @@ | ||
121 | <div class="form-group"> | 121 | <div class="form-group"> |
122 | <label class="control-label col-xs-12 col-sm-2">{:__('Qr_code')}:</label> | 122 | <label class="control-label col-xs-12 col-sm-2">{:__('Qr_code')}:</label> |
123 | <div class="col-xs-12 col-sm-8"> | 123 | <div class="col-xs-12 col-sm-8"> |
124 | - <input id="c-qr_code" class="form-control" name="row[qr_code]" type="text"> | 124 | + <div class="input-group"> |
125 | + <input id="c-qr_code" class="form-control" size="50" name="row[qr_code]" type="text"> | ||
126 | + <div class="input-group-addon no-border no-padding"> | ||
127 | + <span><button type="button" id="faupload-qr_code" class="btn btn-danger faupload" data-input-id="c-qr_code" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-qr_code"><i class="fa fa-upload"></i> {:__('Upload')}</button></span> | ||
128 | + <span><button type="button" id="fachoose-qr_code" class="btn btn-primary fachoose" data-input-id="c-qr_code" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span> | ||
129 | + </div> | ||
130 | + <span class="msg-box n-right" for="c-qr_code"></span> | ||
131 | + </div> | ||
132 | + <ul class="row list-inline faupload-preview" id="p-qr_code"></ul> | ||
125 | </div> | 133 | </div> |
126 | </div> | 134 | </div> |
127 | <div class="form-group"> | 135 | <div class="form-group"> |
128 | <label class="control-label col-xs-12 col-sm-2">{:__('Qr_code_d')}:</label> | 136 | <label class="control-label col-xs-12 col-sm-2">{:__('Qr_code_d')}:</label> |
129 | <div class="col-xs-12 col-sm-8"> | 137 | <div class="col-xs-12 col-sm-8"> |
130 | - <input id="c-qr_code_d" class="form-control" name="row[qr_code_d]" type="text"> | 138 | + <div class="input-group"> |
139 | + <input id="c-qr_code_d" class="form-control" size="50" name="row[image]" type="text"> | ||
140 | + <div class="input-group-addon no-border no-padding"> | ||
141 | + <span><button type="button" id="faupload-qr_code_d" class="btn btn-danger faupload" data-input-id="c-qr_code_d" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-qr_code_d"><i class="fa fa-upload"></i> {:__('Upload')}</button></span> | ||
142 | + <span><button type="button" id="fachoose-qr_code_d" class="btn btn-primary fachoose" data-input-id="c-qr_code_d" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span> | ||
143 | + </div> | ||
144 | + <span class="msg-box n-right" for="c-qr_code_d"></span> | ||
145 | + </div> | ||
146 | + <ul class="row list-inline faupload-preview" id="p-qr_code_d"></ul> | ||
131 | </div> | 147 | </div> |
132 | </div> | 148 | </div> |
133 | <div class="form-group"> | 149 | <div class="form-group"> |
@@ -121,13 +121,35 @@ | @@ -121,13 +121,35 @@ | ||
121 | <div class="form-group"> | 121 | <div class="form-group"> |
122 | <label class="control-label col-xs-12 col-sm-2">{:__('Qr_code')}:</label> | 122 | <label class="control-label col-xs-12 col-sm-2">{:__('Qr_code')}:</label> |
123 | <div class="col-xs-12 col-sm-8"> | 123 | <div class="col-xs-12 col-sm-8"> |
124 | - <input id="c-qr_code" class="form-control" name="row[qr_code]" type="text" value="{$row.qr_code|htmlentities}"> | 124 | + <div class="input-group"> |
125 | + <input id="c-qr_code" class="form-control" size="50" name="row[qr_code]" type="text" value="{$row.qr_code|htmlentities}"> | ||
126 | + <div class="input-group-addon no-border no-padding"> | ||
127 | + <span><button type="button" id="faupload-qr_code" class="btn btn-danger faupload" data-input-id="c-qr_code" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-qr_code"><i class="fa fa-upload"></i> {:__('Upload')}</button></span> | ||
128 | + <span><button type="button" id="fachoose-qr_code" class="btn btn-primary fachoose" data-input-id="c-qr_code" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span> | ||
129 | + </div> | ||
130 | + <span class="msg-box n-right" for="c-qr_code"></span> | ||
131 | + </div> | ||
132 | + <ul class="row list-inline faupload-preview" id="p-qr_code"></ul> | ||
125 | </div> | 133 | </div> |
126 | </div> | 134 | </div> |
135 | +<!-- <div class="form-group">--> | ||
136 | +<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Qr_code')}:</label>--> | ||
137 | +<!-- <div class="col-xs-12 col-sm-8">--> | ||
138 | +<!-- <input id="c-qr_code" class="form-control" name="row[qr_code]" type="text" value="{$row.qr_code|htmlentities}">--> | ||
139 | +<!-- </div>--> | ||
140 | +<!-- </div>--> | ||
127 | <div class="form-group"> | 141 | <div class="form-group"> |
128 | <label class="control-label col-xs-12 col-sm-2">{:__('Qr_code_d')}:</label> | 142 | <label class="control-label col-xs-12 col-sm-2">{:__('Qr_code_d')}:</label> |
129 | <div class="col-xs-12 col-sm-8"> | 143 | <div class="col-xs-12 col-sm-8"> |
130 | - <input id="c-qr_code_d" class="form-control" name="row[qr_code_d]" type="text" value="{$row.qr_code_d|htmlentities}"> | 144 | + <div class="input-group"> |
145 | + <input id="c-qr_code_d" class="form-control" size="50" name="row[qr_code_d]" type="text" value="{$row.qr_code_d|htmlentities}"> | ||
146 | + <div class="input-group-addon no-border no-padding"> | ||
147 | + <span><button type="button" id="faupload-qr_code_d" class="btn btn-danger faupload" data-input-id="c-qr_code_d" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-qr_code_d"><i class="fa fa-upload"></i> {:__('Upload')}</button></span> | ||
148 | + <span><button type="button" id="fachoose-qr_code_d" class="btn btn-primary fachoose" data-input-id="c-qr_code_d" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span> | ||
149 | + </div> | ||
150 | + <span class="msg-box n-right" for="c-qr_code_d"></span> | ||
151 | + </div> | ||
152 | + <ul class="row list-inline faupload-preview" id="p-qr_code_d"></ul> | ||
131 | </div> | 153 | </div> |
132 | </div> | 154 | </div> |
133 | <div class="form-group"> | 155 | <div class="form-group"> |
@@ -94,9 +94,15 @@ class Treasured extends BaseApi | @@ -94,9 +94,15 @@ class Treasured extends BaseApi | ||
94 | if ($this->auth->authlist == '' || $this->auth->authlist == ','){ | 94 | if ($this->auth->authlist == '' || $this->auth->authlist == ','){ |
95 | $this->error('请您先实名认证'); | 95 | $this->error('请您先实名认证'); |
96 | } | 96 | } |
97 | + if ($this->auth->avatar != '' && !in_array(substr($this->auth->avatar,-4),explode(',','jpg,png,bmp,jpeg,gif,zip,rar,xls,xlsx'))){ | ||
98 | + $content = file_get_contents($this->auth->avatar); | ||
99 | + file_put_contents(ROOT_PATH.'/public/uploads/user_avatar/user_id_'.$this->auth->id.'.jpg', $content); | ||
100 | + model('user')->where('id',$this->auth->id)->update(['avatar'=>'/public/uploads/user_avatar/user_id_'.$this->auth->id.'.jpg']); | ||
101 | + } | ||
97 | //2.获取数据 | 102 | //2.获取数据 |
98 | $data = $this->get_data_array([ | 103 | $data = $this->get_data_array([ |
99 | ['url','域名不能为空'], | 104 | ['url','域名不能为空'], |
105 | + ['author','作者名称不能为空'], | ||
100 | ['title','作品标题不能为空'], | 106 | ['title','作品标题不能为空'], |
101 | ['content','内容不存在'], | 107 | ['content','内容不存在'], |
102 | ['images','图片必须上传'], | 108 | ['images','图片必须上传'], |
@@ -122,6 +128,7 @@ class Treasured extends BaseApi | @@ -122,6 +128,7 @@ class Treasured extends BaseApi | ||
122 | $data['avatar'] = $this->auth->avatar; | 128 | $data['avatar'] = $this->auth->avatar; |
123 | $data['nickname'] = $this->auth->nickname; | 129 | $data['nickname'] = $this->auth->nickname; |
124 | $data['images'] = $images; | 130 | $data['images'] = $images; |
131 | + $data['number'] = time()-mt_rand(1000,9999); | ||
125 | if (isset($data['url'])){ | 132 | if (isset($data['url'])){ |
126 | $url = $data['url']; | 133 | $url = $data['url']; |
127 | unset($data['url']); | 134 | unset($data['url']); |
@@ -135,17 +142,21 @@ class Treasured extends BaseApi | @@ -135,17 +142,21 @@ class Treasured extends BaseApi | ||
135 | if ($qr_code_bg && !empty($qr_code_bg['value'])){ | 142 | if ($qr_code_bg && !empty($qr_code_bg['value'])){ |
136 | $code = new QRcode(); | 143 | $code = new QRcode(); |
137 | $qr_code = $code->png($url.$treasured['id']) //生成二维码 | 144 | $qr_code = $code->png($url.$treasured['id']) //生成二维码 |
138 | - ->logo(ROOT_PATH.'public/assets/img/bg.png',4,1.97) //生成logo二维码 | ||
139 | - ->logo($this->auth->avatar)//生成logo二维码 | ||
140 | - ->getPath();//获取二维码生成的地址 | 145 | + ->logo(ROOT_PATH.'public/assets/img/bg.png',4,1.97); //生成logo二维码 |
146 | + if (!empty($this->auth->avatar)){ | ||
147 | + $qr_code = $qr_code->logo($this->auth->avatar);//生成logo二维码 | ||
148 | + } | ||
149 | + $qr_code = $qr_code->getPath();//获取二维码生成的地址 | ||
141 | $qr_code_d = $code->png($url.$treasured['id']) //生成二维码 | 150 | $qr_code_d = $code->png($url.$treasured['id']) //生成二维码 |
142 | - ->logo(ROOT_PATH.'public/assets/img/bg.png',4,1.97) //生成logo二维码 | ||
143 | - ->logo($this->auth->avatar)//生成logo二维码 | ||
144 | - ->background(550,950,cdnurl($qr_code_bg['value'])) //给二维码加上背景 | 151 | + ->logo(ROOT_PATH.'public/assets/img/bg.png',4,1.97); //生成logo二维码 |
152 | + if (!empty($this->auth->avatar)){ | ||
153 | + $qr_code_d = $qr_code_d->logo($this->auth->avatar);//生成logo二维码 | ||
154 | + } | ||
155 | + $qr_code_d = $qr_code_d->background(550,950,cdnurl($qr_code_bg['value'])) //给二维码加上背景 | ||
145 | ->getPath();//获取二维码生成的地址 | 156 | ->getPath();//获取二维码生成的地址 |
146 | //8.更新数据 | 157 | //8.更新数据 |
147 | - $treasured->qr_code = this_url().$qr_code; | ||
148 | - $treasured->qr_code_d = this_url().$qr_code_d; | 158 | + $treasured->qr_code = $qr_code; |
159 | + $treasured->qr_code_d = $qr_code_d; | ||
149 | $treasured->save(); | 160 | $treasured->save(); |
150 | } | 161 | } |
151 | //9.返回结果 | 162 | //9.返回结果 |
@@ -126,7 +126,7 @@ class User extends Model | @@ -126,7 +126,7 @@ class User extends Model | ||
126 | //$value = '/assets/img/avatar.png'; | 126 | //$value = '/assets/img/avatar.png'; |
127 | $value = letter_avatar($data['nickname']); | 127 | $value = letter_avatar($data['nickname']); |
128 | } | 128 | } |
129 | - return $value; | 129 | + return cdnurl($value,true); |
130 | } | 130 | } |
131 | 131 | ||
132 | /** | 132 | /** |
@@ -26,7 +26,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -26,7 +26,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
26 | [ | 26 | [ |
27 | {checkbox: true}, | 27 | {checkbox: true}, |
28 | {field: 'id', title: __('Id')}, | 28 | {field: 'id', title: __('Id')}, |
29 | - {field: 'user_id', title: __('User_id')}, | 29 | + //{field: 'user_id', title: __('User_id')}, |
30 | {field: 'avatar', title: __('Avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image}, | 30 | {field: 'avatar', title: __('Avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image}, |
31 | {field: 'nickname', title: __('Nickname'), operate: 'LIKE'}, | 31 | {field: 'nickname', title: __('Nickname'), operate: 'LIKE'}, |
32 | {field: 'title', title: __('Title'), operate: 'LIKE'}, | 32 | {field: 'title', title: __('Title'), operate: 'LIKE'}, |
@@ -35,16 +35,16 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -35,16 +35,16 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
35 | {field: 'images', title: __('Images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images}, | 35 | {field: 'images', title: __('Images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images}, |
36 | {field: 'content', title: __('Content'), operate: 'LIKE'}, | 36 | {field: 'content', title: __('Content'), operate: 'LIKE'}, |
37 | {field: 'production_typeface', title: __('Production_typeface'), operate: 'LIKE'}, | 37 | {field: 'production_typeface', title: __('Production_typeface'), operate: 'LIKE'}, |
38 | - {field: 'production_typeface_id', title: __('Production_typeface_id')}, | 38 | + //{field: 'production_typeface_id', title: __('Production_typeface_id')}, |
39 | {field: 'production_format', title: __('Production_format'), operate: 'LIKE'}, | 39 | {field: 'production_format', title: __('Production_format'), operate: 'LIKE'}, |
40 | - {field: 'production_format_id', title: __('Production_format_id')}, | 40 | + //{field: 'production_format_id', title: __('Production_format_id')}, |
41 | {field: 'treasured_size', title: __('Treasured_size'), operate: 'LIKE'}, | 41 | {field: 'treasured_size', title: __('Treasured_size'), operate: 'LIKE'}, |
42 | - {field: 'treasured_size_id', title: __('Treasured_size_id')}, | 42 | + //{field: 'treasured_size_id', title: __('Treasured_size_id')}, |
43 | {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status}, | 43 | {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status}, |
44 | {field: 'zan_num', title: __('Zan_num')}, | 44 | {field: 'zan_num', title: __('Zan_num')}, |
45 | {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, | 45 | {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, |
46 | - {field: 'qr_code', title: __('Qr_code'), operate: 'LIKE'}, | ||
47 | - {field: 'qr_code_d', title: __('Qr_code_d'), operate: 'LIKE'}, | 46 | + // {field: 'qr_code', title: __('Qr_code'), operate: 'LIKE',formatter: Table.api.formatter.image}, |
47 | + // {field: 'qr_code_d', title: __('Qr_code_d'), operate: 'LIKE',formatter: Table.api.formatter.image}, | ||
48 | {field: 'is_audit', title: __('Is_audit'), searchList: {"0":__('Is_audit 0'),"1":__('Is_audit 1'),"2":__('Is_audit 2')}, formatter: Table.api.formatter.normal}, | 48 | {field: 'is_audit', title: __('Is_audit'), searchList: {"0":__('Is_audit 0'),"1":__('Is_audit 1'),"2":__('Is_audit 2')}, formatter: Table.api.formatter.normal}, |
49 | {field: 'audit_message', title: __('Audit_message'), operate: 'LIKE'}, | 49 | {field: 'audit_message', title: __('Audit_message'), operate: 'LIKE'}, |
50 | {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, | 50 | {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, |
-
请 注册 或 登录 后发表评论