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
6dc5cd87
Commit
6dc5cd87
authored
Mar 15, 2021
by
leiqingsong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
parent
84dd9a02
Show 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 @
6dc5cd87
...
...
@@ -7,6 +7,7 @@
<
script
>
import
BaseNavBar
from
"./components/BaseNavBar.vue"
;
import
{
getUserInfo
}
from
"@/api/user"
;
export
default
{
components
:
{
BaseNavBar
...
...
@@ -21,20 +22,38 @@ export default {
this
.
currentTitle
=
val
.
meta
.
title
;
}
},
async
created
()
{
created
()
{
// const user = {
// userId: "1313123232"
// }
// localStorage.setItem('user', JSON.stringify(user));
console
.
log
(
"和App开始交互"
);
// showBottomBar(false);
await
this
.
$bridgeToAppFun
.
getAuthToken
()
this
.
$bridgeToAppFun
.
getAuthToken
()
.
then
(
res
=>
{
console
.
log
(
"获取token成功"
,
res
);
this
.
saveUser
(
res
);
})
.
catch
(
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
>
...
...
H5/src/components/BaseNavBar.vue
View file @
6dc5cd87
...
...
@@ -22,16 +22,25 @@ export default {
methods
:
{
onClickLeft
()
{
const
currentPage
=
this
.
$router
.
currentRoute
.
name
;
console
.
log
(
'router'
,
currentPage
);
const
whiteList
=
[
'MyStatus'
,
'Publish'
,
'FastestProgress'
,
'MonthAward'
,
'Instructions'
,
'Settings'
,
'Grade'
,
'AirDrop'
,
'Invite'
,
'AboutUs'
,
'customerService'
]
console
.
log
(
"router"
,
currentPage
);
const
whiteList
=
[
"MyStatus"
,
"Publish"
,
"FastestProgress"
,
"MonthAward"
,
"Instructions"
,
"Settings"
,
"Grade"
,
"AirDrop"
,
"Invite"
,
"AboutUs"
,
"customerService"
];
if
(
whiteList
.
indexOf
(
currentPage
)
>
-
1
)
{
try
{
navigateBack
();
}
catch
{
console
.
log
(
'不能交互'
);
console
.
log
(
"不能交互"
);
}
}
else
{
this
.
$router
.
go
(
-
1
);
...
...
H5/src/utils/bridgeToAppFun.js
View file @
6dc5cd87
// H5 去调用App的方法
import
jsBridge
from
"./bridge"
;
import
{
getUserInfo
}
from
"@/api/user"
;
class
bridgeToAppFun
{
constructor
()
{
this
.
userAgent
=
null
;
console
.
log
(
navigator
.
userAgent
);
if
(
navigator
.
userAgent
.
indexOf
(
"Android"
)
>
-
1
||
navigator
.
userAgent
.
indexOf
(
"Adr"
)
>
-
1
)
{
this
.
userAgent
=
'android'
;
if
(
navigator
.
userAgent
.
indexOf
(
"Android"
)
>
-
1
||
navigator
.
userAgent
.
indexOf
(
"Adr"
)
>
-
1
)
{
this
.
userAgent
=
"android"
;
}
else
if
(
navigator
.
userAgent
.
match
(
/
\(
i
[^
;
]
+;
(
U;
)?
CPU.+Mac OS X/
))
{
this
.
userAgent
=
'ios'
;
this
.
userAgent
=
"ios"
;
}
else
{
this
.
userAgent
=
'web'
;
}
}
saveUser
(
data
)
{
localStorage
.
setItem
(
"token"
,
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
(
"调用失败"
);
this
.
userAgent
=
"web"
;
}
}
// 获取Token
getAuthToken
()
{
console
.
log
(
"ua"
,
this
.
userAgent
);
if
(
this
.
userAgent
===
'android'
)
{
if
(
this
.
userAgent
===
"android"
)
{
// android
console
.
log
(
"android, 和安卓交互"
);
let
token
=
null
;
try
{
token
=
window
.
android
.
getAuthToken
();
localStorage
.
setItem
(
"token"
,
token
);
}
catch
{
console
.
log
(
'token获取失败'
);
console
.
log
(
"token获取失败"
);
}
console
.
log
(
"an-token"
,
token
);
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
token
)
{
this
.
saveUser
(
token
);
resolve
(
token
);
}
else
{
reject
(
"失败"
);
}
});
}
else
if
(
this
.
userAgent
===
'ios'
)
{
}
else
if
(
this
.
userAgent
===
"ios"
)
{
// ios
console
.
log
(
"ios"
);
return
new
Promise
((
resolve
,
reject
)
=>
{
...
...
@@ -61,11 +48,6 @@ class bridgeToAppFun {
console
.
log
(
"--------------"
);
if
(
data
)
{
resolve
(
data
);
getUserInfo
().
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
localStorage
.
setItem
(
"user"
,
JSON
.
stringify
(
res
.
data
));
}
});
}
else
{
console
.
log
(
"调用失败"
);
reject
(
"getAuthToken"
,
data
);
...
...
@@ -77,7 +59,7 @@ class bridgeToAppFun {
// 退出
logoutToApp
()
{
console
.
log
(
"退出登录"
);
if
(
this
.
userAgent
===
'android'
)
{
if
(
this
.
userAgent
===
"android"
)
{
console
.
log
(
"an"
);
window
.
android
.
logout
();
}
else
{
...
...
@@ -86,7 +68,7 @@ class bridgeToAppFun {
}
navigateBack
()
{
console
.
log
(
"返回"
);
if
(
this
.
userAgent
===
'android'
)
{
if
(
this
.
userAgent
===
"android"
)
{
console
.
log
(
"an"
);
window
.
android
.
navigateBack
();
}
else
{
...
...
@@ -95,7 +77,7 @@ class bridgeToAppFun {
}
showBottomBar
(
params
)
{
console
.
log
(
"隐藏底部"
);
if
(
this
.
userAgent
===
'android'
)
{
if
(
this
.
userAgent
===
"android"
)
{
console
.
log
(
"an"
);
window
.
android
.
showBottomBar
(
params
);
}
else
{
...
...
@@ -104,5 +86,4 @@ class bridgeToAppFun {
}
}
export
default
bridgeToAppFun
;
H5/src/views/cashOut/cash-out.vue
View file @
6dc5cd87
...
...
@@ -5,7 +5,13 @@
</van-cell-group>
<div
class=
"detail"
>
<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"
>
<span
style=
"color: #666666"
>
可提现金额
{{
remainMoney
.
toFixed
(
2
)
}}
元
</span
...
...
@@ -103,8 +109,8 @@ export default {
methods
:
{
onFillMoneyBlur
(
e
)
{
if
(
e
.
target
.
value
>
this
.
remainMoney
)
{
this
.
$toast
.
fail
(
'输入超过可提现金额,请重新输入'
)
return
false
this
.
$toast
.
fail
(
"输入超过可提现金额,请重新输入"
);
return
false
;
}
},
canCashOut
()
{
...
...
@@ -118,7 +124,7 @@ export default {
this
.
remainMoney
=
100
;
}
});
getWithdrawalAmount
getWithdrawalAmount
;
},
jumpToBank
()
{
console
.
log
(
"1"
);
...
...
@@ -135,8 +141,8 @@ export default {
return
;
}
if
(
this
.
money
>
this
.
remainMoney
)
{
this
.
$toast
.
fail
(
'输入超过可提现金额,请重新输入'
);
return
this
.
$toast
.
fail
(
"输入超过可提现金额,请重新输入"
);
return
;
}
const
params
=
{
userId
:
this
.
$userId
...
...
H5/src/views/modefyAvatar.vue
View file @
6dc5cd87
...
...
@@ -9,7 +9,13 @@
>
<van-button
type=
"primary"
>
上传新头像
</van-button>
</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>
</
template
>
...
...
@@ -28,19 +34,20 @@ export default {
},
mounted
()
{
console
.
log
(
"123"
);
// if (!this.avatar) {
// this.avatar = require("@/assets/images/no_avatar.png");
// }
console
.
log
(
this
.
$route
.
query
);
const
headImage
=
this
.
$route
.
query
.
headImage
;
if
(
headImage
)
{
this
.
avatar
=
headImage
;
this
.
avatar
=
process
.
env
.
VUE_APP_BASE_URL
+
headImage
;
}
else
{
this
.
avatar
=
require
(
"@/assets/images/no_avatar.png"
);
}
},
methods
:
{
checkBtn
()
{
if
(
!
this
.
canSubmit
)
{
return
;
}
this
.
canSubmit
=
false
;
const
params
=
{
headImage
:
this
.
imageUrl
,
userId
:
this
.
$userId
...
...
H5/src/views/rewards/fastest-progress.vue
View file @
6dc5cd87
...
...
@@ -47,12 +47,12 @@ export default {
};
},
beforeRouteEnter
(
to
,
from
,
next
)
{
console
.
log
(
'路由前'
);
console
.
log
(
"路由前"
);
try
{
showBottomBar
(
false
);
}
catch
{
console
.
log
(
'无法请求App'
);
next
()
console
.
log
(
"无法请求App"
);
next
()
;
}
},
beforeRouteLeave
(
to
,
form
,
next
)
{
...
...
@@ -60,7 +60,7 @@ export default {
try
{
showBottomBar
(
true
);
}
catch
{
console
.
log
(
'未能和App交互'
);
console
.
log
(
"未能和App交互"
);
next
();
}
},
...
...
@@ -72,7 +72,7 @@ export default {
try
{
navigateBack
();
}
catch
{
console
.
log
(
'不能和App交互'
);
console
.
log
(
"不能和App交互"
);
this
.
$router
.
go
(
-
1
);
}
},
...
...
H5/src/views/settings.vue
View file @
6dc5cd87
...
...
@@ -3,7 +3,11 @@
<van-cell-group
class=
"group-1"
>
<van-cell
title=
"用户名"
:value=
"$userId"
/>
<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-group>
<van-cell-group>
...
...
@@ -70,14 +74,14 @@ export default {
const
params
=
{
userId
:
this
.
$userId
};
console
.
log
(
'setting-userId'
,
params
);
console
.
log
(
"setting-userId"
,
params
);
getUserInfo2
(
params
).
then
(
res
=>
{
if
(
res
.
userId
)
{
localStorage
.
setItem
(
"user"
,
JSON
.
stringify
(
res
));
this
.
$nextTick
(()
=>
{
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