dedsudiyu 11 kuukautta sitten
vanhempi
commit
6c87215b6d

+ 215 - 0
accreditH5/accredit.html

@@ -0,0 +1,215 @@
+`
+<!DOCTYPE html>
+<html>
+	<head>
+		<meta charset="utf-8">
+		<meta name="viewport"
+			content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, minimal-ui">
+		<meta name="screen-orientation" content="portrait" />
+		<meta name="apple-mobile-web-app-capable" content="yes">
+		<meta name="format-detection" content="telephone=no">
+		<meta name="full-screen" content="yes">
+		<meta name="x5-fullscreen" content="true">
+		<script src="./js/jweixin-1.0.0.js"></script>
+		<script src="./js/axios.min.js"></script>
+		<title>正在授权请稍后</title>
+		<style type="text/css">
+			html,
+			body {
+				height: 100%;
+			}
+
+			html {
+				font-size: calc(100vw/7.5);
+			}
+
+			.object {
+				-moz-border-radius: 50% 50% 50% 50%;
+				-webkit-border-radius: 50% 50% 50% 50%;
+				border-radius: 50% 50% 50% 50%;
+				position: absolute;
+				border-left: 0.05rem solid #fff;
+				border-right: 0.05rem solid #fff;
+				border-top: 0.05rem solid transparent;
+				border-bottom: 0.05rem solid transparent;
+				-webkit-animation: animate 2s infinite;
+				animation: animate 2s infinite;
+			}
+
+			#object_one {
+				left: 1.25rem;
+				top: 0.65rem;
+				width: 0.5rem;
+				height: 0.5rem;
+			}
+
+			#object_two {
+				left: 1.15rem;
+				top: 0.55rem;
+				width: 0.7rem;
+				height: 0.7rem;
+				-webkit-animation-delay: 0.1s;
+				animation-delay: 0.1s;
+			}
+
+			#object_three {
+				left: 1.05rem;
+				top: 0.45rem;
+				width: 0.9rem;
+				height: 0.9rem;
+				-webkit-animation-delay: 0.2s;
+				animation-delay: 0.2s;
+			}
+
+			#object_four {
+				left: 0.95rem;
+				top: 0.35rem;
+				width: 1.1rem;
+				height: 1.1rem;
+				-webkit-animation-delay: 0.3s;
+				animation-delay: 0.3s;
+			}
+
+			@-webkit-keyframes animate {
+				50% {
+					-ms-transform: rotate(180deg);
+					-webkit-transform: rotate(180deg);
+					transform: rotate(180deg);
+				}
+
+				100% {
+					-ms-transform: rotate(0deg);
+					-webkit-transform: rotate(0deg);
+					transform: rotate(0deg);
+				}
+			}
+
+			@keyframes animate {
+				50% {
+					-ms-transform: rotate(180deg);
+					-webkit-transform: rotate(180deg);
+					transform: rotate(180deg);
+				}
+
+				100% {
+					-ms-transform: rotate(0deg);
+					-webkit-transform: rotate(0deg);
+					transform: rotate(0deg);
+				}
+			}
+		</style>
+	<body>
+		<div class="spinner-box" style="z-index: 1000;
+              width:100%;
+              height: 100%;
+              position: absolute;
+              top:0;
+              left: 0;">
+			<div id="loading-center-absolute" style="position: absolute;
+                left: 50%;
+                top: 40%;
+                height: 2.5rem;
+                width: 3rem;
+                border-radius:0.2rem;
+                background:rgba(0,0,0,0.7);
+                margin-top: -1rem;
+                margin-left: -1.5rem;">
+				<div class="object" id="object_four"></div>
+				<div class="object" id="object_three"></div>
+				<div class="object" id="object_two"></div>
+				<div class="object" id="object_one"></div>
+				<p style="color:#fff;
+                text-align:center;
+                font-size:0.35rem;
+                font-weight: 700;
+                height:1rem;
+                line-height:1rem;
+                margin-top:1.5rem;">加载中</p>
+			</div>
+		</div>
+		<script>
+			function getUrlParam(name, explode, url) {
+				var param = window.location.search.substr(1);
+				if (url) {
+					if (explode) {
+						param = url.substr(url.indexOf(explode) + 1);
+					} else {
+						param = url.substr(url.indexOf('?') + 1);
+					}
+				} else {
+					if (explode) {
+						param = window.location.href.substr(window.location.href.indexOf(explode) + 1);
+					}
+				}
+				var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
+				var r = param.match(reg);
+				if (r != null) return unescape(r[2]);
+				return '';
+			}
+
+			if (!getUrlParam("code")) {
+				//  未携带code时获取agent_id
+				let agent_id = getUrlParam("agent_id");
+				localStorage.setItem("agent_id", agent_id);
+				//获取appId接口
+				axios.get("http://zhejiangmiliangxiansheng.zjmlxs.com/wxsite/index/wxConfig", {
+					params: {
+						'agent_id': agent_id
+					}
+				}).then(function(response) {
+					if (response.data.code == 1) {
+						if (localStorage.getItem("appid") == response.data.data.app_id) {
+							if (!localStorage.getItem("openid") || localStorage.getItem("openid") == null || localStorage.getItem(
+									"openid") == "undefined") {
+								// 获取微信code
+								window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + localStorage
+									.getItem("appid") + "&redirect_uri=" + location.href +
+									"&response_type=code&scope=snsapi_userinfo&state=123#wechat_redirect";
+							} else {
+								// 定向到项目H5页面
+								window.location.href = "http://zhejiangmiliangxiansheng.zjmlxs.com/H5/index.html#/skip?skipType=home";
+							}
+						} else {
+							localStorage.setItem("appid", response.data.data.app_id);
+							localStorage.removeItem("token");
+							localStorage.removeItem("openid");
+							// 获取微信code
+							window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + localStorage
+								.getItem("appid") + "&redirect_uri=" + location.href +
+								"&response_type=code&scope=snsapi_userinfo&state=123#wechat_redirect";
+						}
+					} else {
+						alert(response.data.msg)
+					}
+				}).catch(function(error) {
+					alert(error)
+				});
+			} else {
+				// 携带code时必然为微信跳转回来的地址
+				let code = getUrlParam("code");
+				// 获取openId接口
+				axios.get("http://zhejiangmiliangxiansheng.zjmlxs.com/wxsite/index/getWxInfo", {
+					params: {
+						'code': code,
+						'agent_id': localStorage.getItem("agent_id")
+					}
+				}).then(function(response) {
+					if (response.data.code == 1) {
+						localStorage.setItem("token", response.data.data.token);
+						localStorage.setItem("openid", response.data.data.openid);
+						//定向到 项目H5页面
+						window.location.href = "http://zhejiangmiliangxiansheng.zjmlxs.com/H5/index.html#/skip?skipType=home";
+					} else {
+						//重新获取微信code
+						alert(response.data.msg)
+						window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + localStorage.getItem(
+								"appid") + "&redirect_uri=" + location.href +
+							"&response_type=code&scope=snsapi_userinfo&state=123#wechat_redirect";
+					}
+				}).catch(function(error) {
+					alert(error)
+				});
+			}
+		</script>
+	</body>
+</html>

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 9 - 0
accreditH5/axios.min.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1 - 0
accreditH5/jweixin-1.0.0.js


+ 2 - 2
api/request/config.js

@@ -1,13 +1,13 @@
 const config = {
 	// base_url: 'http://192.168.1.8/api',//V3
-	 base_url: 'http://192.168.1.9:8080',//柴
+	 // base_url: 'http://192.168.1.9:8080',//柴
 	// base_url: 'http://192.168.1.24:8080',//林总
 	// base_url: 'http://192.168.1.7:8080',//刘波
 	//base_url: 'http://192.168.1.17:8080',//小飞
 	// base_url: 'http://192.168.1.20:8080',//志伟
 	// base_url: 'http://192.168.1.8:8080',//高升
 	// base_url: 'http://192.168.1.29:8080',//何成
-	// base_url: 'http://192.168.1.43/api', //43服务器
+	base_url: 'http://192.168.1.43/api', //43服务器
 	// base_url: 'https://demo.zjznai.com/xzgd/',
 	// base_url: 'https://lab.zjznai.com/labNhSystem/',//43服务器高升测试
 	// base_url: 'https://lab.zjznai.com/labAppTest/',//43服务器线上

+ 5 - 5
api/request/request.js

@@ -42,7 +42,7 @@ export const apiResquest = (prams) => {
 							mask: true,
 							icon: "none",
 							position: "center",
-							title: res.data.msg,
+							title: res.data.message,
 							duration: 2000
 						});
 						resolve(res);
@@ -113,7 +113,7 @@ export const apiResquestForm = (prams) => {
 							mask: true,
 							icon: "none",
 							position: "center",
-							title: res.data.msg,
+							title: res.data.message,
 							duration: 2000
 						});
 						resolve(res);
@@ -182,7 +182,7 @@ export const apiResquestJsonList = (prams) => {
 							mask: true,
 							icon: "none",
 							position: "center",
-							title: res.data.msg,
+							title: res.data.message,
 							duration: 2000
 						});
 						resolve(res);
@@ -253,7 +253,7 @@ export const apiResquestFormVideo = (prams) => {
 							mask: true,
 							icon: "none",
 							position: "center",
-							title: res.data.msg,
+							title: res.data.message,
 							duration: 2000
 						});
 						resolve(res);
@@ -321,7 +321,7 @@ export const apiResquestTimer = (prams) => {
 							mask: true,
 							icon: "none",
 							position: "center",
-							title: res.data.msg,
+							title: res.data.message,
 							duration: 2000
 						});
 						resolve(res);

+ 13 - 14
components/mineConfigurationSlot.vue

@@ -29,7 +29,7 @@
 		<view class="button-max-big-box">
 			<permissionsSlot class="button-for-box" v-for="(item,index) in mineConfig.layout" :key="item.id"
 				:hasPermi="item.limits">
-				<view class="button-max-box" @click="buttonClick(mineConfig.layout)">
+				<view class="button-max-box" @click="buttonClick(index)">
 					<img class="left-img" :src="item.img">
 					<view>{{item.name}}</view>
 					<view class="view-three-one" v-if="item.route === 'mineWarningRecording' && securityAlertNum>0">
@@ -80,33 +80,32 @@
 		},
 		methods: {
 			//按钮点击事件
-			buttonClick(item) {
-        console.log(item)
-				if (item.buttonType === 'page') {
-					if (item.route === 'mineWarningRecording') { //预警记录
+			buttonClick(index) {
+				if (this.mineConfig.layout[index].buttonType === 'page') {
+					if (this.mineConfig.layout[index].route === 'mineWarningRecording') { //预警记录
 						uni.navigateTo({
-							url: item.routeUrl,
+							url: this.mineConfig.layout[index].routeUrl,
 						});
 					}
-					if (item.route === 'laboratory') { //我的实验室
+					if (this.mineConfig.layout[index].route === 'laboratory') { //我的实验室
 						uni.navigateTo({
-							url: item.routeUrl,
+							url: this.mineConfig.layout[index].routeUrl,
 						});
 					}
-					if (item.route === 'PlanExecuteRecord') { //预案执行记录
+					if (this.mineConfig.layout[index].route === 'PlanExecuteRecord') { //预案执行记录
 						uni.navigateTo({
-							url: item.routeUrl,
+							url: this.mineConfig.layout[index].routeUrl,
 						});
 					}
-					if (item.route === 'faceImage') { //身份验证
+					if (this.mineConfig.layout[index].route === 'faceImage') { //身份验证
 						uni.navigateTo({
-							url: item.routeUrl,
+							url: this.mineConfig.layout[index].routeUrl,
 						});
 					}
 
-				} else if (item.buttonType === 'button') {
+				} else if (this.mineConfig.layout[index].buttonType === 'button') {
 
-				} else if (item.buttonType === 'none') {
+				} else if (this.mineConfig.layout[index].buttonType === 'none') {
 					uni.showToast({
 						title: '暂未开放',
 						icon: "none",

+ 14 - 4
pages/mine/mine.vue

@@ -83,22 +83,32 @@
 		systemAppletLayoutSelect,
 		systemUserProfile
 	} from '@/api/basicsModules/index.js'
+	import {
+		getMineConfig
+	} from '@/utils/mineConfig'
+	// #ifdef MP-WEIXIN
 	import {
 		tabBar
 	} from '@/components/tabBar.vue'
-
 	import {
 		mineConfigurationSlot
 	} from '@/components/mineConfigurationSlot'
-	import {
-		getMineConfig
-	} from '@/utils/mineConfig'
+	// #endif
+
 
 	export default {
+	// #ifdef MP-WEIXIN
 		components: {
 			tabBar,
 			mineConfigurationSlot,
 		},
+	// #endif
+		// #ifdef H5
+		components: {
+			"tabBar": () => import('@/components/tabBar.vue'),
+			"mineConfigurationSlot": () => import('@/components/mineConfigurationSlot.vue'),
+		},
+		// #endif
 		data() {
 			return {
 				baseUrl: config.base_url,