From e3dcaeb0180a4e37347ac9ceb44c8a59ae7af37f Mon Sep 17 00:00:00 2001
From: liuyg <liuyg@qq.com>
Date: Mon, 21 Feb 2022 19:40:20 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.105:10010/r/qfqk-android
---
pages/registerUser/registerUser.vue | 86 ++++++++++++++++------------
leafletMapOur/loginMap/js/vueMain.js | 22 ++++++-
pages.json | 11 +++
leafletMapOur/loginMap/js/webview.js | 1
leafletMapOur/loginMap/loginMap.html | 4 +
pages/currentMap/currentMap.vue | 48 ++++++++++++++++
6 files changed, 130 insertions(+), 42 deletions(-)
diff --git a/leafletMapOur/loginMap/js/vueMain.js b/leafletMapOur/loginMap/js/vueMain.js
index 8f30fe0..faf0089 100644
--- a/leafletMapOur/loginMap/js/vueMain.js
+++ b/leafletMapOur/loginMap/js/vueMain.js
@@ -22,11 +22,13 @@
resultFeedbackPopupShow: false,
popupDisplay: "none",
- regionName: ''
+ regionName: '',
+ byValue: ''
},
methods: {
getLocalPoliceStation () {
- window.parent.getRegionName(this.regionName)
+ this.regionName = this.byValue
+
},
getDataList () {
var that = this
@@ -119,7 +121,7 @@
// 定位成功之后调用的方法
function showPosition (position) {
- that.regionName = position.district || position.city
+ that.byValue = position.district || position.city
that.lat = position.lat //
that.lng = position.lng //火星坐标 //TODO 实现业务代码逻辑
@@ -167,7 +169,19 @@
}
},
- created () { },
+ created () {
+ var that = this
+ document.addEventListener('UniAppJSBridgeReady', function (e) {
+ uni.getEnv(function (res) {
+ console.log('当前环境:' + JSON.stringify(res))
+ })
+
+ // 向uniapp底座发送消息
+ uni.postMessage({
+ data: that.regionName
+ })
+ })
+ },
mounted () {
this.getDataList()
this.getLocationData()
diff --git a/leafletMapOur/loginMap/js/webview.js b/leafletMapOur/loginMap/js/webview.js
new file mode 100644
index 0000000..93b5818
--- /dev/null
+++ b/leafletMapOur/loginMap/js/webview.js
@@ -0,0 +1 @@
+!function (e, n) { "object" == typeof exports && "undefined" != typeof module ? module.exports = n() : "function" == typeof define && define.amd ? define(n) : (e = e || self).uni = n() }(this, (function () { "use strict"; try { var e = {}; Object.defineProperty(e, "passive", { get: function () { !0 } }), window.addEventListener("test-passive", null, e) } catch (e) { } var n = Object.prototype.hasOwnProperty; function t (e, t) { return n.call(e, t) } var i = [], a = function (e, n) { var t = { options: { timestamp: +new Date }, name: e, arg: n }; if (window.__dcloud_weex_postMessage || window.__dcloud_weex_) { if ("postMessage" === e) { var a = { data: [n] }; return window.__dcloud_weex_postMessage ? window.__dcloud_weex_postMessage(a) : window.__dcloud_weex_.postMessage(JSON.stringify(a)) } var o = { type: "WEB_INVOKE_APPSERVICE", args: { data: t, webviewIds: i } }; window.__dcloud_weex_postMessage ? window.__dcloud_weex_postMessageToService(o) : window.__dcloud_weex_.postMessageToService(JSON.stringify(o)) } if (!window.plus) return window.parent.postMessage({ type: "WEB_INVOKE_APPSERVICE", data: t, pageId: "" }, "*"); if (0 === i.length) { var r = plus.webview.currentWebview(); if (!r) throw new Error("plus.webview.currentWebview() is undefined"); var d = r.parent(), s = ""; s = d ? d.id : r.id, i.push(s) } if (plus.webview.getWebviewById("__uniapp__service")) plus.webview.postMessageToUniNView({ type: "WEB_INVOKE_APPSERVICE", args: { data: t, webviewIds: i } }, "__uniapp__service"); else { var w = JSON.stringify(t); plus.webview.getLaunchWebview().evalJS('UniPlusBridge.subscribeHandler("'.concat("WEB_INVOKE_APPSERVICE", '",').concat(w, ",").concat(JSON.stringify(i), ");")) } }, o = { navigateTo: function () { var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, n = e.url; a("navigateTo", { url: encodeURI(n) }) }, navigateBack: function () { var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, n = e.delta; a("navigateBack", { delta: parseInt(n) || 1 }) }, switchTab: function () { var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, n = e.url; a("switchTab", { url: encodeURI(n) }) }, reLaunch: function () { var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, n = e.url; a("reLaunch", { url: encodeURI(n) }) }, redirectTo: function () { var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, n = e.url; a("redirectTo", { url: encodeURI(n) }) }, getEnv: function (e) { window.plus ? e({ plus: !0 }) : e({ h5: !0 }) }, postMessage: function () { var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; a("postMessage", e.data || {}) } }, r = /uni-app/i.test(navigator.userAgent), d = /Html5Plus/i.test(navigator.userAgent), s = /complete|loaded|interactive/; var w = window.my && navigator.userAgent.indexOf("AlipayClient") > -1; var u = window.swan && window.swan.webView && /swan/i.test(navigator.userAgent); var c = window.qq && window.qq.miniProgram && /QQ/i.test(navigator.userAgent) && /miniProgram/i.test(navigator.userAgent); var g = window.tt && window.tt.miniProgram && /toutiaomicroapp/i.test(navigator.userAgent); var v = window.wx && window.wx.miniProgram && /micromessenger/i.test(navigator.userAgent) && /miniProgram/i.test(navigator.userAgent); var p = window.qa && /quickapp/i.test(navigator.userAgent); for (var l, _ = function () { window.UniAppJSBridge = !0, document.dispatchEvent(new CustomEvent("UniAppJSBridgeReady", { bubbles: !0, cancelable: !0 })) }, f = [function (e) { if (r || d) return window.__dcloud_weex_postMessage || window.__dcloud_weex_ ? document.addEventListener("DOMContentLoaded", e) : window.plus && s.test(document.readyState) ? setTimeout(e, 0) : document.addEventListener("plusready", e), o }, function (e) { if (v) return window.WeixinJSBridge && window.WeixinJSBridge.invoke ? setTimeout(e, 0) : document.addEventListener("WeixinJSBridgeReady", e), window.wx.miniProgram }, function (e) { if (c) return window.QQJSBridge && window.QQJSBridge.invoke ? setTimeout(e, 0) : document.addEventListener("QQJSBridgeReady", e), window.qq.miniProgram }, function (e) { if (w) { document.addEventListener("DOMContentLoaded", e); var n = window.my; return { navigateTo: n.navigateTo, navigateBack: n.navigateBack, switchTab: n.switchTab, reLaunch: n.reLaunch, redirectTo: n.redirectTo, postMessage: n.postMessage, getEnv: n.getEnv } } }, function (e) { if (u) return document.addEventListener("DOMContentLoaded", e), window.swan.webView }, function (e) { if (g) return document.addEventListener("DOMContentLoaded", e), window.tt.miniProgram }, function (e) { if (p) { window.QaJSBridge && window.QaJSBridge.invoke ? setTimeout(e, 0) : document.addEventListener("QaJSBridgeReady", e); var n = window.qa; return { navigateTo: n.navigateTo, navigateBack: n.navigateBack, switchTab: n.switchTab, reLaunch: n.reLaunch, redirectTo: n.redirectTo, postMessage: n.postMessage, getEnv: n.getEnv } } }, function (e) { return document.addEventListener("DOMContentLoaded", e), o }], m = 0; m < f.length && !(l = f[m](_)); m++); l || (l = {}); var E = "undefined" != typeof uni ? uni : {}; if (!E.navigateTo) for (var b in l) t(l, b) && (E[b] = l[b]); return E.webView = l, E }))
diff --git a/leafletMapOur/loginMap/loginMap.html b/leafletMapOur/loginMap/loginMap.html
index 58435c5..8c46189 100644
--- a/leafletMapOur/loginMap/loginMap.html
+++ b/leafletMapOur/loginMap/loginMap.html
@@ -59,6 +59,10 @@
<!-- sha1加密 -->
<!-- <script src="./js/sha1.js"></script> -->
<script src="http://pv.sohu.com/cityjson?ie=utf-8"></script>
+
+ <!-- uni 的 SDK -->
+ <script type="text/javascript" src="./js/webview.js">
+ </script>
</head>
<body>
diff --git a/pages.json b/pages.json
index 13a5c68..d4c1245 100644
--- a/pages.json
+++ b/pages.json
@@ -398,6 +398,17 @@
}
},
{
+ "path": "pages/currentMap/currentMap",
+ "name": "currentMap",
+ "style": {
+ "navigationBarTitleText": "获取辖区",
+ "navigationBarBackgroundColor": "#103289",
+ "navigationBarTextStyle": "white",
+ "enablePullDownRefresh": false,
+ "navigationStyle": "custom"
+ }
+ },
+ {
"path": "pages/clockSignIn/clockSignIn",
"name": "clockSignIn",
"style": {
diff --git a/pages/currentMap/currentMap.vue b/pages/currentMap/currentMap.vue
new file mode 100644
index 0000000..2522f0b
--- /dev/null
+++ b/pages/currentMap/currentMap.vue
@@ -0,0 +1,48 @@
+<template>
+ <view class="content">
+ <web-view :src="urls" @message="handleMessage"></web-view>
+ </view>
+</template>
+
+<script>
+ export default {
+ data() {
+ return {
+ urls: '',
+ // dataList: [],
+ regionName: ""
+ }
+ },
+ methods: {
+ handleMessage(event) {
+ var that = this
+ console.log(event)
+ var regionName = event.detail.data[0]
+ if (regionName.indexOf('区') != -1) {
+ that.regionName = regionName.replace('区', '派出所');
+ } else if (regionName.indexOf('县') != -1) {
+ that.regionName = regionName.replace('县', '派出所');
+ } else if (regionName.indexOf('市') != -1) {
+ that.regionName = regionName.replace('市', '市派出所');
+ }
+
+ this.goBack()
+ },
+ goBack() {
+ uni.$emit('updateDataRegionName', this.regionName)
+ uni.navigateBack({
+ delta: 1
+ })
+ }
+ },
+ mounted() {},
+ onLoad: function(options) {
+
+ this.urls = "http://192.168.0.115:5500/leafletMapOur/loginMap/loginMap.html?data=" + options.data;
+
+ },
+ }
+</script>
+
+<style>
+</style>
diff --git a/pages/registerUser/registerUser.vue b/pages/registerUser/registerUser.vue
index 3cad0e8..8975bd2 100644
--- a/pages/registerUser/registerUser.vue
+++ b/pages/registerUser/registerUser.vue
@@ -41,15 +41,16 @@
和
<text class="a">《隐私政策》</text>
</view>
- <div v-show="mapShow">
- <div class="login-map-bc" @click="mapShow = false">
+ <div class="login-map-bc" v-if="mapShow">
+ <div @click="mapShow = false">
</div>
<div class="login-map-content">
<u-icon class="login-map-close" name="close" @click="mapShow = false"></u-icon>
- <iframe style="width: 100%; height: 100%; position: absolute; " :src="loginMapUrl">
- </iframe>
+ <view style="width: 100%; height: 100%; position: absolute; ">
+ <web-view :src="loginMapUrl"></web-view>
+ </view>
</div>
</div>
@@ -65,8 +66,9 @@
data() {
var validateUser = (rule, value, callback) => {
var phone = /^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/;
- var identity = /(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}$)/;
-
+ var identity =
+ /(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}$)/;
+
if (value.length <= 11) {
if (phone.test(value)) {
return true
@@ -74,7 +76,7 @@
return callback(new Error('手机号格式不正确'));
}
}
-
+
if (value.length <= 18) {
if (identity.test(value)) {
return true
@@ -82,7 +84,7 @@
return callback(new Error('身份证号格式不正确'));
}
}
-
+
};
return {
@@ -194,16 +196,14 @@
jsid: ''
},
rules: {
- user: [
- {
- /*
- u-form提供的可直接调用的js验证,
- 具体有哪些可以观看官方文档,这里就不在赘述了。
- */
- validator: validateUser,
- trigger: ['change', 'blur'],
- },
- ],
+ user: [{
+ /*
+ u-form提供的可直接调用的js验证,
+ 具体有哪些可以观看官方文档,这里就不在赘述了。
+ */
+ validator: validateUser,
+ trigger: ['change', 'blur'],
+ }, ],
pass: [{
required: true,
message: '请输入6~16位密码',
@@ -319,7 +319,27 @@
]
};
},
+
+ onShow() {
+ let that = this
+ uni.$on('updateDataRegionName', function(data) {
+ that.regionName = data
+ that.form.xq = that.regionName
+ })
+ },
methods: {
+ handleMessage(name) {
+ console.log(name)
+ if (name.indexOf('区') != -1) {
+ that.regionName = name.replace('区', '派出所');
+ } else if (name.indexOf('县') != -1) {
+ that.regionName = name.replace('县', '派出所');
+ } else if (name.indexOf('市') != -1) {
+ that.regionName = name.replace('市', '市派出所');
+ }
+
+
+ },
openLoginMap() {
var that = this
uni.getLocation({
@@ -350,14 +370,17 @@
"jd": res.longitude,
"wd": res.latitude
}]
- data = JSON.stringify(data);
+
+ uni.navigateTo({
+ url: '/pages/currentMap/currentMap?data=' + JSON.stringify(data)
+ })
- // that.loginMapUrl = 'http://127.0.0.1:5500/leafletMapOur/loginMap/loginMap.html?data=' +
- // data
+ // that.loginMapUrl =
+ // 'http://192.168.0.115:5500/leafletMapOur/loginMap/loginMap.html?data=' + data
- that.loginMapUrl = 'http://223.82.109.183:2082/loginMap/loginMap.html?data=' + data
- that.mapShow = true
+ // // that.loginMapUrl = 'http://223.82.109.183:2082/loginMap/loginMap.html?data=' + data
+ // that.mapShow = true
}
})
@@ -535,20 +558,6 @@
},
onReady() {
this.$refs.uForm.setRules(this.rules);
- var that = this
- window.getRegionName = function(name) {
- console.log(name)
- if (name.indexOf('区') != -1) {
- that.regionName = name.replace('区', '派出所');
- } else if (name.indexOf('县') != -1) {
- that.regionName = name.replace('县', '派出所');
- } else if (name.indexOf('市') != -1) {
- that.regionName = name.replace('市', '市派出所');
- }
-
- that.form.xq = that.regionName
- that.mapShow = false
- }
},
watch: {
faceState() {
@@ -567,6 +576,7 @@
this.faceMsg = '(服务连接失败!)';
}
}
+
}
};
</script>
@@ -588,7 +598,7 @@
bottom: 0;
left: 0;
width: 100%;
- height: 60%;
+ height: 100%;
z-index: 222;
border-radius: 15px 15px 0 0;
overflow: hidden;
--
Gitblit v1.9.3