|
|
@@ -31,7 +31,7 @@ |
|
|
|
<l-input v-if="ready" v-model="password" placeholder="请输入身份证后八位" password left> |
|
|
|
<l-icon slot="title" type="lock" /> |
|
|
|
</l-input> |
|
|
|
<l-button @click="login(null)" size="lg" color="blue" class="margin-top-sm block" block>确 认</l-button> |
|
|
|
<l-button @click="loginClick(null)" size="lg" color="blue" class="margin-top-sm block" block>确 认</l-button> |
|
|
|
<view class="otherLogin"> |
|
|
|
<navigator url="/pages/login" class="textBtn">常规登陆</text></navigator> |
|
|
|
</view> |
|
|
@@ -68,11 +68,14 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import moment from 'moment'; |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
username: '', |
|
|
|
password: '', |
|
|
|
|
|
|
|
code:'', |
|
|
|
|
|
|
|
ready: false, |
|
|
|
showApiRootSelector: false, |
|
|
@@ -83,7 +86,8 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
async onLoad() { |
|
|
|
async onLoad({code}) { |
|
|
|
this.code = code |
|
|
|
await this.init() |
|
|
|
}, |
|
|
|
|
|
|
@@ -101,7 +105,8 @@ export default { |
|
|
|
this.username = account.username |
|
|
|
this.password = account.password |
|
|
|
} |
|
|
|
this.ready = true |
|
|
|
// this.ready = true |
|
|
|
this.loginInit() |
|
|
|
}, |
|
|
|
|
|
|
|
// 点击新用户注册 |
|
|
@@ -109,7 +114,82 @@ export default { |
|
|
|
this.NAV_TO('/pages/signup') |
|
|
|
}, |
|
|
|
|
|
|
|
// 切换后台地址 |
|
|
|
loginInit(){ |
|
|
|
if (this.code) { |
|
|
|
this.LOADING("加载中...") |
|
|
|
this.HTTP_POST("weixinapi/getweixinaccess_token?code="+this.code).then(success=>{ |
|
|
|
this.HIDE_LOADING() |
|
|
|
if(!success){ |
|
|
|
location.href = "http://" + window.location.host; |
|
|
|
return |
|
|
|
} |
|
|
|
if(success.logined){ |
|
|
|
var logininfo = { |
|
|
|
account: account, |
|
|
|
token: success.baseinfo.token, |
|
|
|
date: moment().format('yyyy-MM-dd hh:mm:ss') |
|
|
|
}; |
|
|
|
this.SET_STORAGE("logininfo",logininfo) |
|
|
|
this.SET_STORAGE("userinfo",success) |
|
|
|
location.href = "http://" + window.location.host; |
|
|
|
}else{ |
|
|
|
this.ready = true |
|
|
|
this.openid = success.openid |
|
|
|
} |
|
|
|
}) |
|
|
|
} else { |
|
|
|
this.HIDE_LOADING(); |
|
|
|
this.HTTP_GET("weixinapi/weixinconfig").then(success=>{ |
|
|
|
if(!success){ |
|
|
|
return |
|
|
|
} |
|
|
|
window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + success.appid + "&redirect_uri=" + encodeURIComponent('http://' + window.location.host + '/pages/weixinLogin') + "&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect"; |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
loginClick(){ |
|
|
|
|
|
|
|
|
|
|
|
// 点击登录 |
|
|
|
// 账号密码登录时,验证输入,输入有误则返回 |
|
|
|
if (!this.check()) { |
|
|
|
return |
|
|
|
} |
|
|
|
let up = true |
|
|
|
|
|
|
|
var postData = { |
|
|
|
username: this.username, |
|
|
|
password: this.MD5(this.password) , |
|
|
|
openid: this.openid, |
|
|
|
up: up |
|
|
|
}; |
|
|
|
this.LOADING("正在登录,请稍后") |
|
|
|
this.HTTP_POST("weixinapi/loginbyidcard", postData).then(success=>{ |
|
|
|
this.HIDE_LOADING() |
|
|
|
if(!success){ |
|
|
|
return |
|
|
|
} |
|
|
|
var logininfo = { |
|
|
|
account: this.username, |
|
|
|
token: success.baseinfo.token, |
|
|
|
date: moment().format('yyyy-MM-dd hh:mm:ss') |
|
|
|
}; |
|
|
|
this.SET_STORAGE('logininfo', logininfo); |
|
|
|
this.SET_STORAGE('userinfo', success); |
|
|
|
this.username = "" |
|
|
|
this.password = "" |
|
|
|
if (success.pwd === true) { |
|
|
|
this.SET_STORAGE('pwd', true); |
|
|
|
this.TOAST("绑定失败!您的密码不满足强度要求,请您先修改密码后再执行系统其他操作"); |
|
|
|
} else { |
|
|
|
this.SET_STORAGE('pwd', false); |
|
|
|
} |
|
|
|
location.href = "http://" + window.location.host; |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 切换后台地址 |
|
|
|
changeApiRoot(newIndex) { |
|
|
|
const newApiRoot = this.apiRootList[newIndex] |
|
|
|
this.currentApiRoot = newApiRoot |
|
|
@@ -272,7 +352,7 @@ page { |
|
|
|
|
|
|
|
.otherLogin{ |
|
|
|
display: flex; |
|
|
|
justify-content: right; |
|
|
|
justify-content: flex-end; |
|
|
|
.textBtn{ |
|
|
|
width: 100px; |
|
|
|
color: #606266; |
|
|
|