Commit da22f5e7 by 李伟康

fix(home-frame): 修复组件模板语法错误

- 修复了模板中缺失的右括号导致的语法错误
- 确保了组件结构的完整性
- 修正了模板解析问题以避免渲染异常
1 parent d9263984
<template> <template>
<view class="left-side"> <view class="left-side">
<view class="user-box"> <view class="user-box">
<view <view class="user-info flex" @click="jumpPersonCenter">
class="user-info flex"
@click="jumpPersonCenter"
>
<view :class="['user-avatar', 'sprite-icon', 'icon-avatar', tabIndex == 99 ? 'user-active' : '']"></view> <view :class="['user-avatar', 'sprite-icon', 'icon-avatar', tabIndex == 99 ? 'user-active' : '']"></view>
<view class="user-name"> <view class="user-name">
<view class="user-name-text">{{ userInfo.name }}</view> <view class="user-name-text">{{ userInfo.name }}</view>
<view <view v-if="hasPerson" class="sprite-icon icon-arrow-next"></view>
v-if="hasPerson"
class="sprite-icon icon-arrow-next"
></view>
</view> </view>
</view> </view>
</view> </view>
<view :class="['left-tabs', { three: tabs.length == 3 }]"> <view :class="['left-tabs', { three: tabs.length == 3 }]">
<template v-for="(i, index) in tabs"> <template v-for="(i, index) in tabs">
<view <view :class="['tab-item', { tabActive: tabIndex == index }]" :key="index" @click="changeIndex(index, i)"
:class="['tab-item', { tabActive: tabIndex == index }]" v-if="!i.hidden && (i.name !== 'ActivityCenter' || activityTabVisible)">
:key="index"
@click="changeIndex(index, i)"
v-if="!i.hidden && (i.name !== 'ActivityCenter' || activityTabVisible)"
>
<view class="icon-box"> <view class="icon-box">
<view :class="['sprite-icon', `icon-${i.icon}${tabIndex == index ? '-active' : ''}`]"></view> <view :class="['sprite-icon', `icon-${i.icon}${tabIndex == index ? '-active' : ''}`]"></view>
</view> </view>
{{ i.label }} {{ i.label }}
<view <view class="dot" v-if="i.icon == 'record' && perRecordNumber"></view>
class="dot" <view class="tip-box" v-if="i.icon == 'study' && readCount">待办事项:{{ readCount }}</view>
v-if="i.icon == 'record' && perRecordNumber"
></view>
<view
class="tip-box"
v-if="i.icon == 'study' && readCount"
>待办事项:{{ readCount }}</view>
</view> </view>
</template> </template>
</view> </view>
...@@ -49,40 +33,20 @@ ...@@ -49,40 +33,20 @@
v-if="messageTotal > 0" v-if="messageTotal > 0"
></view> ></view>
</view> --> </view> -->
<view <view class="btn" @click="openScenePopup">
class="btn"
@click="openScenePopup"
>
<view class="sprite-icon icon-scene-change"></view> <view class="sprite-icon icon-scene-change"></view>
</view> </view>
<view <view class="btn" @click="handleSetting">
class="btn"
@click="handleSetting"
>
<view class="sprite-icon icon-setting"></view> <view class="sprite-icon icon-setting"></view>
</view> </view>
</view> </view>
<!-- 客服弹框 --> <!-- 客服弹框 -->
<!-- <kf-box ref="kfRef" /> --> <!-- <kf-box ref="kfRef" /> -->
<message-pop <message-pop ref="kfRef" :type="messageType" :messageData="messageData"></message-pop>
ref="kfRef"
:type="messageType"
:messageData="messageData"
></message-pop>
<!-- 设置弹框 --> <!-- 设置弹框 -->
<setting-box <setting-box ref="settingRef" @stopAudio="$emit('stopAudio')" />
ref="settingRef" <center-popup :list="sceneTypeList" ref="sceneTypeRef" @choose="chooseSceneType" title="选择场景" tag="当前场景"
@stopAudio="$emit('stopAudio')" :id="userInfo.sceneType" isLine />
/>
<center-popup
:list="sceneTypeList"
ref="sceneTypeRef"
@choose="chooseSceneType"
title="选择场景"
tag="当前场景"
:id="userInfo.sceneType"
isLine
/>
</view> </view>
</template> </template>
...@@ -99,7 +63,7 @@ export default { ...@@ -99,7 +63,7 @@ export default {
userInfo: Object userInfo: Object
}, },
name: '', name: '',
data () { data() {
return { return {
messageData: { messageData: {
classCountList: [], classCountList: [],
...@@ -119,12 +83,12 @@ export default { ...@@ -119,12 +83,12 @@ export default {
} }
}, },
watch: { watch: {
userInfo (n) { userInfo(n) {
if (n.shopMerchantId) this.haveCustomerAccess(n) if (n.shopMerchantId) this.haveCustomerAccess(n)
}, },
activityWindowPopStatus:{ activityWindowPopStatus: {
handler (n) { handler(n) {
if(n == 1) this.getMessageInfo() if (n == 1) this.getMessageInfo()
}, },
immediate: true, immediate: true,
deep: true deep: true
...@@ -136,10 +100,10 @@ export default { ...@@ -136,10 +100,10 @@ export default {
// } // }
}, },
computed: { computed: {
perRecordNumber () { perRecordNumber() {
return this.$store.state.audio.perRecordNumber return this.$store.state.audio.perRecordNumber
}, },
sceneTypeList () { sceneTypeList() {
const sceneTypeObject = { const sceneTypeObject = {
1: { 1: {
title: '轻改', title: '轻改',
...@@ -176,7 +140,7 @@ export default { ...@@ -176,7 +140,7 @@ export default {
return result return result
}, },
// 这个tabs进来的值更新触发顺序是 getStudyCenterPermission的方法变更 => 计算属性的变更 => userInfo的监听变更 => haveCustomerAccess的变更。 计算属性的变更后的更新值是不会重新触发渲染的 // 这个tabs进来的值更新触发顺序是 getStudyCenterPermission的方法变更 => 计算属性的变更 => userInfo的监听变更 => haveCustomerAccess的变更。 计算属性的变更后的更新值是不会重新触发渲染的
tabs () { tabs() {
const tabs = [ const tabs = [
{ {
label: "首页", label: "首页",
...@@ -215,11 +179,11 @@ export default { ...@@ -215,11 +179,11 @@ export default {
if (sceneType == 7) tabs[1].hidden = true if (sceneType == 7) tabs[1].hidden = true
return tabs return tabs
}, },
activityWindowPopStatus () { activityWindowPopStatus() {
return this.$store.state.sys.activityWindowPopStatus return this.$store.state.sys.activityWindowPopStatus
}, },
}, },
created () { created() {
uni.$on('ActivityCenter', this.handleActivityCenter); uni.$on('ActivityCenter', this.handleActivityCenter);
// uni.$on('ActivityCenter', () => { // uni.$on('ActivityCenter', () => {
...@@ -244,7 +208,7 @@ export default { ...@@ -244,7 +208,7 @@ export default {
}, },
inject: ['showPage'], inject: ['showPage'],
methods: { methods: {
getUnreadCount () { getUnreadCount() {
let _this = this let _this = this
uni.$api.commonApi.getUnreadCount({}).then(res => { uni.$api.commonApi.getUnreadCount({}).then(res => {
this.readCount = res.data this.readCount = res.data
...@@ -280,15 +244,15 @@ export default { ...@@ -280,15 +244,15 @@ export default {
// this.leaveTrack() // this.leaveTrack()
// }, 5000) // }, 5000)
// }, // },
clickHome () { clickHome() {
if (this.tabs[this.tabIndex].isTrack) if (this.tabs[this.tabIndex].isTrack)
this.changeIndex(0, this.tabs[0]) this.changeIndex(0, this.tabs[0])
}, },
handleSetting () { handleSetting() {
this.$refs.settingRef.open() this.$refs.settingRef.open()
this.clickHome() this.clickHome()
}, },
findBeiSenSSOToken () { findBeiSenSSOToken() {
return new Promise(resolve => { return new Promise(resolve => {
const url = 'https%3A%2F%2Fcloud.italent.cn%2FPageHome%2FIndex%3Fproduct%3DLearning%26keyName%3DNusion%26pageCode%3DLearningNewHomepage%26appCode%3DLearning%26_qsrcapp%3DLearning%26_qrt%3Dhtml%26quark_s%3D5102bff371c00da5b19968ee53a8c3f1499ecd2447a19f72f3e3ba2390cc9617%23%2FviewDynamic%3Fshadow_context%3D%257BappModel%253A%2522italent%2522%252Cuppid%253A%25221%2522%257D%26quark_s%3D028930f1066f8ef8d28790940d53ae64337f44bde3a44cf89a290e4a3611e3e2' const url = 'https%3A%2F%2Fcloud.italent.cn%2FPageHome%2FIndex%3Fproduct%3DLearning%26keyName%3DNusion%26pageCode%3DLearningNewHomepage%26appCode%3DLearning%26_qsrcapp%3DLearning%26_qrt%3Dhtml%26quark_s%3D5102bff371c00da5b19968ee53a8c3f1499ecd2447a19f72f3e3ba2390cc9617%23%2FviewDynamic%3Fshadow_context%3D%257BappModel%253A%2522italent%2522%252Cuppid%253A%25221%2522%257D%26quark_s%3D028930f1066f8ef8d28790940d53ae64337f44bde3a44cf89a290e4a3611e3e2'
uni.$api.commonApi.findBeiSenSSOToken({}).then(res => { uni.$api.commonApi.findBeiSenSSOToken({}).then(res => {
...@@ -298,14 +262,14 @@ export default { ...@@ -298,14 +262,14 @@ export default {
}) })
}) })
}, },
handleActivityCenter () { handleActivityCenter() {
let { tabs } = this; let { tabs } = this;
let index = tabs.findIndex(e => e.name == 'ActivityCenter'); let index = tabs.findIndex(e => e.name == 'ActivityCenter');
if (index !== -1) { if (index !== -1) {
this.changeIndex(index, this.tabs[index]); this.changeIndex(index, this.tabs[index]);
} }
}, },
async changeIndex (index, item) { async changeIndex(index, item) {
if (item.eventCode) uni.$track.add({ if (item.eventCode) uni.$track.add({
eventCode: item.eventCode eventCode: item.eventCode
}) })
...@@ -326,7 +290,7 @@ export default { ...@@ -326,7 +290,7 @@ export default {
this.findBeiSenSSOToken() this.findBeiSenSSOToken()
} }
}, },
async haveCustomerAccess (val) { async haveCustomerAccess(val) {
const { shopMerchantId, sceneType: scene } = val const { shopMerchantId, sceneType: scene } = val
uni.$api.customerApi.saleOpen({ uni.$api.customerApi.saleOpen({
merchantId: shopMerchantId, merchantId: shopMerchantId,
...@@ -367,7 +331,7 @@ export default { ...@@ -367,7 +331,7 @@ export default {
}) })
}, },
// 获取话术未读列表 // 获取话术未读列表
async getMessage () { async getMessage() {
const { sceneType, uuid } = uni.$storage.get("userInfo") const { sceneType, uuid } = uni.$storage.get("userInfo")
let businessTypeList = [] let businessTypeList = []
if (sceneType == 0) { if (sceneType == 0) {
...@@ -388,9 +352,12 @@ export default { ...@@ -388,9 +352,12 @@ export default {
return Promise.resolve(res.total) return Promise.resolve(res.total)
}, },
// 弹窗推送优先级:1)学习策略/长课程推送 2)优秀案例分享 3)优秀话术推送 4)任务通知(企业通知) 5)活动中心 // 弹窗推送优先级:1)学习策略/长课程推送 2)优秀案例分享 3)优秀话术推送 4)任务通知(企业通知) 5)活动中心
async getMessagePop () { async getMessagePop() {
this.hasPopupOpen = false this.hasPopupOpen = false
const {sceneType} = uni.$storage.get("userInfo") const pages = getCurrentPages(),
currentPage = pages[pages.length - 1]
if (!['pages/equity/index', 'pages/boutique/index'].includes(currentPage.route)) return this.$store.dispatch('setActivityWindowPopCount', 0)
const { sceneType } = uni.$storage.get("userInfo")
const caseParams = { const caseParams = {
pageNum: 1, pageNum: 1,
pageSize: 1, pageSize: 1,
...@@ -401,7 +368,7 @@ export default { ...@@ -401,7 +368,7 @@ export default {
// 1. 学习策略弹窗 // 1. 学习策略弹窗
caseParams.moduleType = 6 caseParams.moduleType = 6
const studyCaseRes = await uni.$api.commonApi.getBoxPage(caseParams) const studyCaseRes = await uni.$api.commonApi.getBoxPage(caseParams)
if(studyCaseRes.list.length) { if (studyCaseRes.list.length) {
this.messageType = 'caseStudy' this.messageType = 'caseStudy'
this.messageData = studyCaseRes.list[0] this.messageData = studyCaseRes.list[0]
this.openPopup() this.openPopup()
...@@ -409,7 +376,7 @@ export default { ...@@ -409,7 +376,7 @@ export default {
} }
// 2. 长课程推送 // 2. 长课程推送
const longCourseRes = await uni.$api.commonApi.getLongCourseNotify() const longCourseRes = await uni.$api.commonApi.getLongCourseNotify()
if(longCourseRes.count > 0) { if (longCourseRes.count > 0) {
this.messageType = 'study' this.messageType = 'study'
this.messageData = longCourseRes this.messageData = longCourseRes
this.openPopup() this.openPopup()
...@@ -424,7 +391,7 @@ export default { ...@@ -424,7 +391,7 @@ export default {
// 3. 优秀案例分享 // 3. 优秀案例分享
caseParams.moduleType = 7 caseParams.moduleType = 7
const caseRes = await uni.$api.commonApi.getBoxPage(caseParams) const caseRes = await uni.$api.commonApi.getBoxPage(caseParams)
if(caseRes.list.length) { if (caseRes.list.length) {
this.messageType = 'caseShare' this.messageType = 'caseShare'
this.messageData = caseRes.list[0] this.messageData = caseRes.list[0]
this.openPopup() this.openPopup()
...@@ -436,7 +403,7 @@ export default { ...@@ -436,7 +403,7 @@ export default {
// 5. 企业通知推送 // 5. 企业通知推送
const enterpriseRes = await uni.$api.commonApi.getEnterpriseNotify() const enterpriseRes = await uni.$api.commonApi.getEnterpriseNotify()
if(enterpriseRes.ids || enterpriseRes.businessIds) { if (enterpriseRes.ids || enterpriseRes.businessIds) {
this.messageType = 'system' this.messageType = 'system'
this.messageData = enterpriseRes this.messageData = enterpriseRes
this.openPopup() this.openPopup()
...@@ -445,21 +412,21 @@ export default { ...@@ -445,21 +412,21 @@ export default {
// 6. 活动中心弹窗 // 6. 活动中心弹窗
if (this.activityWindowPopStatus == 1) this.$store.dispatch('setActivityWindowPopCount', 2) if (this.activityWindowPopStatus == 1) this.$store.dispatch('setActivityWindowPopCount', 2)
}, },
openPopup () { openPopup() {
this.$refs.kfRef.open() this.$refs.kfRef.open()
this.hasPopupOpen = true this.hasPopupOpen = true
this.$store.dispatch('setActivityWindowPopCount', 0) this.$store.dispatch('setActivityWindowPopCount', 0)
this.$emit('closeActivityCenter') this.$emit('closeActivityCenter')
}, },
openPop () { openPop() {
uni.navigateTo({ uni.navigateTo({
url: `/pages/common/messageList` url: `/pages/common/messageList`
}) })
}, },
getMessageInfo () { getMessageInfo() {
this.getMessagePop() this.getMessagePop()
}, },
jumpPersonCenter () { jumpPersonCenter() {
if (this.hasPerson) { if (this.hasPerson) {
uni.$track.add({ uni.$track.add({
eventCode: 'app_personal_center' eventCode: 'app_personal_center'
...@@ -468,7 +435,7 @@ export default { ...@@ -468,7 +435,7 @@ export default {
this.$emit('update:tabIndex', 99) this.$emit('update:tabIndex', 99)
} }
}, },
chooseSceneType (index) { chooseSceneType(index) {
let { userInfo, sceneTypeList } = this, let { userInfo, sceneTypeList } = this,
sceneType = sceneTypeList[index].id sceneType = sceneTypeList[index].id
if (sceneType == userInfo.sceneType) return if (sceneType == userInfo.sceneType) return
...@@ -487,14 +454,14 @@ export default { ...@@ -487,14 +454,14 @@ export default {
url url
}) })
}, },
openScenePopup () { openScenePopup() {
this.$refs.sceneTypeRef.open() this.$refs.sceneTypeRef.open()
uni.$track.add({ uni.$track.add({
eventCode: 'app_scene_change' eventCode: 'app_scene_change'
}) })
}, },
// 学习中心权限获取,场景集市权限 // 学习中心权限获取,场景集市权限
getStudyCenterPermission () { getStudyCenterPermission() {
const userInfo = uni.$storage.get('userInfo') const userInfo = uni.$storage.get('userInfo')
const res = uni.$storage.get('studyCenterPermission') const res = uni.$storage.get('studyCenterPermission')
if (!res) { if (!res) {
...@@ -512,11 +479,11 @@ export default { ...@@ -512,11 +479,11 @@ export default {
} }
} }
}, },
beforeCreate () { beforeCreate() {
// clearInterval(this.trackInterval) // clearInterval(this.trackInterval)
// this.trackInterval = null // this.trackInterval = null
}, },
beforeDestroy () { beforeDestroy() {
// uni.$off('pageBack') // uni.$off('pageBack')
// uni.$off('studyCenter') // uni.$off('studyCenter')
uni.$off('ActivityCenter', this.handleActivityCenter); uni.$off('ActivityCenter', this.handleActivityCenter);
......
...@@ -730,8 +730,11 @@ export default { ...@@ -730,8 +730,11 @@ export default {
}, },
async getActivityMessage() { async getActivityMessage() {
this.$store.dispatch('setActivityWindowPopCount', 0) this.$store.dispatch('setActivityWindowPopCount', 0)
const { sceneType } = this const { sceneType } = this,
pages = getCurrentPages(),
currentPage = pages[pages.length - 1]
if (sceneType == 7) return // 二手车业务无活动中心 if (sceneType == 7) return // 二手车业务无活动中心
if (!['pages/equity/index', 'pages/boutique/index'].includes(currentPage.route)) return
const data = await uni.$api.activityApi.getActivityMessagePopUpWindow({ const data = await uni.$api.activityApi.getActivityMessagePopUpWindow({
businessType: sceneType businessType: sceneType
}) })
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!