细节优化
parent
986f7068bd
commit
f95f93fc14
|
|
@ -21,6 +21,14 @@
|
|||
{{/foreach}}
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label>{{$data.common_app_is_use_mobile_detail.name}}<span class="am-form-group-label-tips">{{$data.common_app_is_use_mobile_detail.describe}}</span></label>
|
||||
<select name="{{$data.common_app_is_use_mobile_detail.only_tag}}" class="am-radius chosen-select c-p" data-validation-message="{{$data.common_app_is_use_mobile_detail.error_tips}}" required>
|
||||
{{foreach $common_is_text_list as $v}}
|
||||
<option value="{{$v.id}}" {{if isset($data['common_app_is_use_mobile_detail']['value']) and $data['common_app_is_use_mobile_detail']['value'] eq $v['id']}}selected{{/if}}>{{$v.name}}</option>
|
||||
{{/foreach}}
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label>{{$data.common_app_customer_service_tel.name}}</label>
|
||||
<input type="text" name="{{$data.common_app_customer_service_tel.only_tag}}" placeholder="{{$data.common_app_customer_service_tel.name}}" data-validation-message="{{$data.common_app_customer_service_tel.error_tips}}" class="am-radius" {{if !empty($data)}}value="{{$data.common_app_customer_service_tel.value}}"{{/if}} />
|
||||
|
|
|
|||
|
|
@ -50,6 +50,9 @@ class Goods extends Common
|
|||
return DataReturn('参数有误', -1);
|
||||
}
|
||||
|
||||
// 商品详情方式
|
||||
$is_use_mobile_detail = intval(MyC('common_app_is_use_mobile_detail'));
|
||||
|
||||
// 获取商品
|
||||
$goods_id = intval($this->data_post['goods_id']);
|
||||
$params = [
|
||||
|
|
@ -59,14 +62,32 @@ class Goods extends Common
|
|||
],
|
||||
'is_photo' => true,
|
||||
'is_spec' => true,
|
||||
'is_content_app' => true,
|
||||
'is_content_app' => ($is_use_mobile_detail == 1),
|
||||
];
|
||||
$ret = GoodsService::GoodsList($params);
|
||||
if(empty($ret['data'][0]) || $ret['data'][0]['is_delete_time'] != 0)
|
||||
{
|
||||
return DataReturn('商品不存在或已删除', -1);
|
||||
}
|
||||
unset($ret['data'][0]['content_web']);
|
||||
|
||||
// 商品详情处理
|
||||
if($is_use_mobile_detail == 1)
|
||||
{
|
||||
unset($ret['data'][0]['content_web']);
|
||||
} else {
|
||||
// 标签处理,兼容小程序rich-text
|
||||
$search = [
|
||||
'<img ',
|
||||
'<section',
|
||||
'/section>'
|
||||
];
|
||||
$replace = [
|
||||
'<img style="max-width:100%;margin:0;display:block;" ',
|
||||
'<div',
|
||||
'/div>',
|
||||
];
|
||||
$ret['data'][0]['content_web'] = str_replace($search, $replace, $ret['data'][0]['content_web']);
|
||||
}
|
||||
|
||||
// 当前登录用户是否已收藏
|
||||
$ret_favor = GoodsService::IsUserGoodsFavor(['goods_id'=>$goods_id, 'user'=>$this->user]);
|
||||
|
|
@ -82,6 +103,7 @@ class Goods extends Common
|
|||
$result = [
|
||||
'goods' => $ret['data'][0],
|
||||
'common_order_is_booking' => (int) MyC('common_order_is_booking', 0),
|
||||
'is_use_mobile_detail' => $is_use_mobile_detail,
|
||||
];
|
||||
return DataReturn('success', 0, $result);
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -50,7 +50,9 @@
|
|||
<text class="text-wrapper">详情</text>
|
||||
</view>
|
||||
<!-- web详情 -->
|
||||
<rich-text a:if="{{is_use_mobile_detail == 0}}" nodes="{{goods.content_web || ''}}"></rich-text>
|
||||
<view a:if="{{is_use_mobile_detail == 0}}" class="bg-white">
|
||||
<rich-text nodes="{{goods.content_web || ''}}"></rich-text>
|
||||
</view>
|
||||
<!-- 手机独立详情 -->
|
||||
<block a:if="{{is_use_mobile_detail == 1 && goods_content_app.length > 0}}">
|
||||
<view a:for="{{goods_content_app}}" class="goods-detail-app bg-white">
|
||||
|
|
|
|||
|
|
@ -61,7 +61,9 @@
|
|||
<text class="text-wrapper">详情</text>
|
||||
</view>
|
||||
<!-- web详情 -->
|
||||
<rich-text wx:if="{{is_use_mobile_detail == 0}}" nodes="{{goods.content_web || ''}}"></rich-text>
|
||||
<view wx:if="{{is_use_mobile_detail == 0}}" class="bg-white">
|
||||
<rich-text nodes="{{goods.content_web || ''}}"></rich-text>
|
||||
</view>
|
||||
<!-- 手机独立详情 -->
|
||||
<block wx:if="{{is_use_mobile_detail == 1 && goods_content_app.length > 0}}">
|
||||
<view wx:for="{{goods_content_app}}" wx:key="key" class="goods-detail-app bg-white">
|
||||
|
|
|
|||
Loading…
Reference in New Issue