Ver código fonte

微信登陆

西昌缴费二期
杨晓琪 2 anos atrás
pai
commit
c9a4731768
2 arquivos alterados com 20 adições e 5 exclusões
  1. +1
    -1
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/App.vue
  2. +19
    -4
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/weixinLogin.vue

+ 1
- 1
Learun.Framework.Ultimate V7/LearunApp-2.2.0/App.vue Ver arquivo

@@ -10,7 +10,7 @@
// H5 刷新时获取当前页面路径
const pagePath = "/" + param.path;
// 如果 H5 刷新后访问的不是首页/登录页/注册页,直接跳转回首页
if (!["/pages/login", "/pages/home", "/pages/signup"].includes(pagePath)) {
if (!["/pages/login", "/pages/weixinLogin","/pages/home", "/pages/signup"].includes(pagePath)) {
this.$nextTick(() => {
this.TAB_TO("/pages/home");
return;


+ 19
- 4
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/weixinLogin.vue Ver arquivo

@@ -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="loginClick(null)" size="lg" color="blue" class="margin-top-sm block" block>确 认</l-button>
<l-button v-if="ready" @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>
@@ -86,8 +86,10 @@ export default {
}
},

async onLoad({code}) {
this.code = code
async onLoad() {
if(this.getHashSearchParam("code")){
this.code = this.getHashSearchParam("code")
}
await this.init()
},

@@ -108,6 +110,17 @@ export default {
// this.ready = true
this.loginInit()
},
getHashSearchParam(key) {
let search = location.search
let array = []
if(search){
search = search.substring(1)
array = search.split("&")
let res = array.find((item)=>item.split("=")[0] == key)
return res.split("=")[1]
}
return ''
},

// 点击新用户注册
signUp() {
@@ -117,8 +130,9 @@ export default {
loginInit(){
if (this.code) {
this.LOADING("加载中...")
this.HTTP_POST("weixinapi/getweixinaccess_token?code="+this.code).then(success=>{
this.HTTP_POST("weixinapi/getweixinaccess_token?code="+this.code,null).then(success=>{
this.HIDE_LOADING()
return
if(!success){
location.href = "http://" + window.location.host;
return
@@ -129,6 +143,7 @@ export default {
token: success.baseinfo.token,
date: moment().format('yyyy-MM-dd hh:mm:ss')
};
this.ready = true
this.SET_STORAGE("token",success.baseinfo.token)
// this.SET_STORAGE("logininfo",logininfo)
// this.SET_STORAGE("userinfo",success)


Carregando…
Cancelar
Salvar