Merge branch 'master' of http://139.186.142.91:10010/r/productDev/zbomyoujia
| | |
| | | } |
| | | // 验证码登录 |
| | | export const loginByPhone = (data) => { |
| | | console.log(data) |
| | | return request({ |
| | | url: '/web/personnel/loginByPhone', |
| | | data |
| | |
| | | }) |
| | | } |
| | | // 获取会员信息 |
| | | export const getMemberInfo = () => { |
| | | export const getMemberInfo = (data) => { |
| | | return request({ |
| | | url: '/web/personnel/getUserDetail', |
| | | data:data |
| | | }) |
| | | } |
| | | // 更新会员信息 |
| | |
| | | import { |
| | | wxLoginCustomer |
| | | wxLoginCustomer, |
| | | getMemberInfo |
| | | } from './api/index' |
| | | App({ |
| | | globalData: { |
| | |
| | | if (WindowInfo.safeArea.top > 20) { |
| | | this.globalData.bottomLift = WindowInfo.screenHeight - WindowInfo.safeArea.bottom; |
| | | } |
| | | wx.login({ |
| | | timeout: 5000, |
| | | success(res) { |
| | | if (res.code) { |
| | | //发起网络请求 |
| | | wxLoginCustomer({ |
| | | code: res.code |
| | | }).then(res => { |
| | | if (res && res.data) { |
| | | wx.setStorageSync('member', res.data.users || '') |
| | | wx.setStorageSync('sessionKey', res.data.sessionKey) |
| | | wx.setStorageSync('token', res.data.token || '') |
| | | } else { |
| | | wx.navigateTo({ |
| | | url: '/pages/login/index', |
| | | }) |
| | | console.log('登录失败!') |
| | | } |
| | | }) |
| | | } else { |
| | | wx.navigateTo({ |
| | | url: '/pages/login/index', |
| | | }) |
| | | console.log('登录失败!' + res) |
| | | } |
| | | }, |
| | | fail(err) { |
| | | console.log(err) |
| | | } |
| | | }) |
| | | } |
| | | let users = wx.getStorageSync('token') |
| | | if(users ==null){ |
| | | wx.navigateTo({ |
| | | url: '/pages/login/index', |
| | | }) |
| | | }else{ |
| | | getMemberInfo({goLogin:true}).then(res => { |
| | | }) |
| | | } |
| | | }, |
| | | }) |
| | |
| | | isShowPoster: true, |
| | | showShare: false, |
| | | posterUrl: res.data |
| | | }) |
| | | |
| | | }) |
| | | }) |
| | | }, |
| | | saveCard() { |
| | |
| | | getDictData, |
| | | getWxMiniPhone, |
| | | loginByPhone, |
| | | bindingOpenid |
| | | bindingOpenid, |
| | | wxLoginCustomer |
| | | } from '../../api/index' |
| | | Page({ |
| | | |
| | |
| | | status: '0', // 标识 |
| | | countDown: 0, |
| | | phone: '', |
| | | openid:'', |
| | | code: '', |
| | | showModal: false, |
| | | activeHtml: '', |
| | |
| | | loginPhone() { |
| | | const { |
| | | code, |
| | | phone |
| | | phone, |
| | | openid |
| | | } = this.data |
| | | if (!this.data.agreementFalg) { |
| | | return wx.showToast({ |
| | |
| | | |
| | | loginByPhone({ |
| | | code, |
| | | openid, |
| | | phone |
| | | }).then(res => { |
| | | if (res.data && res.data.token) { |
| | | wx.login({ |
| | | timeout: 5000, |
| | | success: (loginRes) => { |
| | | if (loginRes.code) { |
| | | this.bindingOpenid(loginRes.code, res.data.token) |
| | | } |
| | | } |
| | | }) |
| | | // wx.login({ |
| | | // timeout: 5000, |
| | | // success: (loginRes) => { |
| | | // if (loginRes.code) { |
| | | // this.bindingOpenid(loginRes.code, res.data.token) |
| | | // } |
| | | // } |
| | | // }) |
| | | if(res.data.phone){ |
| | | res.data.users.phone = res.data.phone || res.data.users.phone |
| | | } |
| | |
| | | primary: app.primary, |
| | | bottomLift: app.bottomLift |
| | | }) |
| | | this.autoLogin() |
| | | this.initData() |
| | | }, |
| | | autoLogin(){ |
| | | var that =this |
| | | wx.login({ |
| | | timeout: 5000, |
| | | success(res) { |
| | | if (res.code) { |
| | | //发起网络请求 |
| | | wxLoginCustomer({ |
| | | code: res.code |
| | | }).then(res => { |
| | | console.log(res) |
| | | wx.setStorageSync('sessionKey', res.data.sessionKey) |
| | | that.setData({openid:res.data.openid}) |
| | | if (res && res.data !=null && res.data.token!=null) { |
| | | console.log(res) |
| | | wx.setStorageSync('member', res.data.users || '') |
| | | wx.setStorageSync('token', res.data.token || '') |
| | | wx.switchTab({ |
| | | url: '/pages/index/index', |
| | | }) |
| | | } |
| | | }) |
| | | } else { |
| | | wx.navigateTo({ |
| | | url: '/pages/login/index', |
| | | }) |
| | | console.log('登录失败!' + res) |
| | | } |
| | | }, |
| | | fail(err) { |
| | | console.log(err) |
| | | } |
| | | }) |
| | | }, |
| | | getPhoneNumber(e) { |
| | | const data = { |
| | | ...e.detail |
| | |
| | | // export const baseUrl = 'http://192.168.0.135:10027' |
| | | export const baseUrl = 'https://dmtest.ahapp.net/web_interface' // 本地 |
| | | export const baseUrl = 'http://192.168.0.135:10027' |
| | | // export const baseUrl = 'https://dmtest.ahapp.net/web_interface' // 本地 |
| | | // export const baseUrl = 'http://zbtest.ahapp.net/zbom_interface/jx/wechat/' //测试服务器 |
| | | |
| | | // export const imageUrl = 'https://osswebcdn.zbom.com/jiaxuan/images/' |
| | |
| | | wx.showLoading() |
| | | number++ |
| | | } |
| | | return new Promise(resolve => { |
| | | return new Promise(resolve=> { |
| | | wx.request({ |
| | | url: baseUrl + options.url, |
| | | data: options.data || {}, |
| | |
| | | resolve(res.data || true) |
| | | } else { |
| | | if (res.data.code && (res.data.code == 5112 || res.data.code == 5111)) { |
| | | wx.navigateTo({ |
| | | url: '/pages/login/index', |
| | | }) |
| | | } |
| | | if(options.data && options.data.goLogin){ |
| | | console.log("==================") |
| | | wx.navigateTo({ |
| | | url: '/pages/login/index', |
| | | }) |
| | | } |
| | | } |
| | | resolve(res) |
| | | res.data.message && wx.showToast({ |
| | | title: res.data.message || '发生错误', |
| | | icon: 'none' |