Jelajahi Sumber

奉建路的

ZaiZai 2 tahun lalu
induk
melakukan
bc2c8f2280

+ 94 - 98
common/request.js

@@ -1,119 +1,115 @@
 import http from './request/interface.js'
+
 var config = require("../core/api.js")
 /**
  * 将业务所有接口统一起来便于维护
  * 如果项目很大可以将 url 独立成文件,接口分成不同的模块
- * 
+ *
  */
 
 
 export const getDomain = () => {
-	//#ifdef H5
-	var url = window.location.href;
-	if (url.indexOf('localhost') != -1 || url.indexOf('127.0.0.1') != -1 || url.indexOf("192.168.0") != -1 || true) {
-		config.api = "/api";
-		/* console.log("跨域的:"+config.api) */
-	}
-	//#endif
+    //#ifdef H5
+    var url = window.location.href;
+    if (url.indexOf('localhost') != -1 || url.indexOf('127.0.0.1') != -1 || url.indexOf("192.168.0") != -1 || true) {
+        config.api = "/api";
+        /* console.log("跨域的:"+config.api) */
+    }
+    //#endif
 }
 
 
-
 // 单独导出()
-export const request = (url, data,head,type) => {
-	const _this = this;
-	if(!type){
-		uni.showLoading({
-			title: '加载中'
-		});
-	}
-	
-/* 	console.log("============================data:" + JSON.stringify(data));
-	console.log("============================访问url:" + url) */
-	
-	http.config.baseUrl = config.api;
-	//设置请求前拦截器 ,每次请求都要携带token,并设置请求的类型
-	var token =uni.getStorageSync("token");
-	//var storeName =uni.getStorageSync("storeName");
-	http.interceptor.request = (config) => {
-		if(head){
-			config.header = {
-				'Content-Type':'application/json;charset=UTF-8',
-				"Authorization": token,
-				//"StoreName": storeName,
-			}
-		}else{
-			config.header = { 
-				'Content-Type':'application/x-www-form-urlencoded',
-				"Authorization": token,
-				//"StoreName": storeName,
-			}
-		}
-	}
-	
-	//设置请求结束后拦截器
-	http.interceptor.response = (response) => {
-		uni.hideLoading();
-		try {
-				 //console.log('个性化拦截response....' + JSON.stringify(response.data))
-				 if ( response.statusCode != null && response.statusCode != 200) {
-					 if(response.statusCode==401){//登录失效,点击跳转到登录页面
-						 return new Promise((resolve,reject)=>{
-						 	uni.showModal({
-						 		title: '提示',
-						 		content: response.data,
-								success:function(res){
-									uni.reLaunch({
-										url:"/pages/user/login/login"
-									});
-								    uni.hideLoading();
-								}
-						 	});	
-						 });
-					 }else{
-						 return new Promise((resolve,reject)=>{
-						 	uni.showModal({
-						 		title: '提示',
-						 		content: response.data ? response.data : "500",
-						 		complete() {
-						 			reject('向外层抛出错误')
-						 		}
-						 	});	
-						 });
-					 }
-				} else {
-					return response.data
-				}	
-		   }
-		 catch(err)
-		   {
-			   console.log('访问服务器错误');
-			   console.log(err);
-			   return new Promise((resolve,reject)=>{
-			   	uni.showModal({
-			   		title: '提示',
-			   		content:  err.toString(),
-			   		complete() {
-			   			reject('向外层抛出错误,用catch捕获')
-			   		}
-			   	});
-			   });
-		   }
-	}
-	var res = http.request({
-		url: url,
-		method: "POST",
-		data: data,
-	});
-	return res
-}
+export const request = (url, data, head, type) => {
+    const _this = this;
+    if (!type) {
+        uni.showLoading({
+            title: '加载中'
+        });
+    }
 
+    /* 	console.log("============================data:" + JSON.stringify(data));
+        console.log("============================访问url:" + url) */
+
+    http.config.baseUrl = config.api;
+    //设置请求前拦截器 ,每次请求都要携带token,并设置请求的类型
+    var token = uni.getStorageSync("token");
+    //var storeName =uni.getStorageSync("storeName");
+    http.interceptor.request = (config) => {
+        if (head) {
+            config.header = {
+                'Content-Type': 'application/json;charset=UTF-8',
+                "Authorization": token,
+                //"StoreName": storeName,
+            }
+        } else {
+            config.header = {
+                'Content-Type': 'application/x-www-form-urlencoded',
+                "Authorization": token,
+                //"StoreName": storeName,
+            }
+        }
+    }
+
+    //设置请求结束后拦截器
+    http.interceptor.response = (response) => {
+        uni.hideLoading();
+        try {
+            //console.log('个性化拦截response....' + JSON.stringify(response.data))
+            if (response.statusCode != null && response.statusCode != 200) {
+                if (response.statusCode == 401) {//登录失效,点击跳转到登录页面
+                    return new Promise((resolve, reject) => {
+                        uni.showModal({
+                            title: '提示',
+                            content: response.data,
+                            success: function (res) {
+                                uni.reLaunch({
+                                    url: "/pages/user/login/login"
+                                });
+                                uni.hideLoading();
+                            }
+                        });
+                    });
+                } else {
+                    return new Promise((resolve, reject) => {
+                        uni.showModal({
+                            title: '提示',
+                            content: response.data ? response.data : "500",
+                            complete() {
+                                reject('向外层抛出错误')
+                            }
+                        });
+                    });
+                }
+            } else {
+                return response.data
+            }
+        } catch (err) {
+            console.log('访问服务器错误');
+            console.log(err);
+            return new Promise((resolve, reject) => {
+                uni.showModal({
+                    title: '提示',
+                    content: err.toString(),
+                    complete() {
+                        reject('向外层抛出错误,用catch捕获')
+                    }
+                });
+            });
+        }
+    }
+    return http.request({
+        url: url,
+        method: 'POST',
+        data: data,
+    })
+}
 
 
 // 默认全部导出  import api from '@/common/vmeitime-http/'
 export default {
-	request,
-	getDomain,
+    request,
+    getDomain,
 }
 
 

+ 13 - 10
pages/qualityInspection_fj/qualityInspection.vue

@@ -13,7 +13,7 @@
                 <uni-datetime-picker class="action-date-picker" v-model="pickerRange" type="daterange" @change="searchDateChange"/>
             </view>
             <view class="action">
-                <button class="cu-btn bg-white">搜索</button>
+                <button class="cu-btn bg-white" @click="searchClick">搜索</button>
             </view>
         </view>
         <!--列表-->
@@ -117,9 +117,7 @@ export default {
         this.userid = id;
     },
     onShow() {
-        this.resetPage();
-        this.getList();
-        this.getListNums();
+        this.searchClick();
     },
     methods: {
         searchDateChange(val) {
@@ -136,6 +134,10 @@ export default {
             this.totalPage = 999;
             this.taskList = [];
         },
+        searchClick() {
+            this.resetPage();
+            this.getList();
+        },
         getList() {
             if(this.page >= this.totalPage){
                 return;
@@ -153,19 +155,20 @@ export default {
                     this.totalPage = json.totalPage;
                 }
             })
-        },
-        getListNums(){
-
         },
         //查看详情
-        itemInfoTap(item) {
+        itemInfoTap({id}) {
             uni.navigateTo({
-                url: '/pages/qualityInspection_fj/qualityInfo'
+                url: '/pages/qualityInspection_fj/qualityInfo?id=' + id
             })
         },
         //撤回
         revocationTap() {
-
+            /**
+             * 2、办结、复核,撤回操作 依次对应1  2  3
+             * POST:/app/qualityModifyInfo/updateStatus
+             * 入参:WEB端一样
+             */
         },
         //新增记录
         newRecordTap() {

+ 1 - 1
pages/qualityInspection_fj/tree.vue

@@ -100,7 +100,7 @@
 		methods: {
 			findDataProgress() {
 				var that = this;
-				that.http.request('/divideClient/getDataByparantId', {
+				that.http.request('/app/qualityModifyInfo/getDataByparantId', {
                     type: 0,
                     id: ''
 				}).then((result) => {