Эх сурвалжийг харах

登录token功能,场所检查情况上报(未完成)

yin_yu820 2 жил өмнө
parent
commit
30c35212c2

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 10599 - 1
package-lock.json


+ 1 - 0
package.json

@@ -11,6 +11,7 @@
     "axios": "^1.3.4",
     "core-js": "^3.8.3",
     "normalize.css": "^8.0.1",
+    "qs": "^6.11.1",
     "vant": "^4.1.0",
     "vue": "^3.2.13",
     "vue-router": "^4.0.3",

+ 1 - 1
public/index.html

@@ -8,7 +8,7 @@
     <title><%= htmlWebpackPlugin.options.title %></title>
 
     <!--小程序SDK 只有在小程序容器中才能加载到 -->
-	  <script src="shinemosdk://20000/index.js"></script>
+	  <!-- <script src="shinemosdk://20000/index.js"></script> -->
   </head>
   <body>
     <noscript>

+ 3 - 3
src/App.vue

@@ -1,9 +1,9 @@
 <template>
 	<router-view></router-view>
 	<van-tabbar v-model="active" route  v-show="showStatus" >
-        <van-tabbar-item replace to="/toBeDone" name="toBeDone" icon="notes-o">我的待办</van-tabbar-item>
-        <van-tabbar-item replace to="/siteMan" name="siteMan" icon="shop-o">场所管理</van-tabbar-item>
-        <van-tabbar-item replace to="/activityMan" name="activityMan" icon="newspaper-o">活动管理</van-tabbar-item>
+        <van-tabbar-item replace to="/setting" name="toBeDone" icon="notes-o">我的待办</van-tabbar-item>
+        <van-tabbar-item replace to="/setting" name="siteMan" icon="shop-o">场所管理</van-tabbar-item>
+        <van-tabbar-item replace to="/setting" name="activityMan" icon="newspaper-o">活动管理</van-tabbar-item>
         <van-tabbar-item replace to="/setting" name="setting" icon="friends-o">个人中心</van-tabbar-item>
     </van-tabbar>
 </template>

+ 11 - 0
src/api/index.js

@@ -26,6 +26,17 @@ export default  {
                 return http.get(this.url,params)
             }
         }
+    },
+    activityMan : {
+        siteInspectionList : {
+            url:`${config.baseUrl}/csjcqk/siteInspection/list`,
+            name:'测试',
+            get : function(params){
+                return http.get(this.url,params)
+            }
+        }
+        
+        
     },
     yin : {
         TokenLogin : {

+ 8 - 16
src/router/index.js

@@ -33,6 +33,14 @@ const routes = [{
             isShowTarbar: true,
         }
     }, {
+        path: '/siteInspectionList',
+        name: 'siteInspectionList',
+        component: () =>
+            import ('../views/activityMan/siteInspection/siteInspectionList.vue'),
+        meta: {
+            isShowTarbar: true,
+        }
+    },{
         path: '/toBeDone',
         name: 'toBeDone',
         component: () =>
@@ -48,22 +56,6 @@ const routes = [{
         meta: {
             isShowTarbar: true,
         }
-    }, {
-        path: '/siteMan',
-        name: 'siteMan',
-        component: () =>
-            import ('../views/siteMan/siteMan.vue'),
-        meta: {
-            isShowTarbar: true,
-        }
-    }, {
-        path: '/activityMan',
-        name: 'activityMan',
-        component: () =>
-            import ('../views/activityMan/activityMan.vue'),
-        meta: {
-            isShowTarbar: true,
-        }
     }, {
         path: '/placeActivityList',
         name: 'placeActivityList',

+ 8 - 2
src/store/index.js

@@ -1,13 +1,19 @@
 import { createStore } from "vuex";
 const TOKEN_Key="MZ_USER";
+const PCTOKEN_Key="MZ_TOKEN";
 const store =createStore({
     state:{
-        user:JSON.parse(window.localStorage.getItem(TOKEN_Key)),
+        user:window.localStorage.getItem(TOKEN_Key),
+        pctoken:window.localStorage.getItem(PCTOKEN_Key)
     },
     mutations:{
         setUser(state,data){
             state.user=data;
-            window.localStorage.setItem(TOKEN_Key,JSON.stringify(state.user));
+            window.localStorage.setItem(TOKEN_Key,state.user);
+        },
+        setPcToken(state,data){
+            state.pctoken=data;
+            window.localStorage.setItem(PCTOKEN_Key,state.pctoken);
         },
     },
 });

+ 55 - 5
src/utils/request.js

@@ -1,17 +1,21 @@
 import axios from "axios";          //引入axios
 import sysConfig from '@/config'    //引入配置文件
+import store from "../store/index"
+import qs from "qs"
 
 // console.log(process.env.NODE_ENV)
 
 axios.defaults.baseURL = sysConfig.baseURL   //设置请求时间
 axios.defaults.timeout = sysConfig.timeout   //设置请求超时时间
 const ContentType = sysConfig.ContentType
-axios.defaults.headers["Content-Type"] = "application/json";
+//axios.defaults.headers["Content-Type"] = "application/json";
+axios.defaults.headers["Content-Type"] = "application/x-www-form-urlencoded";
+
 
 /** 请求发送前拦截,用于配置求情内容,如headers参数等 */
 axios.interceptors.request.use(
     (config) => {
-        config.params.api_key = sysConfig.api_key
+        config.headers.token=window.localStorage.getItem('MZ_TOKEN');
         return config
     },
     (error) => {
@@ -19,16 +23,54 @@ axios.interceptors.request.use(
     }
 )
 
+function error1(res){
+	if (res.status == 408 || res.status == 401) {// 需要重新登录
+        store.commit('setPcToken',"");
+		console.log(res.data);
+        // window.xm.showToast({
+        //     message:res.data
+        // })
+	}else if(res.status === 404){
+        console.log("404,路径找不到:"+res.data.path);
+        // window.xm.showToast({
+        //     message:"404,路径找不到:"+res.data.path
+        // })
+	}else if(res.status === 503){
+        console.log("服务不可用");
+        // window.xm.showToast({
+        //     message:"服务不可用"
+        // })
+	}else if(res.status === 504){		
+        console.log("网络连接错误");
+        // window.xm.showToast({
+        //     message:"网络连接错误"
+        // })
+	}else{
+        console.log(res.data);
+        // window.xm.showToast({
+        //     message:res.data
+        // })
+	}
+}
+
 /** 请求发送后返回拦截,用于处理数据格式等 */
 axios.interceptors.response.use(
     (response) => {
         return response
     },
     (error) => {
+		console.log(22);
+		if(error.request){
+			error1(error.request);
+		} else if(error.response){
+			
+		}
         return error
     }
 )
 
+
+
 //封装http请求
 
 var http = {
@@ -42,9 +84,10 @@ var http = {
     get: function (url, params = {}, config = {}) {
         return new Promise((resolve, reject) => {
             axios({
-                url: url,
+                url: url+"?"+params,
                 method: 'get',
-                params: params,
+                //params: qs.stringify(params),
+                //params: params,
                 config: config
             }).then((response) => {
                 resolve(response.data)
@@ -70,9 +113,16 @@ var http = {
                 method: 'post',
                 data: data,
                 params: params,
+                //params: qs.stringify(params),
                 config: config
             }).then((response) => {
-                resolve(response.data)
+				//if(response.data && response.data.statusCode !== 200){
+				// 	error(response.data);
+				// 	reject(response.data)
+				// }
+				// resolve(response.data);
+
+                resolve(response);
             }).catch((error) => {
                 reject(error)
             })

+ 0 - 6
src/views/activityMan/activityMan.vue

@@ -1,6 +0,0 @@
-<template>
-    <div class="about">
-      <h1>activityMan</h1>
-    </div>
-  </template>
-  

+ 89 - 0
src/views/activityMan/siteInspection/siteInspectionList.vue

@@ -0,0 +1,89 @@
+<template>
+    <van-nav-bar
+      title="场所检查"
+      left-text=""
+      left-arrow
+      @click-left="onClickLeft"
+    />
+    <van-search
+    v-model="value"
+    shape="round"
+    placeholder="请输入搜索关键词"
+  />
+    <van-list
+      v-model:loading="loading"
+      :finished="finished"
+      finished-text="没有更多了"
+      @load="onLoad"
+    >
+      <van-button type="primary" size="small" to="/placeActivity">新增</van-button>
+      <van-cell v-for="item in list" :key="item" :title="item" label="2222" is-link>
+        <template #value>
+          11111
+        </template>
+      </van-cell>
+    </van-list>
+  </template>
+  
+  <script>
+  import { ref } from "vue";
+  import  qs  from "qs";
+
+  export default {
+		data() {
+			return{
+                title:'民宗干事',
+				username:"",
+				sms:"",
+				password:"",
+				password2:"",
+				con1:"0",
+                searchForm: {
+                    siteName: {
+                        id: ''
+                    }
+                },
+			}
+		},
+
+		async created(){
+			let aa=qs.stringify({
+            'current': 1,
+            'size': 10,
+            'orders': [],
+            ...this.searchForm
+            },  { allowDots: true, arrayFormat: 'indices' })
+      
+			console.log(aa);
+			let id=this.$route.query.id;
+
+      
+
+			var res = await this.$API.activityMan.siteInspectionList.get(aa);
+            console.log(res);
+
+
+		},
+
+		methods:{
+			onClickLeft(){
+				history.back();
+			},
+        },
+    };
+
+
+  
+  </script>
+  
+  <style>
+  .van-button {
+    top: -5px;
+  }
+  
+  .van-list {
+    height: 80%;
+    margin-top: 5px;
+  }
+  
+  </style>

+ 383 - 0
src/views/activityMan/siteInspection/siteInspectionView.vue

@@ -0,0 +1,383 @@
+<template>
+    <van-nav-bar
+      title="信息上报中心"
+      left-text=""
+      left-arrow
+      @click-left="onClickLeft"
+    />
+    <div class="main">
+      <p class="title">场所检查情况上报</p>
+      <div class="formArea">
+        <p class="miniTitle">基础信息</p>
+        <van-cell-group>
+          <van-field
+            v-model="placeActivity.activity"
+            center
+            label="活动名称:"
+            placeholder="请填写活动名称"
+            input-align="right"
+          />
+        </van-cell-group>
+        <van-cell-group>
+          <van-field
+            v-model="placeActivity.place"
+            readonly
+            required
+            label="场所名称:"
+            placeholder="请选择"
+            input-align="right"
+            right-icon="arrow-down"
+            @click="showPlace = true"
+          />
+          <van-popup v-model:show="showPlace" round position="bottom">
+            <van-picker
+              title="活动场所"
+              :columns="places"
+              @cancel="showPlace = false"
+              @confirm="getPlace"
+            />
+          </van-popup>
+        </van-cell-group>
+        <van-cell-group>
+          <van-field
+            v-model="placeActivity.activityTime"
+            center
+            readonly
+            label="活动时间:"
+            placeholder="请选择时间"
+            input-align="right"
+            right-icon="arrow-down"
+            @click="showAct = true"
+          />
+          <van-popup v-model:show="showAct" round position="bottom">
+            <van-picker-group
+              title="活动时间"
+              :tabs="['选择日期', '选择时间']"
+              next-step-text="下一步"
+              @confirm="getTime"
+              @cancel="showAct = false"
+            >
+              <van-date-picker v-model="currentDate" />
+              <van-time-picker v-model="currentTime" />
+            </van-picker-group>
+          </van-popup>
+        </van-cell-group>
+        <van-cell-group>
+          <van-field
+            v-model="placeActivity.countPerson"
+            center
+            label="参会人数:"
+            placeholder="请填写参会人数"
+            input-align="right"
+            type="digit"
+          />
+        </van-cell-group>
+        <van-cell-group>
+          <van-field
+            v-model="placeActivity.list"
+            center
+            required
+            label="已知名单:"
+            placeholder="请选择参会已知名单"
+            input-align="right"
+            right-icon="arrow-down"
+            @click="showPerson = true"
+          />
+          <van-dialog
+            v-model:show="showPerson"
+            title="选择人员名单"
+            show-cancel-button
+            @confirm="reselected"
+          >
+            <person-list @selected="selected"></person-list>
+          </van-dialog>
+        </van-cell-group>
+        <van-cell-group>
+          <van-field
+            v-model="placeActivity.portname"
+            center
+            label="报告人:"
+            placeholder="请选择报告人"
+            input-align="right"
+            right-icon="arrow-down"
+          />
+        </van-cell-group>
+        <van-cell-group>
+          <van-field
+            v-model="placeActivity.area"
+            center
+            label="参加范围:"
+            placeholder="请填写参加范围"
+            input-align="right"
+          />
+        </van-cell-group>
+        <van-cell-group>
+          <van-field
+            v-model="placeActivity.activityPlace"
+            center
+            readonly
+            label="活动地点:"
+            placeholder="请填写参加地点"
+            input-align="right"
+            right-icon="arrow-down"
+            @click="showArea = true"
+          />
+          <van-popup v-model:show="showArea" round position="bottom">
+            <van-cascader
+              v-model="cascaderValue"
+              title="请选择所在地区"
+              :options="options"
+              @close="showArea = false"
+              @finish="onFinish"
+            />
+          </van-popup>
+        </van-cell-group>
+        <van-cell-group>
+          <van-field
+            v-model="placeActivity.address"
+            center
+            label="详细地址:"
+            placeholder="请填写活参加地点"
+            input-align="right"
+            right-icon="location"
+          />
+        </van-cell-group>
+        <van-cell-group>
+          <van-field
+            v-model="placeActivity.money"
+            center
+            label="经费来源:"
+            placeholder="请选择"
+            input-align="right"
+          />
+        </van-cell-group>
+        <van-cell-group>
+          <van-field
+            v-model="placeActivity.activityName"
+            center
+            label="活动负责人:"
+            placeholder="请选择活动负责人"
+            input-align="right"
+            right-icon="arrow-down"
+            @click="showReport = true"
+          />
+          <van-dialog
+            v-model:show="showReport"
+            title="选择活动负责人"
+            show-cancel-button
+          >
+            <person-list></person-list>
+          </van-dialog>
+        </van-cell-group>
+        <van-cell-group>
+          <van-field
+            v-model="placeActivity.tel"
+            center
+            type="tel"
+            label="联系方式:"
+            placeholder="请填写联系方式"
+            input-align="right"
+          />
+        </van-cell-group>
+        <van-cell-group>
+          <van-field name="uploader" label="安全预案:">
+            <template #input>
+              <van-uploader>
+                <van-button icon="plus">上传文件</van-button>
+              </van-uploader>
+            </template>
+          </van-field>
+        </van-cell-group>
+        <van-cell-group>
+          <div class="rowTextArea">
+            <van-field
+              v-model="placeActivity.into"
+              center
+              rows="2"
+              type="textarea"
+              label="主题内容:"
+              label-align="top"
+            />
+          </div>
+        </van-cell-group>
+      </div>
+      <div class="subbtn">
+        <van-button type="primary">提交</van-button>
+        <van-button type="default" hairline>取消</van-button>
+      </div>
+    </div>
+  </template>
+  
+  <script>
+  import { reactive, ref } from "vue";
+  import personList from "../personList.vue";
+  export default {
+    components: { personList },
+    setup() {
+      // 返回
+      const onClickLeft = () => {
+        history.back();
+      };
+      // 活动信息
+      const placeActivity = reactive({
+        activity: "",
+        place: "",
+        activityTime: "",
+        countPerson: "",
+        list: "",
+        portname: "",
+        area: "",
+        activityPlace: "",
+        address: "",
+        money: "",
+        activityName: "",
+        tel: "",
+        file: "",
+        into: "",
+      });
+      // 场所名称
+      const places = [
+        { text: "杭州", value: "Hangzhou" },
+        { text: "宁波", value: "Ningbo" },
+        { text: "温州", value: "Wenzhou" },
+        { text: "绍兴", value: "Shaoxing" },
+        { text: "湖州", value: "Huzhou" },
+      ];
+      let showPlace = ref(false);
+      const getPlace = ({ selectedOptions }) => {
+        showPlace.value = false;
+        placeActivity.place = selectedOptions[0].text;
+      };
+      // 获取活动时间
+      let showAct = ref(false);
+      let currentDate = ref(["" + new Date().getFullYear(), "01", "01"]);
+      let currentTime = ref(["00", "00"]);
+      const getTime = () => {
+        showAct.value = false;
+        placeActivity.activityTime = `${currentDate.value.join(
+          "-"
+        )} ${currentTime.value.join(":")}`;
+      };
+      // 已知名单
+      let showPerson = ref(false);
+      // 活动负责人
+      let showReport = ref(false);
+      const show = () => {
+        showPerson = true;
+      };
+      let list = "";
+      const selected = (val) => {
+        
+        list = val;
+      };
+      const reselected = () => {
+        placeActivity.list = list;
+      };
+      // 地区选择
+      let showArea = ref(false);
+      const cascaderValue = ref("");
+      // 选项列表,children 代表子选项,支持多级嵌套
+      const options = [
+        {
+          text: "浙江省",
+          value: "330000",
+          children: [{ text: "杭州市", value: "330100" }],
+        },
+        {
+          text: "江苏省",
+          value: "320000",
+          children: [{ text: "南京市", value: "320100" }],
+        },
+      ];
+      // 全部选项选择完毕后,会触发 finish 事件
+      const onFinish = ({ selectedOptions }) => {
+        showArea.value = false;
+        placeActivity.activityPlace = selectedOptions
+          .map((option) => option.text)
+          .join("/");
+      };
+      return {
+        placeActivity,
+        // 活动场所
+        showPlace,
+        places,
+        getPlace,
+        // 活动时间
+        showAct,
+        currentDate,
+        currentTime,
+        getTime,
+        // 返回
+        onClickLeft,
+        // 人员选择
+        showPerson,
+        showReport,
+        selected,
+        reselected,
+        // 地区选择
+        showArea,
+        options,
+        onFinish,
+        cascaderValue,
+      };
+    },
+  };
+  </script>
+  
+  <style scoped>
+  * {
+    margin: 0;
+    padding: 0;
+  }
+  .main p {
+    height: 40px;
+    line-height: 40px;
+    color: #36a7f3;
+    border-bottom: 1px solid #eee;
+  }
+  .title {
+    font-size: 20px;
+    font-weight: 700;
+    padding-left: 20px;
+  }
+  .miniTitle {
+    font-size: 16px;
+  }
+  .formArea {
+    padding: 0px 20px;
+  }
+  .formArea .van-cell-group .van-field__label {
+    height: 40px;
+  }
+  .formArea .van-cell-group .van-cell {
+    line-height: 40px;
+  }
+  .van-cell__value .van-field__right-icon .van-icon-location {
+    color: #36a7f3!important;
+  }
+  .rowTextArea::v-deep .van-field__value {
+    width: 98%;
+    border: 2px solid #ccc;
+    border-radius: 10px;
+  }
+  .rowTextArea::v-deep .van-cell {
+    display: flow-root;
+  }
+  .subbtn {
+    margin: 20px;
+    text-align: center;
+  }
+  .subbtn .van-button {
+    width: 40%;
+    margin: 5px;
+  }
+  .van-uploader .van-button {
+    border: none;
+    color: #36a7f3;
+    top: -4px;
+  }
+  .van-dialog {
+    width: 80%;
+    top: 50%;
+  }
+  </style>

+ 0 - 6
src/views/siteMan/siteMan.vue

@@ -1,6 +0,0 @@
-<template>
-    <div class="about">
-      <h1>siteMan</h1>
-    </div>
-  </template>
-  

+ 14 - 5
src/views/tab_a/tabAll.vue

@@ -66,6 +66,8 @@
 
 <script>
 import tool from "@/tool";
+import  qs  from "qs";
+
 	export default {
 		data() {
 			return{
@@ -109,15 +111,22 @@ import tool from "@/tool";
 				// })
 
 
-				const inputForm ={
+
+				//添加PCtoken过期判断,(请求拦截到token过期,会设置PCtoken为空,为空的时候再调用免登功能)
+				if(this.$store.state.pctoken==""||this.$store.state.pctoken==undefined){
+					const inputForm =qs.stringify({
 					'token': "ssssssss"
+					},  { allowDots: true, arrayFormat: 'indices' })
+					var res = await this.$API.yin.TokenLogin.get(inputForm);
+					//console.log(res);
+					//存PCtoken
+					this.$store.commit('setPcToken',res.PcToken);
+					this.$store.commit('setUser',res.account);
 				}
-				var res = await this.$API.yin.TokenLogin.get(inputForm);
-				console.log(res);
-
-				//this.$store.commit('setUser',data);
 
+				
 
+				//this.$store.commit('setUser',data);
 				// if (res.type == 1) {
 				// 	this.$router.replace({
 				// 		path: "/main",

+ 3 - 3
src/views/tab_a/tab_a.vue

@@ -1,9 +1,9 @@
 <template>
     <router-view></router-view>
     <van-tabbar v-model="active" route >
-        <van-tabbar-item replace to="/toBeDone" name="toBeDone" icon="notes-o">我的待办</van-tabbar-item>
-        <van-tabbar-item replace to="/siteMan" name="siteMan" icon="shop-o">场所管理</van-tabbar-item>
-        <van-tabbar-item replace to="/activityMan" name="activityMan" icon="newspaper-o">活动管理</van-tabbar-item>
+        <van-tabbar-item replace to="/setting" name="toBeDone" icon="notes-o">我的待办</van-tabbar-item>
+        <van-tabbar-item replace to="/setting" name="siteMan" icon="shop-o">场所管理</van-tabbar-item>
+        <van-tabbar-item replace to="/setting" name="activityMan" icon="newspaper-o">活动管理</van-tabbar-item>
         <van-tabbar-item replace to="/setting" name="setting" icon="friends-o">个人中心</van-tabbar-item>
     </van-tabbar>
 </template>

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно