master
lion 21 hours ago
parent cbef170c43
commit 517080ddaa

@ -6,6 +6,7 @@ export interface RadarTeacher {
research_direction?: string | null
research_directions?: Array<{ id: number; name: string }>
star_level_item?: { id: number; label: string; value: string } | null
status_item?: { id: number; label: string; value: string } | null
}
export interface RadarSchool {

@ -8,22 +8,62 @@
</picker>
</view>
<view class="field">
<text class="form-label">需求标题 *</text>
<text class="form-label">项目名称 *</text>
<input
v-model="form.title"
class="input"
maxlength="40"
placeholder="请输入标题"
placeholder="请输入项目名称"
placeholder-class="input-placeholder"
/>
</view>
<view class="field">
<text class="form-label">需求描述 *</text>
<text class="form-label">行业类型 *</text>
<input
v-model="form.industry_type"
class="input"
maxlength="40"
placeholder="如:人工智能、生物医药"
placeholder-class="input-placeholder"
/>
</view>
<view class="field">
<text class="form-label">主营业务 *</text>
<input
v-model="form.main_business"
class="input"
maxlength="80"
placeholder="请输入主营业务"
placeholder-class="input-placeholder"
/>
</view>
<view v-if="selectedTypeValue === 'finance'" class="field">
<text class="form-label">金额 *</text>
<input
v-model="form.finance_amount"
class="input"
maxlength="40"
placeholder="如500万、A轮1000万"
placeholder-class="input-placeholder"
/>
</view>
<view v-if="selectedTypeValue === 'hire'" class="field">
<text class="form-label">岗位需求 *</text>
<input
v-model="form.job_positions"
class="input"
maxlength="80"
placeholder="如:算法工程师 2 名"
placeholder-class="input-placeholder"
/>
</view>
<view class="field">
<text class="form-label">简要描述 *</text>
<textarea
v-model="form.content"
class="textarea"
maxlength="300"
placeholder="请详细描述需求"
maxlength="500"
:placeholder="contentPlaceholder"
placeholder-class="input-placeholder"
/>
</view>
@ -42,7 +82,7 @@ export default {
</script>
<script setup lang="ts">
import { reactive, ref } from 'vue'
import { computed, reactive, ref } from 'vue'
import { onShow } from '@dcloudio/uni-app'
import { demandApi, dictApi } from '@/api/dict'
import { useUserStore } from '@/stores/user'
@ -52,13 +92,24 @@ const userStore = useUserStore()
const typeItems = ref<ApiDictItem[]>([])
const typeLabels = ref<string[]>([])
const selectedTypeLabel = ref('')
const selectedTypeValue = ref('')
const submitting = ref(false)
const form = reactive({
type_dict_item_id: 0,
title: '',
industry_type: '',
main_business: '',
finance_amount: '',
job_positions: '',
content: '',
})
const contentPlaceholder = computed(() =>
selectedTypeValue.value === 'hire'
? '需填写所需职位的具体描述,如岗位要求、核心能力、薪酬范围等'
: '请简要描述您的需求',
)
onShow(async () => {
if (!userStore.isLoggedIn) {
uni.navigateTo({ url: '/subpkg/login/index' })
@ -84,19 +135,40 @@ function onTypeChange(event: UniHelper.PickerChangeEvent) {
const item = typeItems.value[index]
if (!item) return
selectedTypeLabel.value = item.label
selectedTypeValue.value = item.value
form.type_dict_item_id = item.id
if (item.value !== 'finance') form.finance_amount = ''
if (item.value !== 'hire') form.job_positions = ''
}
async function submit() {
if (!form.type_dict_item_id || !form.title.trim() || !form.content.trim()) {
if (
!form.type_dict_item_id ||
!form.title.trim() ||
!form.industry_type.trim() ||
!form.main_business.trim() ||
!form.content.trim()
) {
uni.showToast({ title: '请完整填写表单', icon: 'none' })
return
}
if (selectedTypeValue.value === 'finance' && !form.finance_amount.trim()) {
uni.showToast({ title: '请填写融资金额', icon: 'none' })
return
}
if (selectedTypeValue.value === 'hire' && !form.job_positions.trim()) {
uni.showToast({ title: '请填写岗位需求', icon: 'none' })
return
}
submitting.value = true
try {
await demandApi.create({
type_dict_item_id: form.type_dict_item_id,
title: form.title.trim(),
industry_type: form.industry_type.trim(),
main_business: form.main_business.trim(),
finance_amount: form.finance_amount.trim() || undefined,
job_positions: form.job_positions.trim() || undefined,
content: form.content.trim(),
company: userStore.profile.company || userStore.user?.company || undefined,
})
@ -124,6 +196,7 @@ async function submit() {
.field {
box-sizing: border-box;
width: 100%;
margin-bottom: 24rpx;
}
.picker-field {

@ -12,6 +12,10 @@
<StatusTag :text="demand.status || '已提交'" />
</view>
<text class="title">{{ demand.title }}</text>
<text v-if="demand.industry_type" class="meta-line">{{ demand.industry_type }}</text>
<text v-if="demand.main_business" class="meta-line">{{ demand.main_business }}</text>
<text v-if="demand.finance_amount" class="meta-line">{{ demand.finance_amount }}</text>
<text v-if="demand.job_positions" class="meta-line">{{ demand.job_positions }}</text>
<text class="summary">{{ demand.description }}</text>
<text class="muted small date">{{ demand.date }}</text>
</view>
@ -103,6 +107,13 @@ function goCreate() {
line-height: 1.6;
}
.meta-line {
display: block;
margin-top: 10rpx;
color: #6b7280;
font-size: 26rpx;
}
.date {
display: block;
margin-top: 20rpx;

@ -19,6 +19,10 @@
<text class="detail-label">联系电话</text>
<text class="detail-value contact-value" @tap="copyContact(teacher.phone)">{{ teacher.phone }}</text>
</view>
<view v-if="teacher.status_item?.label" class="detail-row">
<text class="detail-label">跟进状态</text>
<text class="detail-value">{{ teacher.status_item.label }}</text>
</view>
<view v-if="teacher.research_direction" class="detail-row">
<text class="detail-label">研究方向</text>
<text class="detail-value">{{ teacher.research_direction }}</text>
@ -60,6 +64,7 @@ interface TeacherDetail {
research_direction?: string | null
email?: string | null
phone?: string | null
status_item?: { id: number; label: string; value: string } | null
}
const loading = ref(true)

@ -131,6 +131,10 @@ export interface ApiDemand {
type_dict_item_id?: number
status?: string | null
title: string
industry_type?: string | null
main_business?: string | null
finance_amount?: string | null
job_positions?: string | null
description?: string | null
date?: string | null
}

Loading…
Cancel
Save