Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
X
XiTianSenMall
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
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
leiqingsong
XiTianSenMall
Commits
17cc9919
Commit
17cc9919
authored
Mar 15, 2021
by
leiqingsong
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev_lqs' into 'master'
修改 See merge request
!64
parents
0751e6ff
6dc5cd87
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
157 additions
and
131 deletions
+157
-131
App.vue
H5/src/App.vue
+21
-2
BaseNavBar.vue
H5/src/components/BaseNavBar.vue
+16
-7
bridgeToAppFun.js
H5/src/utils/bridgeToAppFun.js
+83
-102
cash-out.vue
H5/src/views/cashOut/cash-out.vue
+12
-6
modefyAvatar.vue
H5/src/views/modefyAvatar.vue
+12
-5
fastest-progress.vue
H5/src/views/rewards/fastest-progress.vue
+5
-5
settings.vue
H5/src/views/settings.vue
+8
-4
No files found.
H5/src/App.vue
View file @
17cc9919
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
<
script
>
<
script
>
import
BaseNavBar
from
"./components/BaseNavBar.vue"
;
import
BaseNavBar
from
"./components/BaseNavBar.vue"
;
import
{
getUserInfo
}
from
"@/api/user"
;
export
default
{
export
default
{
components
:
{
components
:
{
BaseNavBar
BaseNavBar
...
@@ -21,20 +22,38 @@ export default {
...
@@ -21,20 +22,38 @@ export default {
this
.
currentTitle
=
val
.
meta
.
title
;
this
.
currentTitle
=
val
.
meta
.
title
;
}
}
},
},
async
created
()
{
created
()
{
// const user = {
// const user = {
// userId: "1313123232"
// userId: "1313123232"
// }
// }
// localStorage.setItem('user', JSON.stringify(user));
// localStorage.setItem('user', JSON.stringify(user));
console
.
log
(
"和App开始交互"
);
console
.
log
(
"和App开始交互"
);
// showBottomBar(false);
// showBottomBar(false);
await
this
.
$bridgeToAppFun
.
getAuthToken
()
this
.
$bridgeToAppFun
.
getAuthToken
()
.
then
(
res
=>
{
.
then
(
res
=>
{
console
.
log
(
"获取token成功"
,
res
);
console
.
log
(
"获取token成功"
,
res
);
this
.
saveUser
(
res
);
})
})
.
catch
(
err
=>
{
.
catch
(
err
=>
{
console
.
log
(
"获取token失败"
,
err
);
console
.
log
(
"获取token失败"
,
err
);
});
});
},
methods
:
{
saveUser
(
data
)
{
if
(
data
)
{
getUserInfo
().
then
(
res
=>
{
console
.
log
(
"存用户信息"
);
console
.
log
(
res
);
console
.
log
(
"----"
);
if
(
res
.
code
==
0
)
{
localStorage
.
setItem
(
"user"
,
JSON
.
stringify
(
res
.
data
));
}
});
}
else
{
console
.
log
(
"调用失败"
);
}
}
}
}
};
};
</
script
>
</
script
>
...
...
H5/src/components/BaseNavBar.vue
View file @
17cc9919
...
@@ -22,17 +22,26 @@ export default {
...
@@ -22,17 +22,26 @@ export default {
methods
:
{
methods
:
{
onClickLeft
()
{
onClickLeft
()
{
const
currentPage
=
this
.
$router
.
currentRoute
.
name
;
const
currentPage
=
this
.
$router
.
currentRoute
.
name
;
console
.
log
(
'router'
,
currentPage
);
console
.
log
(
"router"
,
currentPage
);
const
whiteList
=
[
'MyStatus'
,
'Publish'
,
'FastestProgress'
,
const
whiteList
=
[
'MonthAward'
,
'Instructions'
,
'Settings'
,
'Grade'
,
"MyStatus"
,
'AirDrop'
,
'Invite'
,
'AboutUs'
,
'customerService'
"Publish"
,
]
"FastestProgress"
,
"MonthAward"
,
"Instructions"
,
"Settings"
,
"Grade"
,
"AirDrop"
,
"Invite"
,
"AboutUs"
,
"customerService"
];
if
(
whiteList
.
indexOf
(
currentPage
)
>
-
1
)
{
if
(
whiteList
.
indexOf
(
currentPage
)
>
-
1
)
{
try
{
try
{
navigateBack
();
navigateBack
();
}
catch
{
}
catch
{
console
.
log
(
'不能交互'
);
console
.
log
(
"不能交互"
);
}
}
}
else
{
}
else
{
this
.
$router
.
go
(
-
1
);
this
.
$router
.
go
(
-
1
);
}
}
...
...
H5/src/utils/bridgeToAppFun.js
View file @
17cc9919
// H5 去调用App的方法
// H5 去调用App的方法
import
jsBridge
from
"./bridge"
;
import
jsBridge
from
"./bridge"
;
import
{
getUserInfo
}
from
"@/api/user"
;
class
bridgeToAppFun
{
class
bridgeToAppFun
{
constructor
()
{
constructor
()
{
this
.
userAgent
=
null
;
this
.
userAgent
=
null
;
console
.
log
(
navigator
.
userAgent
);
console
.
log
(
navigator
.
userAgent
);
if
(
navigator
.
userAgent
.
indexOf
(
"Android"
)
>
-
1
||
navigator
.
userAgent
.
indexOf
(
"Adr"
)
>
-
1
)
{
if
(
this
.
userAgent
=
'android'
;
navigator
.
userAgent
.
indexOf
(
"Android"
)
>
-
1
||
}
else
if
(
navigator
.
userAgent
.
match
(
/
\(
i
[^
;
]
+;
(
U;
)?
CPU.+Mac OS X/
))
{
navigator
.
userAgent
.
indexOf
(
"Adr"
)
>
-
1
this
.
userAgent
=
'ios'
;
)
{
}
else
{
this
.
userAgent
=
"android"
;
this
.
userAgent
=
'web'
;
}
else
if
(
navigator
.
userAgent
.
match
(
/
\(
i
[^
;
]
+;
(
U;
)?
CPU.+Mac OS X/
))
{
}
this
.
userAgent
=
"ios"
;
}
}
else
{
saveUser
(
data
)
{
this
.
userAgent
=
"web"
;
localStorage
.
setItem
(
"token"
,
data
);
}
if
(
data
)
{
}
getUserInfo
().
then
(
res
=>
{
// 获取Token
console
.
log
(
"存用户信息"
);
getAuthToken
()
{
console
.
log
(
res
);
console
.
log
(
"ua"
,
this
.
userAgent
);
console
.
log
(
"----"
);
if
(
this
.
userAgent
===
"android"
)
{
if
(
res
.
code
==
0
)
{
// android
localStorage
.
setItem
(
"user"
,
JSON
.
stringify
(
res
.
data
));
console
.
log
(
"android, 和安卓交互"
);
}
let
token
=
null
;
});
try
{
}
else
{
token
=
window
.
android
.
getAuthToken
();
console
.
log
(
"调用失败"
);
localStorage
.
setItem
(
"token"
,
token
);
}
}
catch
{
}
console
.
log
(
"token获取失败"
);
// 获取Token
}
getAuthToken
()
{
console
.
log
(
"an-token"
,
token
);
console
.
log
(
"ua"
,
this
.
userAgent
);
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
this
.
userAgent
===
'android'
)
{
if
(
token
)
{
// android
resolve
(
token
);
console
.
log
(
"android, 和安卓交互"
);
}
else
{
let
token
=
null
;
reject
(
"失败"
);
try
{
}
token
=
window
.
android
.
getAuthToken
();
});
}
catch
{
}
else
if
(
this
.
userAgent
===
"ios"
)
{
console
.
log
(
'token获取失败'
);
// ios
}
console
.
log
(
"ios"
);
console
.
log
(
"an-token"
,
token
);
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
console
.
log
(
"调用1"
);
if
(
token
)
{
jsBridge
.
callhandler
(
"getAuthToken"
,
null
,
data
=>
{
this
.
saveUser
(
token
);
console
.
log
(
"调用2"
);
resolve
(
token
);
localStorage
.
setItem
(
"token"
,
data
);
}
else
{
console
.
log
(
"--------------"
);
reject
(
"失败"
);
if
(
data
)
{
}
resolve
(
data
);
});
}
else
{
}
else
if
(
this
.
userAgent
===
'ios'
)
{
console
.
log
(
"调用失败"
);
// ios
reject
(
"getAuthToken"
,
data
);
console
.
log
(
"ios"
);
}
return
new
Promise
((
resolve
,
reject
)
=>
{
});
console
.
log
(
"调用1"
);
});
jsBridge
.
callhandler
(
"getAuthToken"
,
null
,
data
=>
{
}
console
.
log
(
"调用2"
);
}
localStorage
.
setItem
(
"token"
,
data
);
// 退出
console
.
log
(
"--------------"
);
logoutToApp
()
{
if
(
data
)
{
console
.
log
(
"退出登录"
);
resolve
(
data
);
if
(
this
.
userAgent
===
"android"
)
{
getUserInfo
().
then
(
res
=>
{
console
.
log
(
"an"
);
if
(
res
.
code
===
0
)
{
window
.
android
.
logout
();
localStorage
.
setItem
(
"user"
,
JSON
.
stringify
(
res
.
data
));
}
else
{
}
jsBridge
.
callhandler
(
"logout"
);
});
}
}
else
{
}
console
.
log
(
"调用失败"
);
navigateBack
()
{
reject
(
"getAuthToken"
,
data
);
console
.
log
(
"返回"
);
}
if
(
this
.
userAgent
===
"android"
)
{
});
console
.
log
(
"an"
);
});
window
.
android
.
navigateBack
();
}
}
else
{
}
jsBridge
.
callhandler
(
"navigateBack"
);
// 退出
}
logoutToApp
()
{
}
console
.
log
(
"退出登录"
);
showBottomBar
(
params
)
{
if
(
this
.
userAgent
===
'android'
)
{
console
.
log
(
"隐藏底部"
);
console
.
log
(
"an"
);
if
(
this
.
userAgent
===
"android"
)
{
window
.
android
.
logout
();
console
.
log
(
"an"
);
}
else
{
window
.
android
.
showBottomBar
(
params
);
jsBridge
.
callhandler
(
"logout"
);
}
else
{
}
jsBridge
.
callhandler
(
"showBottomBar"
,
params
);
}
}
navigateBack
()
{
}
console
.
log
(
"返回"
);
if
(
this
.
userAgent
===
'android'
)
{
console
.
log
(
"an"
);
window
.
android
.
navigateBack
();
}
else
{
jsBridge
.
callhandler
(
"navigateBack"
);
}
}
showBottomBar
(
params
)
{
console
.
log
(
"隐藏底部"
);
if
(
this
.
userAgent
===
'android'
)
{
console
.
log
(
"an"
);
window
.
android
.
showBottomBar
(
params
);
}
else
{
jsBridge
.
callhandler
(
"showBottomBar"
,
params
);
}
}
}
}
export
default
bridgeToAppFun
;
export
default
bridgeToAppFun
;
\ No newline at end of file
H5/src/views/cashOut/cash-out.vue
View file @
17cc9919
...
@@ -5,7 +5,13 @@
...
@@ -5,7 +5,13 @@
</van-cell-group>
</van-cell-group>
<div
class=
"detail"
>
<div
class=
"detail"
>
<p
style=
"font-size: 24px"
>
提现金额
</p>
<p
style=
"font-size: 24px"
>
提现金额
</p>
<van-field
v-model=
"money"
type=
"number"
label=
"¥"
class=
"money"
@
blur=
"onFillMoneyBlur"
/>
<van-field
v-model=
"money"
type=
"number"
label=
"¥"
class=
"money"
@
blur=
"onFillMoneyBlur"
/>
<div
class=
"remain"
>
<div
class=
"remain"
>
<span
style=
"color: #666666"
<span
style=
"color: #666666"
>
可提现金额
{{
remainMoney
.
toFixed
(
2
)
}}
元
</span
>
可提现金额
{{
remainMoney
.
toFixed
(
2
)
}}
元
</span
...
@@ -103,8 +109,8 @@ export default {
...
@@ -103,8 +109,8 @@ export default {
methods
:
{
methods
:
{
onFillMoneyBlur
(
e
)
{
onFillMoneyBlur
(
e
)
{
if
(
e
.
target
.
value
>
this
.
remainMoney
)
{
if
(
e
.
target
.
value
>
this
.
remainMoney
)
{
this
.
$toast
.
fail
(
'输入超过可提现金额,请重新输入'
)
this
.
$toast
.
fail
(
"输入超过可提现金额,请重新输入"
);
return
false
return
false
;
}
}
},
},
canCashOut
()
{
canCashOut
()
{
...
@@ -118,7 +124,7 @@ export default {
...
@@ -118,7 +124,7 @@ export default {
this
.
remainMoney
=
100
;
this
.
remainMoney
=
100
;
}
}
});
});
getWithdrawalAmount
getWithdrawalAmount
;
},
},
jumpToBank
()
{
jumpToBank
()
{
console
.
log
(
"1"
);
console
.
log
(
"1"
);
...
@@ -135,8 +141,8 @@ export default {
...
@@ -135,8 +141,8 @@ export default {
return
;
return
;
}
}
if
(
this
.
money
>
this
.
remainMoney
)
{
if
(
this
.
money
>
this
.
remainMoney
)
{
this
.
$toast
.
fail
(
'输入超过可提现金额,请重新输入'
);
this
.
$toast
.
fail
(
"输入超过可提现金额,请重新输入"
);
return
return
;
}
}
const
params
=
{
const
params
=
{
userId
:
this
.
$userId
userId
:
this
.
$userId
...
...
H5/src/views/modefyAvatar.vue
View file @
17cc9919
...
@@ -9,7 +9,13 @@
...
@@ -9,7 +9,13 @@
>
>
<van-button
type=
"primary"
>
上传新头像
</van-button>
<van-button
type=
"primary"
>
上传新头像
</van-button>
</van-uploader>
</van-uploader>
<van-button
type=
"primary"
:class=
"!canSubmit && 'deactive-btn'"
plain
@
click=
"checkBtn"
>
确定
</van-button>
<van-button
type=
"primary"
:class=
"!canSubmit && 'deactive-btn'"
plain
@
click=
"checkBtn"
>
确定
</van-button
>
</div>
</div>
</div>
</div>
</
template
>
</
template
>
...
@@ -28,19 +34,20 @@ export default {
...
@@ -28,19 +34,20 @@ export default {
},
},
mounted
()
{
mounted
()
{
console
.
log
(
"123"
);
console
.
log
(
"123"
);
// if (!this.avatar) {
// this.avatar = require("@/assets/images/no_avatar.png");
// }
console
.
log
(
this
.
$route
.
query
);
console
.
log
(
this
.
$route
.
query
);
const
headImage
=
this
.
$route
.
query
.
headImage
;
const
headImage
=
this
.
$route
.
query
.
headImage
;
if
(
headImage
)
{
if
(
headImage
)
{
this
.
avatar
=
headImage
;
this
.
avatar
=
process
.
env
.
VUE_APP_BASE_URL
+
headImage
;
}
else
{
}
else
{
this
.
avatar
=
require
(
"@/assets/images/no_avatar.png"
);
this
.
avatar
=
require
(
"@/assets/images/no_avatar.png"
);
}
}
},
},
methods
:
{
methods
:
{
checkBtn
()
{
checkBtn
()
{
if
(
!
this
.
canSubmit
)
{
return
;
}
this
.
canSubmit
=
false
;
const
params
=
{
const
params
=
{
headImage
:
this
.
imageUrl
,
headImage
:
this
.
imageUrl
,
userId
:
this
.
$userId
userId
:
this
.
$userId
...
...
H5/src/views/rewards/fastest-progress.vue
View file @
17cc9919
...
@@ -47,12 +47,12 @@ export default {
...
@@ -47,12 +47,12 @@ export default {
};
};
},
},
beforeRouteEnter
(
to
,
from
,
next
)
{
beforeRouteEnter
(
to
,
from
,
next
)
{
console
.
log
(
'路由前'
);
console
.
log
(
"路由前"
);
try
{
try
{
showBottomBar
(
false
);
showBottomBar
(
false
);
}
catch
{
}
catch
{
console
.
log
(
'无法请求App'
);
console
.
log
(
"无法请求App"
);
next
()
next
()
;
}
}
},
},
beforeRouteLeave
(
to
,
form
,
next
)
{
beforeRouteLeave
(
to
,
form
,
next
)
{
...
@@ -60,7 +60,7 @@ export default {
...
@@ -60,7 +60,7 @@ export default {
try
{
try
{
showBottomBar
(
true
);
showBottomBar
(
true
);
}
catch
{
}
catch
{
console
.
log
(
'未能和App交互'
);
console
.
log
(
"未能和App交互"
);
next
();
next
();
}
}
},
},
...
@@ -72,7 +72,7 @@ export default {
...
@@ -72,7 +72,7 @@ export default {
try
{
try
{
navigateBack
();
navigateBack
();
}
catch
{
}
catch
{
console
.
log
(
'不能和App交互'
);
console
.
log
(
"不能和App交互"
);
this
.
$router
.
go
(
-
1
);
this
.
$router
.
go
(
-
1
);
}
}
},
},
...
...
H5/src/views/settings.vue
View file @
17cc9919
...
@@ -3,7 +3,11 @@
...
@@ -3,7 +3,11 @@
<van-cell-group
class=
"group-1"
>
<van-cell-group
class=
"group-1"
>
<van-cell
title=
"用户名"
:value=
"$userId"
/>
<van-cell
title=
"用户名"
:value=
"$userId"
/>
<van-cell
is-link
center
title=
"头像"
@
click=
"onModefy"
>
<van-cell
is-link
center
title=
"头像"
@
click=
"onModefy"
>
<img
class=
"avatar-img"
:src=
"avatar"
alt=
"头像"
/>
<img
class=
"avatar-img"
:src=
"process.env.VUE_APP_BASE_URL + avatar"
alt=
"头像"
/>
</van-cell>
</van-cell>
</van-cell-group>
</van-cell-group>
<van-cell-group>
<van-cell-group>
...
@@ -70,14 +74,14 @@ export default {
...
@@ -70,14 +74,14 @@ export default {
const
params
=
{
const
params
=
{
userId
:
this
.
$userId
userId
:
this
.
$userId
};
};
console
.
log
(
'setting-userId'
,
params
);
console
.
log
(
"setting-userId"
,
params
);
getUserInfo2
(
params
).
then
(
res
=>
{
getUserInfo2
(
params
).
then
(
res
=>
{
if
(
res
.
userId
)
{
if
(
res
.
userId
)
{
localStorage
.
setItem
(
"user"
,
JSON
.
stringify
(
res
));
localStorage
.
setItem
(
"user"
,
JSON
.
stringify
(
res
));
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
this
.
inviteeCode
=
res
.
inviteCode
;
this
.
inviteeCode
=
res
.
inviteCode
;
this
.
avatar
=
process
.
env
.
VUE_APP_BASE_URL
+
res
.
headImage
;
this
.
avatar
=
res
.
headImage
;
})
})
;
}
}
});
});
},
},
...
...
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