From 9057e04efad1b7d61c77a72e5c37a504d0aee935 Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期五, 26 九月 2025 09:24:03 +0800
Subject: [PATCH] H5静态化

---
 h5/App.vue |  463 ++++++++++++++++++++++++---------------------------------
 1 files changed, 194 insertions(+), 269 deletions(-)

diff --git a/h5/App.vue b/h5/App.vue
index 526bb3b..85703fe 100644
--- a/h5/App.vue
+++ b/h5/App.vue
@@ -1,274 +1,199 @@
 <script>
-export default {
-  onLaunch: function () {
-    // const result = uni.getWindowInfo()
-  },
-  onShow: function () {
-    console.log('App Show')
-  },
-  onHide: function () {
-    console.log('App Hide')
-  }
-}
+	export default {
+		onLaunch: function() {
+			this.init()
+		},
+		onShow: function() {
+			console.log('App Show')
+		},
+		onHide: function() {
+			console.log('App Hide')
+		},
+		methods: {
+			async init() {
+				// ShiXuHui GuoJiWenWu
+				if (!this.$store.state.userInfo) {
+					let res = await this.$u.api.login({ code: 'GuoJiWenWu' })
+					if (res.code === 200) {
+						this.$store.commit('setUserInfo', res.data)
+					}
+				}
+				return
+				let code = this.getQueryVariable('code')
+				if (code) {
+					if (!uni.getStorageSync('code')) {
+						uni.setStorageSync('code', code);
+						
+						let res = await this.$u.api.login({ code: code })
+						if (res.code === 200) {
+							this.$store.commit('setUserInfo', res.data)
+							this.initRegister()
+							
+							// 鍒ゆ柇鏄惁璺宠浆璇︽儏
+							let url = window.location.href
+							if (url.indexOf('state=') !== -1 && url.indexOf('#') !== -1) {
+								let value = url.substring(url.indexOf('state=') + 6, url.indexOf('#')).split('_')
+								console.log(value)
+								if (value[0] !== '') {
+									if (value[0] == 0) {
+										uni.navigateTo({
+											url: `/pages/details_she/details_she?id=${value[1]}`
+										})
+									} else if (value[0] == 1) {
+										uni.navigateTo({
+											url: `/pages/details_dca/details_dca?id=${value[1]}&isShow=true`
+										})
+									} else if (value[0] == 3) {
+										uni.navigateTo({
+											url: `/pages/workOrder_she/workOrder_she?id=${value[1]}`
+										})
+									}
+								}
+							}
+						}
+					} else if (uni.getStorageSync('code') !== code) {
+						
+						uni.setStorageSync('code', code);
+						
+						let res = await this.$u.api.login({ code: code })
+						if (res.code === 200) {
+							this.$store.commit('setUserInfo', res.data)
+							this.initRegister()
+							
+							// 鍒ゆ柇鏄惁璺宠浆璇︽儏
+							let url = window.location.href
+							if (url.indexOf('state=') !== -1 && url.indexOf('#') !== -1) {
+								let value = url.substring(url.indexOf('state=') + 6, url.indexOf('#')).split('_')
+								console.log(value)
+								if (value[0] !== '') {
+									if (value[0] == 0) {
+										uni.navigateTo({
+											url: `/pages/details_she/details_she?id=${value[1]}`
+										})
+									} else if (value[0] == 1) {
+										uni.navigateTo({
+											url: `/pages/details_dca/details_dca?id=${value[1]}&isShow=true`
+										})
+									} else if (value[0] == 3) {
+										uni.navigateTo({
+											url: `/pages/workOrder_she/workOrder_she?id=${value[1]}`
+										})
+									}
+								}
+							}
+						}
+
+					} else {
+						let loc_href = encodeURIComponent("https://dmtest.ahapp.net/lianhelihua_web/")
+						
+						let corpId = 'wweea8f71b54e3b835';
+						let agentId = '1000095';
+									
+						let wxUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${corpId}&redirect_uri=${loc_href}&response_type=code&scope=snsapi_base&state=#wechat_redirect`
+						
+						location.href = wxUrl;
+					}
+				} else {
+					let loc_href = encodeURIComponent("https://dmtest.ahapp.net/lianhelihua_web/")
+					
+					let corpId = 'wweea8f71b54e3b835';
+					let agentId = '1000095';
+								
+					let wxUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${corpId}&redirect_uri=${loc_href}&response_type=code&scope=snsapi_base&state=#wechat_redirect`
+					
+					location.href = wxUrl;
+				}
+				// ShiXuHui
+				// if (!this.$store.state.userInfo) {
+				// 	let res = await this.$u.api.login({ code: 'GuoJiWenWu' })
+				// 	if (res.code === 200) {
+				// 		this.$store.commit('setUserInfo', res.data)
+				// 	}
+				// }
+				// return
+			// 	let code = this.getQueryVariable('code')
+			// 	if (code) {
+			// 		let res = await this.$u.api.login({ code: code })
+			// 		if (res.code === 200) {
+			// 			this.$store.commit('setUserInfo', res.data)
+			// 			this.initRegister()
+						
+			// 			// 鍒ゆ柇鏄惁璺宠浆璇︽儏
+			// 			let url = window.location.href
+			// 			if (url.indexOf('state=') !== -1 && url.indexOf('#') !== -1) {
+			// 				let value = url.substring(url.indexOf('state=') + 6, url.indexOf('#')).split('_')
+			// 				console.log(value)
+			// 				if (value[0] !== '') {
+			// 					if (value[0] == 0) {
+			// 						uni.navigateTo({
+			// 							url: `/pages/details_she/details_she?id=${value[1]}`
+			// 						})
+			// 					} else if (value[0] == 1) {
+			// 						uni.navigateTo({
+			// 							url: `/pages/workOrder_dca/workOrder_dca?id=${value[1]}`
+			// 						})
+			// 					} else if (value[0] == 3) {
+			// 						uni.navigateTo({
+			// 							url: `/pages/workOrder_she/workOrder_she?id=${value[1]}`
+			// 						})
+			// 					}
+			// 				}
+			// 			}
+			// 		}
+			// 	} else {
+			// 		let loc_href = encodeURIComponent("https://dmtest.ahapp.net/lianhelihua_web/")
+					
+			// 		let corpId = 'wweea8f71b54e3b835';
+			// 		let agentId = '1000095';
+			
+			// 		let wxUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${corpId}&redirect_uri=${loc_href}&response_type=code&scope=snsapi_base&state=#wechat_redirect`
+					
+			// 		location.href = wxUrl;
+			// 	}
+			},
+			// 鑾峰彇url鍙傛暟
+			getQueryVariable(variable) {
+				var query = window.location.search.substring(1);
+				var vars = query.split("&");
+				for (var i = 0; i < vars.length; i++) {
+					var pair = vars[i].split("=");
+					if (pair[0] == variable) {
+						return pair[1];
+					}
+				}
+				return (false);
+			},
+			async initRegister() {
+				let fullURL = window.location.href.substring(0, window.location.href.lastIndexOf('#'))
+				console.log(fullURL)
+				let resData = await this.$u.api.getQwSignature({ url: fullURL })
+				if (resData.code === 200) {
+					this.$ww.register({
+						corpId: 'wweea8f71b54e3b835',
+						agentId: '1000095',
+						jsApiList: [
+							'initOpenData',
+							'selectEnterpriseContact'
+						],
+						getConfigSignature: (url) => {
+							console.log(this.$ww.getSignature(resData.data.ticket))
+							return this.$ww.getSignature(resData.data.ticket)
+						}
+					})
+					this.$ww.initOpenData({
+						success: (res) => {
+							console.log('success', res)
+						},
+						fail: (err) => {
+							console.log('fail', err)
+						}
+					})
+				}
+			}
+		}
+	}
 </script>
 
 <style lang="scss">
-/*姣忎釜椤甸潰鍏叡css */
-@import "uview-ui/index.scss";
-// @import "./uni_modules/uview-ui/index.scss";
-body{
-	font-size: 28rpx;
-}
-.primaryColor {
-	color: $primaryColor !important;
-}
-.flex-cb {
-  display: flex;
-  justify-content: space-between;
-  align-items: center;
-}
-.empty_wrap{
-	display: flex;
-	flex-direction: column;
-	justify-content: center;
-	align-items: center;
-	height: 100%;
-	image{
-		width: 320rpx;
-	}
-}
-.bg{
-	width: 100%;
-	height: 100%;
-	position: absolute;
-	top: 0;
-	left: 0;
-}
-.container {
-  height: 100%;
-  width: 100%;
-  max-width: 800rpx;
-  overflow-y: auto;
-}
-.empty_wrap{
-	display: flex;
-	flex-direction: column;
-	justify-content: center;
-	align-items: center;
-	color: #666666;
-	min-height: 600rpx;
-	image{
-		width: 300rpx;
-		height: 300rpx;
-	}
-}
-.doumee-container .ivu-tabs-nav {
-  width: 100%;
-}
-
-.doumee-container .ivu-tabs-nav .ivu-tabs-tab {
-  width: calc(100% / 3);
-}
-
-.doumee-container .ivu-tabs-nav .ivu-tabs-tab {
-  margin-right: 0;
-  text-align: center;
-}
-
-.cell {
-  background-color: #fff;
-  display: flex;
-  justify-content: space-between;
-  align-items: center;
-  min-height: 100rpx;
-  padding: 24rpx 30rpx;
-  box-sizing: border-box;
-  border-bottom: 1rpx solid #eee;
-  font-size: 15rpx;
-  position: relative;
-}
-
-.cell .title {
-  flex-shrink: 0;
-  color: #222;
-  line-height: 20rpx;
-  height: 20rpx;
-  width: 28%;
-  margin-right: 5%;
-}
-
-.cell .content {
-  flex: 1;
-  font-size: 28rpx;
-  font-weight: 400;
-  color: #999999;
-  display: flex;
-  align-items: center;
-  justify-content: flex-end;
-}
-
-.cell .content .input {
-  width: 100%;
-  height: 100%;
-  font-size: 28rpx;
-  font-weight: 400;
-  color: #333333;
-  text-align: right;
-}
-
-.cell.is-link::after {
-  content: "";
-  display: block;
-  width: 8rpx;
-  height: 8rpx;
-  transform: rotate(-45deg);
-  border-right: 1rpx solid #999999;
-  border-bottom: 1rpx solid #999999;
-  margin-left: 5rpx;
-}
-
-.card {
-  background-color: #fff;
-  padding: 16rpx;
-  position: relative;
-}
-.red{
-	color: red;
-}
-.card::after {
-  content: "";
-  display: block;
-  position: absolute;
-  width: calc(100% - 32rpx);
-  height: 0;
-  bottom: 0;
-  left: 16rpx;
-  border-bottom: 1rpx solid #f7f7f7;
-}
-
-.card .title {
-  color: #777777;
-  margin-bottom: 12rpx;
-}
-
-.card .content {
-  color: #222;
-}
-
-.placeholder9 {
-  color: #999999 !important;
-  font-size: 28rpx;
-}
-.red{
-	color: red !important;
-}
-
-//璁剧疆鍦嗚
-checkbox .uni-checkbox-input {
-  border-radius: 50%;
-}
-
-checkbox .uni-checkbox-input.uni-checkbox-input-checked {
-  color: #fff !important;
-  border: 1px solid #4d99a8 !important;
-  background-color: #4d99a8 !important;
-}
-
-checkbox .uni-checkbox-input.uni-checkbox-input-checked:before {
-  /* color: #4d99a8 !important;  */
-  /* border: 1px solid #4d99a8 !important; */
-  /* font-size: 58rpx; */
-  /* border-radius: 50%; */
-}
-
-//
-
-view {
-  box-sizing: border-box;
-}
-
-image {
-  box-sizing: border-box;
-  margin: 0;
-  display: flex;
-}
-input {
-  font-size: 30rpx;
-}
-textarea {
-  box-sizing: border-box;
-  // background-color: #f7f7f7;
-  font-size: 30rpx !important;
-  padding: 0;
-  border-radius: 8rpx;
-  color: #333333 !important;
-}
-.u-textarea {
-  padding: 0 !important;
-  color: #333333 !important;
-}
-
-.df_ac {
-  display: flex;
-  align-items: center;
-}
-
-.main_app {
-  padding: 0 30rpx 30rpx;
-  font-size: 28rpx;
-  color: #333333;
-}
-.popupShow {
-  overflow: hidden;
-  position: fixed;
-  width: 100%;
-}
-.placeholder6 {
-  color: #666666;
-  font-size: 28rpx;
-}
-.primaryColor {
-  color: $uni-color-primary;
-}
-.avatar {
-  width: 64rpx;
-  height: 64rpx;
-  border-radius: 50%;
-  margin-right: 20rpx;
-  display: flex;
-  justify-content: center;
-  align-items: center;
-  background-color: $uni-color-primary;
-  color: #fff;
-  font-size: 30rpx;
-}
-.placeholder9 {
-  color: #999999;
-  font-size: 28rpx;
-}
-.fs24 {
-  font-size: 24rpx;
-}
-.mr24 {
-  margin-right: 24rpx;
-}
-.mt24 {
-  margin-top: 24rpx;
-}
-
-.mr12 {
-  margin-right: 12rpx;
-}
-.ml12 {
-  margin-left: 12rpx;
-}
-.ml6 {
-  margin-left: 6rpx;
-}
-.mt6 {
-  margin-top: 6rpx;
-}
-.mr6 {
-  margin-right: 6rpx;
-}
+	@import "uview-ui/index.scss";
 </style>

--
Gitblit v1.9.3