Ver código fonte

对对应接口进行测试和布局调整

LuChongMei 2 anos atrás
pai
commit
bfa1a15683

+ 5 - 2
src/api/placeActivity/placeActivityServer.js

@@ -1,6 +1,9 @@
 import request from '@/utils/request'
 export default class placeActivityServer {
-    treeData() {
-        return request.get('/tools/area_yc/treeData');
+    list(params) {
+        return request.get({
+            url: '/reporting/reportingActivities/list',
+            params: params
+        })
     }
 }

+ 12 - 0
src/api/sys/tools.js

@@ -0,0 +1,12 @@
+export default class Tools {
+    treeData() {
+            return request.get('/tools/area_yc/treeData');
+        }
+        // 获取人员信息
+    list(params) {
+        return request({
+            url: '/user/usermanagement/userManagement/list',
+            params: params
+        })
+    }
+}

+ 3 - 1
src/main.js

@@ -8,7 +8,7 @@ import axios from 'axios';
 
 
 
-import { NavBar, Button, Form, Field, CellGroup, Tabbar, TabbarItem, Icon, Toast, Image as VanImage, Grid, GridItem, Row, Col, Tab, Tabs, Popup, PickerGroup, DatePicker, TimePicker, Picker, Uploader, Dialog, List, Cell, Cascader, Search, RadioGroup, Radio, DropdownMenu, DropdownItem, SwipeCell } from 'vant';
+import { NavBar, Button, Form, Field, CellGroup, Tabbar, TabbarItem, Icon, Toast, Image as VanImage, Grid, GridItem, Row, Col, Tab, Tabs, Popup, PickerGroup, DatePicker, TimePicker, Picker, Uploader, Dialog, List, Cell, Cascader, Search, RadioGroup, Radio, DropdownMenu, DropdownItem, SwipeCell, Checkbox, CheckboxGroup } from 'vant';
 import 'vant/lib/index.css';
 import store from './store';
 
@@ -48,6 +48,8 @@ app.use(router)
     .use(DropdownMenu)
     .use(DropdownItem)
     .use(SwipeCell)
+    .use(Checkbox)
+    .use(CheckboxGroup)
 
 app.config.globalProperties.$API = api
 app.config.globalProperties.$axios = axios

+ 63 - 7
src/views/activityMan/personList.vue

@@ -13,7 +13,7 @@
       finished-text="没有更多了"
       @load="onLoad"
     >
-      <van-cell title="全选">
+      <!-- <van-cell title="全选">
         <template #right-icon>
           <input type="checkbox" v-model="isAll" @change="selectAll" />
         </template>
@@ -26,14 +26,38 @@
             @change="selectPerson(item, index)"
           />
         </template>
-      </van-cell>
+      </van-cell> -->
+      <van-checkbox-group v-model="checked">
+        <van-cell-group inset>
+          <van-cell title="全选">
+            <template #right-icon>
+              <input type="checkbox" v-model="isAll" @change="selectAll" />
+            </template>
+          </van-cell>
+          <van-cell
+            v-for="(item, index) in list"
+            clickable
+            :key="item"
+            :title="`复选框 ${item}`"
+            @click="toggle(index)"
+          >
+            <template #right-icon>
+              <van-checkbox
+                :name="item"
+                :ref="(el) => (checkboxRefs[index] = el)"
+                @click.stop
+              />
+            </template>
+          </van-cell>
+        </van-cell-group>
+      </van-checkbox-group>
     </van-list>
   </div>
 </template>
 
 <script>
-import { ref, toRef } from "vue";
-
+import { ref } from "vue";
+import tools from "@/api/sys/tools";
 export default {
   name: "personList",
   emits: ["selected"],
@@ -41,24 +65,53 @@ export default {
     const list = [];
     const loading = ref(false);
     const finished = ref(false);
-
+    // let index = 0;
+    // const onLoad = () => {
+    //   // 异步更新数据
+    //   new tools()
+    //     .list({
+    //       current: index + 1,
+    //       size: 10,
+    //     })
+    //     .then(({ data }) => {
+    //       console.log("获取数据", data);
+    //       // list.push(data);
+    //       // // 数据全部加载完成
+    //       // if (data.length < 10) {
+    //       //   finished.value = true;
+    //       // }
+    //     });
+    //   // 加载状态结束
+    //   loading.value = false;
+    //   index++;
+    // };
     const onLoad = () => {
       // 异步更新数据
       // setTimeout 仅做示例,真实场景中一般为 ajax 请求
       setTimeout(() => {
         for (let i = 0; i < 10; i++) {
-          list.push(list.length + 1);
+          list.value.push(list.value.length + 1);
         }
 
         // 加载状态结束
         loading.value = false;
 
         // 数据全部加载完成
-        if (list.length >= 10) {
+        if (list.value.length >= 40) {
           finished.value = true;
         }
       }, 1000);
     };
+    const checked = ref([]);
+    const checkboxRefs = ref([]);
+    const toggle = (index) => {
+      checkboxRefs.value[index].toggle();
+    };
+
+    onBeforeUpdate(() => {
+      checkboxRefs.value = [];
+    });
+
     // 搜索
     const value = ref("");
     const onSearch = (val) => showToast(val);
@@ -108,6 +161,9 @@ export default {
       selectAll,
       getList,
       isAll,
+      toggle,
+      checked,
+      checkboxRefs,
     };
   },
 };

+ 46 - 16
src/views/activityMan/placeactivity/placeActivityList.vue

@@ -16,10 +16,18 @@
   >
     <!-- tab切换 -->
     <div class="nav_tab">
-      <div class="tab active">未审核</div>
-      <div class="tab">已审核</div>
+      <div class="tab" :class="tabIndex ? '' : 'active'" @click="tabIndex = 0">
+        未审核
+      </div>
+      <div class="tab" :class="tabIndex ? 'active' : ''" @click="tabIndex = 1">
+        已审核
+      </div>
     </div>
-    <van-swipe-cell v-for="item in list" :key="item">
+    <van-swipe-cell
+      v-for="item in list"
+      :key="item"
+      :before-close="beforeClose"
+    >
       <div class="list_item">
         <div class="item-left">
           <p style="color: #c4c4c4">{{ item.activityTime }}</p>
@@ -45,6 +53,7 @@
 <script>
 import { reactive, ref } from "vue";
 import router from "@/router";
+import placeActivityServer from "@/api/placeActivity/placeActivityServer";
 export default {
   name: "placeActivityList",
   setup() {
@@ -56,6 +65,8 @@ export default {
     const onClickRight = () => {
       router.push("placeActivity");
     };
+    // 切换
+    let tabIndex = ref(0);
     // 列表
     const list = reactive([
       {
@@ -77,26 +88,43 @@ export default {
     ]);
     const loading = ref(false);
     const finished = ref(false);
-
+    let index = 0;
     const onLoad = () => {
       // 异步更新数据
-      // setTimeout 仅做示例,真实场景中一般为 ajax 请求
-      // setTimeout(() => {
-      //   for (let i = 0; i < 10; i++) {
-      //     list.value.push(list.value.length + 1);
-      //   }
-
+      new placeActivityServer()
+        .list({
+          current: index + 1,
+          size: 10,
+        })
+        .then(({ data }) => {
+          console.log("获取数据", data);
+          // list.push(data);
+          // // 数据全部加载完成
+          // if (data.length < 10) {
+          //   finished.value = true;
+          // }
+        });
       // 加载状态结束
       loading.value = false;
-
-      // 数据全部加载完成
-      // if (list.value.length >= 10) {
-      //   finished.value = true;
-      // }
-      // }, 1000);
+      index++;
     };
     // 搜索
     let value = ref("");
+    // 删除确认
+    const beforeClose = ({ position }) => {
+      switch (position) {
+        case "left":
+        case "cell":
+        case "outside":
+          return true;
+        case "right":
+          return new Promise((resolve) => {
+            showConfirmDialog({
+              title: "确定删除吗?",
+            }).then(resolve);
+          });
+      }
+    };
     return {
       onClickLeft,
       list,
@@ -105,6 +133,8 @@ export default {
       finished,
       value,
       onClickRight,
+      tabIndex,
+      beforeClose,
     };
   },
 };

+ 6 - 4
src/views/activityMan/placeactivity/placeActivityView.vue

@@ -212,8 +212,10 @@
 import { reactive, ref } from "vue";
 import personList from "../personList.vue";
 import placeActivityServer from "@/api/placeActivity/placeActivityServer";
+import tools from '@/api/sys/tools'
 export default {
   components: { personList },
+  tools:new tools(),
   setup() {
     // 返回
     const onClickLeft = () => {
@@ -263,9 +265,9 @@ export default {
     let showPerson = ref(false);
     // 活动负责人
     let showReport = ref(false);
-    const show = () => {
-      showPerson = true;
-    };
+    // const show = () => {
+    //   showPerson = true;
+    // };
     let list = "";
     const selected = (val) => {
       list = val;
@@ -276,7 +278,7 @@ export default {
     // 地区选择
     let showArea = ref(false);
     const cascaderValue = ref("");
-    new placeActivityServer().treeData().then((res) => {
+    tools.treeData().then((res) => {
       console.log("area", res);
     });
     // 选项列表,children 代表子选项,支持多级嵌套