Browse Source

Merge remote-tracking branch 'origin/master'

Hwf 5 ngày trước cách đây
mục cha
commit
01d35d220a

+ 1 - 1
.env.development

@@ -12,7 +12,7 @@ VITE_BASE_DOWNLOAD_API = '/file/download/'
 #VITE_BASE_API = 'http://127.0.0.1:9988'
 
 # 开发环境启用 cdn eruda 调试工具。若不启用,将 true 修改为 false 或其他任意值即可
-VITE_ENABLE_ERUDA = "false"
+VITE_ENABLE_ERUDA = "true"
 
 # 线上环境平台打包路径
 VITE_PUBLIC_PATH = /yjxp/

+ 2 - 0
.env.production

@@ -10,6 +10,8 @@ VITE_APP_BASE_API2 = '/'
 VITE_BASE_API = ""
 VITE_BASE_DOWNLOAD_API = '/file/download/'
 
+VITE_ENABLE_ERUDA = "false"
+
 # 线上环境平台打包路径
 VITE_PUBLIC_PATH = "/yjxp/"
 

+ 2 - 2
index.html

@@ -8,7 +8,7 @@
       content="width=device-width,initial-scale=1.0,user-scalable=no"
     />
     <link rel="icon" href="/favicon.ico" />
-    <script src="/h5player.min.js"></script>
+    <script src="/static/h5player.min.js"></script>
     <!-- script src="/static/szca_crypto.js"></script -->
     <!-- script src="/static/szca_base64.js"></script -->
     <title>应急工作台移动端</title>
@@ -55,7 +55,7 @@
     </div>
     <script type="module" src="/src/main.ts"></script>
     <% if (ENABLE_ERUDA === "true") { %>
-    <script src="//cdn.jsdelivr.net/npm/eruda"></script>
+    <script src="/static/eruda.js"></script>
     <script>
       eruda.init();
     </script>

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 7 - 0
public/static/eruda.js


+ 0 - 0
public/h5player.min.js → public/static/h5player.min.js


+ 1 - 1
src/components/YzyCallback/index.vue

@@ -20,7 +20,7 @@ const do_callback = () => {
   callback({code, state}).then((res)=>{
       loading.value = false;
       var access_token = res.data.access_token;
-      var redirect_url = res.data.redirect_url;
+      var redirect_url = sessionStorage.getItem(state) || "/";
       setToken(access_token);
       
       console.log('redirect_url:', redirect_url);

+ 6 - 9
src/permission.ts

@@ -68,18 +68,15 @@ router.beforeEach(async (to, from, next) => {
         next(`/mplogin?redirect=${redirect}`); // 否则全部重定向到登录页
         NProgress.done();
       }
-      /*
       else if (/(wxworklocal)/i.test(navigator.userAgent)) {
-        let state_json = {
-          "redirect_url": to.fullPath || '/',
-          "rnd": Math.floor(Math.random() * 1000000)
-        };
-        const state = JSON.stringify(state_json);
-        let redirect_uri = encodeURIComponent(window.location.protocol + "//" + window.location.host + "/yjxp/#/yzy/callback")
-        let next_url = `https://open.weixin.qq.com/connect/Oauth2/authorize?appid=wld341060039&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_base&agentid=1004302&state=${state}#wechat_redirect`;
+
+        const rnd = Math.floor(Math.random() * 900000) + 100000;
+        const state = `F${rnd}`;
+        const redirect_uri = encodeURIComponent(window.location.protocol + "//" + window.location.host + "/api/yzy/callback.html")
+        let next_url = `https://open.weixin.qq.com/connect/Oauth2/authorize?appid=wl2bee594e73&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_base&agentid=1004000&state=${state}#wechat_redirect`;
+        sessionStorage.setItem(state, to.fullPath || '/');
         window.location.href = next_url; // 粤政易自动登录
       }
-      */
       else {
         const redirect = encodeURIComponent(to.fullPath || '/');
         next(`/login?redirect=${redirect}`); // 否则全部重定向到登录页

+ 21 - 18
src/views/index.vue

@@ -13,7 +13,6 @@
 
 <script lang="ts" setup>
 import {useRoute, useRouter} from "vue-router";
-import { setToken } from '@/utils/auth';
 import useUserStore from "@/store/modules/user";
 import {getInfo} from "@/api/login"
 import {onMounted, nextTick, ref} from "vue";
@@ -32,15 +31,11 @@ const handleJump = (path: string, role: string) => {
 
 onMounted(() => {
   console.log('env:', env);
-  // if(env === 'development') 
-  {
-    // setToken('eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxIiwiZXhwIjoyMDM5Njk2ODMzfQ.Rhd38oo_S1odjg0xnT4n31cCWCAAPXGb8y_V2XcgqzQ')
-    nextTick(()=>{
-      setTimeout(()=> {
-        getUserInfo();
-      }, 100);
-    })
-  }
+  nextTick(()=>{
+    setTimeout(()=> {
+      getUserInfo();
+    }, 100);
+  })
 })
 
 const getUserInfo = () => {
@@ -61,17 +56,25 @@ const getUserInfo = () => {
     if(role_is_leader.value && !role_is_worker.value) {
       handleJump('LeaderIndex', 'leader');
     }
-    if(!role_is_leader.value && role_is_worker.value) {
+    else if(!role_is_leader.value && role_is_worker.value) {
       handleJump('WorkerIndex', 'worker');
     }
-    /*
-    let redirect_url = decodeURIComponent(route.query.redirect_url as string || "");
-    console.log('redirect_url:', redirect_url);
-    if(redirect_url != "") {
-      useUser.setRoles("worker");
-      router.replace(redirect_url);
+    else {
+      let redirect_url = decodeURIComponent(route.query.redirect_url as string || "");
+      console.log('redirect_url:', redirect_url);
+      if(redirect_url != "") {
+        if(roles.includes("superadmin")) {
+          useUser.setRoles("leader");
+        }
+        if(roles.includes("super_ld")) {
+          useUser.setRoles("leader");
+        }
+        if(roles.includes("super_worker")) {
+          useUser.setRoles("worker");
+        }
+        router.replace(redirect_url);
+      }
     }
-    */
   })
 }
 </script>

+ 93 - 70
src/views/mobileControl/MaterialManage.vue

@@ -1,28 +1,37 @@
 <template>
-  <van-floating-panel v-model:height="height" :anchors="anchors" :content-draggable="false">
+  <van-floating-panel
+    v-model:height="height"
+    :anchors="anchors"
+    :content-draggable="false"
+  >
     <van-tabs v-model:active="active">
       <van-tab title="救援队伍">
         <van-search
-            v-model="queryParams1.query.keyword"
-            class="common-search"
-            :left-icon="searchImg"
-            :right-icon="closeImg"
-            :clearable="false"
-            placeholder="请输入搜索内容"
-            @search="onSearchKeyword1"
-            @click-right-icon.stop="onSearchCancel1"
+          v-model="queryParams1.query.keyword"
+          class="common-search"
+          :left-icon="searchImg"
+          :right-icon="closeImg"
+          :clearable="false"
+          placeholder="请输入搜索内容"
+          @search="onSearchKeyword1"
+          @click-right-icon.stop="onSearchCancel1"
         />
         <van-list
-            v-model:loading="loading1"
-            v-model:error="error1"
-            error-text="请求失败,点击重新加载"
-            :finished="finished1"
-            finished-text="没有更多了"
-            :immediate-check="false"
-            class="list"
-            @load="getList"
+          v-model:loading="loading1"
+          v-model:error="error1"
+          error-text="请求失败,点击重新加载"
+          :finished="finished1"
+          finished-text="没有更多了"
+          :immediate-check="false"
+          class="list"
+          @load="getList"
         >
-          <div v-for="(item, index) in dataList1" :key="index" :class="!!item.checked  ? 'item item-active' : 'item'" @click="handleClickItem(item)">
+          <div
+            v-for="(item, index) in dataList1"
+            :key="index"
+            :class="!!item.checked ? 'item item-active' : 'item'"
+            @click="handleClickItem(item)"
+          >
             <div class="text-box">
               <div class="text1">{{ item.name }}</div>
               <div class="text2">{{ item.address }}</div>
@@ -33,26 +42,31 @@
       </van-tab>
       <van-tab title="应急物资">
         <van-search
-            v-model="queryParams2.query.keyword"
-            class="common-search"
-            :left-icon="searchImg"
-            :right-icon="closeImg"
-            :clearable="false"
-            placeholder="请输入搜索内容"
-            @search="onSearchKeyword2"
-            @click-right-icon.stop="onSearchCancel2"
+          v-model="queryParams2.query.keyword"
+          class="common-search"
+          :left-icon="searchImg"
+          :right-icon="closeImg"
+          :clearable="false"
+          placeholder="请输入搜索内容"
+          @search="onSearchKeyword2"
+          @click-right-icon.stop="onSearchCancel2"
         />
         <van-list
-            v-model:loading="loading2"
-            v-model:error="error2"
-            error-text="请求失败,点击重新加载"
-            :finished="finished2"
-            finished-text="没有更多了"
-            :immediate-check="false"
-            class="list"
-            @load="getList2"
+          v-model:loading="loading2"
+          v-model:error="error2"
+          error-text="请求失败,点击重新加载"
+          :finished="finished2"
+          finished-text="没有更多了"
+          :immediate-check="false"
+          class="list"
+          @load="getList2"
         >
-          <div v-for="(item, index) in dataList2" :key="index" :class="!!item.checked  ? 'item item-active' : 'item'" @click="handleClickItem(item)">
+          <div
+            v-for="(item, index) in dataList2"
+            :key="index"
+            :class="!!item.checked ? 'item item-active' : 'item'"
+            @click="handleClickItem(item)"
+          >
             <div class="text-box">
               <div class="text1">{{ item.name }}</div>
               <div class="text2">{{ item.address }}</div>
@@ -66,33 +80,41 @@
 </template>
 
 <script lang="ts" setup name="MaterialManage">
-import {computed, inject, onMounted, reactive, ref} from "vue";
+import { computed, inject, onMounted, reactive, ref } from "vue";
 import searchImg from "@/assets/images/search.png";
 import closeImg from "@/assets/images/close.png";
-import {getRescueMateriaWarehouseList, getRescueUnitsList} from "@/api/globalMap";
-import {getImageUrl} from "@/components/Map/mapData";
+import {
+  getRescueMateriaWarehouseList,
+  getRescueUnitsList
+} from "@/api/globalMap";
+import { getImageUrl } from "@/components/Map/mapData";
 
-const emits = defineEmits(['update:modelValue']);
+const emits = defineEmits(["update:modelValue"]);
 const props = defineProps({
   modelValue: Number
 });
 const height = computed({
   get() {
-    return props.modelValue
+    return props.modelValue;
   },
   set(newValue) {
-    emits('update:modelValue', newValue);
+    emits("update:modelValue", newValue);
   }
 });
-const getMapUtils = inject('getMapUtils');
-const anchors = ref([0, 300, window.innerHeight * 0.6, window.innerHeight * 0.95]);
+const getMapUtils = inject("getMapUtils");
+const anchors = ref([
+  0,
+  300,
+  window.innerHeight * 0.6,
+  window.innerHeight * 0.95
+]);
 let markers = ref([]);
-let active = ref('1');
+let active = ref("1");
 const queryParams1 = reactive({
   current: 0,
   size: 15,
   query: {
-    keyword: ''
+    keyword: ""
   }
 });
 const total1 = ref(0);
@@ -100,25 +122,26 @@ let loading1 = ref(false);
 let error1 = ref(false);
 let finished1 = ref(false);
 let dataList1 = ref([]);
-const onSearchKeyword1 = (val) => {
+const onSearchKeyword1 = val => {
   queryParams1.query.keyword = val;
   queryParams1.current = 0;
   getList();
 };
 const onSearchCancel1 = () => {
-  queryParams1.query.keyword = '';
+  queryParams1.query.keyword = "";
   queryParams1.current = 0;
   getList();
-}
+};
 const getList = () => {
   queryParams1.current++;
+  loading1.value = false;
   getRescueUnitsList(queryParams1).then((res: any) => {
     const items = res.rows || [];
     total1.value = res.total;
     if (queryParams1.current == 1) {
       dataList1.value = [];
     }
-    items.forEach((val) => {
+    items.forEach(val => {
       dataList1.value.push(val);
     });
     if (queryParams1.size * queryParams1.current >= total1.value) {
@@ -126,14 +149,14 @@ const getList = () => {
     } else {
       finished1.value = false;
     }
-  })
+  });
 };
 
 const queryParams2 = reactive({
   current: 0,
   size: 15,
   query: {
-    keyword: ''
+    keyword: ""
   }
 });
 const total2 = ref(0);
@@ -141,25 +164,26 @@ let loading2 = ref(false);
 let error2 = ref(false);
 let finished2 = ref(false);
 let dataList2 = ref([]);
-const onSearchKeyword2 = (val) => {
+const onSearchKeyword2 = val => {
   queryParams2.query.keyword = val;
   queryParams2.current = 0;
   getList2();
 };
 const onSearchCancel2 = () => {
-  queryParams2.query.keyword = '';
+  queryParams2.query.keyword = "";
   queryParams2.current = 0;
   getList2();
-}
+};
 const getList2 = () => {
   queryParams2.current++;
+  loading2.value = false;
   getRescueMateriaWarehouseList(queryParams2).then((res: any) => {
     const items = res.rows || [];
     total2.value = res.total;
     if (queryParams2.current == 1) {
       dataList2.value = [];
     }
-    items.forEach((val) => {
+    items.forEach(val => {
       dataList2.value.push(val);
     });
     if (queryParams2.size * queryParams2.current >= total2.value) {
@@ -167,16 +191,16 @@ const getList2 = () => {
     } else {
       finished2.value = false;
     }
-  })
-}
-const handleClickItem = (item) => {
+  });
+};
+const handleClickItem = item => {
   item.checked = !item.checked;
   let points = [];
-  const dotIcon1 = getImageUrl('common.png');
-  const dotIcon2 = getImageUrl('common_hover.png');
-  const dotIcon3 = getImageUrl('28_emergencytransportresources.png');
-  const dotIcon4 = getImageUrl('28_emergencytransportresources_hover.png');
-  dataList1.value.forEach((item2) => {
+  const dotIcon1 = getImageUrl("common.png");
+  const dotIcon2 = getImageUrl("common_hover.png");
+  const dotIcon3 = getImageUrl("28_emergencytransportresources.png");
+  const dotIcon4 = getImageUrl("28_emergencytransportresources_hover.png");
+  dataList1.value.forEach(item2 => {
     if (!!item2.checked) {
       points.push({
         icon: dotIcon1,
@@ -188,8 +212,8 @@ const handleClickItem = (item) => {
         latitude: item2.latitude
       });
     }
-  })
-  dataList2.value.forEach((item2) => {
+  });
+  dataList2.value.forEach(item2 => {
     if (!!item2.checked) {
       points.push({
         icon: dotIcon3,
@@ -201,13 +225,13 @@ const handleClickItem = (item) => {
         latitude: item2.latitude
       });
     }
-  })
+  });
   getMapUtils().addMarker(points);
-}
+};
 onMounted(() => {
   getList();
   getList2();
-})
+});
 </script>
 
 <style lang="scss" scoped>
@@ -235,7 +259,7 @@ onMounted(() => {
       display: inline-block;
       width: 20px;
       height: 20px;
-      background: url('@/assets/images/map/position1.png') no-repeat;
+      background: url("@/assets/images/map/position1.png") no-repeat;
       background-size: 100% 100%;
     }
   }
@@ -244,5 +268,4 @@ onMounted(() => {
     border: 1px solid #cef0f5;
   }
 }
-
 </style>

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác