From 1e756198bc1568ca74858f0a6b81bba1950f80a4 Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期二, 07 五月 2024 17:11:41 +0800
Subject: [PATCH] api

---
 h5/pages/visitorApplication/visitorApplication.vue |   16 +++++---
 h5/utils/config.js                                 |    3 +
 h5/utils/http.api.js                               |    4 -
 h5/utils/service.js                                |   60 ++++++++++++++++++++++++++++++
 4 files changed, 74 insertions(+), 9 deletions(-)

diff --git a/h5/pages/visitorApplication/visitorApplication.vue b/h5/pages/visitorApplication/visitorApplication.vue
index 3856651..1838734 100644
--- a/h5/pages/visitorApplication/visitorApplication.vue
+++ b/h5/pages/visitorApplication/visitorApplication.vue
@@ -108,7 +108,6 @@
 			v-if="form1.starttime"
 			:show="show5"
 			:minDate="formatTimeStamp(form1.starttime)"
-			:maxDate="formatTimeStamp(maxTime)"
 			mode="datetime"
 			@cancel="show5 = false"
 			@confirm="setoutDate"
@@ -309,7 +308,9 @@
 				show6: false,
 				show7: false,
 				fileList: [],
-				columns1: [[{name: '韬唤璇�', id: 0}, {name: '娓境璇佷欢', id: 1},{name: '鎶ょ収', id: 2}]],
+				columns1: [
+					[{name: '韬唤璇�', id: 0}, {name: '娓境璇佷欢', id: 1},{name: '鎶ょ収', id: 2}],
+				],
 				columns: [],
 				cars: [],
 				day: null,
@@ -351,9 +352,9 @@
 			if (options.data) {
 				this.form = JSON.parse(options.data)
 			}
-			this.getvisit()
-			this.getVisit1()
-			this.getUserValid()
+			// this.getvisit()
+			// this.getVisit1()
+			// this.getUserValid()
 		},
 		methods: {
 			openInput(type) {
@@ -563,6 +564,7 @@
 			seleIdcard(e) {
 				this.withUserList.idcardType = e.value[0].id
 				this.withUserList.idcardTypeName = e.value[0].name
+				console.log(e);
 				this.show6 = false
 			},
 			submitCart() {
@@ -612,7 +614,9 @@
 			},
 			setinDate(e) {
 				this.form1.starttime = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM');
-				this.maxTime = getDaysAfterDate(uni.$u.timeFormat(e.value, 'yyyy-mm-dd'), this.day)
+				// this.maxTime = getDaysAfterDate(uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM'), this.day)
+				this.maxTime = this.form1.starttime
+				console.log(this.form1.starttime);
 				this.show4 = false
 			},
 			setoutDate(e) {
diff --git a/h5/utils/config.js b/h5/utils/config.js
new file mode 100644
index 0000000..aff5d77
--- /dev/null
+++ b/h5/utils/config.js
@@ -0,0 +1,3 @@
+
+export const baseUrl = 'api/'
+export const uploadUrl = `${baseUrl}visitsAdmin/cloudService/web/public/uploadFtp.do`
\ No newline at end of file
diff --git a/h5/utils/http.api.js b/h5/utils/http.api.js
index 7b289fd..d910c5d 100644
--- a/h5/utils/http.api.js
+++ b/h5/utils/http.api.js
@@ -1,5 +1,4 @@
-export const baseUrl = 'api/'
-export const uploadUrl = `${baseUrl}visitsAdmin/cloudService/web/public/uploadFtp.do`
+import {baseUrl, uploadUrl} from './config'
 
 const install = (Vue, vm) => {
 	
@@ -8,7 +7,6 @@
 			config.timeout = 60000;
 	    return config;
 	})
-	
 	Vue.prototype.$baseUrl = baseUrl;
 	Vue.prototype.$uploadUrl = uploadUrl;
 	
diff --git a/h5/utils/service.js b/h5/utils/service.js
new file mode 100644
index 0000000..74e9df7
--- /dev/null
+++ b/h5/utils/service.js
@@ -0,0 +1,60 @@
+import { baseUrl } from "./config.js"
+export const http = function (options) {
+	{
+		return new Promise((resolve, reject) => {
+			let token = uni.getStorageSync('token')
+			// 鍦ㄧ櫥褰曠殑鏃跺�欓渶瑕佸偍瀛� token uni.setStorageSync("authorization","杩欓噷鏄櫥褰曡幏鍙栫殑token鍊�")
+
+			// uni.showLoading({
+			// 	title:"鍔犺浇涓�..."
+			// })
+			uni.showLoading({
+				title: '鍔犺浇涓�',
+				mask: true
+			})
+			uni.request({
+				url: baseUrl + options.url,
+				data: options.data || {},
+				method: options.method || 'GET',
+				header: options.header || {
+					// 鏍规嵁瀹為檯鎺ュ彛璁捐 key 鍙� token 鎴栬�� authorization
+					token: token,
+					"content-type": 'application/json'
+				},
+				success: (res) => {
+					let data = res.data
+					// 鎺у埗鍙版樉绀烘暟鎹俊鎭�
+					uni.hideLoading()
+					// 鐧诲綍杩囨湡
+					if (data.code === 401) {
+						uni.navigateTo({
+							url: '/packageA/loginAgain/loginAgain'
+						})
+					}
+					if (data.code !== 200) {
+						uni.showToast({
+							title: response.data.message,
+							icon: "none",
+							duration: 2000
+						})
+					}
+					resolve(data)
+					// return response.data
+				},
+				fail: (err) => {
+					// 椤甸潰涓脊妗嗘樉绀哄け璐�
+					uni.showToast({
+						title: '璇锋眰鎺ュ彛澶辫触'
+					})
+					// 杩斿洖閿欒娑堟伅
+					reject(err)
+					uni.hideLoading()
+					return Promise.reject(err)
+				},
+				catch: (e) => {
+					console.log(e)
+				}
+			})
+		})
+	}
+}
\ No newline at end of file

--
Gitblit v1.9.3