feat: 添加web-view

master
xjs 2025-03-27 18:04:31 +08:00
parent 0fa672628e
commit b74e480946
12 changed files with 382 additions and 35 deletions

View File

@ -3,14 +3,26 @@
style: { style: {
navigationBarTitleText: '小纬', navigationBarTitleText: '小纬',
}, },
needLogin: true,
} }
</route> </route>
<template> <template>
<web-view src="http://localhost:3000/" /> <web-view src="http://localhost:3001/sort-college" @message="handleChildMessage" />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
const handleChildMessage = (event) => {
console.log('子应用传递的消息', event)
}
const callback = ({
// B
response,
method,
}) => {
console.log('callback.response: ', response) // {name: ""}
console.log('callback.method: ', method) // passToA
}
onLoad(() => { onLoad(() => {
const manager = uni.getRecorderManager() const manager = uni.getRecorderManager()
manager.start({ manager.start({
@ -20,6 +32,8 @@ onLoad(() => {
console.log('录音结束') console.log('录音结束')
}) })
}) })
defineExpose({ callback })
</script> </script>
<style lang="scss" scoped></style> <style lang="scss" scoped></style>

View File

@ -0,0 +1,125 @@
<route lang="json5" type="page">
{
style: {
navigationStyle: 'custom',
},
}
</route>
<template>
<scroll-view :scroll-y="true" class="flex flex-col h-screen relative custom-bg">
<Navbar
safeAreaInsetTop
:bordered="false"
leftArrow
@clickLeft="handleBack"
bg-color="transparent"
>
<template #title>
<text class="text-[#1F2329] text-[36rpx] font-medium text-[#fff]">职业锚测评报告</text>
</template>
</Navbar>
<view class="flex-1 overflow-auto pb-[30rpx] relative">
<!-- 顶部卡片 -->
<view class="flex flex-col pt-[32rpx] px-[84rpx] h-[244rpx] mb-[-148rpx]">
<image src="/static/images/evaluate/bg.png" class="header-bg" />
<text class="text-[#333] text-[28rpx] mb-[14rpx] z-2">您的职业价值观</text>
<text class="text-[#117CFC] text-[36rpx] z-2">{{ studyRecord.tag }}</text>
</view>
<OpinionChart :pic-charts="studyRecord.picCharts" />
<AbilityDimension :report-items="studyRecord.reportItems" />
<!-- 底部AI智能顾问 -->
<!-- <view class="ai-assistant mt-[20rpx] mb-[10rpx] flex items-center justify-center">
<image src="" class="w-[32rpx] h-[32rpx] mr-[10rpx]"></image>
<text class="text-[#117CFC] text-[26rpx]">智能AI顾问</text>
</view> -->
</view>
</scroll-view>
</template>
<script setup lang="ts">
import Navbar from '@/pages-evaluation-sub/components/navbar/Navbar.vue'
import OpinionChart from '../components/interestChart/OpinionChart.vue'
import AbilityDimension from '../components/AbilityDimension.vue'
import { getOpinionAbout } from '@/service/index/api'
const pageType = ref(0)
const pageId = ref(0)
const handleBack = () => {
uni.navigateBack()
}
const studyRecord = ref({
description: '',
title: '',
picCharts: { indicator: [], radars: [] },
reportItems: [],
tag: '',
})
onLoad((options) => {
pageType.value = +options.type
pageId.value = options.id
getOpinionAbout({ ScaleId: pageId.value }).then((resp) => {
if (resp.code === 200) {
studyRecord.value = resp.result as {
description: string
title: string
picCharts: { radars: any[]; indicator: any[] }
reportItems: any[]
tag: string
}
}
})
})
</script>
<style scoped lang="scss">
.custom-bg {
background: linear-gradient(184deg, #0d79fc 0%, #2186fc 100%);
}
:deep(.icon-class) {
color: #fff !important;
}
.header-bg {
width: calc(100% - 80rpx);
height: 244rpx;
position: absolute;
top: 0;
left: 40rpx;
z-index: 1;
}
.type-tag {
font-size: 24rpx;
min-width: 40rpx;
text-align: center;
}
.position-tag {
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
font-size: 26rpx;
text-align: center;
}
.table-row {
align-items: center;
font-size: 26rpx;
color: #333;
}
.avatar-item image {
border: 4rpx solid #fff;
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.15);
}
.border-class {
border-radius: 20rpx 20rpx 0 0;
padding-bottom: 42rpx;
margin-bottom: -14rpx;
}
</style>

View File

@ -5,7 +5,9 @@
<view class="flex flex-col gap-[40rpx]"> <view class="flex flex-col gap-[40rpx]">
<view v-for="(item, index) in reportItems" :key="index"> <view v-for="(item, index) in reportItems" :key="index">
<view class="text-[32rpx] text-[#000]">{{ item.title }}</view> <view class="text-[32rpx] text-[#000]">{{ item.title }}</view>
<view class="text-[26rpx] text-[#666] mt-[6rpx]">{{ item.resolving }}</view> <view class="text-[26rpx] text-[#666] mt-[6rpx]">
{{ item.resolving || item.description }}
</view>
</view> </view>
</view> </view>
</view> </view>

View File

@ -0,0 +1,37 @@
<template>
<view
class="text-[26rpx] text-[#000] mx-[24rpx] bg-[#fff] flex flex-col px-[20rpx] gap-[10rpx] pb-[20rpx] custom-class"
>
<view class="flex gap-[10rpx] w-full">
<view class="w-[94rpx] py-[12rpx] bg-color text-center">类型</view>
<view class="py-[12rpx] text-center bg-color flex-1">详解</view>
</view>
<view class="flex gap-[10rpx] w-full" v-for="(item, index) in reportItems" :key="index">
<view class="w-[94rpx] py-[12rpx] bg-color text-center">
<view>{{ item.tag }}</view>
<view>{{ item.title }}</view>
</view>
<view class="py-[22rpx] px-[14rpx] text-start bg-color flex-1">{{ item.resolving }}</view>
</view>
</view>
</template>
<script setup lang="ts">
const props = defineProps({
reportItems: {
type: Array<any>,
default: () => [],
},
})
</script>
<style lang="scss" scoped>
.bg-color {
background-color: #f5faff;
border-radius: 8rpx;
}
.custom-class {
border-radius: 0 0 20rpx 20rpx;
}
</style>

View File

@ -0,0 +1,162 @@
<template>
<view class="bg-white mx-[24rpx] rounded-[20rpx] pb-[20rpx]">
<view class="px-[24rpx] h-[368rpx] z-1">
<LEchart ref="echart" :customStyle="`z-index:1;`"></LEchart>
</view>
</view>
</template>
<script lang="ts" setup>
import LEchart from '@/pages-evaluation-sub/uni_modules/lime-echart/components/l-echart/l-echart.vue'
const echarts = require('../../../uni_modules/lime-echart/static/echarts.min')
const echart = ref(null)
interface IndicatorItem {
name: string
max: number
}
interface PicChartsData {
indicator: IndicatorItem[]
radars: number[]
}
const props = defineProps({
picCharts: {
type: Object as () => PicChartsData,
default: () => ({
indicator: [],
radars: [],
}),
},
description: {
type: String,
default: '',
},
})
onMounted(() => {
updateChart()
})
watch(
() => props.picCharts,
(newVal) => {
if (newVal && newVal.indicator && newVal.indicator.length > 0) {
updateChart()
}
},
{ deep: true },
)
const updateChart = () => {
echart.value.init(echarts, (chart) => {
//
const categories = props.picCharts.indicator.map((item) => {
const match = item.name.match(/(.*?)\([^)]*\)/)
return match ? match[1].trim() : item.name
})
const option = {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
},
},
grid: {
top: 60,
left: 0,
right: 0,
bottom: 0,
containLabel: true,
},
xAxis: {
type: 'category',
data: categories,
axisLine: {
lineStyle: {
color: '#E0E0E0',
},
},
axisLabel: {
color: '#666',
fontSize: 12,
interval: 0,
rotate: 45,
formatter: function (value) {
//
if (value.length > 4) {
return value.substring(0, 4) + '...'
}
return value
},
},
axisTick: {
show: false,
},
},
yAxis: {
type: 'value',
name: '分数',
min: 0,
max: 30,
interval: 5,
axisLine: {
show: true,
lineStyle: {
color: '#E0E0E0',
},
},
axisTick: {
show: false,
},
splitLine: {
lineStyle: {
color: '#E8E8E8',
type: 'solid',
},
},
axisLabel: {
color: '#999',
},
},
series: [
{
name: '得分',
type: 'bar',
barWidth: '20',
itemStyle: {
color: function (params) {
//
const colorList = [
'#1580FF',
'#F9AA5B',
'#5470c6',
'#91cc75',
'#fac858',
'#ee6666',
'#73c0de',
'#3ba272',
]
return colorList[params.dataIndex % colorList.length]
},
borderRadius: [4, 4, 0, 0],
},
label: {
show: true,
position: 'top',
color: '#666',
fontSize: 12,
},
data: props.picCharts.radars,
},
],
}
chart.setOption(option)
})
}
</script>
<style scoped></style>

View File

@ -65,7 +65,6 @@
<view <view
class="overflow-auto transition-all duration-300" class="overflow-auto transition-all duration-300"
:style="{ maxHeight: isCollapsed ? '0' : '100vh' }" :style="{ maxHeight: isCollapsed ? '0' : '100vh' }"
v-if="!isCollapsed"
> >
<DragSort v-model:list="college.vItems" ref="majorDrop" @get-list="getMajorList"> <DragSort v-model:list="college.vItems" ref="majorDrop" @get-list="getMajorList">
<template #content="{ data }"> <template #content="{ data }">

View File

@ -8,9 +8,11 @@
<template> <template>
<view class="h-screen flex flex-col"> <view class="h-screen flex flex-col">
<HeaderTip :user-info="userStore.userInfo" :type="1" /> <web-view :src="webUrl" :fullscreen="false" :update-title="false" @message="handleMessage" />
<DragSortList <!-- <HeaderTip :user-info="userStore.userInfo" :type="1" /> -->
v-model:list="wishList"
<!-- <DragSortList
:list="list"
class="flex-auto overflow-auto" class="flex-auto overflow-auto"
ref="myDrop" ref="myDrop"
@get-list="getDropList" @get-list="getDropList"
@ -32,12 +34,11 @@
/> />
</view> </view>
</template> </template>
</DragSortList> </DragSortList> -->
<view class="flex items-center pb-safe button-group px-[32rpx] pt-[32rpx]"> <view class="flex items-center pb-safe button-group px-[32rpx] pt-[32rpx]">
<!-- <button <!-- <button
plain plain
class="border-[#f5f5f5]! flex-auto bg-[#f5f5f5]! rounded-[8rpx]! text-[#1580FF]! text-[32rpx]! font-normal! mr-[22rpx]" class="border-[#f5f5f5]! flex-auto bg-[#f5f5f5]! rounded-[8rpx]! text-[#1580FF]! text-[32rpx]! font-normal! mr-[22rpx]"
@click="exportPdf"
> >
下载PDF 下载PDF
</button> --> </button> -->
@ -159,14 +160,8 @@ const addWishList = () => {
} }
saveWishList(params).then((res) => { saveWishList(params).then((res) => {
if (res.code === 200) { if (res.code === 200) {
uni.showToast({
title: '保存成功',
icon: 'success',
})
userStore.clearWishList() userStore.clearWishList()
uni.switchTab({ vTbId.value = res.result as number
url: '/pages/home/index/index',
})
} else { } else {
uni.showToast({ uni.showToast({
title: res.message || '保存失败', title: res.message || '保存失败',
@ -179,9 +174,16 @@ const addWishList = () => {
let typeName = '' let typeName = ''
let editType = '' let editType = ''
let vTbId = ref(0)
let webUrl = computed(() => {
return `http://localhost:3001/sort-college?id=${vTbId.value}&token=${userStore.userInfo.token}&score=${userStore.userInfo.estimatedAchievement.expectedScore}&batchName=${userStore.userInfo.batchName}&subjectGroup=${userStore.userInfo.estimatedAchievement.subjectGroup}&location=${userStore.userInfo.estimatedAchievement.provinceCode}`
})
const handleMessage = () => {}
onLoad((options) => { onLoad((options) => {
typeName = options.typeName typeName = options.typeName
editType = options.editType editType = options.editType
addWishList()
}) })
</script> </script>

View File

@ -50,11 +50,13 @@ const toDetail = (item: any) => {
let url = '' let url = ''
if (item.type === 0) { if (item.type === 0) {
url = `/pages-evaluation-sub/evaluate/academicReport/InterestReport?id=${item.reportsId}&type=${item.type}` url = `/pages-evaluation-sub/evaluate/academicReport/interestReport?id=${item.reportsId}&type=${item.type}`
} else if (item.type === 1) { } else if (item.type === 1) {
url = `/pages-evaluation-sub/evaluate/academicReport/CharacterReport?id=${item.reportsId}&type=${item.type}` url = `/pages-evaluation-sub/evaluate/academicReport/characterReport?id=${item.reportsId}&type=${item.type}`
} else if (item.type === 2) { } else if (item.type === 2) {
url = `/pages-evaluation-sub/evaluate/academicReport/CapabilityReport?id=${item.reportsId}&type=${item.type}` url = `/pages-evaluation-sub/evaluate/academicReport/capabilityReport?id=${item.reportsId}&type=${item.type}`
} else if (item.type === -1) {
url = `/pages-evaluation-sub/evaluate/academicReport/opinionAboutReport?id=${item.reportsId}&type=${item.type}`
} }
uni.navigateTo({ uni.navigateTo({
url, url,

View File

@ -348,21 +348,28 @@
} }
}, },
{ {
"path": "evaluate/academicReport/CapabilityReport", "path": "evaluate/academicReport/capabilityReport",
"type": "page", "type": "page",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, },
{ {
"path": "evaluate/academicReport/CharacterReport", "path": "evaluate/academicReport/characterReport",
"type": "page", "type": "page",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, },
{ {
"path": "evaluate/academicReport/InterestReport", "path": "evaluate/academicReport/interestReport",
"type": "page",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "evaluate/academicReport/opinionAboutReport",
"type": "page", "type": "page",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
@ -378,8 +385,7 @@
"type": "page", "type": "page",
"style": { "style": {
"navigationBarTitleText": "小纬" "navigationBarTitleText": "小纬"
}, }
"needLogin": true
} }
] ]
} }

View File

@ -403,7 +403,7 @@ export const getMySpecialList = (params: { openId: string }) => {
} }
export const getMyBusReports = (params: { CustomId: number }) => { export const getMyBusReports = (params: { CustomId: number }) => {
return http.get('/api/busScale/GetBusCustomReports', params) return http.get('/api/busScale/GetBusCustomReports/v2', params)
} }
export const deleteMyAppointment = (params: { id: number }) => { export const deleteMyAppointment = (params: { id: number }) => {
@ -429,3 +429,7 @@ export const getMBTIDimension = (params: { ScaleId: number }) => {
export const getAbilityDimension = (params: { ScaleId: number }) => { export const getAbilityDimension = (params: { ScaleId: number }) => {
return http.get('/api/busscale/GetAbilityDimension', params) return http.get('/api/busscale/GetAbilityDimension', params)
} }
export const getOpinionAbout = (params: { ScaleId: number }) => {
return http.get('/api/busScale/GetOpinionAbout', params)
}

View File

@ -40,9 +40,10 @@ interface NavigateToOptions {
"/login-sub/index" | "/login-sub/index" |
"/pages-evaluation-sub/aiAutoFill/index" | "/pages-evaluation-sub/aiAutoFill/index" |
"/pages-evaluation-sub/rank/index" | "/pages-evaluation-sub/rank/index" |
"/pages-evaluation-sub/evaluate/academicReport/CapabilityReport" | "/pages-evaluation-sub/evaluate/academicReport/capabilityReport" |
"/pages-evaluation-sub/evaluate/academicReport/CharacterReport" | "/pages-evaluation-sub/evaluate/academicReport/characterReport" |
"/pages-evaluation-sub/evaluate/academicReport/InterestReport" | "/pages-evaluation-sub/evaluate/academicReport/interestReport" |
"/pages-evaluation-sub/evaluate/academicReport/opinionAboutReport" |
"/aiService-sub/index/index"; "/aiService-sub/index/index";
} }
interface RedirectToOptions extends NavigateToOptions {} interface RedirectToOptions extends NavigateToOptions {}

View File

@ -40,13 +40,6 @@ export default defineConfig({
'vertical-align': 'middle', 'vertical-align': 'middle',
}, },
}), }),
// 将颜色函数 (rgb()和hsl()) 从空格分隔转换为逗号分隔更好的兼容性app端example
// `rgb(255 0 0)` -> `rgb(255, 0, 0)`
// `rgba(255 0 0 / 0.5)` -> `rgba(255, 0, 0, 0.5)`
// 与群友的正常写法冲突先去掉2024-05-25
// presetLegacyCompat({
// commaStyleColorFunction: true,
// }) as Preset,
], ],
/** /**
* *