Browse Source

pda修改扫描顺序,分页

tianhui 3 years ago
parent
commit
9156855ab4

+ 0 - 255
package-lock.json

@@ -2,265 +2,10 @@
   "requires": true,
   "lockfileVersion": 1,
   "dependencies": {
-    "ansi-regex": {
-      "version": "4.1.0",
-      "resolved": "https://registry.nlark.com/ansi-regex/download/ansi-regex-4.1.0.tgz",
-      "integrity": "sha1-i5+PCM8ay4Q3Vqg5yox+MWjFGZc="
-    },
-    "ansi-styles": {
-      "version": "3.2.1",
-      "resolved": "https://registry.nlark.com/ansi-styles/download/ansi-styles-3.2.1.tgz?cache=0&sync_timestamp=1618995588464&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fansi-styles%2Fdownload%2Fansi-styles-3.2.1.tgz",
-      "integrity": "sha1-QfuyAkPlCxK+DwS43tvwdSDOhB0=",
-      "requires": {
-        "color-convert": "^1.9.0"
-      }
-    },
-    "base64-js": {
-      "version": "1.5.1",
-      "resolved": "https://registry.npm.taobao.org/base64-js/download/base64-js-1.5.1.tgz?cache=0&sync_timestamp=1605123440207&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fbase64-js%2Fdownload%2Fbase64-js-1.5.1.tgz",
-      "integrity": "sha1-GxtEAWClv3rUC2UPCVljSBkDkwo="
-    },
-    "buffer": {
-      "version": "5.7.1",
-      "resolved": "https://registry.npm.taobao.org/buffer/download/buffer-5.7.1.tgz?cache=0&sync_timestamp=1606098159535&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fbuffer%2Fdownload%2Fbuffer-5.7.1.tgz",
-      "integrity": "sha1-umLnwTEzBTWCGXFghRqPZI6Z7tA=",
-      "requires": {
-        "base64-js": "^1.3.1",
-        "ieee754": "^1.1.13"
-      }
-    },
-    "buffer-alloc": {
-      "version": "1.2.0",
-      "resolved": "https://registry.npm.taobao.org/buffer-alloc/download/buffer-alloc-1.2.0.tgz",
-      "integrity": "sha1-iQ3ZDZI6hz4I4Q5f1RpX5bfM4Ow=",
-      "requires": {
-        "buffer-alloc-unsafe": "^1.1.0",
-        "buffer-fill": "^1.0.0"
-      }
-    },
-    "buffer-alloc-unsafe": {
-      "version": "1.1.0",
-      "resolved": "https://registry.npm.taobao.org/buffer-alloc-unsafe/download/buffer-alloc-unsafe-1.1.0.tgz",
-      "integrity": "sha1-vX3CauKXLQ7aJTvgYdupkjScGfA="
-    },
-    "buffer-fill": {
-      "version": "1.0.0",
-      "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz",
-      "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw="
-    },
-    "buffer-from": {
-      "version": "1.1.1",
-      "resolved": "https://registry.npm.taobao.org/buffer-from/download/buffer-from-1.1.1.tgz",
-      "integrity": "sha1-MnE7wCj3XAL9txDXx7zsHyxgcO8="
-    },
-    "camelcase": {
-      "version": "5.3.1",
-      "resolved": "https://registry.npm.taobao.org/camelcase/download/camelcase-5.3.1.tgz?cache=0&sync_timestamp=1603923709404&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcamelcase%2Fdownload%2Fcamelcase-5.3.1.tgz",
-      "integrity": "sha1-48mzFWnhBoEd8kL3FXJaH0xJQyA="
-    },
-    "cliui": {
-      "version": "5.0.0",
-      "resolved": "https://registry.npm.taobao.org/cliui/download/cliui-5.0.0.tgz?cache=0&sync_timestamp=1604880033053&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcliui%2Fdownload%2Fcliui-5.0.0.tgz",
-      "integrity": "sha1-3u/P2y6AB4SqNPRvoI4GhRx7u8U=",
-      "requires": {
-        "string-width": "^3.1.0",
-        "strip-ansi": "^5.2.0",
-        "wrap-ansi": "^5.1.0"
-      }
-    },
-    "color-convert": {
-      "version": "1.9.3",
-      "resolved": "https://registry.npm.taobao.org/color-convert/download/color-convert-1.9.3.tgz",
-      "integrity": "sha1-u3GFBpDh8TZWfeYp0tVHHe2kweg=",
-      "requires": {
-        "color-name": "1.1.3"
-      }
-    },
-    "color-name": {
-      "version": "1.1.3",
-      "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
-      "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU="
-    },
-    "decamelize": {
-      "version": "1.2.0",
-      "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
-      "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA="
-    },
-    "dijkstrajs": {
-      "version": "1.0.1",
-      "resolved": "https://registry.npmjs.org/dijkstrajs/-/dijkstrajs-1.0.1.tgz",
-      "integrity": "sha1-082BIh4+pAdCz83lVtTpnpjdxxs="
-    },
-    "emoji-regex": {
-      "version": "7.0.3",
-      "resolved": "https://registry.npm.taobao.org/emoji-regex/download/emoji-regex-7.0.3.tgz?cache=0&sync_timestamp=1614682725186&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Femoji-regex%2Fdownload%2Femoji-regex-7.0.3.tgz",
-      "integrity": "sha1-kzoEBShgyF6DwSJHnEdIqOTHIVY="
-    },
-    "find-up": {
-      "version": "3.0.0",
-      "resolved": "https://registry.npm.taobao.org/find-up/download/find-up-3.0.0.tgz",
-      "integrity": "sha1-SRafHXmTQwZG2mHsxa41XCHJe3M=",
-      "requires": {
-        "locate-path": "^3.0.0"
-      }
-    },
-    "get-caller-file": {
-      "version": "2.0.5",
-      "resolved": "https://registry.npm.taobao.org/get-caller-file/download/get-caller-file-2.0.5.tgz",
-      "integrity": "sha1-T5RBKoLbMvNuOwuXQfipf+sDH34="
-    },
-    "ieee754": {
-      "version": "1.2.1",
-      "resolved": "https://registry.npm.taobao.org/ieee754/download/ieee754-1.2.1.tgz?cache=0&sync_timestamp=1603838208740&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fieee754%2Fdownload%2Fieee754-1.2.1.tgz",
-      "integrity": "sha1-jrehCmP/8l0VpXsAFYbRd9Gw01I="
-    },
-    "is-fullwidth-code-point": {
-      "version": "2.0.0",
-      "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
-      "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8="
-    },
-    "isarray": {
-      "version": "2.0.5",
-      "resolved": "https://registry.npm.taobao.org/isarray/download/isarray-2.0.5.tgz",
-      "integrity": "sha1-ivHkwSISRMxiRZ+vOJQNTmRKVyM="
-    },
-    "locate-path": {
-      "version": "3.0.0",
-      "resolved": "https://registry.npm.taobao.org/locate-path/download/locate-path-3.0.0.tgz",
-      "integrity": "sha1-2+w7OrdZdYBxtY/ln8QYca8hQA4=",
-      "requires": {
-        "p-locate": "^3.0.0",
-        "path-exists": "^3.0.0"
-      }
-    },
-    "p-limit": {
-      "version": "2.3.0",
-      "resolved": "https://registry.npm.taobao.org/p-limit/download/p-limit-2.3.0.tgz?cache=0&sync_timestamp=1606290276843&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fp-limit%2Fdownload%2Fp-limit-2.3.0.tgz",
-      "integrity": "sha1-PdM8ZHohT9//2DWTPrCG2g3CHbE=",
-      "requires": {
-        "p-try": "^2.0.0"
-      }
-    },
-    "p-locate": {
-      "version": "3.0.0",
-      "resolved": "https://registry.npm.taobao.org/p-locate/download/p-locate-3.0.0.tgz?cache=0&sync_timestamp=1597081605529&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fp-locate%2Fdownload%2Fp-locate-3.0.0.tgz",
-      "integrity": "sha1-Mi1poFwCZLJZl9n0DNiokasAZKQ=",
-      "requires": {
-        "p-limit": "^2.0.0"
-      }
-    },
-    "p-try": {
-      "version": "2.2.0",
-      "resolved": "https://registry.npm.taobao.org/p-try/download/p-try-2.2.0.tgz",
-      "integrity": "sha1-yyhoVA4xPWHeWPr741zpAE1VQOY="
-    },
-    "path-exists": {
-      "version": "3.0.0",
-      "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
-      "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU="
-    },
-    "pngjs": {
-      "version": "3.4.0",
-      "resolved": "https://registry.npm.taobao.org/pngjs/download/pngjs-3.4.0.tgz",
-      "integrity": "sha1-mcp9clll+2VYFOr2XzjxK72/VV8="
-    },
-    "qrcode": {
-      "version": "1.4.4",
-      "resolved": "https://registry.npm.taobao.org/qrcode/download/qrcode-1.4.4.tgz",
-      "integrity": "sha1-8MQ1aKfnUQpV78O4jZYC9xlj6oM=",
-      "requires": {
-        "buffer": "^5.4.3",
-        "buffer-alloc": "^1.2.0",
-        "buffer-from": "^1.1.1",
-        "dijkstrajs": "^1.0.1",
-        "isarray": "^2.0.1",
-        "pngjs": "^3.3.0",
-        "yargs": "^13.2.4"
-      }
-    },
-    "require-directory": {
-      "version": "2.1.1",
-      "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
-      "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I="
-    },
-    "require-main-filename": {
-      "version": "2.0.0",
-      "resolved": "https://registry.npm.taobao.org/require-main-filename/download/require-main-filename-2.0.0.tgz",
-      "integrity": "sha1-0LMp7MfMD2Fkn2IhW+aa9UqomJs="
-    },
-    "set-blocking": {
-      "version": "2.0.0",
-      "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
-      "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc="
-    },
-    "string-width": {
-      "version": "3.1.0",
-      "resolved": "https://registry.npm.taobao.org/string-width/download/string-width-3.1.0.tgz",
-      "integrity": "sha1-InZ74htirxCBV0MG9prFG2IgOWE=",
-      "requires": {
-        "emoji-regex": "^7.0.1",
-        "is-fullwidth-code-point": "^2.0.0",
-        "strip-ansi": "^5.1.0"
-      }
-    },
-    "strip-ansi": {
-      "version": "5.2.0",
-      "resolved": "https://registry.npm.taobao.org/strip-ansi/download/strip-ansi-5.2.0.tgz?cache=0&sync_timestamp=1618553320591&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fstrip-ansi%2Fdownload%2Fstrip-ansi-5.2.0.tgz",
-      "integrity": "sha1-jJpTb+tq/JYr36WxBKUJHBrZwK4=",
-      "requires": {
-        "ansi-regex": "^4.1.0"
-      }
-    },
     "tki-qrcode": {
       "version": "0.1.6",
       "resolved": "https://registry.npmjs.org/tki-qrcode/-/tki-qrcode-0.1.6.tgz",
       "integrity": "sha512-EnnlS8psowC7PsW3MDYcxvJYkuklX3WAZ/BYanR4TdBHTu74GfjTBX8Y16REP+AeDENiVtBPh4jtTRL2P736hQ=="
-    },
-    "which-module": {
-      "version": "2.0.0",
-      "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz",
-      "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho="
-    },
-    "wrap-ansi": {
-      "version": "5.1.0",
-      "resolved": "https://registry.npm.taobao.org/wrap-ansi/download/wrap-ansi-5.1.0.tgz",
-      "integrity": "sha1-H9H2cjXVttD+54EFYAG/tpTAOwk=",
-      "requires": {
-        "ansi-styles": "^3.2.0",
-        "string-width": "^3.0.0",
-        "strip-ansi": "^5.0.0"
-      }
-    },
-    "y18n": {
-      "version": "4.0.3",
-      "resolved": "https://registry.npm.taobao.org/y18n/download/y18n-4.0.3.tgz?cache=0&sync_timestamp=1617822642544&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fy18n%2Fdownload%2Fy18n-4.0.3.tgz",
-      "integrity": "sha1-tfJZyCzW4zaSHv17/Yv1YN6e7t8="
-    },
-    "yargs": {
-      "version": "13.3.2",
-      "resolved": "https://registry.nlark.com/yargs/download/yargs-13.3.2.tgz",
-      "integrity": "sha1-rX/+/sGqWVZayRX4Lcyzipwxot0=",
-      "requires": {
-        "cliui": "^5.0.0",
-        "find-up": "^3.0.0",
-        "get-caller-file": "^2.0.1",
-        "require-directory": "^2.1.1",
-        "require-main-filename": "^2.0.0",
-        "set-blocking": "^2.0.0",
-        "string-width": "^3.0.0",
-        "which-module": "^2.0.0",
-        "y18n": "^4.0.0",
-        "yargs-parser": "^13.1.2"
-      }
-    },
-    "yargs-parser": {
-      "version": "13.1.2",
-      "resolved": "https://registry.npm.taobao.org/yargs-parser/download/yargs-parser-13.1.2.tgz",
-      "integrity": "sha1-Ew8JcC667vJlDVTObj5XBvek+zg=",
-      "requires": {
-        "camelcase": "^5.0.0",
-        "decamelize": "^1.2.0"
-      }
     }
   }
 }

+ 20 - 17
pages/getin/getin.vue

@@ -108,7 +108,8 @@
 			this.orderInTime = page.orderInTime;
 			this.spaceName = page.spaceName;
 			this.roadNo = page.roadNo;
-			
+			this.carImg = age.carImg;
+			this.vehicleNo = page.vehicleNo
 		},
 		onShow() {
 			
@@ -208,22 +209,24 @@
 				});
 			},
 			getPic(){
-				let that = this;
-				ocr.ocrVehicleNo((ret) => {
-					if (ret.success){
-						that.vehicleNo = ret.vehicleNo;
-						that.carImg = 'data:image/png;base64,' + ret.imageBase64;
-						this.$u.api.tencentBase64Upload({
-							base64: ret.imageBase64,
-							suffix: 'png'
-						})
-						.then(res=>{
-								that.vehicleImage =  res.data.url;
-						}).catch(err=>{});
-					}else {
-						plus.nativeUI.toast('识别失败');
-					}
-				});
+				// let that = this;
+				// ocr.ocrVehicleNo((ret) => {
+				// 	if (ret.success){
+				// 		that.vehicleNo = ret.vehicleNo;
+				// 		that.carImg = 'data:image/png;base64,' + ret.imageBase64;
+				// 		this.$u.api.tencentBase64Upload({
+				// 			base64: ret.imageBase64,
+				// 			suffix: 'png'
+				// 		})
+				// 		.then(res=>{
+				// 				that.vehicleImage =  res.data.url;
+				// 		}).catch(err=>{});
+				// 	}else {
+				// 		plus.nativeUI.toast('识别失败');
+				// 	}
+				// });
+				
+				
 				// uni.chooseImage({
 				// 	count: 1, //默认9
 				// 	sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有

+ 14 - 0
pages/parking/parking.scss

@@ -72,4 +72,18 @@
 	font-weight: 500;
 	color: #FFF;
 	letter-spacing: 1px
+}
+.page{
+	position: fixed;
+	left: 40rpx;
+	right: 40rpx;
+	bottom: 60rpx;
+	height: 85rpx;
+	line-height: 85rpx;
+	border-radius: 10rpx;
+	text-align: center;
+	font-size: 28rpx;
+	font-weight: 500;
+	color: #FFF;
+	letter-spacing: 1px
 }

+ 59 - 19
pages/parking/parking.vue

@@ -16,16 +16,19 @@
 				<view class="text">{{item.spaceName}}</view>
 			</view>			
 			<view class="bottom-btn-wrap">
-				<view class="bottom-btn" @click="openPage('pages/index/index')">返回主页</view>
+				<!-- <view class="bottom-btn" @click="openPage('pages/index/index')">返回主页</view> -->
+				<uni-pagination class="page" v-if="roadspaceList" title="标题文字" :total='total'  @change='uni_pagination_change'></uni-pagination>
 			</view>
 		</view>
-		
-		<u-action-sheet :list="actionList" @click="actionClick" v-model="actionShow"></u-action-sheet>
+		<!-- <u-action-sheet :list="actionList" @click="actionClick" v-model="actionShow"></u-action-sheet> -->
 		<u-toast ref="uToast" />
 	</view>
 </template>
 
 <script>
+	//#ifdef APP-PLUS
+	let ocr = uni.requireNativePlugin("OcrPlug");
+	//#endif
 	export default {
 		data() {
 			return {
@@ -38,7 +41,10 @@
 				roadspaceList:[],
 				spaceId:null,
 				spaceName:'',
-				
+				total:'',
+				list:[],
+				vehicleNo:'',
+				carImg:''
 			}
 		},
 		onLoad() {
@@ -47,6 +53,13 @@
 			
 		},
 		methods:{
+			uni_pagination_change(e){
+			
+				//this.getList(e.current)
+				this.handleGetRoadspace(this.roadNo, e.current)
+				console.log(e)
+				// {type: "next", current: 2}
+			},
 			customBack(){
 				this.$u.route({
 					// type:'switchTab',
@@ -59,13 +72,14 @@
 					url: path
 				})
 			},
-			handleGetRoadspace(roadNo){
-				this.$u.api.getRoadspace({roadNo:this.roadNo,placeStatus:0})
+			handleGetRoadspace(roadNo, page){
+				this.$u.api.getRoadspace({roadNo:this.roadNo,placeStatus:0,pageNum:page || ''})
 				.then(res=>{
 					// this.$refs.uToast.show({
 					// 	title: res.msg,
 					// 	type: 'success',
 					// });
+					this.total=res.data.total;
 					this.roadspaceList = res.data.rows;
 					console.log('handleGetRoadspace',res)
 				}).catch(err=>{
@@ -88,26 +102,52 @@
 				this.spaceId = roadspace.id;
 				this.spaceName = roadspace.spaceName;
 				console.log('roadspace',roadspace);
-			},
-			actionClick(e){
-				console.log('actionClick',e);
-				switch (e){
-					case 0:
+				let that = this;
+				ocr.ocrVehicleNo((ret) => {
+					if (ret.success){
+						that.vehicleNo = ret.vehicleNo;
+						that.carImg = 'data:image/png;base64,' + ret.imageBase64;
+						this.$u.api.tencentBase64Upload({
+							base64: ret.imageBase64,
+							suffix: 'png'
+						})
+						.then(res=>{
+								that.vehicleImage =  res.data.url;
+						}).catch(err=>{});
 						this.$u.route({
 							url: 'pages/getin/getin',
 							params: {
 								spaceId: this.spaceId,
 								spaceName:this.spaceName,
-								roadNo:this.roadNo
+								roadNo:this.roadNo,
+								vehicleNo:that.vehicleNo,
+								carImg:that.carImg
 							}
 						});
-						break;
-					case 1:
-						break;
-					default:
-						break;
-				}
-			}
+					}else {
+						plus.nativeUI.toast('识别失败');
+					}
+				});
+			},
+			// actionClick(e){
+			// 	console.log('actionClick',e);
+			// 	switch (e){
+			// 		case 0:
+			// 			this.$u.route({
+			// 				url: 'pages/getin/getin',
+			// 				params: {
+			// 					spaceId: this.spaceId,
+			// 					spaceName:this.spaceName,
+			// 					roadNo:this.roadNo
+			// 				}
+			// 			});
+			// 			break;
+			// 		case 1:
+			// 			break;
+			// 		default:
+			// 			break;
+			// 	}
+			// }
 			
 		}
 		

+ 9 - 0
uni_modules/uni-pagination/changelog.md

@@ -0,0 +1,9 @@
+## 1.0.7(2021-05-12)
+- 新增 组件示例地址
+## 1.0.6(2021-04-12)
+- 新增 PC 和 移动端适配不同的 ui 
+## 1.0.5(2021-02-05)
+- 优化 组件引用关系,通过uni_modules引用组件
+
+## 1.0.4(2021-02-05)
+- 调整为uni_modules目录规范

+ 391 - 0
uni_modules/uni-pagination/components/uni-pagination/uni-pagination.vue

@@ -0,0 +1,391 @@
+<template>
+	<view class="uni-pagination">
+		<!-- #ifndef APP-NVUE -->
+		<view class="uni-pagination__total is-phone-hide">共 {{ total }} 条</view>
+		<!-- #endif -->
+		<view
+			class="uni-pagination__btn"
+			:class="currentIndex === 1 ? 'uni-pagination--disabled' : 'uni-pagination--enabled'"
+			:hover-class="currentIndex === 1 ? '' : 'uni-pagination--hover'"
+			:hover-start-time="20"
+			:hover-stay-time="70"
+			@click="clickLeft"
+		>
+			<template v-if="showIcon === true || showIcon === 'true'">
+				<uni-icons color="#666" size="16" type="arrowleft" />
+			</template>
+			<template v-else>
+				<text class="uni-pagination__child-btn">{{ prevText }}</text>
+			</template>
+		</view>
+		<view class="uni-pagination__num uni-pagination__num-flex-none">
+			<view class="uni-pagination__num-current">
+				<text class="uni-pagination__num-current-text is-pc-hide" style="color:#409EFF">{{ currentIndex }}</text>
+				<text class="uni-pagination__num-current-text is-pc-hide">/{{ maxPage || 0 }}</text>
+				<!-- #ifndef APP-NVUE -->
+				<view
+					v-for="(item, index) in paper"
+					:key="index"
+					:class="{ 'page--active': item === currentIndex }"
+					class="uni-pagination__num-tag tag--active is-phone-hide"
+					@click.top="selectPage(item, index)"
+				>
+					<text>{{ item }}</text>
+				</view>
+				<!-- #endif -->
+				
+			</view>
+		</view>
+		<view
+			class="uni-pagination__btn"
+			:class="currentIndex >= maxPage ? 'uni-pagination--disabled' : 'uni-pagination--enabled'"
+			:hover-class="currentIndex === maxPage ? '' : 'uni-pagination--hover'"
+			:hover-start-time="20"
+			:hover-stay-time="70"
+			@click="clickRight"
+		>
+			<template v-if="showIcon === true || showIcon === 'true'">
+				<uni-icons color="#666" size="16" type="arrowright" />
+			</template>
+			<template v-else>
+				<text class="uni-pagination__child-btn">{{ nextText }}</text>
+			</template>
+		</view>
+	</view>
+</template>
+
+<script>
+/**
+ * Pagination 分页器
+ * @description 分页器组件,用于展示页码、请求数据等
+ * @tutorial https://ext.dcloud.net.cn/plugin?id=32
+ * @property {String} prevText 左侧按钮文字
+ * @property {String} nextText 右侧按钮文字
+ * @property {Number} current 当前页
+ * @property {Number} total 数据总量
+ * @property {Number} pageSize 每页数据量
+ * @property {Number} showIcon = [true|false] 是否以 icon 形式展示按钮
+ * @event {Function} change 点击页码按钮时触发 ,e={type,current} current为当前页,type值为:next/prev,表示点击的是上一页还是下一个
+ */
+
+export default {
+	name: 'UniPagination',
+	props: {
+		value: {
+			type: [Number, String],
+			default: 1
+		},
+		prevText: {
+			type: String,
+			default: '上一页'
+		},
+		nextText: {
+			type: String,
+			default: '下一页'
+		},
+		current: {
+			type: [Number, String],
+			default: 1
+		},
+		total: {
+			// 数据总量
+			type: [Number, String],
+			default: 0
+		},
+		pageSize: {
+			// 每页数据量
+			type: [Number, String],
+			default: 10
+		},
+		showIcon: {
+			// 是否以 icon 形式展示按钮
+			type: [Boolean, String],
+			default: false
+		},
+		pagerCount: {
+			type: Number,
+			default: 7
+		}
+	},
+	data() {
+		return {
+			currentIndex: 1,
+			paperData: []
+		}
+	},
+	computed: {
+		maxPage() {
+			let maxPage = 1
+			let total = Number(this.total)
+			let pageSize = Number(this.pageSize)
+			if (total && pageSize) {
+				maxPage = Math.ceil(total / pageSize)
+			}
+			return maxPage
+		},
+		paper() {
+			const num = this.currentIndex
+			// TODO 最大页数
+			const pagerCount = this.pagerCount
+			// const total = 181
+			const total = this.total
+			const pageSize = this.pageSize
+			let totalArr = []
+			let showPagerArr = []
+			let pagerNum = Math.ceil(total / pageSize)
+			for (let i = 0; i < pagerNum; i++) {
+				totalArr.push(i + 1)
+			}
+			showPagerArr.push(1)
+			const totalNum = totalArr[totalArr.length - (pagerCount + 1) / 2]
+			totalArr.forEach((item, index) => {
+				if ((pagerCount + 1) / 2 >= num) {
+					if (item < pagerCount + 1 && item > 1) {
+						showPagerArr.push(item)
+					}
+				} else if (num + 2 <= totalNum) {
+					if (item > num - (pagerCount + 1) / 2 && item < num + (pagerCount + 1) / 2) {
+						showPagerArr.push(item)
+					}
+				} else {
+					if ((item > num - (pagerCount + 1) / 2 || pagerNum - pagerCount < item) && item < totalArr[totalArr.length - 1]) {
+						showPagerArr.push(item)
+					}
+				}
+			})
+			if (pagerNum > pagerCount) {
+				if ((pagerCount + 1) / 2 >= num) {
+					showPagerArr[showPagerArr.length - 1] = '...'
+				} else if (num + 2 <= totalNum) {
+					showPagerArr[1] = '...'
+					showPagerArr[showPagerArr.length - 1] = '...'
+				} else {
+					showPagerArr[1] = '...'
+				}
+				showPagerArr.push(totalArr[totalArr.length - 1])
+			} else {
+				if ((pagerCount + 1) / 2 >= num) {
+				} else if (num + 2 <= totalNum) {
+				} else {
+					showPagerArr.shift()
+					showPagerArr.push(totalArr[totalArr.length - 1])
+				}
+			}
+
+			return showPagerArr
+		}
+	},
+	watch: {
+		current(val) {
+			this.currentIndex = val
+		},
+		value(val) {
+			if (val < 1) {
+				this.currentIndex = 1
+			} else {
+				this.currentIndex = val
+			}
+		}
+	},
+	created() {
+		this.currentIndex = +this.value
+	},
+	methods: {
+		// 选择标签
+		selectPage(e, index) {
+			if (parseInt(e)) {
+				this.currentIndex = e
+				this.change('current')
+			} else {
+				let pagerNum = Math.ceil(this.total / this.pageSize)
+				// let pagerNum = Math.ceil(181 / this.pageSize)
+				// 上一页
+				if (index <= 1) {
+					if (this.currentIndex - 5 > 1) {
+						this.currentIndex -= 5
+					} else {
+						this.currentIndex = 1
+					}
+					return
+				}
+				// 下一页
+				if (index >= 6) {
+					if (this.currentIndex + 5 > pagerNum) {
+						this.currentIndex = pagerNum
+					} else {
+						this.currentIndex += 5
+					}
+					return
+				}
+			}
+		},
+		clickLeft() {
+			if (Number(this.currentIndex) === 1) {
+				return
+			}
+			this.currentIndex -= 1
+			this.change('prev')
+		},
+		clickRight() {
+			if (Number(this.currentIndex) >= this.maxPage) {
+				return
+			}
+			this.currentIndex += 1
+			this.change('next')
+		},
+		change(e) {
+			this.$emit('input', this.currentIndex)
+			this.$emit('change', {
+				type: e,
+				current: this.currentIndex
+			})
+		}
+	}
+}
+</script>
+
+<style lang="scss" scoped>
+.uni-pagination {
+	/* #ifndef APP-NVUE */
+	display: flex;
+	/* #endif */
+	position: relative;
+	overflow: hidden;
+	flex-direction: row;
+	justify-content: center;
+	align-items: center;
+}
+
+.uni-pagination__total {
+	font-size: 14px;
+	color: #999;
+	margin-right: 15px;
+}
+
+.uni-pagination__btn {
+	/* #ifndef APP-NVUE */
+	display: flex;
+	cursor: pointer;
+	/* #endif */
+	padding: 0 8px;
+	line-height: 30px;
+	font-size: $uni-font-size-base;
+	position: relative;
+	background-color: #f4f4f5;
+	flex-direction: row;
+	justify-content: center;
+	align-items: center;
+	text-align: center;
+	// border-width: 1px;
+	// border-style: solid;
+	// border-color: $uni-border-color;
+}
+
+.uni-pagination__child-btn {
+	/* #ifndef APP-NVUE */
+	display: flex;
+	/* #endif */
+	font-size: $uni-font-size-base;
+	position: relative;
+	flex-direction: row;
+	justify-content: center;
+	align-items: center;
+	text-align: center;
+}
+
+.uni-pagination__num {
+	/* #ifndef APP-NVUE */
+	display: flex;
+	/* #endif */
+	flex: 1;
+	flex-direction: row;
+	justify-content: center;
+	align-items: center;
+	height: 30px;
+	line-height: 30px;
+	font-size: $uni-font-size-base;
+	color: $uni-text-color;
+	margin: 0 5px;
+}
+
+.uni-pagination__num-tag {
+	/* #ifdef H5 */
+	cursor: pointer;
+	min-width: 30px;
+	/* #endif */
+	margin: 0 5px;
+	height: 30px;
+	text-align: center;
+	line-height: 30px;
+	// border: 1px red solid;
+	color: #666;
+	// border-width: 1px;
+	// border-style: solid;
+	// border-color: $uni-border-color;
+}
+
+.uni-pagination__num-current {
+	/* #ifndef APP-NVUE */
+	display: flex;
+	/* #endif */
+	flex-direction: row;
+}
+
+.uni-pagination__num-current-text {
+	font-size: 15px;
+}
+
+.uni-pagination--enabled {
+	color: #333333;
+	opacity: 1;
+}
+
+.uni-pagination--disabled {
+	opacity: 0.5;
+	/* #ifdef H5 */
+	cursor: default;
+	/* #endif */
+}
+
+.uni-pagination--hover {
+	color: rgba(0, 0, 0, 0.6);
+	background-color: $uni-bg-color-hover;
+}
+
+.tag--active:hover {
+	color: $uni-color-primary;
+}
+
+.page--active {
+	color: #fff;
+	background-color: $uni-color-primary;
+}
+
+.page--active:hover {
+	color: #fff;
+}
+
+/* #ifndef APP-NVUE */
+.is-pc-hide {
+	display: block;
+}
+
+.is-phone-hide {
+	display: none;
+}
+
+@media screen and (min-width: 450px) {
+	.is-pc-hide {
+		display: none;
+	}
+
+	.is-phone-hide {
+		display: block;
+	}
+
+	.uni-pagination__num-flex-none {
+		flex: none;
+	}
+}
+/* #endif */
+</style>

+ 82 - 0
uni_modules/uni-pagination/package.json

@@ -0,0 +1,82 @@
+{
+  "id": "uni-pagination",
+  "displayName": "uni-pagination 分页器",
+  "version": "1.0.7",
+  "description": "Pagination 分页器组件,用于展示页码、请求数据等。",
+  "keywords": [
+    "uni-ui",
+    "uniui",
+    "分页器",
+    "页码"
+],
+  "repository": "https://github.com/dcloudio/uni-ui",
+  "engines": {
+    "HBuilderX": ""
+  },
+  "directories": {
+    "example": "../../temps/example_temps"
+  },
+  "dcloudext": {
+    "category": [
+      "前端组件",
+      "通用组件"
+    ],
+    "sale": {
+      "regular": {
+        "price": "0.00"
+      },
+      "sourcecode": {
+        "price": "0.00"
+      }
+    },
+    "contact": {
+      "qq": ""
+    },
+    "declaration": {
+      "ads": "无",
+      "data": "无",
+      "permissions": "无"
+    },
+    "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
+  },
+  "uni_modules": {
+    "dependencies": ["uni-icons"],
+    "encrypt": [],
+    "platforms": {
+      "cloud": {
+        "tcb": "y",
+        "aliyun": "y"
+      },
+      "client": {
+        "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"
+        }
+      }
+    }
+  }
+}

+ 48 - 0
uni_modules/uni-pagination/readme.md

@@ -0,0 +1,48 @@
+
+
+## Pagination 分页器
+> **组件名:uni-pagination**
+> 代码块: `uPagination`
+
+
+分页器组件,用于展示页码、请求数据等。
+
+### 安装方式
+
+本组件符合[easycom](https://uniapp.dcloud.io/collocation/pages?id=easycom)规范,`HBuilderX 2.5.5`起,只需将本组件导入项目,在页面`template`中即可直接使用,无需在页面中`import`和注册`components`。
+
+如需通过`npm`方式使用`uni-ui`组件,另见文档:[https://ext.dcloud.net.cn/plugin?id=55](https://ext.dcloud.net.cn/plugin?id=55)
+
+### 基本用法
+
+在 ``template`` 中使用组件
+
+```html
+<uni-pagination title="标题文字" total="20"></uni-pagination>
+<uni-pagination title="标题文字" show-icon="true" total="50" current="2"></uni-pagination>
+```
+
+## API
+
+### Pagination Props
+
+|属性名		|类型	|默认值	|说明						|
+|:-:		|:-:	|:-:	|:-:						|
+|prevText	|String	|上一页	|左侧按钮文字				|
+|nextText	|String	|下一页	|右侧按钮文字				|
+|current	|Number	|1		|当前页						|
+|total		|Number	|0		|数据总量					|
+|pageSize	|Number	|10		|每页数据量					|
+|showIcon	|Boolean|false	|是否以 icon 形式展示按钮	|
+
+
+### Pagination Events
+
+|事件称名	|说明				|返回值																		|
+|:-:		|:-:				|:-:																				|
+|@change|点击页码按钮时触发	|e={type,current} current为当前页,type值为:next/prev,表示点击的是上一页还是下一个	|
+
+
+## 组件示例
+
+点击查看:[https://hellouniapp.dcloud.net.cn/pages/extUI/pagination/pagination](https://hellouniapp.dcloud.net.cn/pages/extUI/pagination/pagination)