| | |
| | | state.isBind = true |
| | | storage.setItem("token", resp.data.access_token || "") |
| | | state.hasLogin = true |
| | | if(inviter){ |
| | | if (inviter) { |
| | | storage.removeItem('inviter'); |
| | | storage.removeItem('inviterTime'); |
| | | storage.removeItem('inviterName'); |
| | |
| | | } |
| | | return resp |
| | | }, |
| | | loginSupplier: async function({ |
| | | regSupplier: async function({ |
| | | commit, |
| | | dispatch, |
| | | state |
| | | }, data) { |
| | | { |
| | | const resp = await http.request('post', '/api/login/supplier'+(data.phoneNumber?'/phone':''), { |
| | | const resp = await http.request('post', '/api/register/supplier', { |
| | | data: { |
| | | username: data.username, |
| | | password: data.password, |
| | | tel:data.phoneNumber, |
| | | smsCode:data.smsCode || '' |
| | | tel: data.phoneNumber || data.tel, |
| | | smsCode: data.smsCode || '' |
| | | }, |
| | | params: { |
| | | clientType: data.clientType || 'app' |
| | | } |
| | | }) |
| | | console.log('resp', resp) |
| | | if (resp && resp.code == 0) { |
| | | |
| | | |
| | | } else { |
| | | |
| | | } |
| | | return resp |
| | | } |
| | | |
| | | }, |
| | | loginPartner: async function({ |
| | | commit, |
| | | dispatch, |
| | | state |
| | | }, data) { |
| | | { |
| | | const resp = await http.request('post', '/api/login/partner' + (data |
| | | .phoneNumber ? '/phone' : ''), { |
| | | data: { |
| | | username: data.username, |
| | | password: data.password, |
| | | tel: data.phoneNumber || data.tel, |
| | | smsCode: data.smsCode || '' |
| | | }, |
| | | params: { |
| | | clientType: data.clientType || 'app' |
| | |
| | | storage.setItem('token', resp.data.access_token) |
| | | commit("updateLogin", true) |
| | | await dispatch('getCurrentInfo') |
| | | |
| | | |
| | | console.log('login,reLaunch') |
| | | // #ifdef APP |
| | | var KeepAliveModule = uni.requireNativePlugin("yh-nl") //保活组件 |
| | |
| | | // url: '/views/app/app-home/app-home' |
| | | // }) |
| | | uni.reLaunch({ |
| | | url: '/pages/home/farmer-home' |
| | | url: '/pages/home/supplier-home' |
| | | }) |
| | | } else { |
| | | // this.$message.showToast('登录失败') |
| | | |
| | | } |
| | | return resp |
| | | } |
| | | |
| | | }, |
| | | loginSupplier: async function({ |
| | | commit, |
| | | dispatch, |
| | | state |
| | | }, data) { |
| | | { |
| | | const resp = await http.request('post', '/api/login/supplier' + (data |
| | | .phoneNumber ? '/phone' : ''), { |
| | | data: { |
| | | username: data.username, |
| | | password: data.password, |
| | | tel: data.phoneNumber || data.tel, |
| | | smsCode: data.smsCode || '' |
| | | }, |
| | | params: { |
| | | clientType: data.clientType || 'app' |
| | | } |
| | | }) |
| | | console.log('resp', resp) |
| | | if (resp && resp.code == 0) { |
| | | // await getCurrentInfo() |
| | | // // this.$message.showToast('登录成功') |
| | | // console.log(resp) |
| | | storage.setItem('token', resp.data.access_token) |
| | | commit("updateLogin", true) |
| | | await dispatch('getCurrentInfo') |
| | | |
| | | console.log('login,reLaunch') |
| | | // #ifdef APP |
| | | var KeepAliveModule = uni.requireNativePlugin("yh-nl") //保活组件 |
| | | |
| | | KeepAliveModule && KeepAliveModule.startLocation({ |
| | | intervalTime: 5000, //定位间隔时间 |
| | | gaodeApiKey: "0eef1axxxxxx7964", //高德地图Key,已停用,引入插件配置 |
| | | locationMode: 1, //定位模式 |
| | | purpose: 0, //定位场景 |
| | | ifUpload: true, //是否上报服务器 |
| | | uploadUrl: "http://bio51-api.fixbug.fun/api/current/employee/location", //上报接口 |
| | | params: "{'lat':'1','lng':'3'}", //其他参数 |
| | | headers: "{'authorization1':'Bearer xOHeJhg'}", |
| | | }, function(res) { |
| | | console.log("启用结果:", res); |
| | | let ret = KeepAliveModule.getCurrentLocation(); |
| | | console.log("启用结果2:", ret); |
| | | }); |
| | | // #endif |
| | | // uni.redirectTo({ |
| | | // url: '/views/app/app-home/app-home' |
| | | // }) |
| | | uni.reLaunch({ |
| | | url: '/pages/home/supplier-home' |
| | | }) |
| | | } else { |
| | | // this.$message.showToast('登录失败') |