This commit is contained in:
2024-06-23 17:59:13 +08:00
25 changed files with 163 additions and 112 deletions

View File

@@ -11,10 +11,10 @@ VITE_BASE_URL='http://localhost:48080'
VITE_UPLOAD_URL='http://118.31.23.45:48080/admin-api/system/file/upload'
# 接口前缀
VITE_API_BASEPATH=/dev-api
VITE_API_BASEPATH=/crm-api
# 接口地址
VITE_API_URL=/admin-api
# 打包路径
VITE_BASE_PATH=/
VITE_BASE_PATH=/crm/

View File

@@ -10,13 +10,13 @@ VITE_BASE_URL='http://localhost:48080'
VITE_UPLOAD_URL='http://118.31.23.45:48080/admin-api/system/file/upload'
# 接口前缀
VITE_API_BASEPATH=/dev-api
VITE_API_BASEPATH=/crm-api
# 接口地址
VITE_API_URL=/admin-api
# 打包路径
VITE_BASE_PATH=/
VITE_BASE_PATH=/crm/
# 是否删除debugger
VITE_DROP_DEBUGGER=false

View File

@@ -10,13 +10,13 @@ VITE_BASE_URL='http://118.31.23.45:48080'
VITE_UPLOAD_URL='http://118.31.23.45:48080/admin-api/system/file/upload'
# 接口前缀
VITE_API_BASEPATH=/dev-api
VITE_API_BASEPATH=/crm-api
# 接口地址
VITE_API_URL=/admin-api
# 打包路径
VITE_BASE_PATH=/
VITE_BASE_PATH=/crm/
# 项目本地运行端口号, 与.vscode/launch.json配合
VITE_PORT=80

View File

@@ -4,13 +4,13 @@ VITE_NODE_ENV=production
VITE_DEV=false
# 请求路径
VITE_BASE_URL='http://localhost:48080'
VITE_BASE_URL='/crm-api'
# 上传路径
VITE_UPLOAD_URL='http://118.31.23.45:48080/admin-api/system/file/upload'
VITE_UPLOAD_URL='/crm-api/admin-api/system/file/upload'
# 接口前缀
VITE_API_BASEPATH=
VITE_API_BASEPATH=/crm-api
# 接口地址
VITE_API_URL=/admin-api
@@ -25,7 +25,7 @@ VITE_DROP_CONSOLE=true
VITE_SOURCEMAP=false
# 打包路径
VITE_BASE_PATH=/
VITE_BASE_PATH=/crm/
# 输出路径
VITE_OUT_DIR=dist-pro

View File

@@ -10,7 +10,7 @@ VITE_BASE_URL='http://api-dashboard.yudao.iocoder.cn'
VITE_UPLOAD_URL='http://118.31.23.45:48080/admin-api/system/file/upload'
# 接口前缀
VITE_API_BASEPATH=
VITE_API_BASEPATH=/crm-api
# 接口地址
VITE_API_URL=/admin-api
@@ -25,7 +25,7 @@ VITE_DROP_CONSOLE=true
VITE_SOURCEMAP=false
# 打包路径
VITE_BASE_PATH='http://static-vue3.yudao.iocoder.cn/'
VITE_BASE_PATH='/crm'
# 输出路径
VITE_OUT_DIR=dist-stage

View File

@@ -10,7 +10,7 @@ VITE_BASE_URL='http://localhost:48080'
VITE_UPLOAD_URL='http://118.31.23.45:48080/admin-api/system/file/upload'
# 接口前缀
VITE_API_BASEPATH=
VITE_API_BASEPATH=/crm-api
# 接口地址
VITE_API_URL=/admin-api
@@ -25,7 +25,7 @@ VITE_DROP_CONSOLE=true
VITE_SOURCEMAP=false
# 打包路径
VITE_BASE_PATH=/admin-ui-vue3/
VITE_BASE_PATH=/crm/
# 输出路径
VITE_OUT_DIR=dist-dev

View File

@@ -10,7 +10,7 @@ VITE_BASE_URL='http://localhost:48080'
VITE_UPLOAD_URL='http://118.31.23.45:48080/admin-api/system/file/upload'
# 接口前缀
VITE_API_BASEPATH=
VITE_API_BASEPATH=/crm-api
# 接口地址
VITE_API_URL=/admin-api
@@ -25,7 +25,7 @@ VITE_DROP_CONSOLE=false
VITE_SOURCEMAP=true
# 打包路径
VITE_BASE_PATH=/
VITE_BASE_PATH=/crm/
# 输出路径
VITE_OUT_DIR=dist-test

20
src/api/home/index.js Normal file
View File

@@ -0,0 +1,20 @@
import request from '@/config/axios'
// 线索情况
export const getUserClueCount = async (params) => {
return await request.get({ url: '/admin-api/crm/home/get-user-count', params })
}
// 成交率
export const getClueSignSignRate = async (params) => {
return await request.get({ url: '/admin-api/crm/home/get-sign-rate', params })
}
// 成交率
export const getClueSignSignRank = async (params) => {
return await request.get({ url: '/admin-api/crm/home/get-sign-top10', params })
}
// 成交率
export const getClueFollowRank = async (params) => {
return await request.get({ url: '/admin-api/crm/home/get-follow-top10', params })
}

View File

@@ -7,7 +7,7 @@ const config: {
/**
* api请求基础路径
*/
base_url: 'http://localhost' + import.meta.env.VITE_API_BASEPATH,
base_url: import.meta.env.VITE_API_BASEPATH,
/**
* 接口成功返回状态码
*/

View File

@@ -200,6 +200,9 @@ service.interceptors.response.use(
} else {
ElNotification.error({ title: msg })
if (code == 403) {
ElMessageBox.confirm(`${msg},是否重新登陆`, '提示', {
type: 'warning'
}).then(() => {
// 无访问权限,退出登录
const { wsCache } = useCache()
const tenantId = wsCache.get('TENANT_ID')
@@ -207,7 +210,8 @@ service.interceptors.response.use(
resetRouter() // 重置静态路由表
wsCache.clear()
removeToken()
window.location.href = `/login?tenantId=${tenantId}&appId=${appId}`
window.location.href = `/crm/login?tenantId=${tenantId}&appId=${appId}`
})
}
}
return Promise.reject('error')
@@ -255,7 +259,7 @@ const handleAuthorized = () => {
isRelogin.show = false
// 干掉token后再走一次路由让它过router.beforeEach的校验
// window.location.href = window.location.href
window.location.href = `/login?tenantId=${tenantId}&appId=${appId}`
window.location.href = `/crm/login?tenantId=${tenantId}&appId=${appId}`
})
}
return Promise.reject(t('sys.api.timeoutMessage'))

View File

@@ -24,7 +24,7 @@ const getUnreadCount = async () => {
// 跳转我的站内信
const goMyList = () => {
push({
name: 'MyNotifyMessage'
name: 'NotifyMessage'
})
}

View File

@@ -198,6 +198,7 @@ const clear = () => {
<template>
<div
v-if="false"
:class="prefixCls"
class="fixed top-[45%] right-0 w-40px h-40px text-center leading-40px bg-[var(--el-color-primary)] cursor-pointer"
@click="drawer = true"
@@ -205,7 +206,9 @@ const clear = () => {
<Icon color="#fff" icon="ep:setting" />
</div>
<ElDrawer v-model="drawer" :z-index="4000" direction="rtl" size="350px">
<div @click="drawer = true">主题配置</div>
<ElDrawer v-model="drawer" :z-index="4000" append-to-body direction="rtl" size="350px">
<template #header>
<span class="text-16px font-700">{{ t('setting.projectSetting') }}</span>
</template>

View File

@@ -8,6 +8,8 @@ import { useUserStore } from '@/store/modules/user'
import { useTagsViewStore } from '@/store/modules/tagsView'
import { getTenantId, getAppId } from '@/utils/auth'
import { Setting } from '@/layout/components/Setting'
const { t } = useI18n()
const { wsCache } = useCache()
@@ -58,6 +60,10 @@ const toProfile = async () => {
</div>
<template #dropdown>
<ElDropdownMenu>
<ElDropdownItem>
<Icon icon="ep:tools" />
<Setting />
</ElDropdownItem>
<ElDropdownItem>
<Icon icon="ep:tools" />
<div @click="toProfile">{{ t('common.profile') }}</div>

View File

@@ -54,9 +54,9 @@ router.beforeEach(async (to, from, next) => {
const tenantId = getTenantId()
const appId = getAppId()
if (tenantId && appId) {
next(`/login?tenantId=${tenantId}&appId=${appId}&redirect=${to.fullPath}`) // 否则全部重定向到登录页
next(`/crm/login?tenantId=${tenantId}&appId=${appId}&redirect=${to.fullPath}`) // 否则全部重定向到登录页
} else {
next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
next(`/crm/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
}
}
}

View File

@@ -5,7 +5,7 @@ import remainingRouter from './modules/remaining'
// 创建路由实例
const router = createRouter({
history: createWebHistory(), // createWebHashHistory URL带#createWebHistory URL不带#
history: createWebHistory(import.meta.env.VITE_BASE_PATH), // createWebHashHistory URL带#createWebHistory URL不带#
strict: true,
routes: remainingRouter as RouteRecordRaw[],
scrollBehavior: () => ({ left: 0, top: 0 })

View File

@@ -94,8 +94,8 @@ const remainingRouter: AppRouteRecordRaw[] = [
},
{
path: 'notify-message',
component: () => import('@/views/system/notify/my/index.vue'),
name: 'MyNotifyMessage',
component: () => import('@/views/Profile/NotifyMessage.vue'),
name: 'NotifyMessage',
meta: {
canTo: true,
hidden: true,

View File

@@ -8,7 +8,10 @@
/>
<span>使用外呼</span>
</template>
<el-radio-group v-model="form.usePhoneConfig">
<el-radio-group
v-model="form.usePhoneConfig"
:disabled="getConfig('usePhoneConfig').modifiable == 'false'"
>
<el-radio
v-for="(item, index) in getConfig('usePhoneConfig').options"
:key="index"

View File

@@ -86,7 +86,7 @@ defineExpose({ open }) // 提供 open 方法,用于打开弹窗
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
const submitForm = async () => {
// 校验表单
if (!formRef) return
if (!formRef.value) return
const valid = await formRef.value.validate()
if (!valid) return
// 提交请求

View File

@@ -141,7 +141,7 @@ defineExpose({ open }) // 提供 open 方法,用于打开弹窗
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
const submitForm = async () => {
// 校验表单
if (!formRef) return
if (!formRef.value) return
const valid = await formRef.value.validate()
if (!valid) return
// 提交请求

View File

@@ -18,7 +18,7 @@
<CountTo
class="text-20px number-font"
:start-val="0"
:end-val="10"
:end-val="clueInfo.todayFollowingNum"
:duration="2600"
/>
</div>
@@ -28,7 +28,7 @@
<CountTo
class="text-20px number-font"
:start-val="0"
:end-val="25"
:end-val="clueInfo.todayFollowedNum"
:duration="2600"
/>
</div>
@@ -38,7 +38,7 @@
<CountTo
class="text-20px number-font"
:start-val="0"
:end-val="2"
:end-val="clueInfo.todaySignedNum"
:duration="2600"
/>
</div>
@@ -48,7 +48,7 @@
<CountTo
class="text-20px number-font"
:start-val="0"
:end-val="235"
:end-val="clueInfo.outFollowNum"
:duration="2600"
/>
</div>
@@ -58,7 +58,7 @@
<CountTo
class="text-20px number-font"
:start-val="0"
:end-val="0"
:end-val="clueInfo.unknownNum"
:duration="2600"
/>
</div>
@@ -99,9 +99,9 @@
<template #header>
<div class="flex justify-between items-center">
<span>跟进榜Top10</span>
<el-radio-group v-model="followDate" size="small">
<el-radio label="day">本日</el-radio>
<el-radio label="month">本月</el-radio>
<el-radio-group v-model="followDate" size="small" @change="getFollowList">
<el-radio :label="1">本日</el-radio>
<el-radio :label="2">本月</el-radio>
</el-radio-group>
</div>
</template>
@@ -114,8 +114,8 @@
:key="index"
>
<span class="mr-10px">NO.{{ index + 1 }}</span>
<span class="mr-10px">{{ item.name }}</span>
<span>已跟进{{ item.count }}条线索</span>
<span class="mr-10px">{{ item.username }}</span>
<span>已跟进{{ item.followNum }}条线索</span>
</li>
<br />
<!-- </TransitionGroup> -->
@@ -129,11 +129,11 @@
<div class="flex justify-between"> 本月成交榜Top10 </div>
</template>
<el-skeleton :loading="loading" animated>
<el-table :data="followList" size="small">
<el-table-column prop="sort" label="排名" width="50" />
<el-table-column prop="name" label="姓名" width="70" />
<el-table-column prop="count" label="成交数量" width="70" />
<el-table-column prop="orgName" label="所属组织" />
<el-table :data="signList" size="small">
<el-table-column type="index" />
<el-table-column prop="username" label="姓名" width="100" />
<el-table-column prop="followNum" label="成交数量" width="70" />
<el-table-column prop="deptName" label="所属组织" />
</el-table>
</el-skeleton>
</el-card>
@@ -146,7 +146,8 @@ import { set } from 'lodash-es'
import { EChartsOption } from 'echarts'
import { useUserStore } from '@/store/modules/user'
import avatarImg from '@/assets/imgs/avatar.gif'
import { pieOptions, lineOptions } from './echarts-data'
import { lineOptions } from './echarts-data'
import * as HomeApi from '@/api/home/index'
const { t } = useI18n()
const userStore = useUserStore()
@@ -154,59 +155,46 @@ const loading = ref(false)
const avatar = userStore.getUser.avatar ? userStore.getUser.avatar : avatarImg
const username = userStore.getUser.nickname
const followDate = ref('day')
const followDate = ref(1)
// 成交线索来源
const pieOptionsData = reactive<EChartsOption>(pieOptions) as EChartsOption
const getSaleClueSource = async () => {
const data = [
{ value: 335, name: '宝典' },
{ value: 310, name: '一点通' },
{ value: 234, name: '抖音' },
{ value: 135, name: '小红书' },
{ value: 1548, name: '转介绍' }
]
set(
pieOptionsData,
'legend.data',
data.map((v) => t(v.name))
)
pieOptionsData!.series![0].data = data.map((v) => {
return {
name: t(v.name),
value: v.value
}
})
}
// const pieOptionsData = reactive<EChartsOption>(pieOptions) as EChartsOption
// const getSaleClueSource = async () => {
// const data = [
// { value: 335, name: '宝典' },
// { value: 310, name: '一点通' },
// { value: 234, name: '抖音' },
// { value: 135, name: '小红书' },
// { value: 1548, name: '转介绍' }
// ]
// set(
// pieOptionsData,
// 'legend.data',
// data.map((v) => t(v.name))
// )
// pieOptionsData!.series![0].data = data.map((v) => {
// return {
// name: t(v.name),
// value: v.value
// }
// })
// }
// 成交率
const lineOptionsData = reactive<EChartsOption>(lineOptions) as EChartsOption
const getMonthlySaleRate = async () => {
const data = [
{ estimate: 100, actual: 120, name: 'analysis.january' },
{ estimate: 120, actual: 82, name: 'analysis.february' },
{ estimate: 161, actual: 91, name: 'analysis.march' },
{ estimate: 134, actual: 154, name: 'analysis.april' },
{ estimate: 105, actual: 162, name: 'analysis.may' },
{ estimate: 160, actual: 140, name: 'analysis.june' },
{ estimate: 165, actual: 145, name: 'analysis.july' },
{ estimate: 114, actual: 250, name: 'analysis.august' },
{ estimate: 163, actual: 134, name: 'analysis.september' },
{ estimate: 185, actual: 56, name: 'analysis.october' },
{ estimate: 118, actual: 99, name: 'analysis.november' },
{ estimate: 123, actual: 123, name: 'analysis.december' }
]
const data = await HomeApi.getClueSignSignRate()
set(
lineOptionsData,
'xAxis.data',
data.map((v) => t(v.name))
data.map((v) => t(v.month))
)
set(lineOptionsData, 'series', [
{
name: '个人成交率',
smooth: true,
type: 'line',
data: data.map((v) => v.estimate),
data: data.map((v) => v.personalRate),
animationDuration: 2800,
animationEasing: 'cubicInOut'
},
@@ -215,33 +203,50 @@ const getMonthlySaleRate = async () => {
smooth: true,
type: 'line',
itemStyle: {},
data: data.map((v) => v.actual),
data: data.map((v) => v.avgRate),
animationDuration: 2800,
animationEasing: 'quadraticOut'
}
])
}
const followList = ref([
{ sort: 1, name: '张三', count: 12, orgName: '销售1组' },
{ sort: 2, name: '张三', count: 11, orgName: '销售3组' },
{ sort: 3, name: '张三', count: 11, orgName: '销售1组' },
{ sort: 4, name: '张三', count: 10, orgName: '销售1组' },
{ sort: 5, name: '张三', count: 2, orgName: '销售2组' },
{ sort: 6, name: '张三', count: 1, orgName: '销售1组' },
{ sort: 2, name: '张三', count: 11, orgName: '销售3组' },
{ sort: 3, name: '张三', count: 11, orgName: '销售1组' },
{ sort: 4, name: '张三', count: 10, orgName: '销售1组' },
{ sort: 5, name: '张三', count: 2, orgName: '销售2组' },
{ sort: 6, name: '张三', count: 1, orgName: '销售1组' }
])
const followList = ref<any>([])
const clueInfo = ref({
todayFollowingNum: 0,
todayFollowedNum: 0,
todaySignedNum: 0,
outFollowNum: 0,
unknownNum: 0
})
function getClueInfo() {
HomeApi.getUserClueCount().then((data) => {
clueInfo.value = data
})
}
function getFollowList() {
HomeApi.getClueFollowRank({ type: followDate.value }).then((data) => {
followList.value = data
})
}
const signList = ref([])
function getSignList() {
HomeApi.getClueSignSignRank().then((data) => {
signList.value = data
})
}
const getAllApi = async () => {
await Promise.all([getSaleClueSource(), getMonthlySaleRate()])
await Promise.all([getClueInfo(), getSignList(), getMonthlySaleRate(), getFollowList()])
loading.value = false
}
onMounted(() => {
getAllApi()
})
</script>
<style lang="scss" scoped>

View File

@@ -50,9 +50,9 @@
<!-- 账号登录 -->
<LoginForm class="p-20px h-auto m-auto <xl:(rounded-3xl light:bg-white)" />
<!-- 手机登录 -->
<MobileForm class="p-20px h-auto m-auto <xl:(rounded-3xl light:bg-white)" />
<!-- <MobileForm class="p-20px h-auto m-auto <xl:(rounded-3xl light:bg-white)" /> -->
<!-- 二维码登录 -->
<QrCodeForm class="p-20px h-auto m-auto <xl:(rounded-3xl light:bg-white)" />
<!-- <QrCodeForm class="p-20px h-auto m-auto <xl:(rounded-3xl light:bg-white)" /> -->
<!-- 注册 -->
<!-- <RegisterForm class="p-20px h-auto m-auto <xl:(rounded-3xl light:bg-white)" /> -->
<!-- 三方登录 -->
@@ -70,7 +70,7 @@ import { useDesign } from '@/hooks/web/useDesign'
import { useAppStore } from '@/store/modules/app'
import { ThemeSwitch } from '@/layout/components/ThemeSwitch'
import { LoginForm, MobileForm, QrCodeForm } from './components'
import { LoginForm } from './components'
import soups from './components/soup.js'

View File

@@ -82,7 +82,7 @@
mode="pop"
@success="handleLogin"
/>
<el-col :span="24" style="padding-left: 10px; padding-right: 10px">
<el-col v-if="showOtherLogin" :span="24" style="padding-left: 10px; padding-right: 10px">
<el-form-item>
<el-row :gutter="5" justify="space-between" style="width: 100%">
<el-col :span="12">
@@ -131,6 +131,7 @@ const verify = ref()
const captchaType = ref('blockPuzzle') // blockPuzzle 滑块 clickWord 点击文字
const getShow = computed(() => unref(getLoginState) === LoginStateEnum.LOGIN)
const showOtherLogin = false
const LoginRules = {
username: [required],

View File

@@ -0,0 +1,7 @@
<template>
<div> 站内信 </div>
</template>
<script setup name="NotifyMessage"></script>
<style lang="scss" scoped></style>

View File

@@ -61,6 +61,8 @@ const bindSocial = () => {
})
}
const bind = (row) => {
message.info('暂未开放,敬请期待')
return
const redirectUri = location.origin + '/user/profile?type=' + row.type
// 进行跳转
socialAuthRedirect(row.type, encodeURIComponent(redirectUri)).then((res) => {

View File

@@ -40,11 +40,11 @@ export default ({ command, mode }) => {
changeOrigin: true,
rewrite: (path) => path.replace(new RegExp(`^/call-api`), '')
},
['/dev-api']: {
['/crm-api']: {
target: env.VITE_BASE_URL,
ws: false,
changeOrigin: true,
rewrite: (path) => path.replace(new RegExp(`^/dev-api`), '')
rewrite: (path) => path.replace(new RegExp(`^/crm-api`), '')
}
}
},