2026-09-10 16:06:11 +08:00
|
|
|
import { request } from '../../utils/requestPromise'
|
|
|
|
|
const app = getApp<{ globalData: { apiBase: string; token: string } }>()
|
2026-09-09 22:05:00 +08:00
|
|
|
Page({
|
|
|
|
|
data: {
|
|
|
|
|
services: [] as Array<{ type: string; name: string; description: string; icon: string }>
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onLoad() {
|
|
|
|
|
this.loadServices();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
async loadServices() {
|
|
|
|
|
try {
|
2026-09-10 16:06:11 +08:00
|
|
|
const res = await request<any>({
|
2026-09-09 22:05:00 +08:00
|
|
|
url: `${app.globalData.apiBase}/counseling/services/intro`,
|
|
|
|
|
header: { 'Authorization': `Bearer ${app.globalData.token}` }
|
|
|
|
|
});
|
|
|
|
|
if (res.statusCode === 200 && res.data.success) {
|
|
|
|
|
this.setData({ services: res.data.data });
|
|
|
|
|
}
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.error('加载咨询介绍失败', e);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onSelectService(e: any) {
|
|
|
|
|
const type = e.currentTarget.dataset.type;
|
|
|
|
|
wx.navigateTo({
|
|
|
|
|
url: `/pages/counseling-request/counseling-request?type=${type}`
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|