提交 c6cdba8c 作者: 毛细亚

Merge branch '6.2' into 6.3

...@@ -15,7 +15,16 @@ ...@@ -15,7 +15,16 @@
ref="menuRef" ref="menuRef"
> >
<el-menu-item v-for="item in menuList" :key="item.path" :index="item.path" class="mobile-menu-item"> <el-menu-item v-for="item in menuList" :key="item.path" :index="item.path" class="mobile-menu-item">
{{ item.label }} <!-- 任务列表菜单项显示红点 -->
<div v-if="item.path === '/taskList' && hasTaskRedDot" class="menu-item-with-badge">
<div class="task-badge">
<el-badge is-dot>
<span>{{ item.label }}</span>
</el-badge>
</div>
</div>
<!-- 普通菜单项 -->
<span v-else>{{ item.label }}</span>
</el-menu-item> </el-menu-item>
</el-menu> </el-menu>
...@@ -43,10 +52,11 @@ ...@@ -43,10 +52,11 @@
<script> <script>
import bindUserList from '@/views/components/bindGameAccount/bindUserList.vue' import bindUserList from '@/views/components/bindGameAccount/bindUserList.vue'
import { getToken } from '@/utils/auth' import { getToken } from '@/utils/auth'
import { mapState, mapMutations } from 'vuex' import { mapState, mapMutations, mapActions } from 'vuex'
import Cookies from 'js-cookie' import Cookies from 'js-cookie'
import { getParams } from '@/utils/index' import { getParams } from '@/utils/index'
import Debug from '@/components/debug.vue' import Debug from '@/components/debug.vue'
export default { export default {
name: 'App', name: 'App',
components: { components: {
...@@ -99,7 +109,8 @@ export default { ...@@ -99,7 +109,8 @@ export default {
}, },
{ {
label: '任务列表', label: '任务列表',
path: '/taskList' path: '/taskList',
hasRedDot: false // 红点状态
}, },
// { // {
// label: '通讯录', // label: '通讯录',
...@@ -113,7 +124,12 @@ export default { ...@@ -113,7 +124,12 @@ export default {
} }
}, },
computed: { computed: {
...mapState('user', ['external_userid', 'token']), ...mapState('user', ['external_userid', 'token', 'userInfo']),
...mapState('game', ['taskData']),
// 计算任务列表是否需要显示红点
hasTaskRedDot() {
return this.taskData.user_task > 0 || this.taskData.account_task > 0
}
}, },
watch: { watch: {
'$route.path'(val) { '$route.path'(val) {
...@@ -125,6 +141,18 @@ export default { ...@@ -125,6 +141,18 @@ export default {
} }
console.log('路由变化:', val, '选中路径:', this.selectedPath) console.log('路由变化:', val, '选中路径:', this.selectedPath)
}, },
// 监听用户信息变化,只在初始化时获取一次任务数据
userInfo: {
handler(newVal, oldVal) {
if (newVal && newVal.id && (!oldVal || !oldVal.id)) {
console.log('用户信息初始化完成,获取任务数据:', newVal)
// 只在用户信息第一次设置时获取任务数据
this.getTaskUnReadData()
}
},
deep: true,
immediate: true
},
// 监听 external_userid 的变化,确保界面及时更新 // 监听 external_userid 的变化,确保界面及时更新
external_userid: { external_userid: {
handler(newVal) { handler(newVal) {
...@@ -181,6 +209,7 @@ export default { ...@@ -181,6 +209,7 @@ export default {
methods: { methods: {
...mapMutations('user', ['set_userid', 'set_corp_id', 'set_token', 'set_cser_info', 'set_cser_id', 'set_cser_name', 'set_userInfo']), ...mapMutations('user', ['set_userid', 'set_corp_id', 'set_token', 'set_cser_info', 'set_cser_id', 'set_cser_name', 'set_userInfo']),
...mapMutations('game', ['set_accountSelect']), ...mapMutations('game', ['set_accountSelect']),
...mapActions('game', ['getTaskUnReadData']),
// 设置缓存 // 设置缓存
cacheCorp_id(corp_id) { cacheCorp_id(corp_id) {
Cookies.set('corp_id', corp_id, { expires: 7 }) Cookies.set('corp_id', corp_id, { expires: 7 })
...@@ -205,23 +234,6 @@ export default { ...@@ -205,23 +234,6 @@ export default {
handleSelect(key, keyPath) { handleSelect(key, keyPath) {
console.log('菜单选择:', key, keyPath, window.location.href) console.log('菜单选择:', key, keyPath, window.location.href)
}, },
initVuexValue(){
this.set_userid(Cookies.get('userid'))
this.set_corp_id(Cookies.get('corp_id'))
this.set_token(Cookies.get('token'))
this.set_cser_id(Cookies.get('cser_id'))
this.set_cser_name(Cookies.get('cser_name'))
const userinfo = {
cser_id:Cookies.get('cser_id'),
cser_name:Cookies.get('cser_name'),
username:Cookies.get('cser_name'),
id:Cookies.get('cser_id'),
}
this.set_userInfo(userinfo)
const cser_info = Cookies.get('cser_info')
console.log(Cookies.get('cser_id'),'cser_info',Cookies.get('cser_name'))
cser_info?this.set_cser_info(JSON.parse(cser_info)):this.set_cser_info({})
},
// 切换菜单展开收起状态 // 切换菜单展开收起状态
toggleMenu() { toggleMenu() {
this.isMenuExpanded = !this.isMenuExpanded this.isMenuExpanded = !this.isMenuExpanded
...@@ -366,4 +378,23 @@ export default { ...@@ -366,4 +378,23 @@ export default {
body { body {
background: #f0f2f5; background: #f0f2f5;
} }
/* 任务列表菜单项红点样式 */
.menu-item-with-badge {
display: inline-block;
}
.task-badge {
::v-deep .el-badge__content.is-dot {
top: 8px !important;
right: -5px !important;
}
}
/* 确保菜单项内容居中 */
.mobile-menu-item .menu-item-with-badge {
display: flex;
align-items: center;
justify-content: center;
}
</style> </style>
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// 管理公共的store // 管理公共的store
import { zyouBindMember } from '@/api/works' import { zyouBindMember } from '@/api/works'
import { getTaskTotal } from '@/api/game'
import Cookies from 'js-cookie' import Cookies from 'js-cookie'
// 从本地缓存获取accountSelect // 从本地缓存获取accountSelect
...@@ -15,6 +16,13 @@ const state = { ...@@ -15,6 +16,13 @@ const state = {
chatUserInfo: {}, // 当前选中的用户的详情 chatUserInfo: {}, // 当前选中的用户的详情
viewLoading:false, // 查看用户详情的时候 加载状态 viewLoading:false, // 查看用户详情的时候 加载状态
taskDetails: {}, // 任务详情 taskDetails: {}, // 任务详情
// 任务数据
taskData: {
user_task: 0,
account_task: 0,
operator_task: 0,
lastUpdateTime: null
},
} }
const mutations = { const mutations = {
...@@ -38,6 +46,13 @@ const mutations = { ...@@ -38,6 +46,13 @@ const mutations = {
}, },
set_taskDetails(state, data) { set_taskDetails(state, data) {
state.taskDetails = data state.taskDetails = data
},
// 设置任务数据
set_taskData(state, data) {
state.taskData = {
...data,
lastUpdateTime: Date.now()
}
} }
} }
...@@ -62,6 +77,46 @@ const actions = { ...@@ -62,6 +77,46 @@ const actions = {
}) })
}) })
}, },
// 获取任务数据
async getTaskUnReadData({ commit, rootState }) {
return new Promise( async (resolve, reject) => {
try {
// 确保用户信息存在
if (!rootState.user.userInfo || !rootState.user.userInfo.id) {
console.log('用户信息不存在,跳过任务数据获取')
return
}
const data = {
zw_user_id: rootState.user.userInfo.id
}
console.log('开始获取任务数据:', data)
const res = await getTaskTotal(data)
if (res.status_code === 1) {
// 使用真实的 API 响应数据
const responseData = res.data.data || {}
const taskData = {
user_task: responseData.user_num || 0,
account_task: responseData.member_num || 0,
operator_task: Number(responseData.user_num || 0) + Number(responseData.member_num || 0)
}
commit('set_taskData', taskData)
resolve(taskData)
return taskData
} else {
reject(res.msg)
console.error('获取任务数据失败:', res.msg)
}
} catch (error) {
reject(error)
console.error('获取任务数据异常:', error)
throw error
}
})
}
} }
export default { export default {
......
...@@ -76,7 +76,7 @@ const mutations = { ...@@ -76,7 +76,7 @@ const mutations = {
}, },
set_client_online_status(state, status) { set_client_online_status(state, status) {
state.client_online_status = status state.client_online_status = status
}, }
} }
const actions = { const actions = {
......
...@@ -50,8 +50,10 @@ ...@@ -50,8 +50,10 @@
<div <div
v-for="(items,indexs) in item.children" v-for="(items,indexs) in item.children"
:key="indexs" :key="indexs"
class="gameListItem rowFlex columnCenter spaceBetween gameListItemAc" class="gameListItemChange"
> >
<p v-if="item.group_name" style="margin-left: 10px;" class="gameName">{{ item.group_name }}</p>
<div class="gameListItem rowFlex columnCenter spaceBetween gameListItemAc">
<p class="rowFlex columnCenter spaceBetween"> <p class="rowFlex columnCenter spaceBetween">
<el-popover <el-popover
placement="top" placement="top"
...@@ -86,6 +88,7 @@ ...@@ -86,6 +88,7 @@
>发送礼包码</el-button> >发送礼包码</el-button>
</div> </div>
</div> </div>
</div>
<div <div
v-else v-else
class="rowFlex allCenter" class="rowFlex allCenter"
...@@ -227,6 +230,7 @@ ...@@ -227,6 +230,7 @@
item.label = item.main_game_name + '/' + item.main_game_id item.label = item.main_game_name + '/' + item.main_game_id
item.value = item.main_game_id item.value = item.main_game_id
item.children = item.gift_package_list item.children = item.gift_package_list
item.group_name = item.gift_package_group_name
}) })
}, },
// 发送渠道 // 发送渠道
...@@ -349,6 +353,7 @@ ...@@ -349,6 +353,7 @@
.gameListItem { .gameListItem {
width: 100%; width: 100%;
height: 40px; height: 40px;
padding-left: 20px;
.gameName{ .gameName{
max-width: 120px; max-width: 120px;
overflow: hidden; overflow: hidden;
......
...@@ -235,7 +235,7 @@ ...@@ -235,7 +235,7 @@
<layer <layer
:show.sync="showLayer" :show.sync="showLayer"
title="填写跟进结果" title="填写跟进结果"
width="400px" width="320px"
@confirm="onConfirm" @confirm="onConfirm"
> >
<div class="editLayer"> <div class="editLayer">
...@@ -511,9 +511,13 @@ ...@@ -511,9 +511,13 @@
this.assionInfo = { ...this.assionInfo, ...this.todayOrder } this.assionInfo = { ...this.assionInfo, ...this.todayOrder }
}, },
async taskRecord() { async taskRecord() {
const res = await taskRecord({ task_id: this.taskDetails.id }) const res = await taskRecord({ task_id: this.taskDetails.id,user_type:'' })
console.log(res.data.data, 'res.data.data') console.log(res.data.data, 'res.data.data')
this.remarks = res.data.data[0] if(res.data.data.length > 0){
this.remarks = res.data.data[0].remarks
}else{
this.remarks = [{remark:''}]
}
}, },
async memberBindExternalUser() { async memberBindExternalUser() {
let member_list = [] let member_list = []
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
<el-form-item <el-form-item
label="跟进客服:" label="跟进客服:"
> >
<p class="text" style="margin-left: 10px;">{{ item.tracer_name }}</p> <p class="text" style="margin-left: 10px;">{{ item.tracer_name || '--' }}</p>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label="待维护日期:" label="待维护日期:"
...@@ -167,6 +167,7 @@ ...@@ -167,6 +167,7 @@
</div> </div>
<div <div
v-else-if="!loading && orderList.length == 0" v-else-if="!loading && orderList.length == 0"
style="margin-top: 100px;"
class="noContent rowFlex allCenter" class="noContent rowFlex allCenter"
> >
<noContent /> <noContent />
...@@ -622,15 +623,13 @@ ...@@ -622,15 +623,13 @@
.money { .money {
width: 100%; width: 100%;
height: auto; height: auto;
padding-left: 10px;
.btns { .btns {
padding-right: 40px; margin-right: 20px;
} }
.btn { .btn {
background: #fff; background: #fff;
border-radius: 4px; border-radius: 4px;
padding: 2px 5px; padding: 2px 5px;
margin-left: 10px;
font-size: 12px; font-size: 12px;
border: 1px solid rgba(0, 0, 0, 0.15); border: 1px solid rgba(0, 0, 0, 0.15);
color: #333333; color: #333333;
...@@ -729,6 +728,7 @@ ...@@ -729,6 +728,7 @@
color: #333333; color: #333333;
font-size: 14px; font-size: 14px;
font-weight: 400; font-weight: 400;
padding: 0 5px;
/* 单行显示省略号 */ /* 单行显示省略号 */
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
......
...@@ -4,24 +4,17 @@ ...@@ -4,24 +4,17 @@
<el-tabs v-model="taskForm.type" @tab-click="taskTypeChange"> <el-tabs v-model="taskForm.type" @tab-click="taskTypeChange">
<el-tab-pane v-for="(item, index) in typeList" :key="index" :label="item.label" :name="item.value + ''"> <el-tab-pane v-for="(item, index) in typeList" :key="index" :label="item.label" :name="item.value + ''">
<template slot="label"> <template slot="label">
<!-- 有数字 --> <!-- 有红点数字显示 badge -->
<div v-if="item.redNum && item.redNum > 0"> <div v-if="item.redNum && item.redNum > 0" class="tab-label-with-badge">
<el-badge is-dot class="badgeItem"> <el-badge :value="item.redNum" class="badgeItem">
<span>{{ item.label }}</span> <span>{{ item.label }}</span>
</el-badge> </el-badge>
<!-- <el-badge
v-else
:value="item.redNum"
class="badgeItem"
>
<span>{{ item.label }}</span>
</el-badge> -->
</div> </div>
<div v-else> <!-- 没有红点时正常显示标签 -->
<span class="badgeLabel">{{ item.label }}</span> <div v-else class="tab-label-normal">
<span>{{ item.label }}</span>
</div> </div>
</template> </template>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
<!-- 运营任务 --> <!-- 运营任务 -->
...@@ -186,9 +179,10 @@ import { ...@@ -186,9 +179,10 @@ import {
taskIndex, taskIndex,
searchcondition, searchcondition,
reportCancel, reportCancel,
appealCancel appealCancel,
getTaskTotal
} from '@/api/game' } from '@/api/game'
import { getTaskUnReadData, clearTaskUnReadData } from '@/api/works' import { clearTaskUnReadData } from '@/api/works'
import { mapState, mapMutations, mapActions } from 'vuex' import { mapState, mapMutations, mapActions } from 'vuex'
import mainGameSelect from '@/components/mainGame.vue' import mainGameSelect from '@/components/mainGame.vue'
import { removeDp } from '@/utils/index' import { removeDp } from '@/utils/index'
...@@ -215,7 +209,7 @@ export default { ...@@ -215,7 +209,7 @@ export default {
}, },
}, },
computed: { computed: {
...mapState('game', ['taskDetails', 'accountSelect']), ...mapState('game', ['taskDetails', 'accountSelect', 'taskData']),
...mapState('user', ['userInfo', 'corp_id']) ...mapState('user', ['userInfo', 'corp_id'])
}, },
components: { components: {
...@@ -350,7 +344,6 @@ export default { ...@@ -350,7 +344,6 @@ export default {
} }
}, },
created() { created() {
this.getTaskUnReadData()
this.reportForm.create_time_start = this.$moment().subtract(30, 'days').format('YYYY-MM-DD 00:00:00') this.reportForm.create_time_start = this.$moment().subtract(30, 'days').format('YYYY-MM-DD 00:00:00')
this.reportForm.create_time_end = this.$moment().format('YYYY-MM-DD 23:59:59') this.reportForm.create_time_end = this.$moment().format('YYYY-MM-DD 23:59:59')
this.reportForm.createTimeDate = [this.reportForm.create_time_start, this.reportForm.create_time_end] this.reportForm.createTimeDate = [this.reportForm.create_time_start, this.reportForm.create_time_end]
...@@ -360,24 +353,24 @@ export default { ...@@ -360,24 +353,24 @@ export default {
this.requstPlanList('') this.requstPlanList('')
}, },
mounted() { mounted() {
// 进入任务列表页面时重新请求任务数据,刷新红点状态
const taskForm = window.sessionStorage.getItem('newTaskForm') const taskForm = window.sessionStorage.getItem('newTaskForm')
if (taskForm) { if (taskForm) {
const form = JSON.parse(taskForm) const form = JSON.parse(taskForm)
!form.type || form.type == '' ? (form.type = '1') : form.type = form.type + '' !form.type || form.type == '' ? (form.type = '1') : form.type = form.type + ''
// if (form.assignment_time_start == '') {
// form.timeDate = [this.$moment().subtract(7, 'days').format('YYYY-MM-DD 00:00:00'), this.$moment().format('YYYY-MM-DD 23:59:59')]
// form.assignment_time_start = this.$moment().subtract(7, 'days').format('YYYY-MM-DD 00:00:00')
// form.assignment_time_end = this.$moment().format('YYYY-MM-DD 00:00:00')
// }
this.taskForm = form this.taskForm = form
} }
this.requestList() this.requestList()
this.searchcondition() this.searchcondition()
this.requstApprovalList() this.requstApprovalList()
this.initializeWecom() this.initializeWecom()
this.$nextTick(() => {
this.refreshTaskData()
})
}, },
methods: { methods: {
...mapActions('user', ['initWecom']), ...mapActions('user', ['initWecom']),
...mapActions('game', ['getTaskUnReadData']),
...mapMutations('game', ['set_taskDetails']), ...mapMutations('game', ['set_taskDetails']),
filterChange() { filterChange() {
...@@ -395,23 +388,41 @@ export default { ...@@ -395,23 +388,41 @@ export default {
console.error('❌ 企业微信 SDK 初始化失败:', error) console.error('❌ 企业微信 SDK 初始化失败:', error)
} }
}, },
// 获取更新 // 刷新任务数据
getTaskUnReadData() { async refreshTaskData() {
let taskNum = {} try {
getTaskUnReadData().then(res => { console.log('taskList.vue 刷新任务数据')
if (res.status_code === 1) { // 重新请求任务数据接口,更新 Vuex 状态
taskNum = res.data await this.getTaskUnReadData()
this.typeList.map(item => { console.log('任务数据刷新成功')
for (const key in taskNum) { // 更新本地显示(这里调用本地的方法来更新 typeList 显示)
if (item.type == key) { this.updateLocalTaskDisplay()
item.redNum = taskNum[key] } catch (error) {
console.error('刷新任务数据失败:', error)
} }
},
// 更新本地任务显示
updateLocalTaskDisplay() {
// 直接使用 Vuex 中存储的任务数据
const taskData = this.taskData
console.log(taskData, 'taskData')
const taskNum = {
operator_task: taskData.operator_task || 0,
user_task: taskData.user_task || 0,
account_task: taskData.account_task || 0
} }
}) // 更新 typeList 中的红点数量
this.typeList[0].redNum = 0 this.typeList.forEach(item => {
this.$forceUpdate() // 重置红点数量
item.redNum = 0
// 根据任务类型设置红点数量
if (taskNum[item.type] && taskNum[item.type] > 0) {
item.redNum = taskNum[item.type]
} }
}) })
this.$forceUpdate()
}, },
iconSort(type) { iconSort(type) {
if (type == 'top') { if (type == 'top') {
...@@ -440,18 +451,9 @@ export default { ...@@ -440,18 +451,9 @@ export default {
taskTypeChange() { taskTypeChange() {
this.reportForm.create_time_start = this.$moment().subtract(30, 'days').format('YYYY-MM-DD 00:00:00') this.reportForm.create_time_start = this.$moment().subtract(30, 'days').format('YYYY-MM-DD 00:00:00')
this.reportForm.create_time_end = this.$moment().format('YYYY-MM-DD 23:59:59') this.reportForm.create_time_end = this.$moment().format('YYYY-MM-DD 23:59:59')
const tabItem = this.typeList.find((item) => item.value == this.taskForm.type)
this.loading = true this.loading = true
this.set_taskDetails({}) this.set_taskDetails({})
this.filterChange() this.filterChange()
if (tabItem.redNum > 0) {
this.clearTaskUnReadData(tabItem.type)
}
},
// 清除红点
async clearTaskUnReadData(type) {
const res = await clearTaskUnReadData({ type: type })
this.getTaskUnReadData()
}, },
mainGameResult(data) { mainGameResult(data) {
this.taskForm.main_game_id = [data] this.taskForm.main_game_id = [data]
...@@ -857,14 +859,23 @@ export default { ...@@ -857,14 +859,23 @@ export default {
} }
.badgeItem { .badgeItem {
::v-deep .is-dot {
top: 8px;
}
::v-deep .el-badge__content { ::v-deep .el-badge__content {
top: 8px; top: 12px !important;
right: -2px !important;
}
::v-deep .el-badge__content.is-dot {
top: 10px !important;
right: -2px !important;
width: 8px !important;
height: 8px !important;
} }
} }
.tab-label-normal {
display: inline-block;
}
.badgeLabel { .badgeLabel {
position: relative; position: relative;
top: 2px; top: 2px;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论