feat: 完成商家改版相关页面与请求工具修改
This commit is contained in:
parent
d5d7242ec7
commit
1e56c78f12
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<view class="container">
|
||||
<view class="positonFixed">
|
||||
<view class="header-top flex-row-center" :style="{ height: `${100}rpx`,paddingTop:`${statusBarHeight}rpx`}">
|
||||
<view class="header-top flex-row-center" :style="{ height: `${100 + statusBarHeight}rpx`,paddingTop:`${statusBarHeight}rpx`}">
|
||||
<view class="left-area" @click="goBack">
|
||||
<image src="/static/images/back.png" mode="aspectFit" class="back-icon"></image>
|
||||
</view>
|
||||
|
|
@ -25,7 +25,7 @@
|
|||
<swiper class="swiper" circular :style="swiperStyle" :current="current" @change="swiperChange"
|
||||
:disable-touch="current==0">
|
||||
<swiper-item>
|
||||
<scroll-view scroll-y :style="{height:`${viewportHeight-100-this.statusBarHeight}rpx`}">
|
||||
<scroll-view scroll-y :style="{height:`${viewportHeight - 100 - statusBarHeight}rpx`}">
|
||||
<view class="swiper-items3">
|
||||
<view class="swiper-item3" :class="{item2Left:index%2 == 0}"
|
||||
v-for="(item,index) in videoList" :key="index" @click="tovideo(item)">
|
||||
|
|
@ -40,7 +40,7 @@
|
|||
</scroll-view>
|
||||
</swiper-item>
|
||||
<swiper-item>
|
||||
<scroll-view scroll-y :style="{height:`${viewportHeight-100-this.statusBarHeight-100}rpx`}">
|
||||
<scroll-view scroll-y :style="{height:`${viewportHeight - 100 - statusBarHeight - 100}rpx`}">
|
||||
<view class="swiper-items2">
|
||||
<view class="swiper-item2" :class="{item2Left:index%2 == 0}"
|
||||
v-for="(item,index) in imagObj[cardListIndex]" :key="index" @click="toimg(item)">
|
||||
|
|
@ -166,7 +166,7 @@
|
|||
};
|
||||
}
|
||||
return {
|
||||
height: `${this.viewportHeight}rpx`
|
||||
height: `${this.viewportHeight - 100 - this.statusBarHeight}rpx`
|
||||
};
|
||||
},
|
||||
swiperStyle2() {
|
||||
|
|
@ -176,7 +176,7 @@
|
|||
};
|
||||
}
|
||||
return {
|
||||
height: `${this.viewportHeight}rpx`
|
||||
height: `${this.viewportHeight - 100 - this.statusBarHeight}rpx`
|
||||
};
|
||||
},
|
||||
swiperStyle3() {
|
||||
|
|
|
|||
|
|
@ -542,7 +542,7 @@ export default {
|
|||
|
||||
// 获取:通知公告列表
|
||||
fetchNoticeList() {
|
||||
request.post('/sj/notice/list', { page: 1, limit: 6 }).then(res => {
|
||||
request.post('/sj/notice/list', { page: 1, limit: 5 }).then(res => {
|
||||
if(res.code == 200 && res.data && res.data.list.length > 0) {
|
||||
this.noticeList = res.data.list;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,22 +1,16 @@
|
|||
<template>
|
||||
<view class="brand-detail-page">
|
||||
|
||||
<custom-navbar
|
||||
:title="info.name || '品牌详情'"
|
||||
<custom-navbar :title="info.name || '品牌详情'"
|
||||
:leftImg="'https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/60ae3383-6ff6-4f42-818b-d9b09a9bd0e0.png'"
|
||||
:showUser="true"
|
||||
backgroundColor="#ffffff"
|
||||
titleColor="#333"
|
||||
borderBottom="none"
|
||||
:show-headle="true"
|
||||
:headleSrc="isCollected ? iconCollectOn : iconCollectOff"
|
||||
@onHeadleClick="toggleCollectStatus"
|
||||
>
|
||||
:showUser="true" backgroundColor="#ffffff" titleColor="#333" borderBottom="none" :show-headle="true"
|
||||
:headleSrc="isCollected ? iconCollectOn : iconCollectOff" @onHeadleClick="toggleCollectStatus">
|
||||
</custom-navbar>
|
||||
|
||||
<!-- 顶部导航栏扩展:动态计算位置的拨号图标 -->
|
||||
<view class="nav-phone-wrap" :style="{ top: phoneIconTop + 'px', right: phoneIconRight + 'px' }" @click="makeCall">
|
||||
<image src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/c164280f-1ab9-41b4-9d60-846368364e9c.png" class="nav-phone-icon"></image>
|
||||
<image src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/c164280f-1ab9-41b4-9d60-846368364e9c.png"
|
||||
class="nav-phone-icon"></image>
|
||||
</view>
|
||||
|
||||
<!-- <view class="mock-switch" @click="toggleMockData">
|
||||
|
|
@ -26,15 +20,8 @@
|
|||
<view class="banner-section" v-if="bannerList && bannerList.length || info.video">
|
||||
|
||||
<!-- 原生视频组件 (就地播放) -->
|
||||
<video
|
||||
v-if="info.video && isVideoPlaying"
|
||||
id="myVideo"
|
||||
class="banner-video"
|
||||
:src="info.video"
|
||||
autoplay
|
||||
controls
|
||||
object-fit="cover"
|
||||
></video>
|
||||
<video v-if="info.video && isVideoPlaying" id="myVideo" class="banner-video" :src="info.video" autoplay controls
|
||||
object-fit="cover"></video>
|
||||
|
||||
<!-- 轮播图区域 (当视频播放时隐藏) -->
|
||||
<swiper v-else class="banner-swiper" circular @change="onSwiperChange" :autoplay="!info.video">
|
||||
|
|
@ -44,12 +31,9 @@
|
|||
</swiper>
|
||||
|
||||
<!-- 居中的视频播放大图标 (当视频播放时隐藏) -->
|
||||
<image
|
||||
v-if="info.video && !isVideoPlaying"
|
||||
class="center-play-icon"
|
||||
<image v-if="info.video && !isVideoPlaying" class="center-play-icon"
|
||||
src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/bb720bb0-4ada-49f6-9ce5-38abfd613d5d.png"
|
||||
@click="playVideoInPlace"
|
||||
></image>
|
||||
@click="playVideoInPlace"></image>
|
||||
|
||||
<!-- 视频/图片 相册切换组件 (当视频播放时隐藏) -->
|
||||
<view class="album" v-if="(info.video || bannerList.length > 0) && !isVideoPlaying">
|
||||
|
|
@ -72,7 +56,7 @@
|
|||
<view class="intro-section" v-if="info.name">
|
||||
<view class="section-title">品牌介绍</view>
|
||||
<view class="intro-content" :class="{ 'is-expanded': isExpanded }">
|
||||
<text v-html="info.detail || '暂无品牌介绍'" class="intro-text"></text>
|
||||
<rich-text :nodes="formatDetailContent" class="intro-text"></rich-text>
|
||||
</view>
|
||||
<view class="expand-btn" @click="toggleExpand" v-if="info.detail && info.detail.length > 100">
|
||||
<text class="expand-text">{{ isExpanded ? '收起查看' : '展开查看' }}</text>
|
||||
|
|
@ -84,13 +68,8 @@
|
|||
<view class="divider-bg"></view>
|
||||
<view class="tab-section">
|
||||
<view class="tab-header">
|
||||
<view
|
||||
class="tab-item"
|
||||
v-for="(tab, index) in availableTabs"
|
||||
:key="tab.key"
|
||||
:class="{ active: activeTab === index }"
|
||||
@click="switchTab(index)"
|
||||
>
|
||||
<view class="tab-item" v-for="(tab, index) in availableTabs" :key="tab.key"
|
||||
:class="{ active: activeTab === index }" @click="switchTab(index)">
|
||||
<!-- 加上 class="tab-text" 以便控制层级 -->
|
||||
<text class="tab-text">{{ tab.name }}</text>
|
||||
<view v-if="activeTab === index" class="active-line"></view>
|
||||
|
|
@ -117,7 +96,8 @@
|
|||
|
||||
<view class="form-item">
|
||||
<view class="label"><text class="required">*</text>手机号码</view>
|
||||
<input class="input-el" type="number" maxlength="11" v-model="formData.contact_phone" placeholder="请输入您的手机号码" placeholder-class="ph-style" />
|
||||
<input class="input-el" type="number" maxlength="11" v-model="formData.contact_phone" placeholder="请输入您的手机号码"
|
||||
placeholder-class="ph-style" />
|
||||
</view>
|
||||
|
||||
<view class="form-item">
|
||||
|
|
@ -143,7 +123,8 @@
|
|||
|
||||
<view class="form-item border-none" v-if="formData.intention === 1">
|
||||
<view class="label"><text class="required">*</text>其他意向</view>
|
||||
<input class="input-el" v-model="formData.intention_other" placeholder="请填写您的其他意向" placeholder-class="ph-style" />
|
||||
<input class="input-el" v-model="formData.intention_other" placeholder="请填写您的其他意向"
|
||||
placeholder-class="ph-style" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
|
@ -159,9 +140,7 @@
|
|||
<text class="popup-close" @click="hideLocationPopup">×</text>
|
||||
</view>
|
||||
<view class="region-body">
|
||||
<picker-view @change="bindChangeLocation"
|
||||
class="picker-scroll"
|
||||
:indicator-style="indicatorStyle"
|
||||
<picker-view @change="bindChangeLocation" class="picker-scroll" :indicator-style="indicatorStyle"
|
||||
:value="locationValue">
|
||||
<picker-view-column>
|
||||
<view class="picker-item" v-for="(item, index) in ChinaCitys" :key="index">{{ item.province }}</view>
|
||||
|
|
@ -254,6 +233,8 @@ export default {
|
|||
|
||||
cityNameText: '',
|
||||
intentionText: '',
|
||||
hasSubmitted: false,
|
||||
submittedData: null,
|
||||
|
||||
intentionOptions: [
|
||||
{ value: 2, label: '品牌加盟' },
|
||||
|
|
@ -268,6 +249,18 @@ export default {
|
|||
activeTabKey() {
|
||||
return this.availableTabs[this.activeTab]?.key || '';
|
||||
},
|
||||
formatDetailContent() {
|
||||
const html = this.info.detail;
|
||||
if (!html) return '<div style="color:#999;font-size:13px;text-align:center;">暂无品牌介绍</div>';
|
||||
|
||||
let newHtml = html.replace(/<img[^>]*>/gi, function (match) {
|
||||
match = match.replace(/style\s*=\s*["'][^"']*["']/gi, '');
|
||||
return match.replace(/<img/gi, '<img style="max-width:100%; height:auto; display:block; border-radius:20rpx; margin:8px 0;"');
|
||||
});
|
||||
|
||||
newHtml = newHtml.replace(/<p[^>]*>/gi, '<p style="margin-bottom: 0px; line-height: 1.6; word-break: break-all;">');
|
||||
return newHtml;
|
||||
},
|
||||
availableTabs() {
|
||||
const tabs = [];
|
||||
|
||||
|
|
@ -572,9 +565,31 @@ export default {
|
|||
return;
|
||||
}
|
||||
|
||||
// 检查是否重复提交
|
||||
if (this.hasSubmitted && this.submittedData) {
|
||||
const currentData = JSON.stringify({
|
||||
contact_name: this.formData.contact_name,
|
||||
contact_phone: this.formData.contact_phone,
|
||||
province_code: this.formData.province_code,
|
||||
city_code: this.formData.city_code,
|
||||
area_code: this.formData.area_code,
|
||||
intention: this.formData.intention,
|
||||
intention_other: this.formData.intention_other
|
||||
});
|
||||
if (currentData === this.submittedData) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '未修改内容,不能再次提交',
|
||||
showCancel: false,
|
||||
confirmText: '知道了'
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.useMockData) {
|
||||
uni.showToast({ title: '模拟环境下留言提交成功!', icon: 'success' });
|
||||
this.resetForm();
|
||||
this.saveSubmittedData();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -582,7 +597,7 @@ export default {
|
|||
request.post("/sj/brand/consult", this.formData).then((res) => {
|
||||
if (res.code == 200) {
|
||||
uni.showToast({ title: '留言提交成功!', icon: 'success', duration: 2000 });
|
||||
this.resetForm();
|
||||
this.saveSubmittedData();
|
||||
} else {
|
||||
uni.showToast({ title: res.msg || '提交失败', icon: 'none' });
|
||||
}
|
||||
|
|
@ -593,6 +608,19 @@ export default {
|
|||
});
|
||||
},
|
||||
|
||||
saveSubmittedData() {
|
||||
this.hasSubmitted = true;
|
||||
this.submittedData = JSON.stringify({
|
||||
contact_name: this.formData.contact_name,
|
||||
contact_phone: this.formData.contact_phone,
|
||||
province_code: this.formData.province_code,
|
||||
city_code: this.formData.city_code,
|
||||
area_code: this.formData.area_code,
|
||||
intention: this.formData.intention,
|
||||
intention_other: this.formData.intention_other
|
||||
});
|
||||
},
|
||||
|
||||
resetForm() {
|
||||
this.formData = {
|
||||
id: this.brandId,
|
||||
|
|
@ -892,7 +920,8 @@ export default {
|
|||
margin: 20rpx 0;
|
||||
}
|
||||
|
||||
::v-deep p, ::v-deep div {
|
||||
::v-deep p,
|
||||
::v-deep div {
|
||||
margin-bottom: 24rpx;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
|
@ -934,7 +963,8 @@ export default {
|
|||
}
|
||||
}
|
||||
|
||||
.input-el, .picker-el {
|
||||
.input-el,
|
||||
.picker-el {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
|
|
@ -997,7 +1027,8 @@ export default {
|
|||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 9999; /* 层级调高,防止被挡住 */
|
||||
z-index: 9999;
|
||||
/* 层级调高,防止被挡住 */
|
||||
visibility: hidden;
|
||||
opacity: 0;
|
||||
transition: all 0.3s ease;
|
||||
|
|
|
|||
Loading…
Reference in New Issue