| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- // index.js
- let myPro = require("../../utils/wxRequest.js");
- let util = require("../../utils/util.js");
- // 获取应用实例
- const app = getApp();
- Page({
- data: {
- current: 0, // 轮播图展示第几个
- interval: 3000, // 自动切换时间间隔
- adList: ['/statics/img/join/1.png','/statics/img/join/2.png','/statics/img/join/3.png'],
- name: '',
- phone: '',
- city: '',
- remark: '',
- showBack: true,
- pageTitle: "招商加盟",
- showHeader: false, // header显示状态
- setBgHeight: getApp().globalData.setBgHeight,
- loading: false // 全局loading
- },
- onLoad: function (options) {
- // Do some initialize when page load.
- },
- onShow: function () {
- // Do something when page show.
- let that = this;
- },
- onReady: function () {
- // Do something when page ready.
- },
- onHide: function () {
- // Do something when page hide.
- },
- onUnload: function () {
- // Do something when page close.
- },
- onPullDownRefresh: function () {
- // Do something when pull down.
-
- },
- onReachBottom: function () {
- // Do something when page reach bottom.
- },
- onPageScroll: function (event) {
- // Do something when page scroll
- let that = this;
- let scrollTop = event.scrollTop;
- if(scrollTop >= that.data.setBgHeight){
- that.setData({
- showHeader: true
- });
- }else{
- that.setData({
- showHeader: false
- });
- }
- },
- onResize: function () {
- // Do something when page resize
- },
- // 广告轮播图切换
- changeAd(event){
- let that = this;
- that.setData({
- current: event.detail.current,
- });
- },
- // 加盟人姓名
- getName(event){
- let that = this;
- that.setData({
- name: event.detail
- });
- },
- // 加盟人电话
- getPhone(event){
- let that = this;
- that.setData({
- phone: event.detail
- });
- },
- // 加盟人地址
- getCity(event){
- let that = this;
- that.setData({
- city: event.detail
- });
- },
- // 加盟人留言
- getRemark(event){
- let that = this;
- that.setData({
- remark: event.detail
- });
- },
- // 提交
- tijiao(){
- let that = this;
- if(!that.data.name){
- wx.showToast({
- title: "请填写您的姓名",
- icon: "none",
- });
- return;
- };
- if(!that.data.phone || !(/^1[3456789]\d{9}$/.test(that.data.phone))){
- wx.showToast({
- title: "手机号有误,请重新填写",
- icon: "none",
- });
- return;
- };
- if(!that.data.city){
- wx.showToast({
- title: "请填写您所在的城市",
- icon: "none",
- });
- return;
- };
- let params = {
- name: that.data.name,
- phone: that.data.phone,
- city: that.data.city
- };
- if(that.data.remark){
- params.remark = that.data.remark
- };
- myPro.wxRequest("user/v2/joinUs","GET",params).then(res=>{
- wx.showToast({
- title: res.msg,
- icon: "none"
- });
- that.setData({
- name: "",
- phone: "",
- city: "",
- remark: ""
- });
- }).catch(err=>{
- console.log("报错信息",err);
- wx.showToast({
- title: err,
- icon: "none"
- })
- })
- }
- });
|