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
9bde5029
Commit
9bde5029
authored
Jul 29, 2024
by
陈宗胤(贵阳日报)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
接口
parent
d97c9db9
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
58 additions
and
19 deletions
+58
-19
.env.development
.env.development
+8
-0
.env.production
.env.production
+9
-0
App.vue
src/App.vue
+1
-1
index.js
src/api/index.js
+10
-1
index.vue
src/pages/index/index.vue
+26
-9
test.json
src/static/json/test.json
+0
-0
domain.js
src/utils/domain.js
+0
-3
env.js
src/utils/env.js
+0
-1
request.js
src/utils/request.js
+3
-4
vite.config.ts
vite.config.ts
+1
-0
No files found.
.env.development
0 → 100644
View file @
9bde5029
# 环境标识
VITE_APP_ENV = 'development'
# URL路径
VITE_APP_BASE_URL = '/api'
# 照片url路径
VITE_APP_IMG_URL = 'http://file.rhhzkj.com:8080'
.env.production
0 → 100644
View file @
9bde5029
# 环境标识
VITE_APP_ENV = 'production'
# URL路径
VITE_APP_BASE_URL = 'https://api.rddyz.com'
# 照片url路径
VITE_APP_IMG_URL = 'https://file.rddyz.com'
\ No newline at end of file
src/App.vue
View file @
9bde5029
<
script
setup
lang=
"ts"
>
<
script
setup
>
onLaunch
(()
=>
{
onLaunch
(()
=>
{
console
.
log
(
'App Launch'
);
console
.
log
(
'App Launch'
);
});
});
...
...
src/api/index.js
View file @
9bde5029
import
{
request
}
from
'../utils/request'
;
import
{
request
}
from
'../utils/request'
;
export
function
test
(
data
)
{
// 登录
export
function
getTokenUser
(
data
)
{
return
request
({
return
request
({
url
:
'/sgyrdd/auth/getToken'
,
url
:
'/sgyrdd/auth/getToken'
,
method
:
'POST'
,
method
:
'POST'
,
data
,
data
,
});
});
}
}
// 分类
export
function
groupBuyList
()
{
return
request
({
url
:
'/sgyrdd/category/groupBuyList'
,
method
:
'GET'
,
});
}
src/pages/index/index.vue
View file @
9bde5029
...
@@ -128,17 +128,35 @@ import FoodDetails from '../../components/index/FoodDetails.vue';
...
@@ -128,17 +128,35 @@ import FoodDetails from '../../components/index/FoodDetails.vue';
import
ShopCard
from
'../../components/index/ShopCard.vue'
;
import
ShopCard
from
'../../components/index/ShopCard.vue'
;
import
Marketing
from
'../../components/index/Marketing.vue'
;
import
Marketing
from
'../../components/index/Marketing.vue'
;
import
Position
from
'../../components/index/Position.vue'
;
import
Position
from
'../../components/index/Position.vue'
;
import
{
test
}
from
'../../api/index'
;
import
{
getTokenUser
,
groupBuyList
}
from
'../../api/index'
;
import
testJson
from
'../../json/test.json'
;
import
testJson
from
'../../static/json/test.json'
;
import
{
getToken
}
from
'../../utils/auth'
;
const
title
=
ref
(
'小程序平台'
);
const
title
=
ref
(
'小程序平台'
);
const
{
countInfo
,
addCount
}
=
useCountStore
();
const
{
countInfo
,
addCount
}
=
useCountStore
();
onMounted
(()
=>
{
onMounted
(
async
()
=>
{
test
(
testJson
).
then
((
res
)
=>
{
if
(
!
getToken
())
await
signIn
();
console
.
log
(
'打印'
,
res
);
getClassification
();
});
// test(testJson).then((res) => {
// console.log('打印', res);
// });
// console.log('testJson', testJson);
// console.log('testJson', testJson);
});
});
// 登录
const
signIn
=
()
=>
{
getTokenUser
(
testJson
).
then
((
res
)
=>
{
const
token
=
res
.
data
.
access_token
;
xma
.
setStorageSync
(
'Authorization'
,
token
);
console
.
log
(
'登录...'
);
});
};
// 获取分类
const
getClassification
=
()
=>
{
groupBuyList
().
then
((
res
)
=>
{
console
.
log
(
'res'
,
res
);
});
};
const
light
=
ref
(
0
);
const
light
=
ref
(
0
);
const
rotate
=
ref
(
false
);
const
rotate
=
ref
(
false
);
const
classificationT
=
reactive
([
const
classificationT
=
reactive
([
...
@@ -197,7 +215,7 @@ const handleClick = (e) => {
...
@@ -197,7 +215,7 @@ const handleClick = (e) => {
}
}
};
};
const
onChange
=
(
e
)
=>
{
const
onChange
=
(
e
)
=>
{
console
.
log
(
e
);
//
console.log(e);
};
};
// function toUIComponentsDoc() {
// function toUIComponentsDoc() {
// window.open('https://wot-design-uni.netlify.app/component/button.html');
// window.open('https://wot-design-uni.netlify.app/component/button.html');
...
@@ -260,9 +278,8 @@ page {
...
@@ -260,9 +278,8 @@ page {
display
:
flex
;
display
:
flex
;
flex-direction
:
column
;
flex-direction
:
column
;
align-items
:
center
;
align-items
:
center
;
font-size
:
24
rpx
;
font-size
:
18
rpx
;
color
:
#3d3d3d
;
color
:
#3d3d3d
;
font-weight
:
500
;
justify-content
:
flex-end
;
justify-content
:
flex-end
;
font-family
:
font-family
:
Source
Han
Sans
,
Source
Han
Sans
,
...
...
src/json/test.json
→
src/
static/
json/test.json
View file @
9bde5029
File moved
src/utils/domain.js
View file @
9bde5029
// const { env } = require('./env');
import
{
env
}
from
'./env'
;
import
{
env
}
from
'./env'
;
let
domain
=
{};
let
domain
=
{};
if
(
env
===
'dev'
)
{
if
(
env
===
'dev'
)
{
...
@@ -12,7 +11,5 @@ if (env === 'dev') {
...
@@ -12,7 +11,5 @@ if (env === 'dev') {
// imgPrefix: 'https://gdlxy-images.wjzpgz.com/',
// imgPrefix: 'https://gdlxy-images.wjzpgz.com/',
};
};
}
}
// domain.ossImgPrefix = 'https://gdlxy-images.wjzpgz.com/mp',
// module.exports = domain;
export
default
domain
;
export
default
domain
;
src/utils/env.js
View file @
9bde5029
export
const
env
=
'dev'
;
export
const
env
=
'dev'
;
// prod 生产
// prod 生产
// dev 开发
// dev 开发
// export default env;
src/utils/request.js
View file @
9bde5029
import
{
getToken
,
removeToken
}
from
'./auth'
;
import
{
getToken
,
removeToken
}
from
'./auth'
;
import
domain
from
'./domain'
;
//
import domain from './domain';
export
const
request
=
({
url
,
data
=
{},
header
,
method
=
'GET'
})
=>
{
export
const
request
=
({
url
,
data
=
{},
header
,
method
=
'GET'
})
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
console
.
log
(
'url'
,
url
);
const
token
=
getToken
();
const
token
=
getToken
();
header
=
{
header
=
{
/* "Client-Type": 1,
/* "Client-Type": 1,
...
@@ -16,12 +15,12 @@ export const request = ({ url, data = {}, header, method = 'GET' }) => {
...
@@ -16,12 +15,12 @@ export const request = ({ url, data = {}, header, method = 'GET' }) => {
header
.
Authorization
=
'Bearer '
+
token
;
header
.
Authorization
=
'Bearer '
+
token
;
}
}
xma
.
request
({
xma
.
request
({
url
:
domain
.
apiPrefix
+
url
,
url
:
import
.
meta
.
env
.
VITE_APP_BASE_URL
+
url
,
data
,
data
,
header
,
header
,
method
,
method
,
success
:
(
res
)
=>
{
success
:
(
res
)
=>
{
console
.
log
(
res
.
data
);
resolve
(
res
.
data
);
},
},
fail
:
(
e
)
=>
{
fail
:
(
e
)
=>
{
console
.
log
(
'e'
,
e
);
console
.
log
(
'e'
,
e
);
...
...
vite.config.ts
View file @
9bde5029
...
@@ -43,6 +43,7 @@ export default defineConfig({
...
@@ -43,6 +43,7 @@ export default defineConfig({
'/api'
:
{
'/api'
:
{
target
:
'http://test.rhhzkj.com:8080'
,
target
:
'http://test.rhhzkj.com:8080'
,
changeOrigin
:
true
,
changeOrigin
:
true
,
rewrite
:
(
path
)
=>
path
.
replace
(
/^
\/
api/
,
''
),
},
},
},
},
},
},
...
...
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