123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
- const app = getApp()
- var util = require("../../utils/util.js")
- Page({
- data: {
- duration: 500,
- latitude: undefined,
- longitude: undefined,
- name: undefined,
- address: undefined,
- arr: [],
- mktarr: [],
- booking_setp: ['学龄前', '小学一年级', '小学一年级', '小学二年级','小学三年级','小学四年级','小学五年级','小学六年级','初中一年级','初中二年级','初中三年级','高中一年级','高中二年级','高中三年级'],
- mktList_m: [
- "https://api.zhumi.tech/MiniProgram/mkt/m1.jpg",
- "https://api.zhumi.tech/MiniProgram/mkt/m2.jpg",
- "https://api.zhumi.tech/MiniProgram/mkt/m3.jpg",
- "https://api.zhumi.tech/MiniProgram/mkt/m4.jpg",
- "https://api.zhumi.tech/MiniProgram/mkt/m5.jpg",
- "https://api.zhumi.tech/MiniProgram/mkt/m6.jpg",
- "https://api.zhumi.tech/MiniProgram/mkt/m7.jpg",
- "https://api.zhumi.tech/MiniProgram/mkt/m8.jpg",
- "https://api.zhumi.tech/MiniProgram/mkt/m9.jpg"
- ],
- mktList_l: [
- "https://api.zhumi.tech/MiniProgram/mkt/l1.jpg",
- "https://api.zhumi.tech/MiniProgram/mkt/l2.jpg",
- "https://api.zhumi.tech/MiniProgram/mkt/l3.jpg",
- "https://api.zhumi.tech/MiniProgram/mkt/l4.jpg",
- "https://api.zhumi.tech/MiniProgram/mkt/l5.jpg",
- "https://api.zhumi.tech/MiniProgram/mkt/l6.jpg",
- "https://api.zhumi.tech/MiniProgram/mkt/l7.jpg",
- "https://api.zhumi.tech/MiniProgram/mkt/l8.jpg",
- "https://api.zhumi.tech/MiniProgram/mkt/l9.jpg"
- ],
- mktImgage: "https://api.zhumi.tech/MiniProgram/mkt/l1.jpg",
- bookingShow: false,
- index_setp: 1,
- mask: false,
- booking: false,
- bookingreturn: false
- },
- onLoad: function(options) {
- this.init(options)
- },
- init(options) {
- var that = this
- util.getData('/getBanners')
- .then(res => {
- that.setData({
- arr: res
- })
- })
- that.setData({
- navH: app.globalData.navHeight
- })
- util.getData('/getMktInfos',{
- mi_branche_code: 110000
- }).then(res => {
- console.log(res)
- that.setData({
- mktarr: res
- })
- })
- that.setData({
- navH: app.globalData.navHeight
- })
- },
- mktImageChange: function(e) {
- this.setData({
- mktImgage: e.currentTarget.dataset.path
- })
- },
- //点击轮播图
- BhrefPm: function(e) {
- var index = e.currentTarget.dataset.index;
- if (index != null) {
- if (e.currentTarget.dataset.type == 1) {
- wx.navigateTo({
- url: '/pages/promotion/promotionhref?para=' + index
- })
- }
- if (e.currentTarget.dataset.type == 2) {
- wx.navigateTo({
- url: index
- })
- }
- }
- },
- onShareAppMessage: function() {
- return {
- title: '科技强国梦 编程向未来',
- path: '/pages/index/index?id=888'
- }
- },
- // map
- markertap: function(e) {
- wx.getLocation({
- type: 'gcj02', //返回可以用于wx.openLocation的经纬度
- success: function(res) {
- var latitude = e.currentTarget.dataset.latitude
- var longitude = e.currentTarget.dataset.longitude
- wx.openLocation({ //出发wx.openLocation API
- latitude: Number(latitude), //坐标纬度(从地图获取坐标)
- longitude: Number(longitude), //坐标经度(从地图获取坐标)
- name: e.currentTarget.dataset.name, //打开后显示的地址名称
- address: e.currentTarget.dataset.address, //打开后显示的地址汉字
- scale: 17
- })
- }
- })
- },
- hrefoBooking () {
- this.setData({
- mask: true,
- booking: true,
- bookingreturn: false
- })
- },
- hrefoKc() {
- wx.navigateTo({
- url: '/pages/packages/packages'
- })
- },
- hideAllBox() {
- this.setData({
- //遮罩层隐藏
- mask: false,
- booking: false,
- bookingreturn: false
- })
- },
- bindPickerChange: function(e) {
- this.setData({
- index_setp: e.detail.value
- })
- },
- submitForm: function(data) {
- let obj = {
- ...data.detail.value,
- }
- if (obj.phone.length < 11) {
- wx.showToast({
- title: '手机号填写不完整',
- icon: 'none',
- duration: 2000
- })
- return
- }
- if (obj.name == null || obj.name == '' ) {
- wx.showToast({
- title: '请填写孩子姓名',
- icon: 'none',
- duration: 2000
- })
- return
- }
- obj.college_code = this.data.booking_setp[obj.step]
- util.postData('/college/addCollegeBooking', obj)
- .then(res => {
- if (res == 1) {
- this.setData({
- booking: false,
- bookingreturn: true
- })
- }
- })
- }
- })
|