refactor: remove duplicate miniapp page sources
This commit is contained in:
@@ -1,66 +0,0 @@
|
||||
// pages/local-eligibility/local-eligibility.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
}
|
||||
})
|
||||
@@ -1,42 +1,84 @@
|
||||
// 本地资格说明页 U62
|
||||
// 解释为什么需要本地资格,引导用户声明
|
||||
import api from '../../utils/api'
|
||||
|
||||
type EligibilityStatus =
|
||||
| 'not_declared'
|
||||
| 'declared'
|
||||
| 'needs_evidence'
|
||||
| 'pending_review'
|
||||
| 'verified'
|
||||
| 'rejected'
|
||||
|
||||
interface EligibilityStatusResponse {
|
||||
verificationStatus?: EligibilityStatus
|
||||
eligibilityType?: string
|
||||
}
|
||||
|
||||
Page({
|
||||
data: {
|
||||
loading: true,
|
||||
loadError: false,
|
||||
submitting: false,
|
||||
status: 'not_declared' as EligibilityStatus,
|
||||
eligibilityType: '',
|
||||
eligibilityTypes: [
|
||||
{ value: 'household_registration', label: '丹阳户籍', icon: '🏠' },
|
||||
{ value: 'employment', label: '在丹阳工作', icon: '💼' },
|
||||
{ value: 'residence', label: '在丹阳长期居住', icon: '🏡' },
|
||||
{ value: 'other', label: '其他符合服务条件', icon: '⭐' }
|
||||
]
|
||||
{ value: 'household_registration', label: '丹阳户籍', icon: '户' },
|
||||
{ value: 'employment', label: '在丹阳工作', icon: '工' },
|
||||
{ value: 'residence', label: '在丹阳长期居住', icon: '居' },
|
||||
{ value: 'other', label: '其他符合服务条件', icon: '其' },
|
||||
],
|
||||
statusText: {
|
||||
not_declared: '尚未声明',
|
||||
declared: '声明已保存',
|
||||
needs_evidence: '需要补充佐证',
|
||||
pending_review: '审核中',
|
||||
verified: '已核验',
|
||||
rejected: '未通过',
|
||||
} as Record<EligibilityStatus, string>,
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
// 检查当前用户的本地资格状态
|
||||
this.checkStatus()
|
||||
},
|
||||
|
||||
onShow() {
|
||||
this.checkStatus()
|
||||
if (!this.data.loading) this.checkStatus()
|
||||
},
|
||||
|
||||
checkStatus() {
|
||||
const app = getApp<{ getStorageSync: (key: string) => any }>()
|
||||
// TODO: P04-V11 接入真实API
|
||||
// 如果已声明并verified,跳转到已完成提示
|
||||
onPullDownRefresh() {
|
||||
this.checkStatus().finally(() => wx.stopPullDownRefresh())
|
||||
},
|
||||
|
||||
// 选择资格类型
|
||||
onTypeSelect(e: WechatMiniprogram.TouchEvent) {
|
||||
const type = e.currentTarget.dataset.type as string
|
||||
// 跳转到补充核验页(如果需要)或直接提交
|
||||
async checkStatus() {
|
||||
this.setData({ loading: true, loadError: false })
|
||||
try {
|
||||
const result = await api.get<EligibilityStatusResponse>('/local-eligibility')
|
||||
this.setData({
|
||||
loading: false,
|
||||
status: result.verificationStatus || 'not_declared',
|
||||
eligibilityType: result.eligibilityType || '',
|
||||
})
|
||||
return result
|
||||
} catch {
|
||||
this.setData({ loading: false, loadError: true })
|
||||
return null
|
||||
}
|
||||
},
|
||||
|
||||
onTypeSelect(event: WechatMiniprogram.TouchEvent) {
|
||||
const type = event.currentTarget.dataset.type as string
|
||||
wx.navigateTo({
|
||||
url: `/pages/local-eligibility-supplement/local-eligibility-supplement?type=${type}`
|
||||
url: `/pages/local-eligibility-supplement/local-eligibility-supplement?type=${type}`,
|
||||
})
|
||||
},
|
||||
|
||||
// 跳转到已有资格页面
|
||||
go到我的资格() {
|
||||
wx.showToast({ title: '功能开发中', icon: 'none' })
|
||||
}
|
||||
goToMyEligibility() {
|
||||
const { status, eligibilityType, statusText } = this.data
|
||||
if (status === 'needs_evidence' || status === 'rejected' || status === 'declared') {
|
||||
wx.navigateTo({
|
||||
url: `/pages/local-eligibility-supplement/local-eligibility-supplement?type=${eligibilityType || ''}`,
|
||||
})
|
||||
return
|
||||
}
|
||||
wx.showToast({ title: statusText[status] || '状态已更新', icon: 'none' })
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user