mao 1 år sedan
förälder
incheckning
f063f1511a
3 ändrade filer med 25 tillägg och 9 borttagningar
  1. 2 2
      api/base/path.js
  2. 2 1
      components/dialog-login/dialog-login.vue
  3. 21 6
      pages/index/index.vue

+ 2 - 2
api/base/path.js

@@ -1,10 +1,10 @@
-// const baseURL = 'http://192.168.31.216:8099'
+// const baseURL = 'http://120.46.159.163:7004'
 
 const baseURL = function() {
 	let path = '';
 	try {
 		const value = uni.getStorageSync('baseUrl');
-		path = value ? value : 'http://192.168.31.8:8099';
+		path = value ? value : 'http://120.46.159.163:7004';
 		console.log(value)
 	} catch (e) {
 		// error

+ 2 - 1
components/dialog-login/dialog-login.vue

@@ -35,6 +35,7 @@
 	import {
 		store
 	} from '@/store/index.js'
+import request from '../../utils/request'
 	// 对话框
 	const baseDialog = ref(null)
 	const currentUser = ref({})
@@ -69,10 +70,10 @@
 				uni.showLoading({
 					title: '加载中'
 				});
+				loginRequest(URL.value);	
 				setTimeout(function() {
 					uni.hideLoading();
 				}, 3000)
-				loginRequest(URL.value);	
 			},
 			fail: function() {
 				uni.showLoading({

+ 21 - 6
pages/index/index.vue

@@ -71,6 +71,9 @@
 					uni.getStorage({
 						key: storagekey,
 						success: function(res) {
+							if (storagekey === 'baseUrl') {
+								baseUrl.value = res.data;
+							}
 							if (storagekey !== 'token' && storagekey !== '__DC_STAT_UUID' &&
 								storagekey !== 'baseUrl') {
 								getNickNameByUserName(storagekey).then((response) => {
@@ -83,9 +86,6 @@
 									}
 								})
 							}
-							if(storagekey === 'baseUrl'){
-								baseUrl.value = res.data;
-							}
 						}
 					});
 				}
@@ -110,8 +110,13 @@
 						icon: "success",
 						title: "设置成功"
 					})
-				}
+				},
 			});
+			// 刷新当前页面重新加载一下()
+			// uni.navigateBack({
+			// 	delta: 1
+			// })
+			refresh();
 			showInput.value = !showInput.value;
 		} else {
 			uni.showToast({
@@ -121,6 +126,16 @@
 		}
 	}
 
+	function refresh() {
+		// 刷新当前页面
+		var pages = getCurrentPages(); //获取所有页面的数组对象
+		var currPage = pages[pages.length - 1]; //当前页面
+		uni.reLaunch({
+			url: currPage.$page.fullPath
+		})
+	}
+
+
 	const handleShowLoginDialog = (user) => {
 		let _user = user ?? {}
 		// 调用子组件中的方法
@@ -178,13 +193,13 @@
 	.page-container {
 		overflow: auto;
 	}
-	
+
 	.logo {
 		width: 120rpx;
 		height: 120rpx;
 		margin: 0 auto;
 	}
-	
+
 	.title {
 		height: 80rpx;
 		justify-content: center;