作者 王晓刚
1 个管道 的构建 通过 耗费 2 秒

我的分享

... ... @@ -32,6 +32,31 @@ class Merchant extends WechatBase
return $this->fetch();
}
public function enter_view(){
$domain_name = $this->request->domain();//域名
$data = Db::name('merchant_audit')->where(['user_id'=>$this->user_id])->find();
if(!empty($data)){
if($data['status'] == 1){
//审核中
$this->redirect('audit1');
}else if($data['status'] == 2){
//审核通过
$this->redirect('audit2');
}
$business_images = explode(',',$data['business_images']);
foreach($business_images as $key => $b_i){
$business_images[$key] = $domain_name.$b_i;
}
$data['business_images'] = $business_images;
$other_images = explode(',',$data['other_images']);
foreach($other_images as $key => $o_i){
$other_images[$key] = $domain_name.$o_i;
}
$data['other_images'] = $other_images;
}
$this->assign('user_id',$this->user_id);
$this->assign('data',$data);
$this->assign('title','商家入驻');
$options = [
'app_id' => config('wechat.app_id'),
'secret' => config('wechat.secret'),
... ...
... ... @@ -38,7 +38,7 @@
营业执照<i>*</i>
</div>
<div class="submit_img">
<div class="submit_img_add">
<div class="submit_img_add upload_one">
<img src="__CDN__/assets/advertising/img/add.png" alt="">
</div>
{foreach name="$data.business_images" item="b_i"}
... ... @@ -57,7 +57,7 @@
其他证件
</div>
<div class="submit_img">
<div class="submit_img_add">
<div class="submit_img_add upload_two">
<img src="__CDN__/assets/advertising/img/add.png" alt="">
</div>
{foreach name="$data.other_images" item="o_i"}
... ... @@ -83,19 +83,31 @@
{$jssdk}
);
wx.ready(function () {
$('.upload').click(function () {
$('.upload_one').click(function () {
wx.chooseImage({
count: 1, // 默认9
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success: function (res) {
$(res.localIds).each(function (key, localId) {
uploadImages(localId);
uploadImages(localId,1);
});
}
});
});
function uploadImages(localId) {
$('.upload_two').click(function () {
wx.chooseImage({
count: 1, // 默认9
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success: function (res) {
$(res.localIds).each(function (key, localId) {
uploadImages(localId,2);
});
}
});
});
function uploadImages(localId,type) {
wx.uploadImage({
localId: localId,
isShowProgressTips: 1,
... ... @@ -108,6 +120,11 @@
success:function(res){
console.log(res);
if(res.code == 1){
if(type == 1){
}else if(type == 2){
}
$('.upload').find('img').attr('src',res.data);
$('#avatar').val(res.data);
}
... ...