Commit 52104f93 by 李伟康

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

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