chore: remove obsolete .js sources for migrated C-group pages
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
Page({
|
||||
data: {
|
||||
risks: [
|
||||
{ title: '投资博彩诱导', description: '刚认识便引导投资、博彩或下载陌生应用' },
|
||||
{ title: '借款资金周转', description: '以生病、工程或临时周转为由反复借款' },
|
||||
{ title: '索取隐私资料', description: '催促脱离平台并索要验证码、银行卡或证件信息' },
|
||||
{ title: '冒充平台人员', description: '以认证、保证金或解冻账户为由要求转账' },
|
||||
],
|
||||
},
|
||||
|
||||
report() {
|
||||
wx.navigateTo({ url: '/pages/report/report?type=fraud' })
|
||||
},
|
||||
|
||||
requestHelp() {
|
||||
wx.showModal({
|
||||
title: '安全求助',
|
||||
content: '如有财产损失或人身危险,请立即拨打 110;非紧急问题可前往平台帮助中心。',
|
||||
confirmText: '拨打 110',
|
||||
cancelText: '帮助中心',
|
||||
success(result) {
|
||||
if (result.confirm) wx.makePhoneCall({ phoneNumber: '110' })
|
||||
else if (result.cancel) wx.navigateTo({ url: '/pages/help-center/help-center' })
|
||||
},
|
||||
})
|
||||
},
|
||||
})
|
||||
@@ -1,76 +0,0 @@
|
||||
const api = require('../../utils/api')
|
||||
|
||||
const formatDate = (value) => {
|
||||
if (!value) return ''
|
||||
const date = new Date(value)
|
||||
if (Number.isNaN(date.getTime())) return ''
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0')
|
||||
const day = String(date.getDate()).padStart(2, '0')
|
||||
return `${date.getFullYear()}-${month}-${day}`
|
||||
}
|
||||
|
||||
Page({
|
||||
data: {
|
||||
categories: [{ id: '', name: '推荐' }],
|
||||
activeCategoryId: '',
|
||||
articles: [],
|
||||
loading: true,
|
||||
loadError: false,
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
this.loadPage()
|
||||
},
|
||||
|
||||
async loadPage() {
|
||||
this.setData({ loading: true, loadError: false })
|
||||
try {
|
||||
const [categories, articles] = await Promise.all([
|
||||
api.get('/content/categories'),
|
||||
api.get('/content/articles'),
|
||||
])
|
||||
this.setData({
|
||||
categories: [{ id: '', name: '推荐' }, ...(categories || [])],
|
||||
articles: this.normalizeArticles(articles || [], categories || []),
|
||||
loading: false,
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('加载婚恋课堂失败', error)
|
||||
this.setData({ loading: false, loadError: true })
|
||||
}
|
||||
},
|
||||
|
||||
normalizeArticles(articles, categories) {
|
||||
const categoryNames = new Map(categories.map((item) => [item.id, item.name]))
|
||||
return articles.map((item) => ({
|
||||
...item,
|
||||
categoryName: categoryNames.get(item.categoryId) || '婚恋课堂',
|
||||
publishAtText: formatDate(item.publishAt || item.createdAt),
|
||||
}))
|
||||
},
|
||||
|
||||
async select(e) {
|
||||
const categoryId = e.currentTarget.dataset.id || ''
|
||||
if (categoryId === this.data.activeCategoryId) return
|
||||
this.setData({ activeCategoryId: categoryId, loading: true, loadError: false })
|
||||
try {
|
||||
const articles = await api.get('/content/articles', categoryId ? { categoryId } : undefined)
|
||||
this.setData({
|
||||
articles: this.normalizeArticles(articles || [], this.data.categories),
|
||||
loading: false,
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('加载课堂分类失败', error)
|
||||
this.setData({ loading: false, loadError: true })
|
||||
}
|
||||
},
|
||||
|
||||
open(e) {
|
||||
const id = e.currentTarget.dataset.id
|
||||
if (id) wx.navigateTo({ url: `/pages/content-detail/content-detail?id=${id}` })
|
||||
},
|
||||
|
||||
onRetry() {
|
||||
this.loadPage()
|
||||
},
|
||||
})
|
||||
@@ -1,65 +0,0 @@
|
||||
const api = require('../../utils/api')
|
||||
|
||||
Page({
|
||||
data: {
|
||||
serviceLocation: null,
|
||||
loading: true,
|
||||
loadError: false,
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
this.loadStation()
|
||||
},
|
||||
|
||||
async loadStation() {
|
||||
this.setData({ loading: true, loadError: false })
|
||||
try {
|
||||
const home = await api.get('/home')
|
||||
this.setData({ serviceLocation: home?.serviceLocation || null, loading: false })
|
||||
} catch (error) {
|
||||
console.error('加载服务站失败', error)
|
||||
this.setData({ loading: false, loadError: true })
|
||||
}
|
||||
},
|
||||
|
||||
call() {
|
||||
const station = this.data.serviceLocation
|
||||
const phoneNumber = station?.contactPhone || station?.contactPhoneDisplay || ''
|
||||
const digitCount = phoneNumber.replace(/\D/g, '').length
|
||||
if (!phoneNumber || phoneNumber.includes('*') || digitCount < 5) {
|
||||
wx.showToast({ title: '联系电话请以预约确认为准', icon: 'none' })
|
||||
return
|
||||
}
|
||||
wx.makePhoneCall({ phoneNumber })
|
||||
},
|
||||
|
||||
openMap() {
|
||||
const station = this.data.serviceLocation
|
||||
const latitude = Number(station?.latitude)
|
||||
const longitude = Number(station?.longitude)
|
||||
if (Number.isFinite(latitude) && Number.isFinite(longitude) && latitude && longitude) {
|
||||
wx.openLocation({
|
||||
latitude,
|
||||
longitude,
|
||||
name: station.name,
|
||||
address: station.address || '',
|
||||
})
|
||||
return
|
||||
}
|
||||
if (station?.address) {
|
||||
wx.setClipboardData({ data: station.address })
|
||||
return
|
||||
}
|
||||
wx.showToast({ title: '暂未提供地图位置', icon: 'none' })
|
||||
},
|
||||
|
||||
book() {
|
||||
const id = this.data.serviceLocation?.id
|
||||
const query = id ? `?serviceLocationId=${encodeURIComponent(id)}` : ''
|
||||
wx.navigateTo({ url: `/pages/service-appointment/service-appointment${query}` })
|
||||
},
|
||||
|
||||
onRetry() {
|
||||
this.loadStation()
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user