Просмотр исходного кода

移动端前端:代码优化

zhuangdezheng 1 год назад
Родитель
Сommit
572711a9c0

+ 1 - 1
api/base/path.js

@@ -11,7 +11,7 @@ export const path = reactive({
 	furnaceNoURL: 'http://120.46.159.163:7002',
 
 	// 内网
-	innerURL: 'http://192.168.31.36:8099',
+	innerURL: 'http://192.168.31.147:8099',
 	// innerURL: 'http://120.46.159.163:401',
 	innerUpdateAppURL: 'http://120.46.159.163:401/ezhizao-dms-production',
 	innerFurnaceNoURL: 'http://120.46.159.163:7002',

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

@@ -104,6 +104,7 @@
 			uni.request({
 				method: 'POST',
 				url: url + '/login',
+				timeout: 10000,
 				data: {
 					username: currentUser.value.userName,
 					password: currentUser.value.password
@@ -142,7 +143,8 @@
 						})
 					}
 				},
-				fail: () => {
+				fail: (err) => {
+					console.log(err)
 					uni.showToast({
 						icon: "none",
 						title: "请求异常,请联系管理员",

+ 13 - 18
pages/batchReporting/index.vue

@@ -46,7 +46,7 @@
 					<text class="label">箱号</text>
 					<text class="label right">{{ item['carrierName'] ? item['carrierName'] : '-' }}</text>
 				</view>
-				<!-- 			<view class="item-info uni-row">
+				<!-- <view class="item-info uni-row">
 					<text class="label">总工时</text>
 					<text class="label right">{{ item['totalWorkingHours']}}</text>
 				</view> -->
@@ -71,7 +71,7 @@
 						</view>)
 					</view>
 				</view>
-				<!-- 		<view class="item-info uni-row">
+				<!-- <view class="item-info uni-row">
 					<text class="label">设备</text>
 					<text class="label right">{{ curPlan['equipmentName'] }}</text>
 				</view> -->
@@ -93,23 +93,18 @@
 			</view>
 		</view>
 		<!-- 抽屉 -->
-		<view>
-			<uni-drawer ref="showRight" mode="right" :mask-click="true">
-				<view class="scroll-view">
-					<scroll-view class="scroll-view-box" scroll-y="true">
-						<view style="width: 100%;text-align: center;;font-size: 48rpx;margin: 48rpx 0 24rpx 0;">工艺列表
-						</view>
-						<view style="font-size: 24rpx;width: 100%;text-align: center;color: red;margin-bottom: 48rpx;">
-							仅显示当前工序后面工艺</view>
-						<view class="info-content" v-for="(item,index) in curProcessAfte" :key="index"
-							style="width: 100%;margin: 8rpx 0 8rpx 14%;">
-							<text>{{ index + 1 }}.{{item.processAlias}}</text>
-						</view>
-					</scroll-view>
+		<uni-drawer ref="showRight" mode="right" :mask-click="true">
+			<scroll-view scroll-y="true" style="height: 100%; background-color: #a00;" @touchmove.stop>
+				<view style="text-align: center;font-size: 48rpx;margin: 48rpx 0 24rpx 0;">工艺列表</view>
+				<view style="font-size: 24rpx;text-align: center;color: red;margin-bottom: 48rpx;">
+					仅显示当前工序后面工艺
 				</view>
-			</uni-drawer>
-		</view>
-		<!-- 		<view v-if="bottomStatus" class="bottom uni-row">
+				<view v-for="(item,index) in curProcessAfte" :key="index" style="margin: 8rpx 0 8rpx 14%;">
+					<text>{{ index + 1 }}.{{item.processAlias}}</text>
+				</view>
+			</scroll-view>
+		</uni-drawer>
+		<!-- <view v-if="bottomStatus" class="bottom uni-row">
 			<button class="start-batch-btn" type="primary" @click="handleStartNewBatch">开始新批次</button>
 		</view>
 		<view v-if="!bottomStatus" class="bottom uni-row">

+ 9 - 16
pages/index/index.vue

@@ -2,16 +2,14 @@
 	<view class="page-container uni-column">
 		<view class="uni-row" style="align-items: center;margin:8rpx 0 16rpx 0">
 			<image class="logo" src="../../static/images/logo.png" @click="handleShowGear" />
-			<uni-icons v-if="showGear > 4" class="icon-gear" type="gear-filled" size="60"
-				@click="toggle('top')"></uni-icons>
+			<uni-icons v-if="showGear > 4" class="icon-gear" type="gear-filled" size="60" @click="toggle('top')"></uni-icons>
 		</view>
 		<view class="title uni-row" v-if="loggedUsers.length > 0">
 			<text>点击头像切换用户</text>
 		</view>
 		<!-- 输入框示例 -->
 		<uni-popup ref="inputDialog" type="dialog" style="z-index: 2;">
-			<uni-popup-dialog ref="inputClose" mode="input" title="手动设置"  placeholder="请输入管理员密码"
-				@confirm="dialogInputConfirm"></uni-popup-dialog>
+			<uni-popup-dialog ref="inputClose" mode="input" title="手动设置" placeholder="请输入管理员密码" @confirm="dialogInputConfirm"></uni-popup-dialog>
 		</uni-popup>
 		<!-- 弹出层 -->
 		<uni-popup ref="popup" background-color="#fff" style="z-index: 1;">
@@ -101,6 +99,7 @@
 	const userInfo = ref({})
 	const users = ref([])
 	const nickName = ref('')
+	const useInnerUrl = ref(true)
 	const baseUrl = ref(null)
 	const showGear = ref(0)
 	const appInfo = ref({})
@@ -112,9 +111,10 @@
 	const showInputDialog = ref(0)
 
 	onLoad(() => {
+		//uni.clearStorageSync();
 		initBaseUrl();
 		// getUser();
-		setTimeout(doCheckUpdata, 500);
+		!useInnerUrl.value && setTimeout(doCheckUpdata, 500)
 	})
 
 	onReady(() => {
@@ -124,7 +124,6 @@
 	function doCheckUpdata() {
 		checkUpdate().then(res => {
 			updateFlag.value = res;
-			console.log(res)
 			if (!res) {		
 				uni.showModal({
 					title: '更新',
@@ -146,12 +145,10 @@
 				appInfo.value = res;
 			}
 		});
-		console.log(appInfo.value);
 		// false 版本号不一致,更新,true不需要更新
 		let flag = getAppInfoListByType(path.checkAppURL, {
 			type: appInfo.value.osName
 		}).then(res => {
-			console.log(res);
 			newAppInfo.value = res.rows[0];
 			if (res.rows[0]) {
 				return appInfo.value.appWgtVersion === newAppInfo.value.versionName;
@@ -164,8 +161,6 @@
 
 	function update() {
 		upgrade.downloadInstallApp(path.updateAppURL + newAppInfo.value.url);
-		console.log(newAppInfo.value)
-		console.log(path.updateAppURL + newAppInfo.value.url)
 	}
 
 	function init() {
@@ -173,7 +168,6 @@
 			success: function(res) {
 				for (let i = 0; i < res.keys.length; i++) {
 					let storagekey = res.keys[i];
-					console.log(storagekey)
 					uni.getStorage({
 						key: storagekey,
 						success: function(res) {
@@ -204,10 +198,10 @@
 
 	function initBaseUrl() {
 		let urlList = {
-			baseUrl: path.baseURL,
-			checkAppURL: path.checkAppURL,
-			updateAppURL: path.updateAppURL,
-			furnaceNoURL: path.furnaceNoURL
+			baseUrl: useInnerUrl ? path.innerURL : path.baseURL,
+			checkAppURL: useInnerUrl ? '' : path.checkAppURL,
+			updateAppURL: useInnerUrl ? path.innerUpdateAppURL : path.updateAppURL,
+			furnaceNoURL: useInnerUrl ? path.innerFurnaceNoURL : path.furnaceNoURL
 		}
 		uni.getStorage({
 			key: 'baseUrl',
@@ -313,7 +307,6 @@
 	}
 
 	const handleLongPressUser = (user) => {
-		console.log(user)
 		uni.showModal({
 			title: '提示', // 标题
 			content: '是否删除此账号', // 提示内容

+ 2 - 8
pages/productionPlan/index.vue

@@ -72,14 +72,8 @@
 
 	const listData = ref([])
 	const keywords = ref('')
-	const initReqParam = ref({})
 
 	onLoad(() => {
-		console.log(store.curDeptDetails.deptId)
-		initReqParam.value = {
-			deptId: store.curDeptDetails.deptId
-		}
-		// init(initReqParam.value);
 		// dayworkItem数据更改后刷新数据
 		// uni.$on('dayworkItemUpdate', reflush);
 	})
@@ -97,14 +91,13 @@
 	 * 监听下拉刷新
 	 */
 	// onPullDownRefresh(() => {
-	// 	init(initReqParam.value);
 	// 	setTimeout(function() {
 	// 		uni.stopPullDownRefresh();
 	// 	}, 3000);
 	// })
 
 	function reflush() {
-		init(initReqParam.value);
+		init();
 	}
 
 	function init(data) {
@@ -116,6 +109,7 @@
 			keywords:keywords.value
 		}).then(res => {
 			if(res.code == 200){
+				console.log(res)
 				listData.value = res.data;
 				uni.hideLoading();
 			}

+ 1 - 2
utils/request.js

@@ -1,8 +1,6 @@
 import { getToken } from '@/utils/auth'
 // import baseURL from '@/api/base/path.js'
 
-let timeout = 6000;
-
 function request({url, data, method="GET"}) {
 	let token = 'Bearer ' + getToken();
 	let header = {
@@ -15,6 +13,7 @@ function request({url, data, method="GET"}) {
 			data,
 			method,
 			header,
+			timeout: 10000,
 			sslVerify: false,
 			success: (res) => {
 				if (res.statusCode === 200) {