| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311 |
- import { d as defineComponent, r as ref, n as reactive, o as onMounted, p as onActivated, q as onBeforeRouteLeave, b as createElementBlock, c as createVNode, f as withCtx, B as unref, e as createBaseVNode, j as openBlock, s as createTextVNode, F as Fragment, x as renderList, k as createBlock, z as nextTick } from "./index-5e4623ce.js";
- import { B as BackTop } from "./index-9e456003.js";
- import { P as PullRefresh } from "./index-e8b8fc91.js";
- import { S as SwipeCell } from "./index-73d5a905.js";
- import { C as Cell } from "./index-8540448e.js";
- import { I as Image } from "./index-f1ec0231.js";
- import { B as Button } from "./index-b1054607.js";
- import { F as Field } from "./index-41ec7e28.js";
- import { p as post_promise } from "./index-18735c56.js";
- import { C as CusNavigation } from "./CusNavigation-87012716.js";
- import { I as Icon } from "./index-487cde8c.js";
- import { L as Loading } from "./index-217c49a0.js";
- import "./index-eef3af38.js";
- import "./use-scope-id-0b5b8615.js";
- import "./on-popup-reopen-c5ca1603.js";
- import "./use-route-726f0d0b.js";
- import "./axios-8cd254ce.js";
- import "./function-call-dc072a29.js";
- import "./mount-component-2b0f7b23.js";
- const _hoisted_1 = { style: { "display": "flex", "flex-direction": "column", "height": "100vh" } };
- const _hoisted_2 = { style: { "padding": "16px" } };
- const _hoisted_3 = { style: { "background-color": "#eee", "border-radius": "2.5rem", "margin": "0px 5px" } };
- const _hoisted_4 = { style: { "margin-top": "16px", "display": "flex" } };
- const _hoisted_5 = { style: { "flex-grow": "1" } };
- const _hoisted_6 = { style: { "flex-grow": "1" } };
- const _hoisted_7 = { style: { "padding": "16px" } };
- const _hoisted_8 = { style: { "height": "80px", "display": "flex" } };
- const _hoisted_9 = { style: { "margin-right": "18px" } };
- const _hoisted_10 = { key: 0 };
- const _hoisted_11 = {
- key: 1,
- style: { "text-align": "center", "padding": "10px 20px 20px 20px", "color": "#ccc" }
- };
- const _hoisted_12 = {
- key: 2,
- style: { "text-align": "center", "padding": "10px 20px 20px 20px" }
- };
- const _hoisted_13 = {
- key: 3,
- style: { "text-align": "center", "padding": "10px 20px 20px 20px", "color": "#ccc" }
- };
- const _hoisted_14 = {
- key: 4,
- style: { "text-align": "center", "padding": "10px 20px 20px 20px" }
- };
- const _sfc_main = /* @__PURE__ */ defineComponent({
- __name: "Index",
- setup(__props) {
- const cusNavigation = ref();
- const onSearch = () => {
- console.log("jjj");
- console.log(keyWord);
- onRefresh();
- };
- const onCancel = () => {
- cusNavigation.value.closeSearchPopup();
- };
- const onScan = () => {
- cusNavigation.value.closePlusPopup();
- };
- const keyWord = ref("");
- const page = reactive({
- total: 0,
- pageNum: 1,
- pageSize: 10,
- pages: 0
- });
- const dataList = ref([]);
- const refreshing = ref(false);
- const isLoading = ref(false);
- const finished = ref(false);
- const getData = () => {
- console.log("onload.....");
- post_promise({ url: "/device/search", data: {
- size: page.pageSize,
- page: page.pageNum,
- sort: "createtime",
- order: "desc",
- keyWord: keyWord.value,
- mac: ""
- } }).then((result) => {
- console.log(result);
- isLoading.value = false;
- refreshing.value = false;
- if (result.code == 0) {
- const dataArr = result.data;
- const total = result.total;
- const pages = Math.ceil(total / page.pageSize);
- console.log(pages);
- console.log(dataArr);
- if (page.pageNum == 1) {
- dataList.value.splice(0, dataList.value.length);
- }
- dataList.value.push(...dataArr);
- page.pages = pages;
- page.total = total;
- console.log(dataList.value, pages);
- }
- }, (result) => {
- console.log(result);
- isLoading.value = false;
- refreshing.value = false;
- }).catch((ex) => {
- console.log(ex);
- isLoading.value = false;
- refreshing.value = false;
- });
- };
- const onRefresh = () => {
- console.log("onrefresh...");
- console.log(refreshing.value);
- page.pageNum = 1;
- finished.value = false;
- isLoading.value = true;
- getData();
- };
- onMounted(() => {
- console.log("onMounted");
- getData();
- });
- const scrollRef = ref(null);
- const scrollTop = ref(0);
- onActivated(() => {
- console.log("onActived...");
- nextTick(() => {
- scrollRef.value.scrollTop = scrollTop.value;
- });
- });
- onBeforeRouteLeave((to, from, next) => {
- console.log(to, from);
- console.log("onBeforeRouteLeave...");
- scrollTop.value = scrollRef.value.scrollTop;
- next();
- });
- const clickLoading = () => {
- console.log("clickLoading");
- page.pageNum++;
- isLoading.value = true;
- getData();
- };
- return (_ctx, _cache) => {
- const _component_van_icon = Icon;
- const _component_van_field = Field;
- const _component_van_button = Button;
- const _component_van_image = Image;
- const _component_van_cell = Cell;
- const _component_van_swipe_cell = SwipeCell;
- const _component_van_loading = Loading;
- const _component_van_pull_refresh = PullRefresh;
- const _component_van_back_top = BackTop;
- return openBlock(), createElementBlock("div", _hoisted_1, [
- createVNode(unref(CusNavigation), {
- ref_key: "cusNavigation",
- ref: cusNavigation,
- gobackabled: "",
- title: "文章列表",
- searchabled: "",
- plusabled: false
- }, {
- search: withCtx(() => [
- createBaseVNode("div", _hoisted_2, [
- createBaseVNode("div", _hoisted_3, [
- createVNode(_component_van_field, {
- style: { "padding": "6px 16px", "height": "44px", "line-height": "25px", "align-items": "center" },
- modelValue: keyWord.value,
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => keyWord.value = $event),
- size: "normal",
- clearable: ""
- }, {
- "right-icon": withCtx(() => [
- createBaseVNode("div", null, [
- createVNode(_component_van_icon, {
- name: "scan",
- size: "1.5rem"
- })
- ])
- ]),
- _: 1
- }, 8, ["modelValue"])
- ]),
- createBaseVNode("div", _hoisted_4, [
- createBaseVNode("div", _hoisted_5, [
- createVNode(_component_van_button, {
- type: "warning",
- size: "normal",
- round: "",
- block: "",
- onClick: onCancel
- }, {
- default: withCtx(() => _cache[2] || (_cache[2] = [
- createTextVNode("取消")
- ])),
- _: 1
- })
- ]),
- _cache[4] || (_cache[4] = createBaseVNode("div", { style: { "width": "10px" } }, null, -1)),
- createBaseVNode("div", _hoisted_6, [
- createVNode(_component_van_button, {
- type: "primary",
- size: "normal",
- round: "",
- block: "",
- onClick: onSearch
- }, {
- default: withCtx(() => _cache[3] || (_cache[3] = [
- createTextVNode("搜索")
- ])),
- _: 1
- })
- ])
- ])
- ])
- ]),
- plus: withCtx(() => [
- createBaseVNode("div", _hoisted_7, [
- createBaseVNode("div", null, [
- createVNode(_component_van_button, {
- type: "primary",
- size: "normal",
- icon: "scan",
- round: "",
- block: "",
- onClick: onScan
- }, {
- default: withCtx(() => _cache[5] || (_cache[5] = [
- createTextVNode("扫码添加设备")
- ])),
- _: 1
- })
- ])
- ])
- ]),
- _: 1
- }, 512),
- createBaseVNode("div", {
- ref_key: "scrollRef",
- ref: scrollRef,
- class: "container",
- style: { "overflow-y": "auto", "flex-grow": "1" }
- }, [
- createVNode(_component_van_pull_refresh, {
- style: { "min-height": "100%" },
- modelValue: refreshing.value,
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => refreshing.value = $event),
- onRefresh
- }, {
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(dataList.value, (item) => {
- return openBlock(), createBlock(_component_van_swipe_cell, { style: { "background-color": "#fff", "margin-bottom": "10px" } }, {
- default: withCtx(() => [
- createVNode(_component_van_cell, {
- clickable: "",
- to: "/article/detail/" + item.mac
- }, {
- default: withCtx(() => [
- createBaseVNode("div", _hoisted_8, [
- createBaseVNode("div", _hoisted_9, [
- createVNode(_component_van_image, {
- width: "80",
- height: "80",
- radius: "6",
- src: "static/images/banner.png"
- })
- ]),
- _cache[6] || (_cache[6] = createBaseVNode("div", { style: { "width": "0px", "flex-grow": "1", "display": "flex", "flex-direction": "column", "justify-content": "space-between" } }, [
- createBaseVNode("div", { style: { "font-weight": "bold", "text-align": "left", "color": "#000" } }, [
- createBaseVNode("span", null, "公务员考试笔试,政审都过了,单位叫我去上班我要去吗?")
- ]),
- createBaseVNode("div", { style: { "display": "flex", "justify-content": "space-between", "color": "#969799" } }, [
- createBaseVNode("div", null, "河南新闻"),
- createBaseVNode("div", null, "2024-06-11")
- ])
- ], -1))
- ])
- ]),
- _: 2
- }, 1032, ["to"])
- ]),
- _: 2
- }, 1024);
- }), 256)),
- createBaseVNode("div", null, [
- refreshing.value ? (openBlock(), createElementBlock("div", _hoisted_10)) : dataList.value.length == 0 ? (openBlock(), createElementBlock("div", _hoisted_11, _cache[7] || (_cache[7] = [
- createBaseVNode("span", null, "暂无数据", -1)
- ]))) : isLoading.value ? (openBlock(), createElementBlock("div", _hoisted_12, [
- createVNode(_component_van_loading, {
- type: "spinner",
- color: "#1989fa"
- })
- ])) : page.pages <= page.pageNum ? (openBlock(), createElementBlock("div", _hoisted_13, _cache[8] || (_cache[8] = [
- createBaseVNode("span", null, "没有更多了", -1)
- ]))) : (openBlock(), createElementBlock("div", _hoisted_14, [
- createBaseVNode("span", { onClick: clickLoading }, "点击加载")
- ]))
- ])
- ]),
- _: 1
- }, 8, ["modelValue"]),
- createVNode(_component_van_back_top, {
- target: ".container",
- right: "5vw",
- bottom: "80px"
- })
- ], 512)
- ]);
- };
- }
- });
- export {
- _sfc_main as default
- };
|