import Taro, { Component } from '@tarojs/taro' import { View } from '@tarojs/components' import { AtTextarea } from 'taro-ui' import LFormGroup from '@/c/lform/formGroup' import './apply.scss' class Index extends Component { onShareAppMessage() { return { title: '南昌买房,来洪楼领取专属优惠', path: `/pagesPlan/apply`, } } onShareTimeline () { return { title: '南昌买房,来洪楼领取专属优惠', path: `/pagesPlan/apply`, } } constructor (props) { super(props) this.state = { formObj: {}, isMoreShow: false, } } config = { navigationBarTitleText: '置业小助手', navigationStyle: 'custom', navigationBarTextStyle: 'white' } componentWillMount () { Taro.$AHU(this) // Taro.$msgConfirm('正在开发中~敬请期待', () => { // this.linkHome() // }, () => { // this.linkHome() // }) } saveHandle () { const { formObj } = this.state if (formObj.name && formObj.phone) { const userInfo = Taro.getStorageSync('APP_userInfo') const {eId} = this.$router.params Taro.api.other.planadd({ ...formObj, estate_id: eId || '', userinfo: userInfo ? JSON.stringify(userInfo) : '' }).then(res => { Taro.$msgConfirm('提交成功,洪楼将根据您的情况联系您', () => { if (eId) { Taro.navigateBack({ delta: 1 }) } else { Taro.reLaunch({ url: '/pages/index/index' }) } }, () => { if (eId) { Taro.navigateBack({ delta: 1 }) } else { Taro.reLaunch({ url: '/pages/index/index' }) } }) }) } else { Taro.$msg('请输入您的称呼和手机号~') } } baseFormChange (key, val) { let { formObj } = this.state formObj[key] = val this.setState({ formObj }) } renderGoHome () { const icon = require('@img/images/icon_go_home.png') return ( ) } linkHome () { const pages = getCurrentPages() const pagesLength = pages.length if (pagesLength < 2) { Taro.reLaunch({ url: '/pages/index/index' }) } else { Taro.navigateBack({ delta: 1 }) } } openMore () { this.setState({ isMoreShow: true }) } render () { const { formObj, isMoreShow } = this.state const dictData = Taro.getStorageSync('dictData') || {} const yesnoMoreOptions = {arr: [{key: '不限', val: '-1'}, ...dictData.sys_yesno]} const area_type = {arr: dictData.area_type} const house_type = {arr: dictData.house_type} const topBg = require('./img/apply/banner.jpg') const moreIcon = require('./img/apply/more.gif') const footerBg = require('./img/apply/slogan.jpg') return ( {this.renderGoHome()} { isMoreShow ? : } 提交 ) } } export default Index