Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CFFP-HB
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chao Sun
CFFP-HB
Commits
d5653e8a
Commit
d5653e8a
authored
Jul 23, 2025
by
zhangxingmin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
push
parent
688f6e97
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
182 additions
and
182 deletions
+182
-182
App.vue
+182
-182
No files found.
App.vue
View file @
d5653e8a
<
script
>
import
initApp
from
"@/util/router.js"
;
import
{
interceptor
}
from
"@/util/interceptor"
;
import
{
baseURL
,
apiURL
,
cffpURL
,
companyInfo
}
from
"@/environments/environment"
;
import
api
from
'./api/api'
;
<
!--<script>--
>
<!--import initApp from "@/util/router.js";-->
<!--import {interceptor} from "@/util/interceptor";-->
<!--import {baseURL,apiURL,cffpURL,companyInfo} from "@/environments/environment";-->
<!--import api from './api/api';-->
export
default
{
data
()
{
return
{
invitationHandled
:
false
}
},
onLaunch
:
function
()
{
console
.
log
(
'App Launch'
);
if
(
!
uni
.
getStorageSync
(
'loginType'
)){
uni
.
clearStorageSync
();
uni
.
setStorageSync
(
'loginType'
,
'visitor'
);
}
<!--export default {-->
<!-- data() {-->
<!-- return {-->
<!-- invitationHandled: false-->
<!-- }-->
<!-- },-->
<!-- onLaunch: function() {-->
<!-- console.log('App Launch');-->
<!-- if(!uni.getStorageSync('loginType')){-->
<!-- uni.clearStorageSync();-->
<!-- uni.setStorageSync('loginType','visitor');-->
<!-- }-->
this
.
handleExternalUrlParams
();
<!-- this.handleExternalUrlParams();-->
// App更新逻辑
// #ifdef APP-PLUS
plus
.
runtime
.
getProperty
(
plus
.
runtime
.
appid
,
(
wgtinfo
)
=>
{
uni
.
getSystemInfo
({
success
:(
systemInfo
)
=>
{
uni
.
request
({
url
:
`
${
apiURL
}
/appVersion/checkIsUpdate`
,
method
:
'POST'
,
data
:
{
appType
:
1
,
version
:
wgtinfo
.
version
,
systemType
:
systemInfo
.
osName
.
toLowerCase
()
===
'ios'
?
2
:
1
},
success
:
(
result
)
=>
{
const
data
=
result
.
data
.
data
[
'appVersionInfo'
];
if
(
data
.
status
==
1
&&
data
.
isForceUpdate
&&
data
.
wgtUrl
)
{
uni
.
downloadFile
({
url
:
`
${
baseURL
}${
data
.
wgtUrl
}
`
,
success
:
(
downloadResult
)
=>
{
if
(
downloadResult
.
statusCode
===
200
)
{
plus
.
runtime
.
install
(
downloadResult
.
tempFilePath
,
{
force
:
true
},
function
()
{
plus
.
runtime
.
restart
();
},
function
(
e
)
{
console
.
error
(
'install fail...'
);
});
}
}
});
}
}
});
}
})
})
// #endif
<!-- // App更新逻辑-->
<!-- // #ifdef APP-PLUS-->
<!-- plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {-->
<!-- uni.getSystemInfo({-->
<!-- success:(systemInfo)=> {-->
<!-- uni.request({-->
<!-- url: `${apiURL}/appVersion/checkIsUpdate`,-->
<!-- method:'POST',-->
<!-- data: {-->
<!-- appType: 1,-->
<!-- version: wgtinfo.version,-->
<!-- systemType:systemInfo.osName.toLowerCase() === 'ios' ? 2 : 1-->
<!-- },-->
<!-- success: (result) => {-->
<!-- const data = result.data.data['appVersionInfo'];-->
<!-- if (data.status==1 && data.isForceUpdate && data.wgtUrl) {-->
<!-- uni.downloadFile({-->
<!-- url: `${baseURL}${data.wgtUrl}`,-->
<!-- success: (downloadResult) => {-->
<!-- if (downloadResult.statusCode === 200) {-->
<!-- plus.runtime.install(downloadResult.tempFilePath, {-->
<!-- force: true-->
<!-- }, function() {-->
<!-- plus.runtime.restart();-->
<!-- }, function(e) {-->
<!-- console.error('install fail...');-->
<!-- });-->
<!-- }-->
<!-- }-->
<!-- });-->
<!-- }-->
<!-- }-->
<!-- });-->
<!-- }-->
<!-- })-->
<!-- })-->
<!-- // #endif-->
interceptor
();
initApp
();
},
<!-- interceptor();-->
<!-- initApp();-->
<!-- },-->
onShow
:
function
(
options
)
{
console
.
log
(
'App Show'
,
options
);
this
.
checkUserStatus
();
// #ifdef APP-PLUS
if
(
options
&&
options
.
query
)
{
this
.
saveUrlParams
(
options
.
query
);
}
// #endif
},
<!-- onShow: function(options) {-->
<!-- console.log('App Show', options);-->
<!-- this.checkUserStatus();-->
<!-- // #ifdef APP-PLUS-->
<!-- if(options && options.query) {-->
<!-- this.saveUrlParams(options.query);-->
<!-- }-->
<!-- // #endif-->
<!-- },-->
onHide
:
function
()
{
console
.
log
(
'App Hide'
)
},
<!-- onHide: function() {-->
<!-- console.log('App Hide')-->
<!-- },-->
methods
:
{
async
checkUserStatus
()
{
if
(
uni
.
getStorageSync
(
'loginType'
)
==
'codelogin'
&&
uni
.
getStorageSync
(
'cffp_userId'
))
{
try
{
const
res
=
await
api
.
queryInfo
({
userId
:
uni
.
getStorageSync
(
'cffp_userId'
)});
if
(
!
res
[
'success'
])
{
this
.
clearLoginState
();
const
pages
=
getCurrentPages
();
if
(
pages
.
length
>
0
)
{
const
currentRoute
=
pages
[
pages
.
length
-
1
].
route
;
const
whiteList
=
[
'/myPackageA/login/login'
,
'/pages/invitationRegister/invitationlogin'
,
'/myPackageA/applyFranchise/applyFranchise'
,
'/pages/applyFranchise/applyFranchise'
,
'/myPackageA/ruleAndContract/clause'
,
'/pages/courselist/courselist'
,
'/pages/courseDetail/courseDetail'
,
'/pages/orderDetail/orderDetail'
,
'/pages/orderStatus/orderStatus'
,
'/pages/index/index'
];
if
(
!
whiteList
.
includes
(
currentRoute
))
{
uni
.
navigateTo
({
url
:
'/myPackageA/login/login'
});
}
}
}
if
(
res
[
'success'
])
{
const
cffp_userInfo
=
{
name
:
res
[
'data'
][
'realName'
],
mobile
:
res
[
'data'
][
'mobile'
],
partnerType
:
res
[
'data'
][
'partnerType'
],
nickName
:
res
[
'data'
][
'nickName'
],
}
uni
.
setStorageSync
(
'cffp_userInfo'
,
JSON
.
stringify
(
cffp_userInfo
))
}
}
catch
(
err
)
{
console
.
error
(
'检查用户状态失败:'
,
err
);
}
}
},
<!-- methods: {-->
<!-- async checkUserStatus() {-->
<!-- if(uni.getStorageSync('loginType') == 'codelogin' && uni.getStorageSync('cffp_userId')) {-->
<!-- try {-->
<!-- const res = await api.queryInfo({userId: uni.getStorageSync('cffp_userId')});-->
<!-- if(!res['success']) {-->
<!-- this.clearLoginState();-->
<!-- const pages = getCurrentPages();-->
<!-- if(pages.length > 0) {-->
<!-- const currentRoute = pages[pages.length - 1].route;-->
<!-- const whiteList = [-->
<!-- '/myPackageA/login/login',-->
<!-- '/pages/invitationRegister/invitationlogin',-->
<!-- '/myPackageA/applyFranchise/applyFranchise',-->
<!-- '/pages/applyFranchise/applyFranchise',-->
<!-- '/myPackageA/ruleAndContract/clause',-->
<!-- '/pages/courselist/courselist',-->
<!-- '/pages/courseDetail/courseDetail',-->
<!-- '/pages/orderDetail/orderDetail',-->
<!-- '/pages/orderStatus/orderStatus',-->
<!-- '/pages/index/index'-->
<!-- ];-->
<!-- if(!whiteList.includes(currentRoute)) {-->
<!-- uni.navigateTo({-->
<!-- url: '/myPackageA/login/login'-->
<!-- });-->
<!-- }-->
<!-- }-->
<!-- }-->
<!-- if (res['success']) {-->
<!-- const cffp_userInfo = {-->
<!-- name: res['data']['realName'],-->
<!-- mobile: res['data']['mobile'],-->
<!-- partnerType:res['data']['partnerType'],-->
<!-- nickName:res['data']['nickName'],-->
<!-- }-->
<!-- uni.setStorageSync('cffp_userInfo', JSON.stringify(cffp_userInfo))-->
<!-- }-->
<!-- } catch (err) {-->
<!-- console.error('检查用户状态失败:', err);-->
<!-- }-->
<!-- }-->
<!-- },-->
clearLoginState
()
{
uni
.
clearStorageSync
();
uni
.
setStorageSync
(
'loginType'
,
'visitor'
);
},
<!-- clearLoginState() {-->
<!-- uni.clearStorageSync();-->
<!-- uni.setStorageSync('loginType', 'visitor');-->
<!-- },-->
handleExternalUrlParams
()
{
// #ifdef H5
this
.
handleH5UrlParams
();
// #endif
<!-- handleExternalUrlParams() {-->
<!-- // #ifdef H5-->
<!-- this.handleH5UrlParams();-->
<!-- // #endif-->
// #ifdef APP-PLUS
this
.
handleAppUrlParams
();
// #endif
},
<!-- // #ifdef APP-PLUS-->
<!-- this.handleAppUrlParams();-->
<!-- // #endif-->
<!-- },-->
handleH5UrlParams
()
{
const
url
=
window
.
location
.
href
;
if
(
url
.
indexOf
(
'?'
)
>
-
1
)
{
const
queryString
=
url
.
split
(
'?'
)[
1
];
const
params
=
this
.
parseQueryString
(
queryString
);
this
.
saveUrlParams
(
params
);
}
},
<!-- handleH5UrlParams() {-->
<!-- const url = window.location.href;-->
<!-- if(url.indexOf('?') > -1) {-->
<!-- const queryString = url.split('?')[1];-->
<!-- const params = this.parseQueryString(queryString);-->
<!-- this.saveUrlParams(params);-->
<!-- }-->
<!-- },-->
handleAppUrlParams
()
{
plus
.
runtime
.
getProperty
(
plus
.
runtime
.
appid
,
(
widgetInfo
)
=>
{
const
args
=
plus
.
runtime
.
arguments
;
if
(
args
)
{
const
params
=
this
.
parseAppLaunchArgs
(
args
);
this
.
saveUrlParams
(
params
);
}
});
<!-- handleAppUrlParams() {-->
<!-- plus.runtime.getProperty(plus.runtime.appid, (widgetInfo) => {-->
<!-- const args = plus.runtime.arguments;-->
<!-- if(args) {-->
<!-- const params = this.parseAppLaunchArgs(args);-->
<!-- this.saveUrlParams(params);-->
<!-- }-->
<!-- });-->
plus
.
runtime
.
addEventListener
(
'newintent'
,
(
e
)
=>
{
const
args
=
e
.
arguments
;
if
(
args
)
{
const
params
=
this
.
parseAppLaunchArgs
(
args
);
this
.
saveUrlParams
(
params
);
}
});
},
<!-- plus.runtime.addEventListener('newintent', (e) => {-->
<!-- const args = e.arguments;-->
<!-- if(args) {-->
<!-- const params = this.parseAppLaunchArgs(args);-->
<!-- this.saveUrlParams(params);-->
<!-- }-->
<!-- });-->
<!-- },-->
parseQueryString
(
queryString
)
{
const
params
=
{};
const
pairs
=
queryString
.
split
(
'&'
);
for
(
let
i
=
0
;
i
<
pairs
.
length
;
i
++
)
{
const
pair
=
pairs
[
i
].
split
(
'='
);
if
(
pair
.
length
===
2
)
{
params
[
decodeURIComponent
(
pair
[
0
])]
=
decodeURIComponent
(
pair
[
1
]
||
''
);
}
}
return
params
;
},
<!-- parseQueryString(queryString) {-->
<!-- const params = {};-->
<!-- const pairs = queryString.split('&');-->
<!-- for(let i = 0; i < pairs.length; i++) {-->
<!-- const pair = pairs[i].split('=');-->
<!-- if(pair.length === 2) {-->
<!-- params[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1] || '');-->
<!-- }-->
<!-- }-->
<!-- return params;-->
<!-- },-->
parseAppLaunchArgs
(
args
)
{
if
(
args
.
indexOf
(
'?'
)
>
-
1
)
{
const
queryString
=
args
.
split
(
'?'
)[
1
];
return
this
.
parseQueryString
(
queryString
);
}
return
{};
},
<!-- parseAppLaunchArgs(args) {-->
<!-- if(args.indexOf('?') > -1) {-->
<!-- const queryString = args.split('?')[1];-->
<!-- return this.parseQueryString(queryString);-->
<!-- }-->
<!-- return {};-->
<!-- },-->
saveUrlParams
(
params
)
{
if
(
Object
.
keys
(
params
).
length
>
0
)
{
console
.
log
(
'获取到外部链接参数:'
,
params
);
try
{
if
(
params
.
addSystemType
){
uni
.
setStorageSync
(
'addSystemType'
,
params
.
addSystemType
);
}
}
catch
(
e
)
{
console
.
error
(
'存储外部链接参数失败:'
,
e
);
}
}
}
}
}
<
/
script
>
<!-- saveUrlParams(params) {-->
<!-- if(Object.keys(params).length > 0) {-->
<!-- console.log('获取到外部链接参数:', params);-->
<!-- try {-->
<!-- if(params.addSystemType){-->
<!-- uni.setStorageSync('addSystemType', params.addSystemType);-->
<!-- }-->
<!-- } catch(e) {-->
<!-- console.error('存储外部链接参数失败:', e);-->
<!-- }-->
<!-- }-->
<!-- }-->
<!-- }-->
<!--}-->
<
!--</script>--
>
<
style
>
@import
"@/static/font1/iconfont.css"
;
...
...
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