Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
brandEventLibraryMiniProgram
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LinChengbiao
brandEventLibraryMiniProgram
Commits
63e878a7
Commit
63e878a7
authored
Oct 16, 2018
by
LinChengbiao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
对接PC端,修改登录页逻辑
parent
c44078ce
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
9 deletions
+35
-9
.wepycache
+0
-0
src/app.wpy
+2
-1
src/components/common/homeHeader.wpy
+7
-1
src/pages/home.wpy
+6
-0
src/pages/login.wpy
+20
-7
No files found.
.wepycache
View file @
63e878a7
This diff is collapsed.
Click to expand it.
src/app.wpy
View file @
63e878a7
...
...
@@ -29,7 +29,8 @@ export default class extends wepy.app {
}
globalData = {
userInfo: null
userInfo: null,
loginRes: null
}
constructor () {
...
...
src/components/common/homeHeader.wpy
View file @
63e878a7
<template>
<view class="homeHeaderWpy">
携程
品牌事件库
{{ loginRes.sourceName }}
品牌事件库
</view>
</template>
...
...
@@ -11,6 +11,12 @@ export default class homeHeader extends wepy.component {
onLoad () {
// console.log('homeHeader')
}
computed = {
loginRes () {
return this.$parent.$parent.globalData.loginRes
}
}
}
</script>
...
...
src/pages/home.wpy
View file @
63e878a7
...
...
@@ -90,6 +90,12 @@ export default class home extends wepy.page {
})
}
computed = {
userInfo () {
return this.$parent.globalData.userInfo
}
}
events = {
toSearch () {
// console.log(this.searchWord)
...
...
src/pages/login.wpy
View file @
63e878a7
...
...
@@ -10,10 +10,10 @@
<image class="logo" src="../static/img/logo.png" />
<!-- 点击按钮的时候弹出授权弹窗,已经授权过的不会弹出弹窗 -->
<button class="btn" wx:if="{{ !userInfo }}" open-type="getUserInfo" @getuserinfo="getUserInfo">登录</button>
<view class="btn" wx:if="{{ userInfo }}" @tap="bindZhiWei">绑定</view>
<button class="btn" wx:if="{{ !userInfo }}" open-type="getUserInfo" @getuserinfo="getUserInfo"
@tap="loginBtn"
>登录</button>
<view class="btn" wx:if="{{ userInfo
&& wait
}}" @tap="bindZhiWei">绑定</view>
<view class="bindIpts" wx:if="{{ userInfo }}">
<view class="bindIpts" wx:if="{{ userInfo
&& wait
}}">
<view class="text">绑定已有帐号</view>
<view class="input">
<image src="../static/img/i_icon_username.png" />
...
...
@@ -50,12 +50,12 @@ export default class login extends wepy.page {
password: ''
},
alertData: {},
autoLogin: true
autoLogin: true,
wait: true
}
onLoad () {
// console.log('login')
this.loginBrandSmall()
}
methods = {
...
...
@@ -72,6 +72,9 @@ export default class login extends wepy.page {
} else {
this.zhiweiBind()
}
},
loginBtn () {
this.wait = false
}
}
...
...
@@ -158,14 +161,15 @@ export default class login extends wepy.page {
url: 'base/loginBrandSmall.do',
method: 'POST',
data: {
code: await this.getCode()
code: await this.getCode(),
wxUserInfo: this.userInfo
}
}).then(res => {
// console.log(res)
if (res.data.state) {
let data = res.data.data
console.log('loginBrandSmall: ', data)
if (
!
this.autoLogin) {
if (this.autoLogin) {
this.alertData = {
show: true,
type: 'success',
...
...
@@ -173,6 +177,7 @@ export default class login extends wepy.page {
duration: 2,
callback: () => {
// console.log('页面跳转到首页')
this.$parent.globalData.loginRes = data
wepy.setStorageSync('JSESSIONID', data.JSESSIONID)
wepy.redirectTo({
url: `/pages/home`
...
...
@@ -180,6 +185,7 @@ export default class login extends wepy.page {
}
}
} else {
this.$parent.globalData.loginRes = data
wepy.setStorageSync('JSESSIONID', data.JSESSIONID)
wepy.redirectTo({
url: `/pages/home`
...
...
@@ -196,6 +202,7 @@ export default class login extends wepy.page {
}
}
}
this.wait = true
this.$apply()
}).catch(err => {
if (!this.autoLogin) {
...
...
@@ -221,6 +228,12 @@ export default class login extends wepy.page {
return this.$parent.globalData.userInfo
}
}
watch = {
userInfo (val) {
this.loginBrandSmall()
}
}
}
</script>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment