Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
account-book
Project
Project
Details
Activity
Releases
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
刘文虎
account-book
Commits
ef193272
Commit
ef193272
authored
Oct 21, 2022
by
Facius
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 邀请分享
parent
5e6e0ffb
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
53 additions
and
32 deletions
+53
-32
App.vue
App.vue
+2
-13
index.js
api/login/index.js
+0
-10
share.js
api/mine/share.js
+22
-0
index.vue
pages/index/index.vue
+15
-7
index.vue
pages/mine/share/index.vue
+14
-1
login.js
store/modules/login.js
+0
-1
No files found.
App.vue
View file @
ef193272
...
...
@@ -2,7 +2,6 @@
<
script
>
import
{
getLatestVersionNumber
}
from
'@/api/common/index.js'
;
import
{
version
}
from
'@/utils/config.js'
;
import
{
checkToken
}
from
'@/utils/common.js'
;
export
default
{
onLaunch
:
function
()
{
...
...
@@ -22,18 +21,8 @@ import { checkToken} from '@/utils/common.js';
this
.
appUpdateCheck
()
// #endif
},
onShow
:
function
(
options
)
{
var
options
=
{
query
:{
shareUserId
:
2131
}}
console
.
log
(
'App Show'
,
options
)
if
(
options
&&
options
.
query
&&
options
.
query
.
shareUserId
)
{
var
shareUserId
=
options
.
query
.
shareUserId
console
.
log
(
'---App Show---被邀请进来--------'
,
shareUserId
)
if
(
checkToken
())
{
// 调接口
}
else
{
uni
.
setStorageSync
(
'shareUserId'
,
shareUserId
);
}
}
onShow
:
function
()
{
console
.
log
(
'App Show'
)
},
onHide
:
function
()
{
console
.
log
(
'App Hide'
)
...
...
api/login/index.js
View file @
ef193272
...
...
@@ -16,13 +16,3 @@ export function sendCode(data) {
data
})
}
export
function
mobileLogin
(
data
)
{
return
request
({
url
:
`/anno/mobileLogin`
,
method
:
'GET'
,
data
,
noLoading
:
true
})
}
\ No newline at end of file
api/mine/share.js
0 → 100644
View file @
ef193272
import
request
from
"@/utils/request.js"
// 邀请有奖的分享
export
async
function
shareInvited
(
data
)
{
return
request
({
url
:
`/rest/share`
,
method
:
'PUT'
,
data
,
noLoading
:
true
})
}
// 被邀请者通过链接进入应用
export
async
function
shareInto
(
data
)
{
return
request
({
url
:
`/rest/share/into`
,
method
:
'POST'
,
data
,
noLoading
:
true
})
}
pages/index/index.vue
View file @
ef193272
...
...
@@ -121,6 +121,7 @@ import { checkVip, checkToken, getSetting, formatCount } from '@/utils/common.js
import
{
checkOpenPermission
,
checkOpenService
}
from
'@/utils/app-plus-auth.js'
;
import
{
mapGetters
}
from
'vuex'
;
import
{
experienceVip
}
from
'@/api/mine/pay.js'
;
import
{
shareInto
}
from
'@/api/mine/share.js'
;
export
default
{
components
:
{
...
...
@@ -271,6 +272,10 @@ export default {
const
q
=
decodeURIComponent
(
options
.
q
);
// 获取到二维码原始链接内容
console
.
log
(
q
);
}
if
(
options
&&
options
.
shareUserId
)
{
// 点别人的分享邀请进来
uni
.
setStorageSync
(
'shareUserId'
,
options
.
shareUserId
)
}
this
.
freshing
=
false
;
uni
.
$on
(
'bill-list-reload'
,
res
=>
{
setTimeout
(()
=>
{
...
...
@@ -280,11 +285,10 @@ export default {
this
.
systemInfo
=
uni
.
getSystemInfoSync
();
},
onShow
()
{
console
.
log
(
'index/index===onShow'
);
this
.
initInfo
();
if
(
this
.
checkToken
())
{
this
.
getUserInfo
();
this
.
checkShare
()
this
.
checkShare
()
// 检查是否是点别人的分享邀请进来
}
this
.
shareSuccessTip
();
},
...
...
@@ -507,10 +511,15 @@ export default {
checkShare
()
{
const
shareUserId
=
uni
.
getStorageSync
(
'shareUserId'
);
if
(
shareUserId
)
{
console
.
log
(
'---index---被邀请进来------'
,
shareUserId
)
// 调接口
// 成功之后
// uni.setStorageSync('shareUserId', '');
shareInto
({
inviter
:
shareUserId
})
.
then
(
res
=>
{
uni
.
setStorageSync
(
'shareUserId'
,
''
);
})
.
catch
(
err
=>
{
console
.
log
(
err
);
});
}
},
handleClickShare
()
{
...
...
@@ -556,7 +565,6 @@ export default {
});
// #endif
},
handleShare
()
{},
// 朋友圈
onShareTimeline
(
res
)
{
var
image
=
this
.
isVipShare
?
this
.
shareImage
:
''
;
...
...
pages/mine/share/index.vue
View file @
ef193272
...
...
@@ -35,6 +35,7 @@
import
NavbarRight
from
'@/components/navbar-right'
;
import
{
mapGetters
}
from
'vuex'
;
import
{
wxMiniId
,
webUrl
}
from
'@/utils/config.js'
;
import
{
shareInvited
}
from
'@/api/mine/share.js'
;
export
default
{
components
:
{
...
...
@@ -77,11 +78,21 @@ export default {
},
methods
:
{
handleClickShare
()
{
shareInvited
()
{
shareInvited
({})
.
then
(
res
=>
{
if
(
res
.
data
)
{
}
})
.
catch
(
err
=>
{
console
.
log
(
err
);
});
},
handleClickShare
()
{
// #ifdef APP-PLUS
this
.
shareInvited
()
uni
.
share
({
provider
:
'weixin'
,
scene
:
'WXSceneSession'
,
...
...
@@ -107,6 +118,7 @@ export default {
},
// 朋友圈
onShareTimeline
(
res
)
{
this
.
shareInvited
()
return
{
title
:
'扳手记账'
,
path
:
`/pages/index/index?shareUserId=
${
this
.
userInfo
.
id
}
`
,
...
...
@@ -115,6 +127,7 @@ export default {
},
// 好友
onShareAppMessage
(
res
)
{
this
.
shareInvited
()
return
{
title
:
'扳手记账'
,
path
:
`/pages/index/index?shareUserId=
${
this
.
userInfo
.
id
}
`
,
...
...
store/modules/login.js
View file @
ef193272
...
...
@@ -22,7 +22,6 @@ import {
}
from
"@/utils/config.js"
import
{
userAuthLogin
,
mobileLogin
}
from
"@/api/login/index.js"
;
import
{
getUserInfo
,
...
...
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