Compare commits
9 Commits
master
...
full-versi
Author | SHA1 | Date | |
---|---|---|---|
|
279a0d1475 | ||
|
0aaabd6807 | ||
|
65d698df3a | ||
|
4b765b63f3 | ||
|
7cc61290f6 | ||
|
820beb4203 | ||
|
d30195a32d | ||
|
39c97c43c0 | ||
|
d9f0e1ddb6 |
23
.gitignore
vendored
@ -1,21 +1,2 @@
|
|||||||
# Logs
|
unpackage/
|
||||||
logs
|
node_modules/
|
||||||
*.log
|
|
||||||
npm-debug.log*
|
|
||||||
yarn-debug.log*
|
|
||||||
yarn-error.log*
|
|
||||||
pnpm-debug.log*
|
|
||||||
lerna-debug.log*
|
|
||||||
|
|
||||||
node_modules
|
|
||||||
.DS_Store
|
|
||||||
dist
|
|
||||||
*.local
|
|
||||||
unpackage
|
|
||||||
# Editor directories and files
|
|
||||||
.idea
|
|
||||||
*.suo
|
|
||||||
*.ntvs*
|
|
||||||
*.njsproj
|
|
||||||
*.sln
|
|
||||||
*.sw?
|
|
||||||
|
@ -10,10 +10,6 @@
|
|||||||
"default" : {
|
"default" : {
|
||||||
"launchtype" : "local"
|
"launchtype" : "local"
|
||||||
},
|
},
|
||||||
"h5" : {
|
|
||||||
"launchtype" : "local"
|
|
||||||
},
|
|
||||||
"provider" : "aliyun",
|
|
||||||
"type" : "uniCloud"
|
"type" : "uniCloud"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
68
App.vue
@ -1,76 +1,12 @@
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
// 上一次网络状态
|
|
||||||
lastNetworkStatus: null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
// 判断是否是第一次安装APP并且打开
|
|
||||||
isFirstOpen() {
|
|
||||||
let isFirstOpen = uni.getStorageSync('isFirstOpen')
|
|
||||||
if (!isFirstOpen) {
|
|
||||||
uni.setStorageSync('isFirstOpen', true)
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
},
|
|
||||||
networkStatusChange(res) {
|
|
||||||
console.log(res)
|
|
||||||
if (res.isConnected) {
|
|
||||||
// 如果是第一次安装进入,并且网络状态为有网络,则跳转到主页
|
|
||||||
if (this.isFirstOpen()) {
|
|
||||||
uni.redirectTo({
|
|
||||||
url: '/pages/index/index'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
// 如果上一次网络状态为无网络,且当前网络状态为有网络,则跳转到首页
|
|
||||||
if (this.lastNetworkStatus === false) {
|
|
||||||
uni.showModal({
|
|
||||||
title: "提示",
|
|
||||||
content: "当前设备网络发生更改,是否刷新页面?",
|
|
||||||
showCancel: true,
|
|
||||||
success: function (res) {
|
|
||||||
if (res.confirm || res.cancel) {
|
|
||||||
uni.redirectTo({
|
|
||||||
url: '/pages/index/index'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
uni.redirectTo({
|
|
||||||
url: '/pages/networko/index'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
this.lastNetworkStatus = res.isConnected
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onLaunch: function() {
|
onLaunch: function() {
|
||||||
console.log('onLaunch')
|
|
||||||
|
|
||||||
},
|
},
|
||||||
onShow: function() {
|
onShow: function() {
|
||||||
uni.onNetworkStatusChange(this.networkStatusChange);
|
console.log('App Show')
|
||||||
uni.getNetworkType({
|
|
||||||
success: (res) => {
|
|
||||||
if (res.networkType === 'none') {
|
|
||||||
uni.redirectTo({
|
|
||||||
url: '/pages/networko/index'
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
},
|
},
|
||||||
onHide: function() {
|
onHide: function() {
|
||||||
uni.offNetworkStatusChange(this.networkStatusChange)
|
console.log('App Hide')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,36 +0,0 @@
|
|||||||
{
|
|
||||||
"version" : "1",
|
|
||||||
"prompt" : "template",
|
|
||||||
"title" : "温馨提示",
|
|
||||||
"message" : " 感谢您对oa考勤系统的信赖!在使用前请务必阅读并同意<a href=\"https://oa-a.szjixun.cn/#/pages/setting/severInfo\">《用户服务协议》</a>和<a href=\"https://oa-a.szjixun.cn/#/pages/setting/privateInfo\">《隐私政策》</a>,我们将按照协议和政策内容为您提供服务。<br/>oa考勤系统系统的基本功能为打卡、审批等考勤管理及协同办公服务。基于您的授权及服务之必要,基本功能的必要个人信息包括移动电话号码、账号信息等。您同意<a href=\"https://oa-a.szjixun.cn/#/pages/setting/privateInfo\">《隐私政策》</a>仅代表同意oa考勤系统在您使用基本功能时处理相关必要信息。附加功能如需处理个人信息,将单独征求您的同意。",
|
|
||||||
"buttonAccept" : "同意并接受",
|
|
||||||
"buttonRefuse" : "不同意",
|
|
||||||
"second" : {
|
|
||||||
"title" : " 您需要同意本隐私政策才能继续使用oa考勤系统",
|
|
||||||
"message" : " 若您不同意本<a href=\"https://oa-a.szjixun.cn/#/pages/setting/privateInfo\">《隐私政策》</a>,很遗憾我们将无法为您提供服务",
|
|
||||||
"buttonAccept" : "同意并继续",
|
|
||||||
"buttonRefuse" : "退出应用"
|
|
||||||
},
|
|
||||||
"disagreeMode" : {
|
|
||||||
"support" : false,
|
|
||||||
"loadNativePlugins" : false,
|
|
||||||
"visitorEntry" : false,
|
|
||||||
"showAlways" : false
|
|
||||||
},
|
|
||||||
"styles" : {
|
|
||||||
"backgroundColor" : "#ffffff",
|
|
||||||
"borderRadius" : "5px",
|
|
||||||
"title" : {
|
|
||||||
"color" : "#000"
|
|
||||||
},
|
|
||||||
"buttonAccept" : {
|
|
||||||
"color" : "#000"
|
|
||||||
},
|
|
||||||
"buttonRefuse" : {
|
|
||||||
"color" : "#000"
|
|
||||||
},
|
|
||||||
"buttonVisitor" : {
|
|
||||||
"color" : "#009"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
25
common/index.js
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
/* 非空验证 */
|
||||||
|
const vefEmpty = (key,msg) => {
|
||||||
|
if (key === '' || key === undefined || key === null) {
|
||||||
|
uni.showToast({
|
||||||
|
title: msg,
|
||||||
|
duration: 2000,
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
return false
|
||||||
|
} else {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const addZero = (num) => {
|
||||||
|
if (num < 10) {
|
||||||
|
num = `0${num}`;
|
||||||
|
}
|
||||||
|
return num;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default {
|
||||||
|
vefEmpty,
|
||||||
|
addZero
|
||||||
|
}
|
BIN
common/updown/20230714_dev.p12
Normal file
BIN
common/updown/20230714_dis.p12
Normal file
BIN
common/updown/oa_dev_20240104.mobileprovision
Normal file
BIN
common/updown/oa_dis_20231130.mobileprovision
Normal file
@ -1,21 +1,18 @@
|
|||||||
const env = 'prod';
|
const env = 'dev';
|
||||||
const configs = {
|
const configs = {
|
||||||
LocalTest: {
|
|
||||||
apiBaseUrl: 'https://warehouse.szjixun.cn/oa_backend',
|
|
||||||
h5Url: 'http://192.168.88.61:2367/#/'
|
|
||||||
},
|
|
||||||
dev: {
|
dev: {
|
||||||
apiBaseUrl: 'https://warehouse.szjixun.cn/oa_backend',
|
apiBaseUrl: 'https://warehouse.szjixun.cn/oa_backend',
|
||||||
h5Url: 'http://192.168.88.47:2367/#/'
|
h5Url:'http://192.168.88.37:8080/#/'
|
||||||
},
|
},
|
||||||
test: {
|
test: {
|
||||||
apiBaseUrl: 'https://warehouse.szjixun.cn/oa_backend',
|
apiBaseUrl: 'https://warehouse.szjixun.cn/oa_backend',
|
||||||
h5Url: 'http://114.218.158.24:8042/#/'
|
h5Url:'http://114.218.158.24:9051/#/'
|
||||||
},
|
},
|
||||||
prod: {
|
prod: {
|
||||||
apiBaseUrl: 'https://oa-a.szjixun.cn/api',
|
apiBaseUrl: 'https://oa-a.szjixun.cn/api',
|
||||||
h5Url:'https://oa-a.szjixun.cn/#/'
|
h5Url:'https://oa-a.szjixun.cn/#/'
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const config = configs[env];
|
const config = configs[env];
|
||||||
export default config;
|
export default config;
|
||||||
|
@ -1,105 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
|
||||||
<device id="retina6_5" orientation="portrait" appearance="light"/>
|
|
||||||
<dependencies>
|
|
||||||
<deployment identifier="iOS"/>
|
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/>
|
|
||||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
|
||||||
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
|
||||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
|
||||||
</dependencies>
|
|
||||||
<scenes>
|
|
||||||
<!--View Controller-->
|
|
||||||
<scene sceneID="EHf-IW-A2E">
|
|
||||||
<objects>
|
|
||||||
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
|
||||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
|
||||||
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
|
||||||
<subviews>
|
|
||||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="dc_launchscreen_pad_background.png" translatesAutoresizingMaskIntoConstraints="NO" id="Oly-Jg-H5o">
|
|
||||||
<rect key="frame" x="0.0" y="0.0" width="1032" height="1376"/>
|
|
||||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
|
||||||
</imageView>
|
|
||||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="dc_launchscreen_landscape_background.png" translatesAutoresizingMaskIntoConstraints="NO" id="jN2-Td-r8h">
|
|
||||||
<rect key="frame" x="0.0" y="0.0" width="812" height="375"/>
|
|
||||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
|
||||||
</imageView>
|
|
||||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="dc_launchscreen_portrait_background.png" translatesAutoresizingMaskIntoConstraints="NO" id="Tt8-jS-2H5">
|
|
||||||
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
|
||||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
|
||||||
</imageView>
|
|
||||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="dc_launchscreen_icon.png" translatesAutoresizingMaskIntoConstraints="NO" id="vp6-uo-KS2">
|
|
||||||
<rect key="frame" x="150.66666666666666" y="391.66666666666669" width="112.66666666666666" height="112.66666666666669"/>
|
|
||||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
|
||||||
</imageView>
|
|
||||||
<!-- <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="hello uniapp" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="QBH-Ne-rcx">
|
|
||||||
<rect key="frame" x="168" y="835" width="78.333333333333314" height="17"/>
|
|
||||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
|
||||||
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
|
||||||
<nil key="highlightedColor"/>
|
|
||||||
</label> -->
|
|
||||||
</subviews>
|
|
||||||
<viewLayoutGuide key="safeArea" id="IW3-oA-Ytg"/>
|
|
||||||
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
|
||||||
<constraints>
|
|
||||||
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="vp6-uo-KS2" secondAttribute="trailing" id="1Cb-y2-pRQ"/>
|
|
||||||
<constraint firstItem="QBH-Ne-rcx" firstAttribute="bottom" secondItem="Ze5-6b-2t3" secondAttribute="bottom" constant="-44" id="5MD-Bb-oGe"/>
|
|
||||||
<constraint firstAttribute="trailing" secondItem="jN2-Td-r8h" secondAttribute="trailing" id="Bbg-68-h1T"/>
|
|
||||||
<constraint firstItem="Tt8-jS-2H5" firstAttribute="top" secondItem="Ze5-6b-2t3" secondAttribute="top" id="FH7-NM-QY8"/>
|
|
||||||
<constraint firstItem="vp6-uo-KS2" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="GM5-vc-qeO"/>
|
|
||||||
<constraint firstItem="jN2-Td-r8h" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" id="J9z-eJ-GkK"/>
|
|
||||||
<constraint firstItem="vp6-uo-KS2" firstAttribute="top" relation="greaterThanOrEqual" secondItem="Ze5-6b-2t3" secondAttribute="top" constant="10" id="M4i-XX-uO2"/>
|
|
||||||
<constraint firstItem="jN2-Td-r8h" firstAttribute="top" secondItem="Ze5-6b-2t3" secondAttribute="top" id="QFR-Dp-WZN"/>
|
|
||||||
<constraint firstAttribute="trailing" secondItem="Tt8-jS-2H5" secondAttribute="trailing" id="QGW-bk-xBw"/>
|
|
||||||
<constraint firstItem="vp6-uo-KS2" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="Qji-wc-LLD"/>
|
|
||||||
<constraint firstAttribute="bottom" secondItem="Oly-Jg-H5o" secondAttribute="bottom" id="RrE-yv-HsN"/>
|
|
||||||
<constraint firstItem="Oly-Jg-H5o" firstAttribute="top" secondItem="Ze5-6b-2t3" secondAttribute="top" id="VcW-dk-n8h"/>
|
|
||||||
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="vp6-uo-KS2" secondAttribute="bottom" constant="10" id="dGX-JM-hiU"/>
|
|
||||||
<constraint firstItem="Oly-Jg-H5o" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" id="fa7-4C-n5e"/>
|
|
||||||
<constraint firstItem="Tt8-jS-2H5" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" id="fnt-hE-VMi"/>
|
|
||||||
<constraint firstAttribute="bottom" secondItem="jN2-Td-r8h" secondAttribute="bottom" id="iIX-Hl-IOF"/>
|
|
||||||
<constraint firstAttribute="trailing" secondItem="Oly-Jg-H5o" secondAttribute="trailing" id="mm9-f4-toK"/>
|
|
||||||
<constraint firstItem="vp6-uo-KS2" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="Ze5-6b-2t3" secondAttribute="leading" id="oA2-4f-IGA"/>
|
|
||||||
<constraint firstItem="QBH-Ne-rcx" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="rO7-2t-bpH"/>
|
|
||||||
<constraint firstAttribute="bottom" secondItem="Tt8-jS-2H5" secondAttribute="bottom" id="seh-wj-zPF"/>
|
|
||||||
</constraints>
|
|
||||||
<variation key="default">
|
|
||||||
<mask key="subviews">
|
|
||||||
<exclude reference="Oly-Jg-H5o"/>
|
|
||||||
<exclude reference="jN2-Td-r8h"/>
|
|
||||||
<exclude reference="Tt8-jS-2H5"/>
|
|
||||||
</mask>
|
|
||||||
</variation>
|
|
||||||
<variation key="heightClass=compact">
|
|
||||||
<mask key="subviews">
|
|
||||||
<include reference="jN2-Td-r8h"/>
|
|
||||||
</mask>
|
|
||||||
</variation>
|
|
||||||
<variation key="heightClass=regular-widthClass=compact">
|
|
||||||
<mask key="subviews">
|
|
||||||
<include reference="Tt8-jS-2H5"/>
|
|
||||||
</mask>
|
|
||||||
</variation>
|
|
||||||
<variation key="heightClass=regular-widthClass=regular">
|
|
||||||
<mask key="subviews">
|
|
||||||
<include reference="Oly-Jg-H5o"/>
|
|
||||||
</mask>
|
|
||||||
</variation>
|
|
||||||
</view>
|
|
||||||
</viewController>
|
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
|
||||||
</objects>
|
|
||||||
<point key="canvasLocation" x="52.173913043478265" y="374.33035714285711"/>
|
|
||||||
</scene>
|
|
||||||
</scenes>
|
|
||||||
<resources>
|
|
||||||
<image name="dc_launchscreen_icon.png" width="112.66666412353516" height="112.66666412353516"/>
|
|
||||||
<image name="dc_launchscreen_landscape_background.png" width="812" height="375"/>
|
|
||||||
<image name="dc_launchscreen_pad_background.png" width="768" height="1024"/>
|
|
||||||
<image name="dc_launchscreen_portrait_background.png" width="375" height="812"/>
|
|
||||||
<systemColor name="systemBackgroundColor">
|
|
||||||
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
|
||||||
</systemColor>
|
|
||||||
</resources>
|
|
||||||
</document>
|
|
Before Width: | Height: | Size: 226 KiB |
Before Width: | Height: | Size: 226 KiB |
@ -1,59 +0,0 @@
|
|||||||
## 使用说明
|
|
||||||
此 storyboard 文件适用于各种 iPhone 及 iPad 设备的横竖屏,支持自定义界面元素包括
|
|
||||||
|
|
||||||
- 页面背景图片或背景颜色
|
|
||||||
- 中间显示图片
|
|
||||||
- 底部显示文字及颜色
|
|
||||||
|
|
||||||
**注:每一项都是可选的(比如只显示背景图片,按照下面的方法只提供背景图片即可)**
|
|
||||||
|
|
||||||
默认效果如下:
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
自定义方法:使用 HBuilderX 打开 `LaunchScreen.storyboard` 文件,作为xml文件编辑自定义修改部分样式。
|
|
||||||
|
|
||||||
|
|
||||||
### 自定义界面背景
|
|
||||||
|
|
||||||
页面背景支持设置`背景色`或设置`背景图片`,**默认为使用背景色,值为systemBackgroundColor,会跟随系统设置的模式自动修改颜色,正常模式为白色暗黑模式为黑色**,
|
|
||||||
|
|
||||||
#### 自定义背景色
|
|
||||||
|
|
||||||
替换第`44行` color 节点 `<color key="backgroundColor" systemColor="systemBackgroundColor"/>` 为下面的代码,并将 red、green、blue 属性值修改为自己需要的颜色,取值范围为0到1
|
|
||||||
```
|
|
||||||
<color key="backgroundColor" red="0.83516160100000003" green="0.88008347600000003" blue="0.88008347600000003" alpha="1" colorSpace="calibratedRGB"/>
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 自定义背景图
|
|
||||||
|
|
||||||
##### 图片要求
|
|
||||||
|
|
||||||
|设备|尺寸要求|命名规范|说明|
|
|
||||||
|:--|:--|:--|:--|
|
|
||||||
|iPhone 竖屏|以iPhoneX的尺寸设计|`dc_launchscreen_portrait_background@2x.png`、 `dc_launchscreen_portrait_background@3x.png`|以 iPhoneX 竖屏为模板设计图片,并输出@2x、@3x图片,注意命名规范|
|
|
||||||
|iPhone 横屏|以iPhoneX的尺寸设计|`dc_launchscreen_landscape_background@2x.png`、 `dc_launchscreen_landscape_background@3x.png`|以 iPhoneX 横屏为模板设计图片,并输出@2x、@3x图片,注意命名规范|
|
|
||||||
|iPad(不区分横竖屏)|以 iPad 9.7 的尺寸设计|`dc_launchscreen_pad_background@2x.png`、 `dc_launchscreen_pad_background@3x.png`|以 iPad 9.7 设备为模板设计图片,并输出@2x、@3x图片,注意命名规范|
|
|
||||||
|
|
||||||
将设计好的图片放到根目录即可;
|
|
||||||
|
|
||||||
注:如果您不需要背景图片,不存放相应的图片即可;
|
|
||||||
|
|
||||||
### 自定义中间显示的图片
|
|
||||||
请将目录中的`dc_launchscreen_icon@2x.png`、`dc_launchscreen_icon@3x.png`图片替换为您自己的图片
|
|
||||||
|
|
||||||
注:如果您不需要中间的图片,不存放相应的图片即可;
|
|
||||||
|
|
||||||
### 自定义底部文字
|
|
||||||
- 修改文字
|
|
||||||
修改第`36行` label节点的 text 属性值即可,设置为空字符串则不显示文字
|
|
||||||
```
|
|
||||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="hello uniapp" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="QBH-Ne-rcx">
|
|
||||||
```
|
|
||||||
|
|
||||||
- 修改文字颜色
|
|
||||||
替换第`39行` color 节点为下面的代码,并将 red、green、blue属性值修改为自己需要的颜色,取值范围为0到1
|
|
||||||
```
|
|
||||||
<color key="textColor" red="0.83516160100000003" green="0.88008347600000003" blue="0.88008347600000003" alpha="1" colorSpace="calibratedRGB"/>
|
|
||||||
```
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
|||||||
Android 包名 : uni.UNI70C49A3
|
|
||||||
证书别名:oaapp
|
|
||||||
密钥密码:12345678
|
|
BIN
files/icon.png
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 8.0 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 19 KiB |
@ -1,5 +0,0 @@
|
|||||||
Android 包名 : uni.UNI70C49A3
|
|
||||||
证书别名:oaapp
|
|
||||||
密钥密码:12345678
|
|
||||||
Bundle ID:com.fonchain.attendance
|
|
||||||
IOS:私钥证书密码 dis dev 都是 12345678
|
|
1
main.js
@ -10,6 +10,7 @@ const app = new Vue({
|
|||||||
})
|
})
|
||||||
app.$mount()
|
app.$mount()
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifdef VUE3
|
// #ifdef VUE3
|
||||||
import { createSSRApp } from 'vue'
|
import { createSSRApp } from 'vue'
|
||||||
export function createApp() {
|
export function createApp() {
|
||||||
|
@ -1,15 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name" : "oa考勤系统",
|
"name" : "oa考勤系统",
|
||||||
"appid" : "__UNI__4796942",
|
"appid" : "__UNI__70C49A3",
|
||||||
"description" : "",
|
"description" : "",
|
||||||
"versionName" : "2.3.2",
|
"versionName" : "2.0.0",
|
||||||
"versionCode" : 232,
|
"versionCode" : 200,
|
||||||
"transformPx" : false,
|
"transformPx" : false,
|
||||||
/* 5+App特有相关 */
|
/* 5+App特有相关 */
|
||||||
"app-plus" : {
|
"app-plus" : {
|
||||||
"compatible" : {
|
|
||||||
"ignoreVersion" : true //true表示忽略版本检查提示框,HBuilderX1.9.0及以上版本支持
|
|
||||||
},
|
|
||||||
"usingComponents" : true,
|
"usingComponents" : true,
|
||||||
"nvueStyleCompiler" : "uni-app",
|
"nvueStyleCompiler" : "uni-app",
|
||||||
"compilerVersion" : 3,
|
"compilerVersion" : 3,
|
||||||
@ -22,12 +19,7 @@
|
|||||||
/* 模块配置 */
|
/* 模块配置 */
|
||||||
"modules" : {
|
"modules" : {
|
||||||
"Camera" : {},
|
"Camera" : {},
|
||||||
"Geolocation" : {},
|
"Geolocation" : {}
|
||||||
"Maps" : {},
|
|
||||||
"LivePusher" : {},
|
|
||||||
"Push" : {},
|
|
||||||
"Barcode" : {},
|
|
||||||
"Share" : {}
|
|
||||||
},
|
},
|
||||||
/* 应用发布信息 */
|
/* 应用发布信息 */
|
||||||
"distribute" : {
|
"distribute" : {
|
||||||
@ -38,11 +30,13 @@
|
|||||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
||||||
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
||||||
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
||||||
@ -52,8 +46,7 @@
|
|||||||
],
|
],
|
||||||
"abiFilters" : [ "armeabi-v7a", "arm64-v8a" ],
|
"abiFilters" : [ "armeabi-v7a", "arm64-v8a" ],
|
||||||
"autoSdkPermissions" : false,
|
"autoSdkPermissions" : false,
|
||||||
"targetSdkVersion" : 34,
|
"targetSdkVersion" : 33
|
||||||
"minSdkVersion" : 21
|
|
||||||
},
|
},
|
||||||
/* ios打包配置 */
|
/* ios打包配置 */
|
||||||
"ios" : {
|
"ios" : {
|
||||||
@ -70,37 +63,21 @@
|
|||||||
"geolocation" : {
|
"geolocation" : {
|
||||||
"system" : {
|
"system" : {
|
||||||
"__platform__" : [ "ios", "android" ]
|
"__platform__" : [ "ios", "android" ]
|
||||||
|
},
|
||||||
|
"baidu" : {
|
||||||
|
"__platform__" : [ "ios", "android" ],
|
||||||
|
"appkey_ios" : "5zzMAq3ofL5H5KfxRcf0zDMLTimvGIb0",
|
||||||
|
"appkey_android" : "ahdcPcBfatf61zRAgNl9SpBGUEURsnXN"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ad" : {},
|
"ad" : {},
|
||||||
"share" : {
|
"share" : {
|
||||||
"weixin" : {
|
"weixin" : {
|
||||||
"appid" : "wx3a0f78634d074b23",
|
"appid" : "",
|
||||||
"UniversalLinks" : "https://warehouse.szjixun.cn/oa_backend/static/aretree/"
|
"UniversalLinks" : ""
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"push" : {
|
|
||||||
"unipush" : {
|
|
||||||
"offline" : true,
|
|
||||||
"oppo" : {},
|
|
||||||
"vivo" : {},
|
|
||||||
"mi" : {},
|
|
||||||
"honor" : {},
|
|
||||||
"version" : "2",
|
|
||||||
"icons" : {
|
|
||||||
"small" : {
|
|
||||||
"ldpi" : "unpackage/pushicon/18.png",
|
|
||||||
"mdpi" : "unpackage/pushicon/24.png",
|
|
||||||
"hdpi" : "unpackage/pushicon/36.png",
|
|
||||||
"xhdpi" : "unpackage/pushicon/48.png",
|
|
||||||
"xxhdpi" : "unpackage/pushicon/72.png"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"meizu" : {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"maps" : {}
|
|
||||||
},
|
|
||||||
"icons" : {
|
"icons" : {
|
||||||
"android" : {
|
"android" : {
|
||||||
"hdpi" : "unpackage/res/icons/72x72.png",
|
"hdpi" : "unpackage/res/icons/72x72.png",
|
||||||
@ -134,17 +111,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"splashscreen" : {
|
"splashscreen" : {
|
||||||
"useOriginalMsgbox" : true,
|
"useOriginalMsgbox" : true
|
||||||
"androidStyle" : "default",
|
|
||||||
"android" : {
|
|
||||||
"hdpi" : "static/image/drawable-hdpi/sy.9.png",
|
|
||||||
"xhdpi" : "static/image/drawable-xhdpi/sy.9.png",
|
|
||||||
"xxhdpi" : "static/image/drawable-xxhdpi/sy.9.png"
|
|
||||||
},
|
|
||||||
"iosStyle" : "storyboard",
|
|
||||||
"ios" : {
|
|
||||||
"storyboard" : "files/CustomStoryboard.zip"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
6
package-lock.json
generated
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "oa-base",
|
|
||||||
"lockfileVersion": 3,
|
|
||||||
"requires": true,
|
|
||||||
"packages": {}
|
|
||||||
}
|
|
10
pages.json
@ -6,17 +6,7 @@
|
|||||||
"navigationBarTitleText": "uni-app",
|
"navigationBarTitleText": "uni-app",
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
"path" : "pages/networko/index",
|
|
||||||
"style" :
|
|
||||||
{
|
|
||||||
"navigationBarTitleText": "uni-app",
|
|
||||||
"navigationStyle": "custom"
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
],
|
],
|
||||||
"globalStyle": {
|
"globalStyle": {
|
||||||
"navigationBarTextStyle": "black",
|
"navigationBarTextStyle": "black",
|
||||||
|
78
pages/index/index.nvue
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
<template>
|
||||||
|
<div class="content">
|
||||||
|
<web-view class="webview" @onPostMessage="webLoad" :style="{height:`${systemInfo.windowHeight}px`,width:`${systemInfo.windowWidth}`}" ref="webViewRef" :src="config.h5Url"></web-view>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import { ref} from 'vue'
|
||||||
|
import config from "../../config";
|
||||||
|
import { onShow, onHide } from "@dcloudio/uni-app";
|
||||||
|
|
||||||
|
import {sendWebWiew,receiveWebView} from "@/utils/communicate";
|
||||||
|
const webViewRef=ref(null)
|
||||||
|
|
||||||
|
const systemInfo = uni.getSystemInfoSync();
|
||||||
|
// #ifdef APP-ANDROID
|
||||||
|
/* const permissionListener = uni.createRequestPermissionListener();
|
||||||
|
permissionListener.onRequest((e)=>{
|
||||||
|
})
|
||||||
|
permissionListener.onConfirm((e) => {
|
||||||
|
sendWebWiew(webViewRef.value,{auth:e,open:true})
|
||||||
|
});
|
||||||
|
permissionListener.onComplete((e) => {
|
||||||
|
sendWebWiew(webViewRef.value,{auth:e,open:false})
|
||||||
|
}); */
|
||||||
|
// #endif
|
||||||
|
//解决ios的h5问题,获取网络权限之后,重新加载
|
||||||
|
const networkStatusChange=(res)=>{
|
||||||
|
if(res.isConnected) {
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pages/index/index'
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: '网络无连接',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const webViewObj=ref(null)
|
||||||
|
onShow(()=>{
|
||||||
|
uni.onNetworkStatusChange(networkStatusChange);
|
||||||
|
})
|
||||||
|
|
||||||
|
onHide(()=>{
|
||||||
|
uni.offNetworkStatusChange(networkStatusChange)
|
||||||
|
})
|
||||||
|
const webLoad=(e)=>{
|
||||||
|
const m=receiveWebView(e)
|
||||||
|
switch (m.action) {
|
||||||
|
//webview初始化加载完成
|
||||||
|
case 'load-complete':{
|
||||||
|
|
||||||
|
const systemInfo= uni.getSystemInfoSync()
|
||||||
|
uni.getLocation({
|
||||||
|
type: 'gcj02',
|
||||||
|
geocode: false,
|
||||||
|
isHighAccuracy: false,
|
||||||
|
success:async (res) => {
|
||||||
|
sendWebWiew(webViewRef.value,{...res,systemInfo})
|
||||||
|
},
|
||||||
|
fail: (e) => {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
.content {
|
||||||
|
display: flex;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
</style>
|
@ -1,173 +0,0 @@
|
|||||||
<template>
|
|
||||||
<web-view class="webview" @message="webLoad" style="flex: 1;" :src="config.h5Url"></web-view>
|
|
||||||
</template>
|
|
||||||
<script setup>
|
|
||||||
import { ref, onMounted } from 'vue'
|
|
||||||
import { onExit, onShow } from "@dcloudio/uni-app";
|
|
||||||
import config from "../../config"
|
|
||||||
onShow(() => {
|
|
||||||
// const { statusBarHeight } = uni.getSystemInfoSync()
|
|
||||||
// const wv1 = plus.webview.getWebviewById("custom-webview");
|
|
||||||
// let wv = null;
|
|
||||||
// if (wv1) {
|
|
||||||
// wv = wv1;
|
|
||||||
// } else {
|
|
||||||
// wv = plus.webview.create(config.h5Url, "custom-webview", {
|
|
||||||
// top: statusBarHeight,
|
|
||||||
// bottom: 0,
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// var pages = getCurrentPages();
|
|
||||||
// var page = pages[pages.length - 1];
|
|
||||||
// var currentWebview = page.$getAppWebview();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
})
|
|
||||||
import { Communication } from '../../utils/communication.js';
|
|
||||||
const commun = new Communication()
|
|
||||||
const shareH5 = () => {
|
|
||||||
uni.share({
|
|
||||||
provider: 'weixin',
|
|
||||||
scene: "WXSceneSession",
|
|
||||||
type: 0,// 5代表分享为小程序
|
|
||||||
imageUrl: 'https://th.bing.com/th?id=ORMS.41c34644e7e67f95a14620e77064b5d9&pid=Wdp&w=268&h=140&qlt=90&c=1&rs=1&dpr=1&p=0', // 必填
|
|
||||||
title: '分享的标题',
|
|
||||||
href: 'https://www.baidu.com/',
|
|
||||||
success: function (res) {
|
|
||||||
console.log("success:" + JSON.stringify(res));
|
|
||||||
},
|
|
||||||
fail: function (err) {
|
|
||||||
console.log("fail:" + JSON.stringify(err));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
//#ifdef APP-ANDROID
|
|
||||||
import {
|
|
||||||
registerRequestPermissionTipsListener,
|
|
||||||
unregisterRequestPermissionTipsListener,
|
|
||||||
setRequestPermissionTips
|
|
||||||
} from "@/uni_modules/uni-registerRequestPermissionTips"
|
|
||||||
|
|
||||||
const PermissionTips = {
|
|
||||||
"android.permission.READ_PHONE_STATE": "<h4 style=\"font-size:40px;\">正在读取网络状态权限</h4><font color=#cccccc>通讯录权限不会获取任何信息,请注意通讯录权限不会获取任何信息,请注意通讯录权限不会获取任何信息,请注意</font>",
|
|
||||||
"android.permission.CAMERA": "<h4 style=\"font-size:40px;\">正在访问相机权限</h4><font color=#cccccc>需要扫描二维码或拍照,是否允许打开相机?</font>",
|
|
||||||
"android.permission.WRITE_EXTERNAL_STORAGE": "<h4 style=\"font-size:40px;\">正在读取相册权限</h4><font color=#cccccc>我们需要获取访问您设备相册的权限,以便您能够选择并上传图片或视频到我们的应用中。</font>",
|
|
||||||
"android.permission.ACCESS_FINE_LOCATION": "<h4 style=\"font-size:40px;\">正在访问位置权限</h4><font color=#cccccc>需要获取您的位置信息,以便您能够进行考勤打卡。</font>",
|
|
||||||
"android.permission.ACCESS_COARSE_LOCATION": "<h4 style=\"font-size:40px;\">正在访问位置权限</h4><font color=#cccccc>需要获取您的位置信息,以便您能够进行考勤打卡。</font>"
|
|
||||||
}
|
|
||||||
onExit(() => {
|
|
||||||
unregisterRequestPermissionTipsListener()
|
|
||||||
})
|
|
||||||
|
|
||||||
const brand = uni.getSystemInfoSync().deviceBrand
|
|
||||||
setRequestPermissionTips(PermissionTips)
|
|
||||||
registerRequestPermissionTipsListener({
|
|
||||||
onRequest: (e) => {
|
|
||||||
console.log('onRequest', e)
|
|
||||||
},
|
|
||||||
onConfirm: (e) => {
|
|
||||||
// commun.sendToH5('permission-application', { action: 'open-permission', data: e });
|
|
||||||
},
|
|
||||||
onComplete: (e) => {
|
|
||||||
commun.sendToH5('permission-application', { action: 'close-permission', data: e });
|
|
||||||
|
|
||||||
// 华为手机在权限禁止之后,再次申请权限不会出现权限申请框。此时应该引导用户去系统设置开启此权限,不应该频繁申请。
|
|
||||||
if (brand.toLowerCase() === "huawei") {
|
|
||||||
const tips = {}
|
|
||||||
let hasDeniedPermission = false
|
|
||||||
for (let k in PermissionTips) {
|
|
||||||
if (e[k] !== "denied") {
|
|
||||||
tips[k] = PermissionTips[k]
|
|
||||||
} else {
|
|
||||||
hasDeniedPermission = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
setRequestPermissionTips(tips) // 更新弹框提醒,防止华为手机不出现权限申请框时权限提醒框闪烁的情况
|
|
||||||
if (hasDeniedPermission)
|
|
||||||
uni.showModal({
|
|
||||||
content: "权限已经被拒绝,请前往设置中开启"
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
//#endif
|
|
||||||
const webLoad = (e) => {
|
|
||||||
const message = e.detail.data?.[0] || '';
|
|
||||||
commun.handleMessage(message);
|
|
||||||
};
|
|
||||||
function initializeWebView() {
|
|
||||||
const currentWebview = getCurrentPages().pop().$getAppWebview()
|
|
||||||
commun.setWebView(currentWebview.children()[0])
|
|
||||||
}
|
|
||||||
//load-complete 注册函数
|
|
||||||
commun.registerHandler('load-complete', () => {
|
|
||||||
|
|
||||||
initializeWebView()
|
|
||||||
const { statusBarHeight } = uni.getSystemInfoSync()
|
|
||||||
commun.webViewObj.setStyle({
|
|
||||||
top: statusBarHeight,
|
|
||||||
bottom: 0,
|
|
||||||
})
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
commun.registerHandler('getLocation', (data) => {
|
|
||||||
uni.getLocation({
|
|
||||||
type: 'gcj02',
|
|
||||||
geocode: true,
|
|
||||||
isHighAccuracy: true,
|
|
||||||
...data,
|
|
||||||
success: (res) => {
|
|
||||||
console.log('getLocation', res)
|
|
||||||
commun.sendToH5('getLocation', res);
|
|
||||||
},
|
|
||||||
})
|
|
||||||
})
|
|
||||||
commun.registerHandler('goCard', async (data) => {
|
|
||||||
await getCard(data.phone)
|
|
||||||
})
|
|
||||||
|
|
||||||
commun.registerHandler('createPushMessage', async (data) => {
|
|
||||||
uni.createPushMessage(JSON.parse(decodeURIComponent(data)))
|
|
||||||
})
|
|
||||||
|
|
||||||
// 获取电子名片
|
|
||||||
async function getCard(phone) {
|
|
||||||
uni.request({
|
|
||||||
url: 'https://blockchain.szjixun.cn/api/e_card/info-phone',
|
|
||||||
method: 'POST',
|
|
||||||
data: {
|
|
||||||
phone: phone
|
|
||||||
},
|
|
||||||
success: (res) => {
|
|
||||||
const resData = res.data.data
|
|
||||||
uni.share({
|
|
||||||
provider: 'weixin',
|
|
||||||
scene: "WXSceneSession",
|
|
||||||
type: 5,// 5代表分享为小程序
|
|
||||||
imageUrl: 'https://e-cdn.fontree.cn/fonchain-main/prod/image/139/avatar/ababc42c-7654-47f8-b22b-29dc589c71f0.png', // 必填
|
|
||||||
title: `${resData.name}的电子名片`,
|
|
||||||
miniProgram: {
|
|
||||||
id: "gh_97094c34debd",
|
|
||||||
path: `/pages/mine/index?uid=${resData.uid}&userType=${resData.userType}`,
|
|
||||||
type: 0,
|
|
||||||
webUrl: `/pages/mine/index?uid=${resData.uid}&userType=${resData.userType}`,
|
|
||||||
},
|
|
||||||
success: function (res) {
|
|
||||||
console.log("success:" + JSON.stringify(res));
|
|
||||||
},
|
|
||||||
fail: function (err) {
|
|
||||||
console.log("fail:" + JSON.stringify(err));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
fail: (err) => {
|
|
||||||
console.log('getCard', err)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style></style>
|
|
@ -1,11 +0,0 @@
|
|||||||
<template>
|
|
||||||
<uvNoNetwork></uvNoNetwork>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import uvNoNetwork from "../../uni_modules/uv-no-network/components/uv-no-network/uv-no-network.vue";
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
|
|
||||||
</style>
|
|
Before Width: | Height: | Size: 175 KiB |
Before Width: | Height: | Size: 227 KiB |
Before Width: | Height: | Size: 525 KiB |
Before Width: | Height: | Size: 226 KiB |
10
uni.promisify.adaptor.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
uni.addInterceptor({
|
||||||
|
returnValue (res) {
|
||||||
|
if (!(!!res && (typeof res === "object" || typeof res === "function") && typeof res.then === "function")) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
res.then((res) => res[0] ? reject(res[0]) : resolve(res[1]));
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
@ -1,8 +0,0 @@
|
|||||||
// 简单的使用示例
|
|
||||||
'use strict';
|
|
||||||
const uniPush = uniCloud.getPushManager({appId:"__UNI__4796942"}) //注意这里需要传入你的应用appId
|
|
||||||
exports.main = async (event) => {
|
|
||||||
const obj = JSON.parse(event.body)
|
|
||||||
const res = await uniPush.sendMessage(obj)
|
|
||||||
return res;
|
|
||||||
};
|
|
@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "uni-cloud-push",
|
|
||||||
"dependencies": {},
|
|
||||||
"extensions": {
|
|
||||||
"uni-cloud-jql": {},
|
|
||||||
"uni-cloud-push": {}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
// 本文件用于,使用JQL语法操作项目关联的uniCloud空间的数据库,方便开发调试和远程数据库管理
|
|
||||||
// 编写clientDB的js API(也支持常规js语法,比如var),可以对云数据库进行增删改查操作。不支持uniCloud-db组件写法
|
|
||||||
// 可以全部运行,也可以选中部分代码运行。点击工具栏上的运行按钮或者按下【F5】键运行代码
|
|
||||||
// 如果文档中存在多条JQL语句,只有最后一条语句生效
|
|
||||||
// 如果混写了普通js,最后一条语句需是数据库操作语句
|
|
||||||
// 此处代码运行不受DB Schema的权限控制,移植代码到实际业务中注意在schema中配好permission
|
|
||||||
// 不支持clientDB的action
|
|
||||||
// 数据库查询有最大返回条数限制,详见:https://uniapp.dcloud.net.cn/uniCloud/cf-database.html#limit
|
|
||||||
// 详细JQL语法,请参考:https://uniapp.dcloud.net.cn/uniCloud/jql.html
|
|
||||||
|
|
||||||
// 下面示例查询uni-id-users表的所有数据
|
|
||||||
db.collection('uni-id-users').get();
|
|
@ -1,14 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"IndexName": "index_device_id",
|
|
||||||
"MgoKeySchema": {
|
|
||||||
"MgoIndexKeys": [
|
|
||||||
{
|
|
||||||
"Name": "device_id",
|
|
||||||
"Direction": "1"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"MgoIsUnique": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
@ -1,142 +0,0 @@
|
|||||||
{
|
|
||||||
"bsonType": "object",
|
|
||||||
"required": [],
|
|
||||||
"permission": {
|
|
||||||
"read": false,
|
|
||||||
"create": false,
|
|
||||||
"update": false,
|
|
||||||
"delete": false
|
|
||||||
},
|
|
||||||
"properties": {
|
|
||||||
"_id": {
|
|
||||||
"description": "ID,系统自动生成"
|
|
||||||
},
|
|
||||||
"appid": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "DCloud appid"
|
|
||||||
},
|
|
||||||
"device_id": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "设备唯一标识"
|
|
||||||
},
|
|
||||||
"vendor": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "设备厂商"
|
|
||||||
},
|
|
||||||
"push_clientid": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "推送设备客户端标识"
|
|
||||||
},
|
|
||||||
"imei": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "国际移动设备识别码IMEI(International Mobile Equipment Identity)"
|
|
||||||
},
|
|
||||||
"oaid": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "移动智能设备标识公共服务平台提供的匿名设备标识符(OAID)"
|
|
||||||
},
|
|
||||||
"idfa": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "iOS平台配置应用使用广告标识(IDFA)"
|
|
||||||
},
|
|
||||||
"imsi": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "国际移动用户识别码(International Mobile Subscriber Identification Number)"
|
|
||||||
},
|
|
||||||
"model": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "设备型号"
|
|
||||||
},
|
|
||||||
"platform": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "平台类型"
|
|
||||||
},
|
|
||||||
"uni_platform": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "uni-app 运行平台,与条件编译平台相同。"
|
|
||||||
},
|
|
||||||
"os_name": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "ios|android|windows|mac|linux "
|
|
||||||
},
|
|
||||||
"os_version": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "操作系统版本号 "
|
|
||||||
},
|
|
||||||
"os_language": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "操作系统语言 "
|
|
||||||
},
|
|
||||||
"os_theme": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "操作系统主题 light|dark"
|
|
||||||
},
|
|
||||||
"pixel_ratio": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "设备像素比 "
|
|
||||||
},
|
|
||||||
"network_model": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "设备网络型号wifi/3G/4G/"
|
|
||||||
},
|
|
||||||
"window_width": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "设备窗口宽度 "
|
|
||||||
},
|
|
||||||
"window_height": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "设备窗口高度"
|
|
||||||
},
|
|
||||||
"screen_width": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "设备屏幕宽度"
|
|
||||||
},
|
|
||||||
"screen_height": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "设备屏幕高度"
|
|
||||||
},
|
|
||||||
"rom_name": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "rom 名称"
|
|
||||||
},
|
|
||||||
"rom_version": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "rom 版本"
|
|
||||||
},
|
|
||||||
"location_latitude": {
|
|
||||||
"bsonType": "double",
|
|
||||||
"description": "纬度"
|
|
||||||
},
|
|
||||||
"location_longitude": {
|
|
||||||
"bsonType": "double",
|
|
||||||
"description": "经度"
|
|
||||||
},
|
|
||||||
"location_country": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "国家"
|
|
||||||
},
|
|
||||||
"location_province": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "省份"
|
|
||||||
},
|
|
||||||
"location_city": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "城市"
|
|
||||||
},
|
|
||||||
"create_date": {
|
|
||||||
"bsonType": "timestamp",
|
|
||||||
"description": "创建时间",
|
|
||||||
"forceDefaultValue": {
|
|
||||||
"$env": "now"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"last_update_date": {
|
|
||||||
"bsonType": "timestamp",
|
|
||||||
"description": "最后一次修改时间",
|
|
||||||
"forceDefaultValue": {
|
|
||||||
"$env": "now"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"version": "0.0.1"
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
{
|
|
||||||
"bsonType": "object",
|
|
||||||
"required": [
|
|
||||||
"value",
|
|
||||||
"expired"
|
|
||||||
],
|
|
||||||
"permission": {
|
|
||||||
"read": false,
|
|
||||||
"create": false,
|
|
||||||
"update": false,
|
|
||||||
"delete": false
|
|
||||||
},
|
|
||||||
"properties": {
|
|
||||||
"_id": {
|
|
||||||
"description": "ID,系统自动生成"
|
|
||||||
},
|
|
||||||
"value": {
|
|
||||||
"description": "值"
|
|
||||||
},
|
|
||||||
"expired": {
|
|
||||||
"description": "过期时间",
|
|
||||||
"bsonType": "timestamp"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"version": "0.0.1"
|
|
||||||
}
|
|
@ -1,38 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"IndexName": "device_id",
|
|
||||||
"MgoKeySchema": {
|
|
||||||
"MgoIndexKeys": [
|
|
||||||
{
|
|
||||||
"Name": "device_id",
|
|
||||||
"Direction": "1"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"MgoIsUnique": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"IndexName": "oaid",
|
|
||||||
"MgoKeySchema": {
|
|
||||||
"MgoIndexKeys": [
|
|
||||||
{
|
|
||||||
"Name": "oaid",
|
|
||||||
"Direction": "1"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"MgoIsUnique": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"IndexName": "imei",
|
|
||||||
"MgoKeySchema": {
|
|
||||||
"MgoIndexKeys": [
|
|
||||||
{
|
|
||||||
"Name": "imei",
|
|
||||||
"Direction": "1"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"MgoIsUnique": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
@ -1,87 +0,0 @@
|
|||||||
{
|
|
||||||
"bsonType": "object",
|
|
||||||
"required": [
|
|
||||||
"user_id"
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"_id": {
|
|
||||||
"description": "ID,系统自动生成"
|
|
||||||
},
|
|
||||||
"user_id": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "用户id,参考uni-id-users表"
|
|
||||||
},
|
|
||||||
"ua": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "userAgent"
|
|
||||||
},
|
|
||||||
"uuid": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "设备唯一标识(需要加密存储)"
|
|
||||||
},
|
|
||||||
"os_name": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "ios|android|windows|mac|linux "
|
|
||||||
},
|
|
||||||
"os_version": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "操作系统版本号 "
|
|
||||||
},
|
|
||||||
"os_language": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "操作系统语言 "
|
|
||||||
},
|
|
||||||
"os_theme": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "操作系统主题 light|dark"
|
|
||||||
},
|
|
||||||
"vendor": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "设备厂商"
|
|
||||||
},
|
|
||||||
"push_clientid": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "推送设备客户端标识"
|
|
||||||
},
|
|
||||||
"device_id": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "设备id"
|
|
||||||
},
|
|
||||||
"imei": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "国际移动设备识别码IMEI(International Mobile Equipment Identity)"
|
|
||||||
},
|
|
||||||
"oaid": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "移动智能设备标识公共服务平台提供的匿名设备标识符(OAID)"
|
|
||||||
},
|
|
||||||
"idfa": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "iOS平台配置应用使用广告标识(IDFA)"
|
|
||||||
},
|
|
||||||
"model": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "设备型号"
|
|
||||||
},
|
|
||||||
"platform": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "平台类型"
|
|
||||||
},
|
|
||||||
"create_date": {
|
|
||||||
"bsonType": "timestamp",
|
|
||||||
"description": "创建时间",
|
|
||||||
"forceDefaultValue": {
|
|
||||||
"$env": "now"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"last_active_date": {
|
|
||||||
"bsonType": "timestamp",
|
|
||||||
"description": "最后登录时间"
|
|
||||||
},
|
|
||||||
"last_active_ip": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "最后登录IP"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"version": "0.0.1"
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
## 0.0.3(2022-11-11)
|
|
||||||
- 修复 config 方法获取根节点为数组格式配置时错误的转化为了对象的Bug
|
|
||||||
## 0.0.2(2021-04-16)
|
|
||||||
- 修改插件package信息
|
|
||||||
## 0.0.1(2021-03-15)
|
|
||||||
- 初始化项目
|
|
@ -1,81 +0,0 @@
|
|||||||
{
|
|
||||||
"id": "uni-config-center",
|
|
||||||
"displayName": "uni-config-center",
|
|
||||||
"version": "0.0.3",
|
|
||||||
"description": "uniCloud 配置中心",
|
|
||||||
"keywords": [
|
|
||||||
"配置",
|
|
||||||
"配置中心"
|
|
||||||
],
|
|
||||||
"repository": "",
|
|
||||||
"engines": {
|
|
||||||
"HBuilderX": "^3.1.0"
|
|
||||||
},
|
|
||||||
"dcloudext": {
|
|
||||||
"sale": {
|
|
||||||
"regular": {
|
|
||||||
"price": "0.00"
|
|
||||||
},
|
|
||||||
"sourcecode": {
|
|
||||||
"price": "0.00"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"contact": {
|
|
||||||
"qq": ""
|
|
||||||
},
|
|
||||||
"declaration": {
|
|
||||||
"ads": "无",
|
|
||||||
"data": "无",
|
|
||||||
"permissions": "无"
|
|
||||||
},
|
|
||||||
"npmurl": "",
|
|
||||||
"type": "unicloud-template-function"
|
|
||||||
},
|
|
||||||
"directories": {
|
|
||||||
"example": "../../../scripts/dist"
|
|
||||||
},
|
|
||||||
"uni_modules": {
|
|
||||||
"dependencies": [],
|
|
||||||
"encrypt": [],
|
|
||||||
"platforms": {
|
|
||||||
"cloud": {
|
|
||||||
"tcb": "y",
|
|
||||||
"aliyun": "y"
|
|
||||||
},
|
|
||||||
"client": {
|
|
||||||
"App": {
|
|
||||||
"app-vue": "u",
|
|
||||||
"app-nvue": "u"
|
|
||||||
},
|
|
||||||
"H5-mobile": {
|
|
||||||
"Safari": "u",
|
|
||||||
"Android Browser": "u",
|
|
||||||
"微信浏览器(Android)": "u",
|
|
||||||
"QQ浏览器(Android)": "u"
|
|
||||||
},
|
|
||||||
"H5-pc": {
|
|
||||||
"Chrome": "u",
|
|
||||||
"IE": "u",
|
|
||||||
"Edge": "u",
|
|
||||||
"Firefox": "u",
|
|
||||||
"Safari": "u"
|
|
||||||
},
|
|
||||||
"小程序": {
|
|
||||||
"微信": "u",
|
|
||||||
"阿里": "u",
|
|
||||||
"百度": "u",
|
|
||||||
"字节跳动": "u",
|
|
||||||
"QQ": "u"
|
|
||||||
},
|
|
||||||
"快应用": {
|
|
||||||
"华为": "u",
|
|
||||||
"联盟": "u"
|
|
||||||
},
|
|
||||||
"Vue": {
|
|
||||||
"vue2": "y",
|
|
||||||
"vue3": "u"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,93 +0,0 @@
|
|||||||
# 为什么使用uni-config-center
|
|
||||||
|
|
||||||
实际开发中很多插件需要配置文件才可以正常运行,如果每个插件都单独进行配置的话就会产生下面这样的目录结构
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cloudfunctions
|
|
||||||
└─────common 公共模块
|
|
||||||
├─plugin-a // 插件A对应的目录
|
|
||||||
│ ├─index.js
|
|
||||||
│ ├─config.json // plugin-a对应的配置文件
|
|
||||||
│ └─other-file.cert // plugin-a依赖的其他文件
|
|
||||||
└─plugin-b // plugin-b对应的目录
|
|
||||||
├─index.js
|
|
||||||
└─config.json // plugin-b对应的配置文件
|
|
||||||
```
|
|
||||||
|
|
||||||
假设插件作者要发布一个项目模板,里面使用了很多需要配置的插件,无论是作者发布还是用户使用都是一个大麻烦。
|
|
||||||
|
|
||||||
uni-config-center就是用了统一管理这些配置文件的,使用uni-config-center后的目录结构如下
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cloudfunctions
|
|
||||||
└─────common 公共模块
|
|
||||||
├─plugin-a // 插件A对应的目录
|
|
||||||
│ └─index.js
|
|
||||||
├─plugin-b // plugin-b对应的目录
|
|
||||||
│ └─index.js
|
|
||||||
└─uni-config-center
|
|
||||||
├─index.js // config-center入口文件
|
|
||||||
├─plugin-a
|
|
||||||
│ ├─config.json // plugin-a对应的配置文件
|
|
||||||
│ └─other-file.cert // plugin-a依赖的其他文件
|
|
||||||
└─plugin-b
|
|
||||||
└─config.json // plugin-b对应的配置文件
|
|
||||||
```
|
|
||||||
|
|
||||||
使用uni-config-center后的优势
|
|
||||||
|
|
||||||
- 配置文件统一管理,分离插件主体和配置信息,更新插件更方便
|
|
||||||
- 支持对config.json设置schema,插件使用者在HBuilderX内编写config.json文件时会有更好的提示(后续HBuilderX会提供支持)
|
|
||||||
|
|
||||||
# 用法
|
|
||||||
|
|
||||||
在要使用uni-config-center的公共模块或云函数内引入uni-config-center依赖,请参考:[使用公共模块](https://uniapp.dcloud.net.cn/uniCloud/cf-common)
|
|
||||||
|
|
||||||
```js
|
|
||||||
const createConfig = require('uni-config-center')
|
|
||||||
|
|
||||||
const uniIdConfig = createConfig({
|
|
||||||
pluginId: 'uni-id', // 插件id
|
|
||||||
defaultConfig: { // 默认配置
|
|
||||||
tokenExpiresIn: 7200,
|
|
||||||
tokenExpiresThreshold: 600,
|
|
||||||
},
|
|
||||||
customMerge: function(defaultConfig, userConfig) { // 自定义默认配置和用户配置的合并规则,不设置的情况侠会对默认配置和用户配置进行深度合并
|
|
||||||
// defaudltConfig 默认配置
|
|
||||||
// userConfig 用户配置
|
|
||||||
return Object.assign(defaultConfig, userConfig)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
// 以如下配置为例
|
|
||||||
// {
|
|
||||||
// "tokenExpiresIn": 7200,
|
|
||||||
// "passwordErrorLimit": 6,
|
|
||||||
// "bindTokenToDevice": false,
|
|
||||||
// "passwordErrorRetryTime": 3600,
|
|
||||||
// "app-plus": {
|
|
||||||
// "tokenExpiresIn": 2592000
|
|
||||||
// },
|
|
||||||
// "service": {
|
|
||||||
// "sms": {
|
|
||||||
// "codeExpiresIn": 300
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 获取配置
|
|
||||||
uniIdConfig.config() // 获取全部配置,注意:uni-config-center内不存在对应插件目录时会返回空对象
|
|
||||||
uniIdConfig.config('tokenExpiresIn') // 指定键值获取配置,返回:7200
|
|
||||||
uniIdConfig.config('service.sms.codeExpiresIn') // 指定键值获取配置,返回:300
|
|
||||||
uniIdConfig.config('tokenExpiresThreshold', 600) // 指定键值获取配置,如果不存在则取传入的默认值,返回:600
|
|
||||||
|
|
||||||
// 获取文件绝对路径
|
|
||||||
uniIdConfig.resolve('custom-token.js') // 获取uni-config-center/uni-id/custom-token.js文件的路径
|
|
||||||
|
|
||||||
// 引用文件(require)
|
|
||||||
uniIDConfig.requireFile('custom-token.js') // 使用require方式引用uni-config-center/uni-id/custom-token.js文件。文件不存在时返回undefined,文件内有其他错误导致require失败时会抛出错误。
|
|
||||||
|
|
||||||
// 判断是否包含某文件
|
|
||||||
uniIDConfig.hasFile('custom-token.js') // 配置目录是否包含某文件,true: 文件存在,false: 文件不存在
|
|
||||||
```
|
|
@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "uni-config-center",
|
|
||||||
"version": "0.0.3",
|
|
||||||
"description": "配置中心",
|
|
||||||
"main": "index.js",
|
|
||||||
"keywords": [],
|
|
||||||
"author": "DCloud",
|
|
||||||
"license": "Apache-2.0"
|
|
||||||
}
|
|
@ -1,34 +0,0 @@
|
|||||||
## 1.0.17(2024-04-26)
|
|
||||||
- 兼容uni-app-x对客户端uniPlatform的调整(uni-app-x内uniPlatform区分app-android、app-ios)
|
|
||||||
## 1.0.16(2023-04-25)
|
|
||||||
- 新增maxTokenLength配置,用于限制数据库用户记录token数组的最大长度
|
|
||||||
## 1.0.15(2023-04-06)
|
|
||||||
- 修复部分语言国际化出错的Bug
|
|
||||||
## 1.0.14(2023-03-07)
|
|
||||||
- 修复 admin用户包含其他角色时未包含在token的Bug
|
|
||||||
## 1.0.13(2022-07-21)
|
|
||||||
- 修复 创建token时未传角色权限信息生成的token不正确的bug
|
|
||||||
## 1.0.12(2022-07-15)
|
|
||||||
- 提升与旧版本uni-id的兼容性(补充读取配置文件时回退平台app-plus、h5),但是仍推荐使用新平台名进行配置(app、web)
|
|
||||||
## 1.0.11(2022-07-14)
|
|
||||||
- 修复 部分情况下报`read property 'reduce' of undefined`的错误
|
|
||||||
## 1.0.10(2022-07-11)
|
|
||||||
- 将token存储在用户表的token字段内,与旧版本uni-id保持一致
|
|
||||||
## 1.0.9(2022-07-01)
|
|
||||||
- checkToken兼容token内未缓存角色权限的情况,此时将查库获取角色权限
|
|
||||||
## 1.0.8(2022-07-01)
|
|
||||||
- 修复clientDB默认依赖时部分情况下获取不到uni-id配置的Bug
|
|
||||||
## 1.0.7(2022-06-30)
|
|
||||||
- 修复config文件不合法时未抛出具体错误的Bug
|
|
||||||
## 1.0.6(2022-06-28)
|
|
||||||
- 移除插件内的数据表schema
|
|
||||||
## 1.0.5(2022-06-27)
|
|
||||||
- 修复使用多应用配置时报`Cannot read property 'appId' of undefined`的Bug
|
|
||||||
## 1.0.4(2022-06-27)
|
|
||||||
- 修复使用自定义token内容功能报错的Bug [详情](https://ask.dcloud.net.cn/question/147945)
|
|
||||||
## 1.0.2(2022-06-23)
|
|
||||||
- 对齐旧版本uni-id默认配置
|
|
||||||
## 1.0.1(2022-06-22)
|
|
||||||
- 补充对uni-config-center的依赖
|
|
||||||
## 1.0.0(2022-06-21)
|
|
||||||
- 提供uni-id token创建、校验、刷新接口,简化旧版uni-id公共模块
|
|
@ -1,85 +0,0 @@
|
|||||||
{
|
|
||||||
"id": "uni-id-common",
|
|
||||||
"displayName": "uni-id-common",
|
|
||||||
"version": "1.0.17",
|
|
||||||
"description": "包含uni-id token生成、校验、刷新功能的云函数公共模块",
|
|
||||||
"keywords": [
|
|
||||||
"uni-id-common",
|
|
||||||
"uniCloud",
|
|
||||||
"token",
|
|
||||||
"权限"
|
|
||||||
],
|
|
||||||
"repository": "https://gitcode.net/dcloud/uni-id-common",
|
|
||||||
"engines": {
|
|
||||||
"HBuilderX": "^3.1.0"
|
|
||||||
},
|
|
||||||
"dcloudext": {
|
|
||||||
"sale": {
|
|
||||||
"regular": {
|
|
||||||
"price": "0.00"
|
|
||||||
},
|
|
||||||
"sourcecode": {
|
|
||||||
"price": "0.00"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"contact": {
|
|
||||||
"qq": ""
|
|
||||||
},
|
|
||||||
"declaration": {
|
|
||||||
"ads": "无",
|
|
||||||
"data": "无",
|
|
||||||
"permissions": "无"
|
|
||||||
},
|
|
||||||
"npmurl": "",
|
|
||||||
"type": "unicloud-template-function"
|
|
||||||
},
|
|
||||||
"uni_modules": {
|
|
||||||
"dependencies": ["uni-config-center"],
|
|
||||||
"encrypt": [],
|
|
||||||
"platforms": {
|
|
||||||
"cloud": {
|
|
||||||
"tcb": "y",
|
|
||||||
"aliyun": "y",
|
|
||||||
"alipay": "n"
|
|
||||||
},
|
|
||||||
"client": {
|
|
||||||
"Vue": {
|
|
||||||
"vue2": "u",
|
|
||||||
"vue3": "u"
|
|
||||||
},
|
|
||||||
"App": {
|
|
||||||
"app-vue": "u",
|
|
||||||
"app-nvue": "u"
|
|
||||||
},
|
|
||||||
"H5-mobile": {
|
|
||||||
"Safari": "u",
|
|
||||||
"Android Browser": "u",
|
|
||||||
"微信浏览器(Android)": "u",
|
|
||||||
"QQ浏览器(Android)": "u"
|
|
||||||
},
|
|
||||||
"H5-pc": {
|
|
||||||
"Chrome": "u",
|
|
||||||
"IE": "u",
|
|
||||||
"Edge": "u",
|
|
||||||
"Firefox": "u",
|
|
||||||
"Safari": "u"
|
|
||||||
},
|
|
||||||
"小程序": {
|
|
||||||
"微信": "u",
|
|
||||||
"阿里": "u",
|
|
||||||
"百度": "u",
|
|
||||||
"字节跳动": "u",
|
|
||||||
"QQ": "u",
|
|
||||||
"钉钉": "u",
|
|
||||||
"快手": "u",
|
|
||||||
"飞书": "u",
|
|
||||||
"京东": "u"
|
|
||||||
},
|
|
||||||
"快应用": {
|
|
||||||
"华为": "u",
|
|
||||||
"联盟": "u"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
# uni-id-common
|
|
||||||
|
|
||||||
文档请参考:[uni-id-common](https://uniapp.dcloud.net.cn/uniCloud/uni-id-common.html)
|
|
@ -1,16 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "uni-id-common",
|
|
||||||
"version": "1.0.17",
|
|
||||||
"description": "uni-id token生成、校验、刷新",
|
|
||||||
"main": "index.js",
|
|
||||||
"homepage": "https://uniapp.dcloud.io/uniCloud/uni-id-common.html",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://gitee.com/dcloud/uni-id-common.git"
|
|
||||||
},
|
|
||||||
"author": "DCloud",
|
|
||||||
"license": "Apache-2.0",
|
|
||||||
"dependencies": {
|
|
||||||
"uni-config-center": "file:../../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
## 1.0.1(2024-05-30)
|
|
||||||
修复云打包可能报错的bug
|
|
||||||
## 1.0.0(2024-03-09)
|
|
||||||
支持全局监听权限申请。当申请权限时,会在页面顶部显示申请权限的目的。
|
|
@ -1,114 +0,0 @@
|
|||||||
{
|
|
||||||
"id": "uni-registerRequestPermissionTips",
|
|
||||||
"displayName": "uni-registerRequestPermissionTips",
|
|
||||||
"version": "1.0.1",
|
|
||||||
"description": "支持android平台全局监听权限的申请。当申请权限时,会在页面顶部显示申请权限的目的。主要解决上架华为应用市场审核要求:APP在调用终端权限时,应同步告知用户申请该权限的目的。",
|
|
||||||
"keywords": [
|
|
||||||
"权限",
|
|
||||||
"权限申请",
|
|
||||||
"上架",
|
|
||||||
"华为"
|
|
||||||
],
|
|
||||||
"repository": "",
|
|
||||||
"engines": {
|
|
||||||
"HBuilderX": "^4.0"
|
|
||||||
},
|
|
||||||
"dcloudext": {
|
|
||||||
"type": "uts",
|
|
||||||
"sale": {
|
|
||||||
"regular": {
|
|
||||||
"price": "0.00"
|
|
||||||
},
|
|
||||||
"sourcecode": {
|
|
||||||
"price": "0.00"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"contact": {
|
|
||||||
"qq": ""
|
|
||||||
},
|
|
||||||
"declaration": {
|
|
||||||
"ads": "无",
|
|
||||||
"data": "无",
|
|
||||||
"permissions": "无"
|
|
||||||
},
|
|
||||||
"npmurl": ""
|
|
||||||
},
|
|
||||||
"uni_modules": {
|
|
||||||
"dependencies": [
|
|
||||||
],
|
|
||||||
"uni-ext-api": {
|
|
||||||
"uni": {
|
|
||||||
"registerRequestPermissionTipsListener": {
|
|
||||||
"name": "registerRequestPermissionTipsListener",
|
|
||||||
"app": {
|
|
||||||
"js": false,
|
|
||||||
"kotlin": true,
|
|
||||||
"swift": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"unregisterRequestPermissionTipsListener": {
|
|
||||||
"name": "unregisterRequestPermissionTipsListener",
|
|
||||||
"app": {
|
|
||||||
"js": false,
|
|
||||||
"kotlin": true,
|
|
||||||
"swift": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"setRequestPermissionTips": {
|
|
||||||
"name": "setRequestPermissionTips",
|
|
||||||
"app": {
|
|
||||||
"js": false,
|
|
||||||
"kotlin": true,
|
|
||||||
"swift": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"encrypt": [],
|
|
||||||
"platforms": {
|
|
||||||
"cloud": {
|
|
||||||
"tcb": "y",
|
|
||||||
"aliyun": "y",
|
|
||||||
"alipay": "y"
|
|
||||||
},
|
|
||||||
"client": {
|
|
||||||
"Vue": {
|
|
||||||
"vue2": "y",
|
|
||||||
"vue3": "y"
|
|
||||||
},
|
|
||||||
"App": {
|
|
||||||
"app-android": "y",
|
|
||||||
"app-ios": "n"
|
|
||||||
},
|
|
||||||
"H5-mobile": {
|
|
||||||
"Safari": "n",
|
|
||||||
"Android Browser": "n",
|
|
||||||
"微信浏览器(Android)": "n",
|
|
||||||
"QQ浏览器(Android)": "n"
|
|
||||||
},
|
|
||||||
"H5-pc": {
|
|
||||||
"Chrome": "n",
|
|
||||||
"IE": "n",
|
|
||||||
"Edge": "n",
|
|
||||||
"Firefox": "n",
|
|
||||||
"Safari": "n"
|
|
||||||
},
|
|
||||||
"小程序": {
|
|
||||||
"微信": "n",
|
|
||||||
"阿里": "n",
|
|
||||||
"百度": "n",
|
|
||||||
"字节跳动": "n",
|
|
||||||
"QQ": "n",
|
|
||||||
"钉钉": "n",
|
|
||||||
"快手": "n",
|
|
||||||
"飞书": "n",
|
|
||||||
"京东": "n"
|
|
||||||
},
|
|
||||||
"快应用": {
|
|
||||||
"华为": "n",
|
|
||||||
"联盟": "n"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,95 +0,0 @@
|
|||||||
## registerRequestPermissionTipsListener(listener?)
|
|
||||||
注册权限监听事件
|
|
||||||
## unregisterRequestPermissionTipsListener(listener?)
|
|
||||||
取消注册权限监听事件
|
|
||||||
|
|
||||||
## RequestPermissionTipsListener的属性值
|
|
||||||
|名称 |类型 |描述 |必填 |
|
|
||||||
|:-- |:-- |:-- |:-- |
|
|
||||||
|onRequest |(permissions:Array<string>)=>void |申请系统权限回调,permissions为触发权限申请的所有权限 |否 |
|
|
||||||
|onConfirm |(permissions:Array<string>)=>void |弹出系统权限授权框回调,permissions为触发弹出权限授权框的所有权限 |否 |
|
|
||||||
|onComplete |(permissions:UTSJSONObject)=>void |权限申请完成回调,permissions包括权限及权限的状态。`grant`为权限已获取,`denied`为权限已拒绝 |否 |
|
|
||||||
|
|
||||||
## setRequestPermissionTips(UTSJSONObject)
|
|
||||||
设置权限监听的说明。支持针对权限设置具体的说明。
|
|
||||||
|
|
||||||
参考:`{"android.permission.CAMERA":"<p>相机权限申请说明</p>"}`
|
|
||||||
|
|
||||||
安卓权限列表可参考[谷歌官方文档](https://developer.android.com/reference/android/Manifest.permission)。
|
|
||||||
|
|
||||||
权限申请说明基于原生TextView实现,可以实现加载html内容,支持的标签及属性可参考:
|
|
||||||
```
|
|
||||||
<b> 或 <strong>:加粗文本。
|
|
||||||
<i> 或 <em>:斜体文本。
|
|
||||||
<u>:下划线文本。
|
|
||||||
<sup>:上标文本。
|
|
||||||
<sub>:下标文本。
|
|
||||||
<tt>:等宽字体文本。
|
|
||||||
<big>:放大字体。
|
|
||||||
<small>:缩小字体。
|
|
||||||
<strike> 或 <s> 或 <del>:带有删除线的文本。
|
|
||||||
<p>:段落。
|
|
||||||
<div>:块级容器。
|
|
||||||
<h1>,<h2>,<h3>,<h4>,<h5>,<h6>:区域标题元素。
|
|
||||||
<ul>, <ol>, <li>:无序列表和有序列表。
|
|
||||||
<br>:换行。
|
|
||||||
<font color="..."> 和 <font size="...">:设置文本颜色和大小。
|
|
||||||
```
|
|
||||||
|
|
||||||
## 示例
|
|
||||||
|
|
||||||
```
|
|
||||||
<script>
|
|
||||||
import {
|
|
||||||
registerRequestPermissionTipsListener,
|
|
||||||
unregisterRequestPermissionTipsListener,
|
|
||||||
setRequestPermissionTips
|
|
||||||
} from "@/uni_modules/uni-registerRequestPermissionTips"
|
|
||||||
var PermissionTips = {
|
|
||||||
"android.permission.CAMERA": "<h4 style=\"font-size:40px;\">正在读取通讯录权限</h4><font color=#cccccc>通讯录权限不会获取任何信息,请注意</font>",
|
|
||||||
"android.permission.READ_PHONE_STATE": "<h4 style=\"font-size:40px;\">正在读取网络状态权限</h4><font color=#cccccc>通讯录权限不会获取任何信息,请注意通讯录权限不会获取任何信息,请注意通讯录权限不会获取任何信息,请注意</font>"
|
|
||||||
}
|
|
||||||
export default {
|
|
||||||
onLaunch: function() {
|
|
||||||
var brand = uni.getSystemInfoSync().deviceBrand
|
|
||||||
setRequestPermissionTips(PermissionTips)
|
|
||||||
registerRequestPermissionTipsListener({
|
|
||||||
onRequest: (e) => {
|
|
||||||
console.log(e)
|
|
||||||
},
|
|
||||||
onConfirm: (e) => {
|
|
||||||
console.log(e)
|
|
||||||
},
|
|
||||||
onComplete: (e) => {
|
|
||||||
// 华为手机在权限禁止之后,再次申请权限不会出现权限申请框。此时应该引导用户去系统设置开启此权限,不应该频繁申请。
|
|
||||||
if (brand.toLowerCase() == "huawei") {
|
|
||||||
var tips = {}
|
|
||||||
var hasDeniedPermission = false
|
|
||||||
for (var k in PermissionTips) {
|
|
||||||
if (e[k] != "denied") {
|
|
||||||
tips[k] = PermissionTips[k]
|
|
||||||
} else {
|
|
||||||
hasDeniedPermission = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
setRequestPermissionTips(tips) // 更新弹框提醒,防止华为手机不出现权限申请框时权限提醒框闪烁的情况
|
|
||||||
if (hasDeniedPermission)
|
|
||||||
uni.showModal({
|
|
||||||
content: "权限已经被拒绝,请前往设置中开启"
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
onShow: function() {
|
|
||||||
console.log('App Show')
|
|
||||||
},
|
|
||||||
onHide: function() {
|
|
||||||
console.log('App Hide')
|
|
||||||
},
|
|
||||||
onExit: function() {
|
|
||||||
unregisterRequestPermissionTipsListener(null)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
```
|
|
@ -1,3 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="io.dcloud.uts.permissionrequest">
|
|
||||||
</manifest>
|
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"minSdkVersion": "21"
|
|
||||||
}
|
|
@ -1,124 +0,0 @@
|
|||||||
import { UnregisterRequestPermissionTipsListener, RegisterRequestPermissionTipsListener, RequestPermissionTipsListener, SetRequestPermissionTips } from "../interface";
|
|
||||||
import RelativeLayout from 'android.widget.RelativeLayout';
|
|
||||||
import LinearLayout from 'android.widget.LinearLayout';
|
|
||||||
import Color from 'android.graphics.Color';
|
|
||||||
import TextView from 'android.widget.TextView';
|
|
||||||
import ViewGroup from 'android.view.ViewGroup';
|
|
||||||
import Activity from 'android.app.Activity';
|
|
||||||
import HashMap from 'java.util.HashMap';
|
|
||||||
import AnimationUtils from 'android.view.animation.AnimationUtils';
|
|
||||||
import R from 'io.dcloud.uts.permissionrequest.R'
|
|
||||||
import Html from 'android.text.Html';
|
|
||||||
import View from 'android.view.View';
|
|
||||||
import Context from 'android.content.Context';
|
|
||||||
import WindowManager from 'android.view.WindowManager';
|
|
||||||
|
|
||||||
let PermissionTipsView : View | null = null
|
|
||||||
let permissionTips : HashMap<String, String> = new HashMap<String, String>()
|
|
||||||
var permissionListener : RequestPermissionListener | null = null
|
|
||||||
var listener : RequestPermissionTipsListener | null = null
|
|
||||||
export const unregisterRequestPermissionTipsListener : UnregisterRequestPermissionTipsListener = (_ : RequestPermissionTipsListener | null) => {
|
|
||||||
listener = null;
|
|
||||||
if (permissionListener != null) {
|
|
||||||
permissionListener!.stop()
|
|
||||||
permissionListener = null
|
|
||||||
}
|
|
||||||
if (PermissionTipsView != null) {
|
|
||||||
if (PermissionTipsView!.getParent() != null) {
|
|
||||||
PermissionTipsView!.setAnimation(null);
|
|
||||||
((PermissionTipsView!.getParent()) as ViewGroup).removeView(PermissionTipsView)
|
|
||||||
}
|
|
||||||
PermissionTipsView = null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const registerRequestPermissionTipsListener : RegisterRequestPermissionTipsListener = (l : RequestPermissionTipsListener | null) => {
|
|
||||||
listener = l
|
|
||||||
if (permissionListener == null) {
|
|
||||||
permissionListener = uni.createRequestPermissionListener()
|
|
||||||
permissionListener!.onRequest((permissions : Array<string>) => {
|
|
||||||
if (listener != null)
|
|
||||||
listener!.onRequest?.invoke(permissions)
|
|
||||||
})
|
|
||||||
permissionListener!.onConfirm((permissions : Array<string>) => {
|
|
||||||
let activity = UTSAndroid.getUniActivity()!
|
|
||||||
if (PermissionTipsView != null && PermissionTipsView!.getParent() != null) {
|
|
||||||
PermissionTipsView!.setAnimation(null);
|
|
||||||
((PermissionTipsView!.getParent()) as ViewGroup).removeView(PermissionTipsView)
|
|
||||||
}
|
|
||||||
if (permissions.length > 0) {
|
|
||||||
PermissionTipsView = createPermissionWindow(activity, permissions);
|
|
||||||
if (PermissionTipsView != null) {
|
|
||||||
(activity.findViewById(android.R.id.content) as ViewGroup).addView(PermissionTipsView!)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (listener != null)
|
|
||||||
listener!.onConfirm?.invoke(permissions)
|
|
||||||
|
|
||||||
})
|
|
||||||
permissionListener!.onComplete((permissions : Array<string>) => {
|
|
||||||
// clearTimeout(timeoutRequestId)
|
|
||||||
let activity = UTSAndroid.getUniActivity()!
|
|
||||||
if (PermissionTipsView != null) {
|
|
||||||
PermissionTipsView!.setAnimation(AnimationUtils.loadAnimation(activity, R.anim.popupwindow_exit));
|
|
||||||
((PermissionTipsView!.getParent()) as ViewGroup).removeView(PermissionTipsView!)
|
|
||||||
PermissionTipsView = null
|
|
||||||
}
|
|
||||||
if (listener != null) {
|
|
||||||
var permissionStatus = {}
|
|
||||||
for (var p in permissions) {
|
|
||||||
permissionStatus[p] = UTSAndroid.checkSystemPermissionGranted(UTSAndroid.getUniActivity()!, [p]) ? "grant" : "denied"
|
|
||||||
}
|
|
||||||
listener!.onComplete?.invoke(permissionStatus)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const setRequestPermissionTips : SetRequestPermissionTips = (tips : UTSJSONObject) => {
|
|
||||||
permissionTips.clear()
|
|
||||||
for (var k in tips) {
|
|
||||||
permissionTips.put(k, tips[k] != null ? tips[k].toString() : "")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function createPermissionWindow(activity : Activity, permissions : Array<string>) : ViewGroup | null {
|
|
||||||
let rootView = new RelativeLayout(activity);
|
|
||||||
rootView.setBackgroundColor(Color.TRANSPARENT);
|
|
||||||
let backgroundView = new LinearLayout(activity);
|
|
||||||
backgroundView.setPadding(30, 0, 30, 30);
|
|
||||||
backgroundView.setOrientation(1)
|
|
||||||
backgroundView.setBackgroundResource(R.drawable.dcloud_permission_background);
|
|
||||||
let permissionTipsList : Array<string> = new Array<string>()
|
|
||||||
for (var p in permissions) {
|
|
||||||
if (permissionTips.containsKey(p) && permissionTipsList.indexOf(permissionTips.get(p)) == -1) {
|
|
||||||
permissionTipsList.push(permissionTips.get(p)!)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (var p in permissionTipsList) {
|
|
||||||
let text = new TextView(activity);
|
|
||||||
text.setText(Html.fromHtml(p, Html.FROM_HTML_SEPARATOR_LINE_BREAK_HEADING))
|
|
||||||
text.setPadding(0, 30, 0, 0)
|
|
||||||
text.setTextSize((5 * getScale()).toFloat())
|
|
||||||
text.setTextColor(Color.BLACK)
|
|
||||||
backgroundView.addView(text)
|
|
||||||
}
|
|
||||||
if (backgroundView.getChildCount() == 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
let rll = new RelativeLayout.LayoutParams(-1, -2)
|
|
||||||
rll.topMargin = (UTSAndroid.getStatusBarHeight() * getScale()).toInt();
|
|
||||||
rll.leftMargin = 30;
|
|
||||||
rll.rightMargin = 30;
|
|
||||||
rll.bottomMargin = 30;
|
|
||||||
rootView.addView(backgroundView, rll)
|
|
||||||
rootView.setAnimation(AnimationUtils.loadAnimation(activity, R.anim.popupwindow_enter));
|
|
||||||
return rootView;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getScale() : Float {
|
|
||||||
if (UTSAndroid.getUniActivity() != null) {
|
|
||||||
return UTSAndroid.getUniActivity()!.resources.displayMetrics.scaledDensity
|
|
||||||
}
|
|
||||||
return (0 as number).toFloat();
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<translate xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:duration="200"
|
|
||||||
android:fromYDelta="-100%"
|
|
||||||
android:toYDelta="0" >
|
|
||||||
</translate>
|
|
@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<translate xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:duration="200"
|
|
||||||
android:fromYDelta="0"
|
|
||||||
android:toYDelta="-100%" />
|
|
@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
|
|
||||||
<corners android:radius="8dp" />
|
|
||||||
<!-- <stroke android:color="@color/black" android:width="2dp"/>-->
|
|
||||||
<solid android:color="#ffffff"/>
|
|
||||||
</shape>
|
|
@ -1,19 +0,0 @@
|
|||||||
export type RequestPermissionTipsListener = {
|
|
||||||
onRequest ?: ((permissions : Array<string>) => void) | null,
|
|
||||||
onConfirm ?: ((permission : Array<string>) => void) | null,
|
|
||||||
onComplete ?: ((permissions : UTSJSONObject) => void) | null
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export type RegisterRequestPermissionTipsListener = (listener : RequestPermissionTipsListener | null) => void
|
|
||||||
export type UnregisterRequestPermissionTipsListener = (listener : RequestPermissionTipsListener | null) => void
|
|
||||||
export type SetRequestPermissionTips = (tips : UTSJSONObject) => void
|
|
||||||
|
|
||||||
export interface Uni {
|
|
||||||
|
|
||||||
registerRequestPermissionTipsListener : RegisterRequestPermissionTipsListener,
|
|
||||||
|
|
||||||
unregisterRequestPermissionTipsListener : UnregisterRequestPermissionTipsListener
|
|
||||||
|
|
||||||
setRequestPermissionTips : SetRequestPermissionTips
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
## 1.0.15(2023-12-20)
|
|
||||||
1. 优化
|
|
||||||
## 1.0.14(2023-12-06)
|
|
||||||
1. 优化
|
|
||||||
## 1.0.13(2023-12-06)
|
|
||||||
1. 阻止事件冒泡处理
|
|
||||||
## 1.0.12(2023-10-19)
|
|
||||||
1. 增加后置插槽
|
|
||||||
## 1.0.11(2023-09-21)
|
|
||||||
1. 修复通过customStyle修改按钮宽度,组件中最外层节点不改变的问题
|
|
||||||
## 1.0.10(2023-09-15)
|
|
||||||
1. 按钮支持open-type="agreePrivacyAuthorization"
|
|
||||||
## 1.0.9(2023-09-11)
|
|
||||||
1. 增加参数iconSize,用于控制图标的大小
|
|
||||||
## 1.0.8(2023-09-10)
|
|
||||||
1. 修复多个按钮在一行宽度不正常的BUG
|
|
||||||
## 1.0.7(2023-09-07)
|
|
||||||
1. 修复warning颜色对应错误的BUG
|
|
||||||
## 1.0.6(2023-07-25)
|
|
||||||
1. 增加customTextStyle属性,方便自定义文字样式
|
|
||||||
## 1.0.5(2023-07-20)
|
|
||||||
1. 解决微信小程序动态设置hover-class点击态不消失的BUG
|
|
||||||
## 1.0.4(2023-06-29)
|
|
||||||
1. 修改上次更新出现nvue报错异常
|
|
||||||
## 1.0.3(2023-06-28)
|
|
||||||
修复:设置open-type="chooseAvatar"等值不生效的BUG
|
|
||||||
## 1.0.2(2023-06-01)
|
|
||||||
1. 修复按钮点击触发两次的BUG
|
|
||||||
## 1.0.1(2023-05-16)
|
|
||||||
1. 优化组件依赖,修改后无需全局引入,组件导入即可使用
|
|
||||||
2. 优化部分功能
|
|
||||||
## 1.0.0(2023-05-10)
|
|
||||||
uv-button 按钮
|
|
@ -1,46 +0,0 @@
|
|||||||
$uv-button-active-opacity:0.75 !default;
|
|
||||||
$uv-button-loading-text-margin-left:4px !default;
|
|
||||||
$uv-button-text-color: #FFFFFF !default;
|
|
||||||
$uv-button-text-plain-error-color:$uv-error !default;
|
|
||||||
$uv-button-text-plain-warning-color:$uv-warning !default;
|
|
||||||
$uv-button-text-plain-success-color:$uv-success !default;
|
|
||||||
$uv-button-text-plain-info-color:$uv-info !default;
|
|
||||||
$uv-button-text-plain-primary-color:$uv-primary !default;
|
|
||||||
.uv-button {
|
|
||||||
&--active {
|
|
||||||
opacity: $uv-button-active-opacity;
|
|
||||||
}
|
|
||||||
|
|
||||||
&--active--plain {
|
|
||||||
background-color: rgb(217, 217, 217);
|
|
||||||
}
|
|
||||||
|
|
||||||
&__loading-text {
|
|
||||||
margin-left:$uv-button-loading-text-margin-left;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__text,
|
|
||||||
&__loading-text {
|
|
||||||
color:$uv-button-text-color;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__text--plain--error {
|
|
||||||
color:$uv-button-text-plain-error-color;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__text--plain--warning {
|
|
||||||
color:$uv-button-text-plain-warning-color;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__text--plain--success{
|
|
||||||
color:$uv-button-text-plain-success-color;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__text--plain--info {
|
|
||||||
color:$uv-button-text-plain-info-color;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__text--plain--primary {
|
|
||||||
color:$uv-button-text-plain-primary-color;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,163 +0,0 @@
|
|||||||
export default {
|
|
||||||
props: {
|
|
||||||
// 是否细边框
|
|
||||||
hairline: {
|
|
||||||
type: Boolean,
|
|
||||||
default: true
|
|
||||||
},
|
|
||||||
// 按钮的预置样式,info,primary,error,warning,success
|
|
||||||
type: {
|
|
||||||
type: String,
|
|
||||||
default: 'info'
|
|
||||||
},
|
|
||||||
// 按钮尺寸,large,normal,small,mini
|
|
||||||
size: {
|
|
||||||
type: String,
|
|
||||||
default: 'normal'
|
|
||||||
},
|
|
||||||
// 按钮形状,circle(两边为半圆),square(带圆角)
|
|
||||||
shape: {
|
|
||||||
type: String,
|
|
||||||
default: 'square'
|
|
||||||
},
|
|
||||||
// 按钮是否镂空
|
|
||||||
plain: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
// 是否禁止状态
|
|
||||||
disabled: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
// 是否加载中
|
|
||||||
loading: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
// 加载中提示文字
|
|
||||||
loadingText: {
|
|
||||||
type: [String, Number],
|
|
||||||
default: ''
|
|
||||||
},
|
|
||||||
// 加载状态图标类型
|
|
||||||
loadingMode: {
|
|
||||||
type: String,
|
|
||||||
default: 'spinner'
|
|
||||||
},
|
|
||||||
// 加载图标大小
|
|
||||||
loadingSize: {
|
|
||||||
type: [String, Number],
|
|
||||||
default: 14
|
|
||||||
},
|
|
||||||
// 开放能力,具体请看uniapp稳定关于button组件部分说明
|
|
||||||
// https://uniapp.dcloud.io/component/button
|
|
||||||
openType: {
|
|
||||||
type: String,
|
|
||||||
default: ''
|
|
||||||
},
|
|
||||||
// 用于 <form> 组件,点击分别会触发 <form> 组件的 submit/reset 事件
|
|
||||||
// 取值为submit(提交表单),reset(重置表单)
|
|
||||||
formType: {
|
|
||||||
type: String,
|
|
||||||
default: ''
|
|
||||||
},
|
|
||||||
// 打开 APP 时,向 APP 传递的参数,open-type=launchApp时有效
|
|
||||||
// 只微信小程序、QQ小程序有效
|
|
||||||
appParameter: {
|
|
||||||
type: String,
|
|
||||||
default: ''
|
|
||||||
},
|
|
||||||
// 指定是否阻止本节点的祖先节点出现点击态,微信小程序有效
|
|
||||||
hoverStopPropagation: {
|
|
||||||
type: Boolean,
|
|
||||||
default: true
|
|
||||||
},
|
|
||||||
// 指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文。只微信小程序有效
|
|
||||||
lang: {
|
|
||||||
type: String,
|
|
||||||
default: 'en'
|
|
||||||
},
|
|
||||||
// 会话来源,open-type="contact"时有效。只微信小程序有效
|
|
||||||
sessionFrom: {
|
|
||||||
type: String,
|
|
||||||
default: ''
|
|
||||||
},
|
|
||||||
// 会话内消息卡片标题,open-type="contact"时有效
|
|
||||||
// 默认当前标题,只微信小程序有效
|
|
||||||
sendMessageTitle: {
|
|
||||||
type: String,
|
|
||||||
default: ''
|
|
||||||
},
|
|
||||||
// 会话内消息卡片点击跳转小程序路径,open-type="contact"时有效
|
|
||||||
// 默认当前分享路径,只微信小程序有效
|
|
||||||
sendMessagePath: {
|
|
||||||
type: String,
|
|
||||||
default: ''
|
|
||||||
},
|
|
||||||
// 会话内消息卡片图片,open-type="contact"时有效
|
|
||||||
// 默认当前页面截图,只微信小程序有效
|
|
||||||
sendMessageImg: {
|
|
||||||
type: String,
|
|
||||||
default: ''
|
|
||||||
},
|
|
||||||
// 是否显示会话内消息卡片,设置此参数为 true,用户进入客服会话会在右下角显示"可能要发送的小程序"提示,
|
|
||||||
// 用户点击后可以快速发送小程序消息,open-type="contact"时有效
|
|
||||||
showMessageCard: {
|
|
||||||
type: Boolean,
|
|
||||||
default: true
|
|
||||||
},
|
|
||||||
// 额外传参参数,用于小程序的data-xxx属性,通过target.dataset.name获取
|
|
||||||
dataName: {
|
|
||||||
type: String,
|
|
||||||
default: ''
|
|
||||||
},
|
|
||||||
// 节流,一定时间内只能触发一次
|
|
||||||
throttleTime: {
|
|
||||||
type: [String, Number],
|
|
||||||
default: 0
|
|
||||||
},
|
|
||||||
// 按住后多久出现点击态,单位毫秒
|
|
||||||
hoverStartTime: {
|
|
||||||
type: [String, Number],
|
|
||||||
default: 0
|
|
||||||
},
|
|
||||||
// 手指松开后点击态保留时间,单位毫秒
|
|
||||||
hoverStayTime: {
|
|
||||||
type: [String, Number],
|
|
||||||
default: 200
|
|
||||||
},
|
|
||||||
// 按钮文字,之所以通过props传入,是因为slot传入的话
|
|
||||||
// nvue中无法控制文字的样式
|
|
||||||
text: {
|
|
||||||
type: [String, Number],
|
|
||||||
default: ''
|
|
||||||
},
|
|
||||||
// 按钮图标
|
|
||||||
icon: {
|
|
||||||
type: String,
|
|
||||||
default: ''
|
|
||||||
},
|
|
||||||
// 按钮图标大小
|
|
||||||
iconSize: {
|
|
||||||
type: [String, Number],
|
|
||||||
default: ''
|
|
||||||
},
|
|
||||||
// 按钮图标颜色
|
|
||||||
iconColor: {
|
|
||||||
type: String,
|
|
||||||
default: '#000000'
|
|
||||||
},
|
|
||||||
// 按钮颜色,支持传入linear-gradient渐变色
|
|
||||||
color: {
|
|
||||||
type: String,
|
|
||||||
default: ''
|
|
||||||
},
|
|
||||||
// 自定义按钮文本样式
|
|
||||||
customTextStyle: {
|
|
||||||
type: [Object,String],
|
|
||||||
default: ''
|
|
||||||
},
|
|
||||||
...uni.$uv?.props?.button
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,528 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view
|
|
||||||
class="uv-button-wrapper"
|
|
||||||
:style="[btnWrapperStyle]"
|
|
||||||
>
|
|
||||||
<!-- #ifndef APP-NVUE -->
|
|
||||||
<!-- #ifdef MP -->
|
|
||||||
<!-- 为了解决微信小程序动态设置hover-class点击态不消失的BUG -->
|
|
||||||
<view class="uv-button-wrapper--dis" v-if="disabled || loading"></view>
|
|
||||||
<button
|
|
||||||
:hover-start-time="Number(hoverStartTime)"
|
|
||||||
:hover-stay-time="Number(hoverStayTime)"
|
|
||||||
:form-type="formType"
|
|
||||||
:open-type="openType"
|
|
||||||
:app-parameter="appParameter"
|
|
||||||
:hover-stop-propagation="hoverStopPropagation"
|
|
||||||
:send-message-title="sendMessageTitle"
|
|
||||||
:send-message-path="sendMessagePath"
|
|
||||||
:lang="lang"
|
|
||||||
:data-name="dataName"
|
|
||||||
:session-from="sessionFrom"
|
|
||||||
:send-message-img="sendMessageImg"
|
|
||||||
:show-message-card="showMessageCard"
|
|
||||||
@getphonenumber="onGetPhoneNumber"
|
|
||||||
@getuserinfo="onGetUserInfo"
|
|
||||||
@error="onError"
|
|
||||||
@opensetting="onOpenSetting"
|
|
||||||
@launchapp="onLaunchApp"
|
|
||||||
@contact="onContact"
|
|
||||||
@chooseavatar="onChooseavatar"
|
|
||||||
@agreeprivacyauthorization="onAgreeprivacyauthorization"
|
|
||||||
@addgroupapp="onAddgroupapp"
|
|
||||||
@chooseaddress="onChooseaddress"
|
|
||||||
@subscribe="onSubscribe"
|
|
||||||
@login="onLogin"
|
|
||||||
@im="onIm"
|
|
||||||
hover-class="uv-button--active"
|
|
||||||
class="uv-button uv-reset-button"
|
|
||||||
:style="[baseColor, $uv.addStyle(customStyle)]"
|
|
||||||
@tap="clickHandler"
|
|
||||||
:class="bemClass"
|
|
||||||
>
|
|
||||||
<!-- #endif -->
|
|
||||||
<!-- #ifndef MP -->
|
|
||||||
<button
|
|
||||||
:hover-start-time="Number(hoverStartTime)"
|
|
||||||
:hover-stay-time="Number(hoverStayTime)"
|
|
||||||
:form-type="formType"
|
|
||||||
:open-type="openType"
|
|
||||||
:app-parameter="appParameter"
|
|
||||||
:hover-stop-propagation="hoverStopPropagation"
|
|
||||||
:send-message-title="sendMessageTitle"
|
|
||||||
:send-message-path="sendMessagePath"
|
|
||||||
:lang="lang"
|
|
||||||
:data-name="dataName"
|
|
||||||
:session-from="sessionFrom"
|
|
||||||
:send-message-img="sendMessageImg"
|
|
||||||
:show-message-card="showMessageCard"
|
|
||||||
:hover-class="!disabled && !loading ? 'uv-button--active' : ''"
|
|
||||||
class="uv-button uv-reset-button"
|
|
||||||
:style="[baseColor, $uv.addStyle(customStyle)]"
|
|
||||||
@tap="clickHandler"
|
|
||||||
:class="bemClass"
|
|
||||||
>
|
|
||||||
<!-- #endif -->
|
|
||||||
<template v-if="loading">
|
|
||||||
<uv-loading-icon
|
|
||||||
:mode="loadingMode"
|
|
||||||
:size="loadingSize * 1.15"
|
|
||||||
:color="loadingColor"
|
|
||||||
></uv-loading-icon>
|
|
||||||
<text
|
|
||||||
class="uv-button__loading-text"
|
|
||||||
:style="[
|
|
||||||
{ fontSize: textSize + 'px' },
|
|
||||||
$uv.addStyle(customTextStyle)
|
|
||||||
]"
|
|
||||||
>{{ loadingText || text }}</text>
|
|
||||||
</template>
|
|
||||||
<template v-else>
|
|
||||||
<uv-icon
|
|
||||||
v-if="icon"
|
|
||||||
:name="icon"
|
|
||||||
:color="iconColorCom"
|
|
||||||
:size="getIconSize"
|
|
||||||
:customStyle="{ marginRight: '2px' }"
|
|
||||||
></uv-icon>
|
|
||||||
<slot>
|
|
||||||
<text
|
|
||||||
class="uv-button__text"
|
|
||||||
:style="[
|
|
||||||
{ fontSize: textSize + 'px' },
|
|
||||||
$uv.addStyle(customTextStyle)
|
|
||||||
]"
|
|
||||||
>{{ text }}</text>
|
|
||||||
</slot>
|
|
||||||
<slot name="suffix"></slot>
|
|
||||||
</template>
|
|
||||||
</button>
|
|
||||||
<!-- #endif -->
|
|
||||||
<!-- #ifdef APP-NVUE -->
|
|
||||||
<view
|
|
||||||
:hover-start-time="Number(hoverStartTime)"
|
|
||||||
:hover-stay-time="Number(hoverStayTime)"
|
|
||||||
class="uv-button"
|
|
||||||
:hover-class="
|
|
||||||
!disabled && !loading && !color && (plain || type === 'info')
|
|
||||||
? 'uv-button--active--plain'
|
|
||||||
: !disabled && !loading && !plain
|
|
||||||
? 'uv-button--active'
|
|
||||||
: ''
|
|
||||||
"
|
|
||||||
@tap="clickHandler"
|
|
||||||
:class="bemClass"
|
|
||||||
:style="[baseColor, $uv.addStyle(customStyle)]"
|
|
||||||
>
|
|
||||||
<template v-if="loading">
|
|
||||||
<uv-loading-icon
|
|
||||||
:mode="loadingMode"
|
|
||||||
:size="loadingSize * 1.15"
|
|
||||||
:color="loadingColor"
|
|
||||||
></uv-loading-icon>
|
|
||||||
<text
|
|
||||||
class="uv-button__loading-text"
|
|
||||||
:style="[nvueTextStyle,$uv.addStyle(customTextStyle)]"
|
|
||||||
:class="[plain && `uv-button__text--plain--${type}`]"
|
|
||||||
>{{ loadingText || text }}</text>
|
|
||||||
</template>
|
|
||||||
<template v-else>
|
|
||||||
<uv-icon
|
|
||||||
v-if="icon"
|
|
||||||
:name="icon"
|
|
||||||
:color="iconColorCom"
|
|
||||||
:size="getIconSize"
|
|
||||||
></uv-icon>
|
|
||||||
<text
|
|
||||||
class="uv-button__text"
|
|
||||||
:style="[
|
|
||||||
{
|
|
||||||
marginLeft: icon ? '2px' : 0,
|
|
||||||
},
|
|
||||||
nvueTextStyle,
|
|
||||||
$uv.addStyle(customTextStyle)
|
|
||||||
]"
|
|
||||||
:class="[plain && `uv-button__text--plain--${type}`]"
|
|
||||||
>{{ text }}</text>
|
|
||||||
<slot name="suffix"></slot>
|
|
||||||
</template>
|
|
||||||
</view>
|
|
||||||
<!-- #endif -->
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import throttle from '@/uni_modules/uv-ui-tools/libs/function/throttle.js';
|
|
||||||
import mpMixin from '@/uni_modules/uv-ui-tools/libs/mixin/mpMixin.js'
|
|
||||||
import mixin from '@/uni_modules/uv-ui-tools/libs/mixin/mixin.js'
|
|
||||||
import button from '@/uni_modules/uv-ui-tools/libs/mixin/button.js'
|
|
||||||
import openType from '@/uni_modules/uv-ui-tools/libs/mixin/openType.js'
|
|
||||||
import props from "./props.js";
|
|
||||||
/**
|
|
||||||
* button 按钮
|
|
||||||
* @description Button 按钮
|
|
||||||
* @tutorial https://www.uvui.cn/components/button.html
|
|
||||||
* @property {Boolean} hairline 是否显示按钮的细边框 (默认 true )
|
|
||||||
* @property {String} type 按钮的预置样式,info,primary,error,warning,success (默认 'info' )
|
|
||||||
* @property {String} size 按钮尺寸,large,normal,mini (默认 normal)
|
|
||||||
* @property {String} shape 按钮形状,circle(两边为半圆),square(带圆角) (默认 'square' )
|
|
||||||
* @property {Boolean} plain 按钮是否镂空,背景色透明 (默认 false)
|
|
||||||
* @property {Boolean} disabled 是否禁用 (默认 false)
|
|
||||||
* @property {Boolean} loading 按钮名称前是否带 loading 图标(App-nvue 平台,在 ios 上为雪花,Android上为圆圈) (默认 false)
|
|
||||||
* @property {String | Number} loadingText 加载中提示文字
|
|
||||||
* @property {String} loadingMode 加载状态图标类型 (默认 'spinner' )
|
|
||||||
* @property {String | Number} loadingSize 加载图标大小 (默认 15 )
|
|
||||||
* @property {String} openType 开放能力,具体请看uniapp稳定关于button组件部分说明
|
|
||||||
* @property {String} formType 用于 <form> 组件,点击分别会触发 <form> 组件的 submit/reset 事件
|
|
||||||
* @property {String} appParameter 打开 APP 时,向 APP 传递的参数,open-type=launchApp时有效 (注:只微信小程序、QQ小程序有效)
|
|
||||||
* @property {Boolean} hoverStopPropagation 指定是否阻止本节点的祖先节点出现点击态,微信小程序有效(默认 true )
|
|
||||||
* @property {String} lang 指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文(默认 en )
|
|
||||||
* @property {String} sessionFrom 会话来源,openType="contact"时有效
|
|
||||||
* @property {String} sendMessageTitle 会话内消息卡片标题,openType="contact"时有效
|
|
||||||
* @property {String} sendMessagePath 会话内消息卡片点击跳转小程序路径,openType="contact"时有效
|
|
||||||
* @property {String} sendMessageImg 会话内消息卡片图片,openType="contact"时有效
|
|
||||||
* @property {Boolean} showMessageCard 是否显示会话内消息卡片,设置此参数为 true,用户进入客服会话会在右下角显示"可能要发送的小程序"提示,用户点击后可以快速发送小程序消息,openType="contact"时有效(默认false)
|
|
||||||
* @property {String} dataName 额外传参参数,用于小程序的data-xxx属性,通过target.dataset.name获取
|
|
||||||
* @property {String | Number} throttleTime 节流,一定时间内只能触发一次 (默认 0 )
|
|
||||||
* @property {String | Number} hoverStartTime 按住后多久出现点击态,单位毫秒 (默认 0 )
|
|
||||||
* @property {String | Number} hoverStayTime 手指松开后点击态保留时间,单位毫秒 (默认 200 )
|
|
||||||
* @property {String | Number} text 按钮文字,之所以通过props传入,是因为slot传入的话(注:nvue中无法控制文字的样式)
|
|
||||||
* @property {String} icon 按钮图标
|
|
||||||
* @property {String} iconColor 按钮图标颜色
|
|
||||||
* @property {String} color 按钮颜色,支持传入linear-gradient渐变色
|
|
||||||
* @property {Object} customStyle 定义需要用到的外部样式
|
|
||||||
* @event {Function} click 非禁止并且非加载中,才能点击
|
|
||||||
* @event {Function} getphonenumber open-type="getPhoneNumber"时有效
|
|
||||||
* @event {Function} getuserinfo 用户点击该按钮时,会返回获取到的用户信息,从返回参数的detail中获取到的值同uni.getUserInfo
|
|
||||||
* @event {Function} error 当使用开放能力时,发生错误的回调
|
|
||||||
* @event {Function} opensetting 在打开授权设置页并关闭后回调
|
|
||||||
* @event {Function} launchapp 打开 APP 成功的回调
|
|
||||||
* @example <uv-button>月落</uv-button>
|
|
||||||
*/
|
|
||||||
export default {
|
|
||||||
name: "uv-button",
|
|
||||||
// #ifdef MP
|
|
||||||
mixins: [mpMixin, mixin, button, openType, props],
|
|
||||||
// #endif
|
|
||||||
// #ifndef MP
|
|
||||||
mixins: [mpMixin, mixin, props],
|
|
||||||
// #endif
|
|
||||||
emits: ['click'],
|
|
||||||
data() {
|
|
||||||
return {};
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
// 生成bem风格的类名
|
|
||||||
bemClass() {
|
|
||||||
// this.bem为一个computed变量,在mixin中
|
|
||||||
if (!this.color) {
|
|
||||||
return this.bem("button",
|
|
||||||
["type", "shape", "size"],
|
|
||||||
["disabled", "plain", "hairline"]);
|
|
||||||
} else {
|
|
||||||
// 由于nvue的原因,在有color参数时,不需要传入type,否则会生成type相关的类型,影响最终的样式
|
|
||||||
return this.bem("button",
|
|
||||||
["shape", "size"],
|
|
||||||
["disabled", "plain", "hairline"]);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
loadingColor() {
|
|
||||||
if (this.plain) {
|
|
||||||
// 如果有设置color值,则用color值,否则使用type主题颜色
|
|
||||||
return this.color ? this.color : '#3c9cff';
|
|
||||||
}
|
|
||||||
if (this.type === "info") {
|
|
||||||
return "#c9c9c9";
|
|
||||||
}
|
|
||||||
return "rgb(200, 200, 200)";
|
|
||||||
},
|
|
||||||
iconColorCom() {
|
|
||||||
// 如果是镂空状态,设置了color就用color值,否则使用主题颜色,
|
|
||||||
// uv-icon的color能接受一个主题颜色的值
|
|
||||||
if (this.iconColor) return this.iconColor;
|
|
||||||
if (this.plain) {
|
|
||||||
return this.color ? this.color : this.type;
|
|
||||||
} else {
|
|
||||||
return this.type === "info" ? "#000000" : "#ffffff";
|
|
||||||
}
|
|
||||||
},
|
|
||||||
baseColor() {
|
|
||||||
let style = {};
|
|
||||||
if (this.color) {
|
|
||||||
// 针对自定义了color颜色的情况,镂空状态下,就是用自定义的颜色
|
|
||||||
style.color = this.plain ? this.color : "white";
|
|
||||||
if (!this.plain) {
|
|
||||||
// 非镂空,背景色使用自定义的颜色
|
|
||||||
style["background-color"] = this.color;
|
|
||||||
}
|
|
||||||
if (this.color.indexOf("gradient") !== -1) {
|
|
||||||
// 如果自定义的颜色为渐变色,不显示边框,以及通过backgroundImage设置渐变色
|
|
||||||
// weex文档说明可以写borderWidth的形式,为什么这里需要分开写?
|
|
||||||
// 因为weex是阿里巴巴为了部门业绩考核而做的你懂的东西,所以需要这么写才有效
|
|
||||||
style.borderTopWidth = 0;
|
|
||||||
style.borderRightWidth = 0;
|
|
||||||
style.borderBottomWidth = 0;
|
|
||||||
style.borderLeftWidth = 0;
|
|
||||||
if (!this.plain) {
|
|
||||||
style.backgroundImage = this.color;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// 非渐变色,则设置边框相关的属性
|
|
||||||
style.borderColor = this.color;
|
|
||||||
style.borderWidth = "1px";
|
|
||||||
style.borderStyle = "solid";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return style;
|
|
||||||
},
|
|
||||||
// nvue版本按钮的字体不会继承父组件的颜色,需要对每一个text组件进行单独的设置
|
|
||||||
nvueTextStyle() {
|
|
||||||
let style = {};
|
|
||||||
// 针对自定义了color颜色的情况,镂空状态下,就是用自定义的颜色
|
|
||||||
if (this.type === "info") {
|
|
||||||
style.color = "#323233";
|
|
||||||
}
|
|
||||||
if (this.color) {
|
|
||||||
style.color = this.plain ? this.color : "white";
|
|
||||||
}
|
|
||||||
style.fontSize = this.textSize + "px";
|
|
||||||
return style;
|
|
||||||
},
|
|
||||||
// 字体大小
|
|
||||||
textSize() {
|
|
||||||
let fontSize = 14,
|
|
||||||
{ size } = this;
|
|
||||||
if (size === "large") fontSize = 16;
|
|
||||||
if (size === "normal") fontSize = 14;
|
|
||||||
if (size === "small") fontSize = 12;
|
|
||||||
if (size === "mini") fontSize = 10;
|
|
||||||
return fontSize;
|
|
||||||
},
|
|
||||||
// 设置图标大小
|
|
||||||
getIconSize() {
|
|
||||||
const size = this.iconSize ? this.iconSize : this.textSize * 1.35;
|
|
||||||
return this.$uv.addUnit(size);
|
|
||||||
},
|
|
||||||
// 设置外层盒子的宽度,其他样式不需要
|
|
||||||
btnWrapperStyle() {
|
|
||||||
const style = {};
|
|
||||||
const customStyle = this.$uv.addStyle(this.customStyle);
|
|
||||||
if(customStyle.width) style.width = customStyle.width;
|
|
||||||
return style;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
clickHandler() {
|
|
||||||
// 非禁止并且非加载中,才能点击
|
|
||||||
if (!this.disabled && !this.loading) {
|
|
||||||
// 进行节流控制,每this.throttle毫秒内,只在开始处执行
|
|
||||||
throttle(() => {
|
|
||||||
this.$emit("click");
|
|
||||||
}, this.throttleTime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
$show-reset-button: 1;
|
|
||||||
@import '@/uni_modules/uv-ui-tools/libs/css/variable.scss';
|
|
||||||
@import '@/uni_modules/uv-ui-tools/libs/css/components.scss';
|
|
||||||
@import '@/uni_modules/uv-ui-tools/libs/css/color.scss';
|
|
||||||
|
|
||||||
/* #ifndef APP-NVUE */
|
|
||||||
@import "./vue.scss";
|
|
||||||
/* #endif */
|
|
||||||
|
|
||||||
/* #ifdef APP-NVUE */
|
|
||||||
@import "./nvue.scss";
|
|
||||||
/* #endif */
|
|
||||||
|
|
||||||
$uv-button-uv-button-height: 40px !default;
|
|
||||||
$uv-button-text-font-size: 15px !default;
|
|
||||||
$uv-button-loading-text-font-size: 15px !default;
|
|
||||||
$uv-button-loading-text-margin-left: 4px !default;
|
|
||||||
$uv-button-large-width: 100% !default;
|
|
||||||
$uv-button-large-height: 50px !default;
|
|
||||||
$uv-button-normal-padding: 0 12px !default;
|
|
||||||
$uv-button-large-padding: 0 15px !default;
|
|
||||||
$uv-button-normal-font-size: 14px !default;
|
|
||||||
$uv-button-small-min-width: 60px !default;
|
|
||||||
$uv-button-small-height: 30px !default;
|
|
||||||
$uv-button-small-padding: 0px 8px !default;
|
|
||||||
$uv-button-mini-padding: 0px 8px !default;
|
|
||||||
$uv-button-small-font-size: 12px !default;
|
|
||||||
$uv-button-mini-height: 22px !default;
|
|
||||||
$uv-button-mini-font-size: 10px !default;
|
|
||||||
$uv-button-mini-min-width: 50px !default;
|
|
||||||
$uv-button-disabled-opacity: 0.5 !default;
|
|
||||||
$uv-button-info-color: #323233 !default;
|
|
||||||
$uv-button-info-background-color: #fff !default;
|
|
||||||
$uv-button-info-border-color: #ebedf0 !default;
|
|
||||||
$uv-button-info-border-width: 1px !default;
|
|
||||||
$uv-button-info-border-style: solid !default;
|
|
||||||
$uv-button-success-color: #fff !default;
|
|
||||||
$uv-button-success-background-color: $uv-success !default;
|
|
||||||
$uv-button-success-border-color: $uv-button-success-background-color !default;
|
|
||||||
$uv-button-success-border-width: 1px !default;
|
|
||||||
$uv-button-success-border-style: solid !default;
|
|
||||||
$uv-button-primary-color: #fff !default;
|
|
||||||
$uv-button-primary-background-color: $uv-primary !default;
|
|
||||||
$uv-button-primary-border-color: $uv-button-primary-background-color !default;
|
|
||||||
$uv-button-primary-border-width: 1px !default;
|
|
||||||
$uv-button-primary-border-style: solid !default;
|
|
||||||
$uv-button-error-color: #fff !default;
|
|
||||||
$uv-button-error-background-color: $uv-error !default;
|
|
||||||
$uv-button-error-border-color: $uv-button-error-background-color !default;
|
|
||||||
$uv-button-error-border-width: 1px !default;
|
|
||||||
$uv-button-error-border-style: solid !default;
|
|
||||||
$uv-button-warning-color: #fff !default;
|
|
||||||
$uv-button-warning-background-color: $uv-warning !default;
|
|
||||||
$uv-button-warning-border-color: $uv-button-warning-background-color !default;
|
|
||||||
$uv-button-warning-border-width: 1px !default;
|
|
||||||
$uv-button-warning-border-style: solid !default;
|
|
||||||
$uv-button-block-width: 100% !default;
|
|
||||||
$uv-button-circle-border-top-right-radius: 100px !default;
|
|
||||||
$uv-button-circle-border-top-left-radius: 100px !default;
|
|
||||||
$uv-button-circle-border-bottom-left-radius: 100px !default;
|
|
||||||
$uv-button-circle-border-bottom-right-radius: 100px !default;
|
|
||||||
$uv-button-square-border-top-right-radius: 3px !default;
|
|
||||||
$uv-button-square-border-top-left-radius: 3px !default;
|
|
||||||
$uv-button-square-border-bottom-left-radius: 3px !default;
|
|
||||||
$uv-button-square-border-bottom-right-radius: 3px !default;
|
|
||||||
$uv-button-icon-min-width: 1em !default;
|
|
||||||
$uv-button-plain-background-color: #fff !default;
|
|
||||||
$uv-button-hairline-border-width: 0.5px !default;
|
|
||||||
|
|
||||||
.uv-button {
|
|
||||||
height: $uv-button-uv-button-height;
|
|
||||||
position: relative;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
@include flex;
|
|
||||||
/* #ifndef APP-NVUE */
|
|
||||||
box-sizing: border-box;
|
|
||||||
/* #endif */
|
|
||||||
flex-direction: row;
|
|
||||||
|
|
||||||
&__text {
|
|
||||||
font-size: $uv-button-text-font-size;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__loading-text {
|
|
||||||
font-size: $uv-button-loading-text-font-size;
|
|
||||||
margin-left: $uv-button-loading-text-margin-left;
|
|
||||||
}
|
|
||||||
|
|
||||||
&--large {
|
|
||||||
/* #ifndef APP-NVUE */
|
|
||||||
width: $uv-button-large-width;
|
|
||||||
/* #endif */
|
|
||||||
height: $uv-button-large-height;
|
|
||||||
padding: $uv-button-large-padding;
|
|
||||||
}
|
|
||||||
|
|
||||||
&--normal {
|
|
||||||
padding: $uv-button-normal-padding;
|
|
||||||
font-size: $uv-button-normal-font-size;
|
|
||||||
}
|
|
||||||
|
|
||||||
&--small {
|
|
||||||
/* #ifndef APP-NVUE */
|
|
||||||
min-width: $uv-button-small-min-width;
|
|
||||||
/* #endif */
|
|
||||||
height: $uv-button-small-height;
|
|
||||||
padding: $uv-button-small-padding;
|
|
||||||
font-size: $uv-button-small-font-size;
|
|
||||||
}
|
|
||||||
|
|
||||||
&--mini {
|
|
||||||
height: $uv-button-mini-height;
|
|
||||||
font-size: $uv-button-mini-font-size;
|
|
||||||
/* #ifndef APP-NVUE */
|
|
||||||
min-width: $uv-button-mini-min-width;
|
|
||||||
/* #endif */
|
|
||||||
padding: $uv-button-mini-padding;
|
|
||||||
}
|
|
||||||
|
|
||||||
&--disabled {
|
|
||||||
opacity: $uv-button-disabled-opacity;
|
|
||||||
}
|
|
||||||
|
|
||||||
&--info {
|
|
||||||
color: $uv-button-info-color;
|
|
||||||
background-color: $uv-button-info-background-color;
|
|
||||||
border-color: $uv-button-info-border-color;
|
|
||||||
border-width: $uv-button-info-border-width;
|
|
||||||
border-style: $uv-button-info-border-style;
|
|
||||||
}
|
|
||||||
|
|
||||||
&--success {
|
|
||||||
color: $uv-button-success-color;
|
|
||||||
background-color: $uv-button-success-background-color;
|
|
||||||
border-color: $uv-button-success-border-color;
|
|
||||||
border-width: $uv-button-success-border-width;
|
|
||||||
border-style: $uv-button-success-border-style;
|
|
||||||
}
|
|
||||||
|
|
||||||
&--primary {
|
|
||||||
color: $uv-button-primary-color;
|
|
||||||
background-color: $uv-button-primary-background-color;
|
|
||||||
border-color: $uv-button-primary-border-color;
|
|
||||||
border-width: $uv-button-primary-border-width;
|
|
||||||
border-style: $uv-button-primary-border-style;
|
|
||||||
}
|
|
||||||
|
|
||||||
&--error {
|
|
||||||
color: $uv-button-error-color;
|
|
||||||
background-color: $uv-button-error-background-color;
|
|
||||||
border-color: $uv-button-error-border-color;
|
|
||||||
border-width: $uv-button-error-border-width;
|
|
||||||
border-style: $uv-button-error-border-style;
|
|
||||||
}
|
|
||||||
|
|
||||||
&--warning {
|
|
||||||
color: $uv-button-warning-color;
|
|
||||||
background-color: $uv-button-warning-background-color;
|
|
||||||
border-color: $uv-button-warning-border-color;
|
|
||||||
border-width: $uv-button-warning-border-width;
|
|
||||||
border-style: $uv-button-warning-border-style;
|
|
||||||
}
|
|
||||||
|
|
||||||
&--block {
|
|
||||||
@include flex;
|
|
||||||
width: $uv-button-block-width;
|
|
||||||
}
|
|
||||||
|
|
||||||
&--circle {
|
|
||||||
border-top-right-radius: $uv-button-circle-border-top-right-radius;
|
|
||||||
border-top-left-radius: $uv-button-circle-border-top-left-radius;
|
|
||||||
border-bottom-left-radius: $uv-button-circle-border-bottom-left-radius;
|
|
||||||
border-bottom-right-radius: $uv-button-circle-border-bottom-right-radius;
|
|
||||||
}
|
|
||||||
|
|
||||||
&--square {
|
|
||||||
border-bottom-left-radius: $uv-button-square-border-top-right-radius;
|
|
||||||
border-bottom-right-radius: $uv-button-square-border-top-left-radius;
|
|
||||||
border-top-left-radius: $uv-button-square-border-bottom-left-radius;
|
|
||||||
border-top-right-radius: $uv-button-square-border-bottom-right-radius;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__icon {
|
|
||||||
/* #ifndef APP-NVUE */
|
|
||||||
min-width: $uv-button-icon-min-width;
|
|
||||||
line-height: inherit !important;
|
|
||||||
vertical-align: top;
|
|
||||||
/* #endif */
|
|
||||||
}
|
|
||||||
|
|
||||||
&--plain {
|
|
||||||
background-color: $uv-button-plain-background-color;
|
|
||||||
}
|
|
||||||
|
|
||||||
&--hairline {
|
|
||||||
border-width: $uv-button-hairline-border-width !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
@ -1,93 +0,0 @@
|
|||||||
@import '@/uni_modules/uv-ui-tools/libs/css/color.scss';
|
|
||||||
// nvue下hover-class无效
|
|
||||||
$uv-button-before-top:50% !default;
|
|
||||||
$uv-button-before-left:50% !default;
|
|
||||||
$uv-button-before-width:100% !default;
|
|
||||||
$uv-button-before-height:100% !default;
|
|
||||||
$uv-button-before-transform:translate(-50%, -50%) !default;
|
|
||||||
$uv-button-before-opacity:0 !default;
|
|
||||||
$uv-button-before-background-color:#000 !default;
|
|
||||||
$uv-button-before-border-color:#000 !default;
|
|
||||||
$uv-button-active-before-opacity:.15 !default;
|
|
||||||
$uv-button-icon-margin-left:4px !default;
|
|
||||||
$uv-button-plain-uv-button-info-color:$uv-info;
|
|
||||||
$uv-button-plain-uv-button-success-color:$uv-success;
|
|
||||||
$uv-button-plain-uv-button-error-color:$uv-error;
|
|
||||||
$uv-button-plain-uv-button-warning-color:$uv-warning;
|
|
||||||
|
|
||||||
.uv-button-wrapper {
|
|
||||||
position: relative;
|
|
||||||
&--dis {
|
|
||||||
position: absolute;
|
|
||||||
left: 0;
|
|
||||||
top: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
z-index: 9;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.uv-button {
|
|
||||||
width: 100%;
|
|
||||||
|
|
||||||
&__text {
|
|
||||||
white-space: nowrap;
|
|
||||||
line-height: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:before {
|
|
||||||
position: absolute;
|
|
||||||
top:$uv-button-before-top;
|
|
||||||
left:$uv-button-before-left;
|
|
||||||
width:$uv-button-before-width;
|
|
||||||
height:$uv-button-before-height;
|
|
||||||
border: inherit;
|
|
||||||
border-radius: inherit;
|
|
||||||
transform:$uv-button-before-transform;
|
|
||||||
opacity:$uv-button-before-opacity;
|
|
||||||
content: " ";
|
|
||||||
background-color:$uv-button-before-background-color;
|
|
||||||
border-color:$uv-button-before-border-color;
|
|
||||||
}
|
|
||||||
|
|
||||||
&--active {
|
|
||||||
&:before {
|
|
||||||
opacity: .15
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&__icon+&__text:not(:empty),
|
|
||||||
&__loading-text {
|
|
||||||
margin-left:$uv-button-icon-margin-left;
|
|
||||||
}
|
|
||||||
|
|
||||||
&--plain {
|
|
||||||
&.uv-button--primary {
|
|
||||||
color: $uv-primary;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&--plain {
|
|
||||||
&.uv-button--info {
|
|
||||||
color:$uv-button-plain-uv-button-info-color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&--plain {
|
|
||||||
&.uv-button--success {
|
|
||||||
color:$uv-button-plain-uv-button-success-color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&--plain {
|
|
||||||
&.uv-button--error {
|
|
||||||
color:$uv-button-plain-uv-button-error-color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&--plain {
|
|
||||||
&.uv-button--warning {
|
|
||||||
color:$uv-button-plain-uv-button-warning-color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,89 +0,0 @@
|
|||||||
{
|
|
||||||
"id": "uv-button",
|
|
||||||
"displayName": "uv-button 按钮 全面兼容vue3+2、app、h5、小程序等多端",
|
|
||||||
"version": "1.0.15",
|
|
||||||
"description": "按钮组件内部实现以uni-app的button组件为基础,进行二次封装,灵活配置,功能齐全,兼容全端。",
|
|
||||||
"keywords": [
|
|
||||||
"uv-button",
|
|
||||||
"uvui",
|
|
||||||
"uv-ui",
|
|
||||||
"button",
|
|
||||||
"按钮"
|
|
||||||
],
|
|
||||||
"repository": "",
|
|
||||||
"engines": {
|
|
||||||
"HBuilderX": "^3.1.0"
|
|
||||||
},
|
|
||||||
"dcloudext": {
|
|
||||||
"type": "component-vue",
|
|
||||||
"sale": {
|
|
||||||
"regular": {
|
|
||||||
"price": "0.00"
|
|
||||||
},
|
|
||||||
"sourcecode": {
|
|
||||||
"price": "0.00"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"contact": {
|
|
||||||
"qq": ""
|
|
||||||
},
|
|
||||||
"declaration": {
|
|
||||||
"ads": "无",
|
|
||||||
"data": "插件不采集任何数据",
|
|
||||||
"permissions": "无"
|
|
||||||
},
|
|
||||||
"npmurl": ""
|
|
||||||
},
|
|
||||||
"uni_modules": {
|
|
||||||
"dependencies": [
|
|
||||||
"uv-ui-tools",
|
|
||||||
"uv-loading-icon",
|
|
||||||
"uv-icon"
|
|
||||||
],
|
|
||||||
"encrypt": [],
|
|
||||||
"platforms": {
|
|
||||||
"cloud": {
|
|
||||||
"tcb": "y",
|
|
||||||
"aliyun": "y"
|
|
||||||
},
|
|
||||||
"client": {
|
|
||||||
"Vue": {
|
|
||||||
"vue2": "y",
|
|
||||||
"vue3": "y"
|
|
||||||
},
|
|
||||||
"App": {
|
|
||||||
"app-vue": "y",
|
|
||||||
"app-nvue": "y"
|
|
||||||
},
|
|
||||||
"H5-mobile": {
|
|
||||||
"Safari": "y",
|
|
||||||
"Android Browser": "y",
|
|
||||||
"微信浏览器(Android)": "y",
|
|
||||||
"QQ浏览器(Android)": "y"
|
|
||||||
},
|
|
||||||
"H5-pc": {
|
|
||||||
"Chrome": "y",
|
|
||||||
"IE": "y",
|
|
||||||
"Edge": "y",
|
|
||||||
"Firefox": "y",
|
|
||||||
"Safari": "y"
|
|
||||||
},
|
|
||||||
"小程序": {
|
|
||||||
"微信": "y",
|
|
||||||
"阿里": "y",
|
|
||||||
"百度": "y",
|
|
||||||
"字节跳动": "y",
|
|
||||||
"QQ": "y",
|
|
||||||
"钉钉": "u",
|
|
||||||
"快手": "u",
|
|
||||||
"飞书": "u",
|
|
||||||
"京东": "u"
|
|
||||||
},
|
|
||||||
"快应用": {
|
|
||||||
"华为": "u",
|
|
||||||
"联盟": "u"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
## Button 按钮
|
|
||||||
|
|
||||||
> **组件名:uv-button**
|
|
||||||
|
|
||||||
该组件内部实现以`uni-app`的`button`组件为基础,进行二次封装,灵活配置,功能齐全,兼容全端。灵活配置,内置状态设置,开箱即用。
|
|
||||||
|
|
||||||
# <a href="https://www.uvui.cn/components/button.html" target="_blank">查看文档</a>
|
|
||||||
|
|
||||||
## [下载完整示例项目](https://ext.dcloud.net.cn/plugin?name=uv-ui) <small>(请不要 下载插件ZIP)</small>
|
|
||||||
|
|
||||||
### [更多插件,请关注uv-ui组件库](https://ext.dcloud.net.cn/plugin?name=uv-ui)
|
|
||||||
|
|
||||||
<a href="https://ext.dcloud.net.cn/plugin?name=uv-ui" target="_blank">
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
</a>
|
|
||||||
|
|
||||||
#### 如使用过程中有任何问题反馈,或者您对uv-ui有一些好的建议,欢迎加入uv-ui官方交流群:<a href="https://www.uvui.cn/components/addQQGroup.html" target="_blank">官方QQ群</a>
|
|
@ -1,31 +0,0 @@
|
|||||||
## 1.0.13(2023-12-06)
|
|
||||||
1. 优化
|
|
||||||
## 1.0.12(2023-12-06)
|
|
||||||
1. 阻止事件冒泡处理
|
|
||||||
## 1.0.11(2023-10-29)
|
|
||||||
1. imgMode默认值改成aspectFit
|
|
||||||
## 1.0.10(2023-08-13)
|
|
||||||
1. 优化nvue,方便自定义图标
|
|
||||||
## 1.0.9(2023-07-28)
|
|
||||||
1. 修改几个对应错误图标的BUG
|
|
||||||
## 1.0.8(2023-07-24)
|
|
||||||
1. 优化 支持base64图片
|
|
||||||
## 1.0.7(2023-07-17)
|
|
||||||
1. 修复 uv-icon 恢复uv-empty相关的图标
|
|
||||||
## 1.0.6(2023-07-13)
|
|
||||||
1. 修复icon设置name属性对应图标错误的BUG
|
|
||||||
## 1.0.5(2023-07-04)
|
|
||||||
1. 更新图标,删除一些不常用的图标
|
|
||||||
2. 删除base64,修改成ttf文件引入读取图标
|
|
||||||
3. 自定义图标文档说明:https://www.uvui.cn/guide/customIcon.html
|
|
||||||
## 1.0.4(2023-07-03)
|
|
||||||
1. 修复主题颜色在APP不生效的BUG
|
|
||||||
## 1.0.3(2023-05-24)
|
|
||||||
1. 将线上ttf字体包替换成base64,避免加载时或者网络差时候显示白色方块
|
|
||||||
## 1.0.2(2023-05-16)
|
|
||||||
1. 优化组件依赖,修改后无需全局引入,组件导入即可使用
|
|
||||||
2. 优化部分功能
|
|
||||||
## 1.0.1(2023-05-10)
|
|
||||||
1. 修复小程序中异常显示
|
|
||||||
## 1.0.0(2023-05-04)
|
|
||||||
新发版
|
|
@ -1,160 +0,0 @@
|
|||||||
export default {
|
|
||||||
'uvicon-level': 'e68f',
|
|
||||||
'uvicon-checkbox-mark': 'e659',
|
|
||||||
'uvicon-folder': 'e694',
|
|
||||||
'uvicon-movie': 'e67c',
|
|
||||||
'uvicon-star-fill': 'e61e',
|
|
||||||
'uvicon-star': 'e618',
|
|
||||||
'uvicon-phone-fill': 'e6ac',
|
|
||||||
'uvicon-phone': 'e6ba',
|
|
||||||
'uvicon-apple-fill': 'e635',
|
|
||||||
'uvicon-backspace': 'e64d',
|
|
||||||
'uvicon-attach': 'e640',
|
|
||||||
'uvicon-empty-data': 'e671',
|
|
||||||
'uvicon-empty-address': 'e68a',
|
|
||||||
'uvicon-empty-favor': 'e662',
|
|
||||||
'uvicon-empty-car': 'e657',
|
|
||||||
'uvicon-empty-order': 'e66b',
|
|
||||||
'uvicon-empty-list': 'e672',
|
|
||||||
'uvicon-empty-search': 'e677',
|
|
||||||
'uvicon-empty-permission': 'e67d',
|
|
||||||
'uvicon-empty-news': 'e67e',
|
|
||||||
'uvicon-empty-history': 'e685',
|
|
||||||
'uvicon-empty-coupon': 'e69b',
|
|
||||||
'uvicon-empty-page': 'e60e',
|
|
||||||
'uvicon-empty-wifi-off': 'e6cc',
|
|
||||||
'uvicon-reload': 'e627',
|
|
||||||
'uvicon-order': 'e695',
|
|
||||||
'uvicon-server-man': 'e601',
|
|
||||||
'uvicon-search': 'e632',
|
|
||||||
'uvicon-more-dot-fill': 'e66f',
|
|
||||||
'uvicon-scan': 'e631',
|
|
||||||
'uvicon-map': 'e665',
|
|
||||||
'uvicon-map-fill': 'e6a8',
|
|
||||||
'uvicon-tags': 'e621',
|
|
||||||
'uvicon-tags-fill': 'e613',
|
|
||||||
'uvicon-eye': 'e664',
|
|
||||||
'uvicon-eye-fill': 'e697',
|
|
||||||
'uvicon-eye-off': 'e69c',
|
|
||||||
'uvicon-eye-off-outline': 'e688',
|
|
||||||
'uvicon-mic': 'e66d',
|
|
||||||
'uvicon-mic-off': 'e691',
|
|
||||||
'uvicon-calendar': 'e65c',
|
|
||||||
'uvicon-trash': 'e623',
|
|
||||||
'uvicon-trash-fill': 'e6ce',
|
|
||||||
'uvicon-play-left': 'e6bf',
|
|
||||||
'uvicon-play-right': 'e6b3',
|
|
||||||
'uvicon-minus': 'e614',
|
|
||||||
'uvicon-plus': 'e625',
|
|
||||||
'uvicon-info-circle': 'e69f',
|
|
||||||
'uvicon-info-circle-fill': 'e6a7',
|
|
||||||
'uvicon-question-circle': 'e622',
|
|
||||||
'uvicon-question-circle-fill': 'e6bc',
|
|
||||||
'uvicon-close': 'e65a',
|
|
||||||
'uvicon-checkmark': 'e64a',
|
|
||||||
'uvicon-checkmark-circle': 'e643',
|
|
||||||
'uvicon-checkmark-circle-fill': 'e668',
|
|
||||||
'uvicon-setting': 'e602',
|
|
||||||
'uvicon-setting-fill': 'e6d0',
|
|
||||||
'uvicon-heart': 'e6a2',
|
|
||||||
'uvicon-heart-fill': 'e68b',
|
|
||||||
'uvicon-camera': 'e642',
|
|
||||||
'uvicon-camera-fill': 'e650',
|
|
||||||
'uvicon-more-circle': 'e69e',
|
|
||||||
'uvicon-more-circle-fill': 'e684',
|
|
||||||
'uvicon-chat': 'e656',
|
|
||||||
'uvicon-chat-fill': 'e63f',
|
|
||||||
'uvicon-bag': 'e647',
|
|
||||||
'uvicon-error-circle': 'e66e',
|
|
||||||
'uvicon-error-circle-fill': 'e655',
|
|
||||||
'uvicon-close-circle': 'e64e',
|
|
||||||
'uvicon-close-circle-fill': 'e666',
|
|
||||||
'uvicon-share': 'e629',
|
|
||||||
'uvicon-share-fill': 'e6bb',
|
|
||||||
'uvicon-share-square': 'e6c4',
|
|
||||||
'uvicon-shopping-cart': 'e6cb',
|
|
||||||
'uvicon-shopping-cart-fill': 'e630',
|
|
||||||
'uvicon-bell': 'e651',
|
|
||||||
'uvicon-bell-fill': 'e604',
|
|
||||||
'uvicon-list': 'e690',
|
|
||||||
'uvicon-list-dot': 'e6a9',
|
|
||||||
'uvicon-zhifubao-circle-fill': 'e617',
|
|
||||||
'uvicon-weixin-circle-fill': 'e6cd',
|
|
||||||
'uvicon-weixin-fill': 'e620',
|
|
||||||
'uvicon-qq-fill': 'e608',
|
|
||||||
'uvicon-qq-circle-fill': 'e6b9',
|
|
||||||
'uvicon-moments-circel-fill': 'e6c2',
|
|
||||||
'uvicon-moments': 'e6a0',
|
|
||||||
'uvicon-car': 'e64f',
|
|
||||||
'uvicon-car-fill': 'e648',
|
|
||||||
'uvicon-warning-fill': 'e6c7',
|
|
||||||
'uvicon-warning': 'e6c1',
|
|
||||||
'uvicon-clock-fill': 'e64b',
|
|
||||||
'uvicon-clock': 'e66c',
|
|
||||||
'uvicon-edit-pen': 'e65d',
|
|
||||||
'uvicon-edit-pen-fill': 'e679',
|
|
||||||
'uvicon-email': 'e673',
|
|
||||||
'uvicon-email-fill': 'e683',
|
|
||||||
'uvicon-minus-circle': 'e6a5',
|
|
||||||
'uvicon-plus-circle': 'e603',
|
|
||||||
'uvicon-plus-circle-fill': 'e611',
|
|
||||||
'uvicon-file-text': 'e687',
|
|
||||||
'uvicon-file-text-fill': 'e67f',
|
|
||||||
'uvicon-pushpin': 'e6d1',
|
|
||||||
'uvicon-pushpin-fill': 'e6b6',
|
|
||||||
'uvicon-grid': 'e68c',
|
|
||||||
'uvicon-grid-fill': 'e698',
|
|
||||||
'uvicon-play-circle': 'e6af',
|
|
||||||
'uvicon-play-circle-fill': 'e62a',
|
|
||||||
'uvicon-pause-circle-fill': 'e60c',
|
|
||||||
'uvicon-pause': 'e61c',
|
|
||||||
'uvicon-pause-circle': 'e696',
|
|
||||||
'uvicon-gift-fill': 'e6b0',
|
|
||||||
'uvicon-gift': 'e680',
|
|
||||||
'uvicon-kefu-ermai': 'e660',
|
|
||||||
'uvicon-server-fill': 'e610',
|
|
||||||
'uvicon-coupon-fill': 'e64c',
|
|
||||||
'uvicon-coupon': 'e65f',
|
|
||||||
'uvicon-integral': 'e693',
|
|
||||||
'uvicon-integral-fill': 'e6b1',
|
|
||||||
'uvicon-home-fill': 'e68e',
|
|
||||||
'uvicon-home': 'e67b',
|
|
||||||
'uvicon-account': 'e63a',
|
|
||||||
'uvicon-account-fill': 'e653',
|
|
||||||
'uvicon-thumb-down-fill': 'e628',
|
|
||||||
'uvicon-thumb-down': 'e60a',
|
|
||||||
'uvicon-thumb-up': 'e612',
|
|
||||||
'uvicon-thumb-up-fill': 'e62c',
|
|
||||||
'uvicon-lock-fill': 'e6a6',
|
|
||||||
'uvicon-lock-open': 'e68d',
|
|
||||||
'uvicon-lock-opened-fill': 'e6a1',
|
|
||||||
'uvicon-lock': 'e69d',
|
|
||||||
'uvicon-red-packet': 'e6c3',
|
|
||||||
'uvicon-photo-fill': 'e6b4',
|
|
||||||
'uvicon-photo': 'e60d',
|
|
||||||
'uvicon-volume-off-fill': 'e6c8',
|
|
||||||
'uvicon-volume-off': 'e6bd',
|
|
||||||
'uvicon-volume-fill': 'e624',
|
|
||||||
'uvicon-volume': 'e605',
|
|
||||||
'uvicon-download': 'e670',
|
|
||||||
'uvicon-arrow-up-fill': 'e636',
|
|
||||||
'uvicon-arrow-down-fill': 'e638',
|
|
||||||
'uvicon-play-left-fill': 'e6ae',
|
|
||||||
'uvicon-play-right-fill': 'e6ad',
|
|
||||||
'uvicon-arrow-downward': 'e634',
|
|
||||||
'uvicon-arrow-leftward': 'e63b',
|
|
||||||
'uvicon-arrow-rightward': 'e644',
|
|
||||||
'uvicon-arrow-upward': 'e641',
|
|
||||||
'uvicon-arrow-down': 'e63e',
|
|
||||||
'uvicon-arrow-right': 'e63c',
|
|
||||||
'uvicon-arrow-left': 'e646',
|
|
||||||
'uvicon-arrow-up': 'e633',
|
|
||||||
'uvicon-skip-back-left': 'e6c5',
|
|
||||||
'uvicon-skip-forward-right': 'e61f',
|
|
||||||
'uvicon-arrow-left-double': 'e637',
|
|
||||||
'uvicon-man': 'e675',
|
|
||||||
'uvicon-woman': 'e626',
|
|
||||||
'uvicon-en': 'e6b8',
|
|
||||||
'uvicon-twitte': 'e607',
|
|
||||||
'uvicon-twitter-circle-fill': 'e6cf'
|
|
||||||
}
|
|
@ -1,90 +0,0 @@
|
|||||||
export default {
|
|
||||||
props: {
|
|
||||||
// 图标类名
|
|
||||||
name: {
|
|
||||||
type: String,
|
|
||||||
default: ''
|
|
||||||
},
|
|
||||||
// 图标颜色,可接受主题色
|
|
||||||
color: {
|
|
||||||
type: String,
|
|
||||||
default: '#606266'
|
|
||||||
},
|
|
||||||
// 字体大小,单位px
|
|
||||||
size: {
|
|
||||||
type: [String, Number],
|
|
||||||
default: '16px'
|
|
||||||
},
|
|
||||||
// 是否显示粗体
|
|
||||||
bold: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
// 点击图标的时候传递事件出去的index(用于区分点击了哪一个)
|
|
||||||
index: {
|
|
||||||
type: [String, Number],
|
|
||||||
default: null
|
|
||||||
},
|
|
||||||
// 触摸图标时的类名
|
|
||||||
hoverClass: {
|
|
||||||
type: String,
|
|
||||||
default: ''
|
|
||||||
},
|
|
||||||
// 自定义扩展前缀,方便用户扩展自己的图标库
|
|
||||||
customPrefix: {
|
|
||||||
type: String,
|
|
||||||
default: 'uvicon'
|
|
||||||
},
|
|
||||||
// 图标右边或者下面的文字
|
|
||||||
label: {
|
|
||||||
type: [String, Number],
|
|
||||||
default: ''
|
|
||||||
},
|
|
||||||
// label的位置,只能右边或者下边
|
|
||||||
labelPos: {
|
|
||||||
type: String,
|
|
||||||
default: 'right'
|
|
||||||
},
|
|
||||||
// label的大小
|
|
||||||
labelSize: {
|
|
||||||
type: [String, Number],
|
|
||||||
default: '15px'
|
|
||||||
},
|
|
||||||
// label的颜色
|
|
||||||
labelColor: {
|
|
||||||
type: String,
|
|
||||||
default: '#606266'
|
|
||||||
},
|
|
||||||
// label与图标的距离
|
|
||||||
space: {
|
|
||||||
type: [String, Number],
|
|
||||||
default: '3px'
|
|
||||||
},
|
|
||||||
// 图片的mode
|
|
||||||
imgMode: {
|
|
||||||
type: String,
|
|
||||||
default: 'aspectFit'
|
|
||||||
},
|
|
||||||
// 用于显示图片小图标时,图片的宽度
|
|
||||||
width: {
|
|
||||||
type: [String, Number],
|
|
||||||
default: ''
|
|
||||||
},
|
|
||||||
// 用于显示图片小图标时,图片的高度
|
|
||||||
height: {
|
|
||||||
type: [String, Number],
|
|
||||||
default: ''
|
|
||||||
},
|
|
||||||
// 用于解决某些情况下,让图标垂直居中的用途
|
|
||||||
top: {
|
|
||||||
type: [String, Number],
|
|
||||||
default: 0
|
|
||||||
},
|
|
||||||
// 是否阻止事件传播
|
|
||||||
stop: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
...uni.$uv?.props?.icon
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,226 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view
|
|
||||||
class="uv-icon"
|
|
||||||
@tap="clickHandler"
|
|
||||||
:class="['uv-icon--' + labelPos]"
|
|
||||||
>
|
|
||||||
<image
|
|
||||||
class="uv-icon__img"
|
|
||||||
v-if="isImg"
|
|
||||||
:src="name"
|
|
||||||
:mode="imgMode"
|
|
||||||
:style="[imgStyle, $uv.addStyle(customStyle)]"
|
|
||||||
></image>
|
|
||||||
<text
|
|
||||||
v-else
|
|
||||||
class="uv-icon__icon"
|
|
||||||
:class="uClasses"
|
|
||||||
:style="[iconStyle, $uv.addStyle(customStyle)]"
|
|
||||||
:hover-class="hoverClass"
|
|
||||||
>{{icon}}</text>
|
|
||||||
<!-- 这里进行空字符串判断,如果仅仅是v-if="label",可能会出现传递0的时候,结果也无法显示 -->
|
|
||||||
<text
|
|
||||||
v-if="label !== ''"
|
|
||||||
class="uv-icon__label"
|
|
||||||
:style="{
|
|
||||||
color: labelColor,
|
|
||||||
fontSize: $uv.addUnit(labelSize),
|
|
||||||
marginLeft: labelPos == 'right' ? $uv.addUnit(space) : 0,
|
|
||||||
marginTop: labelPos == 'bottom' ? $uv.addUnit(space) : 0,
|
|
||||||
marginRight: labelPos == 'left' ? $uv.addUnit(space) : 0,
|
|
||||||
marginBottom: labelPos == 'top' ? $uv.addUnit(space) : 0
|
|
||||||
}"
|
|
||||||
>{{ label }}</text>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import mpMixin from '@/uni_modules/uv-ui-tools/libs/mixin/mpMixin.js'
|
|
||||||
import mixin from '@/uni_modules/uv-ui-tools/libs/mixin/mixin.js'
|
|
||||||
// #ifdef APP-NVUE
|
|
||||||
// nvue通过weex的dom模块引入字体,相关文档地址如下:
|
|
||||||
// https://weex.apache.org/zh/docs/modules/dom.html#addrule
|
|
||||||
import iconUrl from './uvicons.ttf';
|
|
||||||
const domModule = weex.requireModule('dom')
|
|
||||||
domModule.addRule('fontFace', {
|
|
||||||
'fontFamily': "uvicon-iconfont",
|
|
||||||
'src': "url('" + iconUrl + "')"
|
|
||||||
})
|
|
||||||
// #endif
|
|
||||||
// 引入图标名称,已经对应的unicode
|
|
||||||
import icons from './icons';
|
|
||||||
import props from './props.js';
|
|
||||||
/**
|
|
||||||
* icon 图标
|
|
||||||
* @description 基于字体的图标集,包含了大多数常见场景的图标。
|
|
||||||
* @tutorial https://www.uvui.cn/components/icon.html
|
|
||||||
* @property {String} name 图标名称,见示例图标集
|
|
||||||
* @property {String} color 图标颜色,可接受主题色 (默认 color['uv-content-color'] )
|
|
||||||
* @property {String | Number} size 图标字体大小,单位px (默认 '16px' )
|
|
||||||
* @property {Boolean} bold 是否显示粗体 (默认 false )
|
|
||||||
* @property {String | Number} index 点击图标的时候传递事件出去的index(用于区分点击了哪一个)
|
|
||||||
* @property {String} hoverClass 图标按下去的样式类,用法同uni的view组件的hoverClass参数,详情见官网
|
|
||||||
* @property {String} customPrefix 自定义扩展前缀,方便用户扩展自己的图标库 (默认 'uicon' )
|
|
||||||
* @property {String | Number} label 图标右侧的label文字
|
|
||||||
* @property {String} labelPos label相对于图标的位置,只能right或bottom (默认 'right' )
|
|
||||||
* @property {String | Number} labelSize label字体大小,单位px (默认 '15px' )
|
|
||||||
* @property {String} labelColor 图标右侧的label文字颜色 ( 默认 color['uv-content-color'] )
|
|
||||||
* @property {String | Number} space label与图标的距离,单位px (默认 '3px' )
|
|
||||||
* @property {String} imgMode 图片的mode
|
|
||||||
* @property {String | Number} width 显示图片小图标时的宽度
|
|
||||||
* @property {String | Number} height 显示图片小图标时的高度
|
|
||||||
* @property {String | Number} top 图标在垂直方向上的定位 用于解决某些情况下,让图标垂直居中的用途 (默认 0 )
|
|
||||||
* @property {Boolean} stop 是否阻止事件传播 (默认 false )
|
|
||||||
* @property {Object} customStyle icon的样式,对象形式
|
|
||||||
* @event {Function} click 点击图标时触发
|
|
||||||
* @event {Function} touchstart 事件触摸时触发
|
|
||||||
* @example <uv-icon name="photo" color="#2979ff" size="28"></uv-icon>
|
|
||||||
*/
|
|
||||||
export default {
|
|
||||||
name: 'uv-icon',
|
|
||||||
emits: ['click'],
|
|
||||||
mixins: [mpMixin, mixin, props],
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
colorType: [
|
|
||||||
'primary',
|
|
||||||
'success',
|
|
||||||
'info',
|
|
||||||
'error',
|
|
||||||
'warning'
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
uClasses() {
|
|
||||||
let classes = []
|
|
||||||
classes.push(this.customPrefix)
|
|
||||||
classes.push(this.customPrefix + '-' + this.name)
|
|
||||||
// 主题色,通过类配置
|
|
||||||
if (this.color && this.colorType.includes(this.color)) classes.push('uv-icon__icon--' + this.color)
|
|
||||||
// 阿里,头条,百度小程序通过数组绑定类名时,无法直接使用[a, b, c]的形式,否则无法识别
|
|
||||||
// 故需将其拆成一个字符串的形式,通过空格隔开各个类名
|
|
||||||
//#ifdef MP-ALIPAY || MP-TOUTIAO || MP-BAIDU
|
|
||||||
classes = classes.join(' ')
|
|
||||||
//#endif
|
|
||||||
return classes
|
|
||||||
},
|
|
||||||
iconStyle() {
|
|
||||||
let style = {}
|
|
||||||
style = {
|
|
||||||
fontSize: this.$uv.addUnit(this.size),
|
|
||||||
lineHeight: this.$uv.addUnit(this.size),
|
|
||||||
fontWeight: this.bold ? 'bold' : 'normal',
|
|
||||||
// 某些特殊情况需要设置一个到顶部的距离,才能更好的垂直居中
|
|
||||||
top: this.$uv.addUnit(this.top)
|
|
||||||
}
|
|
||||||
// 非主题色值时,才当作颜色值
|
|
||||||
if (this.color && !this.colorType.includes(this.color)) style.color = this.color
|
|
||||||
return style
|
|
||||||
},
|
|
||||||
// 判断传入的name属性,是否图片路径,只要带有"/"均认为是图片形式
|
|
||||||
isImg() {
|
|
||||||
const isBase64 = this.name.indexOf('data:') > -1 && this.name.indexOf('base64') > -1;
|
|
||||||
return this.name.indexOf('/') !== -1 || isBase64;
|
|
||||||
},
|
|
||||||
imgStyle() {
|
|
||||||
let style = {}
|
|
||||||
// 如果设置width和height属性,则优先使用,否则使用size属性
|
|
||||||
style.width = this.width ? this.$uv.addUnit(this.width) : this.$uv.addUnit(this.size)
|
|
||||||
style.height = this.height ? this.$uv.addUnit(this.height) : this.$uv.addUnit(this.size)
|
|
||||||
return style
|
|
||||||
},
|
|
||||||
// 通过图标名,查找对应的图标
|
|
||||||
icon() {
|
|
||||||
// 如果内置的图标中找不到对应的图标,就直接返回name值,因为用户可能传入的是unicode代码
|
|
||||||
const code = icons['uvicon-' + this.name];
|
|
||||||
// #ifdef APP-NVUE
|
|
||||||
if(!code) {
|
|
||||||
return code ? unescape(`%u${code}`) : ['uvicon'].indexOf(this.customPrefix) > -1 ? unescape(`%u${this.name}`) : '';
|
|
||||||
}
|
|
||||||
// #endif
|
|
||||||
return code ? unescape(`%u${code}`) : ['uvicon'].indexOf(this.customPrefix) > -1 ? this.name : '';
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
clickHandler(e) {
|
|
||||||
this.$emit('click', this.index)
|
|
||||||
// 是否阻止事件冒泡
|
|
||||||
this.stop && this.preventEvent(e)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
@import '@/uni_modules/uv-ui-tools/libs/css/components.scss';
|
|
||||||
@import '@/uni_modules/uv-ui-tools/libs/css/color.scss';
|
|
||||||
// 变量定义
|
|
||||||
$uv-icon-primary: $uv-primary !default;
|
|
||||||
$uv-icon-success: $uv-success !default;
|
|
||||||
$uv-icon-info: $uv-info !default;
|
|
||||||
$uv-icon-warning: $uv-warning !default;
|
|
||||||
$uv-icon-error: $uv-error !default;
|
|
||||||
$uv-icon-label-line-height: 1 !default;
|
|
||||||
/* #ifndef APP-NVUE */
|
|
||||||
// 非nvue下加载字体
|
|
||||||
@font-face {
|
|
||||||
font-family: 'uvicon-iconfont';
|
|
||||||
src: url('./uvicons.ttf') format('truetype');
|
|
||||||
}
|
|
||||||
/* #endif */
|
|
||||||
.uv-icon {
|
|
||||||
/* #ifndef APP-NVUE */
|
|
||||||
display: flex;
|
|
||||||
/* #endif */
|
|
||||||
align-items: center;
|
|
||||||
&--left {
|
|
||||||
flex-direction: row-reverse;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
&--right {
|
|
||||||
flex-direction: row;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
&--top {
|
|
||||||
flex-direction: column-reverse;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
&--bottom {
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
&__icon {
|
|
||||||
font-family: uvicon-iconfont;
|
|
||||||
position: relative;
|
|
||||||
@include flex;
|
|
||||||
align-items: center;
|
|
||||||
&--primary {
|
|
||||||
color: $uv-icon-primary;
|
|
||||||
}
|
|
||||||
&--success {
|
|
||||||
color: $uv-icon-success;
|
|
||||||
}
|
|
||||||
&--error {
|
|
||||||
color: $uv-icon-error;
|
|
||||||
}
|
|
||||||
&--warning {
|
|
||||||
color: $uv-icon-warning;
|
|
||||||
}
|
|
||||||
&--info {
|
|
||||||
color: $uv-icon-info;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&__img {
|
|
||||||
/* #ifndef APP-NVUE */
|
|
||||||
height: auto;
|
|
||||||
will-change: transform;
|
|
||||||
/* #endif */
|
|
||||||
}
|
|
||||||
&__label {
|
|
||||||
/* #ifndef APP-NVUE */
|
|
||||||
line-height: $uv-icon-label-line-height;
|
|
||||||
/* #endif */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
@ -1,83 +0,0 @@
|
|||||||
{
|
|
||||||
"id": "uv-icon",
|
|
||||||
"displayName": "uv-icon 图标 全面兼容vue3+2、app、h5、小程序等多端",
|
|
||||||
"version": "1.0.13",
|
|
||||||
"description": "基于字体的图标集,包含了大多数常见场景的图标,支持自定义,支持自定义图片图标等。可自定义颜色、大小。",
|
|
||||||
"keywords": [
|
|
||||||
"uv-ui,uvui,uv-icon,icon,图标,字体图标"
|
|
||||||
],
|
|
||||||
"repository": "",
|
|
||||||
"engines": {
|
|
||||||
"HBuilderX": "^3.1.0"
|
|
||||||
},
|
|
||||||
"dcloudext": {
|
|
||||||
"type": "component-vue",
|
|
||||||
"sale": {
|
|
||||||
"regular": {
|
|
||||||
"price": "0.00"
|
|
||||||
},
|
|
||||||
"sourcecode": {
|
|
||||||
"price": "0.00"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"contact": {
|
|
||||||
"qq": ""
|
|
||||||
},
|
|
||||||
"declaration": {
|
|
||||||
"ads": "无",
|
|
||||||
"data": "插件不采集任何数据",
|
|
||||||
"permissions": "无"
|
|
||||||
},
|
|
||||||
"npmurl": ""
|
|
||||||
},
|
|
||||||
"uni_modules": {
|
|
||||||
"dependencies": [
|
|
||||||
"uv-ui-tools"
|
|
||||||
],
|
|
||||||
"encrypt": [],
|
|
||||||
"platforms": {
|
|
||||||
"cloud": {
|
|
||||||
"tcb": "y",
|
|
||||||
"aliyun": "y"
|
|
||||||
},
|
|
||||||
"client": {
|
|
||||||
"Vue": {
|
|
||||||
"vue2": "y",
|
|
||||||
"vue3": "y"
|
|
||||||
},
|
|
||||||
"App": {
|
|
||||||
"app-vue": "y",
|
|
||||||
"app-nvue": "y"
|
|
||||||
},
|
|
||||||
"H5-mobile": {
|
|
||||||
"Safari": "y",
|
|
||||||
"Android Browser": "y",
|
|
||||||
"微信浏览器(Android)": "y",
|
|
||||||
"QQ浏览器(Android)": "y"
|
|
||||||
},
|
|
||||||
"H5-pc": {
|
|
||||||
"Chrome": "y",
|
|
||||||
"IE": "y",
|
|
||||||
"Edge": "y",
|
|
||||||
"Firefox": "y",
|
|
||||||
"Safari": "y"
|
|
||||||
},
|
|
||||||
"小程序": {
|
|
||||||
"微信": "y",
|
|
||||||
"阿里": "y",
|
|
||||||
"百度": "y",
|
|
||||||
"字节跳动": "y",
|
|
||||||
"QQ": "y",
|
|
||||||
"钉钉": "u",
|
|
||||||
"快手": "u",
|
|
||||||
"飞书": "u",
|
|
||||||
"京东": "u"
|
|
||||||
},
|
|
||||||
"快应用": {
|
|
||||||
"华为": "u",
|
|
||||||
"联盟": "u"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
## uv-icon 图标库
|
|
||||||
|
|
||||||
> **组件名:uv-icon**
|
|
||||||
|
|
||||||
基于字体的图标集,包含了大多数常见场景的图标,支持自定义,支持自定义图片图标等。
|
|
||||||
|
|
||||||
# <a href="https://www.uvui.cn/components/icon.html" target="_blank">查看文档</a>
|
|
||||||
|
|
||||||
## [下载完整示例项目](https://ext.dcloud.net.cn/plugin?name=uv-ui)
|
|
||||||
|
|
||||||
### [更多插件,请关注uv-ui组件库](https://ext.dcloud.net.cn/plugin?name=uv-ui)
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
#### 如使用过程中有任何问题反馈,或者您对uv-ui有一些好的建议,欢迎加入uv-ui官方交流群:<a href="https://www.uvui.cn/components/addQQGroup.html" target="_blank">官方QQ群</a>
|
|
@ -1,9 +0,0 @@
|
|||||||
## 1.0.3(2023-08-14)
|
|
||||||
1. 新增参数textStyle,自定义文本样式
|
|
||||||
## 1.0.2(2023-06-27)
|
|
||||||
优化
|
|
||||||
## 1.0.1(2023-05-16)
|
|
||||||
1. 优化组件依赖,修改后无需全局引入,组件导入即可使用
|
|
||||||
2. 优化部分功能
|
|
||||||
## 1.0.0(2023-05-10)
|
|
||||||
1. 新增uv-loading-icon组件
|
|
@ -1,67 +0,0 @@
|
|||||||
export default {
|
|
||||||
props: {
|
|
||||||
// 是否显示组件
|
|
||||||
show: {
|
|
||||||
type: Boolean,
|
|
||||||
default: true
|
|
||||||
},
|
|
||||||
// 颜色
|
|
||||||
color: {
|
|
||||||
type: String,
|
|
||||||
default: '#909193'
|
|
||||||
},
|
|
||||||
// 提示文字颜色
|
|
||||||
textColor: {
|
|
||||||
type: String,
|
|
||||||
default: '#909193'
|
|
||||||
},
|
|
||||||
// 文字和图标是否垂直排列
|
|
||||||
vertical: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
// 模式选择,circle-圆形,spinner-花朵形,semicircle-半圆形
|
|
||||||
mode: {
|
|
||||||
type: String,
|
|
||||||
default: 'spinner'
|
|
||||||
},
|
|
||||||
// 图标大小,单位默认px
|
|
||||||
size: {
|
|
||||||
type: [String, Number],
|
|
||||||
default: 24
|
|
||||||
},
|
|
||||||
// 文字大小
|
|
||||||
textSize: {
|
|
||||||
type: [String, Number],
|
|
||||||
default: 15
|
|
||||||
},
|
|
||||||
// 文字样式
|
|
||||||
textStyle: {
|
|
||||||
type: Object,
|
|
||||||
default () {
|
|
||||||
return {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 文字内容
|
|
||||||
text: {
|
|
||||||
type: [String, Number],
|
|
||||||
default: ''
|
|
||||||
},
|
|
||||||
// 动画模式 https://www.runoob.com/cssref/css3-pr-animation-timing-function.html
|
|
||||||
timingFunction: {
|
|
||||||
type: String,
|
|
||||||
default: 'linear'
|
|
||||||
},
|
|
||||||
// 动画执行周期时间
|
|
||||||
duration: {
|
|
||||||
type: [String, Number],
|
|
||||||
default: 1200
|
|
||||||
},
|
|
||||||
// mode=circle时的暗边颜色
|
|
||||||
inactiveColor: {
|
|
||||||
type: String,
|
|
||||||
default: ''
|
|
||||||
},
|
|
||||||
...uni.$uv?.props?.loadingIcon
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,347 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view
|
|
||||||
class="uv-loading-icon"
|
|
||||||
:style="[$uv.addStyle(customStyle)]"
|
|
||||||
:class="[vertical && 'uv-loading-icon--vertical']"
|
|
||||||
v-if="show"
|
|
||||||
>
|
|
||||||
<view
|
|
||||||
v-if="!webviewHide"
|
|
||||||
class="uv-loading-icon__spinner"
|
|
||||||
:class="[`uv-loading-icon__spinner--${mode}`]"
|
|
||||||
ref="ani"
|
|
||||||
:style="{
|
|
||||||
color: color,
|
|
||||||
width: $uv.addUnit(size),
|
|
||||||
height: $uv.addUnit(size),
|
|
||||||
borderTopColor: color,
|
|
||||||
borderBottomColor: otherBorderColor,
|
|
||||||
borderLeftColor: otherBorderColor,
|
|
||||||
borderRightColor: otherBorderColor,
|
|
||||||
'animation-duration': `${duration}ms`,
|
|
||||||
'animation-timing-function': mode === 'semicircle' || mode === 'circle' ? timingFunction : ''
|
|
||||||
}"
|
|
||||||
>
|
|
||||||
<block v-if="mode === 'spinner'">
|
|
||||||
<!-- #ifndef APP-NVUE -->
|
|
||||||
<view
|
|
||||||
v-for="(item, index) in array12"
|
|
||||||
:key="index"
|
|
||||||
class="uv-loading-icon__dot"
|
|
||||||
>
|
|
||||||
</view>
|
|
||||||
<!-- #endif -->
|
|
||||||
<!-- #ifdef APP-NVUE -->
|
|
||||||
<!-- 此组件内部图标部分无法设置宽高,即使通过width和height配置了也无效 -->
|
|
||||||
<loading-indicator
|
|
||||||
v-if="!webviewHide"
|
|
||||||
class="uv-loading-indicator"
|
|
||||||
:animating="true"
|
|
||||||
:style="{
|
|
||||||
color: color,
|
|
||||||
width: $uv.addUnit(size),
|
|
||||||
height: $uv.addUnit(size)
|
|
||||||
}"
|
|
||||||
/>
|
|
||||||
<!-- #endif -->
|
|
||||||
</block>
|
|
||||||
</view>
|
|
||||||
<text
|
|
||||||
v-if="text"
|
|
||||||
class="uv-loading-icon__text"
|
|
||||||
:style="[{
|
|
||||||
fontSize: $uv.addUnit(textSize),
|
|
||||||
color: textColor,
|
|
||||||
},$uv.addStyle(textStyle)]"
|
|
||||||
>{{text}}</text>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { colorGradient } from '@/uni_modules/uv-ui-tools/libs/function/colorGradient.js'
|
|
||||||
import mpMixin from '@/uni_modules/uv-ui-tools/libs/mixin/mpMixin.js'
|
|
||||||
import mixin from '@/uni_modules/uv-ui-tools/libs/mixin/mixin.js'
|
|
||||||
import props from './props.js';
|
|
||||||
// #ifdef APP-NVUE
|
|
||||||
const animation = weex.requireModule('animation');
|
|
||||||
// #endif
|
|
||||||
/**
|
|
||||||
* loading 加载动画
|
|
||||||
* @description 警此组件为一个小动画,目前用在uvui的loadmore加载更多和switch开关等组件的正在加载状态场景。
|
|
||||||
* @tutorial https://www.uvui.cn/components/loading.html
|
|
||||||
* @property {Boolean} show 是否显示组件 (默认 true)
|
|
||||||
* @property {String} color 动画活动区域的颜色,只对 mode = flower 模式有效(默认#909193)
|
|
||||||
* @property {String} textColor 提示文本的颜色(默认#909193)
|
|
||||||
* @property {Boolean} vertical 文字和图标是否垂直排列 (默认 false )
|
|
||||||
* @property {String} mode 模式选择,见官网说明(默认 'circle' )
|
|
||||||
* @property {String | Number} size 加载图标的大小,单位px (默认 24 )
|
|
||||||
* @property {String | Number} textSize 文字大小(默认 15 )
|
|
||||||
* @property {String | Number} text 文字内容
|
|
||||||
* @property {Object} textStyle 文字样式
|
|
||||||
* @property {String} timingFunction 动画模式 (默认 'ease-in-out' )
|
|
||||||
* @property {String | Number} duration 动画执行周期时间(默认 1200)
|
|
||||||
* @property {String} inactiveColor mode=circle时的暗边颜色
|
|
||||||
* @property {Object} customStyle 定义需要用到的外部样式
|
|
||||||
* @example <uv-loading mode="circle"></uv-loading>
|
|
||||||
*/
|
|
||||||
export default {
|
|
||||||
name: 'uv-loading-icon',
|
|
||||||
mixins: [mpMixin, mixin, props],
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
// Array.form可以通过一个伪数组对象创建指定长度的数组
|
|
||||||
// https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/from
|
|
||||||
array12: Array.from({
|
|
||||||
length: 12
|
|
||||||
}),
|
|
||||||
// 这里需要设置默认值为360,否则在安卓nvue上,会延迟一个duration周期后才执行
|
|
||||||
// 在iOS nvue上,则会一开始默认执行两个周期的动画
|
|
||||||
aniAngel: 360, // 动画旋转角度
|
|
||||||
webviewHide: false, // 监听webview的状态,如果隐藏了页面,则停止动画,以免性能消耗
|
|
||||||
loading: false, // 是否运行中,针对nvue使用
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
// 当为circle类型时,给其另外三边设置一个更轻一些的颜色
|
|
||||||
// 之所以需要这么做的原因是,比如父组件传了color为红色,那么需要另外的三个边为浅红色
|
|
||||||
// 而不能是固定的某一个其他颜色(因为这个固定的颜色可能浅蓝,导致效果没有那么细腻良好)
|
|
||||||
otherBorderColor() {
|
|
||||||
const lightColor = colorGradient(this.color, '#ffffff', 100)[80]
|
|
||||||
if (this.mode === 'circle') {
|
|
||||||
return this.inactiveColor ? this.inactiveColor : lightColor
|
|
||||||
} else {
|
|
||||||
return 'transparent'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
show(n) {
|
|
||||||
// nvue中,show为true,且为非loading状态,就重新执行动画模块
|
|
||||||
// #ifdef APP-NVUE
|
|
||||||
if (n && !this.loading) {
|
|
||||||
setTimeout(() => {
|
|
||||||
this.startAnimate()
|
|
||||||
}, 30)
|
|
||||||
}
|
|
||||||
// #endif
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.init()
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
init() {
|
|
||||||
setTimeout(() => {
|
|
||||||
// #ifdef APP-NVUE
|
|
||||||
this.show && this.nvueAnimate()
|
|
||||||
// #endif
|
|
||||||
// #ifdef APP-PLUS
|
|
||||||
this.show && this.addEventListenerToWebview()
|
|
||||||
// #endif
|
|
||||||
}, 20)
|
|
||||||
},
|
|
||||||
// 监听webview的显示与隐藏
|
|
||||||
addEventListenerToWebview() {
|
|
||||||
// webview的堆栈
|
|
||||||
const pages = getCurrentPages()
|
|
||||||
// 当前页面
|
|
||||||
const page = pages[pages.length - 1]
|
|
||||||
// 当前页面的webview实例
|
|
||||||
const currentWebview = page.$getAppWebview()
|
|
||||||
// 监听webview的显示与隐藏,从而停止或者开始动画(为了性能)
|
|
||||||
currentWebview.addEventListener('hide', () => {
|
|
||||||
this.webviewHide = true
|
|
||||||
})
|
|
||||||
currentWebview.addEventListener('show', () => {
|
|
||||||
this.webviewHide = false
|
|
||||||
})
|
|
||||||
},
|
|
||||||
// #ifdef APP-NVUE
|
|
||||||
nvueAnimate() {
|
|
||||||
// nvue下,非spinner类型时才需要旋转,因为nvue的spinner类型,使用了weex的
|
|
||||||
// loading-indicator组件,自带旋转功能
|
|
||||||
this.mode !== 'spinner' && this.startAnimate()
|
|
||||||
},
|
|
||||||
// 执行nvue的animate模块动画
|
|
||||||
startAnimate() {
|
|
||||||
this.loading = true
|
|
||||||
const ani = this.$refs.ani
|
|
||||||
if (!ani) return
|
|
||||||
animation.transition(ani, {
|
|
||||||
// 进行角度旋转
|
|
||||||
styles: {
|
|
||||||
transform: `rotate(${this.aniAngel}deg)`,
|
|
||||||
transformOrigin: 'center center'
|
|
||||||
},
|
|
||||||
duration: this.duration,
|
|
||||||
timingFunction: this.timingFunction,
|
|
||||||
// delay: 10
|
|
||||||
}, () => {
|
|
||||||
// 每次增加360deg,为了让其重新旋转一周
|
|
||||||
this.aniAngel += 360
|
|
||||||
// 动画结束后,继续循环执行动画,需要同时判断webviewHide变量
|
|
||||||
// nvue安卓,页面隐藏后依然会继续执行startAnimate方法
|
|
||||||
this.show && !this.webviewHide ? this.startAnimate() : this.loading = false
|
|
||||||
})
|
|
||||||
}
|
|
||||||
// #endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
@import '@/uni_modules/uv-ui-tools/libs/css/components.scss';
|
|
||||||
@import '@/uni_modules/uv-ui-tools/libs/css/color.scss';
|
|
||||||
$uv-loading-icon-color: #c8c9cc !default;
|
|
||||||
$uv-loading-icon-text-margin-left:4px !default;
|
|
||||||
$uv-loading-icon-text-color:$uv-content-color !default;
|
|
||||||
$uv-loading-icon-text-font-size:14px !default;
|
|
||||||
$uv-loading-icon-text-line-height:20px !default;
|
|
||||||
$uv-loading-width:30px !default;
|
|
||||||
$uv-loading-height:30px !default;
|
|
||||||
$uv-loading-max-width:100% !default;
|
|
||||||
$uv-loading-max-height:100% !default;
|
|
||||||
$uv-loading-semicircle-border-width: 2px !default;
|
|
||||||
$uv-loading-semicircle-border-color:transparent !default;
|
|
||||||
$uv-loading-semicircle-border-top-right-radius: 100px !default;
|
|
||||||
$uv-loading-semicircle-border-top-left-radius: 100px !default;
|
|
||||||
$uv-loading-semicircle-border-bottom-left-radius: 100px !default;
|
|
||||||
$uv-loading-semicircle-border-bottom-right-radiu: 100px !default;
|
|
||||||
$uv-loading-semicircle-border-style: solid !default;
|
|
||||||
$uv-loading-circle-border-top-right-radius: 100px !default;
|
|
||||||
$uv-loading-circle-border-top-left-radius: 100px !default;
|
|
||||||
$uv-loading-circle-border-bottom-left-radius: 100px !default;
|
|
||||||
$uv-loading-circle-border-bottom-right-radiu: 100px !default;
|
|
||||||
$uv-loading-circle-border-width:2px !default;
|
|
||||||
$uv-loading-circle-border-top-color:#e5e5e5 !default;
|
|
||||||
$uv-loading-circle-border-right-color:$uv-loading-circle-border-top-color !default;
|
|
||||||
$uv-loading-circle-border-bottom-color:$uv-loading-circle-border-top-color !default;
|
|
||||||
$uv-loading-circle-border-left-color:$uv-loading-circle-border-top-color !default;
|
|
||||||
$uv-loading-circle-border-style:solid !default;
|
|
||||||
$uv-loading-icon-host-font-size:0px !default;
|
|
||||||
$uv-loading-icon-host-line-height:1 !default;
|
|
||||||
$uv-loading-icon-vertical-margin:6px 0 0 !default;
|
|
||||||
$uv-loading-icon-dot-top:0 !default;
|
|
||||||
$uv-loading-icon-dot-left:0 !default;
|
|
||||||
$uv-loading-icon-dot-width:100% !default;
|
|
||||||
$uv-loading-icon-dot-height:100% !default;
|
|
||||||
$uv-loading-icon-dot-before-width:2px !default;
|
|
||||||
$uv-loading-icon-dot-before-height:25% !default;
|
|
||||||
$uv-loading-icon-dot-before-margin:0 auto !default;
|
|
||||||
$uv-loading-icon-dot-before-background-color:currentColor !default;
|
|
||||||
$uv-loading-icon-dot-before-border-radius:40% !default;
|
|
||||||
|
|
||||||
.uv-loading-icon {
|
|
||||||
/* #ifndef APP-NVUE */
|
|
||||||
// display: inline-flex;
|
|
||||||
/* #endif */
|
|
||||||
flex-direction: row;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
color: $uv-loading-icon-color;
|
|
||||||
|
|
||||||
&__text {
|
|
||||||
margin-left: $uv-loading-icon-text-margin-left;
|
|
||||||
color: $uv-loading-icon-text-color;
|
|
||||||
font-size: $uv-loading-icon-text-font-size;
|
|
||||||
line-height: $uv-loading-icon-text-line-height;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__spinner {
|
|
||||||
width: $uv-loading-width;
|
|
||||||
height: $uv-loading-height;
|
|
||||||
position: relative;
|
|
||||||
/* #ifndef APP-NVUE */
|
|
||||||
box-sizing: border-box;
|
|
||||||
max-width: $uv-loading-max-width;
|
|
||||||
max-height: $uv-loading-max-height;
|
|
||||||
animation: uv-rotate 1s linear infinite;
|
|
||||||
/* #endif */
|
|
||||||
}
|
|
||||||
|
|
||||||
&__spinner--semicircle {
|
|
||||||
border-width: $uv-loading-semicircle-border-width;
|
|
||||||
border-color: $uv-loading-semicircle-border-color;
|
|
||||||
border-top-right-radius: $uv-loading-semicircle-border-top-right-radius;
|
|
||||||
border-top-left-radius: $uv-loading-semicircle-border-top-left-radius;
|
|
||||||
border-bottom-left-radius: $uv-loading-semicircle-border-bottom-left-radius;
|
|
||||||
border-bottom-right-radius: $uv-loading-semicircle-border-bottom-right-radiu;
|
|
||||||
border-style: $uv-loading-semicircle-border-style;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__spinner--circle {
|
|
||||||
border-top-right-radius: $uv-loading-circle-border-top-right-radius;
|
|
||||||
border-top-left-radius: $uv-loading-circle-border-top-left-radius;
|
|
||||||
border-bottom-left-radius: $uv-loading-circle-border-bottom-left-radius;
|
|
||||||
border-bottom-right-radius: $uv-loading-circle-border-bottom-right-radiu;
|
|
||||||
border-width: $uv-loading-circle-border-width;
|
|
||||||
border-top-color: $uv-loading-circle-border-top-color;
|
|
||||||
border-right-color: $uv-loading-circle-border-right-color;
|
|
||||||
border-bottom-color: $uv-loading-circle-border-bottom-color;
|
|
||||||
border-left-color: $uv-loading-circle-border-left-color;
|
|
||||||
border-style: $uv-loading-circle-border-style;
|
|
||||||
}
|
|
||||||
|
|
||||||
&--vertical {
|
|
||||||
flex-direction: column
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* #ifndef APP-NVUE */
|
|
||||||
:host {
|
|
||||||
font-size: $uv-loading-icon-host-font-size;
|
|
||||||
line-height: $uv-loading-icon-host-line-height;
|
|
||||||
}
|
|
||||||
|
|
||||||
.uv-loading-icon {
|
|
||||||
&__spinner--spinner {
|
|
||||||
animation-timing-function: steps(12)
|
|
||||||
}
|
|
||||||
|
|
||||||
&__text:empty {
|
|
||||||
display: none
|
|
||||||
}
|
|
||||||
|
|
||||||
&--vertical &__text {
|
|
||||||
margin: $uv-loading-icon-vertical-margin;
|
|
||||||
color: $uv-content-color;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__dot {
|
|
||||||
position: absolute;
|
|
||||||
top: $uv-loading-icon-dot-top;
|
|
||||||
left: $uv-loading-icon-dot-left;
|
|
||||||
width: $uv-loading-icon-dot-width;
|
|
||||||
height: $uv-loading-icon-dot-height;
|
|
||||||
|
|
||||||
&:before {
|
|
||||||
display: block;
|
|
||||||
width: $uv-loading-icon-dot-before-width;
|
|
||||||
height: $uv-loading-icon-dot-before-height;
|
|
||||||
margin: $uv-loading-icon-dot-before-margin;
|
|
||||||
background-color: $uv-loading-icon-dot-before-background-color;
|
|
||||||
border-radius: $uv-loading-icon-dot-before-border-radius;
|
|
||||||
content: " "
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@for $i from 1 through 12 {
|
|
||||||
.uv-loading-icon__dot:nth-of-type(#{$i}) {
|
|
||||||
transform: rotate($i * 30deg);
|
|
||||||
opacity: 1 - 0.0625 * ($i - 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes uv-rotate {
|
|
||||||
0% {
|
|
||||||
transform: rotate(0deg)
|
|
||||||
}
|
|
||||||
|
|
||||||
to {
|
|
||||||
transform: rotate(1turn)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* #endif */
|
|
||||||
</style>
|
|
@ -1,87 +0,0 @@
|
|||||||
{
|
|
||||||
"id": "uv-loading-icon",
|
|
||||||
"displayName": "uv-loading-icon 加载动画 全面兼容vue3+2、app、h5、小程序等多端",
|
|
||||||
"version": "1.0.3",
|
|
||||||
"description": "此组件为一个小动画,目前用在uv-ui的uv-load-more加载更多等组件,还可以运用在项目中正在加载状态场景。",
|
|
||||||
"keywords": [
|
|
||||||
"uv-loading-icon",
|
|
||||||
"uvui",
|
|
||||||
"uv-ui",
|
|
||||||
"loading",
|
|
||||||
"加载动画"
|
|
||||||
],
|
|
||||||
"repository": "",
|
|
||||||
"engines": {
|
|
||||||
"HBuilderX": "^3.1.0"
|
|
||||||
},
|
|
||||||
"dcloudext": {
|
|
||||||
"type": "component-vue",
|
|
||||||
"sale": {
|
|
||||||
"regular": {
|
|
||||||
"price": "0.00"
|
|
||||||
},
|
|
||||||
"sourcecode": {
|
|
||||||
"price": "0.00"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"contact": {
|
|
||||||
"qq": ""
|
|
||||||
},
|
|
||||||
"declaration": {
|
|
||||||
"ads": "无",
|
|
||||||
"data": "插件不采集任何数据",
|
|
||||||
"permissions": "无"
|
|
||||||
},
|
|
||||||
"npmurl": ""
|
|
||||||
},
|
|
||||||
"uni_modules": {
|
|
||||||
"dependencies": [
|
|
||||||
"uv-ui-tools"
|
|
||||||
],
|
|
||||||
"encrypt": [],
|
|
||||||
"platforms": {
|
|
||||||
"cloud": {
|
|
||||||
"tcb": "y",
|
|
||||||
"aliyun": "y"
|
|
||||||
},
|
|
||||||
"client": {
|
|
||||||
"Vue": {
|
|
||||||
"vue2": "y",
|
|
||||||
"vue3": "y"
|
|
||||||
},
|
|
||||||
"App": {
|
|
||||||
"app-vue": "y",
|
|
||||||
"app-nvue": "y"
|
|
||||||
},
|
|
||||||
"H5-mobile": {
|
|
||||||
"Safari": "y",
|
|
||||||
"Android Browser": "y",
|
|
||||||
"微信浏览器(Android)": "y",
|
|
||||||
"QQ浏览器(Android)": "y"
|
|
||||||
},
|
|
||||||
"H5-pc": {
|
|
||||||
"Chrome": "y",
|
|
||||||
"IE": "y",
|
|
||||||
"Edge": "y",
|
|
||||||
"Firefox": "y",
|
|
||||||
"Safari": "y"
|
|
||||||
},
|
|
||||||
"小程序": {
|
|
||||||
"微信": "y",
|
|
||||||
"阿里": "y",
|
|
||||||
"百度": "y",
|
|
||||||
"字节跳动": "y",
|
|
||||||
"QQ": "y",
|
|
||||||
"钉钉": "u",
|
|
||||||
"快手": "u",
|
|
||||||
"飞书": "u",
|
|
||||||
"京东": "u"
|
|
||||||
},
|
|
||||||
"快应用": {
|
|
||||||
"华为": "u",
|
|
||||||
"联盟": "u"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
## LoadingIcon 加载动画
|
|
||||||
|
|
||||||
> **组件名:uv-loading-icon**
|
|
||||||
|
|
||||||
此组件为一个小动画,目前用在 `uv-ui` 的 `uv-load-more` 加载更多等组件,还可以运用在项目中正在加载状态场景。
|
|
||||||
|
|
||||||
# <a href="https://www.uvui.cn/components/loadingIcon.html" target="_blank">查看文档</a>
|
|
||||||
|
|
||||||
## [下载完整示例项目](https://ext.dcloud.net.cn/plugin?name=uv-ui) <small>(请不要 下载插件ZIP)</small>
|
|
||||||
|
|
||||||
### [更多插件,请关注uv-ui组件库](https://ext.dcloud.net.cn/plugin?name=uv-ui)
|
|
||||||
|
|
||||||
<a href="https://ext.dcloud.net.cn/plugin?name=uv-ui" target="_blank">
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
</a>
|
|
||||||
|
|
||||||
#### 如使用过程中有任何问题反馈,或者您对uv-ui有一些好的建议,欢迎加入uv-ui官方交流群:<a href="https://www.uvui.cn/components/addQQGroup.html" target="_blank">官方QQ群</a>
|
|
@ -1,5 +0,0 @@
|
|||||||
## 1.0.1(2023-05-16)
|
|
||||||
1. 优化组件依赖,修改后无需全局引入,组件导入即可使用
|
|
||||||
2. 优化部分功能
|
|
||||||
## 1.0.0(2023-05-10)
|
|
||||||
uv-no-network 无网络提示
|
|
@ -1,221 +0,0 @@
|
|||||||
<template>
|
|
||||||
<uv-overlay
|
|
||||||
:show="!isConnected"
|
|
||||||
:zIndex="zIndex"
|
|
||||||
@touchmove.stop.prevent="noop"
|
|
||||||
:customStyle="{
|
|
||||||
backgroundColor: '#fff',
|
|
||||||
display: 'flex',
|
|
||||||
justifyContent: 'center',
|
|
||||||
}"
|
|
||||||
>
|
|
||||||
<view
|
|
||||||
class="uv-no-network"
|
|
||||||
>
|
|
||||||
<uv-icon
|
|
||||||
:name="image"
|
|
||||||
size="150"
|
|
||||||
imgMode="widthFit"
|
|
||||||
class="uv-no-network__error-icon"
|
|
||||||
></uv-icon>
|
|
||||||
<text class="uv-no-network__tips">{{tips}}</text>
|
|
||||||
<!-- 只有APP平台,才能跳转设置页,因为需要调用plus环境 -->
|
|
||||||
<!-- #ifdef APP-PLUS -->
|
|
||||||
<view class="uv-no-network__app">
|
|
||||||
<text class="uv-no-network__app__setting">请检查网络,或前往</text>
|
|
||||||
<text
|
|
||||||
class="uv-no-network__app__to-setting"
|
|
||||||
@tap="openSettings"
|
|
||||||
>设置</text>
|
|
||||||
</view>
|
|
||||||
<!-- #endif -->
|
|
||||||
<view class="uv-no-network__retry">
|
|
||||||
<uv-button
|
|
||||||
style="width: 220rpx"
|
|
||||||
text="重试"
|
|
||||||
type="primary"
|
|
||||||
@click="retry"
|
|
||||||
></uv-button>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</uv-overlay>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import mpMixin from '@/uni_modules/uv-ui-tools/libs/mixin/mpMixin.js'
|
|
||||||
import mixin from '@/uni_modules/uv-ui-tools/libs/mixin/mixin.js'
|
|
||||||
import props from './props.js';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* noNetwork 无网络提示
|
|
||||||
* @description 该组件无需任何配置,引入即可,内部自动处理所有功能和事件。
|
|
||||||
* @tutorial https://www.uvui.cn/components/noNetwork.html
|
|
||||||
* @property {String} tips 没有网络时的提示语 (默认:'哎呀,网络信号丢失' )
|
|
||||||
* @property {String | Number} zIndex 组件的z-index值
|
|
||||||
* @property {String} image 无网络的图片提示,可用的src地址或base64图片
|
|
||||||
* @event {Function} retry 用户点击页面的"重试"按钮时触发
|
|
||||||
* @example <uv-no-network></uv-no-network>
|
|
||||||
*/
|
|
||||||
export default {
|
|
||||||
name: "uv-no-network",
|
|
||||||
mixins: [mpMixin, mixin, props],
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
isConnected: true, // 是否有网络连接
|
|
||||||
networkType: "none", // 网络类型
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.isIOS = (uni.getSystemInfoSync().platform === 'ios')
|
|
||||||
uni.onNetworkStatusChange((res) => {
|
|
||||||
this.isConnected = res.isConnected
|
|
||||||
this.networkType = res.networkType
|
|
||||||
this.emitEvent(this.networkType)
|
|
||||||
})
|
|
||||||
uni.getNetworkType({
|
|
||||||
success: (res) => {
|
|
||||||
this.networkType = res.networkType
|
|
||||||
this.emitEvent(this.networkType)
|
|
||||||
if (res.networkType == 'none') {
|
|
||||||
this.isConnected = false
|
|
||||||
} else {
|
|
||||||
this.isConnected = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
retry() {
|
|
||||||
// 重新检查网络
|
|
||||||
uni.getNetworkType({
|
|
||||||
success: (res) => {
|
|
||||||
this.networkType = res.networkType
|
|
||||||
this.emitEvent(this.networkType)
|
|
||||||
if (res.networkType == 'none') {
|
|
||||||
this.$uv.toast('无网络连接')
|
|
||||||
this.isConnected = false
|
|
||||||
} else {
|
|
||||||
this.$uv.toast('网络已连接')
|
|
||||||
this.isConnected = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
this.$emit('retry')
|
|
||||||
},
|
|
||||||
// 发出事件给父组件
|
|
||||||
emitEvent(networkType) {
|
|
||||||
this.$emit(networkType === 'none' ? 'disconnected' : 'connected')
|
|
||||||
},
|
|
||||||
async openSettings() {
|
|
||||||
if (this.networkType == "none") {
|
|
||||||
this.openSystemSettings()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
},
|
|
||||||
openAppSettings() {
|
|
||||||
this.gotoAppSetting()
|
|
||||||
},
|
|
||||||
openSystemSettings() {
|
|
||||||
// 以下方法来自5+范畴,如需深究,请自行查阅相关文档
|
|
||||||
// https://ask.dcloud.net.cn/docs/
|
|
||||||
if (this.isIOS) {
|
|
||||||
this.gotoiOSSetting()
|
|
||||||
} else {
|
|
||||||
this.gotoAndroidSetting()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
network() {
|
|
||||||
var result = null
|
|
||||||
var cellularData = plus.ios.newObject("CTCellularData")
|
|
||||||
var state = cellularData.plusGetAttribute("restrictedState")
|
|
||||||
if (state == 0) {
|
|
||||||
result = null
|
|
||||||
} else if (state == 2) {
|
|
||||||
result = 1
|
|
||||||
} else if (state == 1) {
|
|
||||||
result = 2
|
|
||||||
}
|
|
||||||
plus.ios.deleteObject(cellularData)
|
|
||||||
return result
|
|
||||||
},
|
|
||||||
gotoAppSetting() {
|
|
||||||
if (this.isIOS) {
|
|
||||||
var UIApplication = plus.ios.import("UIApplication")
|
|
||||||
var application2 = UIApplication.sharedApplication()
|
|
||||||
var NSURL2 = plus.ios.import("NSURL")
|
|
||||||
var setting2 = NSURL2.URLWithString("app-settings:")
|
|
||||||
application2.openURL(setting2)
|
|
||||||
plus.ios.deleteObject(setting2)
|
|
||||||
plus.ios.deleteObject(NSURL2)
|
|
||||||
plus.ios.deleteObject(application2)
|
|
||||||
} else {
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
gotoiOSSetting() {
|
|
||||||
var UIApplication = plus.ios.import("UIApplication")
|
|
||||||
var application2 = UIApplication.sharedApplication()
|
|
||||||
var NSURL2 = plus.ios.import("NSURL")
|
|
||||||
var setting2 = NSURL2.URLWithString("App-prefs:root=General")
|
|
||||||
application2.openURL(setting2)
|
|
||||||
plus.ios.deleteObject(setting2)
|
|
||||||
plus.ios.deleteObject(NSURL2)
|
|
||||||
plus.ios.deleteObject(application2)
|
|
||||||
},
|
|
||||||
gotoAndroidSetting() {
|
|
||||||
var Intent = plus.android.importClass("android.content.Intent")
|
|
||||||
var Settings = plus.android.importClass("android.provider.Settings")
|
|
||||||
var mainActivity = plus.android.runtimeMainActivity()
|
|
||||||
var intent = new Intent(Settings.ACTION_SETTINGS)
|
|
||||||
mainActivity.startActivity(intent)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
@import '@/uni_modules/uv-ui-tools/libs/css/components.scss';
|
|
||||||
@import '@/uni_modules/uv-ui-tools/libs/css/color.scss';
|
|
||||||
.uv-no-network {
|
|
||||||
@include flex(column);
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
margin-top: -100px;
|
|
||||||
|
|
||||||
&__tips {
|
|
||||||
color: $uv-tips-color;
|
|
||||||
font-size: 14px;
|
|
||||||
margin-top: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__app {
|
|
||||||
@include flex(row);
|
|
||||||
margin-top: 6px;
|
|
||||||
|
|
||||||
&__setting {
|
|
||||||
color: $uv-light-color;
|
|
||||||
font-size: 13px;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__to-setting {
|
|
||||||
font-size: 13px;
|
|
||||||
color: $uv-primary;
|
|
||||||
margin-left: 3px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&__retry {
|
|
||||||
@include flex(row);
|
|
||||||
justify-content: center;
|
|
||||||
margin-top: 15px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
@ -1,90 +0,0 @@
|
|||||||
{
|
|
||||||
"id": "uv-no-network",
|
|
||||||
"displayName": "uv-no-network 无网络提示 全面兼容小程序、nvue、vue2、vue3等多端",
|
|
||||||
"version": "1.0.1",
|
|
||||||
"description": "uv-no-network 该组件在没有任何网络的情况下,显示在内容上方,无需任何配置,引入即可,内部自动处理所有功能和事件。",
|
|
||||||
"keywords": [
|
|
||||||
"uv-no-network",
|
|
||||||
"uvui",
|
|
||||||
"uv-ui",
|
|
||||||
"network",
|
|
||||||
"无网络"
|
|
||||||
],
|
|
||||||
"repository": "",
|
|
||||||
"engines": {
|
|
||||||
"HBuilderX": "^3.1.0"
|
|
||||||
},
|
|
||||||
"dcloudext": {
|
|
||||||
"type": "component-vue",
|
|
||||||
"sale": {
|
|
||||||
"regular": {
|
|
||||||
"price": "0.00"
|
|
||||||
},
|
|
||||||
"sourcecode": {
|
|
||||||
"price": "0.00"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"contact": {
|
|
||||||
"qq": ""
|
|
||||||
},
|
|
||||||
"declaration": {
|
|
||||||
"ads": "无",
|
|
||||||
"data": "插件不采集任何数据",
|
|
||||||
"permissions": "无"
|
|
||||||
},
|
|
||||||
"npmurl": ""
|
|
||||||
},
|
|
||||||
"uni_modules": {
|
|
||||||
"dependencies": [
|
|
||||||
"uv-ui-tools",
|
|
||||||
"uv-overlay",
|
|
||||||
"uv-icon",
|
|
||||||
"uv-button"
|
|
||||||
],
|
|
||||||
"encrypt": [],
|
|
||||||
"platforms": {
|
|
||||||
"cloud": {
|
|
||||||
"tcb": "y",
|
|
||||||
"aliyun": "y"
|
|
||||||
},
|
|
||||||
"client": {
|
|
||||||
"Vue": {
|
|
||||||
"vue2": "y",
|
|
||||||
"vue3": "y"
|
|
||||||
},
|
|
||||||
"App": {
|
|
||||||
"app-vue": "y",
|
|
||||||
"app-nvue": "y"
|
|
||||||
},
|
|
||||||
"H5-mobile": {
|
|
||||||
"Safari": "y",
|
|
||||||
"Android Browser": "y",
|
|
||||||
"微信浏览器(Android)": "y",
|
|
||||||
"QQ浏览器(Android)": "y"
|
|
||||||
},
|
|
||||||
"H5-pc": {
|
|
||||||
"Chrome": "y",
|
|
||||||
"IE": "y",
|
|
||||||
"Edge": "y",
|
|
||||||
"Firefox": "y",
|
|
||||||
"Safari": "y"
|
|
||||||
},
|
|
||||||
"小程序": {
|
|
||||||
"微信": "y",
|
|
||||||
"阿里": "y",
|
|
||||||
"百度": "y",
|
|
||||||
"字节跳动": "y",
|
|
||||||
"QQ": "y",
|
|
||||||
"钉钉": "u",
|
|
||||||
"快手": "u",
|
|
||||||
"飞书": "u",
|
|
||||||
"京东": "u"
|
|
||||||
},
|
|
||||||
"快应用": {
|
|
||||||
"华为": "u",
|
|
||||||
"联盟": "u"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
## NoNetwork 无网络提示
|
|
||||||
|
|
||||||
> **组件名:uv-no-network**
|
|
||||||
|
|
||||||
该组件在没有任何网络的情况下,显示在内容上方,无需任何配置,引入即可,内部自动处理所有功能和事件。
|
|
||||||
|
|
||||||
### <a href="https://www.uvui.cn/components/noNetwork.html" target="_blank">查看文档</a>
|
|
||||||
|
|
||||||
### [完整示例项目下载 | 关注更多组件](https://ext.dcloud.net.cn/plugin?name=uv-ui)
|
|
||||||
|
|
||||||
#### 如使用过程中有任何问题,或者您对uv-ui有一些好的建议,欢迎加入 uv-ui 交流群:<a href="https://ext.dcloud.net.cn/plugin?id=12287" target="_blank">uv-ui</a>、<a href="https://www.uvui.cn/components/addQQGroup.html" target="_blank">官方QQ群</a>
|
|
@ -1,9 +0,0 @@
|
|||||||
## 1.0.3(2023-07-02)
|
|
||||||
uv-overlay 由于弹出层uv-transition的修改,组件内部做了相应的修改,参数不变。
|
|
||||||
## 1.0.2(2023-06-29)
|
|
||||||
1. 优化,H5端禁止穿透滚动
|
|
||||||
## 1.0.1(2023-05-16)
|
|
||||||
1. 优化组件依赖,修改后无需全局引入,组件导入即可使用
|
|
||||||
2. 优化部分功能
|
|
||||||
## 1.0.0(2023-05-10)
|
|
||||||
1. 新增uv-overlay组件
|
|
@ -1,25 +0,0 @@
|
|||||||
export default {
|
|
||||||
props: {
|
|
||||||
// 是否显示遮罩
|
|
||||||
show: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
// 层级z-index
|
|
||||||
zIndex: {
|
|
||||||
type: [String, Number],
|
|
||||||
default: 10070
|
|
||||||
},
|
|
||||||
// 遮罩的过渡时间,单位为ms
|
|
||||||
duration: {
|
|
||||||
type: [String, Number],
|
|
||||||
default: 300
|
|
||||||
},
|
|
||||||
// 不透明度值,当做rgba的第四个参数
|
|
||||||
opacity: {
|
|
||||||
type: [String, Number],
|
|
||||||
default: 0.5
|
|
||||||
},
|
|
||||||
...uni.$uv?.props?.overlay
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,85 +0,0 @@
|
|||||||
<template>
|
|
||||||
<uv-transition
|
|
||||||
:show="show"
|
|
||||||
mode="fade"
|
|
||||||
custom-class="uv-overlay"
|
|
||||||
:duration="duration"
|
|
||||||
:custom-style="overlayStyle"
|
|
||||||
@click="clickHandler"
|
|
||||||
@touchmove.stop.prevent="clear"
|
|
||||||
>
|
|
||||||
<slot />
|
|
||||||
</uv-transition>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import mpMixin from '@/uni_modules/uv-ui-tools/libs/mixin/mpMixin.js'
|
|
||||||
import mixin from '@/uni_modules/uv-ui-tools/libs/mixin/mixin.js'
|
|
||||||
import props from './props.js';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* overlay 遮罩
|
|
||||||
* @description 创建一个遮罩层,用于强调特定的页面元素,并阻止用户对遮罩下层的内容进行操作,一般用于弹窗场景
|
|
||||||
* @tutorial https://www.uvui.cn/components/overlay.html
|
|
||||||
* @property {Boolean} show 是否显示遮罩(默认 false )
|
|
||||||
* @property {String | Number} zIndex zIndex 层级(默认 10070 )
|
|
||||||
* @property {String | Number} duration 动画时长,单位毫秒(默认 300 )
|
|
||||||
* @property {String | Number} opacity 不透明度值,当做rgba的第四个参数 (默认 0.5 )
|
|
||||||
* @property {Object} customStyle 定义需要用到的外部样式
|
|
||||||
* @event {Function} click 点击遮罩发送事件
|
|
||||||
* @example <uv-overlay :show="show" @click="show = false"></uv-overlay>
|
|
||||||
*/
|
|
||||||
export default {
|
|
||||||
name: "uv-overlay",
|
|
||||||
emits: ['click'],
|
|
||||||
mixins: [mpMixin, mixin, props],
|
|
||||||
watch: {
|
|
||||||
show(newVal){
|
|
||||||
// #ifdef H5
|
|
||||||
if(newVal){
|
|
||||||
document.querySelector('body').style.overflow = 'hidden';
|
|
||||||
}else{
|
|
||||||
document.querySelector('body').style.overflow = '';
|
|
||||||
}
|
|
||||||
// #endif
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
overlayStyle() {
|
|
||||||
const style = {
|
|
||||||
position: 'fixed',
|
|
||||||
top: 0,
|
|
||||||
left: 0,
|
|
||||||
right: 0,
|
|
||||||
zIndex: this.zIndex,
|
|
||||||
bottom: 0,
|
|
||||||
'background-color': `rgba(0, 0, 0, ${this.opacity})`
|
|
||||||
}
|
|
||||||
return this.$uv.deepMerge(style, this.$uv.addStyle(this.customStyle))
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
clickHandler() {
|
|
||||||
this.$emit('click')
|
|
||||||
},
|
|
||||||
clear() {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
/* #ifndef APP-NVUE */
|
|
||||||
$uv-overlay-top:0 !default;
|
|
||||||
$uv-overlay-left:0 !default;
|
|
||||||
$uv-overlay-width:100% !default;
|
|
||||||
$uv-overlay-height:100% !default;
|
|
||||||
$uv-overlay-background-color:rgba(0, 0, 0, .7) !default;
|
|
||||||
.uv-overlay {
|
|
||||||
position: fixed;
|
|
||||||
top:$uv-overlay-top;
|
|
||||||
left:$uv-overlay-left;
|
|
||||||
width: $uv-overlay-width;
|
|
||||||
height:$uv-overlay-height;
|
|
||||||
background-color:$uv-overlay-background-color;
|
|
||||||
}
|
|
||||||
/* #endif */
|
|
||||||
</style>
|
|
@ -1,88 +0,0 @@
|
|||||||
{
|
|
||||||
"id": "uv-overlay",
|
|
||||||
"displayName": "uv-overlay 遮罩层 全面兼容小程序、nvue、vue2、vue3等多端",
|
|
||||||
"version": "1.0.3",
|
|
||||||
"description": "uv-overlay 创建一个遮罩层,用于强调特定的页面元素,并阻止用户对遮罩下层的内容进行操作,一般用于弹窗场景,uv-popup、uv-toast、uv-tooltip等组件就是用了该组件。",
|
|
||||||
"keywords": [
|
|
||||||
"uv-overlay",
|
|
||||||
"uvui",
|
|
||||||
"uv-ui",
|
|
||||||
"overlay",
|
|
||||||
"遮罩层"
|
|
||||||
],
|
|
||||||
"repository": "",
|
|
||||||
"engines": {
|
|
||||||
"HBuilderX": "^3.1.0"
|
|
||||||
},
|
|
||||||
"dcloudext": {
|
|
||||||
"type": "component-vue",
|
|
||||||
"sale": {
|
|
||||||
"regular": {
|
|
||||||
"price": "0.00"
|
|
||||||
},
|
|
||||||
"sourcecode": {
|
|
||||||
"price": "0.00"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"contact": {
|
|
||||||
"qq": ""
|
|
||||||
},
|
|
||||||
"declaration": {
|
|
||||||
"ads": "无",
|
|
||||||
"data": "插件不采集任何数据",
|
|
||||||
"permissions": "无"
|
|
||||||
},
|
|
||||||
"npmurl": ""
|
|
||||||
},
|
|
||||||
"uni_modules": {
|
|
||||||
"dependencies": [
|
|
||||||
"uv-ui-tools",
|
|
||||||
"uv-transition"
|
|
||||||
],
|
|
||||||
"encrypt": [],
|
|
||||||
"platforms": {
|
|
||||||
"cloud": {
|
|
||||||
"tcb": "y",
|
|
||||||
"aliyun": "y"
|
|
||||||
},
|
|
||||||
"client": {
|
|
||||||
"Vue": {
|
|
||||||
"vue2": "y",
|
|
||||||
"vue3": "y"
|
|
||||||
},
|
|
||||||
"App": {
|
|
||||||
"app-vue": "y",
|
|
||||||
"app-nvue": "y"
|
|
||||||
},
|
|
||||||
"H5-mobile": {
|
|
||||||
"Safari": "y",
|
|
||||||
"Android Browser": "y",
|
|
||||||
"微信浏览器(Android)": "y",
|
|
||||||
"QQ浏览器(Android)": "y"
|
|
||||||
},
|
|
||||||
"H5-pc": {
|
|
||||||
"Chrome": "y",
|
|
||||||
"IE": "y",
|
|
||||||
"Edge": "y",
|
|
||||||
"Firefox": "y",
|
|
||||||
"Safari": "y"
|
|
||||||
},
|
|
||||||
"小程序": {
|
|
||||||
"微信": "y",
|
|
||||||
"阿里": "y",
|
|
||||||
"百度": "y",
|
|
||||||
"字节跳动": "y",
|
|
||||||
"QQ": "y",
|
|
||||||
"钉钉": "u",
|
|
||||||
"快手": "u",
|
|
||||||
"飞书": "u",
|
|
||||||
"京东": "u"
|
|
||||||
},
|
|
||||||
"快应用": {
|
|
||||||
"华为": "u",
|
|
||||||
"联盟": "u"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
## Overlay 遮罩层
|
|
||||||
|
|
||||||
> **组件名:uv-overlay**
|
|
||||||
|
|
||||||
创建一个遮罩层,用于强调特定的页面元素,并阻止用户对遮罩下层的内容进行操作,一般用于弹窗场景,uv-popup、uv-toast、uv-tooltip等组件就是用了该组件。
|
|
||||||
|
|
||||||
### <a href="https://www.uvui.cn/components/overlay.html" target="_blank">查看文档</a>
|
|
||||||
|
|
||||||
### [完整示例项目下载 | 关注更多组件](https://ext.dcloud.net.cn/plugin?name=uv-ui)
|
|
||||||
|
|
||||||
#### 如使用过程中有任何问题,或者您对uv-ui有一些好的建议,欢迎加入 uv-ui 交流群:<a href="https://ext.dcloud.net.cn/plugin?id=12287" target="_blank">uv-ui</a>、<a href="https://www.uvui.cn/components/addQQGroup.html" target="_blank">官方QQ群</a>
|
|
@ -1,19 +0,0 @@
|
|||||||
## 1.0.8(2023-10-18)
|
|
||||||
1. 修复在APP上不能正常显示的BUG
|
|
||||||
## 1.0.7(2023-10-12)
|
|
||||||
1. 修复部分情况,修改某属性自动关闭的BUG
|
|
||||||
## 1.0.6(2023-07-24)
|
|
||||||
1. 优化 nvue模式下增加cellChild参数,是否在list中cell节点下,nvue中cell下建议设置成true
|
|
||||||
## 1.0.5(2023-07-02)
|
|
||||||
修改VUE3模式下可能存在的BUG
|
|
||||||
## 1.0.4(2023-07-02)
|
|
||||||
uv-transition 动画组件,代码重构优化,性能更加友好,增加自定义动画功能。详情参考文档:https://www.uvui.cn/components/transition.html
|
|
||||||
## 1.0.3(2023-06-12)
|
|
||||||
1. 恢复this.$nextTick的使用,经过测试百度等平台无问题
|
|
||||||
## 1.0.2(2023-05-23)
|
|
||||||
1. 百度小程序等平台不支持this.$nextick,修改成延时
|
|
||||||
## 1.0.1(2023-05-16)
|
|
||||||
1. 优化组件依赖,修改后无需全局引入,组件导入即可使用
|
|
||||||
2. 优化部分功能
|
|
||||||
## 1.0.0(2023-05-10)
|
|
||||||
1. 新增动画组件
|
|
@ -1,131 +0,0 @@
|
|||||||
// const defaultOption = {
|
|
||||||
// duration: 300,
|
|
||||||
// timingFunction: 'linear',
|
|
||||||
// delay: 0,
|
|
||||||
// transformOrigin: '50% 50% 0'
|
|
||||||
// }
|
|
||||||
// #ifdef APP-NVUE
|
|
||||||
const nvueAnimation = uni.requireNativePlugin('animation')
|
|
||||||
// #endif
|
|
||||||
class MPAnimation {
|
|
||||||
constructor(options, _this) {
|
|
||||||
this.options = options
|
|
||||||
// 在iOS10+QQ小程序平台下,传给原生的对象一定是个普通对象而不是Proxy对象,否则会报parameter should be Object instead of ProxyObject的错误
|
|
||||||
this.animation = uni.createAnimation({
|
|
||||||
...options
|
|
||||||
})
|
|
||||||
this.currentStepAnimates = {}
|
|
||||||
this.next = 0
|
|
||||||
this.$ = _this
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
_nvuePushAnimates(type, args) {
|
|
||||||
let aniObj = this.currentStepAnimates[this.next]
|
|
||||||
let styles = {}
|
|
||||||
if (!aniObj) {
|
|
||||||
styles = {
|
|
||||||
styles: {},
|
|
||||||
config: {}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
styles = aniObj
|
|
||||||
}
|
|
||||||
if (animateTypes1.includes(type)) {
|
|
||||||
if (!styles.styles.transform) {
|
|
||||||
styles.styles.transform = ''
|
|
||||||
}
|
|
||||||
let unit = ''
|
|
||||||
if(type === 'rotate'){
|
|
||||||
unit = 'deg'
|
|
||||||
}
|
|
||||||
styles.styles.transform += `${type}(${args+unit}) `
|
|
||||||
} else {
|
|
||||||
styles.styles[type] = `${args}`
|
|
||||||
}
|
|
||||||
this.currentStepAnimates[this.next] = styles
|
|
||||||
}
|
|
||||||
_animateRun(styles = {}, config = {}) {
|
|
||||||
let ref = this.$.$refs['ani'].ref
|
|
||||||
if (!ref) return
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
nvueAnimation.transition(ref, {
|
|
||||||
styles,
|
|
||||||
...config
|
|
||||||
}, res => {
|
|
||||||
resolve()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
_nvueNextAnimate(animates, step = 0, fn) {
|
|
||||||
let obj = animates[step]
|
|
||||||
if (obj) {
|
|
||||||
let {
|
|
||||||
styles,
|
|
||||||
config
|
|
||||||
} = obj
|
|
||||||
this._animateRun(styles, config).then(() => {
|
|
||||||
step += 1
|
|
||||||
this._nvueNextAnimate(animates, step, fn)
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
this.currentStepAnimates = {}
|
|
||||||
typeof fn === 'function' && fn()
|
|
||||||
this.isEnd = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
step(config = {}) {
|
|
||||||
// #ifndef APP-NVUE
|
|
||||||
this.animation.step(config)
|
|
||||||
// #endif
|
|
||||||
// #ifdef APP-NVUE
|
|
||||||
this.currentStepAnimates[this.next].config = Object.assign({}, this.options, config)
|
|
||||||
this.currentStepAnimates[this.next].styles.transformOrigin = this.currentStepAnimates[this.next].config.transformOrigin
|
|
||||||
this.next++
|
|
||||||
// #endif
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
|
|
||||||
run(fn) {
|
|
||||||
// #ifndef APP-NVUE
|
|
||||||
this.$.animationData = this.animation.export()
|
|
||||||
this.$.timer = setTimeout(() => {
|
|
||||||
typeof fn === 'function' && fn()
|
|
||||||
}, this.$.durationTime)
|
|
||||||
// #endif
|
|
||||||
// #ifdef APP-NVUE
|
|
||||||
this.isEnd = false
|
|
||||||
let ref = this.$.$refs['ani'] && this.$.$refs['ani'].ref
|
|
||||||
if(!ref) return
|
|
||||||
this._nvueNextAnimate(this.currentStepAnimates, 0, fn)
|
|
||||||
this.next = 0
|
|
||||||
// #endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const animateTypes1 = ['matrix', 'matrix3d', 'rotate', 'rotate3d', 'rotateX', 'rotateY', 'rotateZ', 'scale', 'scale3d',
|
|
||||||
'scaleX', 'scaleY', 'scaleZ', 'skew', 'skewX', 'skewY', 'translate', 'translate3d', 'translateX', 'translateY',
|
|
||||||
'translateZ'
|
|
||||||
]
|
|
||||||
const animateTypes2 = ['opacity', 'backgroundColor']
|
|
||||||
const animateTypes3 = ['width', 'height', 'left', 'right', 'top', 'bottom']
|
|
||||||
animateTypes1.concat(animateTypes2, animateTypes3).forEach(type => {
|
|
||||||
MPAnimation.prototype[type] = function(...args) {
|
|
||||||
// #ifndef APP-NVUE
|
|
||||||
this.animation[type](...args)
|
|
||||||
// #endif
|
|
||||||
// #ifdef APP-NVUE
|
|
||||||
this._nvuePushAnimates(type, args)
|
|
||||||
// #endif
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
export function createAnimation(option, _this) {
|
|
||||||
if(!_this) return
|
|
||||||
clearTimeout(_this.timer)
|
|
||||||
return new MPAnimation(option, _this)
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
export default {
|
|
||||||
props: {
|
|
||||||
// 是否展示组件
|
|
||||||
show: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
// 使用的动画模式
|
|
||||||
mode: {
|
|
||||||
type: [Array, String, null],
|
|
||||||
default() {
|
|
||||||
return 'fade'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 动画的执行时间,单位ms
|
|
||||||
duration: {
|
|
||||||
type: [String, Number],
|
|
||||||
default: 300
|
|
||||||
},
|
|
||||||
// 使用的动画过渡函数
|
|
||||||
timingFunction: {
|
|
||||||
type: String,
|
|
||||||
default: 'ease-out'
|
|
||||||
},
|
|
||||||
customClass: {
|
|
||||||
type: String,
|
|
||||||
default: ''
|
|
||||||
},
|
|
||||||
...uni.$uv?.props?.transition
|
|
||||||
}
|
|
||||||
}
|
|