上传代码
This commit is contained in:
166
uniapp04/unpackage/dist/dev/mp-weixin/pages/index/index.js
vendored
Normal file
166
uniapp04/unpackage/dist/dev/mp-weixin/pages/index/index.js
vendored
Normal file
@ -0,0 +1,166 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const common_assets = require("../../common/assets.js");
|
||||
const API_api = require("../../API/api.js");
|
||||
if (!Array) {
|
||||
const _easycom_uni_notice_bar2 = common_vendor.resolveComponent("uni-notice-bar");
|
||||
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
|
||||
(_easycom_uni_notice_bar2 + _easycom_uni_icons2)();
|
||||
}
|
||||
const _easycom_uni_notice_bar = () => "../../uni_modules/uni-notice-bar/components/uni-notice-bar/uni-notice-bar.js";
|
||||
const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
|
||||
if (!Math) {
|
||||
(_easycom_uni_notice_bar + _easycom_uni_icons + common_vendor.unref(recommend))();
|
||||
}
|
||||
const recommend = () => "../recommend/recommend.js";
|
||||
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
__name: "index",
|
||||
props: {
|
||||
damping: {
|
||||
type: Number,
|
||||
default: 10
|
||||
},
|
||||
direction: {
|
||||
type: String,
|
||||
default: "all"
|
||||
},
|
||||
position: {
|
||||
type: Number,
|
||||
default: 4
|
||||
}
|
||||
},
|
||||
setup(__props) {
|
||||
const systemList = common_vendor.ref([]);
|
||||
const lastSystemItem = common_vendor.computed(() => systemList.value[systemList.value.length - 1]);
|
||||
const system = () => {
|
||||
common_vendor.index.request({
|
||||
url: API_api.apiImageUrl + "/api/system/list",
|
||||
method: "POST",
|
||||
data: {
|
||||
type: 0
|
||||
},
|
||||
success(res) {
|
||||
systemList.value = res.data.data;
|
||||
console.log(systemList.value);
|
||||
},
|
||||
fail() {
|
||||
console.log("失败啦");
|
||||
}
|
||||
});
|
||||
};
|
||||
common_vendor.onMounted(system);
|
||||
common_vendor.ref(0);
|
||||
const meishi = [
|
||||
{ type: 1, url: "/pages/food/food", title: "第一餐厅", imgUrl: "../../static/Restaurant/橙汁.png" },
|
||||
{ type: 2, url: "/pages/drinks/drinks", title: "第二餐厅", imgUrl: "../../static/Restaurant/汉堡.png" },
|
||||
{ type: 3, url: "/pages/fruits/fruits", title: "第三餐厅", imgUrl: "../../static/Restaurant/火锅.png" },
|
||||
{ type: 9, url: "/pages/points/points", title: "第四餐厅", imgUrl: "../../static/Restaurant/披萨.png" },
|
||||
{ type: 10, url: "/pages/more/more", title: "第五餐厅", imgUrl: "../../static/Restaurant/章鱼小丸子.png" }
|
||||
];
|
||||
const goSearch = () => {
|
||||
common_vendor.index.navigateTo({
|
||||
url: "/pages/goSearch/goSearch"
|
||||
});
|
||||
};
|
||||
const props = __props;
|
||||
const state = common_vendor.reactive({
|
||||
x: 0,
|
||||
y: 0,
|
||||
x1: 0,
|
||||
x2: 0,
|
||||
y1: 0,
|
||||
y2: 0,
|
||||
move: {
|
||||
x: 0,
|
||||
y: 0
|
||||
}
|
||||
});
|
||||
common_vendor.onMounted(() => {
|
||||
common_vendor.index.getSystemInfo({
|
||||
success: (res) => {
|
||||
state.x1 = 0;
|
||||
state.x2 = parseInt(res.windowWidth) - 50;
|
||||
state.y1 = 0;
|
||||
state.y2 = parseInt(res.windowHeight) - 20;
|
||||
setTimeout(() => {
|
||||
if ([1, 2].includes(props.position))
|
||||
state.y = parseInt(state.y2 * 0.2);
|
||||
if ([3, 4].includes(props.position))
|
||||
state.y = parseInt(state.y2 * 0.8);
|
||||
if ([1, 3].includes(props.position))
|
||||
state.x = parseInt(state.x1);
|
||||
if ([2, 4].includes(props.position))
|
||||
state.x = parseInt(state.x2);
|
||||
state.move.x = state.x;
|
||||
state.move.y = state.y;
|
||||
}, 1e3);
|
||||
}
|
||||
});
|
||||
});
|
||||
function onChange(e) {
|
||||
if (e.detail.source === "touch") {
|
||||
state.move.x = e.detail.x;
|
||||
state.move.y = e.detail.y;
|
||||
}
|
||||
}
|
||||
function onTap(e) {
|
||||
console.log("Tap event");
|
||||
common_vendor.index.navigateTo({
|
||||
url: "/pages/testFive/testFive"
|
||||
});
|
||||
}
|
||||
function onTouchend() {
|
||||
state.x = state.move.x;
|
||||
state.y = state.move.y;
|
||||
setTimeout(() => {
|
||||
if (state.move.x < state.x2 / 2)
|
||||
state.x = state.x1;
|
||||
else
|
||||
state.x = state.x2;
|
||||
console.log("yuan" + state.x, state.y);
|
||||
}, 100);
|
||||
}
|
||||
const getloginUser = () => {
|
||||
const user = common_vendor.index.getStorageSync("userInfo");
|
||||
console.log(user);
|
||||
if (user == "") {
|
||||
common_vendor.index.showToast({
|
||||
title: "去登录",
|
||||
duration: 2e3
|
||||
});
|
||||
}
|
||||
};
|
||||
common_vendor.onMounted(getloginUser);
|
||||
return (_ctx, _cache) => {
|
||||
return {
|
||||
a: common_vendor.p({
|
||||
["show-icon"]: true,
|
||||
scrollable: true,
|
||||
text: lastSystemItem.value.content
|
||||
}),
|
||||
b: common_vendor.o(goSearch),
|
||||
c: common_vendor.p({
|
||||
type: "chat-filled",
|
||||
size: "30"
|
||||
}),
|
||||
d: common_vendor.f(meishi, (item, index, i0) => {
|
||||
return {
|
||||
a: item.imgUrl,
|
||||
b: common_vendor.t(item.title),
|
||||
c: item.url,
|
||||
d: index
|
||||
};
|
||||
}),
|
||||
e: common_assets._imports_0,
|
||||
f: state.x,
|
||||
g: state.y,
|
||||
h: props.direction,
|
||||
i: props.damping,
|
||||
j: common_vendor.o(onChange),
|
||||
k: common_vendor.o(onTap),
|
||||
l: common_vendor.o(onTouchend)
|
||||
};
|
||||
};
|
||||
}
|
||||
});
|
||||
wx.createPage(_sfc_main);
|
Reference in New Issue
Block a user