Commit d4bbaf71 by 李伟康

```

feat(activity): 新增活动弹框功能

- 新增 getActivityMessagePopUpWindow 接口用于获取活动弹框
- 新增 updateActivityMessagePopUpWindow 接口用于更新活动弹框状态
- 创建 ActivityPopup.vue 组件实现活动弹框展示功能
- 支持两种活动类型(获奖名单和销售竞赛)的弹框展示
- 实现弹框状态更新和跳转活动中心功能

style(leftSide): 优化组件代码格式

- 调整模板语法格式,统一使用属性绑定格式
- 修正函数声明格式,统一使用箭头函数写法
- 优化代码可读性和规范性

feat(setting): 新增账号注销功能

- 在设置弹框中新增注销按钮
- 实现账号注销确认弹窗功能
- 更新隐私协议链接文案为《隐私协议》
- 保持原有退出和切换账号功能不变
```
1 parent 1c2f6af7
import http from '../request/http'
module.exports = {
/**活动列表 */
activityPage(data) {
return http.post({
method: 'risk.manage.api.activity.pad.page',
projectName: 'pad',
...data
})
},
/**荣誉墙 */
activityReward(data) {
return http.post({
method: 'risk.manage.api.activity.reward',
projectName: 'pad',
...data
})
}
}
import http from '../request/http'
module.exports = {
/**活动列表 */
activityPage(data) {
return http.post({
method: 'risk.manage.api.activity.pad.page',
projectName: 'pad',
...data
})
},
/**荣誉墙 */
activityReward(data) {
return http.post({
method: 'risk.manage.api.activity.reward',
projectName: 'pad',
...data
})
},
/**
* 获取活动弹框
*/
getActivityMessagePopUpWindow(data) {
return http.post({
method: 'dj.pad.api.activity.message.pop.up.window',
projectName: 'pad',
...data
})
},
/**
* 更新活动弹框状态
*/
updateActivityMessagePopUpWindow(data) {
return http.post({
method: 'dj.pad.api.activity.pop.up.window.update',
projectName: 'pad',
...data
})
},
}
<template>
<uni-popup
ref="popup"
border-radius="20px"
@maskClick="updateActivity"
>
<view class="activity-box">
<view
class="close flex"
@click="close"
>
<uni-icons
type="closeempty"
:size="18"
color="#1A1A1A"
></uni-icons>
</view>
<image
:src="bgUrl"
class="bg"
/>
<view class="content">
<view class="title">{{ title }}</view>
<view class="description">{{ description }}</view>
</view>
<view
class="btn"
@click="jump"
></view>
</view>
</uni-popup>
</template>
<script type="text/ecmascript-6">
export default {
name: 'ActivityPopup',
data () {
return {
data: {}
}
},
computed: {
bgUrl () {
let { type } = this.data
return `https://img02.glsx.com.cn/weapp/resource/app-tape/common/activity-${type}.webp`
},
title () {
return this.data.activityName || ''
},
description () {
return {
0: '获奖名单已出炉!快来看看是谁斩获大奖,围观本期“销售之星”。',
1: '新的销售竞赛活动已发布!请尽快查阅评选规则与奖励方案,力争上游!'
}[this.data.type]
},
},
mounted () {
},
methods: {
open (data) {
this.data = data
this.$refs.popup.open("center");
},
close () {
this.$refs.popup.close()
this.updateActivity()
},
jump () {
this.close()
uni.$emit('ActivityCenter')
},
async updateActivity () {
const { msgId } = this.data
await uni.$api.activityApi.updateActivityMessagePopUpWindow({
msgId
})
}
}
}
</script>
<style scoped lang="scss">
.activity-box {
position: relative;
width: toRpx(1400);
height: toRpx(928);
// background: #ffffff;
border-radius: toRpx(64);
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
.close {
position: absolute;
width: toRpx(160);
height: toRpx(160);
top: 0;
right: 0;
justify-content: center;
}
.bg {
position: absolute;
width: 100%;
height: 100%;
z-index: -1;
}
.content {
position: absolute;
top: toRpx(284);
right: toRpx(100);
width: toRpx(650);
.title {
color: #333333;
font-size: toRpx(56);
font-weight: 700;
margin-bottom: toRpx(24);
line-height: toRpx(80);
display: -webkit-box;
word-break: break-all;
overflow: hidden;
text-overflow: ellipsis;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.description {
color: #999999;
font-size: toRpx(34);
line-height: toRpx(52);
}
}
.btn {
position: absolute;
width: toRpx(516);
height: toRpx(120);
right: toRpx(266);
bottom: toRpx(116);
}
}
</style>
<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>
......@@ -32,19 +49,40 @@
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>
......@@ -61,7 +99,7 @@ export default {
userInfo: Object
},
name: '',
data() {
data () {
return {
messageData: {
classCountList: [],
......@@ -80,7 +118,7 @@ export default {
}
},
watch: {
userInfo(n) {
userInfo (n) {
console.log('userInfo', n)
if (n.shopMerchantId) this.haveCustomerAccess(n)
},
......@@ -92,10 +130,10 @@ export default {
// }
},
computed: {
perRecordNumber() {
perRecordNumber () {
return this.$store.state.audio.perRecordNumber
},
sceneTypeList() {
sceneTypeList () {
const sceneTypeObject = {
1: {
title: '轻改',
......@@ -132,7 +170,7 @@ export default {
return result
},
// 这个tabs进来的值更新触发顺序是 getStudyCenterPermission的方法变更 => 计算属性的变更 => userInfo的监听变更 => haveCustomerAccess的变更。 计算属性的变更后的更新值是不会重新触发渲染的
tabs() {
tabs () {
const tabs = [
{
label: "首页",
......@@ -200,7 +238,7 @@ export default {
},
inject: ['showPage'],
methods: {
getUnreadCount() {
getUnreadCount () {
let _this = this
uni.$api.commonApi.getUnreadCount({}).then(res => {
this.readCount = res.data
......@@ -236,15 +274,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 => {
......@@ -254,7 +292,7 @@ export default {
})
})
},
handleActivityCenter() {
handleActivityCenter () {
console.log('ActivityCenter triggered'); // 添加日志查看触发次数
let { tabs } = this;
let index = tabs.findIndex(e => e.name == 'ActivityCenter');
......@@ -262,7 +300,7 @@ export default {
this.changeIndex(index, this.tabs[index]);
}
},
async changeIndex(index, item) {
async changeIndex (index, item) {
if (item.eventCode) uni.$track.add({
eventCode: item.eventCode
})
......@@ -283,13 +321,13 @@ export default {
this.findBeiSenSSOToken()
}
},
async haveCustomerAccess(val) {
async haveCustomerAccess (val) {
const { shopMerchantId, sceneType: scene } = val
uni.$api.customerApi.saleOpen({
merchantId: shopMerchantId,
scene
}).then(result => {
console.log('有客户权限',result)
console.log('有客户权限', result)
if (result) {
this.hasPerson = true
// this.activityTabVisible = scene !== 7
......@@ -325,7 +363,7 @@ export default {
})
},
// 获取话术未读列表
async getMessage() {
async getMessage () {
const { sceneType, uuid } = uni.$storage.get("userInfo")
let businessTypeList = []
if (sceneType == 0) {
......@@ -341,8 +379,9 @@ export default {
if (res.total) {
this.messageData = res
this.messageType = 'attendance'
this.$refs.kfRef.open()
this.openStudyPopup()
}
return Promise.resolve(res.total)
},
// 消息中心未读总数
// async getMessageCount () {
......@@ -354,7 +393,8 @@ export default {
// this.messageTotal = res
// },
// 学习中心消息弹窗,优先级高于有修改话术弹窗
async getMessagePop() {
async getMessagePop () {
this.$store.dispatch('setIndexMessagePopupStatus', true)
const res = await uni.$api.commonApi.getMessagePop({})
if (res.ids && res.ids.length > 0) {
if (Array.isArray(res.moduleTypeList) && (res.moduleTypeList.includes(3) || res.moduleTypeList.includes(4))
......@@ -362,7 +402,7 @@ export default {
// 3, 4学习任务弹窗
this.messageType = 'study'
this.messageData = res
this.$refs.kfRef.open()
this.openStudyPopup()
// 确认消息
if (res.ids.length) {
uni.$api.commonApi.getStudyTaskConfirm({
......@@ -372,21 +412,25 @@ export default {
} else {
this.messageType = 'system'
this.messageData = res
this.$refs.kfRef.open()
this.openStudyPopup()
}
} else {
await this.getMessage()
const data = await this.getMessage()
if(!data) this.$store.dispatch('setIndexMessagePopupStatus', false)
}
},
openPop() {
openStudyPopup () {
this.$refs.kfRef.open()
},
openPop () {
uni.navigateTo({
url: `/pages/common/messageList`
})
},
getMessageInfo() {
getMessageInfo () {
this.getMessagePop()
},
jumpPersonCenter() {
jumpPersonCenter () {
if (this.hasPerson) {
uni.$track.add({
eventCode: 'app_personal_center'
......@@ -395,7 +439,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
......@@ -414,7 +458,7 @@ export default {
url
})
},
openScenePopup() {
openScenePopup () {
this.$refs.sceneTypeRef.open()
uni.$track.add({
eventCode: 'app_scene_change'
......@@ -424,12 +468,12 @@ export default {
getStudyCenterPermission () {
const userInfo = uni.$storage.get('userInfo')
const res = uni.$storage.get('studyCenterPermission')
if(!res){
uni.$api.commonApi.getStudyCenterPermission({}).then(res => {
uni.$storage.set('studyCenterPermission', res)
console.log(res,'res')
})
}
if (!res) {
uni.$api.commonApi.getStudyCenterPermission({}).then(res => {
uni.$storage.set('studyCenterPermission', res)
console.log(res, 'res')
})
}
if (userInfo.sceneType == 7) {
this.tabs[2].hidden = true
}
......@@ -440,11 +484,11 @@ export default {
}
}
},
beforeCreate() {
beforeCreate () {
// clearInterval(this.trackInterval)
// this.trackInterval = null
},
beforeDestroy() {
beforeDestroy () {
// uni.$off('pageBack')
// uni.$off('studyCenter')
uni.$off('ActivityCenter', this.handleActivityCenter);
......
......@@ -195,6 +195,7 @@ export default {
this.$refs.home.updateApp(true)
},
async onShow () {
this.getActivityMessage()
const userInfo = uni.$storage.get("userInfo")
if (!userInfo.shopMerchantId || !userInfo.shopMerchantName) {
uni.$storage.rm("userInfo");
......@@ -210,6 +211,10 @@ export default {
computed: {
},
methods: {
getActivityMessage () {
if (this.$refs.home) this.$refs.home.getActivityMessage()
else setTimeout(this.getActivityMessage, 200)
},
...mapMutations("audio", ["setReceptionStatus"]),
init () {
const userInfo = uni.$storage.get("userInfo"),
......
export default {
token: (state) => state.user.token,
siteData: (state) => state.site.siteData,
userData: (state) => state.user.userData,
userId: (state) => state.user.userData.id,
isInBackgound: (state) => state.sys.isInBackgound,
customerInfo: (state) => state.user.customerInfo,
receptionTrack: (state) => state.user.receptionTrack,
receptionStatus: (state) => state.audio.receptionStatus,
booksList: (state) => state.audio.booksList,
receptionKey: (state) => state.user.receptionKey,
customerKey: (state) => state.user.customerKey
};
export default {
token: (state) => state.user.token,
siteData: (state) => state.site.siteData,
userData: (state) => state.user.userData,
userId: (state) => state.user.userData.id,
isInBackgound: (state) => state.sys.isInBackgound,
customerInfo: (state) => state.user.customerInfo,
receptionTrack: (state) => state.user.receptionTrack,
receptionStatus: (state) => state.audio.receptionStatus,
booksList: (state) => state.audio.booksList,
receptionKey: (state) => state.user.receptionKey,
customerKey: (state) => state.user.customerKey,
indexMessagePopupStatus: (state) => state.sys.indexMessagePopupStatus,
};
export default {
state() {
return {
isInBackgound: false
}
},
mutations: {
SET_BACKGROUND_STATE(state, value) {
state.isInBackgound = value
}
},
actions: {
setBackgroundState({ commit }, value) {
uni.$logger.local.info(`【==== ${['切回', '切出'][+value]} ====】 APP`)
commit('SET_BACKGROUND_STATE', value)
}
}
}
export default {
state() {
return {
isInBackgound: false,
indexMessagePopupStatus: true, // 首页弹窗状态
}
},
mutations: {
SET_BACKGROUND_STATE(state, value) {
state.isInBackgound = value
},
SET_INDEX_MESSAGE_POPUP_STATUS(state, value){
state.indexMessagePopupStatus = value
}
},
actions: {
setBackgroundState({ commit }, value) {
uni.$logger.local.info(`【==== ${['切回', '切出'][+value]} ====】 APP`)
commit('SET_BACKGROUND_STATE', value)
},
setIndexMessagePopupStatus({ commit }, value){
commit('SET_INDEX_MESSAGE_POPUP_STATUS', value)
}
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!