Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
groupPurchase-miniapp
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
彭佳妮(贵阳日报)
groupPurchase-miniapp
Commits
c1cf916e
Commit
c1cf916e
authored
Aug 06, 2024
by
陈宗胤(贵阳日报)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登录页(无感)
parent
d200caea
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
89 additions
and
42 deletions
+89
-42
App.vue
src/App.vue
+1
-32
Search.vue
src/components/index/Search.vue
+7
-7
pages.json
src/pages.json
+7
-0
index.vue
src/pages/index/index.vue
+6
-3
loading.vue
src/pages/index/loading.vue
+34
-0
signIn.js
src/utils/signIn.js
+34
-0
No files found.
src/App.vue
View file @
c1cf916e
<
script
setup
>
import
{
getTokenUser
}
from
'./api/index'
;
import
{
sgyOrderGetStatus
}
from
'./api/order'
;
import
testJson
from
'./static/json/test.json'
;
import
{
getToken
}
from
'./utils/auth'
;
import
{
setOrderDic
}
from
'./utils/orderDic'
;
// beforeMount(() => {
// if (!getToken()) signIn();
// });
onLaunch
(()
=>
{
if
(
!
getToken
())
signIn
();
sgyOrderGetStatus
().
then
((
res
)
=>
{
if
(
res
.
code
===
0
)
{
setOrderDic
(
res
.
data
.
store
);
}
});
});
onLaunch
(()
=>
{});
onShow
(()
=>
{
console
.
log
(
'App Show'
);
...
...
@@ -23,22 +8,6 @@ onShow(() => {
onHide
(()
=>
{
console
.
log
(
'App Hide'
);
});
// 登录
const
signIn
=
()
=>
{
xma
.
xh
.
getUserProfile
({
range
:
[
'ACCOUNT'
,
'MOBILE'
,
'CITIZEN'
],
async
success
(
info
)
{
const
info2
=
JSON
.
stringify
(
info
);
getTokenUser
(
info2
).
then
((
res
)
=>
{
const
token
=
res
.
data
.
access_token
;
const
userInfo
=
res
.
data
.
user_info
;
xma
.
setStorageSync
(
'Authorization'
,
token
);
xma
.
setStorageSync
(
'userInfo'
,
userInfo
);
console
.
log
(
'登录...'
);
});
},
});
};
</
script
>
<
style
>
.multi-line
{
...
...
src/components/index/Search.vue
View file @
c1cf916e
...
...
@@ -31,13 +31,13 @@ const title = ref('小程序平台');
const
{
countInfo
,
addCount
}
=
useCountStore
();
const
test
=
ref
(
''
);
onMounted
(()
=>
{
xma
.
xh
.
getUserProfile
({
range
:
[
'ACCOUNT'
,
'MOBILE'
,
'CITIZEN'
],
async
success
(
info
)
{
const
info2
=
JSON
.
stringify
(
info
);
test
.
value
=
info2
;
},
});
//
xma.xh.getUserProfile({
//
range: ['ACCOUNT', 'MOBILE', 'CITIZEN'],
//
async success(info) {
//
const info2 = JSON.stringify(info);
//
test.value = info2;
//
},
//
});
});
const
search
=
(
res
)
=>
{
...
...
src/pages.json
View file @
c1cf916e
...
...
@@ -6,6 +6,13 @@
}
},
"pages"
:
[
{
"path"
:
"pages/index/loading"
,
"style"
:
{
"navigationBarTitleText"
:
"加载"
,
"navigationStyle"
:
"custom"
}
},
{
"path"
:
"pages/index/index"
,
"style"
:
{
...
...
src/pages/index/index.vue
View file @
c1cf916e
...
...
@@ -155,7 +155,9 @@ import FoodDetails from '../../components/index/FoodDetails.vue';
import
ShopCard
from
'../../components/index/ShopCard.vue'
;
import
Marketing
from
'../../components/index/Marketing.vue'
;
import
Position
from
'../../components/index/Position.vue'
;
import
{
orderStatus
}
from
'../../utils/signIn'
;
import
{
getTokenUser
,
groupBuyList
,
groupImgList
,
popularityPage
,
...
...
@@ -165,9 +167,8 @@ import {
receiveCoupon
,
}
from
'../../api/index'
;
import
{
timeConversion
}
from
'../../utils/tool'
;
const
nowTime
=
ref
(
new
Date
().
getTime
());
// import testJson from '../../static/json/test.json';
// import { getToken } from '../../utils/auth'
;
const
nowTime
=
ref
(
new
Date
().
getTime
())
;
const
title
=
ref
(
'小程序平台'
);
const
{
countInfo
,
addCount
}
=
useCountStore
();
// 附近美食
...
...
@@ -205,7 +206,8 @@ const coupon = ref([]);
let
total
;
// 轮播图数据
let
lunboData
;
onMounted
(()
=>
{
onMounted
(
async
()
=>
{
orderStatus
();
getClassification
();
rotatingBroadcast
();
nearbyFood
();
...
...
@@ -213,6 +215,7 @@ onMounted(() => {
getMerchantList
();
getCouponMainList
();
});
function
jumpProductDetails
(
item
)
{
xma
.
navigateTo
({
url
:
'/pages/shop/shop?shopId='
+
item
.
shopId
,
...
...
src/pages/index/loading.vue
0 → 100644
View file @
c1cf916e
<
template
>
<view
class=
"loading"
></view>
</
template
>
<
script
setup
>
import
{}
from
'vue'
;
import
{
signIn
}
from
'../../utils/signIn'
;
import
testJson
from
'../../static/json/test.json'
;
import
{
getTokenUser
}
from
'../../api/index'
;
import
{
getToken
}
from
'../../utils/auth'
;
onMounted
(
async
()
=>
{
// await signIn();
if
(
!
getToken
())
await
signIn2
();
xma
.
reLaunch
({
url
:
'/pages/index/index'
});
});
// 登录
const
signIn2
=
()
=>
{
xma
.
showLoading
({
title
:
'加载中'
,
mask
:
true
,
});
return
getTokenUser
(
testJson
).
then
((
res
)
=>
{
const
token
=
res
.
data
.
access_token
;
const
userInfo
=
res
.
data
.
user_info
;
xma
.
setStorageSync
(
'Authorization'
,
token
);
xma
.
setStorageSync
(
'userInfo'
,
userInfo
);
console
.
log
(
'登录...'
);
});
};
</
script
>
<
style
lang=
"scss"
scoped
></
style
>
src/utils/signIn.js
0 → 100644
View file @
c1cf916e
import
{
getTokenUser
}
from
'../api/index'
;
import
{
sgyOrderGetStatus
}
from
'../api/order'
;
import
{
setOrderDic
}
from
'../utils/orderDic'
;
// 登录
export
const
signIn
=
()
=>
{
xma
.
showLoading
({
title
:
'加载中'
,
mask
:
true
,
});
return
new
Promise
((
resolve
,
reject
)
=>
{
xma
.
xh
.
getUserProfile
({
range
:
[
'ACCOUNT'
,
'MOBILE'
,
'CITIZEN'
],
success
(
info
)
{
getTokenUser
(
info
.
data
).
then
((
res
)
=>
{
xma
.
hideLoading
();
const
token
=
res
.
data
.
access_token
;
const
userInfo
=
res
.
data
.
user_info
;
xma
.
setStorageSync
(
'Authorization'
,
token
);
xma
.
setStorageSync
(
'userInfo'
,
userInfo
);
resolve
();
});
},
});
});
};
export
const
orderStatus
=
()
=>
{
sgyOrderGetStatus
().
then
((
res
)
=>
{
if
(
res
.
code
===
0
)
{
setOrderDic
(
res
.
data
.
store
);
}
});
};
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