Commit 52104f93 by 李伟康

feat(HomeFrame): 新增学习中心未读消息提示功能

- 在 LeftSide 组件中添加未读消息提示逻辑
- 在 HomeFrame 组件中显示提示框
- 优化消息提示的样式和动画效果
1 parent d43166f2
<template>
<view class="container" @click="handleTouchStart">
<view
class="container"
@click="handleTouchStart"
>
<view :class="['home', { show: !id && showHome }]">
<left-side :userInfo="userInfo" :tabIndex.sync="tabIndex" ref="leftBox" @changeTab="changeTab" @stopAudio="stopAudio" />
<left-side
:userInfo="userInfo"
:tabIndex.sync="tabIndex"
ref="leftBox"
@changeTab="changeTab"
@stopAudio="stopAudio"
@showReadCountTips="showReadCountTips"
/>
<view
class="tips-box"
:style="tipsObject.style"
@click.stop="closeTips"
>{{tipsObject.text}}</view>
<view class="right-side">
<template v-if="tabIndex == 0">
<view class="right-content">
<view class="start" @click="$emit('start')">
<image class="start-btn" src="../../assets/images/home/start.gif" alt="开始接待" />
<image class="start-border" src="../../assets/images/home/start-border.png" />
<view
class="start"
@click="$emit('start')"
>
<image
class="start-btn"
src="../../assets/images/home/start.gif"
alt="开始接待"
/>
<image
class="start-border"
src="../../assets/images/home/start-border.png"
/>
</view>
<view class="module-list">
<slot name="module" />
......@@ -15,12 +40,26 @@
</view>
</template>
<template v-else-if="tabIndex == 99">
<component is="Point" ref="pointRef" :userInfo="userInfo" @showPage="handleShowPage" />
<component
:is="'Point'"
ref="pointRef"
:userInfo="userInfo"
@showPage="handleShowPage"
/>
</template>
<template v-else>
<component :is="componentName" @handleOperation="handleOperation" ref="pointRef" :userInfo="userInfo" @showPage="handleShowPage" />
<component
:is="componentName"
@handleOperation="handleOperation"
ref="pointRef"
:userInfo="userInfo"
@showPage="handleShowPage"
/>
</template>
<view class="store-addr" v-if="footerBox">
<view
class="store-addr"
v-if="footerBox"
>
<view class="icon-addr sprite-icon icon-addr"></view>
<view class="addr-text">{{ userInfo.shopMerchantName }}</view>
</view>
......@@ -29,17 +68,41 @@
<view :class="['detail', { show: id }]">
<slot name="detail" />
</view>
<view class="point-page" v-if="!showHome">
<component :is="pointComponentName" @backHome="backHome" @jump="jump" :transfer="transfer" />
<view
class="point-page"
v-if="!showHome"
>
<component
:is="pointComponentName"
@backHome="backHome"
@jump="jump"
:transfer="transfer"
/>
</view>
<!-- 未点击开始接待,弹窗 -->
<MessageBox ref="previewRef" @confirm="$emit('preview')" :popupW="704" content="直接点击素材可进行预览,若面向车主展示,请点击「开始接待」" confirmBtnText="预览素材" @cancel="$emit('previewCancel')" @close="$emit('previewClose')"></MessageBox>
<MessageBox
ref="previewRef"
@confirm="$emit('preview')"
:popupW="704"
content="直接点击素材可进行预览,若面向车主展示,请点击「开始接待」"
confirmBtnText="预览素材"
@cancel="$emit('previewCancel')"
@close="$emit('previewClose')"
></MessageBox>
<!-- 停留弹框 -->
<!-- <MessageBox ref="tipBox" @cancel="tipCancel" @confirm="tipConfirm" content="系统检测到您在当前页面停留较久,是否仍在客户接待中?" cancelBtnText="否" confirmBtnText="是"></MessageBox> -->
<!-- 退出弹框 -->
<MessageBox :popupW="704" ref="finish" :content="finishContene" :isFooter="false">
<MessageBox
:popupW="704"
ref="finish"
:content="finishContene"
:isFooter="false"
>
<view class="footer">
<view class="footer-btn confirm flex" @click="$emit('openStep')">
<view
class="footer-btn confirm flex"
@click="$emit('openStep')"
>
<template v-if="finishDoneText">
{{ finishDoneText }}
</template>
......@@ -48,7 +111,10 @@
<text>(推荐)</text>
</template>
</view>
<view class="footer-btn cancel flex" @click="$emit('backHome')">
<view
class="footer-btn cancel flex"
@click="$emit('backHome')"
>
仍要退出
<text>(不推荐)</text>
</view>
......@@ -57,9 +123,23 @@
<!-- 升级弹框 -->
<update-box />
<slot name="content" />
<web-view @message="handlerMessage" ref="webview" src="/hybrid/html/index.html"></web-view>
<web-view ref="studyWebview" :src="jumpUrl" v-if="showBeisen"></web-view>
<image v-if="showLeadPage" @click="showLeadPage = false" class="lead-page" src="../../assets/images/noviceGuide/lead-page.png" mode="scaleToFill" />
<web-view
@message="handlerMessage"
ref="webview"
src="/hybrid/html/index.html"
></web-view>
<web-view
ref="studyWebview"
:src="jumpUrl"
v-if="showBeisen"
></web-view>
<image
v-if="showLeadPage"
@click="showLeadPage = false"
class="lead-page"
src="../../assets/images/noviceGuide/lead-page.png"
mode="scaleToFill"
/>
</view>
</template>
<script>
......@@ -96,7 +176,7 @@ export default {
default: '当前操作视为强制退出接待,若需正常流程完成接待请点击「完成接待」'
}
},
data() {
data () {
return {
studyUrl: '',
jumpUrl: '',
......@@ -108,35 +188,36 @@ export default {
tabIndex: 0,
showLeadPage: false,
showBeisen: false,
tokenUrl: ''
tokenUrl: '',
tipsObject: {}
}
},
mounted() {
mounted () {
const userInfo = uni.$storage.get('userInfo') || {}
this.userInfo = userInfo
this.checkVersion()
this.checkLead()
},
provide() {
provide () {
return {
showPage: this.handleShowPage,
hideFooter: this.handleFooter
}
},
computed: {
previewRef() {
previewRef () {
return this.$refs.previewRef
},
finishRef() {
finishRef () {
return this.$refs.finish
},
componentName() {
componentName () {
console.log(this.$refs.leftBox.tabs, this.tabIndex, this.$refs.leftBox.tabs[this.tabIndex].name)
return this.$refs.leftBox.tabs[this.tabIndex].name
}
},
methods: {
async changeTab($event, jumpUrl, tokenUrl) {
async changeTab ($event, jumpUrl, tokenUrl) {
console.log($event, 'event', tokenUrl)
this.$emit('changeTab', $event)
if ($event == 3) {
......@@ -150,22 +231,22 @@ export default {
})
return
}
} else {
this.jumpUrl = ''
}
},
handleFooter(val) {
handleFooter (val) {
this.footerBox = val
},
backHome() {
backHome () {
this.showHome = true
console.log(this.$refs.pointRef)
Promise.resolve().then(() => {
this.$refs.pointRef?.$refs?.centerRef?.init && this.$refs.pointRef.$refs.centerRef.init()
})
},
jump(val) {
jump (val) {
this.showHome = true
if (val == 'CustomerFile') {
this.tabIndex = 2
......@@ -173,12 +254,12 @@ export default {
}
this.$emit('start')
},
handleShowPage(name, transfer) {
handleShowPage (name, transfer) {
this.transfer = transfer
this.showHome = false
this.pointComponentName = name
},
checkLead() {
checkLead () {
let leadPage = uni.$storage.get('leadPage') || []
const { phone } = this.userInfo
const version = plus?.runtime?.version || '' // 平板
......@@ -200,22 +281,22 @@ export default {
}
}
},
handleOperation(val, data) {
handleOperation (val, data) {
console.log(val, data, 'val, data')
const { type } = val;
// 提取公共的webview设置逻辑
const setWebviewStyle = () => {
setTimeout(() => {
const currentWebview = this.$parent.$scope.$getAppWebview();
const wv = currentWebview.children()[1];
if (wv) {
wv.setStyle({
left: '8%',
top: '3%',
height: '97%',
width: '92%'
wv.setStyle({
left: '8%',
top: '3%',
height: '97%',
width: '92%'
});
} else {
this.jumpUrl = '';
......@@ -234,22 +315,22 @@ export default {
appCode: 'Learning',
id: COURSE_ID
};
const queryString = Object.entries(params)
.map(([key, value]) => `${key}=${value}`)
.join('&');
const url = encodeURIComponent(`${baseUrl}?${queryString}#/viewDynamic?1=1`);
this.jumpUrl = `${this.tokenUrl}&return_url=${url}`;
};
// 根据操作类型执行相应逻辑
switch(type) {
switch (type) {
case 'openCourse':
this.showBeisen = true;
setWebviewStyle();
break;
case 'courseDetail':
handleCourseDetail();
this.showBeisen = true;
......@@ -259,10 +340,22 @@ export default {
}
},
// 学习中心修改阅读状态,打开后才修改
async getStudyCenterRead(id) {
async getStudyCenterRead (id) {
console.log(id, 'getStudyCenterRead')
const res = await uni.$api.commonApi.getStudyCenterRead({ id })
console.log(res)
},
showReadCountTips (res) {
this.tipsObject = res
},
closeTips () {
this.$refs.leftBox.readCount = 0
this.tipsObject = {
style: '',
text: ''
}
}
}
}
......@@ -270,6 +363,21 @@ export default {
<style scoped lang="scss">
.container {
position: relative;
.tips-box {
position: absolute;
color: #ffffff;
font-size: toRpx(28);
width: toRpx(310);
height: toRpx(90);
line-height: toRpx(64);
background-image: url('@/assets/images/home/daliog.png');
background-size: 100% 100%;
z-index: 9;
padding-left: toRpx(60);
text-align: left;
display: none;
opacity: 0;
}
&::after {
content: '';
position: absolute;
......
......@@ -121,7 +121,6 @@
</template>
<script type='text/ecmascript-6'>
import dayjs from 'dayjs'
import utils from '@/utils/utils'
export default {
......@@ -420,7 +419,7 @@ export default {
.detail-box {
background: #f5f8fc;
overflow: hidden;
opacity: 0;
.content-box {
transform: translateY(-100%);
}
......@@ -522,6 +521,7 @@ export default {
@keyframes hide-box {
100% {
height: toRpx(80);
opacity: 1;
}
}
......@@ -633,7 +633,8 @@ export default {
right: toRpx(20);
font-size: toRpx(24);
color: #757980;
display: inline-block;
display: inline-flex;
align-items: center;
height: toRpx(36);
border-radius: toRpx(16);
padding: 0 toRpx(22) 0 toRpx(12);
......
......@@ -163,29 +163,29 @@ export default {
}
.quality-block {
.title {
height: 80rpx;
height: toRpx(80);
background: linear-gradient(119.9deg, #e1f7fc 0%, #f3f7ff 27%, #f7f2ff 41%, #e8f1ff 66%, #f7f2ff 100%);
font-size: 28rpx;
font-size: toRpx(28);
font-weight: 600;
padding: 0 20rpx;
padding: 0 toRpx(20);
&::before {
content: '';
width: 8rpx;
height: 8rpx;
width: toRpx(8);
height: toRpx(8);
background: #000000;
border-radius: 100%;
display: block;
margin-right: 16rpx;
margin-right: toRpx(16);
}
.matched-btn {
margin-left: auto;
height: 56rpx;
border-radius: 28rpx;
height: toRpx(56);
border-radius: toRpx(28);
background: #ffffff;
padding: 0 36rpx;
padding: 0 toRpx(36);
color: #eb4e4e;
font-size: 24rpx;
font-size: toRpx(24);
font-weight: 600;
}
.hit {
......@@ -239,7 +239,7 @@ export default {
}
}
.script-rec {
padding: 24rpx;
padding: toRpx(24);
.suggestions-box {
background: #ffffff;
border-radius: toRpx(16);
......
......@@ -124,7 +124,7 @@ export default {
<style scoped lang='scss'>
.quality-table-box {
.quality-table {
height: 872rpx;
height: toRpx(872);
width: 100%;
box-sizing: border-box;
border-radius: toRpx(16);
......@@ -144,7 +144,7 @@ export default {
}
}
.row-1 {
width: 272rpx;
width: toRpx(272);
}
.row-2 {
width: toRpx(248);
......@@ -178,7 +178,7 @@ export default {
box-sizing: border-box;
}
.row-3 {
padding: 24rpx 48rpx;
padding: toRpx(24) toRpx(48);
justify-content: flex-start;
}
}
......
......@@ -56,17 +56,17 @@ export default {
<style scoped lang='scss'>
.tags-box {
padding-bottom: 24rpx;
padding-bottom: toRpx(24);
.tags-flex {
gap: 20rpx;
gap: toRpx(20);
flex-wrap: wrap;
.tag {
height: 64rpx;
border-radius: 16rpx;
height: toRpx(64);
border-radius: toRpx(16);
background: #edf3ff;
padding: 0 20rpx;
padding: 0 toRpx(20);
color: #4673ff;
font-size: 28rpx;
font-size: toRpx(28);
}
}
}
......
......@@ -202,6 +202,7 @@ export default {
this.status = 'ending'
this.currentTime = this.formatTime(this.qualityAudio.duration)
this.dialogueRef.isPlayIng = false
this.isOperate = true
})
},
onTimeUpdate () {
......@@ -515,7 +516,7 @@ export default {
background: #ffffff;
box-sizing: border-box;
overflow-y: auto;
padding: 0 40rpx;
padding: 0 toRpx(40);
}
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!