Selaa lähdekoodia

h5url二级页面可返回一级页面

WangYiHan 11 kuukautta sitten
vanhempi
commit
962854edc0

+ 11 - 0
package-lock.json

@@ -360,6 +360,17 @@
         "vue": ">= 2.6.0"
       }
     },
+    "node_modules/vconsole": {
+      "version": "3.15.1",
+      "resolved": "https://registry.npmjs.org/vconsole/-/vconsole-3.15.1.tgz",
+      "integrity": "sha512-KH8XLdrq9T5YHJO/ixrjivHfmF2PC2CdVoK6RWZB4yftMykYIaXY1mxZYAic70vADM54kpMQF+dYmvl5NRNy1g==",
+      "dependencies": {
+        "@babel/runtime": "^7.17.2",
+        "copy-text-to-clipboard": "^3.0.1",
+        "core-js": "^3.11.0",
+        "mutation-observer": "^1.0.3"
+      }
+    },
     "node_modules/vue": {
       "version": "3.4.31",
       "resolved": "https://registry.npmjs.org/vue/-/vue-3.4.31.tgz",

+ 7 - 7
pages/equ_list/bind.vue

@@ -1,19 +1,19 @@
 <template>
 
 	<view class="page">
-		<!-- #ifdef APP-PLUS || H5 -->
+		<!-- #ifdef APP-PLUS || H5 || MP -->
 		<!-- 状态栏占位 -->
 		<view class="status_bar"></view>
 		<view class="" style="margin-top: var(--status-bar-height);">
 			<uni-nav-bar title="" left-icon="left" backgroundColor="#F35546" color="#fff" @clickLeft="back"></uni-nav-bar>
 		</view>
 		<view class="content-box">
-			<u-form :model="formData" ref="uForm" label-align="right" label-width="50">
+			<u-form :model="formData" ref="uForm" label-align="right" label-width="100">
 				<u-form-item label="ID号"><u-input v-model="formData.deviceCode" /></u-form-item>
 			</u-form>
 			
 			<view class="form-box">
-				<u-form :model="formData" ref="uForm" label-align="right" label-width="50">
+				<u-form :model="formData" ref="uForm" label-align="right" label-width="100">
 					<u-form-item label="照片">
 						<view class="pictrue" @click.stop='uploadpic'>
 							<image :src='newAvatar ? newAvatar : formData.avatar'></image>
@@ -28,7 +28,7 @@
 				</u-form>
 			</view>
 			<view class="form-box">
-				<u-form :model="formData" ref="uForm" label-align="right" label-width="50">
+				<u-form :model="formData" ref="uForm" label-align="right" label-width="100">
 					<!-- 问题:u-input在disabled得情况下点击事件失效 -->
 					<u-form-item label="关系" right-icon="arrow-right" @click.native="goChooseRelation">
 							<u-input disabled  v-model="formData.relationValue"  placeholder="请选择关系" input-align="right" />
@@ -292,7 +292,7 @@
 			},
 			cardNumberBlur(e) {
 				let value=''
-				// #ifdef APP-PLUS 
+				// #ifdef APP-PLUS  || H5
 					value = e
 				// #endif 
 				// #ifdef MP 
@@ -325,7 +325,7 @@
 			},
 			telBlur(e) {
 				let val=''
-				// #ifdef APP-PLUS 
+				// #ifdef APP-PLUS || H5
 					val = e
 				// #endif 
 				// #ifdef MP 
@@ -412,7 +412,7 @@
 <style lang="scss">
 	::v-deep .u-form-item {
 		background-color: #fff;
-		padding:0 20rpx !important;
+		padding:10rpx 20rpx !important;
 		border-bottom: 2rpx solid #F5F5F5;
 	}
 	::v-deep .u-form-item__body__right__content__slot{

+ 44 - 42
pages/equ_list/choose.vue

@@ -11,13 +11,15 @@
 				确认
 			</view>
 		</view> -->
+		<!-- #ifdef MP -->
 		<van-dialog use-slot title="自定义" :show="showDialog" show-cancel-button="true" @close="showDialog=false"
 			@confirm="confirm">
 			<van-field class="chageName" :value="nameValue" :focus="true" placeholder="请输入"
 				@change="nameValue = $event.detail" />
 		</van-dialog>
+		<!-- #endif -->
 		<!-- #ifdef APP-PLUS || H5 -->
-		<u-modal :show="showDialog" :title-style="{color: 'red'}" title="自定义" show-cancel-button="true" @cancel="showDialog=false" @confirm="confirm">
+		<u-modal :show="showDialog" :title-style="{color: 'red'}" title="自定义" :show-cancel-button="true" @cancel="showDialog=false" @confirm="confirm">
 			<u-input v-model="nameValue"  placeholder="请输入"/>
 		</u-modal>
 		<!-- #endif -->
@@ -32,47 +34,47 @@
 	export default {
 		data() {
 			return {
-				list: [{
-						avatar: '/pages/users/static/vip04.png',
-						name: '爸爸',
-						value: 1
-					}, {
-						avatar: '/pages/users/static/choose2.png',
-						name: '妈妈',
-						value: 2
-					}, {
-						avatar: '/pages/users/static/choose3.png',
-						name: '儿子',
-						value: 3
-					}, {
-						avatar: '/pages/users/static/choose4.png',
-						name: '女儿',
-						value: 4
-					}, {
-						avatar: '/pages/users/static/choose5.png',
-						name: '爷爷',
-						value: 5
-					}, {
-						avatar: '/pages/users/static/choose6.png',
-						name: '奶奶',
-						value: 6
-					}, {
-						avatar: '/pages/users/static/choose7.png',
-						name: '姥爷',
-						value: 7
-					}, {
-						avatar: '/pages/users/static/choose8.png',
-						name: '姥姥',
-						value: 8
-					},
-					{
-						avatar: '/pages/users/static/vip04.png',
-						name: '自定义',
-						value: 9,
-						id: 99
-					},
-				],
-				// list: [],
+				// list: [{
+				// 		avatar: '/pages/users/static/vip04.png',
+				// 		name: '爸爸',
+				// 		value: 1
+				// 	}, {
+				// 		avatar: '/pages/users/static/choose2.png',
+				// 		name: '妈妈',
+				// 		value: 2
+				// 	}, {
+				// 		avatar: '/pages/users/static/choose3.png',
+				// 		name: '儿子',
+				// 		value: 3
+				// 	}, {
+				// 		avatar: '/pages/users/static/choose4.png',
+				// 		name: '女儿',
+				// 		value: 4
+				// 	}, {
+				// 		avatar: '/pages/users/static/choose5.png',
+				// 		name: '爷爷',
+				// 		value: 5
+				// 	}, {
+				// 		avatar: '/pages/users/static/choose6.png',
+				// 		name: '奶奶',
+				// 		value: 6
+				// 	}, {
+				// 		avatar: '/pages/users/static/choose7.png',
+				// 		name: '姥爷',
+				// 		value: 7
+				// 	}, {
+				// 		avatar: '/pages/users/static/choose8.png',
+				// 		name: '姥姥',
+				// 		value: 8
+				// 	},
+				// 	{
+				// 		avatar: '/pages/users/static/vip04.png',
+				// 		name: '自定义',
+				// 		value: 9,
+				// 		id: 99
+				// 	},
+				// ],
+				list: [],
 				showDialog: false,
 				nameValue: '',
 			}

+ 5 - 2
pages/goods/cashier/index.vue

@@ -11,9 +11,10 @@
                    :datatime="invalidTime / 1000" :is-col="true" :bgColor="bgColor" />
 			</view>
 		</view>
-		<view class="payment" v-if="channelCode.length > 0">
+		{{channelCode}}111
+		<view class="payment" >
 			<view class="title">
-        支付方式
+				支付方式
 			</view>
 			<view class="item acea-row row-between-wrapper" v-for="(item,index) in channels" :key="index" @click="payType(item.code)">
 				<view class="left acea-row row-between-wrapper">
@@ -135,6 +136,7 @@
           // 设置属性
 					this.payPrice = res.data.price
 					this.invalidTime = res.data.expireTime
+					console.log(this.channels,'this.channels2222')
 
           // 移除多余的支付渠道;
           this.removeDisableChannel(res.data.appId);
@@ -308,6 +310,7 @@
         // 2. 读取配置,移除被禁用的支付渠道
         PayChannelApi.getEnableChannelCodeList(appId).then(res => {
           this.channels = this.channels.filter(item => res.data.includes(item.code));
+			console.log(this.channels,'this.channels1111')
 
           // 默认选中第一个
           if (this.channels.length > 0) {

+ 20 - 2
pages/goods_cate/goods_cate.vue

@@ -116,8 +116,14 @@
 	import {
 		goShopDetail
 	} from '@/libs/order.js'
-	import orderAddcart from '@/components/order_addcart';
+	import orderAddcart from '@/components/order_addcart/index.vue';
 	export default {
+		props: {
+			attr: {
+				type: Object,
+				default: () => {}
+			},
+		},
 		data() {
 			return {
 				navlist: [],
@@ -322,6 +328,7 @@
 			hideShoppingCar(){
 				// this.footHeight = '0';
 				this.$refs.orderAddcart.showCartList  = false;
+				// this.$refs.orderAddcart.footerswitch = true
 				this.showMask=false
 			},
 		}
@@ -344,7 +351,6 @@
 		border-top-right-radius: 16px;
 		overflow: hidden;
 		width: 100%;
-		border: 1rpx solid red;
 	}
 	.zz{
 		position: absolute;
@@ -401,7 +407,13 @@
 		overflow-x: hidden;
 
 		height: auto;
+		/* #ifdef MP */
 		margin-top: 96rpx;
+		/* #endif */
+		
+		/* #ifdef APP-PLUS || H5 */
+		margin-top: calc(96rpx + var(--status-bar-height));
+		/* #endif */
 	}
 
 	.productSort .aside .item {
@@ -421,7 +433,13 @@
 	}
 
 	.productSort .conter {
+		/* #ifdef MP */
 		margin: 96rpx 0 0 180rpx;
+		/* #endif */
+		
+		/* #ifdef APP-PLUS || H5 */
+		margin: calc(96rpx + var(--status-bar-height)) 0 0 180rpx;
+		/* #endif */
 		padding: 0 14rpx;
 		background-color: #fff;
 	}

+ 1 - 1
pages/goods_details/index.vue

@@ -778,7 +778,7 @@
       getProductReplyCount: function() {
         ProductCommentApi.getCommentStatistics(this.id).then(res => {
           const count = res.data.goodCount + res.data.mediocreCount + res.data.negativeCount;
-          this.$set(this, 'replyChance', (100.0 * res.data.goodCount / count).toFixed(0));
+          this.$set(this, 'replyChance',res.data.goodCount? (100.0 * res.data.goodCount / count).toFixed(0):this.replyChance);
           this.$set(this, 'replyCount', count);
         });
       },

+ 61 - 6
pages/index/index.vue

@@ -1,5 +1,6 @@
 <template>
 	<view>
+		<!-- v-if="!deviceCode" -->
 		<view class="map-box" v-if="!deviceCode">
 
 			<!-- <view class="mp-header">
@@ -15,7 +16,8 @@
 			<!-- <map id='map' :latitude="latitude" :longitude="longitude" :markers="covers" :polyline="polyline"
 				:scale="scale">
 			</map> -->
-			<view class="top-input" v-if="!deviceId">
+			<!-- v-if="!deviceId" -->
+			<view class="top-input" >
 				<image src="../../static/img/noneEqu.png" mode=""></image>
 				<view class="btn-box" @click="goEquList">
 					<view class="btn">添加设备</view>
@@ -107,8 +109,19 @@
 			</view>
 			<van-loading class="loading" v-if="showLoading" type="spinner" color="#000" />
 		</view>
+		<!-- #ifdef APP-PLUS||H5 -->
+		<view class="status_bar"></view>
+		<view class="aaa" style="margin-top: var(--status-bar-height);margin-bottom: var(--status-bar-height);">
+			<uni-nav-bar title="" height="var(--status-bar-height)" left-icon="left" backgroundColor="#F35546" color="#fff" @clickLeft="webviewback"></uni-nav-bar>
+		</view>
+		<!-- <view class="" @click="webviewback" style="z-index: 1;position: absolute;">
+			我是来展位的
+		</view> -->
+		<!-- #endif -->
 		<view class="" v-if="deviceCode">
-			<web-view :src="h5url"></web-view>
+			<!-- <web-view :src="h5url"></web-view> -->
+			<!-- <web-view style="position: absolute; top: 100px;z-index: 2;" src="https://openapiweb.slaaplekker.cn/reportH5?accessToken=9f36cea4a4f64ba8bfb680ff98d98c1b&sn=289935886000036"></web-view> -->
+			<web-view ref="webview" v-if="h5url"  style="position: absolute; top: 100px;z-index: 2;" :src="h5url" @message="bbb"></web-view>
 		</view>
 
 		<!-- </page-container> -->
@@ -136,6 +149,10 @@
 	// 获取导航栏高度
 	const barHeight = menuButtonInfo.height + (menuButtonInfo.top - statusBarHeight) * 2
 	// #endif
+	// #ifdef APP-PLUS
+	// import web from 'https://js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.1.5.2.js'
+	// const webview =web.webview
+	// #endif
 	export default {
 		computed: mapGetters(['deviceCode', 'isLogin']),
 		data() {
@@ -268,7 +285,7 @@
 						y: 0.5,
 					},
 				},
-				h5url:''
+				h5url:'',// 当前H5页面的URL
 			}
 		},
 		beforeCreate() {
@@ -289,7 +306,7 @@
 			// this.initAmap();
 			this.getLocationInfo()
 			// this.getHrdata()
-			console.log(this.deviceCode,'deviceCodedeviceCode')
+			console.log(this.deviceCode,this.h5url,'deviceCodedeviceCode')
 			if(this.deviceCode){
 				this.geth5Url()
 			}
@@ -316,6 +333,9 @@
 				        // this.errorMessage = '获取位置信息失败: ' + error.errMsg;
 				    }
 			});
+			// #ifdef APP-PLUS
+			  this.setWebviewHeight()
+			// #endif
 
 		},
 		onHide: function() {
@@ -326,11 +346,46 @@
 
 		},
 		methods: {
+			bbb(e){
+				console.log(e,'我是刚触发得事件')
+			},
+			webviewback(){
+				uni.reLaunch({
+					url: '/pages/index/index'
+				})
+				// webview.navigateBack({
+				// 	delta:1
+				// })
+				// webview.postMessage({data:'deletefile'})
+			},
+		
+			setWebviewHeight() {
+			  // #ifdef APP-PLUS
+			  let height = 0; //定义动态的高度变量,如高度为定值,可以直接写
+			  uni.getSystemInfo({
+			    //成功获取的回调函数,返回值为系统信息
+			    success: sysinfo => {
+			      height = sysinfo.windowHeight - 47; //自行修改,自己需要的高度
+			    },
+			  });
+			  const currentWebview = this.$scope.$getAppWebview(); //获取当前web-view
+			  setTimeout(function() {
+			      const wv = currentWebview.children()[0];
+			      wv.setStyle({				
+			      top: 80, //设置web-view距离顶部的距离以及自己的高度,单位为px
+			      height: height
+			    });
+			  }, 1000); //如页面初始化调用需要写延迟
+			  // #endif
+			},
 			geth5Url(){
+				// this.h5url='https://openapiweb.slaaplekker.cn/reportH5?accessToken=9f36cea4a4f64ba8bfb680ff98d98c1b&sn=289935886000036'
+				// return
 				hrApi.geth5url({sn:this.deviceCode}).then(res=>{
-					console.log(res,777)
+					console.log(res,this.h5url,777)
 					this.h5url=res.data.httpsURL
-					// this.$set("this.h5url",res.data.httpsURL)
+					this.$forceUpdate();
+					// this.$set(this,"h5url",res.data.httpsURL)
 				})
 			},
 			getHrdata(){

+ 5 - 5
static/iconfont/iconfont.css

@@ -5,11 +5,11 @@
        url('iconfont.ttf?t=1620706240621') format('truetype');
 } */
 @font-face {font-family: "iconfont";
-  src: url('//at.alicdn.com/t/font_993865_1ytjet2daic.eot?t=1611564722576'); /* IE9 */
-  src: url('//at.alicdn.com/t/font_993865_1ytjet2daic.eot?t=1611564722576#iefix') format('embedded-opentype'), /* IE6-IE8 */
-  url('//at.alicdn.com/t/font_993865_1ytjet2daic.woff?t=1611564722576') format('woff'),
-  url('//at.alicdn.com/t/font_993865_1ytjet2daic.ttf?t=1611564722576') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */
-  url('//at.alicdn.com/t/font_993865_1ytjet2daic.svg?t=1611564722576#iconfont') format('svg'); /* iOS 4.1- */
+  src: url('https://at.alicdn.com/t/font_993865_1ytjet2daic.eot?t=1611564722576'); /* IE9 */
+  src: url('https://at.alicdn.com/t/font_993865_1ytjet2daic.eot?t=1611564722576#iefix') format('embedded-opentype'), /* IE6-IE8 */
+  url('https://at.alicdn.com/t/font_993865_1ytjet2daic.woff?t=1611564722576') format('woff'),
+  url('https://at.alicdn.com/t/font_993865_1ytjet2daic.ttf?t=1611564722576') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */
+  url('https://at.alicdn.com/t/font_993865_1ytjet2daic.svg?t=1611564722576#iconfont') format('svg'); /* iOS 4.1- */
 }
 .iconfont {
   font-family: "iconfont" !important;