Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
comment_app
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
莫晓莉
comment_app
Commits
7c72d7a3
Commit
7c72d7a3
authored
Sep 18, 2020
by
莫晓莉
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登录注册
parent
0321957c
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
279 additions
and
113 deletions
+279
-113
api/login.js
+6
-4
pages/evaluate/evaluate.vue
+2
-11
pages/login/login.vue
+31
-7
pages/reg/reg.vue
+59
-8
pages/service-apl/service-apl.vue
+23
-1
pages/user/user.vue
+158
-82
No files found.
api/login.js
View file @
7c72d7a3
...
@@ -16,8 +16,11 @@ export const sendCode = (data) => {
...
@@ -16,8 +16,11 @@ export const sendCode = (data) => {
}
}
//获取用户信息
//获取用户信息
export
const
getUserByToken
=
(
data
)
=>
{
export
const
getUserByToken
=
(
data
)
=>
{
return
request
(
'getUserByToken'
,
data
)
return
request
(
'getUserByToken'
,
data
)
}
}
\ No newline at end of file
//获取项目类型
export
const
getProjectTypeList
=
(
data
)
=>
{
return
request
(
'getProjectTypeList'
,
data
)
}
pages/evaluate/evaluate.vue
View file @
7c72d7a3
...
@@ -9,20 +9,11 @@
...
@@ -9,20 +9,11 @@
</view>
-->
</view>
-->
<view
class=
"type-box"
>
<
!--
<
view
class=
"type-box"
>
<view
class=
"category-title"
>
<view
class=
"category-title"
>
星级评价
<text
style=
"color:red;"
>
*
</text>
星级评价
<text
style=
"color:red;"
>
*
</text>
</view>
</view>
<view
class=
"cate-box"
>
<view
class=
"cate-box"
>
<!--
<scroll-view
scroll-x=
"true"
class=
"category-area"
>
<block
wx:for=
"
{{
suggestInfo
.
typeList
}}
" wx:key="index">
<view
bindtap=
"selectTypeTap"
class=
"cate-item "
>
<text
class=
"name"
>
xx
</text>
</view>
</block>
</scroll-view>
-->
<view
class=
"star"
v-for=
"(item,index) in starsList"
:key=
"item.id"
v-bind:style=
"
{ color: [item.selected ?'red':'#ccc']}"
<view
class=
"star"
v-for=
"(item,index) in starsList"
:key=
"item.id"
v-bind:style=
"
{ color: [item.selected ?'red':'#ccc']}"
:data-current="index" @tap="selStar">
{{
item
.
content
}}
</view>
:data-current="index" @tap="selStar">
{{
item
.
content
}}
</view>
...
@@ -32,7 +23,7 @@
...
@@ -32,7 +23,7 @@
</view>
</view>
</view>
</view>
</view>
</view>
-->
<view
class=
"category-title"
>
<view
class=
"category-title"
>
评价内容
<text
style=
"color:red;"
>
*
</text>
评价内容
<text
style=
"color:red;"
>
*
</text>
...
...
pages/login/login.vue
View file @
7c72d7a3
...
@@ -146,20 +146,44 @@
...
@@ -146,20 +146,44 @@
//登录
//登录
login
()
{
login
()
{
if
(
this
.
loginForm
.
phone
==
undefined
)
{
uni
.
showToast
({
icon
:
'none'
,
title
:
'请输入手机号'
});
return
;
}
if
(
this
.
loginForm
.
code
==
undefined
)
{
uni
.
showToast
({
icon
:
'none'
,
title
:
'请输入验证码'
});
return
;
}
if
(
this
.
loginForm
.
password
==
undefined
)
{
uni
.
showToast
({
icon
:
'none'
,
title
:
'请输入密码'
});
return
;
}
login
(
this
.
loginForm
).
then
(
res
=>
{
login
(
this
.
loginForm
).
then
(
res
=>
{
if
(
res
.
code
==
200
)
{
if
(
res
.
code
==
200
)
{
var
user
=
{},
token
=
''
;
var
user
=
{},
token
=
''
;
user
.
name
=
res
.
data
.
name
;
user
.
name
=
res
.
data
.
data
.
name
;
user
.
phone
=
res
.
data
.
phone
;
user
.
phone
=
res
.
data
.
data
.
phone
;
user
.
phone
=
res
.
data
.
userId
;
user
.
userId
=
res
.
data
.
data
.
userId
;
token
=
res
.
data
.
token
;
user
.
idCard
=
res
.
data
.
data
.
idCard
;
token
=
res
.
data
.
data
.
token
;
uni
.
showToast
({
uni
.
showToast
({
icon
:
'success'
,
icon
:
'success'
,
title
:
'登录成功'
,
title
:
'登录成功'
,
success
:
()
=>
{
success
:
()
=>
{
uni
.
navigateTo
({
uni
.
setStorageSync
(
'token'
,
token
)
url
:
'../user/user?token='
+
token
+
"&user="
+
user
,
uni
.
setStorageSync
(
'user'
,
user
)
});
uni
.
switchTab
({
url
:
'../user/user'
,
})
}
}
...
...
pages/reg/reg.vue
View file @
7c72d7a3
...
@@ -25,10 +25,10 @@
...
@@ -25,10 +25,10 @@
</view>
</view>
</radio-group>
</radio-group>
</view>
</view>
<view
class=
"login-item mt25"
v-if=
"selectName==1"
>
<!--
<view
class=
"login-item mt25"
v-if=
"selectName==1"
>
<image
class=
"login-icon"
src=
"../../static/login/mine.png"
></image>
<image
class=
"login-icon"
src=
"../../static/login/mine.png"
></image>
<input
class=
"login-item-input"
placeholder=
"请输入残疾证号"
v-model=
"addForm.disableNumber"
/>
<input
class=
"login-item-input"
placeholder=
"请输入残疾证号"
v-model=
"addForm.disableNumber"
/>
</view>
</view>
-->
<view
class=
"login-item mt25"
>
<view
class=
"login-item mt25"
>
<image
class=
"login-icon"
src=
"../../static/login/code.png"
></image>
<image
class=
"login-icon"
src=
"../../static/login/code.png"
></image>
...
@@ -101,7 +101,14 @@
...
@@ -101,7 +101,14 @@
methods
:
{
methods
:
{
//是否持证
//是否持证
radioChange
(
e
)
{
radioChange
(
e
)
{
this
.
selectName
=
e
.
detail
.
value
this
.
selectName
=
e
.
detail
.
value
;
if
(
this
.
selectName
!=
1
){
uni
.
showToast
({
icon
:
'none'
,
title
:
'只有持证才可以注册'
});
return
;
}
},
},
//获取验证码
//获取验证码
getCode
()
{
getCode
()
{
...
@@ -138,20 +145,64 @@
...
@@ -138,20 +145,64 @@
//注册
//注册
registerFun
()
{
registerFun
()
{
if
(
this
.
addForm
.
name
==
undefined
)
{
uni
.
showToast
({
icon
:
'none'
,
title
:
'请输入真实姓名'
});
return
;
}
if
(
this
.
addForm
.
idCard
==
undefined
)
{
uni
.
showToast
({
icon
:
'none'
,
title
:
'请输入身份证号'
});
return
;
}
if
(
this
.
addForm
.
phone
==
undefined
)
{
uni
.
showToast
({
icon
:
'none'
,
title
:
'请输入手机号'
});
return
;
}
if
(
this
.
addForm
.
code
==
undefined
)
{
uni
.
showToast
({
icon
:
'none'
,
title
:
'请输入验证码'
});
return
;
}
if
(
this
.
addForm
.
password
==
undefined
)
{
uni
.
showToast
({
icon
:
'none'
,
title
:
'请输入密码'
});
return
;
}
if
(
this
.
addForm
.
okPassword
==
undefined
)
{
uni
.
showToast
({
icon
:
'none'
,
title
:
'请再次输入密码'
});
return
;
}
register
(
this
.
addForm
).
then
(
res
=>
{
register
(
this
.
addForm
).
then
(
res
=>
{
if
(
res
.
code
==
200
)
{
if
(
res
.
code
==
200
)
{
uni
.
showToast
({
uni
.
showToast
({
icon
:
'success'
,
icon
:
'success'
,
title
:
'注册成功'
,
title
:
'注册成功'
,
success
:
()
=>
{
success
:
()
=>
{
uni
.
setStorageSync
(
'token'
,
res
.
data
.
data
.
token
)
// uni.setStorageSync('token', res.data.data.token)
uni
.
setStorageSync
(
'user'
,
res
.
data
.
data
)
// uni.setStorageSync('user', res.data.data)
uni
.
navigateTo
({
url
:
'../login/login'
,
});
//获取
//获取
getUserByToken
().
then
(
res
=>
{
//
getUserByToken().then(res=>{
})
//
})
}
}
...
...
pages/service-apl/service-apl.vue
View file @
7c72d7a3
...
@@ -63,7 +63,13 @@
...
@@ -63,7 +63,13 @@
<!--
<image
class=
"remind-icon"
mode=
"aspectFit"
style=
""
src=
""
></image>
-->
<!--
<image
class=
"remind-icon"
mode=
"aspectFit"
style=
""
src=
""
></image>
-->
</view>
</view>
<view
class=
"flex1"
>
<view
class=
"flex1"
>
<picker
bindchange=
"cat1Change"
value=
""
range=
""
range-key=
"name"
>
<!--
<picker
bindchange=
"cat1Change"
value=
""
range=
""
range-key=
"name"
>
<view
class=
"flex-a-c"
style=
"justify-content:flex-end;"
>
<view
class=
"picker-content"
style=
''
>
公益服务
</view>
<view
class=
"trangle"
></view>
</view>
</picker>
-->
<picker
bindchange=
"cat1Change"
@
change=
"cat1Change"
:value=
"index"
:range=
"projectTypeList"
name=
"category"
>
<view
class=
"flex-a-c"
style=
"justify-content:flex-end;"
>
<view
class=
"flex-a-c"
style=
"justify-content:flex-end;"
>
<view
class=
"picker-content"
style=
''
>
公益服务
</view>
<view
class=
"picker-content"
style=
''
>
公益服务
</view>
<view
class=
"trangle"
></view>
<view
class=
"trangle"
></view>
...
@@ -208,18 +214,34 @@
...
@@ -208,18 +214,34 @@
</
template
>
</
template
>
<
script
>
<
script
>
import
{
getProjectTypeList
}
from
"@/api/login"
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
arrayHurt
:
[{
name
:
'一级'
},{
name
:
'二级'
},
{
name
:
'三级'
},
{
name
:
'四级'
}],
arrayHurt
:
[{
name
:
'一级'
},{
name
:
'二级'
},
{
name
:
'三级'
},
{
name
:
'四级'
}],
index
:
0
,
index
:
0
,
projectTypeList
:[],
//项目类型
}
}
},
},
onShow
()
{
this
.
getProjectTypeList
();
},
methods
:
{
methods
:
{
bindPickerChange
:
function
(
e
)
{
bindPickerChange
:
function
(
e
)
{
console
.
log
(
'picker发送选择改变,携带值为:'
+
e
.
detail
.
value
)
console
.
log
(
'picker发送选择改变,携带值为:'
+
e
.
detail
.
value
)
this
.
index
=
e
.
detail
.
value
this
.
index
=
e
.
detail
.
value
},
},
getProjectTypeList
(){
getProjectTypeList
().
then
(
res
=>
{
if
(
res
.
code
==
200
)
{
this
.
projectTypeList
=
res
.
data
.
data
;
console
.
log
(
projectTypeList
);
}
})
}
}
}
}
}
</
script
>
</
script
>
...
...
pages/user/user.vue
View file @
7c72d7a3
...
@@ -2,61 +2,59 @@
...
@@ -2,61 +2,59 @@
<view
class=
""
>
<view
class=
""
>
<view
class=
"center"
>
<view
class=
"center"
>
<view
class=
"logo"
@
click=
"bindLogin"
:hover-class=
"!hasLogin ? 'logo-hover' : ''"
>
<view
class=
"logo"
@
click=
"bindLogin"
:hover-class=
"!hasLogin ? 'logo-hover' : ''"
>
<!--
<image
class=
"logo-img"
:src=
"token ? userinfo.avatar : avatarUrl"
></image>
-->
<image
class=
"logo-img"
:src=
"avatarUrl"
></image>
<image
class=
"logo-img"
:src=
"avatarUrl"
></image>
<view
class=
"logo-title"
>
<view
class=
"logo-title"
>
<text
class=
"uer-name"
>
Hi,
{{
hasLogin
?
userN
ame
:
'您未登录'
}}
</text>
<text
class=
"uer-name"
>
Hi,
{{
token
?
user
.
n
ame
:
'您未登录'
}}
</text>
<text
class=
"go-login navigat-arrow"
v-if=
"!
hasLogi
n"
>

</text>
<text
class=
"go-login navigat-arrow"
v-if=
"!
toke
n"
>

</text>
</view>
</view>
</view>
</view>
<view
class=
"center-list"
v-for=
"item in navList"
:key=
"item.id"
>
<
!--
<
view
class=
"center-list"
v-for=
"item in navList"
:key=
"item.id"
>
<view
class=
"center-list-item border-bottom"
v-for=
"item2 in item.barList"
:key=
"item2.id"
@
click=
"goDetailPage(item2)"
>
<view
class=
"center-list-item border-bottom"
v-for=
"item2 in item.barList"
:key=
"item2.id"
@
click=
"goDetailPage(item2)"
>
<text
class=
"list-icon"
>

</text>
<text
class=
"list-icon"
>

</text>
<text
class=
"list-text"
>
{{
item2
.
name
}}
</text>
<text
class=
"list-text"
>
{{
item2
.
name
}}
</text>
<text
class=
"navigat-arrow"
>

</text>
<text
class=
"navigat-arrow"
>

</text>
</view>
</view>
<!--
<view
class=
"center-list-item"
>
</view>
-->
<text
class=
"list-icon"
>

</text>
<text
class=
"list-text"
>
申请服务
</text>
<view
class=
"center-list"
>
<text
class=
"navigat-arrow"
>

</text>
<view
class=
"center-list-item border-bottom"
@
click=
"comment"
>
</view>
-->
</view>
<!--
<view
class=
"center-list"
>
<view
class=
"center-list-item border-bottom"
>
<text
class=
"list-icon"
>

</text>
<text
class=
"list-icon"
>

</text>
<text
class=
"list-text"
>
帐号管理
</text>
<text
class=
"list-text"
>
满意度评价
</text>
<text
class=
"navigat-arrow"
>

</text>
<text
class=
"navigat-arrow"
>

</text>
</view>
</view>
<view
class=
"center-list-item"
>
<view
class=
"center-list-item"
@
click=
"apply"
>
<text
class=
"list-icon"
>

</text>
<text
class=
"list-icon"
>

</text>
<text
class=
"list-text"
>
新消息通知
</text>
<text
class=
"list-text"
>
申请服务
</text>
<text
class=
"navigat-arrow"
>

</text>
<text
class=
"navigat-arrow"
>

</text>
</view>
</view>
</view>
</view>
<view
class=
"center-list"
>
<view
class=
"center-list"
>
<view
class=
"center-list-item border-bottom"
>
<view
class=
"center-list-item border-bottom"
@
click=
"commentHis"
>
<text
class=
"list-icon"
>

</text>
<text
class=
"list-icon"
>

</text>
<text
class=
"list-text"
>
帮助与反馈
</text>
<text
class=
"list-text"
>
历史评价
</text>
<text
class=
"navigat-arrow"
>

</text>
<text
class=
"navigat-arrow"
>

</text>
</view>
</view>
<view
class=
"center-list-item"
>
<view
class=
"center-list-item"
@
click=
"aplHis"
>
<text
class=
"list-icon"
>

</text>
<text
class=
"list-icon"
>

</text>
<text
class=
"list-text"
>
服务
条款及隐私
</text>
<text
class=
"list-text"
>
服务
申请记录
</text>
<text
class=
"navigat-arrow"
>

</text>
<text
class=
"navigat-arrow"
>

</text>
</view>
</view>
</view>
</view>
<view
class=
"center-list"
>
<view
class=
"center-list-item"
>
<text
class=
"list-icon"
>

</text>
<view
class=
"center-list"
>
<text
class=
"list-text"
>
关于应用
</text>
<!--
<view
class=
"center-list-item"
@
click=
"logout"
v-if=
"token"
>
-->
<view
class=
"center-list-item"
@
click=
"logout"
>
<text
class=
"list-icon"
>

</text>
<text
class=
"list-text"
>
退出登录
</text>
<text
class=
"navigat-arrow"
>

</text>
<text
class=
"navigat-arrow"
>

</text>
</view>
</view>
</view>
-->
<view
class=
"btn-row"
>
<button
v-if=
"hasLogin"
class=
"primary"
type=
"primary"
@
tap=
"bindLogout"
>
退出登录
</button>
</view>
</view>
<!--
<view
class=
"btn-row"
>
<button
class=
"primary"
type=
"primary"
@
tap=
"bindLogout"
>
退出登录
</button>
</view>
-->
</view>
</view>
</view>
</view>
</
template
>
</
template
>
...
@@ -70,7 +68,7 @@
...
@@ -70,7 +68,7 @@
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
avatarUrl
:
"../../static/img/logo.png"
,
avatarUrl
:
"../../static/img/logo.png"
,
//未登录时的头像
navList
:
[
navList
:
[
{
{
id
:
1
,
id
:
1
,
...
@@ -101,70 +99,87 @@
...
@@ -101,70 +99,87 @@
],
],
},
},
]
],
user
:{},
//用户信息
}
}
},
},
computed
:
{
computed
:
{
...
mapState
([
'hasLogin'
,
'forcedLogin'
,
'userName'
])
...
mapState
([
'hasLogin'
,
'forcedLogin'
,
'userName'
])
},
},
onLoad
()
{
var
token
=
uni
.
getStorageSync
(
'token'
);
var
user
=
uni
.
getStorageSync
(
'user'
);
console
.
log
(
'token:'
,
token
);
this
.
user
=
user
;
this
.
token
=
token
;
},
onShow
()
{
// this.mylike();
},
methods
:
{
methods
:
{
...
mapMutations
([
'logout'
]),
//
...mapMutations(['logout']),
bindLogin
()
{
//
bindLogin() {
uni
.
navigateTo
({
//
uni.navigateTo({
url
:
'../login/login'
,
//
url: '../login/login',
});
//
});
},
//
},
bindLogout
()
{
//
bindLogout() {
const
loginType
=
uni
.
getStorageSync
(
'login_type'
)
//
const loginType = uni.getStorageSync('login_type')
if
(
loginType
===
'local'
)
{
//
if (loginType === 'local') {
this
.
logout
();
//
this.logout();
if
(
this
.
forcedLogin
)
{
//
if (this.forcedLogin) {
uni
.
reLaunch
({
//
uni.reLaunch({
url
:
'../login/login'
,
//
url: '../login/login',
});
//
});
}
//
}
return
//
return
}
//
}
uniCloud
.
callFunction
({
//
uniCloud.callFunction({
name
:
'user-center'
,
//
name: 'user-center',
data
:
{
//
data: {
action
:
'logout'
//
action: 'logout'
},
//
},
success
:
(
e
)
=>
{
//
success: (e) => {
console
.
log
(
'logout success'
,
e
);
//
console.log('logout success', e);
if
(
e
.
result
.
code
==
0
)
{
//
if (e.result.code == 0) {
this
.
logout
();
//
this.logout();
uni
.
removeStorageSync
(
'uniIdToken'
)
//
uni.removeStorageSync('uniIdToken')
uni
.
removeStorageSync
(
'username'
)
//
uni.removeStorageSync('username')
/**
//
/**
* 如果需要强制登录跳转回登录页面
//
* 如果需要强制登录跳转回登录页面
*/
//
*/
if
(
this
.
forcedLogin
)
{
//
if (this.forcedLogin) {
uni
.
reLaunch
({
//
uni.reLaunch({
url
:
'../login/login'
,
//
url: '../login/login',
});
//
});
}
//
}
}
else
{
//
} else {
uni
.
showModal
({
//
uni.showModal({
content
:
e
.
result
.
msg
,
//
content: e.result.msg,
showCancel
:
false
//
showCancel: false
})
//
})
console
.
log
(
'登出失败'
,
e
);
//
console.log('登出失败', e);
}
//
}
},
//
},
fail
(
e
)
{
//
fail(e) {
uni
.
showModal
({
//
uni.showModal({
content
:
JSON
.
stringify
(
e
),
//
content: JSON.stringify(e),
showCancel
:
false
//
showCancel: false
})
//
})
}
//
}
})
//
})
// },
bindLogin
()
{
uni
.
navigateTo
({
url
:
'../login/login'
,
});
},
},
// 路径跳转start
// 路径跳转start
goDetailPage
(
e
)
{
goDetailPage
(
e
)
{
...
@@ -174,8 +189,69 @@
...
@@ -174,8 +189,69 @@
url
:
path
url
:
path
});
});
}
}
,
// 路径跳转end
// 路径跳转end
// 退出登录
logout
()
{
this
.
user
=
''
;
this
.
token
=
''
;
this
.
appusername
=
''
;
uni
.
removeStorageSync
(
'user'
);
uni
.
removeStorageSync
(
'token'
);
uni
.
reLaunch
({
url
:
'../login/login'
,
});
},
// 判断是否登录
comment
()
{
if
(
!
this
.
token
)
{
uni
.
showToast
({
title
:
'请先登录'
,
icon
:
'none'
});
return
false
;
}
uni
.
navigateTo
({
url
:
'../evaluate/evaluate'
});
},
apply
()
{
if
(
!
this
.
token
)
{
uni
.
showToast
({
title
:
'请先登录'
,
icon
:
'none'
});
return
false
;
}
uni
.
navigateTo
({
url
:
'../service-apl/service-apl'
});
},
commentHis
()
{
if
(
!
this
.
token
)
{
uni
.
showToast
({
title
:
'请先登录'
,
icon
:
'none'
});
return
false
;
}
uni
.
navigateTo
({
url
:
'../evaluate-history/evaluate-history'
});
},
aplHis
()
{
if
(
!
this
.
token
)
{
uni
.
showToast
({
title
:
'请先登录'
,
icon
:
'none'
});
return
false
;
}
uni
.
navigateTo
({
url
:
'../service-apl-history/service-apl-history'
});
},
}
}
}
}
</
script
>
</
script
>
...
...
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