Procházet zdrojové kódy

[dev]
1、login页根据用户输入用户名和密码来判断是否login button可按
2、配置Print模块:增加#ifdef APP-PLUS的宏判断
3、优化几个按键中文字的上下左右居中
4、取消rq中的绝对定位导致的bug
5、取消detail页面rq中的具体item加框和点击功能
6、修复status为空的bug,该字段改为state

Neo před 2 roky
rodič
revize
9d0d89913d

+ 1 - 0
.gitignore

@@ -1,3 +1,4 @@
 node_modules
 uni_modules
 unpackage/dist
+unpackage

+ 1 - 0
App.vue

@@ -36,6 +36,7 @@ onShow(()=>{
 			// websocket.connectSocket(`wss://zhongyao.fscuc.cn/webSocket/sentMessage/${data.userId}`,() => {
 				websocket.connectSocket(`ws://zy-web.fscuc.cn:8006/websocket/${data.userId}`,() => {
 				//如果连接成功则发送心跳检测
+				console.log('connect ws success')
 				heartBeatTest()
 			})
 		} catch (error) {

+ 3 - 0
components/nav-bar/nav-bar.vue

@@ -165,6 +165,9 @@ const gotoPrint = ()=>{
 		justify-content: space-between;
 		.scanbara{
 			display: flex;
+			justify-content:center;
+			align-items: center;
+			
 			width: 91rpx;
 			height: 32.8rpx;
 			font-size: 15rpx;

+ 4 - 4
main.js

@@ -4,8 +4,8 @@
 
 
 import App from './App'
-import appPush from '@/js_sdk/levine-APPPush/levine-APPPush/plugins/APPPush/index.js'
-import Print from 'vue3-print-nb'
+// import appPush from '@/js_sdk/levine-APPPush/levine-APPPush/plugins/APPPush/index.js'
+// import Print from 'vue3-print-nb'
 
 
 // #ifndef VUE3
@@ -28,14 +28,14 @@ uni.$showMsg = (title = '数据请求失败!', duration = 1500) => {
 		icon: 'none'
 	})
 }
-uni.$appPush = appPush
+// uni.$appPush = appPush
 
 
 // #ifdef VUE3
 import { createSSRApp } from 'vue'
 export function createApp() {
   const app = createSSRApp(App)
-	app.use(Print)
+	// app.use(appPush)
 	// app.use(ElementPlus, {
 	// 	locale: zhCn,
 	// })

+ 16 - 1
manifest.json

@@ -19,7 +19,8 @@
         },
         /* 模块配置 */
         "modules" : {
-            "Barcode" : {}
+            "Barcode" : {},
+            "Camera" : {}
         },
         /* 应用发布信息 */
         "distribute" : {
@@ -53,6 +54,20 @@
             }
         },
         "nativePlugins" : {
+            "DCloud-PushSound" : {
+                "__plugin_info__" : {
+                    "name" : "自定义推送铃声和渠道",
+                    "description" : "自定义推送铃声同时支持 Android、iOS 平台",
+                    "platforms" : "Android,iOS",
+                    "url" : "https://ext.dcloud.net.cn/plugin?id=7482",
+                    "android_package_name" : "uni.UNIF501A17",
+                    "ios_bundle_id" : "",
+                    "isCloud" : true,
+                    "bought" : 1,
+                    "pid" : "7482",
+                    "parameters" : {}
+                }
+            },
             "Html5app-Gprinter" : {
                 "__plugin_info__" : {
                     "name" : "Android 和 IOS 佳博 蓝牙小票 标签 打印插件支持 ESC 、TSC、CPCL 指令 - [试用版,仅用于自定义调试基座]",

+ 25 - 0
package-lock.json

@@ -8,6 +8,7 @@
             "name": "预约,日历时间段选择,时间段区间选择组件模块",
             "version": "2.0.0",
             "dependencies": {
+                "encoding": "^0.1.13",
                 "vue3-print-nb": "^0.1.4"
             }
         },
@@ -134,11 +135,30 @@
             "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.2.tgz",
             "integrity": "sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ=="
         },
+        "node_modules/encoding": {
+            "version": "0.1.13",
+            "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz",
+            "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==",
+            "dependencies": {
+                "iconv-lite": "^0.6.2"
+            }
+        },
         "node_modules/estree-walker": {
             "version": "2.0.2",
             "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz",
             "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w=="
         },
+        "node_modules/iconv-lite": {
+            "version": "0.6.3",
+            "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
+            "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
+            "dependencies": {
+                "safer-buffer": ">= 2.1.2 < 3.0.0"
+            },
+            "engines": {
+                "node": ">=0.10.0"
+            }
+        },
         "node_modules/magic-string": {
             "version": "0.30.1",
             "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.1.tgz",
@@ -199,6 +219,11 @@
                 "node": "^10 || ^12 || >=14"
             }
         },
+        "node_modules/safer-buffer": {
+            "version": "2.1.2",
+            "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
+            "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
+        },
         "node_modules/source-map-js": {
             "version": "1.0.2",
             "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz",

+ 1 - 0
package.json

@@ -17,6 +17,7 @@
         ]
     },
     "dependencies": {
+        "encoding": "^0.1.13",
         "vue3-print-nb": "^0.1.4"
     }
 }

+ 20 - 19
pages/detail/detail.vue

@@ -41,7 +41,8 @@
 				<view class="lists">
 					<view class="item"  v-for="(x, i) in v.rp" :key="i">
 						<view class="le tag-view">
-							<uni-tag :text="x.matName+x.matDose+x.matUnitName" />
+							<!-- <uni-tag :text="x.matName+x.matDose+x.matUnitName" /> -->
+							{{x.matName+x.matDose+x.matUnitName}}
 						</view>
 						<view class="rig">
 							<view class="up"> {{x.matUsageName}}</view>
@@ -142,7 +143,7 @@ const v=ref({
 	sex:'男',
 	age:35,
 	contactNumber:'13888888888',
-	status: '发药',
+	state: '发药',
 	department:'中医内科',
 	disName:'胃脘痛病',
 	symName:'脾胃虚寒证',
@@ -277,29 +278,29 @@ onLoad(async(options) => {
 		v.value.rp = res.data.detailList
 		v.value.yljgName = res.data.yljgName || ''
 	 
-		v.value.status = res.data.status,
-		console.log('res.data.status',res.data.status)
-		switch (res.data.status) {
+		v.value.state = res.data.state,
+		console.log('res.data.state',res.data.state)
+		switch (res.data.state) {
 			case '1':
-				v.value.status = '配药'
+				v.value.state = '配药'
 				break
 			case '2':
-				v.value.status = '煎药'
+				v.value.state = '煎药'
 				break
 			case '3':
-				v.value.status = '发药'
+				v.value.state = '发药'
 				break
 			case '4':
-				v.value.status = '配送'
+				v.value.state = '配送'
 				break
 			case '5':
-				v.value.status = '已分配'
+				v.value.state = '已分配'
 				break
 			case '6':
-				v.value.status = '已传送'
+				v.value.state = '已传送'
 				break
 			default:
-				v.value.status = '配药'
+				v.value.state = '配药'
 		}
 		
 		v.value.operateList[0].operater = res.data.doctor || ''
@@ -462,14 +463,14 @@ const handleBack =()=>{
 					align-items: center;
 					width: 161rpx;
 					margin: 0 10rpx 20rpx 0;
-					position: relative;
+					// position: relative;
 					.le{
 						display: flex;
 						font-size: 12rpx;
-						width: 100rpx;
+						width: 150rpx;
 						word-wrap: break-word;
-						z-index: 100;
-						position: absolute;
+						// z-index: 100;
+						// position: absolute;
 						
 					}
 					.tag-view:deep(.uni-tag){
@@ -477,7 +478,7 @@ const handleBack =()=>{
 						justify-content:center;
 						align-items: center;
 						font-size: 15rpx;
-						width: 80rpx;
+						// width: 140rpx;
 						padding: 6rpx 6rpx;
 					}
 					.rig{
@@ -485,8 +486,8 @@ const handleBack =()=>{
 						flex-direction:column;
 						margin-left: 5.31rpx;
 						width: 200rpx;
-						z-index: 200;
-						position: absolute;
+						// z-index: 200;
+						// position: absolute;
 						left:120rpx;
 						.up{
 							margin-bottom:8rpx;

+ 38 - 27
pages/edit/edit.vue

@@ -40,8 +40,8 @@
 				</view>
 				<view class="lists">
 					<view class="item"  v-for="(x, i) in v.rp" :key="i">
-						<view class="le tag-view">
-							<uni-tag :inverted="!selectRps.includes(x)" :text="x.matName+x.matDose+x.matUnitName" @click="handleGetRps(x)" />
+						<view class="le tag-view" @click="handleGetRps(x)">
+							<uni-tag :inverted="!selectRps.includes(x)" :text="x.matName+x.matDose+x.matUnitName"  />
 						</view>
 						<view class="rig">
 							<view class="up"> {{x.matUsageName}}</view>
@@ -159,9 +159,9 @@ import { saveDepoly } from '@/static/js/api.js'
 import { onLoad } from '@dcloudio/uni-app'
 
 const urlConfig = ref('http://zhongyao.fscuc.cn')
-
+// #ifdef APP-PLUS 
 const plug= uni.requireNativePlugin('Html5app-Gprinter');
-
+// #endif
 
 // const preseId = ref(11220822134401)
 const preseObj = ref({
@@ -215,7 +215,7 @@ const v=ref({
 	sex:'男',
 	age:35,
 	contactNumber:'13888888888',
-	status: '发药',
+	state: '发药',
 	department:'中医内科',
 	disName:'胃脘痛病',
 	symName:'脾胃虚寒证',
@@ -369,33 +369,33 @@ onLoad(async(options) => {
 		v.value.distributionCost = res.data.distributionCost,
 		v.value.prescriptionTotleSum = res.data.prescriptionTotleSum,
 		
-		v.value.entrust = res.data.entrust,
+		v.value.entrust = res.data.entrust
 		v.value.rp = res.data.detailList
 		v.value.yljgName = res.data.yljgName || ''
-		v.value.birth = res.data.birth || ''
-		v.value.status = res.data.status,
-		console.log('res.data.status',res.data.status)
-		switch (res.data.status) {
+		v.value.birth = res.data.patientBirthday.substring(0,10) || ''
+		v.value.state = res.data.state
+		console.log('res.data.state',res.data.state)
+		switch (res.data.state) {
 			case '1':
-				v.value.status = '配药'
+				v.value.state = '配药'
 				break
 			case '2':
-				v.value.status = '煎药'
+				v.value.state = '煎药'
 				break
 			case '3':
-				v.value.status = '发药'
+				v.value.state = '发药'
 				break
 			case '4':
-				v.value.status = '配送'
+				v.value.state = '配送'
 				break
 			case '5':
-				v.value.status = '已分配'
+				v.value.state = '已分配'
 				break
 			case '6':
-				v.value.status = '已传送'
+				v.value.state = '已传送'
 				break
 			default:
-				v.value.status = '配药'
+				v.value.state = '配药'
 		}
 		
 		v.value.operateList[0].operater = res.data.doctor || ''
@@ -450,7 +450,7 @@ const handleBack =()=>{
 
 const handleSubmit = async()=>{
 	console.log('handleSubmit>>>',editForm.value)
-	console.log('直接调用接口,然后打印')
+	
 	const {data:res} = await saveDepoly({
 		token: uni.getStorageSync('token'),
 		data: JSON.stringify(editForm.value)
@@ -463,7 +463,12 @@ const handleSubmit = async()=>{
 		// 直接调用接口,然后打印
 		// print("#printMe")
 		// 打印成功后调用/userPrescription/sendToUser
+		
+		// #ifdef APP-PLUS
 		const ret = printerTsc()
+		console.log('直接调用接口,然后打印',ret)
+		// #endif
+		
 		const res = await sendToUser({
 			token: uni.getStorageSync('token'),
 			data: JSON.stringify({id:uni.getStorageSync('userId')})
@@ -482,7 +487,12 @@ const handleSubmit = async()=>{
 
 const dialogConfirm = async()=>{
 	console.log('dialogConfirm直接调用接口,然后打印')
+	
+	// #ifdef APP-PLUS
 	const ret = printerTsc()
+	console.log('ret',ret)
+	// #endif
+	
 	// 打印成功后调用/userPrescription/sendToUser
 	const res = await sendToUser({
 			token: uni.getStorageSync('token'),
@@ -558,8 +568,8 @@ const printerTsc = ()=>{
 	line.customText=v.value.yljgName;
 	line.x=100;
 	line.y=40;
-	line.fontSize=30;
-	line.fontPath=filePath;
+	line.fontSize=20;
+	line.fontPath='';
 	data.push(line); //每添加一个,代表一行字
 	
 	//添加图片
@@ -598,7 +608,7 @@ const printerTsc = ()=>{
 	line.x=50; //横坐标
 	line.y=150; //纵坐标
 	line.type="CODE128"; //条型码类型
-	line.height=160; //条型码高度
+	line.height=80; //条型码高度
 	line.readable=true; //是否显示文字在条型下方
 	line.rotation=0;  // 角度:有四个值:0,90,180,270
 	data.push(line)
@@ -623,7 +633,7 @@ const printerTsc = ()=>{
 	
 	// let _this=this;
 	
-			
+	
 	plug.printer({TSC:data}, ret => {
 		// _this.tip = JSON.stringify(ret);
 		console.log('print data', data)
@@ -756,14 +766,14 @@ const printerTsc = ()=>{
 					align-items: center;
 					width: 161rpx;
 					margin: 0 10rpx 20rpx 0;
-					position: relative;
+					// position: relative;
 					.le{
 						display: flex;
 						font-size: 12rpx;
 						width: 100rpx;
 						word-wrap: break-word;
-						z-index: 100;
-						position: absolute;
+						// z-index: 100;
+						// position: absolute;
 						
 					}
 					.tag-view:deep(.uni-tag){
@@ -771,6 +781,7 @@ const printerTsc = ()=>{
 						justify-content:center;
 						align-items: center;
 						font-size: 15rpx;
+						font-weight:500;
 						width: 80rpx;
 						padding: 6rpx 6rpx;
 					}
@@ -779,8 +790,8 @@ const printerTsc = ()=>{
 						flex-direction:column;
 						margin-left: 5.31rpx;
 						width: 200rpx;
-						z-index: 200;
-						position: absolute;
+						// z-index: 200;
+						// position: absolute;
 						left:120rpx;
 						.up{
 							margin-bottom:8rpx;

+ 5 - 1
pages/index/index.vue

@@ -545,8 +545,11 @@ const loadPreList = async()=>{
 						}
 					}
 					.search-button{
+						display: flex;
+						justify-content:center;
+						align-items: center;
 						width:112.5rpx;
-						margin: 13.75rpx 4rpx;
+						margin: 13.75rpx 10.1rpx;
 						font-size: 15rpx;
 						background-color: #18C7B0;
 					}
@@ -652,6 +655,7 @@ const loadPreList = async()=>{
 							.tag-view:deep(.uni-tag){
 								display: inline;
 								font-size: 15rpx;
+								font-weight:500;
 								margin-right: 16.67rpx;
 								// height: 40px;
 								width: 120rpx;

+ 19 - 3
pages/login/login.vue

@@ -27,7 +27,7 @@
 				</label>
 				
 			</uni-forms>
-			<button class="button" @click="submit">登录</button>
+			<button class="button" :class="formData.username.length>0 && formData.password.length>0 ? 'active':''" :disabled="formData.username.length>0 && formData.password.length>0 ? false:true" @click="submit">登录</button>
 		</view>
   </view>
 </template>
@@ -39,7 +39,7 @@
 </script>
 
 <script setup>
-import { onMounted, ref } from 'vue'
+import { onMounted, ref, computed } from 'vue'
 import { login } from '@/static/js/request.js'
 import { onLoad } from '@dcloudio/uni-app'
 import { updateOnlineStatus } from "@/static/js/api.js"
@@ -51,6 +51,18 @@ const formData = ref({
 	remember:false
 })
 
+const isFull = computed(()=>{
+	if(formData.value.username.length>0 && formData.value.password>0 ){
+		console.log('true')
+		return true
+	} else {
+		console.log('false')
+		return false 
+	}
+	
+	
+})
+
 onLoad(() => {
 	const sRemember = false
 	if(uni.getStorageSync('remember')){
@@ -84,7 +96,7 @@ const submit = async ()=> {
 		
 		uni.setStorageSync('token', res.token)
 		uni.setStorageSync('userId', res.userId)
-		// uni.$emit('login',{userId:res.userId})
+		uni.$emit('login',{userId:res.userId})
 		console.log('11')
 		console.log('res.token',res.token)
 		// JSON.stringify(params.data.data)
@@ -223,6 +235,10 @@ onMounted(() => {
 				justify-content: center;
 				align-items: center;
 			}
+			.active{
+				background-color:#18C7B0;
+				color: #fff;
+			}
 		}
 	}
 </style>

+ 14 - 14
pages/review/review.vue

@@ -180,7 +180,7 @@ const v=ref({
 	sex:'男',
 	age:35,
 	contactNumber:'13888888888',
-	status: '发药',
+	state: '发药',
 	department:'中医内科',
 	disName:'胃脘痛病',
 	symName:'脾胃虚寒证',
@@ -330,29 +330,29 @@ onLoad(async(options) => {
 		v.value.rp = res.data.detailList
 		v.value.yljgName = res.data.yljgName || ''
 	 
-		v.value.status = res.data.status,
-		console.log('res.data.status',res.data.status)
-		switch (res.data.status) {
+		v.value.state = res.data.state,
+		console.log('res.data.state',res.data.state)
+		switch (res.data.state) {
 			case '1':
-				v.value.status = '配药'
+				v.value.state = '配药'
 				break
 			case '2':
-				v.value.status = '煎药'
+				v.value.state = '煎药'
 				break
 			case '3':
-				v.value.status = '发药'
+				v.value.state = '发药'
 				break
 			case '4':
-				v.value.status = '配送'
+				v.value.state = '配送'
 				break
 			case '5':
-				v.value.status = '已分配'
+				v.value.state = '已分配'
 				break
 			case '6':
-				v.value.status = '已传送'
+				v.value.state = '已传送'
 				break
 			default:
-				v.value.status = '配药'
+				v.value.state = '配药'
 		}
 		
 		v.value.operateList[0].operater = res.data.doctor || ''
@@ -600,14 +600,14 @@ const handleOnblur = (e)=>{
 					align-items: center;
 					width: 161rpx;
 					margin: 0 10rpx 20rpx 0;
-					position: relative;
+					// position: relative;
 					.le{
 						display: flex;
 						font-size: 12rpx;
 						width: 100rpx;
 						word-wrap: break-word;
-						z-index: 100;
-						position: absolute;
+						// z-index: 100;
+						// position: absolute;
 						
 					}
 					.tag-view:deep(.uni-tag){

+ 21 - 10
static/js/websocket.js

@@ -30,16 +30,27 @@ const _WEBSOCKET = {
       //监听收到消息
       uni.onSocketMessage((res) => {
         console.log('收到服务器内容:' + res.data)
-				params = {
-					inApp: true, // app内横幅提醒
-					voice: true,    // 声音提醒
-					vibration: true,    // 振动提醒
-					messageType: '', //消息分类
-					messageTitle: '', //通知标题
-					messageContent: '中药煎配溯源管理来新处方啦!',
-					messageImage: ''
-				}
-				uni.$appPush(params)
+				// const params = {
+				// 	inApp: true, // app内横幅提醒
+				// 	voice: true,    // 声音提醒
+				// 	vibration: true,    // 振动提醒
+				// 	messageType: '', //消息分类
+				// 	messageTitle: '', //通知标题
+				// 	messageContent: '中药煎配溯源管理来新处方啦!',
+				// 	messageImage: ''
+				// }
+				// #ifdef APP-ANDROID
+				const plugin = uni.requireNativePlugin("DCloud-PushSound");
+				plugin.setCustomPushChannel({
+					soundName: "tips",
+					channelId: "消息通知",
+					channelDesc:"中药煎配溯源管理来新处方啦",
+					enableLights:true,
+					enableVibration:true,
+					importance:4,
+					lockscreenVisibility:1
+					});
+				// #endif
 				uni.redirectTo({
 					url:"/pages/index/index"
 				})