Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
study
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
Damon
study
Commits
0323b236
Commit
0323b236
authored
Jul 27, 2021
by
Facius
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improvement: 获取省份接口优化
parent
e6afd79e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
53 deletions
+63
-53
learn.js
src/api/learn.js
+1
-1
index.vue
src/pages/index/index.vue
+28
-27
examSetting.vue
src/pages/learn/examSetting.vue
+34
-25
No files found.
src/api/learn.js
View file @
0323b236
...
...
@@ -22,7 +22,7 @@ let learnApiFun = function(vm) {
// 查询省份列表
let
getProvinceList
=
async
(
subjectId
)
=>
await
vm
.
$u
.
get
(
'/rest/question/getProvinceList'
+
subjectId
)
await
vm
.
$u
.
get
(
'/rest/question/getProvinceList
/
'
+
subjectId
)
// 学生查询题库首页
let
queryMyQuestionWarehouseDetail
=
async
(
questionWarehouseId
)
=>
...
...
src/pages/index/index.vue
View file @
0323b236
...
...
@@ -47,9 +47,7 @@
:src=
"item.image"
></image
><text
v-if=
"item.title"
class=
"detail-title"
>
{{
item
.
title
}}
</text
><text
class=
"detail-text"
>
{{
item
.
key
==
'location'
?
provinceName
:
info
[
item
.
key
]
}}
</text></view
><text
class=
"detail-text"
>
{{
info
[
item
.
key
]
}}
</text></view
>
</view>
<SubjectStatistics
...
...
@@ -117,10 +115,10 @@ export default {
visible
:
false
,
// 免费体验弹窗
show
:
false
,
type
:
'select'
,
provinceList
:
[],
//
provinceList: [],
detail
:
{
questionWarehouse
:
{}
},
selected
:
{},
data
:
{},
data
:
{
questionWarehouse
:
{}
},
// relationId: 0, // 绑卡用
loading
:
false
,
canExperience
:
false
,
// 体验资格
...
...
@@ -166,7 +164,10 @@ export default {
id
:
this
.
selected
.
id
,
cardId
:
this
.
detail
.
questionWarehouse
&&
this
.
detail
.
questionWarehouse
.
cardId
,
provinceName
:
this
.
provinceName
,
provinceName
:
this
.
data
.
questionWarehouse
.
echoMap
&&
this
.
data
.
questionWarehouse
.
echoMap
.
provinceId
&&
this
.
data
.
questionWarehouse
.
echoMap
.
provinceId
.
fullName
,
experience
:
this
.
canExperience
,
pass
:
this
.
$u
.
random
(
95
,
99
)
+
'%'
,
days
:
this
.
detail
.
totalDayCount
||
0
,
...
...
@@ -208,19 +209,19 @@ export default {
},
]
},
provinceName
()
{
for
(
var
item
of
this
.
provinceList
)
{
if
(
item
.
id
==
this
.
selected
.
provinceId
)
{
return
item
.
fullName
+
'题'
}
}
return
''
},
//
provinceName() {
//
for (var item of this.provinceList) {
//
if (item.id == this.selected.provinceId) {
//
return item.fullName + '题'
//
}
//
}
//
return ''
//
},
detailItems
()
{
return
[
{
title
:
''
,
key
:
'
location
'
,
key
:
'
provinceName
'
,
image
:
process
.
uniEnv
.
qn_base_url
+
'quyu.png'
,
imageStyle
:
'width:24rpx;height:28rpx'
,
},
...
...
@@ -248,7 +249,7 @@ export default {
onLoad
()
{
if
(
this
.
vuex_token
)
{
this
.
loading
=
true
this
.
getProvinceList
()
//
this.getProvinceList()
}
},
onShow
()
{
...
...
@@ -269,7 +270,7 @@ export default {
},
methods
:
{
initData
()
{
this
.
getProvinceList
()
//
this.getProvinceList()
this
.
queryMyQuestionWarehouseDetail
(
'0'
)
},
// 检查是否具有体验资格
...
...
@@ -497,16 +498,16 @@ export default {
})
}
},
getProvinceList
()
{
this
.
$u
.
api
.
getProvinceList
()
.
then
((
res
)
=>
{
this
.
provinceList
=
res
||
[]
})
.
catch
((
err
)
=>
{
console
.
log
(
err
)
})
},
//
getProvinceList() {
//
this.$u.api
//
.getProvinceList()
//
.then((res) => {
//
this.provinceList = res || []
//
})
//
.catch((err) => {
//
console.log(err)
//
})
//
},
setPageInfo
(
info
)
{
var
pages
=
getCurrentPages
()
if
(
pages
.
length
>=
1
)
{
...
...
src/pages/learn/examSetting.vue
View file @
0323b236
...
...
@@ -194,7 +194,7 @@ export default {
onLoad
(
e
)
{
this
.
getPageInfo
()
this
.
getLocation
()
this
.
getProvinceList
(
this
.
questionWarehouseI
d
)
this
.
getProvinceList
(
this
.
category
.
i
d
)
},
methods
:
{
handleClickArea
()
{
...
...
@@ -228,8 +228,8 @@ export default {
this
.
showPop
=
true
},
// 获取省份列表
async
getProvinceList
(
questionWarehouseI
d
)
{
let
res
=
await
this
.
$u
.
api
.
getProvinceList
(
questionWarehouseI
d
)
async
getProvinceList
(
i
d
)
{
let
res
=
await
this
.
$u
.
api
.
getProvinceList
(
i
d
)
console
.
log
(
res
)
this
.
range
=
res
},
...
...
@@ -250,32 +250,41 @@ export default {
}
// 获取科目对应的题库
let
res
=
await
this
.
$u
.
api
.
getQuestionWarehouse
(
this
.
category
.
id
,
param
)
let
data
=
res
[
0
]
this
.
setPageInfo
(
data
)
// 学员增加自己的题库
let
result
=
await
this
.
$u
.
api
.
addQuestionWarehouse
({
questionWarehouseId
:
data
.
id
,
})
.
catch
((
err
)
=>
{
console
.
log
(
err
)
})
if
(
res
&&
res
.
length
>
0
)
{
let
data
=
res
[
0
]
this
.
setPageInfo
(
data
)
// 学员增加自己的题库
let
result
=
await
this
.
$u
.
api
.
addQuestionWarehouse
({
questionWarehouseId
:
data
.
id
,
})
.
catch
((
err
)
=>
{
console
.
log
(
err
)
})
if
(
result
)
{
// 成功
if
(
result
)
{
// 成功
this
.
$refs
.
uToast
.
show
({
title
:
'添加题库成功'
,
type
:
'success'
,
duration
:
1500
,
callback
:
()
=>
{
this
.
showPop
=
false
uni
.
switchTab
({
url
:
'/pages/index/index'
,
})
},
})
}
else
{
this
.
showPop
=
false
}
}
else
{
this
.
$refs
.
uToast
.
show
({
title
:
'
添加题库成功
'
,
type
:
'
success
'
,
title
:
'
所选科目没有对应的题库
'
,
type
:
'
warning
'
,
duration
:
1500
,
callback
:
()
=>
{
this
.
showPop
=
false
uni
.
switchTab
({
url
:
'/pages/index/index'
,
})
},
callback
:
()
=>
{},
})
}
else
{
this
.
showPop
=
false
}
},
changeIndex
()
{
...
...
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