Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
德宏大魔王
uni-starter
提交
92cd08db
U
uni-starter
项目概览
德宏大魔王
/
uni-starter
与 Fork 源项目一致
Fork自
DCloud / uni-starter
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-starter
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
92cd08db
编写于
4月 28, 2021
作者:
DCloud_JSON
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化删除冗余文件,规范文件命名
上级
e9d33106
变更
19
隐藏空白更改
内联
并排
Showing
19 changed file
with
411 addition
and
882 deletion
+411
-882
components/login-ikonw/login-ikonw.vue
components/login-ikonw/login-ikonw.vue
+0
-87
components/uni-quick-login/uni-quick-login.vue
components/uni-quick-login/uni-quick-login.vue
+5
-5
components/uni-send-sms-code/send-sms-code.vue
components/uni-send-sms-code/send-sms-code.vue
+33
-33
js_sdk/wa-permission/permission.js
js_sdk/wa-permission/permission.js
+0
-272
main.js
main.js
+0
-6
pages.json
pages.json
+1
-21
pages/list/list.nvue
pages/list/list.nvue
+35
-48
pages/test/test copy.vue
pages/test/test copy.vue
+0
-86
pages/test/test.nvue
pages/test/test.nvue
+0
-32
pages/ucenter/login-page/phone-code/phone-code.vue
pages/ucenter/login-page/phone-code/phone-code.vue
+32
-32
pages/ucenter/login-page/pwd-retrieve/pwd-retrieve.vue
pages/ucenter/login-page/pwd-retrieve/pwd-retrieve.vue
+3
-3
pages/ucenter/settings/settings.vue
pages/ucenter/settings/settings.vue
+11
-11
pages/ucenter/ucenter.vue
pages/ucenter/ucenter.vue
+14
-5
pages/ucenter/userinfo/bind-mobile/bind-mobile.vue
pages/ucenter/userinfo/bind-mobile/bind-mobile.vue
+1
-1
uni_modules/uni-icons/components/uni-icons/uni-icons.vue
uni_modules/uni-icons/components/uni-icons/uni-icons.vue
+1
-0
uni_modules/uni-search-bar/changelog.md
uni_modules/uni-search-bar/changelog.md
+6
-0
uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.vue
...i-search-bar/components/uni-search-bar/uni-search-bar.vue
+257
-236
uni_modules/uni-search-bar/package.json
uni_modules/uni-search-bar/package.json
+4
-2
uni_modules/uni-search-bar/readme.md
uni_modules/uni-search-bar/readme.md
+8
-2
未找到文件。
components/login-ikonw/login-ikonw.vue
已删除
100644 → 0
浏览文件 @
e9d33106
<
template
>
<view
class=
"login-iknow-wrap"
>
<text
class=
"text-sub"
v-for=
"(t, i) in innerText"
:key=
"i"
:class=
"t.to?'link-color':''"
@
click=
"clickLink(t)"
>
{{
t
.
text
||
t
}}
</text>
</view>
</
template
>
<
script
>
/**
* text 政策描述文字
* link 高亮关键字及其链接
*/
export
default
{
name
:
"
login-ikonw
"
,
props
:
{
text
:
{
type
:
String
,
default
:
''
},
link
:
{
type
:
Array
,
default
:
()
=>
[]
}
},
data
()
{
return
{
};
},
computed
:
{
innerText
()
{
if
(
this
.
link
.
length
==
0
)
return
this
.
text
;
let
textList
=
String
(
this
.
text
);
this
.
link
.
forEach
(
item
=>
{
textList
=
textList
.
replace
(
item
.
text
,
'
$
'
);
});
textList
=
textList
.
split
(
''
);
let
list
=
[],
linkList
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
link
));
textList
.
forEach
((
text
,
tIndex
)
=>
{
if
(
text
==
'
$
'
)
{
let
currLink
=
linkList
.
shift
();
currLink
.
text
.
split
(
''
).
forEach
(
item
=>
{
list
.
push
({
text
:
item
,
to
:
currLink
.
to
});
})
}
else
{
list
.
push
({
text
})
}
});
return
list
;
}
},
methods
:
{
/**
* 点击跳转到协议页面
* @param {Object} link
*/
clickLink
(
link
)
{
uni
.
navigateTo
({
url
:
link
.
to
})
}
}
}
</
script
>
<
style
scoped
>
.login-iknow-wrap
{
/* #ifndef APP-NVUE */
display
:
flex
;
/* #endif */
flex-direction
:
row
;
flex-wrap
:
wrap
;
}
.text-sub
{
color
:
#8a8f8b
;
font-size
:
26
rpx
;
}
.link-color
{
color
:
#04498c
;
}
</
style
>
components/uni-quick-login/uni-quick-login.vue
浏览文件 @
92cd08db
<
template
>
<view
class=
"quick-login-box"
>
<view
class=
"item"
v-for=
"(item,index) in servicesList"
:key=
"index"
@
click=
"item.path?to(item.path):login(item.id,false)"
>
@
click=
"item.path?to(item.path):login
_before
(item.id,false)"
>
<image
class=
"logo"
:src=
"item.logo"
mode=
"widthFix"
></image>
<text
class=
"login-title"
>
{{
item
.
text
}}
</text>
</view>
...
...
@@ -136,7 +136,7 @@
})
}
},
login
(
type
,
navigateBack
=
true
)
{
login
_before
(
type
,
navigateBack
=
true
)
{
console
.
log
(
arguments
);
console
.
log
(
'
services
'
,
services
);
let
oauthService
=
this
.
oauthServices
.
find
((
service
)
=>
service
.
id
==
type
)
...
...
@@ -149,7 +149,7 @@
code
})
=>
{
console
.
log
(
code
);
this
.
quickL
ogin
({
this
.
l
ogin
({
code
},
type
)
},
...
...
@@ -171,7 +171,7 @@
})
Object
.
assign
(
e
.
authResult
,
res
.
userInfo
)
}
this
.
quickL
ogin
(
e
.
authResult
,
type
)
this
.
l
ogin
(
e
.
authResult
,
type
)
},
fail
:
(
err
)
=>
{
uni
.
hideLoading
()
...
...
@@ -209,7 +209,7 @@
}
})
},
quickL
ogin
(
params
,
type
)
{
//联网验证登陆
l
ogin
(
params
,
type
)
{
//联网验证登陆
console
.
log
(
params
,
type
);
this
.
request
(
'
user-center/login_by_
'
+
type
,
params
,
result
=>
{
console
.
log
(
result
);
...
...
components/send-sms-code/send-sms-code.vue
→
components/
uni-
send-sms-code/send-sms-code.vue
浏览文件 @
92cd08db
...
...
@@ -20,7 +20,7 @@
}
}
export
default
{
name
:
"
send-sms-code
"
,
name
:
"
uni-
send-sms-code
"
,
props
:
{
/**
* 倒计时时长 s
...
...
@@ -35,15 +35,15 @@
phone
:
{
type
:
[
String
,
Number
],
default
:
''
},
/*
验证码类型,用于防止不同功能的验证码混用,目前支持的类型login登录、register注册、bind绑定手机、unbind解绑手机
*/
codeType
:{
type
:
String
,
default
(){
return
'
login
'
}
},
/*
验证码类型,用于防止不同功能的验证码混用,目前支持的类型login登录、register注册、bind绑定手机、unbind解绑手机
*/
codeType
:{
type
:
String
,
default
(){
return
'
login
'
}
}
},
data
()
{
...
...
@@ -68,28 +68,28 @@
this
.
sendMsg
();
})
},
sendMsg
()
{
let
reg_phone
=
/^1
\d{10}
$/
;
if
(
!
reg_phone
.
test
(
this
.
phone
))
return
uni
.
showToast
({
title
:
'
手机号格式错误
'
,
icon
:
'
none
'
});
this
.
request
(
'
user-center/sendSmsCode
'
,
sendMsg
()
{
let
reg_phone
=
/^1
\d{10}
$/
;
if
(
!
reg_phone
.
test
(
this
.
phone
))
return
uni
.
showToast
({
title
:
'
手机号格式错误
'
,
icon
:
'
none
'
});
this
.
request
(
'
user-center/sendSmsCode
'
,
{
"
mobile
"
:
this
.
phone
,
"
type
"
:
this
.
codeType
},
result
=>
{
console
.
log
(
result
);
uni
.
showToast
({
title
:
"
短信验证码发送成功
"
,
icon
:
'
none
'
});
this
.
reverseNumber
=
Number
(
this
.
count
);
this
.
getCode
();
this
.
$emit
(
'
getCode
'
);
}
)
},
result
=>
{
console
.
log
(
result
);
uni
.
showToast
({
title
:
"
短信验证码发送成功
"
,
icon
:
'
none
'
});
this
.
reverseNumber
=
Number
(
this
.
count
);
this
.
getCode
();
this
.
$emit
(
'
getCode
'
);
}
)
},
getCode
()
{
if
(
this
.
reverseNumber
==
0
)
{
...
...
@@ -116,11 +116,11 @@
justify-content
:
center
;
align-items
:
center
;
}
.inner-text
{
font-size
:
28
rpx
;
color
:
#AAAAAA
;
.inner-text
{
font-size
:
28
rpx
;
color
:
#AAAAAA
;
}
.inner-text-active
{
color
:
#007aff
;
}
</
style
>
</
style
>
js_sdk/wa-permission/permission.js
已删除
100644 → 0
浏览文件 @
e9d33106
/**
* 本模块封装了Android、iOS的应用权限判断、打开应用权限设置界面、以及位置系统服务是否开启
*/
var
isIos
// #ifdef APP-PLUS
isIos
=
(
plus
.
os
.
name
==
"
iOS
"
)
// #endif
// 判断推送权限是否开启
function
judgeIosPermissionPush
()
{
var
result
=
false
;
var
UIApplication
=
plus
.
ios
.
import
(
"
UIApplication
"
);
var
app
=
UIApplication
.
sharedApplication
();
var
enabledTypes
=
0
;
if
(
app
.
currentUserNotificationSettings
)
{
var
settings
=
app
.
currentUserNotificationSettings
();
enabledTypes
=
settings
.
plusGetAttribute
(
"
types
"
);
console
.
log
(
"
enabledTypes1:
"
+
enabledTypes
);
if
(
enabledTypes
==
0
)
{
console
.
log
(
"
推送权限没有开启
"
);
}
else
{
result
=
true
;
console
.
log
(
"
已经开启推送功能!
"
)
}
plus
.
ios
.
deleteObject
(
settings
);
}
else
{
enabledTypes
=
app
.
enabledRemoteNotificationTypes
();
if
(
enabledTypes
==
0
)
{
console
.
log
(
"
推送权限没有开启!
"
);
}
else
{
result
=
true
;
console
.
log
(
"
已经开启推送功能!
"
)
}
console
.
log
(
"
enabledTypes2:
"
+
enabledTypes
);
}
plus
.
ios
.
deleteObject
(
app
);
plus
.
ios
.
deleteObject
(
UIApplication
);
return
result
;
}
// 判断定位权限是否开启
function
judgeIosPermissionLocation
()
{
var
result
=
false
;
var
cllocationManger
=
plus
.
ios
.
import
(
"
CLLocationManager
"
);
var
status
=
cllocationManger
.
authorizationStatus
();
result
=
(
status
!=
2
)
console
.
log
(
"
定位权限开启:
"
+
result
);
// 以下代码判断了手机设备的定位是否关闭,推荐另行使用方法 checkSystemEnableLocation
/* var enable = cllocationManger.locationServicesEnabled();
var status = cllocationManger.authorizationStatus();
console.log("enable:" + enable);
console.log("status:" + status);
if (enable && status != 2) {
result = true;
console.log("手机定位服务已开启且已授予定位权限");
} else {
console.log("手机系统的定位没有打开或未给予定位权限");
} */
plus
.
ios
.
deleteObject
(
cllocationManger
);
return
result
;
}
// 判断麦克风权限是否开启
function
judgeIosPermissionRecord
()
{
var
result
=
false
;
var
avaudiosession
=
plus
.
ios
.
import
(
"
AVAudioSession
"
);
var
avaudio
=
avaudiosession
.
sharedInstance
();
var
permissionStatus
=
avaudio
.
recordPermission
();
console
.
log
(
"
permissionStatus:
"
+
permissionStatus
);
if
(
permissionStatus
==
1684369017
||
permissionStatus
==
1970168948
)
{
console
.
log
(
"
麦克风权限没有开启
"
);
}
else
{
result
=
true
;
console
.
log
(
"
麦克风权限已经开启
"
);
}
plus
.
ios
.
deleteObject
(
avaudiosession
);
return
result
;
}
// 判断相机权限是否开启
function
judgeIosPermissionCamera
()
{
var
result
=
false
;
var
AVCaptureDevice
=
plus
.
ios
.
import
(
"
AVCaptureDevice
"
);
var
authStatus
=
AVCaptureDevice
.
authorizationStatusForMediaType
(
'
vide
'
);
console
.
log
(
"
authStatus:
"
+
authStatus
);
if
(
authStatus
==
3
)
{
result
=
true
;
console
.
log
(
"
相机权限已经开启
"
);
}
else
{
console
.
log
(
"
相机权限没有开启
"
);
}
plus
.
ios
.
deleteObject
(
AVCaptureDevice
);
return
result
;
}
// 判断相册权限是否开启
function
judgeIosPermissionPhotoLibrary
()
{
var
result
=
false
;
var
PHPhotoLibrary
=
plus
.
ios
.
import
(
"
PHPhotoLibrary
"
);
var
authStatus
=
PHPhotoLibrary
.
authorizationStatus
();
console
.
log
(
"
authStatus:
"
+
authStatus
);
if
(
authStatus
==
3
)
{
result
=
true
;
console
.
log
(
"
相册权限已经开启
"
);
}
else
{
console
.
log
(
"
相册权限没有开启
"
);
}
plus
.
ios
.
deleteObject
(
PHPhotoLibrary
);
return
result
;
}
// 判断通讯录权限是否开启
function
judgeIosPermissionContact
()
{
var
result
=
false
;
var
CNContactStore
=
plus
.
ios
.
import
(
"
CNContactStore
"
);
var
cnAuthStatus
=
CNContactStore
.
authorizationStatusForEntityType
(
0
);
if
(
cnAuthStatus
==
3
)
{
result
=
true
;
console
.
log
(
"
通讯录权限已经开启
"
);
}
else
{
console
.
log
(
"
通讯录权限没有开启
"
);
}
plus
.
ios
.
deleteObject
(
CNContactStore
);
return
result
;
}
// 判断日历权限是否开启
function
judgeIosPermissionCalendar
()
{
var
result
=
false
;
var
EKEventStore
=
plus
.
ios
.
import
(
"
EKEventStore
"
);
var
ekAuthStatus
=
EKEventStore
.
authorizationStatusForEntityType
(
0
);
if
(
ekAuthStatus
==
3
)
{
result
=
true
;
console
.
log
(
"
日历权限已经开启
"
);
}
else
{
console
.
log
(
"
日历权限没有开启
"
);
}
plus
.
ios
.
deleteObject
(
EKEventStore
);
return
result
;
}
// 判断备忘录权限是否开启
function
judgeIosPermissionMemo
()
{
var
result
=
false
;
var
EKEventStore
=
plus
.
ios
.
import
(
"
EKEventStore
"
);
var
ekAuthStatus
=
EKEventStore
.
authorizationStatusForEntityType
(
1
);
if
(
ekAuthStatus
==
3
)
{
result
=
true
;
console
.
log
(
"
备忘录权限已经开启
"
);
}
else
{
console
.
log
(
"
备忘录权限没有开启
"
);
}
plus
.
ios
.
deleteObject
(
EKEventStore
);
return
result
;
}
// Android权限查询
function
requestAndroidPermission
(
permissionID
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
plus
.
android
.
requestPermissions
(
[
permissionID
],
// 理论上支持多个权限同时查询,但实际上本函数封装只处理了一个权限的情况。有需要的可自行扩展封装
function
(
resultObj
)
{
var
result
=
0
;
for
(
var
i
=
0
;
i
<
resultObj
.
granted
.
length
;
i
++
)
{
var
grantedPermission
=
resultObj
.
granted
[
i
];
console
.
log
(
'
已获取的权限:
'
+
grantedPermission
);
result
=
1
}
for
(
var
i
=
0
;
i
<
resultObj
.
deniedPresent
.
length
;
i
++
)
{
var
deniedPresentPermission
=
resultObj
.
deniedPresent
[
i
];
console
.
log
(
'
拒绝本次申请的权限:
'
+
deniedPresentPermission
);
result
=
0
}
for
(
var
i
=
0
;
i
<
resultObj
.
deniedAlways
.
length
;
i
++
)
{
var
deniedAlwaysPermission
=
resultObj
.
deniedAlways
[
i
];
console
.
log
(
'
永久拒绝申请的权限:
'
+
deniedAlwaysPermission
);
result
=
-
1
}
resolve
(
result
);
// 若所需权限被拒绝,则打开APP设置界面,可以在APP设置界面打开相应权限
// if (result != 1) {
// gotoAppPermissionSetting()
// }
},
function
(
error
)
{
console
.
log
(
'
申请权限错误:
'
+
error
.
code
+
"
=
"
+
error
.
message
);
resolve
({
code
:
error
.
code
,
message
:
error
.
message
});
}
);
});
}
// 使用一个方法,根据参数判断权限
function
judgeIosPermission
(
permissionID
)
{
if
(
permissionID
==
"
location
"
)
{
return
judgeIosPermissionLocation
()
}
else
if
(
permissionID
==
"
camera
"
)
{
return
judgeIosPermissionCamera
()
}
else
if
(
permissionID
==
"
photoLibrary
"
)
{
return
judgeIosPermissionPhotoLibrary
()
}
else
if
(
permissionID
==
"
record
"
)
{
return
judgeIosPermissionRecord
()
}
else
if
(
permissionID
==
"
push
"
)
{
return
judgeIosPermissionPush
()
}
else
if
(
permissionID
==
"
contact
"
)
{
return
judgeIosPermissionContact
()
}
else
if
(
permissionID
==
"
calendar
"
)
{
return
judgeIosPermissionCalendar
()
}
else
if
(
permissionID
==
"
memo
"
)
{
return
judgeIosPermissionMemo
()
}
return
false
;
}
// 跳转到**应用**的权限页面
function
gotoAppPermissionSetting
()
{
if
(
isIos
)
{
var
UIApplication
=
plus
.
ios
.
import
(
"
UIApplication
"
);
var
application2
=
UIApplication
.
sharedApplication
();
var
NSURL2
=
plus
.
ios
.
import
(
"
NSURL
"
);
// var setting2 = NSURL2.URLWithString("prefs:root=LOCATION_SERVICES");
var
setting2
=
NSURL2
.
URLWithString
(
"
app-settings:
"
);
application2
.
openURL
(
setting2
);
plus
.
ios
.
deleteObject
(
setting2
);
plus
.
ios
.
deleteObject
(
NSURL2
);
plus
.
ios
.
deleteObject
(
application2
);
}
else
{
// console.log(plus.device.vendor);
var
Intent
=
plus
.
android
.
importClass
(
"
android.content.Intent
"
);
var
Settings
=
plus
.
android
.
importClass
(
"
android.provider.Settings
"
);
var
Uri
=
plus
.
android
.
importClass
(
"
android.net.Uri
"
);
var
mainActivity
=
plus
.
android
.
runtimeMainActivity
();
var
intent
=
new
Intent
();
intent
.
setAction
(
Settings
.
ACTION_APPLICATION_DETAILS_SETTINGS
);
var
uri
=
Uri
.
fromParts
(
"
package
"
,
mainActivity
.
getPackageName
(),
null
);
intent
.
setData
(
uri
);
mainActivity
.
startActivity
(
intent
);
}
}
// 检查系统的设备服务是否开启
// var checkSystemEnableLocation = async function () {
function
checkSystemEnableLocation
()
{
if
(
isIos
)
{
var
result
=
false
;
var
cllocationManger
=
plus
.
ios
.
import
(
"
CLLocationManager
"
);
var
result
=
cllocationManger
.
locationServicesEnabled
();
console
.
log
(
"
系统定位开启:
"
+
result
);
plus
.
ios
.
deleteObject
(
cllocationManger
);
return
result
;
}
else
{
var
context
=
plus
.
android
.
importClass
(
"
android.content.Context
"
);
var
locationManager
=
plus
.
android
.
importClass
(
"
android.location.LocationManager
"
);
var
main
=
plus
.
android
.
runtimeMainActivity
();
var
mainSvr
=
main
.
getSystemService
(
context
.
LOCATION_SERVICE
);
var
result
=
mainSvr
.
isProviderEnabled
(
locationManager
.
GPS_PROVIDER
);
console
.
log
(
"
系统定位开启:
"
+
result
);
return
result
}
}
module
.
exports
=
{
judgeIosPermission
:
judgeIosPermission
,
requestAndroidPermission
:
requestAndroidPermission
,
checkSystemEnableLocation
:
checkSystemEnableLocation
,
gotoAppPermissionSetting
:
gotoAppPermissionSetting
}
main.js
浏览文件 @
92cd08db
...
...
@@ -9,12 +9,6 @@ Vue.prototype.request = request
//openApp();
App
.
mpType
=
'
app
'
import
nullComponents
from
'
@/components/null/null.vue
'
Vue
.
component
(
'
cell
'
,
nullComponents
);
Vue
.
component
(
'
refresh
'
,
nullComponents
);
Vue
.
component
(
'
refreshBox
'
,
nullComponents
);
const
app
=
new
Vue
({
...
App
,
store
...
...
pages.json
浏览文件 @
92cd08db
...
...
@@ -4,26 +4,9 @@
"path"
:
"pages/list/list"
,
"style"
:
{
"navigationStyle"
:
"custom"
,
"enablePullDownRefresh"
:
true
,
"app-plus"
:{
//
"titleNView"
:{
/*排除了H
5
*/
//
"searchInput"
:{
//
"placeholder"
:
"请输入搜索的内容"
,
//
"backgroundColor"
:
"#efefef"
,
//
"disabled"
:
true
,
//
"borderRadius"
:
"30px"
//
}
//
}
}
"enablePullDownRefresh"
:
true
}
},
{
"path"
:
"pages/test/test"
,
"style"
:
{
"navigationBarTitleText"
:
"测试页面"
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"pages/grid/grid"
,
"style"
:
{
...
...
@@ -218,9 +201,6 @@
{
"path"
:
"pages/ucenter/login-page/index/index"
},
{
"path"
:
"pages/test/test"
},
{
"path"
:
"pages/ucenter/settings/settings"
}
...
...
pages/list/list.nvue
浏览文件 @
92cd08db
...
...
@@ -4,18 +4,12 @@
<uni-nav-bar :border="false"></uni-nav-bar>
<!-- #endif -->
<!-- 搜索功能 -->
<uni-search-bar class="uni-search-box" v-model="keyword" ref="searchBar" radius="100"
@click.native="searchClick" cancelButton="none" disabled />
<unicloud-db ref='udb' v-slot:default="{data,pagination,hasMore, loading, error, options}" @load="handleLoad" @error="onqueryerror"
:where="where" collection="opendb-news-articles,uni-id-users"
<uni-search-bar @click="searchClick" class="uni-search-box" v-model="keyword" ref="searchBar" radius="100" cancelButton="none" disabled/>
<unicloud-db ref='udb' v-slot:default="{data,pagination,hasMore, loading, error, options}" @error="onqueryerror"
:where="where" collection="opendb-news-articles,uni-id-users" :page-size="10"
field="avatar,title,last_modify_date,user_id{username}">
<!-- 基于 uni-list 的页面布局 -->
<uni-list class="uni-list" :border="false" :bounce="true" :alwaysScrollableVertical="true"
<!-- #ifdef APP-NVUE -->
:style='{height:listHight+"px"}'
<!-- #endif -->
>
<uni-list class="uni-list" :border="false" :bounce="true" :alwaysScrollableVertical="true" :style="{height:listHight}">
<cell v-if="error">
<template slot="body">
<!-- 设置网络 -->
...
...
@@ -34,7 +28,7 @@
</template>
</cell>
<uni-list-item :to="'./detail?id='+item._id+'&title='+item.title"
v-for="(item,index) in
testData(data)
" :key="index">
v-for="(item,index) in
data
" :key="index">
<!-- 通过header插槽定义列表左侧图片 -->
<template v-slot:header>
<image class="avatar" :src="item.avatar" mode="aspectFill"></image>
...
...
@@ -50,13 +44,13 @@
</view>
</uni-list-item>
<!-- 存在下一页数据
,且不在加载中
通过 loadMore 组件实现上拉加载效果,如需自定义显示内容,可参考:https://ext.dcloud.net.cn/plugin?id=29 -->
<template v-if="!loading">
<!-- 存在下一页数据
&& 不是正在加载中 && 已经满一页;
通过 loadMore 组件实现上拉加载效果,如需自定义显示内容,可参考:https://ext.dcloud.net.cn/plugin?id=29 -->
<template v-if="!loading
&&data.length>10
">
<cell v-if="hasMore">
<uni-load-more
:status="options.status
"></uni-load-more>
<uni-load-more
status="more
"></uni-load-more>
</cell>
<cell v-else>
<
text class="noMore">- 没有更多数据了 -</text
>
<cell v-else>
<
uni-load-more status="noMore"></uni-load-more
>
</cell>
</template>
</template>
...
...
@@ -75,9 +69,23 @@
refreshState: 0,
listHight: 0
}
},
watch: {
keyword(keyword, oldValue) {
if(keyword){
this.where = `/${keyword}/.test(title)`;
}else{
this.where = '';
}
}
},
onReady() {
this.listHight = uni.getSystemInfoSync().windowHeight - uni.getSystemInfoSync().statusBarHeight - 65
// #ifdef APP-NVUE
this.listHight = uni.getSystemInfoSync().windowHeight - 96 + 'px'
// #endif
// #ifndef APP-NVUE
this.listHight = 'auto'
// #endif
cdbRef = this.$refs.udb
console.log(cdbRef);
},
...
...
@@ -97,28 +105,18 @@
}
},
methods: {
testData(data) { //复制同一个数据多遍方便测试,正式项目中不要带
var testData = []
for (let i = 0; i < 10; i++) {
testData.push(...data)
}
return testData
},
handleLoad(data, ended, pagination) {
// `data` 当前查询结果 `ended` 是否有更多数据 `pagination` 分页信息 HBuilderX 3.1.5+ 支持
console.log(9527, data, ended, pagination);
//上拉加载成功
},
searchClick() {
// testData(data) { //复制同一个数据多遍方便测试,正式项目中不要带
// var testData = []
// for (let i = 0; i < 10; i++) {
// testData.push(...data)
// }
// return testData
// },
searchClick(e) { //点击搜索框
uni.hideKeyboard();
uni.navigateTo({
url: '/pages/list/search/search',
animationType: 'fade-in',
events: {
acceptDataFromOpenedPage(e) {
console.log(e);
}
}
animationType: 'fade-in'
});
},
retry(){
...
...
@@ -189,8 +187,7 @@
/* #ifndef APP-PLUS */
z-index: 9;
/* #endif */
}
}
.show-refresh-tip {
transform: translateY(0);
height: 40px;
...
...
@@ -214,15 +211,5 @@
width: 750rpx;
text-align: center;
}
.uni-list {}
.noMore {
width: 750rpx;
text-align: center;
color: #6E6E6E;
font-size: 26rpx;
height: 55px;
line-height: 55px;
}
</style>
pages/test/test copy.vue
已删除
100644 → 0
浏览文件 @
e9d33106
<
template
>
<view>
<!--
<button
type=
"default"
@
click=
"openSystemSetting('ACTION_BLUETOOTH_SETTINGS')"
>
设置蓝牙
</button>
<button
type=
"default"
@
click=
"openSystemSetting('ACTION_LOCALE_SETTINGS')"
>
设置语言
</button>
<button
type=
"default"
@
click=
"openSystemSetting('ACTION_LOCATION_SOURCE_SETTINGS')"
>
设置gps
</button>
<button
type=
"default"
@
click=
"openSystemSetting('ACTION_WIFI_SETTINGS')"
>
设置wifi
</button>
<button
type=
"default"
@
click=
"openSystemSetting('ACTION_DATA_ROAMING_SETTINGS')"
>
数据网络
</button>
<text>
应用相关权限
</text>
<button
type=
"default"
@
click=
"openAppPermissionSetting"
>
打开
</button>
<button
type=
"default"
@
click=
"iosSetting"
>
iosSetting
</button>
-->
<button
type=
"default"
@
click=
"open=1"
>
打开
</button>
<web-view
v-if=
"open"
style=
"height: 1px;"
src=
"https://ur.alipay.com/2tZMWI"
></web-view>
</view>
</
template
>
<
script
>
export
default
{
data
()
{
return
{
open
:
0
}
},
onLoad
()
{
// 当某个权限调用失败
// 1.先检测手机的该模块是否打开
// 2.检测当前应用是否被授权了该模块对应的权限
// 提示,并点击跳转到设置
// plus.runtime.openURL('https://ur.alipay.com/2tZMWI',e=>{
// console.log(e);
// })
},
methods
:
{
openCamera
(){
uni
.
chooseImage
({
sourceType
:
[
"
camera
"
,
"
album
"
],
complete
:
(
e
)
=>
{
console
.
log
(
e
);
}
})
},
iosSetting
()
{
plus
.
runtime
.
launchApplication
({
action
:
'
App-Prefs:root=WIFI
'
},
function
(
e
)
{
//console.log(JSON.stringify(e));
});
//WIFI
},
openSystemSetting
(
type
)
{
var
main
=
plus
.
android
.
runtimeMainActivity
();
//获取activity
var
Intent
=
plus
.
android
.
importClass
(
'
android.content.Intent
'
);
var
Settings
=
plus
.
android
.
importClass
(
'
android.provider.Settings
'
);
var
intent
=
new
Intent
(
Settings
[
type
]);
//可设置表中所有Action字段
main
.
startActivity
(
intent
);
},
openAppPermissionSetting
()
{
// 跳转到**应用**的权限页面
if
(
uni
.
getSystemInfoSync
().
platform
==
"
ios
"
)
{
var
UIApplication
=
plus
.
ios
.
import
(
"
UIApplication
"
);
var
application2
=
UIApplication
.
sharedApplication
();
var
NSURL2
=
plus
.
ios
.
import
(
"
NSURL
"
);
// var setting2 = NSURL2.URLWithString("prefs:root=LOCATION_SERVICES");
var
setting2
=
NSURL2
.
URLWithString
(
"
app-settings:
"
);
application2
.
openURL
(
setting2
);
plus
.
ios
.
deleteObject
(
setting2
);
plus
.
ios
.
deleteObject
(
NSURL2
);
plus
.
ios
.
deleteObject
(
application2
);
}
else
{
// console.log(plus.device.vendor);
var
Intent
=
plus
.
android
.
importClass
(
"
android.content.Intent
"
);
var
Settings
=
plus
.
android
.
importClass
(
"
android.provider.Settings
"
);
var
Uri
=
plus
.
android
.
importClass
(
"
android.net.Uri
"
);
var
mainActivity
=
plus
.
android
.
runtimeMainActivity
();
var
intent
=
new
Intent
();
intent
.
setAction
(
Settings
.
ACTION_APPLICATION_DETAILS_SETTINGS
);
var
uri
=
Uri
.
fromParts
(
"
package
"
,
mainActivity
.
getPackageName
(),
null
);
intent
.
setData
(
uri
);
mainActivity
.
startActivity
(
intent
);
}
},
}
}
</
script
>
<
style
>
</
style
>
pages/test/test.nvue
已删除
100644 → 0
浏览文件 @
e9d33106
<template>
<view>
<cdb-list v-slot="{data}" :reduce-height="0" collection="opendb-feedback" :page-size="3" class="j-list">
<cell v-for="(rows,index) in data" :key="index">
<view style="flex-direction: row;">
<view v-for="item in rows" :key="item._id" class="item">我是内容{{item}}-{{index}}</view>
</view>
</cell>
</cdb-list>
</view>
</template>
<script>
export default {
data() {
return {}
},
onLoad() {
},
methods: {}
}
</script>
<style>
.item {
height: 500px;
width: 750rpx;
background-color: #007AFF;
margin-bottom: 5px;
}
</style>
pages/ucenter/login-page/phone-code/phone-code.vue
浏览文件 @
92cd08db
<
template
>
<view
class=
"content"
>
<!-- 顶部文字 -->
<text
class=
"tit"
>
请输入验证码
</text>
<text
class=
"tip"
>
{{
tipText
}}
</text>
<!-- 登录框 (选择手机号所属国家和地区需要另行实现) -->
<uni-easyinput
type=
"number"
class=
"easyinput"
:inputBorder=
"false"
v-model=
"code"
maxlength=
"6"
placeholder=
"请输入验证码"
>
<template
slot=
"right"
>
<
send-sms-code
:phone=
"phone"
ref=
"sendSmsCode"
></send-sms-code>
</
template
>
</uni-easyinput>
<button
class=
"send-btn"
:disabled=
"!canSubmit"
:type=
"canSubmit?'primary':'default'"
@
click=
"submit"
>
登录
</button>
</uni-forms>
<uni-quick-login></uni-quick-login>
<view
class=
"content"
>
<!-- 顶部文字 -->
<text
class=
"tit"
>
请输入验证码
</text>
<text
class=
"tip"
>
{{
tipText
}}
</text>
<!-- 登录框 (选择手机号所属国家和地区需要另行实现) -->
<uni-easyinput
type=
"number"
class=
"easyinput"
:inputBorder=
"false"
v-model=
"code"
maxlength=
"6"
placeholder=
"请输入验证码"
>
<template
slot=
"right"
>
<
uni-send-sms-code
:phone=
"phone"
ref=
"sendSmsCode"
></uni-send-sms-code>
</
template
>
</uni-easyinput>
<button
class=
"send-btn"
:disabled=
"!canSubmit"
:type=
"canSubmit?'primary':'default'"
@
click=
"submit"
>
登录
</button>
</uni-forms>
<uni-quick-login></uni-quick-login>
</view>
</template>
<
script
>
<
script
>
import
mixin
from
'
../common/login-page.mixin.js
'
;
export
default
{
export
default
{
mixins
:[
mixin
],
data
()
{
return
{
code
:
''
,
phone
:
''
code
:
''
,
phone
:
''
}
},
computed
:
{
tipText
()
{
return
`验证码已通过短信发送至
${
this
.
phone
}
。`
;
},
canSubmit
(){
return
this
.
code
.
length
==
6
;
canSubmit
(){
return
this
.
code
.
length
==
6
;
}
},
onLoad
({
phoneNumber
,
phoneArea
})
{
...
...
@@ -40,17 +40,17 @@
onReady
()
{
this
.
$refs
.
sendSmsCode
.
start
();
},
methods
:
{
submit
(){
//完成并提交
this
.
request
(
'
user-center/loginBySms
'
,
{
"
mobile
"
:
this
.
phone
,
"
code
"
:
this
.
code
},
e
=>
{
console
.
log
(
e
);
this
.
loginSuccess
(
e
)
}
methods
:
{
submit
(){
//完成并提交
this
.
request
(
'
user-center/loginBySms
'
,
{
"
mobile
"
:
this
.
phone
,
"
code
"
:
this
.
code
},
e
=>
{
console
.
log
(
e
);
this
.
loginSuccess
(
e
)
}
)
}
}
...
...
pages/ucenter/login-page/pwd-retrieve/pwd-retrieve.vue
浏览文件 @
92cd08db
...
...
@@ -2,7 +2,7 @@
<view
class=
"content"
>
<!-- 顶部文字 -->
<text
class=
"title"
>
重置密码
</text>
<
login-ikonw
v-show=
"isPhone"
class=
"login-iknow"
:text=
"tipText"
></login-ikonw
>
<
text
v-show=
"isPhone"
class=
"login-iknow"
>
{{
tipText
}}
</text
>
<!-- 登录框 (选择手机号所属国家和地区需要另行实现) -->
<uni-forms
ref=
"form"
:value=
"formData"
:rules=
"rules"
>
<uni-forms-item
name=
"phone"
>
...
...
@@ -14,7 +14,7 @@
<uni-easyinput
:focus=
"formData.phone.length!=0"
type=
"number"
class=
"easyinput"
:inputBorder=
"false"
v-model=
"formData.code"
maxlength=
"6"
placeholder=
"请输入验证码"
>
<template
slot=
"right"
>
<
send-sms-code
ref=
"shortCode"
:phone=
"formData.phone"
></
send-sms-code>
<
uni-send-sms-code
ref=
"shortCode"
:phone=
"formData.phone"
></uni-
send-sms-code>
</
template
>
</uni-easyinput>
</uni-forms-item>
...
...
@@ -166,4 +166,4 @@
.content-top-title
{
margin-bottom
:
6px
;
}
</
style
>
</
style
>
pages/ucenter/settings/settings.vue
浏览文件 @
92cd08db
...
...
@@ -11,8 +11,8 @@
<uni-list-item
title=
"清理缓存"
@
click=
"clearTmp"
link
></uni-list-item>
<uni-list-item
v-if=
"pushIsOn != 'wait'"
@
click.native=
"openSetting()"
title=
"推送功能"
showSwitch
:switchChecked=
"pushIsOn"
></uni-list-item>
<!-- #endif -->
<uni-list-item
v-if=
"supportMode.includes('fingerPrint')"
title=
"指纹解锁"
@
click=
"startSoterAuthentication('fingerPrint'
,'指纹解锁'
)"
link
></uni-list-item>
<uni-list-item
v-if=
"supportMode.includes('facial')"
title=
"人脸解锁"
@
click=
"startSoterAuthentication('facial'
,'人脸解锁'
)"
link
></uni-list-item>
<uni-list-item
v-if=
"supportMode.includes('fingerPrint')"
title=
"指纹解锁"
@
click=
"startSoterAuthentication('fingerPrint')"
link
></uni-list-item>
<uni-list-item
v-if=
"supportMode.includes('facial')"
title=
"人脸解锁"
@
click=
"startSoterAuthentication('facial')"
link
></uni-list-item>
</uni-list>
<!-- 退出/登陆 按钮 -->
...
...
@@ -78,8 +78,7 @@
changePwd
()
{
uni
.
navigateTo
({
url
:
'
/pages/ucenter/login-page/pwd-retrieve/pwd-retrieve?phoneNumber=
'
+
(
this
.
userInfo
&&
this
.
userInfo
.
phone
?
this
.
userInfo
.
phone
:
''
)
+
'
&phoneArea=+86
'
,
+
(
this
.
userInfo
&&
this
.
userInfo
.
phone
?
this
.
userInfo
.
phone
:
''
),
fail
:
err
=>
{
console
.
log
(
err
);
}
...
...
@@ -88,13 +87,14 @@
/**
* 开始生物认证
*/
startSoterAuthentication
(
requestAuthMode
,
title
)
{
startSoterAuthentication
(
checkAuthMode
)
{
let
title
=
{
"
fingerPrint
"
:
"
指纹解锁
"
,
"
facial
"
:
"
人脸解锁
"
}[
checkAuthMode
]
// 检查是否开启认证
this
.
checkIsSoterEnrolledInDevice
({
name
:
requestAuthMode
,
title
:
title
})
this
.
checkIsSoterEnrolledInDevice
({
checkAuthMode
,
title
})
.
then
(()
=>
{
// 开始认证
uni
.
startSoterAuthentication
({
request
AuthModes
:
[
requestAuthMode
],
check
AuthModes
:
[
requestAuthMode
],
challenge
:
'
123456
'
,
// 微信端挑战因子
authContent
:
`请用
${
title
}
`
,
success
:
(
res
)
=>
{
...
...
@@ -126,23 +126,23 @@
})
})
},
checkIsSoterEnrolledInDevice
(
mode
)
{
checkIsSoterEnrolledInDevice
(
{
checkAuthMode
,
title
}
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
uni
.
checkIsSoterEnrolledInDevice
({
checkAuthMode
:
mode
.
nam
e
,
checkAuthMode
:
checkAuthMod
e
,
success
:
(
res
)
=>
{
if
(
res
.
isEnrolled
)
{
return
resolve
(
res
);
}
uni
.
showToast
({
title
:
`设备未开启
${
mode
.
title
}
`
,
title
:
`设备未开启
${
title
}
`
,
icon
:
'
none
'
});
reject
(
res
);
},
fail
:
(
err
)
=>
{
uni
.
showToast
({
title
:
`
${
mode
.
title
}
失败`
,
title
:
`
${
title
}
失败`
,
icon
:
'
none
'
});
reject
(
err
);
...
...
pages/ucenter/ucenter.vue
浏览文件 @
92cd08db
...
...
@@ -112,7 +112,8 @@
return
getApp
().
appVersion
}
// #endif
,
appConfig
(){
,
appConfig
()
{
return
getApp
().
globalData
.
config
}
},
...
...
@@ -136,13 +137,14 @@
async
checkVersion
()
{
let
res
=
await
callCheckVersion
()
console
.
log
(
res
);
if
(
res
.
result
.
code
==
0
)
{
if
(
res
.
result
.
code
>
0
)
{
checkUpdate
()
}
else
{
uni
.
showToast
({
title
:
res
.
result
.
message
,
icon
:
'
none
'
});
}
checkUpdate
()
},
toUserInfo
()
{
uni
.
navigateTo
({
...
...
@@ -162,7 +164,7 @@
// #ifdef APP-PLUS
if
(
uni
.
getSystemInfoSync
().
platform
==
"
ios
"
)
{
// 这里填写appstore应用id
let
appstoreid
=
this
.
appConfig
.
marketId
.
ios
;
// 'id1417078253';
let
appstoreid
=
this
.
appConfig
.
marketId
.
ios
;
// 'id1417078253';
plus
.
runtime
.
openURL
(
"
itms-apps://
"
+
'
itunes.apple.com/cn/app/wechat/
'
+
appstoreid
+
'
?mt=8
'
);
}
if
(
uni
.
getSystemInfoSync
().
platform
==
"
android
"
)
{
...
...
@@ -207,6 +209,7 @@
page
{
background-color
:
#f8f8f8
;
}
/* #endif*/
.center
{
...
...
@@ -214,6 +217,7 @@
flex-direction
:
column
;
background-color
:
#f8f8f8
;
}
.userInfo
{
width
:
750
rpx
;
padding
:
20
rpx
;
...
...
@@ -222,12 +226,14 @@
flex-direction
:
column
;
align-items
:
center
;
}
.logo-img
{
width
:
150
rpx
;
height
:
150
rpx
;
border-radius
:
150
rpx
;
border
:
solid
1px
#FFFFFF
;
}
.logo-title
{
height
:
150
rpx
;
flex
:
1
;
...
...
@@ -242,15 +248,18 @@
font-size
:
38
rpx
;
color
:
#FFFFFF
;
}
.center-list
{
margin-bottom
:
30
rpx
;
background-color
:
#f9f9f9
;
}
.center-list-cell
{
width
:
750
rpx
;
background-color
:
#007AFF
;
height
:
40
rpx
;
}
.grid
{
background-color
:
#FFFFFF
;
margin
:
25
rpx
0
;
...
...
@@ -299,4 +308,4 @@
/* #endif */
background-color
:
#DD524D
;
}
</
style
>
</
style
>
pages/ucenter/userinfo/bind-mobile/bind-mobile.vue
浏览文件 @
92cd08db
...
...
@@ -6,7 +6,7 @@
<uni-easyinput
clearable
type=
"number"
class=
"input-box"
:inputBorder=
"false"
v-model=
"formData.code"
maxlength=
"6"
placeholder=
"请输入验证码"
>
<template
slot=
"right"
>
<
send-sms-code
ref=
"shortCode"
code-type=
"bind"
:phone=
"formData.phone"
></
send-sms-code>
<
uni-send-sms-code
ref=
"shortCode"
code-type=
"bind"
:phone=
"formData.phone"
></uni-
send-sms-code>
</
template
>
</uni-easyinput>
<button
class=
"send-btn-box"
type=
"primary"
@
click=
"submit"
>
提交
</button>
...
...
uni_modules/uni-icons/components/uni-icons/uni-icons.vue
浏览文件 @
92cd08db
...
...
@@ -60,6 +60,7 @@
font-family
:
uniicons
;
src
:
url('./uni.ttf')
format
(
'truetype'
);
}
/* #endif */
.uni-icons
{
...
...
uni_modules/uni-search-bar/changelog.md
浏览文件 @
92cd08db
## 1.0.8(2021-04-21)
-
优化 添加依赖 uni-icons, 导入后自动下载依赖
## 1.0.7(2021-04-15)
-
uni-ui 新增 uni-search-bar 的 focus 事件
## 1.0.6(2021-02-05)
-
优化 组件引用关系,通过uni_modules引用组件
## 1.0.5(2021-02-05)
-
调整为uni_modules目录规范
-
新增 支持双向绑定
...
...
uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.vue
浏览文件 @
92cd08db
<
template
>
<
template
>
<view
class=
"uni-searchbar"
>
<view
:style=
"
{borderRadius:radius+'px',backgroundColor: bgColor}" class="uni-searchbar__box" @click="searchClick">
<view
class=
"uni-searchbar__box-icon-search"
>
<slot
name=
"searchIcon"
>
<uni-icons
color=
"#999999"
size=
"18"
type=
"search"
/>
</slot>
</view>
<input
v-if=
"show || searchVal"
:focus=
"showSync"
:placeholder=
"placeholder"
:maxlength=
"maxlength"
class=
"uni-searchbar__box-search-input"
confirm-type=
"search"
type=
"text"
v-model=
"searchVal"
@
confirm=
"confirm"
@
blur=
"blur"
/>
<text
v-else
class=
"uni-searchbar__text-placeholder"
>
{{
placeholder
}}
</text>
<view
v-if=
"show && (clearButton==='always'||clearButton==='auto'&&searchVal!=='')"
class=
"uni-searchbar__box-icon-clear"
@
click=
"clear"
>
<slot
name=
"clearIcon"
>
<uni-icons
color=
"#c0c4cc"
size=
"18"
type=
"clear"
/>
</slot>
</view>
</view>
<text
@
click=
"cancel"
class=
"uni-searchbar__cancel"
v-if=
"cancelButton ==='always' || show && cancelButton ==='auto'"
>
{{
cancelText
}}
</text>
</view>
</
template
>
<
script
>
/**
* SearchBar 搜索栏
* @description 评分组件
* @tutorial https://ext.dcloud.net.cn/plugin?id=866
* @property {Number} radius 搜索栏圆角
* @property {Number} maxlength 输入最大长度
* @property {String} placeholder 搜索栏Placeholder
* @property {String} clearButton = [always|auto|none] 是否显示清除按钮
* @value always 一直显示
* @value auto 输入框不为空时显示
* @value none 一直不显示
* @property {String} cancelButton = [always|auto|none] 是否显示取消按钮
* @value always 一直显示
* @value auto 输入框不为空时显示
* @value none 一直不显示
* @property {String} cancelText 取消按钮的文字
* @property {String} bgColor 输入框背景颜色
* @property {Boolean} focus 是否自动聚焦
* @event {Function} confirm uniSearchBar 的输入框 confirm 事件,返回参数为uniSearchBar的value,e={value:Number}
* @event {Function} input uniSearchBar 的 value 改变时触发事件,返回参数为uniSearchBar的value,e=value
* @event {Function} cancel 点击取消按钮时触发事件,返回参数为uniSearchBar的value,e={value:Number}
* @event {Function} clear 点击清除按钮时触发事件,返回参数为uniSearchBar的value,e={value:Number}
* @event {Function} blur input失去焦点时触发事件,返回参数为uniSearchBar的value,e={value:Number}
*/
export
default
{
name
:
"
UniSearchBar
"
,
props
:
{
placeholder
:
{
type
:
String
,
default
:
"
请输入搜索内容
"
},
radius
:
{
type
:
[
Number
,
String
],
default
:
5
},
clearButton
:
{
type
:
String
,
default
:
"
auto
"
},
cancelButton
:
{
type
:
String
,
default
:
"
auto
"
},
cancelText
:
{
type
:
String
,
default
:
'
取消
'
},
bgColor
:
{
type
:
String
,
default
:
"
#F8F8F8
"
},
maxlength
:
{
type
:
[
Number
,
String
],
default
:
100
},
value
:
{
type
:
[
Number
,
String
],
default
:
""
},
<view
:style=
"
{borderRadius:radius+'px',backgroundColor: bgColor}" class="uni-searchbar__box" @click="searchClick">
<view
class=
"uni-searchbar__box-icon-search"
>
<slot
name=
"searchIcon"
>
<uni-icons
color=
"#999999"
size=
"18"
type=
"search"
/>
</slot>
</view>
<input
v-if=
"show || searchVal"
:focus=
"showSync"
:placeholder=
"placeholder"
:maxlength=
"maxlength"
class=
"uni-searchbar__box-search-input"
confirm-type=
"search"
type=
"text"
v-model=
"searchVal"
@
confirm=
"confirm"
@
blur=
"blur"
@
focus=
"emitFocus"
/>
<text
v-else
class=
"uni-searchbar__text-placeholder"
>
{{
placeholder
}}
</text>
<view
v-if=
"show && (clearButton==='always'||clearButton==='auto'&&searchVal!=='')"
class=
"uni-searchbar__box-icon-clear"
@
click=
"clear"
>
<slot
name=
"clearIcon"
>
<uni-icons
color=
"#c0c4cc"
size=
"15"
type=
"clear"
/>
</slot>
</view>
</view>
<text
@
click=
"cancel"
class=
"uni-searchbar__cancel"
v-if=
"cancelButton ==='always' || show && cancelButton ==='auto'"
>
{{
cancelText
}}
</text>
<view
v-if=
"disabled"
@
click.stop=
"searchCoverClick"
class=
"uni-search-cover"
></view>
</view>
</
template
>
<
script
>
/**
* SearchBar 搜索栏
* @description 评分组件
* @tutorial https://ext.dcloud.net.cn/plugin?id=866
* @property {Number} radius 搜索栏圆角
* @property {Number} maxlength 输入最大长度
* @property {String} placeholder 搜索栏Placeholder
* @property {String} clearButton = [always|auto|none] 是否显示清除按钮
* @value always 一直显示
* @value auto 输入框不为空时显示
* @value none 一直不显示
* @property {String} cancelButton = [always|auto|none] 是否显示取消按钮
* @value always 一直显示
* @value auto 输入框不为空时显示
* @value none 一直不显示
* @property {String} cancelText 取消按钮的文字
* @property {String} bgColor 输入框背景颜色
* @property {Boolean} focus 是否自动聚焦
* @event {Function} confirm uniSearchBar 的输入框 confirm 事件,返回参数为uniSearchBar的value,e={value:Number}
* @event {Function} input uniSearchBar 的 value 改变时触发事件,返回参数为uniSearchBar的value,e=value
* @event {Function} cancel 点击取消按钮时触发事件,返回参数为uniSearchBar的value,e={value:Number}
* @event {Function} clear 点击清除按钮时触发事件,返回参数为uniSearchBar的value,e={value:Number}
* @event {Function} blur input失去焦点时触发事件,返回参数为uniSearchBar的value,e={value:Number}
*/
export
default
{
name
:
"
UniSearchBar
"
,
props
:
{
placeholder
:
{
type
:
String
,
default
:
"
请输入搜索内容
"
},
radius
:
{
type
:
[
Number
,
String
],
default
:
5
},
clearButton
:
{
type
:
String
,
default
:
"
auto
"
},
cancelButton
:
{
type
:
String
,
default
:
"
auto
"
},
cancelText
:
{
type
:
String
,
default
:
'
取消
'
},
bgColor
:
{
type
:
String
,
default
:
"
#F8F8F8
"
},
maxlength
:
{
type
:
[
Number
,
String
],
default
:
100
},
value
:
{
type
:
[
Number
,
String
],
default
:
""
},
focus
:
{
type
:
Boolean
,
default
:
false
}
},
data
()
{
return
{
show
:
false
,
showSync
:
false
,
searchVal
:
''
}
},
watch
:
{
value
:
{
immediate
:
true
,
handler
(
newVal
)
{
this
.
searchVal
=
newVal
if
(
newVal
)
{
this
.
show
=
true
}
}
},
focus
:
{
immediate
:
true
,
handler
(
newVal
)
{
if
(
newVal
)
{
this
.
show
=
true
;
this
.
$nextTick
(()
=>
{
this
.
showSync
=
true
})
}
}
},
searchVal
(
newVal
,
oldVal
)
{
this
.
$emit
(
"
input
"
,
newVal
)
}
},
disabled
:
{
type
:
Boolean
,
default
:
false
}
},
data
()
{
return
{
show
:
false
,
showSync
:
false
,
searchVal
:
''
}
},
watch
:
{
value
:
{
immediate
:
true
,
handler
(
newVal
)
{
this
.
searchVal
=
newVal
if
(
newVal
)
{
this
.
show
=
true
}
}
},
focus
:
{
immediate
:
true
,
handler
(
newVal
)
{
if
(
newVal
)
{
this
.
show
=
true
;
this
.
$nextTick
(()
=>
{
this
.
showSync
=
true
})
}
}
},
searchVal
(
newVal
,
oldVal
)
{
this
.
$emit
(
"
input
"
,
newVal
)
}
},
methods
:
{
searchClick
()
{
if
(
this
.
show
)
{
return
}
this
.
show
=
true
;
this
.
$nextTick
(()
=>
{
this
.
showSync
=
true
})
},
clear
()
{
this
.
$emit
(
"
clear
"
,
{
value
:
this
.
searchVal
})
this
.
searchVal
=
""
searchCoverClick
(){
this
.
$emit
(
'
click
'
)
},
searchClick
()
{
if
(
this
.
show
)
{
return
}
this
.
show
=
true
;
this
.
$nextTick
(()
=>
{
this
.
showSync
=
true
})
},
clear
()
{
this
.
$emit
(
"
clear
"
,
{
value
:
this
.
searchVal
})
this
.
searchVal
=
""
},
cancel
()
{
this
.
$emit
(
"
cancel
"
,
{
value
:
this
.
searchVal
});
this
.
searchVal
=
""
this
.
show
=
false
this
.
showSync
=
false
// #ifndef APP-PLUS
uni
.
hideKeyboard
()
// #endif
// #ifdef APP-PLUS
plus
.
key
.
hideSoftKeybord
()
// #endif
},
confirm
()
{
// #ifndef APP-PLUS
uni
.
hideKeyboard
();
// #endif
// #ifdef APP-PLUS
plus
.
key
.
hideSoftKeybord
()
// #endif
this
.
$emit
(
"
confirm
"
,
{
value
:
this
.
searchVal
})
},
blur
()
{
// #ifndef APP-PLUS
uni
.
hideKeyboard
();
// #endif
// #ifdef APP-PLUS
plus
.
key
.
hideSoftKeybord
()
// #endif
this
.
$emit
(
"
blur
"
,
{
value
:
this
.
searchVal
})
},
cancel
()
{
this
.
$emit
(
"
cancel
"
,
{
value
:
this
.
searchVal
});
this
.
searchVal
=
""
this
.
show
=
false
this
.
showSync
=
false
// #ifndef APP-PLUS
uni
.
hideKeyboard
()
// #endif
// #ifdef APP-PLUS
plus
.
key
.
hideSoftKeybord
()
// #endif
},
confirm
()
{
// #ifndef APP-PLUS
uni
.
hideKeyboard
();
// #endif
// #ifdef APP-PLUS
plus
.
key
.
hideSoftKeybord
()
// #endif
this
.
$emit
(
"
confirm
"
,
{
value
:
this
.
searchVal
})
},
blur
()
{
// #ifndef APP-PLUS
uni
.
hideKeyboard
();
// #endif
// #ifdef APP-PLUS
plus
.
key
.
hideSoftKeybord
()
// #endif
this
.
$emit
(
"
blur
"
,
{
value
:
this
.
searchVal
})
}
}
};
</
script
>
<
style
lang=
"scss"
scoped
>
$uni-searchbar-height
:
36px
;
.uni-searchbar
{
/* #ifndef APP-NVUE */
display
:
flex
;
/* #endif */
flex-direction
:
row
;
position
:
relative
;
padding
:
$uni-spacing-col-base
;
// background-color: $uni-bg-color;
}
.uni-searchbar__box
{
/* #ifndef APP-NVUE */
display
:
flex
;
box-sizing
:
border-box
;
/* #endif */
overflow
:
hidden
;
position
:
relative
;
flex
:
1
;
justify-content
:
center
;
flex-direction
:
row
;
align-items
:
center
;
height
:
$uni-searchbar-height
;
padding
:
5px
8px
5px
0px
;
border-width
:
0
.5px
;
border-style
:
solid
;
border-color
:
$uni-border-color
;
}
.uni-searchbar__box-icon-search
{
/* #ifndef APP-NVUE */
display
:
flex
;
/* #endif */
flex-direction
:
row
;
// width: 32px;
padding
:
0
8px
;
justify-content
:
center
;
align-items
:
center
;
color
:
$uni-text-color-placeholder
;
}
.uni-searchbar__box-search-input
{
flex
:
1
;
font-size
:
$uni-font-size-base
;
color
:
$uni-text-color
;
}
.uni-searchbar__box-icon-clear
{
align-items
:
center
;
line-height
:
24px
;
emitFocus
(
e
)
{
this
.
$emit
(
"
focus
"
,
e
.
detail
)
}
}
};
</
script
>
<
style
lang=
"scss"
scoped
>
$uni-searchbar-height
:
36px
;
.uni-searchbar
{
/* #ifndef APP-NVUE */
display
:
flex
;
/* #endif */
flex-direction
:
row
;
position
:
relative
;
padding
:
$uni-spacing-col-base
;
// background-color: $uni-bg-color;
}
.uni-searchbar__box
{
/* #ifndef APP-NVUE */
display
:
flex
;
box-sizing
:
border-box
;
/* #endif */
overflow
:
hidden
;
position
:
relative
;
flex
:
1
;
justify-content
:
center
;
flex-direction
:
row
;
align-items
:
center
;
height
:
$uni-searchbar-height
;
padding
:
5px
8px
5px
0px
;
border-width
:
0
.5px
;
border-style
:
solid
;
border-color
:
$uni-border-color
;
}
.uni-searchbar__box-icon-search
{
/* #ifndef APP-NVUE */
display
:
flex
;
/* #endif */
flex-direction
:
row
;
// width: 32px;
padding
:
0
8px
;
justify-content
:
center
;
align-items
:
center
;
color
:
$uni-text-color-placeholder
;
}
.uni-searchbar__box-search-input
{
flex
:
1
;
font-size
:
$uni-font-size-base
;
color
:
$uni-text-color
;
}
.uni-searchbar__box-icon-clear
{
align-items
:
center
;
line-height
:
24px
;
padding-left
:
8px
;
/* #ifdef H5 */
cursor
:
pointer
;
/* #endif */
}
.uni-searchbar__text-placeholder
{
font-size
:
$uni-font-size-base
;
color
:
$uni-text-color-placeholder
;
margin-left
:
5px
;
}
.uni-searchbar__cancel
{
padding-left
:
10px
;
line-height
:
$uni-searchbar-height
;
font-size
:
14px
;
/* #endif */
}
.uni-searchbar__text-placeholder
{
font-size
:
$uni-font-size-base
;
color
:
$uni-text-color-placeholder
;
margin-left
:
5px
;
}
.uni-searchbar__cancel
{
padding-left
:
10px
;
line-height
:
$uni-searchbar-height
;
font-size
:
14px
;
color
:
$uni-text-color
;
/* #ifdef H5 */
cursor
:
pointer
;
/* #endif */
/* #endif */
}
.uni-search-cover
{
height
:
$uni-searchbar-height
;
margin-top
:
$uni-spacing-col-base
;
width
:
750rpx
;
position
:
absolute
;
top
:
0
;
left
:
0
;
/* #ifndef APP-NVUE */
z-index
:
99
;
/* #endif */
}
</
style
>
uni_modules/uni-search-bar/package.json
浏览文件 @
92cd08db
{
"id"
:
"uni-search-bar"
,
"displayName"
:
"SearchBar 搜索栏"
,
"version"
:
"1.0.
6
"
,
"version"
:
"1.0.
8
"
,
"description"
:
"搜索栏组件,通常用于搜索商品、文章等"
,
"keywords"
:
[
"search-bar"
,
...
...
@@ -40,7 +40,9 @@
"npmurl"
:
"https://www.npmjs.com/package/@dcloudio/uni-ui"
},
"uni_modules"
:
{
"dependencies"
:
[],
"dependencies"
:
[
"uni-icons"
],
"encrypt"
:
[],
"platforms"
:
{
"cloud"
:
{
...
...
uni_modules/uni-search-bar/readme.md
浏览文件 @
92cd08db
...
...
@@ -2,6 +2,7 @@
## SearchBar 搜索栏
> **组件名:uni-search-bar**
> 代码块: `uSearchBar`
...
...
@@ -21,6 +22,9 @@
<!-- 基本用法 -->
<uni-search-bar
@
confirm=
"search"
@
input=
"input"
></uni-search-bar>
<!-- v-model 用法 -->
<uni-search-bar
@
confirm=
"search"
:focus=
"true"
v-model=
"searchValue"
@
blur=
"blur"
@
focus=
"focus"
@
input=
"input"
@
cancel=
"cancel"
@
change=
"change"
@
clear=
"clear"
>
<!-- 自定义Placeholder -->
<uni-search-bar
placeholder=
"自定placeholder"
@
confirm=
"search"
></uni-search-bar>
...
...
@@ -34,8 +38,9 @@
|属性名 |类型 |默认值 |说明 |
|:-: |:-: |:-: |:-: |
|value/v-model |StringNumber | |搜索栏绑定值 |
|placeholder |String |搜索 |搜索栏Placeholder |
|radius |Number |10 |搜索栏圆角,单位
r
px |
|radius |Number |10 |搜索栏圆角,单位px |
|clearButton |String |auto |是否显示清除按钮,可选值
`always`
-一直显示、
`auto`
-输入框不为空时显示、
`none`
-一直不显示 |
|cancelButton |String |auto |是否显示取消按钮,可选值
`always`
-一直显示、
`auto`
-输入框不为空时显示、
`none`
-一直不显示 |
|cancelText |String |取消 |取消按钮的文字 |
...
...
@@ -52,7 +57,8 @@
|@input |uniSearchBar 的 value 改变时触发事件,返回参数为uniSearchBar的value|e=value |
|@cancel |点击取消按钮时触发事件,返回参数为uniSearchBar的value |e={value:Number} |
|@clear |点击清除按钮时触发事件,返回参数为uniSearchBar的value |e={value:Number} |
|@blur |input失去焦点时触发事件,返回参数为uniSearchBar的value |e={value:Number} |
|@focus |input 获取焦点时触发事件,返回参数为uniSearchBar的value |e={value:Number} |
|@blur |input 失去焦点时触发事件,返回参数为uniSearchBar的value |e={value:Number} |
### 替换 icon 的 slot 插槽
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录