maxiaoxiao 8 сар өмнө
parent
commit
032aaff64f

+ 38 - 27
api/apis.js

@@ -1,93 +1,104 @@
-import {request} from "@/utils/request.js"
+import request from "@/utils/http.js"
 
-export function apiGetBanner(){
+// 查询监管批次数据列表
+export function listPcsj(query) {
 	return request({
-		url:"/homeBanner"		
-	})	
+		url: '/apply/supervise/pcsj/list',
+		method: 'get',
+		params: query
+	})
+}
+
+export function apiGetBanner() {
+	return request({
+		url: "/homeBanner"
+	})
 }
 
-export function apiGetDayRandom(){
-	return request({url:"/randomWall"})
+export function apiGetDayRandom() {
+	return request({
+		url: "/randomWall"
+	})
 }
 
-export function apiGetNotice(data={}){
+export function apiGetNotice(data = {}) {
 	return request({
-		url:"/wallNewsList",
+		url: "/wallNewsList",
 		data
 	})
 }
 
 
-export function apiGetClassify(data={}){
+export function apiGetClassify(data = {}) {
 	return request({
-		url:"/classify",
+		url: "/classify",
 		data
 	})
 }
 
 
 
-export function apiGetClassList(data={}){
+export function apiGetClassList(data = {}) {
 	return request({
-		url:"/wallList",
+		url: "/wallList",
 		data
 	})
 }
 
 
-export function apiGetSetupScore(data={}){
+export function apiGetSetupScore(data = {}) {
 	return request({
-		url:"/setupScore",
+		url: "/setupScore",
 		data
 	})
 }
 
 
-export function apiWriteDownload(data={}){
+export function apiWriteDownload(data = {}) {
 	return request({
-		url:"/downloadWall",
+		url: "/downloadWall",
 		data
 	})
 }
 
 
 
-export function apiDetailWall(data={}){
+export function apiDetailWall(data = {}) {
 	return request({
-		url:"/detailWall",
+		url: "/detailWall",
 		data
 	})
 }
 
 
-export function apiUserInfo(data={}){
+export function apiUserInfo(data = {}) {
 	return request({
-		url:"/userInfo",
+		url: "/userInfo",
 		data
 	})
 }
 
 
-export function apiGetHistoryList(data={}){
+export function apiGetHistoryList(data = {}) {
 	return request({
-		url:"/userWallList",
+		url: "/userWallList",
 		data
 	})
 }
 
 
 
-export function apiNoticeDetail(data={}){
+export function apiNoticeDetail(data = {}) {
 	return request({
-		url:"/wallNewsDetail",
+		url: "/wallNewsDetail",
 		data
 	})
 }
 
 
-export function apiSearchData(data={}){
+export function apiSearchData(data = {}) {
 	return request({
-		url:"/searchWall",
+		url: "/searchWall",
 		data
 	})
-}
+}

+ 5 - 1
main.uts

@@ -1,8 +1,12 @@
 import App from './App.uvue'
-
 import { createSSRApp } from 'vue'
+import Vant, { Lazyload } from 'vant'
+
+//import 'vant/lib/index.css';
 export function createApp() {
 	const app = createSSRApp(App)
+	app.use(Lazyload)
+	app.use(Vant)
 	return {
 		app
 	}

+ 4 - 1
package.json

@@ -10,7 +10,10 @@
   "author": "",
   "license": "ISC",
   "dependencies": {
+    "axios": "^0.19.2",
+    "gcoord": "^1.0.6",
+    "js-cookie": "3.0.1",
     "ol": "^10.2.1",
-    "gcoord": "^1.0.6"
+    "vant": "^4.9.7"
   }
 }

+ 17 - 4
pages.json

@@ -3,7 +3,19 @@
 		{
 			"path": "pages/index/index",
 			"style": {
-				"navigationBarTitleText": "uni-app x"
+				"navigationBarTitleText": "任务"
+			}
+		},
+		{
+			"path": "pages/check/index",
+			"style": {
+				"navigationBarTitleText": "核查"
+			}
+		},
+		{
+			"path": "pages/user/user",
+			"style": {
+				"navigationBarTitleText": "我的"
 			}
 		}
 	],
@@ -12,13 +24,14 @@
 			"selectedColor": "#28B389",
 			"list": [
 				{
-					"text": "推荐",
+					"text": "任务",
 					"pagePath": "pages/index/index",
+					 // "enableMap": true,
 					"iconPath": "static/images/tabBar/home.png",
 					"selectedIconPath": "static/images/tabBar/home-h.png"
 				},{
-					"text": "分类",
-					"pagePath": "pages/classify/classify",
+					"text": "核查",
+					"pagePath": "pages/check/index",
 					"iconPath": "static/images/tabBar/classify.png",
 					"selectedIconPath": "static/images/tabBar/classify-h.png"
 				},{

+ 0 - 0
pages/index/MapView.vue → pages/check/MapView.vue


+ 26 - 0
pages/check/index.vue

@@ -0,0 +1,26 @@
+<template>
+	<view class="">
+		<MapView></MapView>
+	</view>
+</template>
+<script>
+	import MapView from "./MapView.vue";
+	export default {
+		name: "map-view",
+		components: {
+			MapView
+		},
+		data() {
+			return {
+
+			}
+		},
+		mounted() {},
+		unmounted() {},
+		methods: {},
+
+	};
+</script>
+<style scoped>
+
+</style>

+ 49 - 21
pages/index/index.vue

@@ -1,28 +1,56 @@
 <template>
-	<view class="">
-		<MapView></MapView>
-	</view>
+  <view class="">
+    <!-- :finished="finished" -->
+    <van-list
+      v-model="loading"
+      :immediate-check="false"
+      :error.sync="error"
+      error-text="请求失败,点击重新加载"
+      finished-text="没有更多了~"
+      @load="getList"
+    >
+      <div border class="list-item" v-for="(item, key) in pcsjList" :key="key">
+        <div>{{ item.name }}</div>
+        <div class="nameTitle">{{ item.xmmc }}</div>
+        <div>下发时间:{{ item.jsdw }}</div>
+        <div>结束时间:{{ item.jsdw }}</div>
+        <div>核查图斑:{{ item.spotsnumber }}个</div>
+        <div>核查人员:{{ item.jsdw }}</div>
+      </div>
+    </van-list>
+  </view>
 </template>
 <script>
-	import MapView from "./MapView.vue";
+import { listPcsj } from "@/api/apis.js";
+export default {
+  name: "list",
+  components: {},
+  data() {
+    return {
+      queryParams: {},
+      loading: false,
+      pcsjList: [{ name: "sjcdsicjdifc" }, {}],
+      total: 0,
+    };
+  },
+  mounted() {
+    this.getList();
+  },
 
-
-	export default {
-		name: "map-view",
-		components: {
-			MapView
-		},
-		data() {
-			return {
-
-			}
-		},
-		mounted() {},
-		unmounted() {},
-		methods: {},
-
-	};
+  unmounted() {},
+  methods: {
+    getList() {
+      this.loading = true;
+      console.log("ss1ss", listPcsj(this.queryParams));
+      listPcsj(this.queryParams).then((res) => {
+        console.log(res, "00s00s");
+        this.pcsjList = res.rows;
+        this.total = res.total;
+        this.loading = false;
+      });
+    },
+  },
+};
 </script>
 <style scoped>
-
 </style>

+ 77 - 0
plugins/cache.js

@@ -0,0 +1,77 @@
+const sessionCache = {
+  set (key, value) {
+    if (!sessionStorage) {
+      return
+    }
+    if (key != null && value != null) {
+      sessionStorage.setItem(key, value)
+    }
+  },
+  get (key) {
+    if (!sessionStorage) {
+      return null
+    }
+    if (key == null) {
+      return null
+    }
+    return sessionStorage.getItem(key)
+  },
+  setJSON (key, jsonValue) {
+    if (jsonValue != null) {
+      this.set(key, JSON.stringify(jsonValue))
+    }
+  },
+  getJSON (key) {
+    const value = this.get(key)
+    if (value != null) {
+      return JSON.parse(value)
+    }
+  },
+  remove (key) {
+    sessionStorage.removeItem(key);
+  }
+}
+const localCache = {
+  set (key, value) {
+    if (!localStorage) {
+      return
+    }
+    if (key != null && value != null) {
+      localStorage.setItem(key, value)
+    }
+  },
+  get (key) {
+    if (!localStorage) {
+      return null
+    }
+    if (key == null) {
+      return null
+    }
+    return localStorage.getItem(key)
+  },
+  setJSON (key, jsonValue) {
+    if (jsonValue != null) {
+      this.set(key, JSON.stringify(jsonValue))
+    }
+  },
+  getJSON (key) {
+    const value = this.get(key)
+    if (value != null) {
+      return JSON.parse(value)
+    }
+  },
+  remove (key) {
+    localStorage.removeItem(key);
+  }
+}
+
+export default {
+  /**
+   * 会话级缓存
+   */
+  session: sessionCache,
+  /**
+   * 本地缓存
+   */
+  local: localCache
+}

+ 33 - 0
store/index.js

@@ -0,0 +1,33 @@
+import Vue from 'vue'
+import Vuex from 'vuex'
+
+Vue.use(Vuex)
+
+export default new Vuex.Store({
+  state: {
+    regionCode: '13609',
+    userInfo: {},
+    userMenus: [],
+    timeOut: false,
+    httpErro: false
+  },
+  mutations: {
+    setRegionCode(state, regionCode) {
+      state.regionCode = regionCode
+    },
+    setUserInfo(state, useInfo) {
+      state.userInfo = useInfo
+    },
+    setUserMenus(state, data) {
+      state.userMenus = data
+    },
+    setTimeOut(state, timeOut) {
+      state.timeOut = timeOut
+    },
+    setHttpErro(state, httpErro) {
+      state.httpErro = httpErro
+    }
+  },
+  actions: {},
+  modules: {}
+})

+ 23 - 6
unpackage/dist/cache/.vite/deps/_metadata.json

@@ -1,8 +1,25 @@
 {
-  "hash": "61393a65",
-  "configHash": "436e6dbf",
-  "lockfileHash": "e3b0c442",
-  "browserHash": "3f9ab3ae",
-  "optimized": {},
-  "chunks": {}
+  "hash": "9f22cad2",
+  "configHash": "44361e95",
+  "lockfileHash": "75f23bf9",
+  "browserHash": "c6495eb6",
+  "optimized": {
+    "axios": {
+      "src": "../../../../../node_modules/axios/index.js",
+      "file": "axios.js",
+      "fileHash": "d155ad97",
+      "needsInterop": true
+    },
+    "vant": {
+      "src": "../../../../../node_modules/vant/es/index.js",
+      "file": "vant.js",
+      "fileHash": "47b8b45e",
+      "needsInterop": false
+    }
+  },
+  "chunks": {
+    "chunk-LQ2VYIYD": {
+      "file": "chunk-LQ2VYIYD.js"
+    }
+  }
 }

+ 29 - 0
utils/auth.js

@@ -0,0 +1,29 @@
+import Cookies from 'js-cookie'
+
+const TokenKey = 'Admin-Token'
+
+const ExpiresInKey = 'Admin-Expires-In'
+
+export function getToken() {
+  return Cookies.get(TokenKey)
+}
+
+export function setToken(token) {
+  return Cookies.set(TokenKey, token)
+}
+
+export function removeToken() {
+  return Cookies.remove(TokenKey)
+}
+
+export function getExpiresIn() {
+  return Cookies.get(ExpiresInKey) || -1
+}
+
+export function setExpiresIn(time) {
+  return Cookies.set(ExpiresInKey, time)
+}
+
+export function removeExpiresIn() {
+  return Cookies.remove(ExpiresInKey)
+}

+ 90 - 0
utils/http.js

@@ -0,0 +1,90 @@
+import axios from 'axios'
+import store from '@/store'
+import { tansParams } from "@/utils/ruoyi";
+import cache from '@/plugins/cache'
+let downloadLoadingInstance;
+// 是否显示重新登录
+export let isRelogin = { show: false };
+
+axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
+// 创建axios实例
+const service = axios.create({
+  // axios中请求配置有baseURL选项,表示请求URL公共部分
+  baseURL: process.env.VUE_APP_BASE_API,//this.baseUrl,
+  // 超时
+  timeout: 10000
+})
+
+// 请求拦截
+service.interceptors.request.use(config => {
+  // 是否需要设置 token
+  const isToken = (config.headers || {}).isToken === false
+  // 是否需要防止数据重复提交
+  const isRepeatSubmit = (config.headers || {}).repeatSubmit === false
+  if (getToken() && !isToken) {
+    config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
+  }
+  // get请求映射params参数
+  if (config.method === 'get' && config.params) {
+    let url = config.url + '?' + tansParams(config.params);
+    url = url.slice(0, -1);
+    config.params = {};
+    config.url = url;
+  }
+  if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put')) {
+    const requestObj = {
+      url: config.url,
+      data: typeof config.data === 'object' ? JSON.stringify(config.data) : config.data,
+      time: new Date().getTime()
+    }
+    const requestSize = Object.keys(JSON.stringify(requestObj)).length; // 请求数据大小
+    const limitSize = 5 * 1024 * 1024; // 限制存放数据5M
+    if (requestSize >= limitSize) {
+      console.warn(`[${config.url}]: ` + '请求数据大小超出允许的5M限制,无法进行防重复提交验证。')
+      return config;
+    }
+    const sessionObj = cache.session.getJSON('sessionObj')
+    if (sessionObj === undefined || sessionObj === null || sessionObj === '') {
+      cache.session.setJSON('sessionObj', requestObj)
+    } else {
+      const s_url = sessionObj.url;                  // 请求地址
+      const s_data = sessionObj.data;                // 请求数据
+      const s_time = sessionObj.time;                // 请求时间
+      const interval = 1000;                         // 间隔时间(ms),小于此时间视为重复提交
+      if (s_data === requestObj.data && requestObj.time - s_time < interval && s_url === requestObj.url) {
+        const message = '数据正在处理,请勿重复提交';
+        console.warn(`[${s_url}]: ` + message)
+        return Promise.reject(new Error(message))
+      } else {
+        cache.session.setJSON('sessionObj', requestObj)
+      }
+    }
+  }
+  return config
+}, error => {
+  return Promise.reject(error)
+}
+)
+// 响应拦截
+service.interceptors.response.use(res => {
+  // this.destroy()
+  const { data, status } = res
+  if (Number(data.status) === 1001) {
+    store.commit('setTimeOut', true)
+    localStorage.setItem('token', '') // 清空token
+    return
+  }
+
+  return {
+    data,
+    status
+  }
+},
+  error => {
+    store.commit('setHttpErro', true)
+    return Promise.reject(error)
+  }
+)
+
+
+export default service

+ 233 - 0
utils/ruoyi.js

@@ -0,0 +1,233 @@
+
+
+/**
+ * 通用js方法封装处理
+ * Copyright (c) 2019 ruoyi
+ */
+
+// 日期格式化
+export function parseTime(time, pattern) {
+  if (arguments.length === 0 || !time) {
+    return null
+  }
+  const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}'
+  let date
+  if (typeof time === 'object') {
+    date = time
+  } else {
+    if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
+      time = parseInt(time)
+    } else if (typeof time === 'string') {
+      time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.[\d]{3}/gm), '');
+    }
+    if ((typeof time === 'number') && (time.toString().length === 10)) {
+      time = time * 1000
+    }
+    date = new Date(time)
+  }
+  const formatObj = {
+    y: date.getFullYear(),
+    m: date.getMonth() + 1,
+    d: date.getDate(),
+    h: date.getHours(),
+    i: date.getMinutes(),
+    s: date.getSeconds(),
+    a: date.getDay()
+  }
+  const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
+    let value = formatObj[key]
+    // Note: getDay() returns 0 on Sunday
+    if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value] }
+    if (result.length > 0 && value < 10) {
+      value = '0' + value
+    }
+    return value || 0
+  })
+  return time_str
+}
+
+// 表单重置
+export function resetForm(refName) {
+  if (this.$refs[refName]) {
+    this.$refs[refName].resetFields();
+  }
+}
+
+// 添加日期范围
+export function addDateRange(params, dateRange, propName) {
+  let search = params;
+  search.params = typeof (search.params) === 'object' && search.params !== null && !Array.isArray(search.params) ? search.params : {};
+  dateRange = Array.isArray(dateRange) ? dateRange : [];
+  if (typeof (propName) === 'undefined') {
+    search.params['beginTime'] = dateRange[0];
+    search.params['endTime'] = dateRange[1];
+  } else {
+    search.params['begin' + propName] = dateRange[0];
+    search.params['end' + propName] = dateRange[1];
+  }
+  return search;
+}
+
+// 回显数据字典
+export function selectDictLabel(datas, value) {
+  if (value === undefined) {
+    return "";
+  }
+  var actions = [];
+  Object.keys(datas).some((key) => {
+    if (datas[key].value == ('' + value)) {
+      actions.push(datas[key].label);
+      return true;
+    }
+  })
+  if (actions.length === 0) {
+    actions.push(value);
+  }
+  return actions.join('');
+}
+
+// 回显数据字典(字符串、数组)
+export function selectDictLabels(datas, value, separator) {
+  if (value === undefined || value.length ===0) {
+    return "";
+  }
+  if (Array.isArray(value)) {
+    value = value.join(",");
+  }
+  var actions = [];
+  var currentSeparator = undefined === separator ? "," : separator;
+  var temp = value.split(currentSeparator);
+  Object.keys(value.split(currentSeparator)).some((val) => {
+    var match = false;
+    Object.keys(datas).some((key) => {
+      if (datas[key].value == ('' + temp[val])) {
+        actions.push(datas[key].label + currentSeparator);
+        match = true;
+      }
+    })
+    if (!match) {
+      actions.push(temp[val] + currentSeparator);
+    }
+  })
+  return actions.join('').substring(0, actions.join('').length - 1);
+}
+
+// 字符串格式化(%s )
+export function sprintf(str) {
+  var args = arguments, flag = true, i = 1;
+  str = str.replace(/%s/g, function () {
+    var arg = args[i++];
+    if (typeof arg === 'undefined') {
+      flag = false;
+      return '';
+    }
+    return arg;
+  });
+  return flag ? str : '';
+}
+
+// 转换字符串,undefined,null等转化为""
+export function parseStrEmpty(str) {
+  if (!str || str == "undefined" || str == "null") {
+    return "";
+  }
+  return str;
+}
+
+// 数据合并
+export function mergeRecursive(source, target) {
+  for (var p in target) {
+    try {
+      if (target[p].constructor == Object) {
+        source[p] = mergeRecursive(source[p], target[p]);
+      } else {
+        source[p] = target[p];
+      }
+    } catch (e) {
+      source[p] = target[p];
+    }
+  }
+  return source;
+};
+
+/**
+ * 构造树型结构数据
+ * @param {*} data 数据源
+ * @param {*} id id字段 默认 'id'
+ * @param {*} parentId 父节点字段 默认 'parentId'
+ * @param {*} children 孩子节点字段 默认 'children'
+ */
+export function handleTree(data, id, parentId, children) {
+  let config = {
+    id: id || 'id',
+    parentId: parentId || 'parentId',
+    childrenList: children || 'children'
+  };
+
+  var childrenListMap = {};
+  var nodeIds = {};
+  var tree = [];
+
+  for (let d of data) {
+    let parentId = d[config.parentId];
+    if (childrenListMap[parentId] == null) {
+      childrenListMap[parentId] = [];
+    }
+    nodeIds[d[config.id]] = d;
+    childrenListMap[parentId].push(d);
+  }
+
+  for (let d of data) {
+    let parentId = d[config.parentId];
+    if (nodeIds[parentId] == null) {
+      tree.push(d);
+    }
+  }
+
+  for (let t of tree) {
+    adaptToChildrenList(t);
+  }
+
+  function adaptToChildrenList(o) {
+    if (childrenListMap[o[config.id]] !== null) {
+      o[config.childrenList] = childrenListMap[o[config.id]];
+    }
+    if (o[config.childrenList]) {
+      for (let c of o[config.childrenList]) {
+        adaptToChildrenList(c);
+      }
+    }
+  }
+  return tree;
+}
+
+/**
+* 参数处理
+* @param {*} params  参数
+*/
+export function tansParams(params) {
+  let result = ''
+  for (const propName of Object.keys(params)) {
+    const value = params[propName];
+    var part = encodeURIComponent(propName) + "=";
+    if (value !== null && value !== "" && typeof (value) !== "undefined") {
+      if (typeof value === 'object') {
+        for (const key of Object.keys(value)) {
+          if (value[key] !== null && value[key] !== "" && typeof (value[key]) !== 'undefined') {
+            let params = propName + '[' + key + ']';
+            var subPart = encodeURIComponent(params) + "=";
+            result += subPart + encodeURIComponent(value[key]) + "&";
+          }
+        }
+      } else {
+        result += part + encodeURIComponent(value) + "&";
+      }
+    }
+  }
+  return result
+}
+
+// 验证是否为blob格式
+export function blobValidate(data) {
+  return data.type !== 'application/json'
+}