浏览代码

老人注册、修改。监管用户新增修改待办事项。食堂用户新增修改待办事项

chubiao 1 年之前
父节点
当前提交
e03e711326

+ 20 - 0
api/kh.js

@@ -9,6 +9,16 @@ export function updateKhjbxx(data) {
 	})
 }
 
+
+// 老人信息新增
+export function SaveKhjbxx(data) {
+	return request({
+		url: '/api/business/lrjbxx',
+		method: 'post',
+		data: data
+	})
+}
+
 // 老人信息详情
 export function infoKhjbxx(id) {
 	return request({
@@ -26,4 +36,14 @@ export function ListKhjbxx(data) {
 		method: 'get',
 		data: data
 	})
+}
+
+
+// 老人信息详情
+export function GetLrByZjhm(data) {
+	return request({
+		url: '/api/business/lrjbxx/getLrByZjhm',
+		method: 'get',
+		data: data
+	})
 }

+ 96 - 13
pages/index/index.vue

@@ -14,8 +14,60 @@
 		</view>
 
 		<view class="btnBox">
-			<image class="btnImg" src="../../static/images/lr.png" @click="btnClick(0)" />
-			<image class="btnImg img2" src="../../static/images/shqt.png" @click="btnClick(1)" />
+			<image class="btnImg" src="../../static/images/hywh.png" @click="btnClick(0)" />
+			<image class="btnImg img2" src="../../static/images/jsjz.png" @click="btnClick(1)" />
+		</view>
+
+		<view>
+			<uni-card class="daiban">
+				<uni-section type="line" title="待办事项">
+					<template v-slot:right>
+						<text @click="toList">更多 ></text>
+					</template>
+
+					<uni-list>
+						<uni-list-item v-for="(item,index) in dataList" :key="index" :title="item.lrXm"
+							:thumb="item.lrTx?config.baseUrl+item.lrTx:config.baseUrl + config.head" :note="item.lrCydh"
+							thumbSize="lg" :showArrow="false">
+							<template v-slot:footer>
+								<!-- 	<image v-if="item.lzzt == '0'" src="../../static/images/caogao.png" style="width: 10vw;"
+									mode="widthFix" />
+								<image v-else-if="item.lzzt == '1' || item.lzzt == '2'"
+									src="../../static/images/daishenhe.png" style="width: 10vw;" mode="widthFix" />
+								<image v-else-if="item.lzzt == '3'" src="../../static/images/tongguo.png"
+									style="width: 10vw;" mode="widthFix" />
+								<image v-else-if="item.lzzt == '4'" src="../../static/images/jujue.png"
+									style="width: 10vw;" mode="widthFix" /> -->
+								<view v-if="item.lzzt == '0'"
+									style="width: 60px;display: flex;flex-direction: column;background-image: url('../../static/images/caogao.png');background-position: left;background-size:58px 58px;background-repeat: no-repeat;">
+									<text v-if="item.updateTime">{{item.updateTime.substring(0,8) }}</text>
+									<text v-else>{{item.createTime.substring(0,8) }}</text>
+									<text>{{item.lrSpyj || '无'}}</text>
+								</view>
+								<view v-else-if="item.lzzt == '1' || item.lzzt == '2'"
+									style="width: 60px;display: flex;flex-direction: column;background-image: url('../../static/images/daishenhe.png');background-position: left;background-size:58px 58px;background-repeat: no-repeat;">
+									<text v-if="item.updateTime">{{item.updateTime.substring(0,8) }}</text>
+									<text v-else>{{item.createTime.substring(0,8) }}</text>
+									<text>{{item.lrSpyj || '无'}}</text>
+								</view>
+								<view v-else-if="item.lzzt == '3'"
+									style="width: 60px;display: flex;flex-direction: column;background-image: url('../../static/images/tongguo.png');background-position: left;background-size:58px 58px;background-repeat: no-repeat;">
+									<text v-if="item.updateTime">{{item.updateTime.substring(0,8) }}</text>
+									<text v-else>{{item.createTime.substring(0,8) }}</text>
+									<text>{{item.lrSpyj || '无'}}</text>
+								</view>
+								<view v-else-if="item.lzzt == '4'"
+									style="width: 60px;display: flex;flex-direction: column;background-image: url('../../static/images/jujue.png');background-position: left;background-size:58px 58px;background-repeat: no-repeat;">
+									<text v-if="item.updateTime">{{item.updateTime.substring(0,8) }}</text>
+									<text v-else>{{item.createTime.substring(0,8) }}</text>
+									<text>{{item.lrSpyj || '无'}}</text>
+								</view>
+
+							</template>
+						</uni-list-item>
+					</uni-list>
+				</uni-section>
+			</uni-card>
 		</view>
 
 	</view>
@@ -32,7 +84,8 @@
 	} from '@/common/sm4.js'
 	import {
 		updateKhjbxx,
-		infoKhjbxx
+		infoKhjbxx,
+		ListKhjbxx
 	} from '@/api/kh.js'
 	export default {
 		data() {
@@ -45,18 +98,46 @@
 				// 人员信息
 				userInfo: {},
 				userType: '',
+				form: {
+					pageNum: 1,
+					pageSize: 4,
+					createUserId: ''
+				},
+				dataList: [],
+				total: 0,
 			}
 		},
-		mounted() {
+		onShow() {
 			// 老人07、员工04、监管06
 			this.userInfo = getUser()
 			this.userType = this.userInfo.userType
 			if (this.userType == '07') {
 				this.info(this.userInfo.userId)
+			} else {
+				this.form.createUserId = this.userInfo.userId
 			}
-
+			this.getDaiBanList()
 		},
 		methods: {
+			getDaiBanList() {
+				ListKhjbxx(this.form).then(res => {
+					if (res.code == 200) {
+						this.total = res.total
+						let list = decryptRowData_ECB(res.rows, ["lrZjhm", "lrXm", "lrHjbcxx", "lrXjdzBcxx",
+							"lrCydh", "lrPoxm", "lrPoZjmh", "jhrXm", "jhrSjhm", "zlrXm", "zlrDh", "cjzh",
+							"yhzh", "khmc"
+						], [2, 1, 4, 4, 3, 1, 2, 1, 2, 1, 3, 5, 5, 5])
+						if (list) this.dataList.push(...list)
+					}
+				})
+			},
+			toList() {
+				// 待办事项(他给老人注册、他给老人维护)  会员维护  结算记账(食堂)
+				// 登录不获取openid
+				uni.navigateTo({
+					url: '/pages/lr/list'
+				})
+			},
 			info(id) {
 				infoKhjbxx(id).then(res => {
 					if (res.code == 200) {
@@ -68,19 +149,13 @@
 				})
 			},
 			btnClick(index) {
-				if (index == 0 && this.userType != '07') {
-					uni.showToast({
-						icon: 'none',
-						title: '该功能暂未开放'
-					})
-				} else if (index == 1 && this.userType == '07') {
+				if (index == 1 && this.userType != '04') {
 					uni.showToast({
 						icon: 'none',
 						title: '该功能暂未开放'
 					})
 				} else {
-					let baseUrl = this.userInfo.userType == '07' ? '/pages/lr/base?info=' + JSON.stringify(this.lrInfo) :
-						'/pages/lr/list'
+					let baseUrl = '/pages/lr/base?info=' + JSON.stringify(this.lrInfo)
 					let url = index == 0 ? baseUrl : '/pages/test/index'
 					uni.navigateTo({
 						url: url
@@ -155,6 +230,7 @@
 	}
 
 	.container {
+		display: flex;
 		height: 100vh;
 		width: 100vw;
 		background: linear-gradient(to bottom, #07bf61 0%, #fff 30%, #F8FCFF 100%);
@@ -178,4 +254,11 @@
 	.img2 {
 		margin-left: 5vw;
 	}
+
+	.daiban {
+		width: 84.5vw;
+		left: 1.5vw;
+		top: 49vh;
+
+	}
 </style>

+ 7 - 2
pages/login/index.vue

@@ -18,7 +18,8 @@
 						</view>
 						<view>
 							<uni-forms-item name="password">
-								<input class="inputClass" v-model="formData.password" :password="true" />
+								<input id="ins" class="inputClass" v-model="formData.password" :password="true"
+									@blur="close()" />
 							</uni-forms-item>
 						</view>
 						<view>
@@ -84,7 +85,11 @@
 			}
 		},
 		methods: {
-			close() {},
+			close() {
+				window.scrollTo({
+					top: 0
+				})
+			},
 			register() {
 				uni.navigateTo({
 					url: '/pages/lr/register?code=' + this.formData.code

+ 98 - 24
pages/lr/base.vue

@@ -18,10 +18,10 @@
 						<uni-easyinput type="text" v-model="baseFormData.lrHjbcxx" placeholder="请输入住址"
 							:inputBorder="false"></uni-easyinput>
 					</uni-forms-item>
-					<uni-forms-item label="分数">
+					<!-- <uni-forms-item label="分数">
 						<uni-easyinput type="text" v-model="score"
 							:inputBorder="false"></uni-easyinput>
-					</uni-forms-item>
+					</uni-forms-item> -->
 					<uni-forms-item label="人像" required>
 						<image :src="src" @click="takePhoto" mode="widthFix" style="width: 25vw;"></image>
 					</uni-forms-item>
@@ -59,11 +59,19 @@
 	} from '@/api/upload.js'
 	import {
 		updateKhjbxx,
-		infoKhjbxx
+		infoKhjbxx,
+		GetLrByZjhm,
+		SaveKhjbxx
 	} from '@/api/kh.js'
 	import {
 		getUser
 	} from '@/common/auth.js'
+	import {
+		setToken,
+		setOpenid,
+		getOpenid,
+		setUser
+	} from '@/common/auth.js'
 	import CryptoJS from 'crypto-js';
 	import config from '@/config.js';
 	import idCardNoUtil from '@/common/idcard.js'
@@ -71,6 +79,9 @@
 		translate,
 		base64ToUrl
 	} from '@/common/image.js'
+	import {
+		Register
+	} from '@/api/login.js'
 	export default {
 		components: {
 			lzcOCR
@@ -120,6 +131,7 @@
 				// ocrXm
 				ocrXm: '',
 				isSearch: false,
+				updateFlag: false,
 				baseFormData: {
 					lrXm: '',
 					lrZjhm: '',
@@ -167,11 +179,16 @@
 		onLoad(o) {
 			this.getDictList(Object.keys(this.dicts), this.dicts)
 			this.userInfo = getUser()
+			this.baseFormData.lrHjdz = this.userInfo.dept.locationCode
 			this.groupId = this.userInfo.dept.locationCode.substring(0, 6)
-			let info = JSON.parse(o.info)
-			this.baseFormData = info
-			// this.zjcaijianSrc = config.baseUrl + info.lrZjz
-			this.src = config.baseUrl + info.lrTx
+			if (this.userInfo.userType == '07') {
+				this.updateFlag = true
+				let info = JSON.parse(o.info)
+				this.baseFormData.lrHjdz = info.lrHjdz
+				this.groupId = info.lrHjdz.substring(0, 6)
+				this.baseFormData = info
+				this.src = config.baseUrl + info.lrTx
+			}
 		},
 		methods: {
 			getAccessToken() {
@@ -221,9 +238,15 @@
 						console.log('对比', res);
 						if (res.data.error_msg == 'SUCCESS') {
 							this.score = res.data.result.score;
+
+							this.baseFormData.lrTxdb = JSON.stringify({
+								"lrJmzjhm": this.idcardMD5,
+								"xsfs": this.score
+							})
 							if (this.score >= config.score) {
 								this.show = false
 								this.baseFormData.lzzt = 3
+								this.baseFormData.lrSpyj = '同意'
 								this.baseFormData.prelrZjz = this.idcardFaceUrl
 								this.faceSearch()
 							} else {
@@ -237,6 +260,7 @@
 								// ocr失败身份证原版入库,ocr成功人脸入库
 								// showConfirm('人像与身份证不符,请重新上传')
 								this.baseFormData.lzzt = 1
+								this.baseFormData.lrSpyj = ''
 								this.show = true
 								this.baseFormData.prelrZjz = this.zjcaijianSrc
 								uni.hideLoading()
@@ -331,8 +355,19 @@
 								this.createGroup()
 							} else {
 								if (res.data.result.user_list[0].score >= config.score) {
-									this.baseFormData.xslrZjhm = res.data.result.user_list[0].user_id
-									this.baseFormData.lzzt = 2
+									let xs = []
+									res.data.result.user_list.forEach(e => {
+										if (e.user_id != this.idcardMD5) {
+											xs.push({
+												"lrJmzjhm": e.user_id,
+												"xsfs": e.score
+											})
+											this.baseFormData.lzzt = 2
+											this.baseFormData.lrSpyj = ''
+										}
+
+									})
+									this.baseFormData.xslrZjhm = JSON.stringify(xs)
 								}
 								this.faceAdd()
 							}
@@ -363,7 +398,7 @@
 					// }
 					if ((this.score >= config.score) || (this.score < config.score && this.radio == '1')) {
 						uni.showLoading({
-							title: '正在修改中...'
+							title: '正在保存中...'
 						})
 						this.$refs['baseForm'].validate().then(res => {
 							UploadOne(this.baseFormData.prelrZjz, {}).then(re => {
@@ -372,19 +407,40 @@
 								UploadOne(this.src, {}).then(re => {
 									console.log("re", re)
 									this.baseFormData.lrTx = re.data.url
-									this.baseFormData.id = this.userInfo.userId
-									updateKhjbxx(this.baseFormData).then(r => {
-										console.log("r:", r)
-										uni.hideLoading()
-										if (r.code == 200) {
-											toast('修改成功')
-											setTimeout(function() {
-												uni.switchTab({
-													url: '/pages/index/index'
-												})
-											}, 1000)
-										}
-									})
+									if (this.userInfo.userType == '07') this.baseFormData.id = this
+										.userInfo.userId
+
+									if (this.updateFlag) {
+										updateKhjbxx(this.baseFormData).then(r => {
+											console.log("r:", r)
+											uni.hideLoading()
+											if (r.code == 200) {
+												toast('保存成功')
+												setTimeout(function() {
+													uni.switchTab({
+														url: '/pages/index/index'
+													})
+												}, 1000)
+											}
+										})
+									} else {
+										SaveKhjbxx(this.baseFormData).then(r => {
+											console.log("r:", r)
+											uni.hideLoading()
+											if (r.code == 200) {
+												toast('保存成功')
+												// setOpenid(r.data.openId)
+												// setUser(r.data.sysUser)
+												// setToken(r.data.token.access_token)
+												setTimeout(function() {
+													uni.switchTab({
+														url: '/pages/index/index'
+													})
+												}, 1000)
+											}
+										})
+									}
+
 								})
 							})
 						}).catch(err => {
@@ -455,7 +511,7 @@
 					showConfirm('身份证号识别有误,请重新上传')
 					return
 				}
-				if (this.baseFormData.lrZjhm != id) {
+				if (this.userType == '07' && this.baseFormData.lrZjhm != id) {
 					showConfirm('请使用本人身份证重新上传')
 					return
 				}
@@ -492,6 +548,24 @@
 				this.ocrXm = words.words_result['姓名'].words
 				this.zjSrc = src
 				this.zjcaijianSrc = base64ToUrl(words.card_image);
+
+				if (this.userInfo.userType != '07') {
+					GetLrByZjhm({
+						lrJmzjhm: this.idcardMD5
+					}).then(res => {
+						console.log(res);
+						if (res.data) this.baseFormData = decryptData_ECB(res.data, ["lrZjhm", "lrXm", "lrHjbcxx",
+							"lrXjdzBcxx",
+							"lrCydh", "lrPoxm", "lrPoZjmh", "jhrXm", "jhrSjhm", "zlrXm", "zlrDh", "cjzh",
+							"yhzh", "khmc"
+						], [2, 1, 4, 4, 3, 1, 2, 1, 2, 1, 3, 5, 5, 5]);
+						if (res.data && res.data.lrHjdz) this.baseFormData.lrHjdz = res.data
+							.lrHjdz
+						if (this.baseFormData.lrTx) this.src = config.baseUrl + this.baseFormData.lrTx
+						if (res.data) this.updateFlag = true
+					})
+				}
+
 			},
 		}
 	}

+ 54 - 16
pages/lr/list.vue

@@ -1,20 +1,32 @@
 <template>
 	<view>
 		<uni-card>
-
+			<uni-search-bar :radius="100" @confirm="search" placeholder="请输入姓名搜索" v-model="form.lrXm"></uni-search-bar>
 			<uni-list>
 				<uni-list-item v-for="(item,index) in dataList" :key="index" :title="item.lrXm"
-					:thumb="item.lrTx?config.baseUrl+item.lrTx:config.baseUrl + config.head" thumbSize="lg"
-					:showArrow="false">
+					:thumb="item.lrTx?config.baseUrl+item.lrTx:config.baseUrl + config.head" :note="item.lrCydh"
+					thumbSize="lg" :showArrow="false">
 					<template v-slot:footer>
-						<image v-if="item.lzzt == '0'" src="../../static/images/caogao.png" style="width: 10vw;"
-							mode="widthFix" />
-						<image v-else-if="item.lzzt == '1' || item.lzzt == '2'" src="../../static/images/caogao.png"
-							style="width: 10vw;" mode="widthFix" />
-						<image v-else-if="item.lzzt == '3'" src="../../static/images/tongguo.png" style="width: 10vw;"
-							mode="widthFix" />
-						<image v-else-if="item.lzzt == '4'" src="../../static/images/jujue.png" style="width: 10vw;"
-							mode="widthFix" />
+						<view v-if="item.lzzt == '0'"
+							style="width: 60px;display: flex;flex-direction: column;background-image: url('../../static/images/caogao.png');background-position: left;background-size:58px 58px;background-repeat: no-repeat;">
+							<text>{{item.updateTime.substring(0,8) || item.createTime.substring(0,8)}}</text>
+							<text>{{item.lrSpyj || '无'}}</text>
+						</view>
+						<view v-else-if="item.lzzt == '1' || item.lzzt == '2'"
+							style="width: 60px;display: flex;flex-direction: column;background-image: url('../../static/images/daishenhe.png');background-position: left;background-size:58px 58px;background-repeat: no-repeat;">
+							<text>{{item.updateTime.substring(0,8) || item.createTime.substring(0,8)}}</text>
+							<text>{{item.lrSpyj || '无'}}</text>
+						</view>
+						<view v-else-if="item.lzzt == '3'"
+							style="width: 60px;display: flex;flex-direction: column;background-image: url('../../static/images/tongguo.png');background-position: left;background-size:58px 58px;background-repeat: no-repeat;">
+							<text>{{item.updateTime.substring(0,8) || item.createTime.substring(0,8)}}</text>
+							<text>{{item.lrSpyj || '无'}}</text>
+						</view>
+						<view v-else-if="item.lzzt == '4'"
+							style="width: 60px;display: flex;flex-direction: column;background-image: url('../../static/images/jujue.png');background-position: left;background-size:58px 58px;background-repeat: no-repeat;">
+							<text>{{item.updateTime.substring(0,8) || item.createTime.substring(0,8)}}</text>
+							<text>{{item.lrSpyj || '无'}}</text>
+						</view>
 					</template>
 				</uni-list-item>
 			</uni-list>
@@ -24,6 +36,10 @@
 </template>
 
 <script>
+	import {
+		getToken,
+		getUser
+	} from '@/common/auth.js'
 	import {
 		ListKhjbxx
 	} from '@/api/kh.js'
@@ -38,12 +54,17 @@
 				form: {
 					pageNum: 1,
 					pageSize: 10,
+					createUserId: ''
 				},
 				dataList: [],
 				total: 0,
 			}
 		},
 		mounted() {
+			this.userInfo = getUser()
+			if (this.userInfo.userType != '07') {
+				this.form.createUserId = this.userInfo.userId
+			}
 			this.getList()
 		},
 		created() {},
@@ -60,14 +81,26 @@
 			this.getList()
 		},
 		onReachBottom() {
-			this.status = 'loloading'
-			// if () {
-
-			// }
+			if (this.dataList.length < this.total) {
+				this.form.pageNum += 1
+				this.getList()
+			}
 		},
 		methods: {
+			search() {
+				this.dataList = []
+				this.form.pageNum = 1
+				this.form.pageSize = 10
+				this.getList()
+			},
 			clickLoadMore(e) {
-				console.log(e.detail);
+				this.status = 'loading'
+				if (this.dataList.length < this.total) {
+					this.form.pageNum += 1
+					this.getList()
+				} else {
+					this.status = 'no-more'
+				}
 			},
 			getList() {
 				ListKhjbxx(this.form).then(res => {
@@ -79,6 +112,11 @@
 						], [2, 1, 4, 4, 3, 1, 2, 1, 2, 1, 3, 5, 5, 5])
 						this.dataList.push(...list)
 						uni.stopPullDownRefresh();
+						if (this.dataList.length < this.total) {
+							this.status = 'more'
+						} else if (this.dataList.length == this.total) {
+							this.status = 'no-more'
+						}
 					}
 				})
 			}

+ 21 - 3
pages/lr/register.vue

@@ -212,7 +212,7 @@
 			onnodeclick(node) {
 				console.log("fas", node);
 				this.groupId = node.value.substring(0, 6)
-				this.baseFormData.lrHjdz = this.groupId
+				this.baseFormData.lrHjdz = this.groupId + '000000'
 			},
 			getAccessToken() {
 				uni.request({
@@ -261,9 +261,15 @@
 						console.log('对比', res);
 						if (res.data.error_msg == 'SUCCESS') {
 							this.score = res.data.result.score;
+
+							this.baseFormData.lrTxdb = JSON.stringify({
+								"lrJmzjhm": this.idcardMD5,
+								"xsfs": this.score
+							})
 							if (this.score >= config.score) {
 								this.show = false
 								this.baseFormData.lzzt = 3
+								this.baseFormData.lrSpyj = '同意'
 								this.baseFormData.prelrZjz = this.idcardFaceUrl
 								this.faceSearch()
 							} else {
@@ -277,6 +283,7 @@
 								// ocr失败身份证原版入库,ocr成功人脸入库
 								// showConfirm('人像与身份证不符,请重新上传')
 								this.baseFormData.lzzt = 1
+								this.baseFormData.lrSpyj = ''
 								this.show = true
 								this.baseFormData.prelrZjz = this.zjcaijianSrc
 								uni.hideLoading()
@@ -370,8 +377,19 @@
 								this.createGroup()
 							} else {
 								if (res.data.result.user_list[0].score >= config.score) {
-									this.baseFormData.xslrZjhm = res.data.result.user_list[0].user_id
-									this.baseFormData.lzzt = 2
+									let xs = []
+									res.data.result.user_list.forEach(e => {
+										if (e.user_id != this.idcardMD5) {
+											xs.push({
+												"lrJmzjhm": e.user_id,
+												"xsfs": e.score
+											})
+											this.baseFormData.lzzt = 2
+											this.baseFormData.lrSpyj = ''
+										}
+
+									})
+									this.baseFormData.xslrZjhm = JSON.stringify(xs)
 								}
 								this.faceAdd()
 							}

二进制
static/images/hywh.png


二进制
static/images/jsjz.png


二进制
static/images/lr.png


二进制
static/images/shqt.png


+ 37 - 0
uni_modules/uni-search-bar/changelog.md

@@ -0,0 +1,37 @@
+## 1.2.5(2024-01-31)
+- 修复 uni-search-bar居中问题,现在默认居左,并修复样式偏移问题
+## 1.2.4(2023-05-09)
+- 修复 i18n 国际化不正确的 Bug
+## 1.2.3(2022-05-24)
+- 新增 readonly 属性,组件只读
+## 1.2.2(2022-05-06)
+- 修复  vue3 input 事件不生效的bug
+## 1.2.1(2022-05-06)
+- 修复 多余代码导致的bug
+## 1.2.0(2021-11-19)
+- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource)
+- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-search-bar](https://uniapp.dcloud.io/component/uniui/uni-search-bar)
+## 1.1.2(2021-08-30)
+- 修复 value 属性与 modelValue 属性不兼容的Bug
+## 1.1.1(2021-08-24)
+- 新增 支持国际化
+## 1.1.0(2021-07-30)
+- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
+## 1.0.9(2021-05-12)
+- 新增 项目示例地址
+## 1.0.8(2021-04-21)
+- 优化 添加依赖 uni-icons, 导入后自动下载依赖
+## 1.0.7(2021-04-15)
+- uni-ui 新增 uni-search-bar 的 focus 事件
+
+## 1.0.6(2021-02-05)
+- 优化 组件引用关系,通过uni_modules引用组件
+
+## 1.0.5(2021-02-05)
+- 调整为uni_modules目录规范
+- 新增 支持双向绑定
+- 更改 input 事件的返回值,e={value:Number} --> e=value
+- 新增 支持图标插槽
+- 新增 支持 clear、blur 事件
+- 新增 支持 focus 属性
+- 去掉组件背景色

+ 4 - 0
uni_modules/uni-search-bar/components/uni-search-bar/i18n/en.json

@@ -0,0 +1,4 @@
+{
+	"uni-search-bar.cancel": "cancel",
+	"uni-search-bar.placeholder": "Search enter content"
+}

+ 8 - 0
uni_modules/uni-search-bar/components/uni-search-bar/i18n/index.js

@@ -0,0 +1,8 @@
+import en from './en.json'
+import zhHans from './zh-Hans.json'
+import zhHant from './zh-Hant.json'
+export default {
+	en,
+	'zh-Hans': zhHans,
+	'zh-Hant': zhHant
+}

+ 4 - 0
uni_modules/uni-search-bar/components/uni-search-bar/i18n/zh-Hans.json

@@ -0,0 +1,4 @@
+{
+	"uni-search-bar.cancel": "取消",
+	"uni-search-bar.placeholder": "请输入搜索内容"
+}

+ 4 - 0
uni_modules/uni-search-bar/components/uni-search-bar/i18n/zh-Hant.json

@@ -0,0 +1,4 @@
+{
+	"uni-search-bar.cancel": "取消",
+	"uni-search-bar.placeholder": "請輸入搜索內容"
+}

+ 301 - 0
uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.vue

@@ -0,0 +1,301 @@
+<template>
+	<view class="uni-searchbar">
+		<view :style="{borderRadius:radius+'px',backgroundColor: bgColor}" class="uni-searchbar__box"
+			@click="searchClick">
+			<view class="uni-searchbar__box-icon-search">
+				<slot name="searchIcon">
+					<uni-icons color="#c0c4cc" size="18" type="search" />
+				</slot>
+			</view>
+			<input v-if="show || searchVal" :focus="showSync" :disabled="readonly" :placeholder="placeholderText" :maxlength="maxlength"
+				class="uni-searchbar__box-search-input" confirm-type="search" type="text" v-model="searchVal"
+				@confirm="confirm" @blur="blur" @focus="emitFocus"/>
+			<text v-else class="uni-searchbar__text-placeholder">{{ placeholder }}</text>
+			<view v-if="show && (clearButton==='always'||clearButton==='auto'&&searchVal!=='') &&!readonly"
+				class="uni-searchbar__box-icon-clear" @click="clear">
+				<slot name="clearIcon">
+					<uni-icons color="#c0c4cc" size="20" type="clear" />
+				</slot>
+			</view>
+		</view>
+		<text @click="cancel" class="uni-searchbar__cancel"
+			v-if="cancelButton ==='always' || show && cancelButton ==='auto'">{{cancelTextI18n}}</text>
+	</view>
+</template>
+
+<script>
+	import {
+		initVueI18n
+	} from '@dcloudio/uni-i18n'
+	import messages from './i18n/index.js'
+	const {
+		t
+	} = initVueI18n(messages)
+
+	/**
+	 * SearchBar 搜索栏
+	 * @description 搜索栏组件,通常用于搜索商品、文章等
+	 * @tutorial https://ext.dcloud.net.cn/plugin?id=866
+	 * @property {Number} radius 搜索栏圆角
+	 * @property {Number} maxlength 输入最大长度
+	 * @property {String} placeholder 搜索栏Placeholder
+	 * @property {String} clearButton = [always|auto|none] 是否显示清除按钮
+	 * 	@value always 一直显示
+	 * 	@value auto 输入框不为空时显示
+	 * 	@value none 一直不显示
+	 * @property {String} cancelButton = [always|auto|none] 是否显示取消按钮
+	 * 	@value always 一直显示
+	 * 	@value auto 输入框不为空时显示
+	 * 	@value none 一直不显示
+	 * @property {String} cancelText 取消按钮的文字
+	 * @property {String} bgColor 输入框背景颜色
+	 * @property {Boolean} focus 是否自动聚焦
+	 * @property {Boolean} readonly 组件只读,不能有任何操作,只做展示
+	 * @event {Function} confirm uniSearchBar 的输入框 confirm 事件,返回参数为uniSearchBar的value,e={value:Number}
+	 * @event {Function} input uniSearchBar 的 value 改变时触发事件,返回参数为uniSearchBar的value,e=value
+	 * @event {Function} cancel 点击取消按钮时触发事件,返回参数为uniSearchBar的value,e={value:Number}
+	 * @event {Function} clear 点击清除按钮时触发事件,返回参数为uniSearchBar的value,e={value:Number}
+	 * @event {Function} blur input失去焦点时触发事件,返回参数为uniSearchBar的value,e={value:Number}
+	 */
+
+	export default {
+		name: "UniSearchBar",
+		emits: ['input', 'update:modelValue', 'clear', 'cancel', 'confirm', 'blur', 'focus'],
+		props: {
+			placeholder: {
+				type: String,
+				default: ""
+			},
+			radius: {
+				type: [Number, String],
+				default: 5
+			},
+			clearButton: {
+				type: String,
+				default: "auto"
+			},
+			cancelButton: {
+				type: String,
+				default: "auto"
+			},
+			cancelText: {
+				type: String,
+				default: ""
+			},
+			bgColor: {
+				type: String,
+				default: "#F8F8F8"
+			},
+			maxlength: {
+				type: [Number, String],
+				default: 100
+			},
+			value: {
+				type: [Number, String],
+				default: ""
+			},
+			modelValue: {
+				type: [Number, String],
+				default: ""
+			},
+			focus: {
+				type: Boolean,
+				default: false
+			},
+			readonly: {
+				type: Boolean,
+				default: false
+			}
+		},
+		data() {
+			return {
+				show: false,
+				showSync: false,
+				searchVal: ''
+			}
+		},
+		computed: {
+			cancelTextI18n() {
+				return this.cancelText || t("uni-search-bar.cancel")
+			},
+			placeholderText() {
+				return this.placeholder || t("uni-search-bar.placeholder")
+			}
+		},
+		watch: {
+			// #ifndef VUE3
+			value: {
+				immediate: true,
+				handler(newVal) {
+					this.searchVal = newVal
+					if (newVal) {
+						this.show = true
+					}
+				}
+			},
+			// #endif
+			// #ifdef VUE3
+			modelValue: {
+				immediate: true,
+				handler(newVal) {
+					this.searchVal = newVal
+					if (newVal) {
+						this.show = true
+					}
+				}
+			},
+			// #endif
+			focus: {
+				immediate: true,
+				handler(newVal) {
+					if (newVal) {
+						if(this.readonly) return
+						this.show = true;
+						this.$nextTick(() => {
+							this.showSync = true
+						})
+					}
+				}
+			},
+			searchVal(newVal, oldVal) {
+				this.$emit("input", newVal)
+				// #ifdef VUE3
+				this.$emit("update:modelValue", newVal)
+				// #endif
+			}
+		},
+		methods: {
+			searchClick() {
+				if(this.readonly) return
+				if (this.show) {
+					return
+				}
+				this.show = true;
+				this.$nextTick(() => {
+					this.showSync = true
+				})
+			},
+			clear() {
+				this.$emit("clear", {
+					value: this.searchVal
+				})
+				this.searchVal = ""
+			},
+			cancel() {
+				if(this.readonly) return
+				this.$emit("cancel", {
+					value: this.searchVal
+				});
+				this.searchVal = ""
+				this.show = false
+				this.showSync = false
+				// #ifndef APP-PLUS
+				uni.hideKeyboard()
+				// #endif
+				// #ifdef APP-PLUS
+				plus.key.hideSoftKeybord()
+				// #endif
+			},
+			confirm() {
+				// #ifndef APP-PLUS
+				uni.hideKeyboard();
+				// #endif
+				// #ifdef APP-PLUS
+				plus.key.hideSoftKeybord()
+				// #endif
+				this.$emit("confirm", {
+					value: this.searchVal
+				})
+			},
+			blur() {
+				// #ifndef APP-PLUS
+				uni.hideKeyboard();
+				// #endif
+				// #ifdef APP-PLUS
+				plus.key.hideSoftKeybord()
+				// #endif
+				this.$emit("blur", {
+					value: this.searchVal
+				})
+			},
+			emitFocus(e) {
+				this.$emit("focus", e.detail)
+			}
+		}
+	};
+</script>
+
+<style lang="scss">
+	$uni-searchbar-height: 36px;
+
+	.uni-searchbar {
+		/* #ifndef APP-NVUE */
+		display: flex;
+		/* #endif */
+		flex-direction: row;
+		position: relative;
+		padding: 10px;
+		// background-color: #fff;
+	}
+
+	.uni-searchbar__box {
+		/* #ifndef APP-NVUE */
+		display: flex;
+		box-sizing: border-box;
+		/* #endif */
+		overflow: hidden;
+		position: relative;
+		flex: 1;
+		justify-content: left;
+		flex-direction: row;
+		align-items: center;
+		height: $uni-searchbar-height;
+		padding: 5px 8px 5px 0px;
+	}
+
+	.uni-searchbar__box-icon-search {
+		/* #ifndef APP-NVUE */
+		display: flex;
+		/* #endif */
+		flex-direction: row;
+		// width: 32px;
+		padding: 0 8px;
+		justify-content: center;
+		align-items: center;
+		color: #B3B3B3;
+	}
+
+	.uni-searchbar__box-search-input {
+		flex: 1;
+		font-size: 14px;
+		color: #333;
+		margin-left: 5px;
+		margin-top: 1px;
+	}
+
+	.uni-searchbar__box-icon-clear {
+		align-items: center;
+		line-height: 24px;
+		padding-left: 8px;
+		/* #ifdef H5 */
+		cursor: pointer;
+		/* #endif */
+	}
+
+	.uni-searchbar__text-placeholder {
+		font-size: 14px;
+		color: #B3B3B3;
+		margin-left: 5px;
+		text-align: left;
+	}
+
+	.uni-searchbar__cancel {
+		padding-left: 10px;
+		line-height: $uni-searchbar-height;
+		font-size: 14px;
+		color: #333333;
+		/* #ifdef H5 */
+		cursor: pointer;
+		/* #endif */
+	}
+</style>

+ 86 - 0
uni_modules/uni-search-bar/package.json

@@ -0,0 +1,86 @@
+{
+  "id": "uni-search-bar",
+  "displayName": "uni-search-bar 搜索栏",
+  "version": "1.2.5",
+  "description": "搜索栏组件,通常用于搜索商品、文章等",
+  "keywords": [
+    "uni-ui",
+    "uniui",
+    "搜索框",
+    "搜索栏"
+],
+  "repository": "https://github.com/dcloudio/uni-ui",
+  "engines": {
+    "HBuilderX": ""
+  },
+  "directories": {
+    "example": "../../temps/example_temps"
+  },
+"dcloudext": {
+    "sale": {
+      "regular": {
+        "price": "0.00"
+      },
+      "sourcecode": {
+        "price": "0.00"
+      }
+    },
+    "contact": {
+      "qq": ""
+    },
+    "declaration": {
+      "ads": "无",
+      "data": "无",
+      "permissions": "无"
+    },
+    "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
+    "type": "component-vue"
+  },
+  "uni_modules": {
+    "dependencies": [
+			"uni-scss",
+			"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"
+        },
+        "Vue": {
+            "vue2": "y",
+            "vue3": "y"
+        }
+      }
+    }
+  }
+}

+ 14 - 0
uni_modules/uni-search-bar/readme.md

@@ -0,0 +1,14 @@
+
+
+## SearchBar 搜索栏
+
+> **组件名:uni-search-bar**
+> 代码块: `uSearchBar`
+
+
+搜索栏组件
+
+### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-search-bar)
+#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 
+
+