提交 92d071c3 authored 作者: 王鹏飞's avatar 王鹏飞

chore: update

上级 cb08dd16
<script setup lang="ts"> <script setup lang="ts">
import { QuestionFilled } from '@element-plus/icons-vue'
import { useUserAttr, useMetaEvent, useUserAttrRange } from '@/composables/useRFMData' import { useUserAttr, useMetaEvent, useUserAttrRange } from '@/composables/useRFMData'
import { searchMetaMemberAttrs } from '@/api/base' import { searchMetaMemberAttrs } from '@/api/base'
...@@ -102,6 +103,14 @@ watch( ...@@ -102,6 +103,14 @@ watch(
}, },
{ immediate: true } { immediate: true }
) )
const a = [
{ id: '001', label: '2000' },
{ id: '002', label: '1500' },
{ id: '003', label: '3000' },
{ id: '004', label: '2200' },
{ id: '005', label: '1800' }
]
</script> </script>
<template> <template>
...@@ -120,6 +129,33 @@ watch( ...@@ -120,6 +129,33 @@ watch(
<el-select v-model="form.rule" style="width: 170px" @change="handleRuleChange"> <el-select v-model="form.rule" style="width: 170px" @change="handleRuleChange">
<el-option v-for="item in currentRuleList" :key="item.value" :label="item.label" :value="item.value"></el-option> <el-option v-for="item in currentRuleList" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select> </el-select>
<div class="rfm-tips">
<el-popover popper-class="rfm-popover" placement="right" title="属性值平均法" :width="400" trigger="hover" v-if="form.rule == '101'">
<p>用于计算选中属性的平均值,通过对选定的字段中的所有记录进行数值相加,然后除以记录的数量来计算的。主要针对“数字”和“整数”两种字段类型。</p>
<p>举例:</p>
<el-table :data="a" border>
<el-table-column prop="id" label="用户ID" />
<el-table-column prop="label" label="销售额" />
</el-table>
<p>“销售额”的平均值为:<br />(2000+1500+3000+2200+1800)/5=2100</p>
<template #reference>
<el-icon><QuestionFilled /></el-icon>
</template>
</el-popover>
<el-popover popper-class="rfm-popover" placement="right" title="属性值分类法" :width="400" trigger="hover" v-if="form.rule == '102'">
<p>将数据的属性值按照一定的规则或特性进行分类,本系统中分了“高”和“低”两类。主要针对“字符串”的字段类型。</p>
<template #reference>
<el-icon><QuestionFilled /></el-icon>
</template>
</el-popover>
<el-popover popper-class="rfm-popover" placement="right" title="事件发生次数平均法" :width="400" trigger="hover" v-if="form.rule == '201'">
<p>分析事件发生频率的方法,即通过计算用户事件发生的平均次数。</p>
<template #reference>
<el-icon><QuestionFilled /></el-icon>
</template>
</el-popover>
</div>
<el-select v-model="form.event_id" placeholder="选择事件" style="width: 160px" v-if="form.basis === '2'"> <el-select v-model="form.event_id" placeholder="选择事件" style="width: 160px" v-if="form.basis === '2'">
<el-option v-for="item in currentMetaEventList" :key="item.event_id" :label="item.event_name" :value="item.event_id"></el-option> <el-option v-for="item in currentMetaEventList" :key="item.event_id" :label="item.event_name" :value="item.event_id"></el-option>
</el-select> </el-select>
...@@ -127,7 +163,7 @@ watch( ...@@ -127,7 +163,7 @@ watch(
<el-option v-for="item in userAttrList" :key="item.id" :label="item.name" :value="item.id"></el-option> <el-option v-for="item in userAttrList" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select> </el-select>
<template v-if="form.basis == 1 && form.rule != '102' && form.attr_id"> <template v-if="form.basis == 1 && form.rule != '102' && form.attr_id">
<p>最小值:{{ userAttrRange.min }} <br />最大值:{{ userAttrRange.max }}</p> <p>最小值:{{ userAttrRange.min }} <br />最大值:{{ userAttrRange.max }}<br />平均值:{{ userAttrRange.avg }}</p>
</template> </template>
</div> </div>
<div class="rfm-body"> <div class="rfm-body">
...@@ -198,4 +234,12 @@ watch( ...@@ -198,4 +234,12 @@ watch(
text-align: center; text-align: center;
} }
} }
.rfm-tips {
margin-right: 10px;
}
.rfm-popover {
p {
margin: 10px 0;
}
}
</style> </style>
...@@ -41,7 +41,7 @@ export function useMetaEvent() { ...@@ -41,7 +41,7 @@ export function useMetaEvent() {
// 最大值最小值 // 最大值最小值
export function useUserAttrRange() { export function useUserAttrRange() {
const userAttrRange = ref<{ min: string; max: string }>({ min: '', max: '' }) const userAttrRange = ref<{ min: string; max: string; avg: string }>({ min: '', max: '', avg: '' })
async function fetchUserAttrRange(member_meta_id: string) { async function fetchUserAttrRange(member_meta_id: string) {
await getMemberAttrRange({ member_meta_id }).then((res: any) => { await getMemberAttrRange({ member_meta_id }).then((res: any) => {
userAttrRange.value = res.data.detail userAttrRange.value = res.data.detail
......
...@@ -2,12 +2,13 @@ ...@@ -2,12 +2,13 @@
import { getUserTags } from '../api' import { getUserTags } from '../api'
const props = defineProps({ ssoId: String }) const props = defineProps({ ssoId: String })
const color = ['#af1c40', '#c17933', '#8f0034', '#d45548', '#ab3259', '#dec34c', '#8b8920', '#a25a6d']
const list = ref([]) const list = ref([])
async function fetchList() { async function fetchList() {
if (!props.ssoId) return if (!props.ssoId) return
const res = await getUserTags({ sso_id: props.ssoId, limit: 20 }) const res = await getUserTags({ sso_id: props.ssoId, limit: 20 })
list.value = res.data.items.map(item => { list.value = res.data.items.map((item, index) => {
return { ...item, weight: parseFloat(item.weight) / 5 + 1 || 0 } return { ...item, weight: parseFloat(item.weight) / 2 + 1 || 0, color: color[index % color.length] }
}) })
} }
...@@ -24,9 +25,9 @@ watch( ...@@ -24,9 +25,9 @@ watch(
<div class="user-label"> <div class="user-label">
<ul> <ul>
<li v-for="item in list" :key="item.id" :style="{ scale: item.weight }"> <li v-for="item in list" :key="item.id" :style="{ scale: item.weight }">
<div class="user-label__inner"> <div class="user-label__inner" :style="{ backgroundColor: item.color }">
{{ item.name }} {{ item.name }}
<span class="user-label__arrow"></span> <!-- <span class="user-label__arrow"></span> -->
</div> </div>
</li> </li>
</ul> </ul>
...@@ -47,21 +48,22 @@ watch( ...@@ -47,21 +48,22 @@ watch(
ul { ul {
display: grid; display: grid;
grid-template-columns: repeat(2, 1fr); grid-template-columns: repeat(2, 1fr);
column-gap: 240px; column-gap: 230px;
row-gap: 20px; row-gap: 20px;
} }
.user-label__inner { .user-label__inner {
position: relative; position: relative;
display: inline-block; display: inline-block;
padding: 4px 10px; padding: 10px;
font-size: 14px; font-size: 14px;
text-align: left; text-align: left;
font-family: Roboto; font-family: Roboto;
line-height: 24px; line-height: 24px;
color: rgba(16, 16, 16, 1); // color: rgba(16, 16, 16, 1);
color: #fff;
background-color: rgba(231, 232, 232, 1); background-color: rgba(231, 232, 232, 1);
border: 1px solid rgba(187, 187, 187, 1); // border: 1px solid rgba(187, 187, 187, 1);
border-radius: 5px; border-radius: 50%;
} }
.user-label__arrow { .user-label__arrow {
position: absolute; position: absolute;
......
...@@ -43,7 +43,7 @@ function wayDisabled(item, type) { ...@@ -43,7 +43,7 @@ function wayDisabled(item, type) {
<el-form label-suffix=":" label-width="130" :model="form" :rules="rules" ref="formRef" :disabled="action === 'view'"> <el-form label-suffix=":" label-width="130" :model="form" :rules="rules" ref="formRef" :disabled="action === 'view'">
<el-form-item label="营销内容类型" prop="type"> <el-form-item label="营销内容类型" prop="type">
<el-radio-group v-model="form.type" :disabled="action === 'update'" @change="form.way = '2'"> <el-radio-group v-model="form.type" :disabled="action === 'update'" @change="form.way = '2'">
<el-radio v-for="item in materialType" :key="item.id" :value="item.value">{{ item.label }}</el-radio> <el-radio v-for="item in materialType" :key="item.id" :value="item.value" :disabled="$route.query.type ? item.value !== $route.query.type : false">{{ item.label }}</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="内容名称" prop="name"> <el-form-item label="内容名称" prop="name">
......
...@@ -151,7 +151,7 @@ async function handleChangeStatus(row: MaterialProp) { ...@@ -151,7 +151,7 @@ async function handleChangeStatus(row: MaterialProp) {
<AppList border v-bind="listOptions" ref="appList"> <AppList border v-bind="listOptions" ref="appList">
<template #header-buttons> <template #header-buttons>
<el-space> <el-space>
<router-link to="/material/create"> <router-link :to="{ path: '/material/create', query: $route.query }">
<el-button type="primary" :icon="Plus">营销内容创作</el-button> <el-button type="primary" :icon="Plus">营销内容创作</el-button>
</router-link> </router-link>
</el-space> </el-space>
......
...@@ -14,7 +14,7 @@ const activeName = ref(1) ...@@ -14,7 +14,7 @@ const activeName = ref(1)
const form: any = reactive({ const form: any = reactive({
id: '', id: '',
type: '1', type: route.query.type || '1',
name: '', name: '',
way: '2', way: '2',
industry_id: '1', industry_id: '1',
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论