Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mall-webview
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
frontend
mall-webview
Commits
1b008b58
Commit
1b008b58
authored
Apr 22, 2021
by
hewenhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 文案
parent
79b2e798
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
167 additions
and
167 deletions
+167
-167
constant.ts
src/model/bonus/constant.ts
+3
-4
http.ts
src/server/http.ts
+3
-3
formatBonusTipTxt.ts
src/util/formatBonusTipTxt.ts
+26
-25
nativeBridge.ts
src/util/nativeBridge.ts
+135
-135
No files found.
src/model/bonus/constant.ts
View file @
1b008b58
...
...
@@ -26,7 +26,7 @@ export enum BonusAccountStatus {
FREEZE
=
"FREEZE"
// 冻结
}
// 奖励金预提现错误状态
// 奖励金预提现错误状态
export
enum
ErrCode
{
NOT_BIND
=
"NOT_BIND"
,
// 未绑定微信
USER_FREEZE
=
"USER_FREEZE"
,
// 用户冻结
...
...
@@ -34,7 +34,7 @@ export enum ErrCode {
USER_UP_LIMIT
=
"USER_UP_LIMIT"
,
// 用户上限
SYSTEM_UP_LIMIT
=
"SYSTEM_UP_LIMIT"
,
// 系统上限
STUDENT_WITHDRAWING
=
"STUDENT_WITHDRAWING"
,
// 学生提现中
BALANCE_NOT_ENOUGH
=
"BALANCE_NOT_ENOUGH"
,
// 余额不足
BALANCE_NOT_ENOUGH
=
"BALANCE_NOT_ENOUGH"
// 余额不足
}
// 提现记录状态
...
...
@@ -43,4 +43,4 @@ export enum WithdrawStatus {
WITHDRAWING
=
"WITHDRAWING"
,
RECEIVED
=
"RECEIVED"
,
FAILED
=
"FAILED"
}
\ No newline at end of file
}
src/server/http.ts
View file @
1b008b58
import
axios
,
{
AxiosRequestConfig
}
from
"axios"
;
import
Cookies
from
'js-cookie'
;
import
Cookies
from
"js-cookie"
;
import
{
unref
}
from
"vue"
;
import
router
from
"../router"
;
const
instance
=
axios
.
create
({
headers
:
{
'content-type'
:
'application/json;charset=UTF-8'
,
'Authorization'
:
`Bearer
${
Cookies
.
get
(
'token'
)}
`
"content-type"
:
"application/json;charset=UTF-8"
,
Authorization
:
`Bearer
${
Cookies
.
get
(
"token"
)}
`
},
baseURL
:
""
,
timeout
:
10000
,
...
...
src/util/formatBonusTipTxt.ts
View file @
1b008b58
import
{
ErrCode
}
from
"@/model/bonus/constant"
;
export
function
formatBonusTipTxt
(
errCode
:
string
):
string
{
let
tip
=
''
;
switch
(
errCode
)
{
case
ErrCode
.
NOT_BIND
:
tip
=
'绑定微信后,才可进行提现!'
;
break
;
case
ErrCode
.
USER_FREEZE
:
case
ErrCode
.
ACCOUNT_FREEZE
:
tip
=
'当前账号存在风险,无法进行提现操作!如需帮助请联系:400-8777389'
;
break
;
case
ErrCode
.
USER_UP_LIMIT
:
case
ErrCode
.
SYSTEM_UP_LIMIT
:
tip
=
'今日已达到提现次数/提现金额上限,无法进行提现操作,请明日进行提现操作!如需帮助请联系:400-8777389'
;
break
;
case
ErrCode
.
STUDENT_WITHDRAWING
:
tip
=
'您当前有一笔资金处于提现中,待该笔资金完成提现后,再进行提现操作!如需帮助请联系:400-8777389'
;
break
;
case
ErrCode
.
BALANCE_NOT_ENOUGH
:
tip
=
'提现金额至少为:1.00元。今日可提现金额不足,烦请明日再来提现!如需帮助请联系:400-8777389'
;
break
;
default
:
tip
=
''
}
return
tip
;
}
\ No newline at end of file
let
tip
=
""
;
switch
(
errCode
)
{
case
ErrCode
.
NOT_BIND
:
tip
=
"绑定微信后,才可进行提现!"
;
break
;
case
ErrCode
.
USER_FREEZE
:
case
ErrCode
.
ACCOUNT_FREEZE
:
tip
=
"当前账号存在风险,无法进行提现操作!如需帮助请联系:400-8777389"
;
break
;
case
ErrCode
.
USER_UP_LIMIT
:
case
ErrCode
.
SYSTEM_UP_LIMIT
:
tip
=
"今日已达到提现次数/提现金额上限,无法进行提现操作,请明日进行提现操作!如需帮助请联系:400-8777389"
;
break
;
case
ErrCode
.
STUDENT_WITHDRAWING
:
tip
=
"您当前有一笔资金处于提现中,待该笔资金完成提现后,再进行提现操作!如需帮助请联系:400-8777389"
;
break
;
case
ErrCode
.
BALANCE_NOT_ENOUGH
:
tip
=
"提现金额至少为:1.00元。当前可提现金额不足!如需帮助请联系:400-8777389!"
;
break
;
default
:
tip
=
""
;
}
return
tip
;
}
src/util/nativeBridge.ts
View file @
1b008b58
/* eslint-disable @typescript-eslint/camelcase */
import
{
App
}
from
"vue"
;
import
mitt
from
"./mitt"
;
const
isiOS
=
()
=>
{
const
u
=
navigator
.
userAgent
;
const
iOs
=
!!
u
.
match
(
/
\(
i
[^
;
]
+;
(
U;
)?
CPU.+Mac OS X/
);
return
iOs
;
};
const
isAndroid
=
()
=>
{
const
u
=
navigator
.
userAgent
;
const
android
=
u
.
indexOf
(
"Android"
)
>
-
1
||
u
.
indexOf
(
"Adr"
)
>
-
1
;
return
android
;
};
const
postMessage
=
data
=>
{
if
(
isAndroid
())
{
window
.
ReactNativeWebView
&&
window
.
ReactNativeWebView
.
onMessage
&&
window
.
ReactNativeWebView
.
onMessage
(
JSON
.
stringify
(
data
));
}
window
.
ReactNativeWebView
&&
window
.
ReactNativeWebView
.
postMessage
&&
window
.
ReactNativeWebView
.
postMessage
(
JSON
.
stringify
(
data
));
};
if
(
isiOS
()
||
isAndroid
())
{
// const debugLog = console.log
// eslint-disable-next-line func-names
// console.log = function (...args) {
// postMessage({
// type: 'log',
// data: args
// })
// debugLog(...args)
// }
}
function
install
(
Vue
:
App
)
{
const
GEEK_NATVIE_NAME
=
"GEEK_NATVIE_NAME"
;
// eslint-disable-next-line camelcase
const
event_bus
=
mitt
();
// eslint-disable-next-line func-names
window
.
$geek_excuteJS
=
function
(
args
)
{
try
{
const
params
=
JSON
.
parse
(
args
);
event_bus
.
emit
(
GEEK_NATVIE_NAME
,
params
);
}
catch
(
error
)
{
event_bus
.
emit
(
GEEK_NATVIE_NAME
,
args
);
}
};
Vue
.
mixin
({
methods
:
{
listenNativeMessage
(
arg
)
{
const
{
method
,
data
}
=
arg
;
if
(
method
)
{
this
[
method
]
&&
this
[
method
](
data
);
}
},
$nativeTitle
(
title
)
{
const
message
=
{
type
:
"title"
,
data
:
title
};
postMessage
(
message
);
},
$shareImg
(
base64Img
,
timeline
=
false
)
{
const
message
=
{
type
:
timeline
?
"shareTimeline"
:
"share"
,
data
:
{
type
:
"img"
,
img
:
base64Img
}
};
postMessage
(
message
);
},
$shareText
(
txt
,
timeline
=
false
)
{
const
message
=
{
type
:
timeline
?
"shareTimeline"
:
"share"
,
data
:
{
type
:
"text"
,
description
:
txt
}
};
postMessage
(
message
);
},
$shareNews
({
title
,
url
,
description
},
timeline
=
false
)
{
const
message
=
{
type
:
timeline
?
"shareTimeline"
:
"share"
,
data
:
{
type
:
"news"
,
description
,
webpageUrl
:
url
,
title
}
};
postMessage
(
message
);
},
$playVieo
(
url
)
{
const
message
=
{
type
:
"video"
,
data
:
{
url
}
};
postMessage
(
message
);
},
$postMessage
(
message
)
{
postMessage
(
message
);
},
$exitWebView
(
data
)
{
this
.
$postMessage
({
type
:
"exitWebview"
,
data
});
},
$shareReport
(
params
)
{
this
.
$postMessage
({
type
:
"reportShare"
,
params
});
}
},
created
()
{
event_bus
.
on
(
GEEK_NATVIE_NAME
,
this
.
listenNativeMessage
);
},
beforeUnmount
()
{
event_bus
.
off
(
GEEK_NATVIE_NAME
,
this
.
listenNativeMessage
);
}
});
}
export
default
install
;
/* eslint-disable @typescript-eslint/camelcase */
import
{
App
}
from
"vue"
;
import
mitt
from
"./mitt"
;
const
isiOS
=
()
=>
{
const
u
=
navigator
.
userAgent
;
const
iOs
=
!!
u
.
match
(
/
\(
i
[^
;
]
+;
(
U;
)?
CPU.+Mac OS X/
);
return
iOs
;
};
const
isAndroid
=
()
=>
{
const
u
=
navigator
.
userAgent
;
const
android
=
u
.
indexOf
(
"Android"
)
>
-
1
||
u
.
indexOf
(
"Adr"
)
>
-
1
;
return
android
;
};
const
postMessage
=
data
=>
{
if
(
isAndroid
())
{
window
.
ReactNativeWebView
&&
window
.
ReactNativeWebView
.
onMessage
&&
window
.
ReactNativeWebView
.
onMessage
(
JSON
.
stringify
(
data
));
}
window
.
ReactNativeWebView
&&
window
.
ReactNativeWebView
.
postMessage
&&
window
.
ReactNativeWebView
.
postMessage
(
JSON
.
stringify
(
data
));
};
if
(
isiOS
()
||
isAndroid
())
{
// const debugLog = console.log
// eslint-disable-next-line func-names
// console.log = function (...args) {
// postMessage({
// type: 'log',
// data: args
// })
// debugLog(...args)
// }
}
function
install
(
Vue
:
App
)
{
const
GEEK_NATVIE_NAME
=
"GEEK_NATVIE_NAME"
;
// eslint-disable-next-line camelcase
const
event_bus
=
mitt
();
// eslint-disable-next-line func-names
window
.
$geek_excuteJS
=
function
(
args
)
{
try
{
const
params
=
JSON
.
parse
(
args
);
event_bus
.
emit
(
GEEK_NATVIE_NAME
,
params
);
}
catch
(
error
)
{
event_bus
.
emit
(
GEEK_NATVIE_NAME
,
args
);
}
};
Vue
.
mixin
({
methods
:
{
listenNativeMessage
(
arg
)
{
const
{
method
,
data
}
=
arg
;
if
(
method
)
{
this
[
method
]
&&
this
[
method
](
data
);
}
},
$nativeTitle
(
title
)
{
const
message
=
{
type
:
"title"
,
data
:
title
};
postMessage
(
message
);
},
$shareImg
(
base64Img
,
timeline
=
false
)
{
const
message
=
{
type
:
timeline
?
"shareTimeline"
:
"share"
,
data
:
{
type
:
"img"
,
img
:
base64Img
}
};
postMessage
(
message
);
},
$shareText
(
txt
,
timeline
=
false
)
{
const
message
=
{
type
:
timeline
?
"shareTimeline"
:
"share"
,
data
:
{
type
:
"text"
,
description
:
txt
}
};
postMessage
(
message
);
},
$shareNews
({
title
,
url
,
description
},
timeline
=
false
)
{
const
message
=
{
type
:
timeline
?
"shareTimeline"
:
"share"
,
data
:
{
type
:
"news"
,
description
,
webpageUrl
:
url
,
title
}
};
postMessage
(
message
);
},
$playVieo
(
url
)
{
const
message
=
{
type
:
"video"
,
data
:
{
url
}
};
postMessage
(
message
);
},
$postMessage
(
message
)
{
postMessage
(
message
);
},
$exitWebView
(
data
)
{
this
.
$postMessage
({
type
:
"exitWebview"
,
data
});
},
$shareReport
(
params
)
{
this
.
$postMessage
({
type
:
"reportShare"
,
params
});
}
},
created
()
{
event_bus
.
on
(
GEEK_NATVIE_NAME
,
this
.
listenNativeMessage
);
},
beforeUnmount
()
{
event_bus
.
off
(
GEEK_NATVIE_NAME
,
this
.
listenNativeMessage
);
}
});
}
export
default
install
;
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