123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307 |
- //import * as WxJsApi from '@/utils/wxJsApi.js'
- import * as API from '@/apis/login.js'
- import ResumeAuth from '@/components/job/ResumeAuth.vue'
- import {
- checkPhone
- } from '@/utils'
- export default {
- data() {
- return {
- test:process.env.NODE_ENV === "development",
- phone:"",
- isReady:false,
- vcode:"",
- error:"",
- second:"",
- password:"",
- maxlength:6,
- value:"",
- show:"",
- isSendMsgIng: false,
- sendMsgSecond: 60*2,
- tel:'',
- tab:0,
- message:"",
- backUrl:"",
- form:"",
- readme:true,
- isReady:false,
- auth:false,
- authData:{
-
- }
- }
- },
- components: {
- ResumeAuth
- },
- onLoad(op){
- this.form=op.form;
- if(this.form=="hr"){
- this.tab=2
- }
- if(this.form=="job"){
- this.tab=1
- }
- this.message=op.message;
- this.backUrl=op.back;
- console.log(op)
- },
- computed: {
- inputStyle() {
- let style = {};
- if(this.tel) {
- style.color = "#fff";
- style.backgroundColor = this.$u.color['primary'];
- }
- return style;
- }
- },
- methods: {
- finish(e){
- if(!this.carhelp.getOpenId()){
- uni.showToast({
- title:"请使用“微信”访问本系统登录"
- })
- return
- }
- uni.showLoading({
- title:"加载中",mask:true,
- })
- API.validateCode({
- verifyCode: e,
- telephone:this.tel,
- openId:this.carhelp.getOpenId(),
- form:this.form
- }).then((response) => {
-
- this.loginOk(response);
- }).catch(error => {
- uni.showToast({
- title:error,
- icon:"none"
- })
- })
- },
- showphone(phone){
- if(!phone){
- return "";
- }
- if(phone.length!=11){
- return "";
- }
- return phone.substring(0,3)+'****'+phone.substring(8);
- },
- login2(){
-
-
-
- if (!this.readme) {
- uni.showToast({
- title: "请阅读并同意《用户协议》《隐私政策》",
-
- })
- }
- var time= this.carhelp.get("getvcodetime");
-
- if(time){
- var nowtime= new Date().getTime()
- var differ=(nowtime-time)/1000
- if(differ<2*60){
- this.sendMsgSecond=2*60 - parseInt(differ)
- this.tab=4;
- this.msgTimeInterval();
- }
-
- }
- if (!this.isSendMsgIng) {
- var checkPhoneResult = checkPhone(this.tel);
-
- if(checkPhoneResult!==true){
- uni.showToast({
- title: checkPhoneResult,
-
- })
- return;
- }else{
- uni.showLoading({
- title:"加载中",mask:true,
- })
- API.getVerifyCode(this.tel).then((response) => {
-
- this.tab=4;
- uni.hideLoading();
- this.carhelp.set("getvcodetime",new Date().getTime());
- this.tab=4;
- if(!""){ //response.message
- //倒计时
- this.msgTimeInterval();
- }else{
- uni.showToast({
- title:"您的验证码已经发送[5分钟有效],请勿重复点击"
- })
- }
- }).catch(error => {
- uni.showToast({
- title:error,
- icon:"none"
- })
- })
-
- }
-
-
- }
-
- },
- //倒计时
- msgTimeInterval() {
- this.isSendMsgIng = true;
- var time = this.sendMsgSecond;
- var _this = this;
- this.timer = setInterval(() => {
- if (time > 0) {
- _this.sendMsgSecond = time--;
- } else {
- _this.isSendMsgIng = false;
- _this.sendMsgSecond = 2*60;
- clearInterval(_this.timer)
- }
- }, 1000)
- },
- login3(){
- if(!this.carhelp.getOpenId()){
- uni.showToast({
- title:"请使用“微信”访问本系统登录"
- })
- return
- }
- //var checkPhoneResult = checkPhone(this.tel);
-
- // if(checkPhoneResult!== true){
- // uni.showToast({
- // title: checkPhoneResult,
-
- // })
- // return;
- // }
- if(!this.tel){
- uni.showToast({
- title: "请输入账号",
-
- })
- return;
- }
- if(!this.password){
- uni.showToast({
- title: "请输入密码",
-
- })
- return;
- }
-
- uni.showLoading({
- title:"加载中",mask:true,
- })
- API.passwordLogin({
- phone:this.tel,
- password:this.password,
- openId:this.carhelp.getOpenId(),
- form:this.form
- }).then((response) => {
-
- this.loginOk(response)
- }).catch(error => {
- uni.showToast({
- title:error,
- icon:"none"
- })
- })
-
- },
-
- loginOk(response){
-
- var token = response ? response.data.token : '';
- this.carhelp.setToken(token);
-
- if("job"==this.form){
- this.carhelp.setPersonInfo(response.data.jobUser );
- if(["1","2"].indexOf(response.data.jobUser.isAuthentication)>-1){
- this.loginBack();
- }else{
- uni.hideLoading();
- this.auth=true;
-
- }
- }
- if("hr"==this.form){
- this.carhelp.setPersonInfo(response.data.sysUser );
- this.loginBack();
- }
-
-
- },
- loginBack(){
- if(this.backUrl){
- window.location.href="#"+this.backUrl.split(",").find(function(item){
- return item.indexOf("pages/login/")==-1
- });
- }else{
- this.gotoUrl("pages/"+this.form+"/index/index")
-
- }
- },
- login(){
- if(!this.carhelp.getOpenId()){
- uni.showToast({
- title:"请使用“微信”访问本系统登录"
- })
- return
- }
- if(!this.readme){
- uni.showToast({
- title:"请阅读并同意《用户协议》《隐私政策》",
- icon:"none"
- })
- }else{
- uni.showLoading({
- title: '加载中'
- });
- API.wechatLogin({
- openId:this.carhelp.getOpenId(),
- form:this.form
- }).then((response) => {
-
- this.loginOk(response)
-
- }).catch(error => {
- uni.showToast({
- title:error,
- icon:"none"
- })
- })
- }
-
- }
-
- },onReady(){
- if(this.message){
- uni.showToast({
- title:this.message.split(",")[0],
- icon:"none"
- })
- }
- if(!this.carhelp.getOpenId()){
- uni.showToast({
- title:"请使用“微信”访问本系统登录"
- })
- }
- this.isReady=true;
- },onShow(){
- if(this.isReady){
-
- }
- },
- }
|