// pages/index/index.ts import { httpUtil } from "../../utils/restful"; import { loginType } from '../../utils/loginType' Page({ /** * 页面的初始数据 */ data: { }, /** * 生命周期函数--监听页面加载 */ onLoad() { // httpUtil.wxGet(httpUtil.interfaces.getUserById, null).then((res) => { // console.log("res:", res) // }).catch((res) => { // console.log(res) // }) }, clickItem: function (event: any) { console.log(event.target.id) let type = null; switch (Number(event.target.id)) { case 0: console.log("click teacher") type = loginType.Teacher break; case 1: console.log("click installer") type = loginType.Installer break; case 2: console.log("click repairman") type = loginType.Repairman break; case 3: console.log("click it") type = loginType.IT break; } this.toLoginPage(type) }, toLoginPage: function (type: any) { wx.navigateTo({ url: '../login/login?loginType=' + type, }) }, })