Commit da22f5e7 by 李伟康

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

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