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
876e70cc
Commit
876e70cc
authored
Sep 07, 2021
by
Facius
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'test'
parents
4f1b8a21
4a1a3f24
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
350 additions
and
136 deletions
+350
-136
.env.js
.env.js
+1
-1
launch.json
.hbuilderx/launch.json
+11
-0
index.vue
src/components/mask-tip/index.vue
+57
-0
index.vue
src/components/subject-statistics/index.vue
+16
-24
index.vue
src/pages/index/index.vue
+79
-28
detail.vue
src/pages/learn/detail.vue
+28
-0
score.vue
src/pages/learn/score.vue
+10
-37
index.vue
src/pages/login/index.vue
+143
-43
index.js
src/store/index.js
+5
-3
No files found.
.env.js
View file @
876e70cc
;(
function
()
{
;(
function
()
{
let
NODE_ENV
=
'prod'
// dev:开发环境 | test:测试环境 | prod:生产环境
let
NODE_ENV
=
'prod'
// dev:开发环境 | test:测试环境 | prod:生产环境
let
ENV_VAR
=
null
let
ENV_VAR
=
null
let
VERSION
=
'v1.
1.1
'
let
VERSION
=
'v1.
2.0
'
if
(
process
.
env
.
NODE_ENV
===
'development'
)
{
if
(
process
.
env
.
NODE_ENV
===
'development'
)
{
if
(
NODE_ENV
===
'dev'
)
{
if
(
NODE_ENV
===
'dev'
)
{
ENV_VAR
=
require
(
'./.env.dev.js'
)
ENV_VAR
=
require
(
'./.env.dev.js'
)
...
...
.hbuilderx/launch.json
0 → 100644
View file @
876e70cc
{
//
launch.json
配置了启动调试时相关设置,configurations下节点名称可为
app-plus/h
5
/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp
-360
/
//
launchtype项可配置值为local或remote
,
local代表前端连本地云函数,remote代表前端连云端云函数
"version"
:
"0.0"
,
"configurations"
:
[{
"type"
:
"uniCloud"
,
"default"
:
{
"launchtype"
:
"local"
}
}
]
}
src/components/mask-tip/index.vue
0 → 100644
View file @
876e70cc
<
template
>
<u-mask
:show=
"show"
@
click=
"handleClick"
:zoom=
"false"
>
<view
class=
"tip-view"
>
<image
class=
"tip-image"
:src=
"imageUrl"
:style=
"imageStyle"
mode=
"widthFix"
></image>
</view>
</u-mask>
</
template
>
<
script
>
/**
* @description 创建一个遮罩层,提示图片
* @property {Boolean} visible 是否显示遮罩(默认false)
* @property {Object} customStyle 自定义样式对象,见上方说明
* @example <answer-operation-tips :show.sync="show"></answer-operation-tips>
*/
export
default
{
props
:
{
show
:
{
type
:
Boolean
,
default
:
false
,
},
imageStyle
:
String
,
imageName
:
String
,
customStyle
:
{
type
:
Object
,
default
()
{
return
{}
},
},
},
data
()
{
return
{}
},
computed
:
{
imageUrl
()
{
return
process
.
uniEnv
.
qn_base_url
+
this
.
imageName
},
},
methods
:
{
handleClick
()
{
console
.
log
(
'--------------'
)
this
.
$emit
(
'update:show'
,
false
)
this
.
$emit
(
'click'
)
},
},
}
</
script
>
<
style
lang=
"scss"
scoped
>
.tip-view
{
}
</
style
>
src/components/subject-statistics/index.vue
View file @
876e70cc
...
@@ -2,35 +2,24 @@
...
@@ -2,35 +2,24 @@
<view
class=
"statis"
>
<view
class=
"statis"
>
<image
class=
"background-image"
:src=
"meiriyilianImage"
></image>
<image
class=
"background-image"
:src=
"meiriyilianImage"
></image>
<view
class=
"content-view"
>
<view
class=
"content-view"
>
<!--
<view
class=
"u-flex top"
>
<view
class=
"u-flex avatar"
>
<view
class=
"avatar-list"
v-for=
"(item, index) in info.avatar"
:key=
"index"
><image
:src=
"item"
mode=
"scaleToFill"
/></view>
</view>
<view
class=
"notice"
>
<u-notice-bar
mode=
"horizontal"
type=
"none"
font-size=
"26"
:list=
"info.dynamic"
color=
"#FFFFFF"
:volume-icon=
"false"
autoplay
padding=
"0 10rpx"
></u-notice-bar>
</view>
</view>
-->
<NoticeBar
/>
<NoticeBar
/>
<view
class=
"u-flex center"
>
<view
class=
"u-flex center"
>
<view
v-for=
"(value, key) in detailLabels"
:key=
"key"
class=
"item-view"
>
<view
v-for=
"(value, key) in detailLabels"
:key=
"key"
class=
"item-view"
>
<view
v-if=
"key == 'total'"
class=
"line-view"
></view>
<view
v-if=
"key == 'total'"
class=
"line-view"
></view>
<view
class=
"left-view"
@
click=
"handleClick(key)"
>
<view
class=
"left-view"
@
click=
"handleClick(key)"
hover-class=
"u-hover-class"
>
<view
class=
"count-view"
>
{{
info
[
key
]
}}
</view>
<view
class=
"count-view"
>
{{
info
[
key
]
}}
</view>
<view>
{{
value
}}
</view>
<view
>
{{
value
}}
<u-icon
class=
"arrow-icon"
name=
"arrow-right"
color=
"#cccccc"
></u-icon
></view>
</view>
</view>
<view
v-if=
"key == 'total'"
class=
"line-view"
></view>
<view
v-if=
"key == 'total'"
class=
"line-view"
></view>
</view>
</view>
...
@@ -175,6 +164,9 @@ export default {
...
@@ -175,6 +164,9 @@ export default {
font-size
:
48rpx
;
font-size
:
48rpx
;
margin-bottom
:
6rpx
;
margin-bottom
:
6rpx
;
}
}
.arrow-icon
{
margin-left
:
4rpx
;
}
}
}
.line-view
{
.line-view
{
width
:
2rpx
;
width
:
2rpx
;
...
...
src/pages/index/index.vue
View file @
876e70cc
...
@@ -53,6 +53,7 @@
...
@@ -53,6 +53,7 @@
</view>
</view>
<SubjectStatistics
<SubjectStatistics
:info=
"info"
:info=
"info"
class=
"subject-statistics"
@
answer=
"handleAnswer"
@
answer=
"handleAnswer"
@
click=
"handleClickItem"
@
click=
"handleClickItem"
></SubjectStatistics>
></SubjectStatistics>
...
@@ -105,6 +106,16 @@
...
@@ -105,6 +106,16 @@
<view>
<view>
<u-toast
ref=
"uToast"
/>
<u-toast
ref=
"uToast"
/>
</view>
</view>
<MaskTip
:show
.
sync=
"showMask"
imageName=
"mengceng1.png"
:imageStyle=
"imageStyle0"
/>
<MaskTip
:show
.
sync=
"showCountTip"
imageName=
"mengceng2.png"
:imageStyle=
"imageStyle"
/>
</view>
</view>
</
template
>
</
template
>
...
@@ -112,13 +123,16 @@
...
@@ -112,13 +123,16 @@
import
SubjectStatistics
from
'@/components/subject-statistics'
import
SubjectStatistics
from
'@/components/subject-statistics'
import
ExperiencePop
from
'@/components/experience-pop'
import
ExperiencePop
from
'@/components/experience-pop'
import
ToastPop
from
'@/components/toast-pop'
import
ToastPop
from
'@/components/toast-pop'
import
MaskTip
from
'@/components/mask-tip'
export
default
{
export
default
{
components
:
{
SubjectStatistics
,
ExperiencePop
,
ToastPop
},
components
:
{
SubjectStatistics
,
ExperiencePop
,
ToastPop
,
MaskTip
},
data
()
{
data
()
{
return
{
return
{
visible
:
false
,
// 免费体验弹窗
visible
:
false
,
// 免费体验弹窗
show
:
false
,
show
:
false
,
showMask
:
false
,
// 左上角选题库提示
showCountTip
:
false
,
// 题数可点击提示
type
:
'select'
,
type
:
'select'
,
// provinceList: [],
// provinceList: [],
detail
:
{
questionWarehouse
:
{}
},
detail
:
{
questionWarehouse
:
{}
},
...
@@ -132,6 +146,8 @@ export default {
...
@@ -132,6 +146,8 @@ export default {
isAdd
:
false
,
// 题库切换
isAdd
:
false
,
// 题库切换
tapCount
:
0
,
// 点击底部logo五次,显示机构id
tapCount
:
0
,
// 点击底部logo五次,显示机构id
showOrgId
:
false
,
// 显示机构id
showOrgId
:
false
,
// 显示机构id
tipTop
:
410
,
tipTop0
:
50
,
}
}
},
},
computed
:
{
computed
:
{
...
@@ -254,19 +270,39 @@ export default {
...
@@ -254,19 +270,39 @@ export default {
},
},
]
]
},
},
imageStyle
()
{
return
`width:640rpx;margin-top:
${
this
.
tipTop
}
rpx;margin-left:56rpx;`
},
imageStyle0
()
{
return
`width:502rpx;margin-top:
${
this
.
tipTop0
}
rpx`
},
},
watch
:
{
'detail.totalCount'
(
val
)
{
// 上次答题总数为0,这次答题总数大于0,弹出提示
let
id
=
this
.
detail
.
questionWarehouse
?.
echoMap
?.
questionWarehouseId
?.
id
if
(
val
>
0
&&
getApp
().
globalData
.
oldTotalCount
==
id
+
'-'
+
0
)
{
this
.
$nextTick
(()
=>
{
const
query
=
uni
.
createSelectorQuery
().
in
(
this
)
query
.
select
(
'.subject-statistics'
)
.
boundingClientRect
((
data
)
=>
{
this
.
tipTop
=
data
?.
top
*
2
+
100
this
.
showCountTip
=
true
})
.
exec
()
})
}
getApp
().
globalData
.
oldTotalCount
=
id
+
'-'
+
val
},
},
},
// watch: {
// vuex_token(val, oldVal) {
// // 监听token变化,如果更新则重新加载页面数据
// val && !oldVal && this.initData()
// },
// },
onLoad
()
{
onLoad
()
{
getApp
().
trackPage
(
'首页'
)
getApp
().
trackPage
(
'首页'
)
if
(
this
.
vuex_token
)
{
if
(
this
.
vuex_token
)
{
this
.
loading
=
true
this
.
loading
=
true
// this.getProvinceList()
// this.getProvinceList()
}
}
this
.
showMaskTip
()
},
},
onShow
()
{
onShow
()
{
if
(
this
.
vuex_token
)
{
if
(
this
.
vuex_token
)
{
...
@@ -284,6 +320,7 @@ export default {
...
@@ -284,6 +320,7 @@ export default {
this
.
chagefinishCount
()
this
.
chagefinishCount
()
}
}
},
},
onUnload
()
{},
methods
:
{
methods
:
{
// initData() {
// initData() {
// // this.getProvinceList()
// // this.getProvinceList()
...
@@ -402,13 +439,7 @@ export default {
...
@@ -402,13 +439,7 @@ export default {
},
},
})
})
}
else
{
}
else
{
this
.
$u
.
route
({
this
.
showBuyToast
()
url
:
'pages/learn/detail'
,
params
:
{
// relationId: this.relationId,
id
:
this
.
info
.
id
,
},
})
}
}
}
else
{
}
else
{
this
.
show
=
true
this
.
show
=
true
...
@@ -488,13 +519,7 @@ export default {
...
@@ -488,13 +519,7 @@ export default {
}
}
}
else
if
(
this
.
info
.
id
)
{
}
else
if
(
this
.
info
.
id
)
{
// 已选题库
// 已选题库
this
.
$u
.
route
({
this
.
showBuyToast
()
url
:
'pages/learn/detail'
,
params
:
{
// relationId: this.relationId,
id
:
this
.
info
.
id
,
},
})
}
else
{
}
else
{
// 未选题库
// 未选题库
this
.
show
=
true
this
.
show
=
true
...
@@ -514,13 +539,7 @@ export default {
...
@@ -514,13 +539,7 @@ export default {
})
})
}
else
if
(
this
.
info
.
id
)
{
}
else
if
(
this
.
info
.
id
)
{
// 已选题库未绑卡
// 已选题库未绑卡
this
.
$u
.
route
({
this
.
showBuyToast
()
url
:
'pages/learn/detail'
,
params
:
{
// relationId: this.relationId,
id
:
this
.
info
.
id
,
},
})
}
else
{
}
else
{
this
.
show
=
true
this
.
show
=
true
}
}
...
@@ -581,6 +600,38 @@ export default {
...
@@ -581,6 +600,38 @@ export default {
return
false
return
false
}
}
},
},
showMaskTip
()
{
this
.
$nextTick
(()
=>
{
if
(
this
.
firstLauch
)
{
this
.
$u
.
vuex
(
'firstLauch'
,
false
)
setTimeout
(()
=>
{
console
.
log
(
uni
.
getSystemInfoSync
().
statusBarHeight
)
uni
.
getSystemInfo
({
success
:
(
res
)
=>
{
this
.
tipTop0
=
res
.
statusBarHeight
*
2
+
15
this
.
showMask
=
true
},
})
},
2000
)
}
})
},
showBuyToast
()
{
this
.
$refs
.
uToast
.
show
({
title
:
'请先进行绑卡'
,
type
:
'warning'
,
duration
:
1500
,
callback
:
()
=>
{
this
.
$u
.
route
({
url
:
'pages/learn/detail'
,
params
:
{
// relationId: this.relationId,
id
:
this
.
info
.
id
,
},
})
},
})
},
},
},
}
}
</
script
>
</
script
>
...
...
src/pages/learn/detail.vue
View file @
876e70cc
...
@@ -82,17 +82,29 @@
...
@@ -82,17 +82,29 @@
绑定学习卡
绑定学习卡
</u-button>
</u-button>
</view>
</view>
<MaskTip
:show
.
sync=
"show"
imageName=
"mengceng3.png"
:imageStyle=
"imageStyle"
/>
</view>
</view>
</
template
>
</
template
>
<
script
>
<
script
>
import
MaskTip
from
'@/components/mask-tip'
export
default
{
export
default
{
components
:
{
MaskTip
,
},
data
()
{
data
()
{
return
{
return
{
// relationId: 0, // 绑卡用
// relationId: 0, // 绑卡用
info
:
{
info
:
{
questionWarehouse
:
{},
questionWarehouse
:
{},
},
},
show
:
false
,
tipTop
:
226
,
}
}
},
},
...
@@ -166,6 +178,9 @@ export default {
...
@@ -166,6 +178,9 @@ export default {
},
},
]
]
},
},
imageStyle
()
{
return
`width:492rpx;margin-top:
${
this
.
tipTop
}
px;margin-left:244rpx;`
},
},
},
onLoad
(
e
)
{
onLoad
(
e
)
{
// if (e && e.relationId) {
// if (e && e.relationId) {
...
@@ -190,6 +205,7 @@ export default {
...
@@ -190,6 +205,7 @@ export default {
.
queryQuestionWarehouseById
(
id
)
.
queryQuestionWarehouseById
(
id
)
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
this
.
info
=
res
||
{
questionWarehouse
:
{}
}
this
.
info
=
res
||
{
questionWarehouse
:
{}
}
this
.
showTip
()
})
})
.
catch
((
err
)
=>
{
.
catch
((
err
)
=>
{
this
.
loading
=
false
this
.
loading
=
false
...
@@ -279,6 +295,18 @@ export default {
...
@@ -279,6 +295,18 @@ export default {
}
}
})
})
},
},
showTip
()
{
this
.
$nextTick
(()
=>
{
const
query
=
uni
.
createSelectorQuery
().
in
(
this
)
query
.
select
(
'.price-view'
)
.
boundingClientRect
((
data
)
=>
{
this
.
tipTop
=
data
?.
top
-
64
this
.
show
=
true
})
.
exec
()
})
},
},
},
}
}
</
script
>
</
script
>
...
...
src/pages/learn/score.vue
View file @
876e70cc
...
@@ -80,25 +80,22 @@
...
@@ -80,25 +80,22 @@
</view>
</view>
</view>
</view>
</scroll-view>
</scroll-view>
<u-mask
:show=
"show"
@
click=
"show = false"
>
<MaskTip
<view
class=
"tip-view"
>
:show
.
sync=
"show"
<image
class=
"tip-image"
:src=
"jiantouImage"
></image>
imageName=
"fenxiangmengceng.png"
<view
class=
"tip-message"
imageStyle=
"width:424rpx;margin-left:244rpx;"
><text
class=
"tip-text"
/>
>
请点击右上角可分享至朋友圈或发送给指定朋友
</text
>
</view>
</view>
</u-mask>
</view>
</view>
</
template
>
</
template
>
<
script
>
<
script
>
import
CircleProgress
from
'@/components/circle-progress'
import
CircleProgress
from
'@/components/circle-progress'
import
MaskTip
from
'@/components/mask-tip'
export
default
{
export
default
{
components
:
{
components
:
{
CircleProgress
,
CircleProgress
,
MaskTip
,
},
},
data
()
{
data
()
{
return
{
return
{
...
@@ -191,7 +188,7 @@ export default {
...
@@ -191,7 +188,7 @@ export default {
}
}
let
trackProperties
=
{
let
trackProperties
=
{
openId
:
this
.
openId
,
openId
:
this
.
openId
,
nickname
:
this
.
userInfo
.
nickName
nickname
:
this
.
userInfo
.
nickName
,
}
}
getApp
().
share
(
toShareProperties
,
trackProperties
)
getApp
().
share
(
toShareProperties
,
trackProperties
)
return
toShareProperties
return
toShareProperties
...
@@ -234,7 +231,7 @@ export default {
...
@@ -234,7 +231,7 @@ export default {
pageTotalPoint
:
Number
(
res
.
pageTotalPoint
)
||
0
,
pageTotalPoint
:
Number
(
res
.
pageTotalPoint
)
||
0
,
category
:
echoMap
.
questionWarehouseId
.
title
,
category
:
echoMap
.
questionWarehouseId
.
title
,
type
:
'模拟考试'
,
type
:
'模拟考试'
,
passPoint
:
echoMap
?.
paperId
?.
passPoint
||
80
passPoint
:
echoMap
?.
paperId
?.
passPoint
||
80
,
}
}
}
}
})
})
...
@@ -250,6 +247,7 @@ export default {
...
@@ -250,6 +247,7 @@ export default {
handleClick
()
{
handleClick
()
{
this
.
show
=
true
this
.
show
=
true
setTimeout
(()
=>
{
setTimeout
(()
=>
{
// 防止分享的时候带着遮罩
this
.
show
=
false
this
.
show
=
false
},
2500
)
},
2500
)
},
},
...
@@ -405,30 +403,5 @@ export default {
...
@@ -405,30 +403,5 @@ export default {
}
}
}
}
}
}
.tip-view
{
margin-top
:
116rpx
;
display
:
flex
;
flex-direction
:
column
;
align-items
:
flex-end
;
.tip-image
{
width
:
96rpx
;
height
:
282rpx
;
margin-right
:
200rpx
;
margin-bottom
:
24rpx
;
}
.tip-message
{
width
:
100%
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
.tip-text
{
color
:
#ffffff
;
font-size
:
32rpx
;
font-weight
:
bold
;
text-align
:
left
;
width
:
420rpx
;
}
}
}
}
}
</
style
>
</
style
>
src/pages/login/index.vue
View file @
876e70cc
...
@@ -8,9 +8,9 @@
...
@@ -8,9 +8,9 @@
title-bold
title-bold
></u-navbar>
></u-navbar>
<view
class=
"content"
>
<view
class=
"content"
>
<view>
<
!--
<
view>
<uni-icons
type=
"weixin"
size=
"120"
color=
"#04BE02"
></uni-icons>
<uni-icons
type=
"weixin"
size=
"120"
color=
"#04BE02"
></uni-icons>
</view>
</view>
-->
<view
class=
"view-image"
>
<view
class=
"view-image"
>
<u-image
<u-image
:src=
"targetImage"
:src=
"targetImage"
...
@@ -20,12 +20,27 @@
...
@@ -20,12 +20,27 @@
></u-image>
></u-image>
</view>
</view>
<view
class=
"target"
>
<view
class=
"target"
>
<text
v-if=
"!needAuth"
class=
"bind-phone"
>
绑定手机
</text>
<text
class=
"tips"
>
想要轻松考过,首选模考大师
</text>
<text
class=
"tips"
>
想要轻松考过,首选模考大师
</text>
</view>
</view>
<view
class=
"text-area"
@
click
.
capture=
"loadLogin"
>
<view
class=
"text-area"
@
click
.
capture=
"loadLogin"
>
<button
class=
"bottom"
type=
"primary"
@
tap=
"wxLogin"
>
授权登录
</button>
<button
v-if=
"needAuth"
class=
"bottom"
type=
"primary"
@
tap=
"wxLogin"
>
授权登录
</button>
<button
v-else
class=
"bottom"
type=
"primary"
open-type=
"getPhoneNumber"
@
getphonenumber=
"getphonenumber"
>
绑定手机
</button>
</view>
</view>
</view>
</view>
<view>
<u-toast
ref=
"uToast"
/>
</view>
</view>
</view>
</
template
>
</
template
>
...
@@ -36,6 +51,7 @@ export default {
...
@@ -36,6 +51,7 @@ export default {
title
:
'微信授权登录'
,
title
:
'微信授权登录'
,
host
:
''
,
//配置为自己的额服务器即可
host
:
''
,
//配置为自己的额服务器即可
returnUrl
:
''
,
//跳回页面
returnUrl
:
''
,
//跳回页面
needAuth
:
true
,
}
}
},
},
computed
:
{
computed
:
{
...
@@ -56,6 +72,7 @@ export default {
...
@@ -56,6 +72,7 @@ export default {
mask
:
true
,
mask
:
true
,
})
})
},
},
// 微信登录
wxLogin
()
{
wxLogin
()
{
// 获取code 小程序专有,用户登录凭证。
// 获取code 小程序专有,用户登录凭证。
uni
.
getUserProfile
({
uni
.
getUserProfile
({
...
@@ -63,53 +80,127 @@ export default {
...
@@ -63,53 +80,127 @@ export default {
lang
:
'zh_CN'
,
lang
:
'zh_CN'
,
success
:
(
user
)
=>
{
success
:
(
user
)
=>
{
// 获取成功基本资料后开启登录,因为基本资料首先要授权
// 获取成功基本资料后开启登录,因为基本资料首先要授权
uni
.
login
({
const
userInfo
=
user
.
userInfo
provider
:
'weixin'
,
this
.
$u
.
vuex
(
'userInfo'
,
userInfo
)
success
:
(
code_res
)
=>
{
this
.
uniLogin
((
code
)
=>
{
if
(
code_res
.
errMsg
==
'login:ok'
)
{
// 登录
const
code
=
code_res
.
code
const
data
=
{
const
userInfo
=
user
.
userInfo
code
:
code
,
const
data
=
{
avatar
:
userInfo
.
avatarUrl
,
code
:
code
,
nickname
:
userInfo
.
nickName
,
avatar
:
userInfo
.
avatarUrl
,
orgId
:
this
.
orgId
,
nickname
:
userInfo
.
nickName
,
}
orgId
:
this
.
orgId
,
this
.
studyLogin
(
data
)
})
},
fail
:
(
res
)
=>
{
uni
.
hideLoading
()
uni
.
showModal
({
title
:
'用户拒绝授权'
,
showCancel
:
false
,
})
},
})
},
// 用户登录接口
studyLogin
(
data
)
{
this
.
$u
.
api
.
loginWechatAuth
(
data
).
then
((
res
)
=>
{
uni
.
hideLoading
()
this
.
$u
.
vuex
(
'vuex_token'
,
res
.
token
)
this
.
$u
.
vuex
(
'openId'
,
res
.
openId
)
// 如果已经绑定了手机号
// 后台会返回' '
if
(
res
.
phoneNumber
&&
res
.
phoneNumber
>
1
)
{
// 跳转到特定页面
// 还没有绑定郭手机号
this
.
$refs
.
uToast
.
show
({
title
:
'绑定成功'
,
type
:
'success'
,
duration
:
1500
,
callback
:
()
=>
{
if
(
this
.
returnUrl
)
{
if
(
this
.
returnUrl
===
'pages/learn/selectCategory'
)
{
this
.
queryMyQuestionWarehouseDetail
()
return
}
}
uni
.
showLoading
({
this
.
$u
.
route
({
title
:
'加载中'
,
url
:
this
.
returnUrl
,
type
:
'redirectTo'
,
})
})
this
.
$u
.
api
.
loginWechatAuth
(
data
).
then
((
res
)
=>
{
}
else
{
uni
.
hideLoading
()
this
.
$u
.
route
({
this
.
$u
.
vuex
(
'vuex_token'
,
res
.
token
)
url
:
'/pages/index/index'
,
this
.
$u
.
vuex
(
'openId'
,
res
.
openId
)
type
:
'tab'
,
this
.
$u
.
vuex
(
'userInfo'
,
userInfo
)
if
(
this
.
returnUrl
)
{
if
(
this
.
returnUrl
===
'pages/learn/selectCategory'
)
{
this
.
queryMyQuestionWarehouseDetail
()
return
}
this
.
$u
.
route
({
url
:
this
.
returnUrl
,
type
:
'redirectTo'
,
})
}
else
{
this
.
$u
.
route
({
url
:
'/pages/index/index'
,
type
:
'tab'
,
})
}
})
})
}
}
},
},
})
})
},
}
else
{
fail
:
(
res
)
=>
{
// 还没有绑定郭手机号
this
.
$refs
.
uToast
.
show
({
title
:
'授权成功'
,
type
:
'success'
,
duration
:
1500
,
})
this
.
needAuth
=
false
}
})
},
// 绑定手机
getphonenumber
(
e
)
{
if
(
e
&&
e
.
detail
)
{
if
(
e
.
detail
.
errMsg
.
indexOf
(
'user deny'
)
>
-
1
)
{
uni
.
hideLoading
()
uni
.
showModal
({
uni
.
showModal
({
title
:
'
用户拒绝授权
'
,
title
:
'
提示
'
,
showCancel
:
false
,
showCancel
:
false
,
content
:
'用户拒绝授权'
,
})
})
}
else
if
(
e
.
detail
.
encryptedData
&&
e
.
detail
.
iv
)
{
this
.
uniLogin
((
code
)
=>
{
// 登录
const
data
=
{
code
:
code
,
avatar
:
this
.
userInfo
.
avatarUrl
,
nickname
:
this
.
userInfo
.
nickName
,
orgId
:
this
.
orgId
,
encryptedData
:
e
.
detail
.
encryptedData
,
iv
:
e
.
detail
.
iv
,
}
this
.
studyLogin
(
data
)
})
}
else
{
uni
.
hideLoading
()
uni
.
hideLoading
()
uni
.
showModal
({
title
:
'提示'
,
showCancel
:
false
,
content
:
'用户取消授权'
,
})
}
}
else
{
uni
.
hideLoading
()
uni
.
showModal
({
title
:
'提示'
,
showCancel
:
false
,
content
:
'授权失败,请重新授权'
,
})
}
},
uniLogin
(
block
)
{
uni
.
login
({
provider
:
'weixin'
,
success
:
(
code_res
)
=>
{
if
(
code_res
.
errMsg
==
'login:ok'
)
{
block
(
code_res
.
code
)
}
else
{
uni
.
hideLoading
()
uni
.
showModal
({
content
:
code_res
.
errMsg
,
showCancel
:
false
,
})
}
},
},
})
})
},
},
...
@@ -168,16 +259,18 @@ export default {
...
@@ -168,16 +259,18 @@ export default {
width
:
100%
;
width
:
100%
;
}
}
.content
{
.content
{
height
:
100vh
;
display
:
flex
;
display
:
flex
;
flex-direction
:
column
;
flex-direction
:
column
;
align-items
:
center
;
align-items
:
center
;
justify-content
:
center
;
/* justify-content: center; */
}
}
.text-area
{
.text-area
{
display
:
flex
;
display
:
flex
;
justify-content
:
center
;
justify-content
:
center
;
position
:
relative
;
position
:
relative
;
margin-top
:
500
rpx
;
position
:
fixed
;
bottom
:
100
rpx
;
}
}
.bottom
{
.bottom
{
width
:
600
rpx
;
width
:
600
rpx
;
...
@@ -194,11 +287,18 @@ export default {
...
@@ -194,11 +287,18 @@ export default {
position
:
relative
;
position
:
relative
;
display
:
flex
;
display
:
flex
;
flex-direction
:
column
;
flex-direction
:
column
;
text-align
:
center
;
padding-top
:
32
rpx
;
}
.bind-phone
{
font-size
:
52
rpx
;
font-weight
:
bold
;
color
:
#333333
;
}
}
.tips
{
.tips
{
font-size
:
40
rpx
;
font-size
:
40
rpx
;
color
:
#adbdd4
;
color
:
#adbdd4
;
margin-top
:
64
rpx
;
margin-top
:
32
rpx
;
}
}
.target-image
{
.target-image
{
margin
:
auto
;
margin
:
auto
;
...
...
src/store/index.js
View file @
876e70cc
...
@@ -20,7 +20,8 @@ let saveStateKeys = [
...
@@ -20,7 +20,8 @@ let saveStateKeys = [
'questionWarehouseId'
,
'questionWarehouseId'
,
'relationId'
,
// 绑卡用
'relationId'
,
// 绑卡用
'answerCount'
,
'answerCount'
,
'orgId'
'orgId'
,
'firstLauch'
,
// 初次使用
]
]
// 保存变量到本地存储中
// 保存变量到本地存储中
...
@@ -46,7 +47,7 @@ const store = new Vuex.Store({
...
@@ -46,7 +47,7 @@ const store = new Vuex.Store({
openId
:
lifeData
.
openId
?
lifeData
.
openId
:
''
,
openId
:
lifeData
.
openId
?
lifeData
.
openId
:
''
,
relationId
:
lifeData
.
relationId
?
lifeData
.
relationId
:
''
,
// 绑卡用
relationId
:
lifeData
.
relationId
?
lifeData
.
relationId
:
''
,
// 绑卡用
searchHistory
:
lifeData
.
searchHistory
?
lifeData
.
searchHistory
:
[],
// 搜索历史记录
searchHistory
:
lifeData
.
searchHistory
?
lifeData
.
searchHistory
:
[],
// 搜索历史记录
answerCount
:
lifeData
.
answerCount
?
lifeData
.
answerCount
:
{},
// 已回答题数
answerCount
:
lifeData
.
answerCount
?
lifeData
.
answerCount
:
{},
// 已回答题数
lastIndex
:
lifeData
.
lastIndex
?
lifeData
.
lastIndex
:
{},
// 上次做到第几题
lastIndex
:
lifeData
.
lastIndex
?
lifeData
.
lastIndex
:
{},
// 上次做到第几题
tipStatus
:
lifeData
.
tipStatus
?
lifeData
.
tipStatus
:
false
,
// 滑动提示
tipStatus
:
lifeData
.
tipStatus
?
lifeData
.
tipStatus
:
false
,
// 滑动提示
questionWarehouseId
:
lifeData
.
questionWarehouseId
questionWarehouseId
:
lifeData
.
questionWarehouseId
...
@@ -56,7 +57,8 @@ const store = new Vuex.Store({
...
@@ -56,7 +57,8 @@ const store = new Vuex.Store({
// 如果vuex_version无需保存到本地永久存储,无需lifeData.vuex_version方式
// 如果vuex_version无需保存到本地永久存储,无需lifeData.vuex_version方式
vuex_version
:
'1.0.0'
,
vuex_version
:
'1.0.0'
,
questionList
:
{},
// 练习列表
questionList
:
{},
// 练习列表
beginTime
:
null
// 考试开始时间
beginTime
:
null
,
// 考试开始时间
firstLauch
:
lifeData
.
firstLauch
==
null
?
true
:
false
,
// 初次使用
},
},
mutations
:
{
mutations
:
{
$uStore
(
state
,
payload
)
{
$uStore
(
state
,
payload
)
{
...
...
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