上传代码
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);
|
9
uniapp04/unpackage/dist/dev/mp-weixin/pages/index/index.json
vendored
Normal file
9
uniapp04/unpackage/dist/dev/mp-weixin/pages/index/index.json
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"navigationBarTitleText": "首页",
|
||||
"navigationBarBackgroundColor": "#4095e5",
|
||||
"usingComponents": {
|
||||
"uni-notice-bar": "../../uni_modules/uni-notice-bar/components/uni-notice-bar/uni-notice-bar",
|
||||
"uni-icons": "../../uni_modules/uni-icons/components/uni-icons/uni-icons",
|
||||
"recommend": "../recommend/recommend"
|
||||
}
|
||||
}
|
1
uniapp04/unpackage/dist/dev/mp-weixin/pages/index/index.wxml
vendored
Normal file
1
uniapp04/unpackage/dist/dev/mp-weixin/pages/index/index.wxml
vendored
Normal file
@ -0,0 +1 @@
|
||||
<view class="notice"><uni-notice-bar wx:if="{{a}}" u-i="74c0cf18-0" bind:__l="__l" u-p="{{a}}"/></view><scroll-view refresher-enabled scroll-y><view class="navbar"><view class="search"><text class="icon-search" bindtap="{{b}}"> 搜索店铺 </text></view><navigator url="/pages/messageCenter/messageCenter"><uni-icons wx:if="{{c}}" class="talk" u-i="74c0cf18-1" bind:__l="__l" u-p="{{c}}"></uni-icons></navigator></view><view class="swiperPicture"><swiper circular="{{true}}" autoplay="{{true}}" interval="{{3000}}" indicator-dots><swiper-item><navigator class="navigator"><image mode="aspectFill" class="image" src="https://ts1.cn.mm.bing.net/th/id/R-C.8f2db93b542db8adf6c850762c1cce4d?rik=erpuvqVy64IJzQ&riu=http%3a%2f%2fimg95.699pic.com%2fphoto%2f50044%2f9286.jpg_wh860.jpg&ehk=dnizwrPBuCaHnaxfih%2fryK7p%2fXZMbmolNORKknXvL%2bI%3d&risl=&pid=ImgRaw&r=0"></image></navigator></swiper-item><swiper-item><navigator class="navigator"><image mode="aspectFill" class="image" src="https://img95.699pic.com/photo/50127/2949.jpg_wh860.jpg"></image></navigator></swiper-item><swiper-item><navigator class="navigator"><image mode="aspectFill" class="image" src="https://img95.699pic.com/photo/50070/9636.jpg_wh860.jpg"></image></navigator></swiper-item></swiper></view><view class="category"><navigator wx:for="{{d}}" wx:for-item="item" wx:key="d" class="category-item" url="{{item.c}}"><image class="icon" src="{{item.a}}"></image><text class="text">{{item.b}}</text></navigator></view><recommend u-i="74c0cf18-2" bind:__l="__l"></recommend><view class="content"><movable-area class="movableArea"><movable-view class="movableView" x="{{f}}" y="{{g}}" direction="{{h}}" damping="{{i}}" bindchange="{{j}}" bindtap="{{k}}" bindtouchend="{{l}}"><image src="{{e}}" mode="widthFix" class="iconImage"></image></movable-view></movable-area></view></scroll-view>
|
154
uniapp04/unpackage/dist/dev/mp-weixin/pages/index/index.wxss
vendored
Normal file
154
uniapp04/unpackage/dist/dev/mp-weixin/pages/index/index.wxss
vendored
Normal file
@ -0,0 +1,154 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
.navbar {
|
||||
background-color: #4095e5;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
padding: 10px;
|
||||
/* 添加透明输入框的样式 */
|
||||
}
|
||||
.navbar .search {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 10rpx 0 26rpx;
|
||||
height: 0.64rem;
|
||||
color: #fff;
|
||||
font-size: 28rpx;
|
||||
border-radius: 32rpx;
|
||||
background-color: rgba(255, 255, 255, 0.5);
|
||||
width: 70%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.navbar .icon-search {
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
.navbar .search-button {
|
||||
margin-left: auto;
|
||||
/* 将按钮放置在右侧 */
|
||||
height: 0.64rem;
|
||||
/* 与搜索框高度一致 */
|
||||
background-color: #fff;
|
||||
/* 按钮背景颜色 */
|
||||
color: #4095e5;
|
||||
/* 按钮文字颜色 */
|
||||
border: none;
|
||||
/* 去掉边框 */
|
||||
border-radius: 32rpx;
|
||||
/* 与搜索框圆角一致 */
|
||||
padding: 0 20rpx;
|
||||
/* 按钮内边距 */
|
||||
line-height: 0.64rem;
|
||||
font-size: 15px;
|
||||
}
|
||||
.navbar .transparent-input {
|
||||
background-color: transparent;
|
||||
/* 使输入框背景透明 */
|
||||
border: none;
|
||||
/* 移除边框 */
|
||||
color: #fff;
|
||||
/* 输入文字颜色为白色 */
|
||||
outline: none;
|
||||
/* 点击时没有默认的outline */
|
||||
width: 100%;
|
||||
/* 让输入框占据剩余空间 */
|
||||
padding: 0 10rpx;
|
||||
/* 内边距以保证文本不紧贴边缘 */
|
||||
font-size: 28rpx;
|
||||
/* 继承自 .search 的字体大小 */
|
||||
}
|
||||
.navigator,
|
||||
.image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.category {
|
||||
margin: 20rpx 0 0;
|
||||
padding: 10rpx 0;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
min-height: 1.5rem;
|
||||
}
|
||||
.category .category-item {
|
||||
width: 150rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.category .category-item .icon {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.category .category-item .text {
|
||||
font-size: 26rpx;
|
||||
color: #111;
|
||||
}
|
||||
.IPtext {
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.notice {
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
/* 取餐吗 */
|
||||
.content {
|
||||
position: relative;
|
||||
}
|
||||
.movableArea {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
pointer-events: none;
|
||||
z-index: 999;
|
||||
}
|
||||
.movableView {
|
||||
pointer-events: auto;
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
padding: 10rpx;
|
||||
border-radius: 100%;
|
||||
border: 2px solid #33A3DC;
|
||||
background-color: #eed43e;
|
||||
}
|
||||
.iconImage {
|
||||
display: block;
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
}
|
||||
.contact {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
overflow: hidden;
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
top: 0px;
|
||||
border-radius: 100%;
|
||||
opacity: 0;
|
||||
}
|
Reference in New Issue
Block a user