feat(apply): 入驻只收基本信息并新增启动页、材料后补与改服务城市
入驻表单移除身份证与证件材料(服务城市单选下拉,默认北京),只填姓名/手机/性别/城市/简介即可提交;新增 pages/launch 启动页先解析身份再跳转,无身份直接进申请页不再闪现首页;新增 pages/materials 证件材料补传页;个人资料页支持在职陪诊师修改服务城市;appId 更名为 wxapp_companion。
This commit is contained in:
@@ -7,7 +7,8 @@ const role = require('./utils/role.js');
|
|||||||
// ==================== 全局页面守卫 ====================
|
// ==================== 全局页面守卫 ====================
|
||||||
// 无身份用户(role=none)只能停留在入驻申请页,其余页面在 onShow 时统一重定向。
|
// 无身份用户(role=none)只能停留在入驻申请页,其余页面在 onShow 时统一重定向。
|
||||||
// 包装全局 Page 构造器集中处理,避免在 10 个页面各写一遍、漏掉某个入口就绕过去了。
|
// 包装全局 Page 构造器集中处理,避免在 10 个页面各写一遍、漏掉某个入口就绕过去了。
|
||||||
const ROLE_WHITELIST = ['pages/apply/index'];
|
// 启动页自行判断身份并跳转,不能在这里重定向,否则和它自己的跳转会互相抢。
|
||||||
|
const ROLE_WHITELIST = ['pages/launch/index', 'pages/apply/index'];
|
||||||
let redirecting = false;
|
let redirecting = false;
|
||||||
|
|
||||||
function guardPage(route) {
|
function guardPage(route) {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"pages": [
|
"pages": [
|
||||||
|
"pages/launch/index",
|
||||||
"pages/home/index",
|
"pages/home/index",
|
||||||
"pages/ai/index",
|
"pages/ai/index",
|
||||||
"pages/set/index",
|
"pages/set/index",
|
||||||
@@ -10,6 +11,7 @@
|
|||||||
"pages/healthprofile/index",
|
"pages/healthprofile/index",
|
||||||
"pages/healthprofile/profileInfo",
|
"pages/healthprofile/profileInfo",
|
||||||
"pages/me/index",
|
"pages/me/index",
|
||||||
|
"pages/materials/index",
|
||||||
"pages/apply/index"
|
"pages/apply/index"
|
||||||
],
|
],
|
||||||
"usingComponents": {
|
"usingComponents": {
|
||||||
|
|||||||
+15
-95
@@ -5,6 +5,7 @@
|
|||||||
// 审核通过后本页 onShow 会强刷角色,直接切回首页,不需要用户手动重新登录。
|
// 审核通过后本页 onShow 会强刷角色,直接切回首页,不需要用户手动重新登录。
|
||||||
const API = require('../../utils/api.js')
|
const API = require('../../utils/api.js')
|
||||||
const role = require('../../utils/role.js')
|
const role = require('../../utils/role.js')
|
||||||
|
const { CITY_OPTIONS, CITY_LABELS, cityIndex, cityLabel } = require('../../utils/city.js')
|
||||||
|
|
||||||
const SEX_OPTIONS = [
|
const SEX_OPTIONS = [
|
||||||
{ value: 'female', label: '女' },
|
{ value: 'female', label: '女' },
|
||||||
@@ -12,10 +13,6 @@ const SEX_OPTIONS = [
|
|||||||
]
|
]
|
||||||
const SEX_LABELS = SEX_OPTIONS.map((item) => item.label)
|
const SEX_LABELS = SEX_OPTIONS.map((item) => item.label)
|
||||||
const MOBILE_REGEX = /^1[3-9]\d{9}$/
|
const MOBILE_REGEX = /^1[3-9]\d{9}$/
|
||||||
const ID_NUMBER_REGEX = /^\d{17}[\dXx]$/
|
|
||||||
// 服务端单张限 5MB,但 wx.request 请求体上限 10MB:
|
|
||||||
// base64 膨胀 4/3,两张 5MB 图 ≈ 13MB 会在发送前就失败,端上按 3MB/张收紧
|
|
||||||
const MAX_IMAGE_BYTES = 3 * 1024 * 1024
|
|
||||||
|
|
||||||
Page({
|
Page({
|
||||||
data: {
|
data: {
|
||||||
@@ -27,30 +24,18 @@ Page({
|
|||||||
serviceAreaText: '',
|
serviceAreaText: '',
|
||||||
submitTimeText: '',
|
submitTimeText: '',
|
||||||
accountName: '微信用户',
|
accountName: '微信用户',
|
||||||
today: '',
|
|
||||||
sexLabels: SEX_LABELS,
|
sexLabels: SEX_LABELS,
|
||||||
sexIndex: 0,
|
sexIndex: 0,
|
||||||
|
cityLabels: CITY_LABELS,
|
||||||
|
cityIndex: 0,
|
||||||
form: {
|
form: {
|
||||||
name: '',
|
name: '',
|
||||||
mobile: '',
|
mobile: '',
|
||||||
idNumber: '',
|
|
||||||
sex: '',
|
sex: '',
|
||||||
serviceAreas: '',
|
|
||||||
introduction: ''
|
introduction: ''
|
||||||
},
|
|
||||||
healthExpireDate: '',
|
|
||||||
photos: {
|
|
||||||
qualification: '',
|
|
||||||
healthCertificate: ''
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onLoad() {
|
|
||||||
const now = new Date()
|
|
||||||
const pad = (n) => String(n).padStart(2, '0')
|
|
||||||
this.setData({ today: `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())}` })
|
|
||||||
},
|
|
||||||
|
|
||||||
onShow() {
|
onShow() {
|
||||||
this.refresh()
|
this.refresh()
|
||||||
},
|
},
|
||||||
@@ -99,7 +84,7 @@ Page({
|
|||||||
view: 'pending',
|
view: 'pending',
|
||||||
application,
|
application,
|
||||||
accountName,
|
accountName,
|
||||||
serviceAreaText: (application.applicant.serviceAreas || []).join('、'),
|
serviceAreaText: (application.applicant.serviceAreas || []).map(cityLabel).join('、'),
|
||||||
submitTimeText: this.formatTime(application.createtime)
|
submitTimeText: this.formatTime(application.createtime)
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
@@ -121,13 +106,11 @@ Page({
|
|||||||
accountName,
|
accountName,
|
||||||
rejectReason: application.rejectReason || '',
|
rejectReason: application.rejectReason || '',
|
||||||
sexIndex: sexIndex > -1 ? sexIndex : 0,
|
sexIndex: sexIndex > -1 ? sexIndex : 0,
|
||||||
healthExpireDate: application.healthExpireDate || '',
|
cityIndex: cityIndex((applicant.serviceAreas || [])[0]),
|
||||||
form: {
|
form: {
|
||||||
name: applicant.name || '',
|
name: applicant.name || '',
|
||||||
mobile: applicant.mobile || '',
|
mobile: applicant.mobile || '',
|
||||||
idNumber: applicant.idNumber || '',
|
|
||||||
sex: applicant.sex || '',
|
sex: applicant.sex || '',
|
||||||
serviceAreas: (applicant.serviceAreas || []).join(','),
|
|
||||||
introduction: applicant.introduction || ''
|
introduction: applicant.introduction || ''
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -158,96 +141,31 @@ Page({
|
|||||||
this.setData({ sexIndex: index, 'form.sex': option ? option.value : '' })
|
this.setData({ sexIndex: index, 'form.sex': option ? option.value : '' })
|
||||||
},
|
},
|
||||||
|
|
||||||
onExpireChange(e) {
|
onCityChange(e) {
|
||||||
this.setData({ healthExpireDate: e.detail.value })
|
this.setData({ cityIndex: Number(e.detail.value) || 0 })
|
||||||
},
|
|
||||||
|
|
||||||
pickImage(e) {
|
|
||||||
const field = e.currentTarget.dataset.field
|
|
||||||
if (!field) return
|
|
||||||
|
|
||||||
wx.chooseMedia({
|
|
||||||
count: 1,
|
|
||||||
mediaType: ['image'],
|
|
||||||
sourceType: ['album', 'camera'],
|
|
||||||
sizeType: ['compressed'],
|
|
||||||
success: (res) => {
|
|
||||||
const file = res.tempFiles && res.tempFiles[0]
|
|
||||||
if (!file) return
|
|
||||||
if (file.size && file.size > 10 * 1024 * 1024) {
|
|
||||||
wx.showToast({ title: '请选择 10MB 以内的图片', icon: 'none' })
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// 先压再读:原图直传很容易把请求体顶到小程序 10MB 上限
|
|
||||||
wx.compressImage({
|
|
||||||
src: file.tempFilePath,
|
|
||||||
quality: 60,
|
|
||||||
success: (compressed) => this.readAsDataUrl(compressed.tempFilePath, field),
|
|
||||||
fail: () => this.readAsDataUrl(file.tempFilePath, field)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
fail: () => {}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
readAsDataUrl(path, field) {
|
|
||||||
wx.getFileSystemManager().readFile({
|
|
||||||
filePath: path,
|
|
||||||
encoding: 'base64',
|
|
||||||
success: (res) => {
|
|
||||||
const bytes = Math.floor((res.data.length * 3) / 4)
|
|
||||||
if (bytes > MAX_IMAGE_BYTES) {
|
|
||||||
wx.showToast({ title: '图片过大,请重新拍摄或裁剪到 3MB 以内', icon: 'none' })
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const mime = /\.png$/i.test(path) ? 'png' : 'jpeg'
|
|
||||||
this.setData({ [`photos.${field}`]: `data:image/${mime};base64,${res.data}` })
|
|
||||||
},
|
|
||||||
fail: () => {
|
|
||||||
wx.showToast({ title: '读取图片失败', icon: 'none' })
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
submit() {
|
submit() {
|
||||||
if (this.data.submitting) return
|
if (this.data.submitting) return
|
||||||
|
|
||||||
const { form, photos, healthExpireDate, application } = this.data
|
const { form, cityIndex: cityIdx } = this.data
|
||||||
const name = form.name.trim()
|
const name = form.name.trim()
|
||||||
const mobile = form.mobile.trim()
|
const mobile = form.mobile.trim()
|
||||||
const idNumber = form.idNumber.trim().toUpperCase()
|
const serviceArea = CITY_OPTIONS[cityIdx] || CITY_OPTIONS[0]
|
||||||
const areas = form.serviceAreas
|
|
||||||
.split(/[,,、\s]+/)
|
|
||||||
.map((item) => item.trim())
|
|
||||||
.filter(Boolean)
|
|
||||||
|
|
||||||
if (!name) return this.toast('请填写姓名')
|
if (!name) return this.toast('请填写姓名')
|
||||||
if (!MOBILE_REGEX.test(mobile)) return this.toast('请填写正确的手机号')
|
if (!MOBILE_REGEX.test(mobile)) return this.toast('请填写正确的手机号')
|
||||||
if (!ID_NUMBER_REGEX.test(idNumber)) return this.toast('请填写 18 位身份证号')
|
|
||||||
if (!areas.length) return this.toast('请填写服务城市')
|
|
||||||
if (!healthExpireDate) return this.toast('请选择健康证明有效期')
|
|
||||||
|
|
||||||
// 驳回后重新提交时允许沿用上次上传的证件照
|
|
||||||
const isResubmit = !!application && application.status === 'rejected'
|
|
||||||
if (!photos.qualification && !isResubmit) return this.toast('请上传资质证书照片')
|
|
||||||
if (!photos.healthCertificate && !isResubmit) return this.toast('请上传健康证明照片')
|
|
||||||
|
|
||||||
|
// 先只收基本信息:身份证与证件材料不在此填写,材料可审核通过后补传
|
||||||
const payload = {
|
const payload = {
|
||||||
applicant: {
|
applicant: {
|
||||||
name,
|
name,
|
||||||
mobile,
|
mobile,
|
||||||
idNumber,
|
|
||||||
sex: form.sex,
|
sex: form.sex,
|
||||||
serviceAreas: areas,
|
serviceAreas: [serviceArea.value],
|
||||||
introduction: form.introduction.trim()
|
introduction: form.introduction.trim()
|
||||||
},
|
|
||||||
healthExpireDate
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
const materials = {}
|
|
||||||
if (photos.qualification) materials.qualification = photos.qualification
|
|
||||||
if (photos.healthCertificate) materials.healthCertificate = photos.healthCertificate
|
|
||||||
if (Object.keys(materials).length) payload.materials = materials
|
|
||||||
|
|
||||||
this.setData({ submitting: true })
|
this.setData({ submitting: true })
|
||||||
API.attendantApplication
|
API.attendantApplication
|
||||||
@@ -261,7 +179,9 @@ Page({
|
|||||||
view: 'pending',
|
view: 'pending',
|
||||||
application: next,
|
application: next,
|
||||||
rejectReason: '',
|
rejectReason: '',
|
||||||
serviceAreaText: next ? (next.applicant.serviceAreas || []).join('、') : areas.join('、'),
|
serviceAreaText: next
|
||||||
|
? (next.applicant.serviceAreas || []).map(cityLabel).join('、')
|
||||||
|
: cityLabel(serviceArea.value),
|
||||||
submitTimeText: next ? this.formatTime(next.createtime) : ''
|
submitTimeText: next ? this.formatTime(next.createtime) : ''
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
|
|||||||
+17
-76
@@ -25,6 +25,10 @@
|
|||||||
<text class="row-label">服务城市</text>
|
<text class="row-label">服务城市</text>
|
||||||
<text class="row-value">{{serviceAreaText}}</text>
|
<text class="row-value">{{serviceAreaText}}</text>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="row">
|
||||||
|
<text class="row-label">证件材料</text>
|
||||||
|
<text class="row-value">{{application.hasQualification && application.hasHealthCertificate ? '已上传' : '待补充'}}</text>
|
||||||
|
</view>
|
||||||
<view class="row">
|
<view class="row">
|
||||||
<text class="row-label">提交时间</text>
|
<text class="row-label">提交时间</text>
|
||||||
<text class="row-value">{{submitTimeText}}</text>
|
<text class="row-value">{{submitTimeText}}</text>
|
||||||
@@ -55,7 +59,7 @@
|
|||||||
<view class="reject-box" wx:if="{{rejectReason}}">
|
<view class="reject-box" wx:if="{{rejectReason}}">
|
||||||
<text class="reject-title">上次申请未通过</text>
|
<text class="reject-title">上次申请未通过</text>
|
||||||
<text class="reject-text">原因:{{rejectReason}}</text>
|
<text class="reject-text">原因:{{rejectReason}}</text>
|
||||||
<text class="reject-hint">修改后可重新提交,已上传的证件照无需重复上传。</text>
|
<text class="reject-hint">修改后可重新提交。</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="card">
|
<view class="card">
|
||||||
@@ -86,18 +90,6 @@
|
|||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="field">
|
|
||||||
<text class="field-label">身份证号</text>
|
|
||||||
<input
|
|
||||||
class="field-input"
|
|
||||||
value="{{form.idNumber}}"
|
|
||||||
data-key="idNumber"
|
|
||||||
maxlength="18"
|
|
||||||
placeholder="18 位身份证号"
|
|
||||||
bindinput="onInput"
|
|
||||||
/>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="field">
|
<view class="field">
|
||||||
<text class="field-label">性别</text>
|
<text class="field-label">性别</text>
|
||||||
<picker
|
<picker
|
||||||
@@ -116,13 +108,18 @@
|
|||||||
|
|
||||||
<view class="field">
|
<view class="field">
|
||||||
<text class="field-label">服务城市</text>
|
<text class="field-label">服务城市</text>
|
||||||
<input
|
<picker
|
||||||
class="field-input"
|
class="field-picker"
|
||||||
value="{{form.serviceAreas}}"
|
mode="selector"
|
||||||
data-key="serviceAreas"
|
range="{{cityLabels}}"
|
||||||
placeholder="多个城市用逗号分隔"
|
value="{{cityIndex}}"
|
||||||
bindinput="onInput"
|
bindchange="onCityChange"
|
||||||
/>
|
>
|
||||||
|
<view class="field-value">
|
||||||
|
{{cityLabels[cityIndex]}}
|
||||||
|
<text class="arrow">›</text>
|
||||||
|
</view>
|
||||||
|
</picker>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="field field-block">
|
<view class="field field-block">
|
||||||
@@ -138,62 +135,6 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="card">
|
|
||||||
<text class="card-title">证件材料</text>
|
|
||||||
|
|
||||||
<view class="upload-row">
|
|
||||||
<view class="upload-tile" data-field="qualification" bindtap="pickImage">
|
|
||||||
<image
|
|
||||||
wx:if="{{photos.qualification}}"
|
|
||||||
class="upload-img"
|
|
||||||
src="{{photos.qualification}}"
|
|
||||||
mode="aspectFill"
|
|
||||||
/>
|
|
||||||
<view wx:else class="upload-empty">
|
|
||||||
<text class="upload-plus">+</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="upload-meta">
|
|
||||||
<text class="upload-name">资质证书照片</text>
|
|
||||||
<text class="upload-tip">{{photos.qualification ? '已选择,点击可重新上传' : 'JPG / PNG,单张不超过 3MB'}}</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="upload-row">
|
|
||||||
<view class="upload-tile" data-field="healthCertificate" bindtap="pickImage">
|
|
||||||
<image
|
|
||||||
wx:if="{{photos.healthCertificate}}"
|
|
||||||
class="upload-img"
|
|
||||||
src="{{photos.healthCertificate}}"
|
|
||||||
mode="aspectFill"
|
|
||||||
/>
|
|
||||||
<view wx:else class="upload-empty">
|
|
||||||
<text class="upload-plus">+</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="upload-meta">
|
|
||||||
<text class="upload-name">健康证明照片</text>
|
|
||||||
<text class="upload-tip">{{photos.healthCertificate ? '已选择,点击可重新上传' : 'JPG / PNG,单张不超过 3MB'}}</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="field">
|
|
||||||
<text class="field-label">健康证有效期</text>
|
|
||||||
<picker
|
|
||||||
class="field-picker"
|
|
||||||
mode="date"
|
|
||||||
value="{{healthExpireDate}}"
|
|
||||||
start="{{today}}"
|
|
||||||
bindchange="onExpireChange"
|
|
||||||
>
|
|
||||||
<view class="field-value {{healthExpireDate ? '' : 'placeholder'}}">
|
|
||||||
{{healthExpireDate || '请选择到期日期'}}
|
|
||||||
<text class="arrow">›</text>
|
|
||||||
</view>
|
|
||||||
</picker>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<button class="submit-btn" loading="{{submitting}}" disabled="{{submitting}}" bindtap="submit">
|
<button class="submit-btn" loading="{{submitting}}" disabled="{{submitting}}" bindtap="submit">
|
||||||
提交申请
|
提交申请
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -69,6 +69,13 @@
|
|||||||
color: #2A211B;
|
color: #2A211B;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.card-tip {
|
||||||
|
display: block;
|
||||||
|
padding-bottom: 8rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #9C9188;
|
||||||
|
}
|
||||||
|
|
||||||
/* 表单行 */
|
/* 表单行 */
|
||||||
.field {
|
.field {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
// pages/launch/index.js
|
||||||
|
// 启动页:冷启动先解析身份再决定去首页还是入驻申请页,
|
||||||
|
// 避免默认首页先渲染一帧再被全局守卫重定向。
|
||||||
|
const role = require('../../utils/role.js')
|
||||||
|
|
||||||
|
Page({
|
||||||
|
data: {
|
||||||
|
error: ''
|
||||||
|
},
|
||||||
|
|
||||||
|
onShow() {
|
||||||
|
this.enter()
|
||||||
|
},
|
||||||
|
|
||||||
|
enter() {
|
||||||
|
this.setData({ error: '' })
|
||||||
|
role
|
||||||
|
.ensureRoleSafe(true)
|
||||||
|
.then((detail) => {
|
||||||
|
if (!detail.ok) {
|
||||||
|
this.setData({ error: '网络异常,请重试' })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (detail.role === 'none') {
|
||||||
|
wx.reLaunch({ url: '/pages/apply/index' })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
wx.switchTab({ url: '/pages/home/index' })
|
||||||
|
})
|
||||||
|
.catch(() => this.setData({ error: '网络异常,请重试' }))
|
||||||
|
},
|
||||||
|
|
||||||
|
onRetry() {
|
||||||
|
this.enter()
|
||||||
|
}
|
||||||
|
})
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"navigationStyle": "custom",
|
||||||
|
"usingComponents": {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
/* pages/launch/index.less */
|
||||||
|
page {
|
||||||
|
background-color: #FAF6F1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.launch-page {
|
||||||
|
min-height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background: #FAF6F1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.launch-brand {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.launch-title {
|
||||||
|
font-size: 44rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #C26A2E;
|
||||||
|
}
|
||||||
|
|
||||||
|
.launch-sub {
|
||||||
|
margin-top: 12rpx;
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #9C9188;
|
||||||
|
}
|
||||||
|
|
||||||
|
.launch-tip {
|
||||||
|
margin-top: 48rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #B5AAA0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.launch-error {
|
||||||
|
margin-top: 48rpx;
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #C26A2E;
|
||||||
|
}
|
||||||
|
|
||||||
|
.launch-retry {
|
||||||
|
margin-top: 24rpx;
|
||||||
|
border-radius: 40rpx;
|
||||||
|
background: #C26A2E;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<!--pages/launch/index.wxml-->
|
||||||
|
<view class="launch-page">
|
||||||
|
<view class="launch-brand">
|
||||||
|
<text class="launch-title">暖橙陪诊</text>
|
||||||
|
<text class="launch-sub">陪诊师工作台</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<block wx:if="{{error}}">
|
||||||
|
<text class="launch-error">{{error}}</text>
|
||||||
|
<button class="launch-retry" size="mini" bindtap="onRetry">重试</button>
|
||||||
|
</block>
|
||||||
|
<text wx:else class="launch-tip">正在进入…</text>
|
||||||
|
</view>
|
||||||
@@ -0,0 +1,160 @@
|
|||||||
|
// pages/materials/index.js
|
||||||
|
// 证件材料后补:入驻申请提交时材料可为空,审核前/通过后在此补传。
|
||||||
|
// 只提交本次选择或修改的字段,未改动的保留服务端原值。
|
||||||
|
const API = require('../../utils/api.js')
|
||||||
|
|
||||||
|
// 与服务端 IMAGE_MAX_BYTES 一致:单张 3MB,避免请求体超过小程序 10MB 上限
|
||||||
|
const MAX_IMAGE_BYTES = 3 * 1024 * 1024
|
||||||
|
|
||||||
|
Page({
|
||||||
|
data: {
|
||||||
|
loading: true,
|
||||||
|
submitting: false,
|
||||||
|
application: null,
|
||||||
|
statusText: '',
|
||||||
|
hasQualification: false,
|
||||||
|
hasHealthCertificate: false,
|
||||||
|
healthExpireDate: '',
|
||||||
|
photos: {
|
||||||
|
qualification: '',
|
||||||
|
healthCertificate: ''
|
||||||
|
},
|
||||||
|
today: ''
|
||||||
|
},
|
||||||
|
|
||||||
|
onLoad() {
|
||||||
|
const now = new Date()
|
||||||
|
const pad = (n) => String(n).padStart(2, '0')
|
||||||
|
this.setData({ today: `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())}` })
|
||||||
|
},
|
||||||
|
|
||||||
|
onShow() {
|
||||||
|
this.load()
|
||||||
|
},
|
||||||
|
|
||||||
|
load() {
|
||||||
|
this.setData({ loading: true })
|
||||||
|
API.attendantApplication
|
||||||
|
.getMine()
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code !== 0) {
|
||||||
|
this.setData({ loading: false })
|
||||||
|
wx.showToast({ title: res.msg || '加载失败', icon: 'none' })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const application = res.data ? res.data.application : null
|
||||||
|
const statusText = application
|
||||||
|
? ({ pending: '待审核', approved: '已通过', rejected: '已驳回' }[application.status] || '')
|
||||||
|
: ''
|
||||||
|
this.originalExpireDate = (application && application.healthExpireDate) || ''
|
||||||
|
this.setData({
|
||||||
|
loading: false,
|
||||||
|
application,
|
||||||
|
statusText,
|
||||||
|
hasQualification: !!(application && application.hasQualification),
|
||||||
|
hasHealthCertificate: !!(application && application.hasHealthCertificate),
|
||||||
|
healthExpireDate: this.originalExpireDate
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.setData({ loading: false })
|
||||||
|
wx.showToast({ title: '网络错误,请重试', icon: 'none' })
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
onExpireChange(e) {
|
||||||
|
this.setData({ healthExpireDate: e.detail.value })
|
||||||
|
},
|
||||||
|
|
||||||
|
pickImage(e) {
|
||||||
|
const field = e.currentTarget.dataset.field
|
||||||
|
if (!field) return
|
||||||
|
|
||||||
|
wx.chooseMedia({
|
||||||
|
count: 1,
|
||||||
|
mediaType: ['image'],
|
||||||
|
sourceType: ['album', 'camera'],
|
||||||
|
sizeType: ['compressed'],
|
||||||
|
success: (res) => {
|
||||||
|
const file = res.tempFiles && res.tempFiles[0]
|
||||||
|
if (!file) return
|
||||||
|
if (file.size && file.size > 10 * 1024 * 1024) {
|
||||||
|
wx.showToast({ title: '请选择 10MB 以内的图片', icon: 'none' })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 先压再读:原图直传容易把请求体顶到小程序 10MB 上限
|
||||||
|
wx.compressImage({
|
||||||
|
src: file.tempFilePath,
|
||||||
|
quality: 60,
|
||||||
|
success: (compressed) => this.readAsDataUrl(compressed.tempFilePath, field),
|
||||||
|
fail: () => this.readAsDataUrl(file.tempFilePath, field)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
fail: () => {}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
readAsDataUrl(path, field) {
|
||||||
|
wx.getFileSystemManager().readFile({
|
||||||
|
filePath: path,
|
||||||
|
encoding: 'base64',
|
||||||
|
success: (res) => {
|
||||||
|
const bytes = Math.floor((res.data.length * 3) / 4)
|
||||||
|
if (bytes > MAX_IMAGE_BYTES) {
|
||||||
|
wx.showToast({ title: '图片过大,请重新拍摄或裁剪到 3MB 以内', icon: 'none' })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const mime = /\.png$/i.test(path) ? 'png' : 'jpeg'
|
||||||
|
this.setData({ [`photos.${field}`]: `data:image/${mime};base64,${res.data}` })
|
||||||
|
},
|
||||||
|
fail: () => {
|
||||||
|
wx.showToast({ title: '读取图片失败', icon: 'none' })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
submit() {
|
||||||
|
if (this.data.submitting) return
|
||||||
|
if (!this.data.application) return this.toast('没有可补充的入驻申请')
|
||||||
|
|
||||||
|
const { photos, healthExpireDate, application } = this.data
|
||||||
|
const payload = {}
|
||||||
|
if (photos.qualification) payload.qualification = photos.qualification
|
||||||
|
if (photos.healthCertificate) payload.healthCertificate = photos.healthCertificate
|
||||||
|
if (healthExpireDate && healthExpireDate !== this.originalExpireDate) {
|
||||||
|
payload.healthExpireDate = healthExpireDate
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Object.keys(payload).length) {
|
||||||
|
if (application.status === 'rejected') return this.toast('申请已驳回,请重新提交入驻申请')
|
||||||
|
return this.toast('请选择要补充的证件材料')
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setData({ submitting: true })
|
||||||
|
API.attendantApplication
|
||||||
|
.updateMaterials(payload)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
wx.showToast({ title: '材料已补充', icon: 'success' })
|
||||||
|
this.originalExpireDate = healthExpireDate || this.originalExpireDate
|
||||||
|
this.setData({
|
||||||
|
submitting: false,
|
||||||
|
photos: { qualification: '', healthCertificate: '' },
|
||||||
|
hasQualification: photos.qualification ? true : this.data.hasQualification,
|
||||||
|
hasHealthCertificate: photos.healthCertificate ? true : this.data.hasHealthCertificate
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.setData({ submitting: false })
|
||||||
|
wx.showToast({ title: res.msg || '保存失败', icon: 'none' })
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.setData({ submitting: false })
|
||||||
|
wx.showToast({ title: '网络错误,请重试', icon: 'none' })
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
toast(title) {
|
||||||
|
wx.showToast({ title, icon: 'none' })
|
||||||
|
}
|
||||||
|
})
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"navigationBarTitleText": "证件材料",
|
||||||
|
"usingComponents": {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,195 @@
|
|||||||
|
/* pages/materials/index.less */
|
||||||
|
page {
|
||||||
|
background-color: #FAF6F1;
|
||||||
|
color: #2A211B;
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
.materials-page {
|
||||||
|
min-height: 100vh;
|
||||||
|
background: #FAF6F1;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-box {
|
||||||
|
padding: 120rpx 0;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-text {
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #9C9188;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero {
|
||||||
|
padding: 16rpx 8rpx 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-title {
|
||||||
|
display: block;
|
||||||
|
font-size: 40rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #2A211B;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-desc {
|
||||||
|
display: block;
|
||||||
|
margin-top: 12rpx;
|
||||||
|
font-size: 26rpx;
|
||||||
|
line-height: 1.6;
|
||||||
|
color: #8A8078;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card,
|
||||||
|
.empty-card,
|
||||||
|
.status-card {
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 24rpx;
|
||||||
|
padding: 24rpx 28rpx;
|
||||||
|
box-shadow: 0 4rpx 20rpx rgba(74, 64, 56, 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-card {
|
||||||
|
margin-top: 40rpx;
|
||||||
|
text-align: center;
|
||||||
|
padding: 64rpx 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-title {
|
||||||
|
display: block;
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-desc {
|
||||||
|
display: block;
|
||||||
|
margin-top: 16rpx;
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #8A8078;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-card {
|
||||||
|
margin-bottom: 24rpx;
|
||||||
|
background: #FFF3EC;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-title {
|
||||||
|
display: block;
|
||||||
|
font-size: 28rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #C26A2E;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-desc {
|
||||||
|
display: block;
|
||||||
|
margin-top: 8rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #8A8078;
|
||||||
|
}
|
||||||
|
|
||||||
|
.upload-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 20rpx 0;
|
||||||
|
border-bottom: 1rpx solid #F4EFE9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.upload-row:last-of-type {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.upload-tile {
|
||||||
|
width: 160rpx;
|
||||||
|
height: 160rpx;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
background: #FAF6F1;
|
||||||
|
border: 1rpx dashed #D9CFC5;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
overflow: hidden;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.upload-img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.upload-empty {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.upload-plus {
|
||||||
|
font-size: 56rpx;
|
||||||
|
color: #C9BFB5;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.upload-meta {
|
||||||
|
margin-left: 24rpx;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.upload-name {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #2A211B;
|
||||||
|
}
|
||||||
|
|
||||||
|
.upload-tip {
|
||||||
|
margin-top: 8rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #9C9188;
|
||||||
|
}
|
||||||
|
|
||||||
|
.field {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
min-height: 96rpx;
|
||||||
|
border-top: 1rpx solid #F4EFE9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.field-label {
|
||||||
|
width: 200rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #6F655C;
|
||||||
|
}
|
||||||
|
|
||||||
|
.field-picker {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.field-value {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #2A211B;
|
||||||
|
}
|
||||||
|
|
||||||
|
.field-value.placeholder {
|
||||||
|
color: #B5AAA0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.arrow {
|
||||||
|
margin-left: 8rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #C9BFB5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.submit-btn {
|
||||||
|
margin-top: 40rpx;
|
||||||
|
border-radius: 48rpx;
|
||||||
|
background: #C26A2E;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 30rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.submit-btn[disabled] {
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
<!--pages/materials/index.wxml-->
|
||||||
|
<view class="materials-page">
|
||||||
|
<view class="loading-box" wx:if="{{loading}}">
|
||||||
|
<text class="loading-text">加载中…</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<block wx:elif="{{!application}}">
|
||||||
|
<view class="empty-card">
|
||||||
|
<text class="empty-title">暂无入驻申请</text>
|
||||||
|
<text class="empty-desc">提交陪诊师入驻申请后,可在这里补传证件材料。</text>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<block wx:else>
|
||||||
|
<view class="hero">
|
||||||
|
<text class="hero-title">证件材料</text>
|
||||||
|
<text class="hero-desc">入驻时未上传的材料可在此补传;已上传的重新选择会覆盖原图。</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="status-card" wx:if="{{application.status === 'rejected'}}">
|
||||||
|
<text class="status-title">申请已驳回</text>
|
||||||
|
<text class="status-desc">请在入驻申请页修改资料后重新提交,驳回状态下不能单独补材料。</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="card">
|
||||||
|
<view class="upload-row">
|
||||||
|
<view class="upload-tile" data-field="qualification" bindtap="pickImage">
|
||||||
|
<image
|
||||||
|
wx:if="{{photos.qualification}}"
|
||||||
|
class="upload-img"
|
||||||
|
src="{{photos.qualification}}"
|
||||||
|
mode="aspectFill"
|
||||||
|
/>
|
||||||
|
<view wx:else class="upload-empty">
|
||||||
|
<text class="upload-plus">+</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="upload-meta">
|
||||||
|
<text class="upload-name">资质证书照片</text>
|
||||||
|
<text class="upload-tip">
|
||||||
|
{{photos.qualification ? '已选择,点击可重新上传' : (hasQualification ? '已上传,点击可更换' : '未上传,点击补传')}}
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="upload-row">
|
||||||
|
<view class="upload-tile" data-field="healthCertificate" bindtap="pickImage">
|
||||||
|
<image
|
||||||
|
wx:if="{{photos.healthCertificate}}"
|
||||||
|
class="upload-img"
|
||||||
|
src="{{photos.healthCertificate}}"
|
||||||
|
mode="aspectFill"
|
||||||
|
/>
|
||||||
|
<view wx:else class="upload-empty">
|
||||||
|
<text class="upload-plus">+</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="upload-meta">
|
||||||
|
<text class="upload-name">健康证明照片</text>
|
||||||
|
<text class="upload-tip">
|
||||||
|
{{photos.healthCertificate ? '已选择,点击可重新上传' : (hasHealthCertificate ? '已上传,点击可更换' : '未上传,点击补传')}}
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="field">
|
||||||
|
<text class="field-label">健康证有效期</text>
|
||||||
|
<picker
|
||||||
|
class="field-picker"
|
||||||
|
mode="date"
|
||||||
|
value="{{healthExpireDate}}"
|
||||||
|
start="{{today}}"
|
||||||
|
bindchange="onExpireChange"
|
||||||
|
>
|
||||||
|
<view class="field-value {{healthExpireDate ? '' : 'placeholder'}}">
|
||||||
|
{{healthExpireDate || '可后补,点击选择'}}
|
||||||
|
<text class="arrow">›</text>
|
||||||
|
</view>
|
||||||
|
</picker>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<button
|
||||||
|
class="submit-btn"
|
||||||
|
loading="{{submitting}}"
|
||||||
|
disabled="{{submitting || application.status === 'rejected'}}"
|
||||||
|
bindtap="submit"
|
||||||
|
>
|
||||||
|
保存材料
|
||||||
|
</button>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
+66
-1
@@ -1,5 +1,7 @@
|
|||||||
// pages/me/index.js
|
// pages/me/index.js
|
||||||
|
const API = require('../../utils/api.js')
|
||||||
const role = require('../../utils/role.js')
|
const role = require('../../utils/role.js')
|
||||||
|
const { CITY_OPTIONS, CITY_LABELS, cityIndex, cityLabel } = require('../../utils/city.js')
|
||||||
|
|
||||||
// 性别映射
|
// 性别映射
|
||||||
const SEX_MAP = {
|
const SEX_MAP = {
|
||||||
@@ -10,7 +12,11 @@ const SEX_MAP = {
|
|||||||
Page({
|
Page({
|
||||||
data: {
|
data: {
|
||||||
user: {},
|
user: {},
|
||||||
identityText: ''
|
identityText: '',
|
||||||
|
isAttendant: false,
|
||||||
|
serviceAreaLabels: CITY_LABELS,
|
||||||
|
serviceAreaIndex: 0,
|
||||||
|
serviceAreaText: ''
|
||||||
},
|
},
|
||||||
|
|
||||||
onShow() {
|
onShow() {
|
||||||
@@ -26,13 +32,72 @@ Page({
|
|||||||
.ensureRoleSafe()
|
.ensureRoleSafe()
|
||||||
.then((detail) => {
|
.then((detail) => {
|
||||||
const attendant = detail.attendant || null
|
const attendant = detail.attendant || null
|
||||||
|
const isAttendant = detail.role === 'attendant'
|
||||||
this.setData({
|
this.setData({
|
||||||
|
isAttendant,
|
||||||
identityText: detail.role === 'admin' ? '管理员' : (attendant ? attendant.text : '')
|
identityText: detail.role === 'admin' ? '管理员' : (attendant ? attendant.text : '')
|
||||||
})
|
})
|
||||||
|
if (isAttendant) this.loadServiceArea()
|
||||||
})
|
})
|
||||||
.catch(() => {})
|
.catch(() => {})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务城市:以员工档案 attendantInfo.serviceAreas 为准
|
||||||
|
*/
|
||||||
|
loadServiceArea() {
|
||||||
|
API.employee
|
||||||
|
.getMe()
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code !== 0 || !res.data || !res.data.employee) return
|
||||||
|
const areas = res.data.employee.attendantInfo
|
||||||
|
? res.data.employee.attendantInfo.serviceAreas || []
|
||||||
|
: []
|
||||||
|
this.applyServiceArea(areas[0])
|
||||||
|
})
|
||||||
|
.catch(() => {})
|
||||||
|
},
|
||||||
|
|
||||||
|
applyServiceArea(value) {
|
||||||
|
this.setData({
|
||||||
|
serviceAreaIndex: cityIndex(value),
|
||||||
|
serviceAreaText: value ? cityLabel(value) : '未设置'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改服务城市:只影响订单池可见范围
|
||||||
|
*/
|
||||||
|
onServiceAreaChange(e) {
|
||||||
|
const index = Number(e.detail.value) || 0
|
||||||
|
const option = CITY_OPTIONS[index]
|
||||||
|
if (!option) return
|
||||||
|
|
||||||
|
wx.showLoading({ title: '保存中...' })
|
||||||
|
API.employee
|
||||||
|
.setServiceArea(option.value)
|
||||||
|
.then((res) => {
|
||||||
|
wx.hideLoading()
|
||||||
|
if (res.code === 0) {
|
||||||
|
this.applyServiceArea(option.value)
|
||||||
|
wx.showToast({ title: '服务城市已更新', icon: 'success' })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
wx.showToast({ title: res.msg || '保存失败', icon: 'none' })
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
wx.hideLoading()
|
||||||
|
wx.showToast({ title: (err && err.message) || '网络错误,请重试', icon: 'none' })
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 证件材料后补入口
|
||||||
|
*/
|
||||||
|
onMaterialsTap() {
|
||||||
|
wx.navigateTo({ url: '/pages/materials/index' })
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载当前登录用户信息
|
* 加载当前登录用户信息
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -104,3 +104,16 @@ page {
|
|||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.picker-value {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
|
color: #C26A2E;
|
||||||
|
}
|
||||||
|
|
||||||
|
.arrow {
|
||||||
|
margin-left: 8rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #C9BFB5;
|
||||||
|
}
|
||||||
|
|||||||
@@ -56,6 +56,33 @@
|
|||||||
</view>
|
</view>
|
||||||
<text class="info-value">{{user.locationText || '未填写'}}</text>
|
<text class="info-value">{{user.locationText || '未填写'}}</text>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="info-item" wx:if="{{isAttendant}}">
|
||||||
|
<view class="info-left">
|
||||||
|
<t-icon name="location" size="36rpx" color="#C26A2E" />
|
||||||
|
<text class="info-label">服务城市</text>
|
||||||
|
</view>
|
||||||
|
<picker
|
||||||
|
mode="selector"
|
||||||
|
range="{{serviceAreaLabels}}"
|
||||||
|
value="{{serviceAreaIndex}}"
|
||||||
|
bindchange="onServiceAreaChange"
|
||||||
|
>
|
||||||
|
<view class="info-value picker-value">
|
||||||
|
{{serviceAreaText || '未设置'}}
|
||||||
|
<text class="arrow">›</text>
|
||||||
|
</view>
|
||||||
|
</picker>
|
||||||
|
</view>
|
||||||
|
<view class="info-item" bindtap="onMaterialsTap">
|
||||||
|
<view class="info-left">
|
||||||
|
<t-icon name="file" size="36rpx" color="#C26A2E" />
|
||||||
|
<text class="info-label">证件材料</text>
|
||||||
|
</view>
|
||||||
|
<view class="info-value picker-value">
|
||||||
|
查看 / 补传
|
||||||
|
<text class="arrow">›</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
<view class="info-item">
|
<view class="info-item">
|
||||||
<view class="info-left">
|
<view class="info-left">
|
||||||
<t-icon name="time" size="36rpx" color="#C26A2E" />
|
<t-icon name="time" size="36rpx" color="#C26A2E" />
|
||||||
|
|||||||
@@ -44,6 +44,8 @@ const API = {
|
|||||||
getMe: () => request.get('/health/employee/me'),
|
getMe: () => request.get('/health/employee/me'),
|
||||||
// 首页接单开关:仅在职正式陪诊师可切换
|
// 首页接单开关:仅在职正式陪诊师可切换
|
||||||
setOnline: (isOnline) => request.patch('/health/employee/me/online', { isOnline }),
|
setOnline: (isOnline) => request.patch('/health/employee/me/online', { isOnline }),
|
||||||
|
// 陪诊师本人修改服务城市(订单池按该城市过滤)
|
||||||
|
setServiceArea: (serviceArea) => request.patch('/health/employee/me/service-area', { serviceArea }),
|
||||||
// 共享订单时的陪诊师候选(在职陪诊师,含实习)
|
// 共享订单时的陪诊师候选(在职陪诊师,含实习)
|
||||||
getShareableAttendants: () => request.get('/health/employee/shareable-attendants'),
|
getShareableAttendants: () => request.get('/health/employee/shareable-attendants'),
|
||||||
},
|
},
|
||||||
@@ -52,6 +54,8 @@ const API = {
|
|||||||
attendantApplication: {
|
attendantApplication: {
|
||||||
create: (data) => request.post('/health/attendant-application', data),
|
create: (data) => request.post('/health/attendant-application', data),
|
||||||
getMine: () => request.get('/health/attendant-application/mine'),
|
getMine: () => request.get('/health/attendant-application/mine'),
|
||||||
|
// 证件材料后补:只覆盖本次提交的字段
|
||||||
|
updateMaterials: (data) => request.post('/health/attendant-application/mine/materials', data),
|
||||||
list: (params) => request.get('/health/attendant-application', params),
|
list: (params) => request.get('/health/attendant-application', params),
|
||||||
getMaterials: (id) => request.get(`/health/attendant-application/${id}/materials`),
|
getMaterials: (id) => request.get(`/health/attendant-application/${id}/materials`),
|
||||||
review: (id, data) => request.post(`/health/attendant-application/${id}/review`, data),
|
review: (id, data) => request.post(`/health/attendant-application/${id}/review`, data),
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
// utils/city.js
|
||||||
|
// 服务城市白名单:与 api/health/resource/services.js 的 SERVICE_AREAS 保持一致。
|
||||||
|
// value 带「市」,用于入库与订单 hospital.province 匹配;label 仅用于展示。
|
||||||
|
const CITY_OPTIONS = [
|
||||||
|
{ value: '北京市', label: '北京' },
|
||||||
|
{ value: '上海市', label: '上海' },
|
||||||
|
{ value: '天津市', label: '天津' },
|
||||||
|
{ value: '西安市', label: '西安' }
|
||||||
|
]
|
||||||
|
|
||||||
|
const CITY_LABELS = CITY_OPTIONS.map((item) => item.label)
|
||||||
|
|
||||||
|
function cityIndex(value) {
|
||||||
|
const index = CITY_OPTIONS.findIndex((item) => item.value === value)
|
||||||
|
return index > -1 ? index : 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function cityLabel(value) {
|
||||||
|
const item = CITY_OPTIONS.find((option) => option.value === value)
|
||||||
|
return item ? item.label : (value || '')
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
CITY_OPTIONS,
|
||||||
|
CITY_LABELS,
|
||||||
|
cityIndex,
|
||||||
|
cityLabel
|
||||||
|
}
|
||||||
+1
-1
@@ -26,7 +26,7 @@ class Request {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
data.appId = 'wxapp-escort-admin'
|
data.appId = 'wxapp_companion'
|
||||||
|
|
||||||
wx.request({
|
wx.request({
|
||||||
url: url.startsWith('http') ? url : `${this.baseURL}${url}`,
|
url: url.startsWith('http') ? url : `${this.baseURL}${url}`,
|
||||||
|
|||||||
+2
-2
@@ -1,14 +1,14 @@
|
|||||||
// utils/role.js
|
// utils/role.js
|
||||||
// 管理端角色:admin(管理员)/ attendant(在职陪诊员)/ none(无可用身份)
|
// 管理端角色:admin(管理员)/ attendant(在职陪诊员)/ none(无可用身份)
|
||||||
//
|
//
|
||||||
// - 管理员身份按登录响应的 apps 判定,只认本小程序(wxapp-escort-admin)。
|
// - 管理员身份按登录响应的 apps 判定,只认本小程序(wxapp_companion)。
|
||||||
// web-escort-admin 是 Web 后台的授权,不带到小程序:否则 Web 管理员登录小程序
|
// web-escort-admin 是 Web 后台的授权,不带到小程序:否则 Web 管理员登录小程序
|
||||||
// 会绕过陪诊师入驻流程直接进 tab 页。
|
// 会绕过陪诊师入驻流程直接进 tab 页。
|
||||||
// - 陪诊员身份以员工档案为准(GET /health/employee/me),不能用 app role 判断,
|
// - 陪诊员身份以员工档案为准(GET /health/employee/me),不能用 app role 判断,
|
||||||
// 普通账号首次登录管理端时 user 服务会写入 role: ["user"]
|
// 普通账号首次登录管理端时 user 服务会写入 role: ["user"]
|
||||||
const API = require('./api.js')
|
const API = require('./api.js')
|
||||||
|
|
||||||
const ADMIN_APP_IDS = ['wxapp-escort-admin']
|
const ADMIN_APP_IDS = ['wxapp_companion']
|
||||||
|
|
||||||
let cachedRole = null
|
let cachedRole = null
|
||||||
// 缓存是否来自一次成功的解析:ensureRole 在接口异常时会把 none 写进缓存,
|
// 缓存是否来自一次成功的解析:ensureRole 在接口异常时会把 none 写进缓存,
|
||||||
|
|||||||
Reference in New Issue
Block a user