This commit is contained in:
parent
5add1f1282
commit
ede860cec3
1
App.vue
1
App.vue
|
|
@ -16,4 +16,5 @@
|
||||||
/*每个页面公共css */
|
/*每个页面公共css */
|
||||||
@import "@/uni_modules/uview-plus/index.scss";
|
@import "@/uni_modules/uview-plus/index.scss";
|
||||||
@import '@/common/css/flex.css';
|
@import '@/common/css/flex.css';
|
||||||
|
@import "@/common/css/common.css";
|
||||||
</style>
|
</style>
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
page,
|
||||||
|
view,
|
||||||
|
scroll-view,
|
||||||
|
swiper,
|
||||||
|
swiper-item,
|
||||||
|
match-media,
|
||||||
|
movable-area,
|
||||||
|
movable-view,
|
||||||
|
cover-view,
|
||||||
|
cover-image,
|
||||||
|
icon,
|
||||||
|
text,
|
||||||
|
rich-text,
|
||||||
|
progress,
|
||||||
|
button,
|
||||||
|
checkbox-group,
|
||||||
|
editor,
|
||||||
|
form,
|
||||||
|
input,
|
||||||
|
label,
|
||||||
|
picker,
|
||||||
|
picker-view,
|
||||||
|
radio-group,
|
||||||
|
slider,
|
||||||
|
switch,
|
||||||
|
textarea,
|
||||||
|
navigator,
|
||||||
|
audio,
|
||||||
|
camera,
|
||||||
|
image,
|
||||||
|
video,
|
||||||
|
live-player,
|
||||||
|
live-pusher,
|
||||||
|
map,
|
||||||
|
canvas,
|
||||||
|
web-view {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
image {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
1533
common/css/uni.scss
1533
common/css/uni.scss
File diff suppressed because it is too large
Load Diff
15879
common/js/city.json
15879
common/js/city.json
File diff suppressed because it is too large
Load Diff
|
|
@ -1,99 +1,156 @@
|
||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<!-- 占位高度 -->
|
<!-- 占位高度 -->
|
||||||
<view v-if="hasPlaceholder" :style="{ height: `${height}px` }"></view>
|
<view v-if="hasPlaceholder" :style="{ height: `${height}px` }"></view>
|
||||||
<view class="navbar" :style="{ height: `${height}px`, backgroundColor: isTransparent ? 'transparent' : '#fff' }">
|
<view class="navbar" :style="[centerContentStyle,navbarStyle]">
|
||||||
<!-- 左边返回键 -->
|
<!-- 左边返回键 -->
|
||||||
<view v-if="showBack" @click="goBack" class="back-icon">
|
<view v-if="showBack" @click="goBack" class="back-icon">
|
||||||
<uni-icons type="left" size="24"></uni-icons>
|
<up-icon name="arrow-left" color="#606266" size="24"></up-icon>
|
||||||
</view>
|
</view>
|
||||||
<!-- 中间内容 -->
|
<!-- 中间内容 -->
|
||||||
<view class="center-content" :style="centerContentStyle">
|
<view class="center-content" >
|
||||||
<view v-if="showSearch">
|
<view v-if="showSearch">
|
||||||
<uni-search-bar placeholder="搜索"></uni-search-bar>
|
<view class="navbar_tow_tow flex-start">
|
||||||
</view>
|
<input type="text" class="navbar_tow_towinput" v-model="keyword" placeholder="请输入关键字" />
|
||||||
<view v-else>{{ title }}</view>
|
<view class="navbar_tow_towview">搜索</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 右边文字 -->
|
</view>
|
||||||
<view v-if="rightText" class="right-text" @click="onRightTextClick">{{ rightText }}</view>
|
<view v-else>{{ title }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
<!-- 右边文字 -->
|
||||||
|
<view v-if="rightText" class="right-text" @click="onRightTextClick">{{ rightText }}</view>
|
||||||
|
<view v-else></view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useNavbarStore } from '@/store/navbarStore';
|
import {
|
||||||
import { ref, onMounted } from 'vue';
|
useNavbarStore
|
||||||
|
} from '@/stores/navbarStore';
|
||||||
|
import {
|
||||||
|
ref,
|
||||||
|
watch,
|
||||||
|
onMounted,
|
||||||
|
computed
|
||||||
|
} from 'vue';
|
||||||
|
|
||||||
const store = useNavbarStore();
|
const store = useNavbarStore();
|
||||||
const { showBack, rightText, showSearch, title, isTransparent, height, hasPlaceholder } = store;
|
const {
|
||||||
|
showBack,
|
||||||
|
rightText,
|
||||||
|
showSearch,
|
||||||
|
title,
|
||||||
|
isTransparent,
|
||||||
|
height,
|
||||||
|
hasPlaceholder
|
||||||
|
} = store;
|
||||||
|
|
||||||
const goBack = () => {
|
const keyword = ref()
|
||||||
uni.navigateBack({
|
|
||||||
delta: 1
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const onRightTextClick = () => {
|
const goBack = () => {
|
||||||
console.log('右边文字被点击');
|
uni.navigateBack({
|
||||||
};
|
delta: 1
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const centerContentStyle = ref({});
|
const onRightTextClick = () => {
|
||||||
|
console.log('右边文字被点击');
|
||||||
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
const navbarStyle = computed(() => {
|
||||||
const menuButtonInfo = uni.getMenuButtonBoundingClientRect();
|
return {
|
||||||
const systemInfo = uni.getSystemInfoSync();
|
height: `${height}px`,
|
||||||
const statusBarHeight = systemInfo.statusBarHeight;
|
backgroundColor: store.scrollTop >= 44 ? '#fff' : 'transparent'
|
||||||
|
};
|
||||||
|
});
|
||||||
|
// 小程序单独胶囊的样式
|
||||||
|
const centerContentStyle = ref({});
|
||||||
|
onMounted(() => {
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
const menuButtonInfo = uni.getMenuButtonBoundingClientRect();
|
||||||
|
const systemInfo = uni.getSystemInfoSync();
|
||||||
|
const statusBarHeight = systemInfo.statusBarHeight;
|
||||||
|
// 计算标题的垂直偏移量
|
||||||
|
// const verticalOffset = menuButtonInfo.top - statusBarHeight;
|
||||||
|
const verticalOffset = menuButtonInfo.top > menuButtonInfo.height ? menuButtonInfo.height : Math.abs(menuButtonInfo.top - menuButtonInfo.height)
|
||||||
|
const titleHeight = menuButtonInfo.height;
|
||||||
|
centerContentStyle.value = {
|
||||||
|
paddingTop: `${verticalOffset}px`,
|
||||||
|
paddingRight:`${menuButtonInfo.width +20}px`,
|
||||||
|
height: `${height}px`,
|
||||||
|
lineHeight: `${height}px`,
|
||||||
|
boxSizing: 'border-box',
|
||||||
|
};
|
||||||
|
// #endif
|
||||||
|
|
||||||
// 计算标题的垂直偏移量
|
});
|
||||||
const verticalOffset = menuButtonInfo.top - statusBarHeight;
|
|
||||||
const titleHeight = menuButtonInfo.height;
|
|
||||||
|
|
||||||
centerContentStyle.value = {
|
|
||||||
paddingTop: `${20}px`,
|
|
||||||
height: `${titleHeight}px`,
|
|
||||||
lineHeight: `${titleHeight}px`,
|
|
||||||
boxSizing: 'border-box',
|
|
||||||
|
|
||||||
};
|
|
||||||
console.log(centerContentStyle)
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style lang="scss" scoped>
|
||||||
.navbar {
|
.navbar {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
padding: 0 15px;
|
padding: 0 6px;
|
||||||
z-index: 999;
|
z-index: 999;
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.back-icon {
|
.back-icon {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
display: flex;
|
}
|
||||||
align-items: center;
|
|
||||||
margin-right: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.center-content {
|
.center-content {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.right-text {
|
.navbar_tow_tow {
|
||||||
cursor: pointer;
|
position: relative;
|
||||||
display: flex;
|
height: 100%;
|
||||||
align-items: center;
|
line-height: 100%;
|
||||||
margin-left: 10px;
|
flex: 1;
|
||||||
font-size: 16px;
|
margin-left: 10rpx;
|
||||||
line-height: 1;
|
|
||||||
}
|
.navbar_tow_towview {
|
||||||
|
position: absolute;
|
||||||
|
right: 4rpx;
|
||||||
|
top: 50%;
|
||||||
|
transform: translate(0, -50%);
|
||||||
|
text-align: center;
|
||||||
|
background: #FEE06A;
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333333;
|
||||||
|
width: 116rpx;
|
||||||
|
height: 56rpx;
|
||||||
|
line-height: 56rpx;
|
||||||
|
border-radius: 34rpx 34rpx 34rpx 34rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar_tow_towinput {
|
||||||
|
padding-left: 32rpx;
|
||||||
|
padding: 12rpx 120rpx 12rpx 32rpx;
|
||||||
|
height: 100%;
|
||||||
|
flex: auto;
|
||||||
|
background: #FFFFFF;
|
||||||
|
border-radius: 34rpx;
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #999999;
|
||||||
|
overflow: hidden; //超出的文本隐藏
|
||||||
|
text-overflow: ellipsis; //溢出用省略号显示
|
||||||
|
white-space: nowrap; //溢出不换行
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.right-text {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
@ -2,14 +2,17 @@
|
||||||
<view>
|
<view>
|
||||||
<!-- 占位高度 -->
|
<!-- 占位高度 -->
|
||||||
<view v-if="hasPlaceholder" :style="{ height: `${height}px` }"></view>
|
<view v-if="hasPlaceholder" :style="{ height: `${height}px` }"></view>
|
||||||
<view class="navbar"
|
<view class="navbar" :style="[centerContentStyle,navbarStyle]">
|
||||||
:style="{ height: `${height}px`, backgroundColor: isTransparent ? 'transparent' : '#fff' }">
|
<!-- 左边返回键 ,-->
|
||||||
<!-- 左边返回键 -->
|
|
||||||
<view v-if="showBack" @click="goBack" class="back-icon">
|
<view v-if="showBack" @click="goBack" class="back-icon">
|
||||||
<up-icon name="arrow-left" color="#606266" size="24"></up-icon>
|
<view class="navbar_tow_one flex-start">
|
||||||
|
<text class="textnth-childone">零点八零</text>
|
||||||
|
<text class="textnth-childtow">西安市</text>
|
||||||
|
<up-icon style="margin-left: 8rpx;" name="arrow-down-fill" color="#333333" size="16"></up-icon>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 中间内容 -->
|
<!-- 中间内容 -->
|
||||||
<view class="center-content" :style="centerContentStyle">
|
<view class="center-content">
|
||||||
<view v-if="showSearch">
|
<view v-if="showSearch">
|
||||||
<view class="navbar_tow_tow flex-start">
|
<view class="navbar_tow_tow flex-start">
|
||||||
<input type="text" class="navbar_tow_towinput" v-model="keyword" placeholder="请输入关键字" />
|
<input type="text" class="navbar_tow_towinput" v-model="keyword" placeholder="请输入关键字" />
|
||||||
|
|
@ -20,6 +23,7 @@
|
||||||
</view>
|
</view>
|
||||||
<!-- 右边文字 -->
|
<!-- 右边文字 -->
|
||||||
<view v-if="rightText" class="right-text" @click="onRightTextClick">{{ rightText }}</view>
|
<view v-if="rightText" class="right-text" @click="onRightTextClick">{{ rightText }}</view>
|
||||||
|
<view v-else></view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -31,7 +35,8 @@
|
||||||
import {
|
import {
|
||||||
ref,
|
ref,
|
||||||
watch,
|
watch,
|
||||||
onMounted
|
onMounted,
|
||||||
|
computed
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
|
|
||||||
const store = useNavbarStore();
|
const store = useNavbarStore();
|
||||||
|
|
@ -42,9 +47,12 @@
|
||||||
title,
|
title,
|
||||||
isTransparent,
|
isTransparent,
|
||||||
height,
|
height,
|
||||||
hasPlaceholder
|
hasPlaceholder,
|
||||||
|
scrollTop
|
||||||
} = store;
|
} = store;
|
||||||
|
|
||||||
|
const keyword = ref()
|
||||||
|
|
||||||
const goBack = () => {
|
const goBack = () => {
|
||||||
uni.navigateBack({
|
uni.navigateBack({
|
||||||
delta: 1
|
delta: 1
|
||||||
|
|
@ -52,29 +60,36 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
const onRightTextClick = () => {
|
const onRightTextClick = () => {
|
||||||
// 这里可以添加右边文字点击的处理逻辑
|
|
||||||
console.log('右边文字被点击');
|
console.log('右边文字被点击');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const navbarStyle = computed(() => {
|
||||||
|
return {
|
||||||
|
height: `${height}px`,
|
||||||
|
backgroundColor: store.scrollTop >= 44 ? '#F9F9F9' : 'transparent'
|
||||||
|
};
|
||||||
|
});
|
||||||
|
// 小程序单独胶囊的样式
|
||||||
const centerContentStyle = ref({});
|
const centerContentStyle = ref({});
|
||||||
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
const menuButtonInfo = uni.getMenuButtonBoundingClientRect();
|
const menuButtonInfo = uni.getMenuButtonBoundingClientRect();
|
||||||
const systemInfo = uni.getSystemInfoSync();
|
const systemInfo = uni.getSystemInfoSync();
|
||||||
const statusBarHeight = systemInfo.statusBarHeight;
|
const statusBarHeight = systemInfo.statusBarHeight;
|
||||||
|
|
||||||
// 计算标题的垂直偏移量
|
// 计算标题的垂直偏移量
|
||||||
const verticalOffset = menuButtonInfo.top - statusBarHeight;
|
// const verticalOffset = menuButtonInfo.top - statusBarHeight;
|
||||||
|
const verticalOffset = menuButtonInfo.top > menuButtonInfo.height ? menuButtonInfo.height : Math.abs(
|
||||||
|
menuButtonInfo.top - menuButtonInfo.height)
|
||||||
const titleHeight = menuButtonInfo.height;
|
const titleHeight = menuButtonInfo.height;
|
||||||
|
|
||||||
centerContentStyle.value = {
|
centerContentStyle.value = {
|
||||||
marginTop: `${titleHeight}px`,
|
paddingTop: `${verticalOffset}px`,
|
||||||
height: `${titleHeight}px`,
|
paddingRight: `${menuButtonInfo.width +20}px`,
|
||||||
lineHeight: `${titleHeight}px`,
|
height: `${height}px`,
|
||||||
|
lineHeight: `${height}px`,
|
||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
|
|
||||||
};
|
};
|
||||||
console.log(centerContentStyle)
|
// #endif
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -92,6 +107,26 @@
|
||||||
|
|
||||||
.back-icon {
|
.back-icon {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
|
.navbar_tow_one {
|
||||||
|
height: 100%;
|
||||||
|
line-height: 100%;
|
||||||
|
|
||||||
|
.textnth-childone {
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.textnth-childtow {
|
||||||
|
margin-left: 16rpx;
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333333;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.center-content {
|
.center-content {
|
||||||
|
|
@ -124,7 +159,7 @@
|
||||||
|
|
||||||
.navbar_tow_towinput {
|
.navbar_tow_towinput {
|
||||||
padding-left: 32rpx;
|
padding-left: 32rpx;
|
||||||
padding: 12rpx 120rpx 12rpx 32rpx;
|
padding: 12rpx 120rpx 12rpx 8rpx;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
flex: auto;
|
flex: auto;
|
||||||
background: #FFFFFF;
|
background: #FFFFFF;
|
||||||
|
|
|
||||||
|
|
@ -1,31 +1,5 @@
|
||||||
import {
|
|
||||||
fill
|
|
||||||
} from "lodash"
|
|
||||||
import store from "../store"
|
|
||||||
const preCacheKeyClearFetch = 'storage:clear:fetch:'
|
const preCacheKeyClearFetch = 'storage:clear:fetch:'
|
||||||
|
|
||||||
uni.pro.interceptor('request', {
|
|
||||||
config(paramOptions) {
|
|
||||||
let options = Object.assign({}, paramOptions)
|
|
||||||
options.url = uni.conf.baseUrl + paramOptions.url
|
|
||||||
this.options = options
|
|
||||||
return options
|
|
||||||
},
|
|
||||||
success(res) {
|
|
||||||
if (res.data.code == 0) {
|
|
||||||
return res.data
|
|
||||||
} else {
|
|
||||||
return res.data
|
|
||||||
}
|
|
||||||
},
|
|
||||||
fill(err) {
|
|
||||||
uni.showToast({
|
|
||||||
title: err.message || err.msg,
|
|
||||||
icon: "none",
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
function requestrequest(options) {
|
function requestrequest(options) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
uni.request({
|
uni.request({
|
||||||
|
|
@ -59,18 +33,10 @@ async function request(options) {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (options.toast) {
|
if (options.toast) {
|
||||||
// #ifdef MP-WEIXIN || MP-ALIPAY || APP-PLUS
|
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '加载中',
|
title: '加载中',
|
||||||
mask: true
|
mask: true
|
||||||
})
|
})
|
||||||
// #endif
|
|
||||||
// #ifdef H5
|
|
||||||
uni.pro.showLoading({
|
|
||||||
title: '加载中',
|
|
||||||
mask: true
|
|
||||||
})
|
|
||||||
// #endif
|
|
||||||
}
|
}
|
||||||
if (options.type == 1) {
|
if (options.type == 1) {
|
||||||
options.header = {
|
options.header = {
|
||||||
|
|
@ -87,7 +53,6 @@ async function request(options) {
|
||||||
// #endif
|
// #endif
|
||||||
// #ifdef MP-ALIPAY
|
// #ifdef MP-ALIPAY
|
||||||
environment: 'alipay',
|
environment: 'alipay',
|
||||||
// environment: 'alipay',
|
|
||||||
// #endif
|
// #endif
|
||||||
token: uni.cache.get('token'),
|
token: uni.cache.get('token'),
|
||||||
openId: uni.cache.get('miniAppOpenId'),
|
openId: uni.cache.get('miniAppOpenId'),
|
||||||
|
|
@ -98,13 +63,8 @@ async function request(options) {
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
}
|
}
|
||||||
// #ifdef MP-WEIXIN || MP-ALIPAY || APP-PLUS
|
|
||||||
options.url = uni.conf.baseUrl + options.url
|
options.url = uni.conf.baseUrl + options.url
|
||||||
let res = await requestrequest(options);
|
let res = await requestrequest(options);
|
||||||
// #endif
|
|
||||||
// #ifdef H5
|
|
||||||
let res = await uni.pro.request(options);
|
|
||||||
// #endif
|
|
||||||
if (res.code != 0) {
|
if (res.code != 0) {
|
||||||
if (res.code == -4) {
|
if (res.code == -4) {
|
||||||
// uni.showToast({
|
// uni.showToast({
|
||||||
|
|
@ -117,7 +77,6 @@ async function request(options) {
|
||||||
// }
|
// }
|
||||||
// })
|
// })
|
||||||
|
|
||||||
uni.$u.throttle(store.dispatch("loginEvent"), 1000); //获取shapid
|
|
||||||
|
|
||||||
} else if (res.code == 482) {
|
} else if (res.code == 482) {
|
||||||
let nowTime = new Date() / 1000 | 0
|
let nowTime = new Date() / 1000 | 0
|
||||||
|
|
@ -131,9 +90,7 @@ async function request(options) {
|
||||||
success: () => {
|
success: () => {
|
||||||
setTimeout(res => {
|
setTimeout(res => {
|
||||||
if (options.toast) {
|
if (options.toast) {
|
||||||
// #ifndef MP-WEIXIN || MP-ALIPAY
|
|
||||||
uni.pro.hideLoading()
|
|
||||||
// #endif
|
|
||||||
}
|
}
|
||||||
}, 2000)
|
}, 2000)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,143 @@
|
||||||
|
|
||||||
|
var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||||
|
var base64DecodeChars = new Array(
|
||||||
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||||
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||||
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,
|
||||||
|
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1,
|
||||||
|
-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
|
||||||
|
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
|
||||||
|
-1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
|
||||||
|
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1);
|
||||||
|
function encode(str) {
|
||||||
|
var out, i, len;
|
||||||
|
var c1, c2, c3;
|
||||||
|
len = str.length;
|
||||||
|
i = 0;
|
||||||
|
out = "";
|
||||||
|
while (i < len) {
|
||||||
|
c1 = str.charCodeAt(i++) & 0xff;
|
||||||
|
if (i == len) {
|
||||||
|
out += base64EncodeChars.charAt(c1 >> 2);
|
||||||
|
out += base64EncodeChars.charAt((c1 & 0x3) << 4);
|
||||||
|
out += "==";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
c2 = str.charCodeAt(i++);
|
||||||
|
if (i == len) {
|
||||||
|
out += base64EncodeChars.charAt(c1 >> 2);
|
||||||
|
out += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
|
||||||
|
out += base64EncodeChars.charAt((c2 & 0xF) << 2);
|
||||||
|
out += "=";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
c3 = str.charCodeAt(i++);
|
||||||
|
out += base64EncodeChars.charAt(c1 >> 2);
|
||||||
|
out += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
|
||||||
|
out += base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >> 6));
|
||||||
|
out += base64EncodeChars.charAt(c3 & 0x3F);
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
function decode(str) {
|
||||||
|
var c1, c2, c3, c4;
|
||||||
|
var i, len, out;
|
||||||
|
len = str.length;
|
||||||
|
i = 0;
|
||||||
|
out = "";
|
||||||
|
while (i < len) {
|
||||||
|
/* c1 */
|
||||||
|
do {
|
||||||
|
c1 = base64DecodeChars[str.charCodeAt(i++) & 0xff];
|
||||||
|
} while (i < len && c1 == -1);
|
||||||
|
if (c1 == -1)
|
||||||
|
break;
|
||||||
|
/* c2 */
|
||||||
|
do {
|
||||||
|
c2 = base64DecodeChars[str.charCodeAt(i++) & 0xff];
|
||||||
|
} while (i < len && c2 == -1);
|
||||||
|
if (c2 == -1)
|
||||||
|
break;
|
||||||
|
out += String.fromCharCode((c1 << 2) | ((c2 & 0x30) >> 4));
|
||||||
|
/* c3 */
|
||||||
|
do {
|
||||||
|
c3 = str.charCodeAt(i++) & 0xff;
|
||||||
|
if (c3 == 61)
|
||||||
|
return out;
|
||||||
|
c3 = base64DecodeChars[c3];
|
||||||
|
} while (i < len && c3 == -1);
|
||||||
|
if (c3 == -1)
|
||||||
|
break;
|
||||||
|
out += String.fromCharCode(((c2 & 0XF) << 4) | ((c3 & 0x3C) >> 2));
|
||||||
|
/* c4 */
|
||||||
|
do {
|
||||||
|
c4 = str.charCodeAt(i++) & 0xff;
|
||||||
|
if (c4 == 61)
|
||||||
|
return out;
|
||||||
|
c4 = base64DecodeChars[c4];
|
||||||
|
} while (i < len && c4 == -1);
|
||||||
|
if (c4 == -1)
|
||||||
|
break;
|
||||||
|
out += String.fromCharCode(((c3 & 0x03) << 6) | c4);
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function utf16to8(str) {
|
||||||
|
var out, i, len, c;
|
||||||
|
out = "";
|
||||||
|
len = str.length;
|
||||||
|
for (i = 0; i < len; i++) {
|
||||||
|
c = str.charCodeAt(i);
|
||||||
|
if ((c >= 0x0001) && (c <= 0x007F)) {
|
||||||
|
out += str.charAt(i);
|
||||||
|
} else if (c > 0x07FF) {
|
||||||
|
out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));
|
||||||
|
out += String.fromCharCode(0x80 | ((c >> 6) & 0x3F));
|
||||||
|
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
|
||||||
|
} else {
|
||||||
|
out += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F));
|
||||||
|
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
function utf8to16(str) {
|
||||||
|
var out, i, len, c;
|
||||||
|
var char2, char3;
|
||||||
|
out = "";
|
||||||
|
len = str.length;
|
||||||
|
i = 0;
|
||||||
|
while (i < len) {
|
||||||
|
c = str.charCodeAt(i++);
|
||||||
|
switch (c >> 4) {
|
||||||
|
case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
|
||||||
|
// 0xxxxxxx
|
||||||
|
out += str.charAt(i - 1);
|
||||||
|
break;
|
||||||
|
case 12: case 13:
|
||||||
|
// 110x xxxx 10xx xxxx
|
||||||
|
char2 = str.charCodeAt(i++);
|
||||||
|
out += String.fromCharCode(((c & 0x1F) << 6) | (char2 & 0x3F));
|
||||||
|
break;
|
||||||
|
case 14:
|
||||||
|
// 1110 xxxx 10xx xxxx 10xx xxxx
|
||||||
|
char2 = str.charCodeAt(i++);
|
||||||
|
char3 = str.charCodeAt(i++);
|
||||||
|
out += String.fromCharCode(((c & 0x0F) << 12) |
|
||||||
|
((char2 & 0x3F) << 6) |
|
||||||
|
((char3 & 0x3F) << 0));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
encode: encode,
|
||||||
|
decode: decode,
|
||||||
|
utf16to8: utf16to8,
|
||||||
|
utf8to16: utf8to16
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
var config = {
|
||||||
|
//aliyun OSS config
|
||||||
|
uploadImageUrl: `https://czg-qr-order.oss-cn-beijing.aliyuncs.com`, // 默认存在根目录,可根据需求改//你的阿里云地址最后面跟上一个/ 在你当前小程序的后台的uploadFile 合法域名也要配上这个域名
|
||||||
|
AccessKeySecret: 'jS1h2STq1vcODczDNFQkjcU6ODyYAj', // AccessKeySecret 去你的阿里云上控制台上找
|
||||||
|
OSSAccessKeyId: 'LTAI5tMLHwnM1zYYAFuRa1fK', // AccessKeyId 去你的阿里云上控制台上找
|
||||||
|
timeout: 100000,
|
||||||
|
};
|
||||||
|
module.exports = config
|
||||||
|
|
@ -0,0 +1,178 @@
|
||||||
|
const Crypto = {};
|
||||||
|
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
var base64map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||||
|
|
||||||
|
|
||||||
|
// Crypto utilities
|
||||||
|
var util = Crypto.util = {
|
||||||
|
|
||||||
|
// Bit-wise rotate left
|
||||||
|
rotl: function (n, b) {
|
||||||
|
return (n << b) | (n >>> (32 - b));
|
||||||
|
},
|
||||||
|
|
||||||
|
// Bit-wise rotate right
|
||||||
|
rotr: function (n, b) {
|
||||||
|
return (n << (32 - b)) | (n >>> b);
|
||||||
|
},
|
||||||
|
|
||||||
|
// Swap big-endian to little-endian and vice versa
|
||||||
|
endian: function (n) {
|
||||||
|
|
||||||
|
// If number given, swap endian
|
||||||
|
if (n.constructor == Number) {
|
||||||
|
return util.rotl(n, 8) & 0x00FF00FF |
|
||||||
|
util.rotl(n, 24) & 0xFF00FF00;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Else, assume array and swap all items
|
||||||
|
for (var i = 0; i < n.length; i++)
|
||||||
|
n[i] = util.endian(n[i]);
|
||||||
|
return n;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
// Generate an array of any length of random bytes
|
||||||
|
randomBytes: function (n) {
|
||||||
|
for (var bytes = []; n > 0; n--)
|
||||||
|
bytes.push(Math.floor(Math.random() * 256));
|
||||||
|
return bytes;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Convert a string to a byte array
|
||||||
|
stringToBytes: function (str) {
|
||||||
|
var bytes = [];
|
||||||
|
for (var i = 0; i < str.length; i++)
|
||||||
|
bytes.push(str.charCodeAt(i));
|
||||||
|
return bytes;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Convert a byte array to a string
|
||||||
|
bytesToString: function (bytes) {
|
||||||
|
var str = [];
|
||||||
|
for (var i = 0; i < bytes.length; i++)
|
||||||
|
str.push(String.fromCharCode(bytes[i]));
|
||||||
|
return str.join("");
|
||||||
|
},
|
||||||
|
|
||||||
|
// Convert a string to big-endian 32-bit words
|
||||||
|
stringToWords: function (str) {
|
||||||
|
var words = [];
|
||||||
|
for (var c = 0, b = 0; c < str.length; c++, b += 8)
|
||||||
|
words[b >>> 5] |= str.charCodeAt(c) << (24 - b % 32);
|
||||||
|
return words;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Convert a byte array to big-endian 32-bits words
|
||||||
|
bytesToWords: function (bytes) {
|
||||||
|
var words = [];
|
||||||
|
for (var i = 0, b = 0; i < bytes.length; i++, b += 8)
|
||||||
|
words[b >>> 5] |= bytes[i] << (24 - b % 32);
|
||||||
|
return words;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Convert big-endian 32-bit words to a byte array
|
||||||
|
wordsToBytes: function (words) {
|
||||||
|
var bytes = [];
|
||||||
|
for (var b = 0; b < words.length * 32; b += 8)
|
||||||
|
bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF);
|
||||||
|
return bytes;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Convert a byte array to a hex string
|
||||||
|
bytesToHex: function (bytes) {
|
||||||
|
var hex = [];
|
||||||
|
for (var i = 0; i < bytes.length; i++) {
|
||||||
|
hex.push((bytes[i] >>> 4).toString(16));
|
||||||
|
hex.push((bytes[i] & 0xF).toString(16));
|
||||||
|
}
|
||||||
|
return hex.join("");
|
||||||
|
},
|
||||||
|
|
||||||
|
// Convert a hex string to a byte array
|
||||||
|
hexToBytes: function (hex) {
|
||||||
|
var bytes = [];
|
||||||
|
for (var c = 0; c < hex.length; c += 2)
|
||||||
|
bytes.push(parseInt(hex.substr(c, 2), 16));
|
||||||
|
return bytes;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Convert a byte array to a base-64 string
|
||||||
|
bytesToBase64: function (bytes) {
|
||||||
|
|
||||||
|
// Use browser-native function if it exists
|
||||||
|
if (typeof btoa == "function") return btoa(util.bytesToString(bytes));
|
||||||
|
|
||||||
|
var base64 = [],
|
||||||
|
overflow;
|
||||||
|
|
||||||
|
for (var i = 0; i < bytes.length; i++) {
|
||||||
|
switch (i % 3) {
|
||||||
|
case 0:
|
||||||
|
base64.push(base64map.charAt(bytes[i] >>> 2));
|
||||||
|
overflow = (bytes[i] & 0x3) << 4;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
base64.push(base64map.charAt(overflow | (bytes[i] >>> 4)));
|
||||||
|
overflow = (bytes[i] & 0xF) << 2;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
base64.push(base64map.charAt(overflow | (bytes[i] >>> 6)));
|
||||||
|
base64.push(base64map.charAt(bytes[i] & 0x3F));
|
||||||
|
overflow = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Encode overflow bits, if there are any
|
||||||
|
if (overflow != undefined && overflow != -1)
|
||||||
|
base64.push(base64map.charAt(overflow));
|
||||||
|
|
||||||
|
// Add padding
|
||||||
|
while (base64.length % 4 != 0) base64.push("=");
|
||||||
|
|
||||||
|
return base64.join("");
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
// Convert a base-64 string to a byte array
|
||||||
|
base64ToBytes: function (base64) {
|
||||||
|
|
||||||
|
// Use browser-native function if it exists
|
||||||
|
if (typeof atob == "function") return util.stringToBytes(atob(base64));
|
||||||
|
|
||||||
|
// Remove non-base-64 characters
|
||||||
|
base64 = base64.replace(/[^A-Z0-9+\/]/ig, "");
|
||||||
|
|
||||||
|
var bytes = [];
|
||||||
|
|
||||||
|
for (var i = 0; i < base64.length; i++) {
|
||||||
|
switch (i % 4) {
|
||||||
|
case 1:
|
||||||
|
bytes.push((base64map.indexOf(base64.charAt(i - 1)) << 2) |
|
||||||
|
(base64map.indexOf(base64.charAt(i)) >>> 4));
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
bytes.push(((base64map.indexOf(base64.charAt(i - 1)) & 0xF) << 4) |
|
||||||
|
(base64map.indexOf(base64.charAt(i)) >>> 2));
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
bytes.push(((base64map.indexOf(base64.charAt(i - 1)) & 0x3) << 6) |
|
||||||
|
(base64map.indexOf(base64.charAt(i))));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return bytes;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// Crypto mode namespace
|
||||||
|
Crypto.mode = {};
|
||||||
|
|
||||||
|
})();
|
||||||
|
|
||||||
|
module.exports = Crypto;
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
const Crypto = require('./crypto.js');
|
||||||
|
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
// Shortcut
|
||||||
|
var util = Crypto.util;
|
||||||
|
|
||||||
|
Crypto.HMAC = function (hasher, message, key, options) {
|
||||||
|
|
||||||
|
// Allow arbitrary length keys
|
||||||
|
key = key.length > hasher._blocksize * 4 ?
|
||||||
|
hasher(key, { asBytes: true }) :
|
||||||
|
util.stringToBytes(key);
|
||||||
|
|
||||||
|
// XOR keys with pad constants
|
||||||
|
var okey = key,
|
||||||
|
ikey = key.slice(0);
|
||||||
|
for (var i = 0; i < hasher._blocksize * 4; i++) {
|
||||||
|
okey[i] ^= 0x5C;
|
||||||
|
ikey[i] ^= 0x36;
|
||||||
|
}
|
||||||
|
|
||||||
|
var hmacbytes = hasher(util.bytesToString(okey) +
|
||||||
|
hasher(util.bytesToString(ikey) + message, { asString: true }),
|
||||||
|
{ asBytes: true });
|
||||||
|
return options && options.asBytes ? hmacbytes :
|
||||||
|
options && options.asString ? util.bytesToString(hmacbytes) :
|
||||||
|
util.bytesToHex(hmacbytes);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
})();
|
||||||
|
|
||||||
|
module.exports = Crypto;
|
||||||
|
|
@ -0,0 +1,79 @@
|
||||||
|
const Crypto = require('./crypto.js');
|
||||||
|
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
// Shortcut
|
||||||
|
var util = Crypto.util;
|
||||||
|
|
||||||
|
// Public API
|
||||||
|
var SHA1 = Crypto.SHA1 = function (message, options) {
|
||||||
|
var digestbytes = util.wordsToBytes(SHA1._sha1(message));
|
||||||
|
return options && options.asBytes ? digestbytes :
|
||||||
|
options && options.asString ? util.bytesToString(digestbytes) :
|
||||||
|
util.bytesToHex(digestbytes);
|
||||||
|
};
|
||||||
|
|
||||||
|
// The core
|
||||||
|
SHA1._sha1 = function (message) {
|
||||||
|
|
||||||
|
var m = util.stringToWords(message),
|
||||||
|
l = message.length * 8,
|
||||||
|
w = [],
|
||||||
|
H0 = 1732584193,
|
||||||
|
H1 = -271733879,
|
||||||
|
H2 = -1732584194,
|
||||||
|
H3 = 271733878,
|
||||||
|
H4 = -1009589776;
|
||||||
|
|
||||||
|
// Padding
|
||||||
|
m[l >> 5] |= 0x80 << (24 - l % 32);
|
||||||
|
m[((l + 64 >>> 9) << 4) + 15] = l;
|
||||||
|
|
||||||
|
for (var i = 0; i < m.length; i += 16) {
|
||||||
|
|
||||||
|
var a = H0,
|
||||||
|
b = H1,
|
||||||
|
c = H2,
|
||||||
|
d = H3,
|
||||||
|
e = H4;
|
||||||
|
|
||||||
|
for (var j = 0; j < 80; j++) {
|
||||||
|
|
||||||
|
if (j < 16) w[j] = m[i + j];
|
||||||
|
else {
|
||||||
|
var n = w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16];
|
||||||
|
w[j] = (n << 1) | (n >>> 31);
|
||||||
|
}
|
||||||
|
|
||||||
|
var t = ((H0 << 5) | (H0 >>> 27)) + H4 + (w[j] >>> 0) + (
|
||||||
|
j < 20 ? (H1 & H2 | ~H1 & H3) + 1518500249 :
|
||||||
|
j < 40 ? (H1 ^ H2 ^ H3) + 1859775393 :
|
||||||
|
j < 60 ? (H1 & H2 | H1 & H3 | H2 & H3) - 1894007588 :
|
||||||
|
(H1 ^ H2 ^ H3) - 899497514);
|
||||||
|
|
||||||
|
H4 = H3;
|
||||||
|
H3 = H2;
|
||||||
|
H2 = (H1 << 30) | (H1 >>> 2);
|
||||||
|
H1 = H0;
|
||||||
|
H0 = t;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
H0 += a;
|
||||||
|
H1 += b;
|
||||||
|
H2 += c;
|
||||||
|
H3 += d;
|
||||||
|
H4 += e;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return [H0, H1, H2, H3, H4];
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// Package private blocksize
|
||||||
|
SHA1._blocksize = 16;
|
||||||
|
|
||||||
|
})();
|
||||||
|
|
||||||
|
module.exports = Crypto;
|
||||||
|
|
@ -0,0 +1,86 @@
|
||||||
|
const env = require('./config.js'); //配置文件,在这文件里配置你的OSS keyId和KeySecret,timeout:87600;
|
||||||
|
|
||||||
|
const base64 = require('./base64.js');//Base64,hmac,sha1,crypto相关算法
|
||||||
|
require('./hmac.js');
|
||||||
|
require('./sha1.js');
|
||||||
|
const Crypto = require('./crypto.js');
|
||||||
|
|
||||||
|
/*
|
||||||
|
*上传文件到阿里云oss
|
||||||
|
*@param - filePath :图片的本地资源路径
|
||||||
|
*@param - dir:表示要传到哪个目录下
|
||||||
|
*@param - successc:成功回调
|
||||||
|
*@param - failc:失败回调
|
||||||
|
*/
|
||||||
|
const uploadFile = function (filePath, dir, successc, failc) {
|
||||||
|
if (!filePath || filePath.length < 9) {
|
||||||
|
uni.showModal({
|
||||||
|
title: '图片错误',
|
||||||
|
content: '请重试',
|
||||||
|
showCancel: false,
|
||||||
|
})
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//图片名字 可以自行定义, 这里是采用当前的时间戳 + 150内的随机数来给图片命名的
|
||||||
|
const aliyunFileKey = dir + new Date().getTime() + Math.floor(Math.random() * 150) + '.png';
|
||||||
|
|
||||||
|
const aliyunServerURL = env.uploadImageUrl;//OSS地址,需要https
|
||||||
|
const accessid = env.OSSAccessKeyId;
|
||||||
|
const policyBase64 = getPolicyBase64();
|
||||||
|
const signature = getSignature(policyBase64);//获取签名
|
||||||
|
|
||||||
|
uni.uploadFile({
|
||||||
|
url: aliyunServerURL,//开发者服务器 url
|
||||||
|
filePath: filePath,//要上传文件资源的路径
|
||||||
|
name: 'file',//必须填file
|
||||||
|
formData: {
|
||||||
|
'key': aliyunFileKey,
|
||||||
|
'policy': policyBase64,
|
||||||
|
'OSSAccessKeyId': accessid,
|
||||||
|
'signature': signature,
|
||||||
|
'success_action_status': '200',
|
||||||
|
},
|
||||||
|
success: function (res) {
|
||||||
|
console.log(res,45);
|
||||||
|
if (res.statusCode != 200) {
|
||||||
|
failc(new Error('上传错误:' + JSON.stringify(res)))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
successc(aliyunServerURL+'/'+aliyunFileKey);//成功后的路径
|
||||||
|
},
|
||||||
|
fail: function (err) {
|
||||||
|
err.wxaddinfo = aliyunServerURL;
|
||||||
|
failc(err);
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const getPolicyBase64 = function () {
|
||||||
|
let date = new Date();
|
||||||
|
date.setHours(date.getHours() + env.timeout);
|
||||||
|
let srcT = date.toISOString();
|
||||||
|
const policyText = {
|
||||||
|
"expiration": srcT, //设置该Policy的失效时间,超过这个失效时间之后,就没有办法通过这个policy上传文件了
|
||||||
|
"conditions": [
|
||||||
|
["content-length-range", 0, 5 * 1024 * 1024] // 设置上传文件的大小限制,5mb
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
const policyBase64 = base64.encode(JSON.stringify(policyText));
|
||||||
|
console.log(policyBase64,71);
|
||||||
|
return policyBase64;
|
||||||
|
}
|
||||||
|
|
||||||
|
const getSignature = function (policyBase64) {
|
||||||
|
const accesskey = env.AccessKeySecret;
|
||||||
|
|
||||||
|
const bytes = Crypto.HMAC(Crypto.SHA1, policyBase64, accesskey, {
|
||||||
|
asBytes: true
|
||||||
|
});
|
||||||
|
const signature = Crypto.util.bytesToBase64(bytes);
|
||||||
|
console.log(signature,84);
|
||||||
|
return signature;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = uploadFile;
|
||||||
1
main.js
1
main.js
|
|
@ -1,5 +1,6 @@
|
||||||
import App from './App'
|
import App from './App'
|
||||||
import uviewPlus from '@/uni_modules/uview-plus'
|
import uviewPlus from '@/uni_modules/uview-plus'
|
||||||
|
import './framework/bootstrap'
|
||||||
// #ifndef VUE3
|
// #ifndef VUE3
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import './uni.promisify.adaptor'
|
import './uni.promisify.adaptor'
|
||||||
|
|
|
||||||
174
manifest.json
174
manifest.json
|
|
@ -1,72 +1,106 @@
|
||||||
{
|
{
|
||||||
"name" : "wepp",
|
"name": "wepp",
|
||||||
"appid" : "__UNI__9EC799C",
|
"appid": "__UNI__9EC799C",
|
||||||
"description" : "",
|
"description": "",
|
||||||
"versionName" : "1.0.0",
|
"versionName": "1.0.0",
|
||||||
"versionCode" : "100",
|
"versionCode": "100",
|
||||||
"transformPx" : false,
|
"transformPx": false,
|
||||||
/* 5+App特有相关 */
|
/* 5+App特有相关 */
|
||||||
"app-plus" : {
|
"app-plus": {
|
||||||
"usingComponents" : true,
|
"usingComponents": true,
|
||||||
"nvueStyleCompiler" : "uni-app",
|
"nvueStyleCompiler": "uni-app",
|
||||||
"compilerVersion" : 3,
|
"compilerVersion": 3,
|
||||||
"splashscreen" : {
|
"splashscreen": {
|
||||||
"alwaysShowBeforeRender" : true,
|
"alwaysShowBeforeRender": true,
|
||||||
"waiting" : true,
|
"waiting": true,
|
||||||
"autoclose" : true,
|
"autoclose": true,
|
||||||
"delay" : 0
|
"delay": 0
|
||||||
},
|
},
|
||||||
/* 模块配置 */
|
/* 模块配置 */
|
||||||
"modules" : {},
|
"modules": {},
|
||||||
/* 应用发布信息 */
|
/* 应用发布信息 */
|
||||||
"distribute" : {
|
"distribute": {
|
||||||
/* android打包配置 */
|
/* android打包配置 */
|
||||||
"android" : {
|
"android": {
|
||||||
"permissions" : [
|
"permissions": [
|
||||||
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
||||||
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
||||||
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
/* ios打包配置 */
|
/* ios打包配置 */
|
||||||
"ios" : {},
|
"ios": {},
|
||||||
/* SDK配置 */
|
/* SDK配置 */
|
||||||
"sdkConfigs" : {}
|
"sdkConfigs": {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/* 快应用特有相关 */
|
/* 快应用特有相关 */
|
||||||
"quickapp" : {},
|
"quickapp": {},
|
||||||
/* 小程序特有相关 */
|
/* 小程序特有相关 */
|
||||||
"mp-weixin" : {
|
"mp-weixin": {
|
||||||
"appid" : "",
|
"appid": "wxd88fffa983758a30",
|
||||||
"setting" : {
|
"setting": {
|
||||||
"urlCheck" : false
|
"urlCheck": false,
|
||||||
},
|
"minified": true,
|
||||||
"usingComponents" : true
|
"es6": true,
|
||||||
},
|
"postcss": true
|
||||||
"mp-alipay" : {
|
},
|
||||||
"usingComponents" : true
|
"usingComponents": true,
|
||||||
},
|
"libVersion": "latest",
|
||||||
"mp-baidu" : {
|
"permission": {
|
||||||
"usingComponents" : true
|
"scope.userLocation": {
|
||||||
},
|
"desc": "你的位置信息将用于小程序位置接口的效果展示"
|
||||||
"mp-toutiao" : {
|
}
|
||||||
"usingComponents" : true
|
},
|
||||||
},
|
"requiredPrivateInfos": ["getLocation", "onLocationChange", "chooseLocation", "chooseAddress"]
|
||||||
"uniStatistics" : {
|
},
|
||||||
"enable" : false
|
"h5": {
|
||||||
},
|
"devServer": {
|
||||||
"vueVersion" : "3"
|
"https": false,
|
||||||
|
"disableHostCheck": false,
|
||||||
|
"proxy": {
|
||||||
|
"/api": {
|
||||||
|
// "target": "https://wxcashiertest.sxczgkj.cn",
|
||||||
|
// "target" : "https://ky.sxczgkj.cn",
|
||||||
|
"target": "https://cashier.sxczgkj.cn",
|
||||||
|
"ws": false,
|
||||||
|
"changeOrigin": true, //是否跨域
|
||||||
|
"secure": false, // 设置支持https协议的代理
|
||||||
|
"pathRewrite": {
|
||||||
|
"^/api": "" //需要rewrite重写的,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"template": "template.h5.html",
|
||||||
|
"router": {
|
||||||
|
"mode": "history",
|
||||||
|
"base": "/h5/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mp-alipay": {
|
||||||
|
"usingComponents": true
|
||||||
|
},
|
||||||
|
"mp-baidu": {
|
||||||
|
"usingComponents": true
|
||||||
|
},
|
||||||
|
"mp-toutiao": {
|
||||||
|
"usingComponents": true
|
||||||
|
},
|
||||||
|
"uniStatistics": {
|
||||||
|
"enable": false
|
||||||
|
},
|
||||||
|
"vueVersion": "3"
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,216 @@
|
||||||
|
<template>
|
||||||
|
<view class="onecontent flex-between">
|
||||||
|
<view class="onecontentleft">
|
||||||
|
现有<text style="color: #FC851E;font-size: 24rpx;">
|
||||||
|
{{bannervo.coupons==null?116:bannervo.coupons}}人
|
||||||
|
</text>
|
||||||
|
已免单
|
||||||
|
</view>
|
||||||
|
<view class="onecontentright flex-start">
|
||||||
|
<view class="onecontentrightimage">
|
||||||
|
<view class="swiperPanel" @touchstart="startMove" @touchend="endMove">
|
||||||
|
<view class="swiperItem" v-for="(item, index) in bannervo.counponsInfo" :key="index"
|
||||||
|
:style="{transform: itemStyle[index].transform, zIndex: itemStyle[index].zIndex, opacity: itemStyle[index].opacity}">
|
||||||
|
<view class="children">
|
||||||
|
<image class="pic" :src="item.logo"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="onecontentrighttext">
|
||||||
|
<swiper class="swiper" circular :autoplay="true" :vertical='true' :interval="2000">
|
||||||
|
<swiper-item class="swiperitem" v-for="(item,index) in bannervo.counponsInfo" :key="index">
|
||||||
|
{{item.name}}已省{{item.money}}元钱
|
||||||
|
</swiper-item>
|
||||||
|
</swiper>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 小内切圆 -->
|
||||||
|
<view class="after"></view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {
|
||||||
|
defineProps
|
||||||
|
} from 'vue';
|
||||||
|
const props = defineProps({
|
||||||
|
bannervo: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({}) //
|
||||||
|
},
|
||||||
|
itemStyle: {
|
||||||
|
type: Array,
|
||||||
|
default: () => [{
|
||||||
|
transform: 'scale(' + (1) + ') translate(-' + (0 * 20) + '%,0px)',
|
||||||
|
zIndex: 9999,
|
||||||
|
opacity: 1
|
||||||
|
}] //
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const timersetIntervalnewVal = () => {
|
||||||
|
this.timersetInterval = setInterval(() => {
|
||||||
|
this.endMove()
|
||||||
|
}, 2000);
|
||||||
|
}
|
||||||
|
|
||||||
|
const startMove = () => {
|
||||||
|
this.slideNote.x = e.changedTouches[0] ? e.changedTouches[0].pageX : 0;
|
||||||
|
this.slideNote.y = e.changedTouches[0] ? e.changedTouches[0].pageY : 0;
|
||||||
|
}
|
||||||
|
const endMove = (e) => {
|
||||||
|
// this.itemStyless = []
|
||||||
|
var newList = JSON.parse(JSON.stringify(this.itemStyle))
|
||||||
|
// console.log(newList)
|
||||||
|
// if ((e.changedTouches[0].pageX - this.slideNote.x) < 0) {
|
||||||
|
// 向左滑动
|
||||||
|
var last = [newList.pop()]
|
||||||
|
newList = last.concat(newList)
|
||||||
|
// } else {
|
||||||
|
// 向右滑动
|
||||||
|
// newList.push(newList[0])
|
||||||
|
// newList.splice(0, 1)
|
||||||
|
// }
|
||||||
|
this.$emit('changeValue', newList);
|
||||||
|
|
||||||
|
this.$forceUpdate();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.onecontent {
|
||||||
|
position: relative;
|
||||||
|
margin-top: -34rpx;
|
||||||
|
padding: 14rpx 28rpx 44rpx 28rpx;
|
||||||
|
width: 100%;
|
||||||
|
background: linear-gradient(92deg, #FCECAA 0%, #fff 100%);
|
||||||
|
border-radius: 40rpx 0rpx 0rpx 0rpx;
|
||||||
|
|
||||||
|
.onecontentleft {
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #333333;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
text {
|
||||||
|
color: #FC851E;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.onecontentright {
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #333333;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
.onecontentrightimage {
|
||||||
|
width: 65rpx;
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
height: 28rpx;
|
||||||
|
margin-right: 10rpx;
|
||||||
|
|
||||||
|
.swiperPanel {
|
||||||
|
height: 28rpx;
|
||||||
|
width: 100rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
.swiperItem {
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
transition: all .5s;
|
||||||
|
|
||||||
|
/* 定义一个动画关键帧 */
|
||||||
|
|
||||||
|
|
||||||
|
.children {
|
||||||
|
height: 100%;
|
||||||
|
width: 25%;
|
||||||
|
// margin: 2rpx auto;
|
||||||
|
|
||||||
|
|
||||||
|
/* 应用动画,设置动画时长、循环次数和速度曲线 */
|
||||||
|
.pic {
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
border-radius: 50%;
|
||||||
|
// box-shadow: 0 0 10px #333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.onecontentrightimageabsolute {
|
||||||
|
width: 100%;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
position: absolute;
|
||||||
|
z-index: 9;
|
||||||
|
height: 28rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.onecontentrightimageabsolutetow {
|
||||||
|
width: 100%;
|
||||||
|
left: 14rpx;
|
||||||
|
top: 0;
|
||||||
|
position: absolute;
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
// .onecontentrightswiper {
|
||||||
|
// border: 50%;
|
||||||
|
// width: 28rpx;
|
||||||
|
// height: 28rpx;
|
||||||
|
// background: red;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
.onecontentrighttext {
|
||||||
|
width: 232rpx;
|
||||||
|
|
||||||
|
.swiper {
|
||||||
|
height: 28rpx;
|
||||||
|
// width: 232rpx;
|
||||||
|
|
||||||
|
.swiperitem {
|
||||||
|
width: 100rpx;
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 20rpx;
|
||||||
|
color: #333333;
|
||||||
|
overflow: hidden; //超出的文本隐藏
|
||||||
|
text-overflow: ellipsis; //溢出用省略号显示
|
||||||
|
white-space: nowrap; //溢出不换行
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.after {
|
||||||
|
position: absolute;
|
||||||
|
top: -40rpx;
|
||||||
|
right: 0rpx;
|
||||||
|
width: 40rpx;
|
||||||
|
height: 40rpx;
|
||||||
|
line-height: 40rpx;
|
||||||
|
text-align: center;
|
||||||
|
background-image: radial-gradient(160rpx at 0px 0px, rgba(0, 0, 0, 0) 40rpx, #fff 40rpx);
|
||||||
|
z-index: 9999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,115 @@
|
||||||
|
<template>
|
||||||
|
<view class="fourcontent flex-between">
|
||||||
|
<view class="fourcontent_item flex-start" v-for="(item,index) in menu" :key="index"
|
||||||
|
@click="viewHistorycategoryss(item,index)"
|
||||||
|
:class="!item.isChild && viewHistoryindex == index ? 'fourcontent_itemactev':''">
|
||||||
|
<text>{{item.name}}</text>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
menu: {
|
||||||
|
type: Array,
|
||||||
|
default () {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
type: String,
|
||||||
|
default: '每日特价'
|
||||||
|
},
|
||||||
|
viewHistoryindex: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
viewHistorycategoryss(item, index) {
|
||||||
|
console.log(item, index)
|
||||||
|
uni.$emit('viewHistory', {
|
||||||
|
item:item,
|
||||||
|
index:index
|
||||||
|
});
|
||||||
|
},
|
||||||
|
clickdistrict(item) {
|
||||||
|
switch (item.jumpType) {
|
||||||
|
case 'absolute':
|
||||||
|
uni.pro.navigateTo('webview/webview', {
|
||||||
|
url: item.absUrl
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'relative':
|
||||||
|
uni.pro.navigateTo(item.absUrl, item);
|
||||||
|
break;
|
||||||
|
case 'scan':
|
||||||
|
if (!uni.utils.pluschooseImage()) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
// #ifdef H5
|
||||||
|
if (this.wxSdk) {
|
||||||
|
wx.scanQRCode({
|
||||||
|
needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
|
||||||
|
scanType: ['qrCode', 'barCode'], // 可以指定扫二维码还是一维码,默认二者都有
|
||||||
|
success: res => {
|
||||||
|
// 当needResult 为 1 时,扫码返回的结果
|
||||||
|
console.log(res.resultStr, res)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
uni.showModal({
|
||||||
|
title: '注意',
|
||||||
|
content: '微信sdk初始化失败,请重新加载',
|
||||||
|
success: res => {
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
// #ifdef APP || MP-WEIXIN
|
||||||
|
uni.scanCode({
|
||||||
|
success: res => {
|
||||||
|
console.log(res.result, res)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// #endif
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.fourcontent {
|
||||||
|
padding: 32rpx 28rpx 32rpx 28rpx;
|
||||||
|
overflow-x: auto;
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
|
||||||
|
.fourcontent_item {
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
margin-left: 22rpx;
|
||||||
|
padding: 4rpx 14rpx;
|
||||||
|
background: #FFFFFF;
|
||||||
|
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
||||||
|
|
||||||
|
text {
|
||||||
|
width: max-content;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.fourcontent_itemactev {
|
||||||
|
background: #fee06a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fourcontent_item:nth-child(1) {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,113 @@
|
||||||
|
<template>
|
||||||
|
<view class="towcontent flex-between">
|
||||||
|
<view class="towcontent_item flex-colum" v-for="(item,index) in district" :key="index"
|
||||||
|
@click="clickdistrict(item,index)">
|
||||||
|
<image :src="item.coverImg" mode="aspectFill"></image>
|
||||||
|
<text>{{item.name}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {
|
||||||
|
ref,
|
||||||
|
defineProps
|
||||||
|
} from 'vue';
|
||||||
|
const props = defineProps({
|
||||||
|
district: Array
|
||||||
|
});
|
||||||
|
const clickdistrict = (item) => {
|
||||||
|
console.log(item, '调试')
|
||||||
|
switch (item.jumpType) {
|
||||||
|
case 'absolute':
|
||||||
|
uni.pro.navigateTo('webview/webview', {
|
||||||
|
url: item.absUrl
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'scan_applet':
|
||||||
|
uni.navigateToMiniProgram(JSON.parse(item.value))
|
||||||
|
break;
|
||||||
|
case 'relative':
|
||||||
|
uni.setStorage({
|
||||||
|
key: 'itemData',
|
||||||
|
data: item,
|
||||||
|
});
|
||||||
|
uni.pro.navigateTo(item.absUrl, item.name);
|
||||||
|
break;
|
||||||
|
case 'scan':
|
||||||
|
if (!uni.utils.pluschooseImage()) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
// #ifdef APP || MP-WEIXIN || MP-ALIPAY
|
||||||
|
uni.scanCode({
|
||||||
|
success: async (res) => {
|
||||||
|
let tableCode = getQueryString(decodeURIComponent(res.result), 'code')
|
||||||
|
uni.cache.set('tableCode', tableCode)
|
||||||
|
if (tableCode) {
|
||||||
|
let data = await this.api.productqueryShop({
|
||||||
|
code: uni.cache.get('tableCode'),
|
||||||
|
})
|
||||||
|
if (data.data.shopTableInfo && !data.data.shopTableInfo.choseCount) {
|
||||||
|
uni.pro.navigateTo('/pagesOrder/orderAMeal/index', {
|
||||||
|
tableCode: tableCode,
|
||||||
|
shopId: data.data.storeInfo.id,
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.pro.navigateTo('order_food/order_food', {
|
||||||
|
tableCode: tableCode,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (res) => {
|
||||||
|
console.log(res)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const getQueryString = (url, name) => { //解码
|
||||||
|
var reg = new RegExp('(^|&|/?)' + name + '=([^&|/?]*)(&|/?|$)', 'i')
|
||||||
|
var r = url.substr(1).match(reg)
|
||||||
|
if (r != null) {
|
||||||
|
return r[2]
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.towcontent {
|
||||||
|
position: relative;
|
||||||
|
margin-top: -32rpx;
|
||||||
|
padding: 32rpx 40rpx;
|
||||||
|
width: 100%;
|
||||||
|
background: #F9F9F9;
|
||||||
|
border-radius: 48rpx 48rpx 0rpx 0rpx;
|
||||||
|
overflow-x: auto;
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
box-sizing: border-box;
|
||||||
|
.towcontent_item {
|
||||||
|
width: 25%;
|
||||||
|
margin-left: 34rpx;
|
||||||
|
image {
|
||||||
|
width: 92rpx;
|
||||||
|
height: 92rpx;
|
||||||
|
}
|
||||||
|
text {
|
||||||
|
margin-top: 16rpx;
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333333;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.towcontent_item:nth-child(1) {
|
||||||
|
margin-left: 0rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,309 @@
|
||||||
|
<template>
|
||||||
|
<!-- #ifndef APP-PLUS || MP-WEIXIN -->
|
||||||
|
<view class="fivecontent">
|
||||||
|
<!-- #endif -->
|
||||||
|
<!-- #ifdef MP-WEIXIN -->
|
||||||
|
<view class="fivecontent" :style="isFixedTop?`margin-top:${HeighT.heightBar}px`:''">
|
||||||
|
<!-- #endif -->
|
||||||
|
<!-- #ifdef APP-PLUS -->
|
||||||
|
<view class="fivecontent" :class="{statusbarmargin:isFixedTop}">
|
||||||
|
<!-- #endif -->
|
||||||
|
<view class="fivecontent_item" v-for="(item,index) in 12" :key="index">
|
||||||
|
<view class="fivecontent_item_nav flex-start">
|
||||||
|
<image src="@/static/avatar.png" mode="aspectFill"></image>
|
||||||
|
<view class="fivecontent_item_nav_left">
|
||||||
|
<view class="fivecontent_item_nav_lefttop flex-between">
|
||||||
|
<view>
|
||||||
|
幸运咖啡(荣民时代广场店)
|
||||||
|
</view>
|
||||||
|
<view>
|
||||||
|
龙首.151m
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="fivecontent_item_nav_leftlang flex-start">
|
||||||
|
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/hong_h.png"
|
||||||
|
mode="aspectFill"></image>
|
||||||
|
<text>人气连锁品牌</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="fivecontent_item_box">
|
||||||
|
<view class="fivecontent_item_boxitem flex-between">
|
||||||
|
<image src="@/static/avatar.png" mode=""></image>
|
||||||
|
<view class="fivecontent_item_boxitemleft flex-colum-start">
|
||||||
|
<view class="fivecontent_item_boxitemleftone flex-between">
|
||||||
|
<view>全场饮品任选</view>
|
||||||
|
<text>已抢15789份</text>
|
||||||
|
</view>
|
||||||
|
<view class="fivecontent_item_boxitemlefttow flex-start">
|
||||||
|
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/hong_h.png"
|
||||||
|
mode="aspectFill"></image>
|
||||||
|
<text>人气连锁品牌</text>
|
||||||
|
</view>
|
||||||
|
<view class="indexboxitemleftthere flex-colum-start">
|
||||||
|
<view class="indexboxitemleftthereabsolute">
|
||||||
|
马上抢
|
||||||
|
</view>
|
||||||
|
<view class="indexboxitemlefttheretext flex-start">
|
||||||
|
<view class="indexboxitemlefttheretextone">
|
||||||
|
<text>¥</text>
|
||||||
|
<text>1444</text>
|
||||||
|
</view>
|
||||||
|
<view class="indexboxitemlefttheretexttow">
|
||||||
|
¥111
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
<view class="indexboxitemleftthere_countdown flex-between">
|
||||||
|
<text class="indexboxitemleftthere_countdowntext">共省4元</text>
|
||||||
|
<view class="indexboxitemleftthere_countdowntexts">
|
||||||
|
<uni-countdown :show-day="false" :day="1" :hour="1" :minute="12"
|
||||||
|
:second="40" color="#FFFFFF" border-color="#00B26A"
|
||||||
|
splitorColor="#FFFFFF" :font-size="8"></uni-countdown>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
isFixedTop: false, //吸顶是否显示
|
||||||
|
Topdistance: 3000, //吸顶初始距离
|
||||||
|
keyword: '',
|
||||||
|
current: 0,
|
||||||
|
opacity: false,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
onPageScroll(e) {
|
||||||
|
if (e.scrollTop <= 44) { //搜索导航栏
|
||||||
|
this.opacity = false
|
||||||
|
} else {
|
||||||
|
this.opacity = true
|
||||||
|
}
|
||||||
|
if (e.scrollTop >= this.Topdistance) { //类别导航栏
|
||||||
|
this.isFixedTop = true
|
||||||
|
} else {
|
||||||
|
this.isFixedTop = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
HeighT() { //手机类型的尺寸
|
||||||
|
return this.$store.getters.is_BarHeight
|
||||||
|
},
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.GetTop()
|
||||||
|
}, 1000)
|
||||||
|
},
|
||||||
|
onShow() {},
|
||||||
|
methods: {
|
||||||
|
GetTop() {
|
||||||
|
//获取元素距离顶部的距离
|
||||||
|
this.$u.getRect('.fourcontent').then(res => {
|
||||||
|
this.Topdistance = res.top - this.HeighT.heightBar
|
||||||
|
})
|
||||||
|
},
|
||||||
|
viewHistory() {
|
||||||
|
//移动高度=滚动高度 + 距离上面的位置 - 导航条 - 状态栏高度
|
||||||
|
uni.pageScrollTo({
|
||||||
|
scrollTop: this.Topdistance + 1,
|
||||||
|
duration: 300
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.fivecontent {
|
||||||
|
padding: 0 28rpx;
|
||||||
|
|
||||||
|
.fivecontent_item {
|
||||||
|
margin-top: 32rpx;
|
||||||
|
padding: 24rpx 32rpx;
|
||||||
|
width: 100%;
|
||||||
|
background: #FFFFFF;
|
||||||
|
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
||||||
|
|
||||||
|
.fivecontent_item_nav {
|
||||||
|
image {
|
||||||
|
width: 60rpx;
|
||||||
|
height: 60rpx;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fivecontent_item_nav_left {
|
||||||
|
flex: auto;
|
||||||
|
margin-left: 12rpx;
|
||||||
|
|
||||||
|
.fivecontent_item_nav_lefttop {
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #666666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fivecontent_item_nav_leftlang {
|
||||||
|
margin-top: 8rpx;
|
||||||
|
width: max-content;
|
||||||
|
padding: 4rpx 10rpx;
|
||||||
|
background: #FFF9E1;
|
||||||
|
border-radius: 4rpx 4rpx 4rpx 4rpx;
|
||||||
|
|
||||||
|
text {
|
||||||
|
margin-left: 6rpx;
|
||||||
|
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 16rpx;
|
||||||
|
color: #F9A511;
|
||||||
|
}
|
||||||
|
|
||||||
|
image {
|
||||||
|
width: 10.82rpx;
|
||||||
|
height: 14.06rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.fivecontent_item_box {
|
||||||
|
margin-top: 20rpx;
|
||||||
|
border-top: 2rpx solid #E5E5E5;
|
||||||
|
padding-top: 14rpx;
|
||||||
|
|
||||||
|
.fivecontent_item_boxitem {
|
||||||
|
image {
|
||||||
|
width: 192rpx;
|
||||||
|
height: 192rpx;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fivecontent_item_boxitemleft {
|
||||||
|
margin-left: 24rpx;
|
||||||
|
flex: auto;
|
||||||
|
|
||||||
|
.fivecontent_item_boxitemleftone {
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
text {
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
|
||||||
|
view {
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.fivecontent_item_boxitemlefttow {
|
||||||
|
margin-top: 8rpx;
|
||||||
|
width: max-content;
|
||||||
|
padding: 4rpx 10rpx;
|
||||||
|
background: #FFF9E1;
|
||||||
|
border-radius: 4rpx 4rpx 4rpx 4rpx;
|
||||||
|
|
||||||
|
text {
|
||||||
|
margin-left: 6rpx;
|
||||||
|
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 16rpx;
|
||||||
|
color: #F9A511;
|
||||||
|
}
|
||||||
|
|
||||||
|
image {
|
||||||
|
width: 10.82rpx;
|
||||||
|
height: 14.06rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.indexboxitemleftthere {
|
||||||
|
position: relative;
|
||||||
|
margin-top: 30rpx;
|
||||||
|
padding-left: 16rpx;
|
||||||
|
width: 100%;
|
||||||
|
height: 88rpx;
|
||||||
|
background: url(https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/qinggou.png) no-repeat;
|
||||||
|
background-size: 100% 100%;
|
||||||
|
|
||||||
|
.indexboxitemleftthereabsolute {
|
||||||
|
position: absolute;
|
||||||
|
top: 14rpx;
|
||||||
|
right: 12rpx;
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #FFFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.indexboxitemlefttheretext {
|
||||||
|
.indexboxitemlefttheretextone {
|
||||||
|
text {
|
||||||
|
font-family: SourceHanSansCN-Bold, SourceHanSansCN-Bold;
|
||||||
|
font-weight: normal;
|
||||||
|
color: #FF5053;
|
||||||
|
}
|
||||||
|
|
||||||
|
text:nth-child(2) {
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 34rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
text:nth-child(1) {
|
||||||
|
font-size: 24rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.indexboxitemlefttheretexttow {
|
||||||
|
margin-left: 12rpx;
|
||||||
|
font-size: 20rpx;
|
||||||
|
font-family: SourceHanSansCN-Regular, SourceHanSansCN-Regular;
|
||||||
|
font-weight: normal;
|
||||||
|
color: #999999;
|
||||||
|
text-decoration: line-through;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.indexboxitemleftthere_countdown {
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
.indexboxitemleftthere_countdowntext {
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.indexboxitemleftthere_countdowntexts {
|
||||||
|
font-family: Roboto, Roboto;
|
||||||
|
font-weight: 400;
|
||||||
|
color: #333333;
|
||||||
|
margin-left: 16rpx;
|
||||||
|
font-size: 22rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
<template>
|
||||||
|
<view class="viewswiper">
|
||||||
|
<up-swiper :list="carousel" keyName="coverImg" @change="e => current = e.current" indicatorStyle="right: 20px" height='242'>
|
||||||
|
<template #indicator>
|
||||||
|
<view class="indicator">
|
||||||
|
<view class="indicator__dot" v-for="(item, index) in carousel" :key="index"
|
||||||
|
:class="[index === current && 'indicator__dot--active']">
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</up-swiper>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref,defineProps } from 'vue';
|
||||||
|
const props = defineProps({
|
||||||
|
carousel: Array
|
||||||
|
});
|
||||||
|
const current = ref(0)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.viewswiper {
|
||||||
|
.indicator {
|
||||||
|
margin-bottom: 46rpx;
|
||||||
|
@include flex(row);
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
&__dot {
|
||||||
|
height: 6px;
|
||||||
|
width: 6px;
|
||||||
|
border-radius: 100px;
|
||||||
|
background-color: rgba(255, 255, 255, 0.35);
|
||||||
|
margin: 0 5px;
|
||||||
|
transition: background-color 0.3s;
|
||||||
|
|
||||||
|
&--active {
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.indicator-num {
|
||||||
|
padding: 2px 0;
|
||||||
|
background-color: rgba(0, 0, 0, 0.35);
|
||||||
|
border-radius: 100px;
|
||||||
|
width: 35px;
|
||||||
|
@include flex;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
&__text {
|
||||||
|
color: #FFFFFF;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,243 @@
|
||||||
|
<template>
|
||||||
|
<view class="therecontent flex-between">
|
||||||
|
<view class="therecontent_box_item">
|
||||||
|
<view class="therecontent_box_imge flex-between" @click="jrtoday(0)">
|
||||||
|
<view class="therecontent_box_imge_text">
|
||||||
|
{{todayList.name}}
|
||||||
|
</view>
|
||||||
|
<view class="therecontent_box_imge_right flex-start">
|
||||||
|
<view>
|
||||||
|
{{todayList.date}}
|
||||||
|
</view>
|
||||||
|
<up-icon name="arrow-right" color="#666666" size="16"></up-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="therecontent_box_itembox">
|
||||||
|
<view class="therecontent_box_itembox_item flex-between" v-for="(item,index) in todayList.todayList"
|
||||||
|
:key="index" @click="clickproduct(item)">
|
||||||
|
<image :src="`${item.image}?x-oss-process=image/resize,m_lfit,w_114,h_136`" mode="aspectFill">
|
||||||
|
</image>
|
||||||
|
<view class="therecontent_box_itembox_itemview flex-colum-start">
|
||||||
|
<view class="therecontent_box_itembox_itemviewone">
|
||||||
|
<text
|
||||||
|
style="margin-left: 0;">{{item.productName.length>5?item.productName.substring(0,5)+'...':item.productName}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="therecontent_box_itembox_itemviewtow flex-around">
|
||||||
|
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/xia.png" mode="widthFix">
|
||||||
|
</image>
|
||||||
|
<view>
|
||||||
|
{{item.discount || '1'}}折
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="therecontent_box_itembox_itemviewthere ">
|
||||||
|
<text>¥{{item.salePrice}}</text>
|
||||||
|
<text>¥{{item.originPrice}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="therecontent_box_item">
|
||||||
|
<view class="therecontent_box_imge flex-between"
|
||||||
|
style="background: url(https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/towcontent_box2.png) no-repeat; background-size: cover;"
|
||||||
|
@click="jrtoday(1)">
|
||||||
|
<view class="therecontent_box_imge_text">
|
||||||
|
{{salesList.name}}
|
||||||
|
</view>
|
||||||
|
<view class="therecontent_box_imge_right flex-start">
|
||||||
|
<view>
|
||||||
|
{{salesList.date}}
|
||||||
|
</view>
|
||||||
|
<up-icon name="arrow-right" color="#666666" size="16"></up-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="therecontent_box_itembox">
|
||||||
|
<view class="therecontent_box_itembox_item flex-between" v-for="(item,index) in salesList.hotList"
|
||||||
|
:key="index" @click="clickproduct(item)">
|
||||||
|
<image :src="`${item.image}?x-oss-process=image/resize,m_lfit,w_114,h_136`" mode="aspectFill">
|
||||||
|
</image>
|
||||||
|
<view class="therecontent_box_itembox_itemview flex-colum-start">
|
||||||
|
<view class="therecontent_box_itembox_itemviewone flex-start">
|
||||||
|
<view class="therecontent_box_itembox_itemviewoneafter">
|
||||||
|
TOP.{{index + 1}}
|
||||||
|
</view>
|
||||||
|
<text>{{ item.productName.length>5?item.productName.substring(0,5)+'...':item.productName }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="therecontent_box_itembox_itemviewtowdiscount flex-around">
|
||||||
|
已抢{{item.realSalesNumber}}份
|
||||||
|
</view>
|
||||||
|
<view class="therecontent_box_itembox_itemviewthere ">
|
||||||
|
<text>¥{{item.salePrice}}</text>
|
||||||
|
<text>¥{{item.originPrice}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {
|
||||||
|
defineProps
|
||||||
|
} from 'vue';
|
||||||
|
const props = defineProps({
|
||||||
|
salesList: Object,
|
||||||
|
todayList: Object
|
||||||
|
});
|
||||||
|
|
||||||
|
const clickproduct = (item) => {
|
||||||
|
uni.pro.navigateTo('product/index', {
|
||||||
|
id: item.id
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const jrtoday = (e) => {
|
||||||
|
if (e == 0) {
|
||||||
|
uni.pro.navigateTo('index/jtoday')
|
||||||
|
} else {
|
||||||
|
uni.pro.navigateTo('index/hotlist')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.therecontent {
|
||||||
|
padding: 0 28rpx;
|
||||||
|
|
||||||
|
.therecontent_box_item {
|
||||||
|
width: 336rpx;
|
||||||
|
border-radius: 18rpx;
|
||||||
|
background: #FFFFFF;
|
||||||
|
height: 396rpx;
|
||||||
|
|
||||||
|
.therecontent_box_itembox {
|
||||||
|
padding: 10rpx 18rpx 24rpx 24rpx;
|
||||||
|
|
||||||
|
.therecontent_box_itembox_item {
|
||||||
|
margin-top: 20rpx;
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
|
||||||
|
image {
|
||||||
|
width: 114rpx;
|
||||||
|
height: 136rpx;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.therecontent_box_itembox_itemview {
|
||||||
|
margin-left: 12rpx;
|
||||||
|
|
||||||
|
.therecontent_box_itembox_itemviewone {
|
||||||
|
width: 168rpx;
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #333333;
|
||||||
|
|
||||||
|
text {
|
||||||
|
margin-left: 4rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
display: -webkit-box;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
-webkit-line-clamp: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.therecontent_box_itembox_itemviewoneafter {
|
||||||
|
width: 48rpx;
|
||||||
|
height: 24rpx;
|
||||||
|
line-height: 24rpx;
|
||||||
|
text-align: center;
|
||||||
|
background: linear-gradient(116deg, #FF9D2B 0%, #FF4805 100%);
|
||||||
|
border-radius: 4rpx 4rpx 4rpx 4rpx;
|
||||||
|
font-family: Roboto, Roboto;
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 16rpx;
|
||||||
|
color: #FFFFFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.therecontent_box_itembox_itemviewtow {
|
||||||
|
margin-top: 8rpx;
|
||||||
|
width: 60rpx;
|
||||||
|
// padding: 4rpx 10rpx;
|
||||||
|
background: #FFFFFF;
|
||||||
|
border-radius: 4rpx;
|
||||||
|
border: 2rpx solid #FF7127;
|
||||||
|
|
||||||
|
image {
|
||||||
|
width: 9.74rpx;
|
||||||
|
height: 13.51rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
view {
|
||||||
|
padding-right: 2rpx;
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 16rpx;
|
||||||
|
color: #FF7127;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.therecontent_box_itembox_itemviewtowdiscount {
|
||||||
|
margin-top: 10rpx;
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 16rpx;
|
||||||
|
color: #FF7127;
|
||||||
|
}
|
||||||
|
|
||||||
|
.therecontent_box_itembox_itemviewthere {
|
||||||
|
// margin-top: 4rpx;
|
||||||
|
// align-items: flex-end;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
text:nth-child(1) {
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: Bold;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #FF7127;
|
||||||
|
}
|
||||||
|
|
||||||
|
text:nth-child(2) {
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 16rpx;
|
||||||
|
color: #999999;
|
||||||
|
text-decoration-line: line-through;
|
||||||
|
margin-top: 4rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.therecontent_box_itembox_item:nth-child(1) {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.therecontent_box_imge {
|
||||||
|
padding: 24rpx 16rpx 6rpx 24rpx;
|
||||||
|
background: url(https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/towcontent_box1.png) no-repeat;
|
||||||
|
width: 100%;
|
||||||
|
height: 70rpx;
|
||||||
|
background-size: cover;
|
||||||
|
|
||||||
|
.therecontent_box_imge_text {
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.therecontent_box_imge_right {
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
// font-weight: 500;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #666666;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -1,7 +1,124 @@
|
||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<Nav />
|
<Nav />
|
||||||
<view class="content">页面内容</view>
|
<view class="content">
|
||||||
|
<!-- 轮播图 -->
|
||||||
|
<swipers :carousel='hometoplist.carousel'></swipers>
|
||||||
|
<!-- 广告 -->
|
||||||
|
<advertisement :bannervo='hometoplist.bannerVO' :itemStyle='advertisementStyle'></advertisement>
|
||||||
|
<!-- 金刚区 -->
|
||||||
|
<diamond :district='hometoplist.district'></diamond>
|
||||||
|
<!-- 今日上线 -->
|
||||||
|
<todaylist :todayList='hometoplist.todayList' :salesList='hometoplist.salesList'></todaylist>
|
||||||
|
<!-- 类目 -->
|
||||||
|
<!-- #ifdef MP-WEIXIN -->
|
||||||
|
<!-- 只有小程序需要加height -->
|
||||||
|
<up-sticky :offset-top="store.height">
|
||||||
|
<!-- #endif -->
|
||||||
|
<!-- #ifndef MP-WEIXIN -->
|
||||||
|
<up-sticky>
|
||||||
|
<!-- #endif -->
|
||||||
|
<view class="fourcontent" id="fourcontent">
|
||||||
|
<view class="flex-between" style="flex-wrap: inherit;">
|
||||||
|
<view class="fourcontent_item flex-start" v-for="(item,index) in hometoplist.menu"
|
||||||
|
:key="index" @click="viewHistory(item,index)"
|
||||||
|
:class="!item.isChild && index ? 'fourcontent_itemactev':''">
|
||||||
|
<!-- <view class="fourcontent_item flex-start" v-for="(item,index) in hometoplist.menu" :key="index"
|
||||||
|
@click="viewHistory(item,index)"
|
||||||
|
:class="!item.isChild && viewHistoryindex == index ? 'fourcontent_itemactev':''"> -->
|
||||||
|
<text style="margin-right: 10rpx;">{{item.name}}</text>
|
||||||
|
<up-icon v-if="item.isChild" style="margin-left: 10rpx;" name="arrow-down-fill"
|
||||||
|
color="#333333" size="12"></up-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</up-sticky>
|
||||||
|
|
||||||
|
<!-- 首页抢购区域 -->
|
||||||
|
<view class="fivecontent">
|
||||||
|
<view class="fivecontent_item" v-for="(item,index) in homelist" :key="index"
|
||||||
|
@click="fivecontentclick(item)">
|
||||||
|
<view class="fivecontent_item_nav flex-start">
|
||||||
|
<image :src="item.shopImage" mode="aspectFill"></image>
|
||||||
|
<view class="fivecontent_item_nav_left">
|
||||||
|
<view class="fivecontent_item_nav_lefttop flex-between">
|
||||||
|
<view>
|
||||||
|
{{item.shopName}}
|
||||||
|
</view>
|
||||||
|
<view>
|
||||||
|
{{item.districts}} {{item.distances}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="fivecontent_item_nav_lefttopstart flex-start">
|
||||||
|
<view class="fivecontent_item_nav_leftlang flex-start"
|
||||||
|
v-for="(s,index1) in item.shopTag" :key="index1"
|
||||||
|
:style="{'background':s.backColor,'color':s.backColor}">
|
||||||
|
<image class="fivecontent_item_nav_leftlangimage" v-if="s.shareImg"
|
||||||
|
:src="s.shareImg" mode="aspectFill"></image>
|
||||||
|
<text class="fivecontent_item_nav_leftlangtext">{{s.name}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="fivecontent_item_box">
|
||||||
|
<view class="fivecontent_item_boxitem flex-between">
|
||||||
|
<image :src="`${item.image}?x-oss-process=image/resize,m_lfit,w_192,h_192`"
|
||||||
|
mode="aspectFill"></image>
|
||||||
|
<view class="fivecontent_item_boxitemleft flex-colum-start">
|
||||||
|
<view class="fivecontent_item_boxitemleftone flex-between"
|
||||||
|
style="display: flex;justify-content: space-between;align-items: center;">
|
||||||
|
<view>
|
||||||
|
{{item.productName.length>7?item.productName.substring(0,7)+'...':item.productName}}
|
||||||
|
</view>
|
||||||
|
<text>已抢{{item.realSalesNumber}}份</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex-start flexstartboxfttow">
|
||||||
|
<view class="fivecontent_item_boxitemlefttow flex-start"
|
||||||
|
v-for="(c,index2) in item.proTag" :key="index2"
|
||||||
|
:style="{'background':c.backColor,'color':c.backColor}">
|
||||||
|
<image class="fivecontent_item_boxitemlefttowimage" v-if="c.shareImg"
|
||||||
|
:src="c.shareImg" mode="aspectFill"></image>
|
||||||
|
<text class="fivecontent_item_boxitemlefttowtext">{{c.name}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="indexboxitemleftthere flex-colum-start">
|
||||||
|
<view class="indexboxitemleftthereabsolute">
|
||||||
|
马上抢
|
||||||
|
</view>
|
||||||
|
<view class="indexboxitemlefttheretext flex-start">
|
||||||
|
<view class="fivecontent_item_boxitemlefthere_one flex-start">
|
||||||
|
<text class="flex_startone">到手</text>
|
||||||
|
<text class="flex_starttow">¥{{item.salePrice}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="fivecontent_item_boxitemlefthere_tow">
|
||||||
|
{{item.discount || ''}}折
|
||||||
|
</view>
|
||||||
|
<view class="fivecontent_item_boxitemlefthere_there">
|
||||||
|
¥{{item.originPrice}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="indexboxitemleftthere_countdown flex-between">
|
||||||
|
<text class="indexboxitemleftthere_countdowntext">共省{{item.save}}元</text>
|
||||||
|
<view class="indexboxitemleftthere_countdowntexts">
|
||||||
|
<!-- <uni-countdown @timeup="updateCity" :show-day="false"
|
||||||
|
:day="item.end_times.d" :hour="item.end_times.h"
|
||||||
|
:minute="item.end_times.m" :second="item.end_times.s" :indexs='index'
|
||||||
|
color="#FFFFFF" border-color="#00B26A" splitorColor="#FFFFFF"
|
||||||
|
:font-size="10"></uni-countdown> -->
|
||||||
|
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<up-loadmore height='40' :status="form.status" iconSize='16' fontSize='16' />
|
||||||
|
<!-- </scroll-view> -->
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -9,42 +126,437 @@
|
||||||
import {
|
import {
|
||||||
ref,
|
ref,
|
||||||
computed,
|
computed,
|
||||||
onMounted
|
onMounted,
|
||||||
|
reactive
|
||||||
} from "vue";
|
} from "vue";
|
||||||
import {
|
import {
|
||||||
onLoad,
|
onLoad,
|
||||||
onReady,
|
onReady,
|
||||||
onShow
|
onShow,
|
||||||
|
onPageScroll
|
||||||
} from '@dcloudio/uni-app'
|
} from '@dcloudio/uni-app'
|
||||||
import Nav from '@/components/indexnav.vue';
|
import swipers from './components/swiper.vue' //引入轮播
|
||||||
|
import advertisement from './components/advertisement.vue' //广告
|
||||||
|
import diamond from './components/diamond.vue' //金刚区
|
||||||
|
import todaylist from './components/todaylist.vue' //今日上线
|
||||||
|
// import popupad from '@/components/popupad.vue'
|
||||||
|
// import productlist from './components/productlist.vue'
|
||||||
|
// import category from '@/components/qiyue-category/qiyue-category.vue';
|
||||||
|
// import indexs from './indexs.vue';
|
||||||
|
import Nav from '@/components/indexnav.vue'; //导航栏
|
||||||
|
import API from "@/common/js/api.js"
|
||||||
import {
|
import {
|
||||||
useNavbarStore
|
useNavbarStore
|
||||||
} from '@/stores/navbarStore';
|
} from '@/stores/navbarStore';
|
||||||
|
|
||||||
const store = useNavbarStore();
|
const store = useNavbarStore();
|
||||||
|
|
||||||
// 动态更新导航栏配置
|
// 动态更新导航栏配置
|
||||||
store.updateNavbarConfig({
|
store.updateNavbarConfig({
|
||||||
showBack: false,
|
showBack: true, //左边返回键
|
||||||
rightText: '',
|
rightText: '', //右边文字
|
||||||
showSearch: true,
|
showSearch: true, //true是标题其他事文字
|
||||||
title: '我的页面',
|
title: '我的页面',
|
||||||
isTransparent: false,
|
isTransparent: false,
|
||||||
hasPlaceholder: true
|
hasPlaceholder: false //是否要占位符
|
||||||
});
|
});
|
||||||
// store.updateNavbarConfig({
|
//数据
|
||||||
// showBack: true,//左边返回键
|
const hometoplist = reactive({})
|
||||||
// rightText: '',//右边文字
|
// 首页抢购数据
|
||||||
// showSearch: true,//true是标题其他事文字
|
const form = ref({
|
||||||
// title: '我的页面',
|
address: '', //地址
|
||||||
// isTransparent: false,
|
type: '', //品类
|
||||||
// height: 44,
|
orderBy: '', //1.理我最近 2.销量优先 3.价格优先
|
||||||
// hasPlaceholder: false//是否要占位符
|
other: '', //附近1KM 1选中 0不选中
|
||||||
// });
|
page: 1, //页数
|
||||||
|
size: 10, //页容量
|
||||||
|
status: 'loadmore'
|
||||||
|
})
|
||||||
|
const homelist = ref([{
|
||||||
|
endRow: 1,
|
||||||
|
firstPage: 1,
|
||||||
|
hasNextPage: false,
|
||||||
|
hasPreviousPage: false,
|
||||||
|
isFirstPage: true,
|
||||||
|
isLastPage: true,
|
||||||
|
lastPage: 1,
|
||||||
|
list: [{
|
||||||
|
discount: 9,
|
||||||
|
distances: "1.1km",
|
||||||
|
districts: "未央区",
|
||||||
|
endTime: 1739059199999,
|
||||||
|
id: 661,
|
||||||
|
image: "https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/20240612/0c07e1f79a244ed498dfe4a70848c479.jpeg",
|
||||||
|
originPrice: 200,
|
||||||
|
proTag: [],
|
||||||
|
productName: "鸡尾酒套餐",
|
||||||
|
realSalesNumber: 0,
|
||||||
|
salePrice: 180,
|
||||||
|
save: 20,
|
||||||
|
shopImage: "https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/20240612/6f3618a31d2a4b489215647871ae732e.jpg",
|
||||||
|
shopName: "漫巷咖啡",
|
||||||
|
shopTag: [],
|
||||||
|
}],
|
||||||
|
discount: 9,
|
||||||
|
distances: "1.1km",
|
||||||
|
districts: "未央区",
|
||||||
|
endTime: 1739059199999,
|
||||||
|
id: 661,
|
||||||
|
image: "https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/20240612/0c07e1f79a244ed498dfe4a70848c479.jpeg",
|
||||||
|
originPrice: 200,
|
||||||
|
proTag: [],
|
||||||
|
productName: "鸡尾酒套餐",
|
||||||
|
realSalesNumber: 0,
|
||||||
|
salePrice: 180,
|
||||||
|
save: 20,
|
||||||
|
shopImage: "https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/20240612/6f3618a31d2a4b489215647871ae732e.jpg",
|
||||||
|
shopName: "漫巷咖啡",
|
||||||
|
shopTag: [],
|
||||||
|
navigateFirstPage: 1,
|
||||||
|
navigateLastPage: 1,
|
||||||
|
navigatePages: 8,
|
||||||
|
navigatepageNums: [1],
|
||||||
|
nextPage: 0,
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
pages: 1,
|
||||||
|
prePage: 0,
|
||||||
|
size: 1,
|
||||||
|
startRow: 1,
|
||||||
|
total: 1,
|
||||||
|
}])
|
||||||
|
//计算广告图片的重合尺寸是位移
|
||||||
|
const getStyle = (e) => {
|
||||||
|
if (e > hometoplist.bannerVO.counponsInfo.length / 2) {
|
||||||
|
var right = hometoplist.bannerVO.counponsInfo.length - e
|
||||||
|
return {
|
||||||
|
transform: 'scale(' + (1) + ') translate(-' + (right * 20) + '%,0px)',
|
||||||
|
zIndex: 9999 - right,
|
||||||
|
opacity: 1
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
transform: 'scale(' + (1) + ') translate(' + (e * 20) + '%,0px)',
|
||||||
|
zIndex: 9999 - e,
|
||||||
|
opacity: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const advertisementStyle = ref([{
|
||||||
|
transform: 'scale(' + (1) + ') translate(-' + (0 * 20) + '%,0px)',
|
||||||
|
zIndex: 9999,
|
||||||
|
opacity: 1
|
||||||
|
}])
|
||||||
|
// 广告数据
|
||||||
|
const hometop = async () => {
|
||||||
|
// try {
|
||||||
|
let res = await API.homehomePageUp()
|
||||||
|
console.log(res.data)
|
||||||
|
Object.assign(hometoplist, res.data)
|
||||||
|
// hometoplist = Object.assign(res.data)
|
||||||
|
if (hometoplist.bannerVO.counponsInfo) {
|
||||||
|
hometoplist.bannerVO.counponsInfo.forEach((item, index) => {
|
||||||
|
advertisementStyle.value.push(getStyle(index))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 计算swiper样式
|
||||||
|
|
||||||
|
// } catch (e) {}
|
||||||
|
}
|
||||||
|
// 存储每个元素距离顶部的距离
|
||||||
|
const elementTop = ref(0);
|
||||||
|
// 存储是否吸顶的状态
|
||||||
|
const isSticky = ref(true);
|
||||||
|
// 点击滑动元素
|
||||||
|
const viewHistory = async (item, index) => {
|
||||||
|
if (isSticky) {
|
||||||
|
uni.pageScrollTo({
|
||||||
|
scrollTop: elementTop.value,
|
||||||
|
duration: 300
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
// 滑动
|
||||||
|
onPageScroll((res) => {
|
||||||
|
isSticky.value = res.scrollTop > elementTop.value ? true : false
|
||||||
|
uni.$u.debounce(store.scrollTop = res.scrollTop, 500)
|
||||||
|
});
|
||||||
|
onShow(() => {})
|
||||||
|
onMounted(() => {
|
||||||
|
hometop()
|
||||||
|
// 初始化
|
||||||
|
const query = uni.createSelectorQuery().select('#fourcontent');
|
||||||
|
query.boundingClientRect((rect) => {
|
||||||
|
elementTop.value = rect.top - store.height
|
||||||
|
}).exec();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.content {
|
.content {
|
||||||
height: 1000vh;
|
height: 1000vh;
|
||||||
|
background: #F9F9F9;
|
||||||
|
|
||||||
|
.fourcontent {
|
||||||
|
padding: 32rpx 28rpx;
|
||||||
|
overflow-x: auto;
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
background: #f9f9f9;
|
||||||
|
|
||||||
|
.fourcontent_item {
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
margin-left: 22rpx;
|
||||||
|
padding: 11rpx 31rpx;
|
||||||
|
background: #FFFFFF;
|
||||||
|
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
||||||
|
|
||||||
|
text {
|
||||||
|
width: max-content;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.fourcontent_itemactev {
|
||||||
|
background: #fee06a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fourcontent_item:nth-child(1) {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.fivecontent {
|
||||||
|
padding: 0 28rpx;
|
||||||
|
height: 100vh;
|
||||||
|
|
||||||
|
.fivecontent_item:nth-child(1) {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fivecontent_item {
|
||||||
|
margin-top: 32rpx;
|
||||||
|
padding: 24rpx 32rpx;
|
||||||
|
width: 100%;
|
||||||
|
background: #FFFFFF;
|
||||||
|
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
||||||
|
|
||||||
|
.fivecontent_item_nav {
|
||||||
|
image {
|
||||||
|
width: 60rpx;
|
||||||
|
height: 60rpx;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fivecontent_item_nav_left {
|
||||||
|
flex: auto;
|
||||||
|
margin-left: 12rpx;
|
||||||
|
|
||||||
|
.fivecontent_item_nav_lefttop {
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #666666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fivecontent_item_nav_lefttopstart {
|
||||||
|
margin-top: 8rpx;
|
||||||
|
|
||||||
|
.fivecontent_item_nav_leftlang {
|
||||||
|
margin-left: 12rpx;
|
||||||
|
width: max-content;
|
||||||
|
padding: 4rpx 10rpx;
|
||||||
|
background: #FFF9E1;
|
||||||
|
border-radius: 4rpx 4rpx 4rpx 4rpx;
|
||||||
|
|
||||||
|
.fivecontent_item_nav_leftlangtext {
|
||||||
|
margin-left: 6rpx;
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 16rpx;
|
||||||
|
color: #F9A511;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fivecontent_item_nav_leftlangimage {
|
||||||
|
width: 10.82rpx;
|
||||||
|
height: 14.06rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.fivecontent_item_nav_leftlang:nth-child(1) {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.fivecontent_item_box {
|
||||||
|
margin-top: 20rpx;
|
||||||
|
border-top: 2rpx solid #E5E5E5;
|
||||||
|
padding-top: 14rpx;
|
||||||
|
|
||||||
|
.fivecontent_item_boxitem {
|
||||||
|
image {
|
||||||
|
width: 192rpx;
|
||||||
|
height: 192rpx;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fivecontent_item_boxitemleft {
|
||||||
|
margin-left: 24rpx;
|
||||||
|
flex: 1;
|
||||||
|
|
||||||
|
.fivecontent_item_boxitemleftone {
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
text {
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
// font-weight: 700;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
|
||||||
|
view {
|
||||||
|
// width: 300rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap; //溢出不换行white-space:nowrap; //溢出不换行
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #333333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.flexstartboxfttow {
|
||||||
|
.fivecontent_item_boxitemlefttow {
|
||||||
|
margin-left: 16rpx;
|
||||||
|
margin-top: 8rpx;
|
||||||
|
width: max-content;
|
||||||
|
padding: 4rpx 10rpx;
|
||||||
|
background: #FFF9E1;
|
||||||
|
border-radius: 4rpx 4rpx 4rpx 4rpx;
|
||||||
|
|
||||||
|
.fivecontent_item_boxitemlefttowtext {
|
||||||
|
margin-left: 6rpx;
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 16rpx;
|
||||||
|
color: #F9A511;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fivecontent_item_boxitemlefttowimage {
|
||||||
|
width: 10.82rpx;
|
||||||
|
height: 14.06rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.fivecontent_item_boxitemlefttow:nth-child(1) {
|
||||||
|
margin-left: 0;
|
||||||
|
background: #FFD6D7;
|
||||||
|
border-radius: 4rpx 4rpx 4rpx 4rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.indexboxitemleftthere {
|
||||||
|
position: relative;
|
||||||
|
margin-top: 30rpx;
|
||||||
|
padding-left: 16rpx;
|
||||||
|
width: 100%;
|
||||||
|
background: url(https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/qinggou.png) no-repeat;
|
||||||
|
background-size: 100% 100%;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.indexboxitemleftthereabsolute {
|
||||||
|
position: absolute;
|
||||||
|
top: 14rpx;
|
||||||
|
right: 12rpx;
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #FFFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.indexboxitemlefttheretext {
|
||||||
|
// width: 100%;
|
||||||
|
margin-top: 12rpx;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.fivecontent_item_boxitemlefthere_one {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.flex_startone {
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 16rpx;
|
||||||
|
color: #FF7127;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex_starttow {
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #FF7127;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.fivecontent_item_boxitemlefthere_tow {
|
||||||
|
margin-left: 4rpx;
|
||||||
|
padding: 2rpx 10rpx;
|
||||||
|
border-radius: 4rpx 4rpx 4rpx 4rpx;
|
||||||
|
border: 2rpx solid #FF7127;
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 16rpx;
|
||||||
|
color: #FF7127;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fivecontent_item_boxitemlefthere_there {
|
||||||
|
margin-left: 6rpx;
|
||||||
|
line-height: 24rpx;
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 16rpx;
|
||||||
|
color: #999999;
|
||||||
|
text-decoration-line: line-through;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.indexboxitemleftthere_countdown {
|
||||||
|
width: 100%;
|
||||||
|
padding-right: 7rpx;
|
||||||
|
margin-top: 2rpx;
|
||||||
|
|
||||||
|
.indexboxitemleftthere_countdowntext {
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #999999;
|
||||||
|
padding-bottom: 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.indexboxitemleftthere_countdowntexts {
|
||||||
|
font-family: Roboto, Roboto;
|
||||||
|
font-weight: 400;
|
||||||
|
color: #333333;
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 16rpx;
|
||||||
|
color: #FFFFFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<Nav />
|
||||||
|
<view class="content" :style="{ marginTop: `${store.height}px` }">
|
||||||
|
<!-- 轮播图 -->
|
||||||
|
<swipers :carousel='hometoplist.carousel'></swipers>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {
|
||||||
|
ref,
|
||||||
|
computed,
|
||||||
|
onMounted
|
||||||
|
} from "vue";
|
||||||
|
import {
|
||||||
|
onLoad,
|
||||||
|
onReady,
|
||||||
|
onShow
|
||||||
|
} from '@dcloudio/uni-app'
|
||||||
|
import swipers from './components/swiper.vue' //引入轮播
|
||||||
|
import popupad from '@/components/popupad.vue'
|
||||||
|
import diamond from './components/diamond.vue'
|
||||||
|
import todaylist from './components/todaylist.vue'
|
||||||
|
import productlist from './components/productlist.vue'
|
||||||
|
import advertisement from './components/advertisement.vue'
|
||||||
|
import category from '@/components/qiyue-category/qiyue-category.vue';
|
||||||
|
import indexs from './indexs.vue';
|
||||||
|
import Nav from '@/components/indexnav.vue'; //导航栏
|
||||||
|
import {
|
||||||
|
useNavbarStore
|
||||||
|
} from '@/stores/navbarStore';
|
||||||
|
const store = useNavbarStore();
|
||||||
|
|
||||||
|
// 动态更新导航栏配置
|
||||||
|
store.updateNavbarConfig({
|
||||||
|
showBack: true, //左边返回键
|
||||||
|
rightText: '', //右边文字
|
||||||
|
showSearch: true, //true是标题其他事文字
|
||||||
|
title: '我的页面',
|
||||||
|
isTransparent: false,
|
||||||
|
hasPlaceholder: false //是否要占位符
|
||||||
|
});
|
||||||
|
const targetObj = {
|
||||||
|
a: 1
|
||||||
|
};
|
||||||
|
const sourceObj1 = {
|
||||||
|
b: 2
|
||||||
|
};
|
||||||
|
const sourceObj2 = {
|
||||||
|
c: 3
|
||||||
|
};
|
||||||
|
|
||||||
|
// 将 sourceObj1 和 sourceObj2 的属性复制到 targetObj
|
||||||
|
const result = Object.assign(targetObj, sourceObj1, sourceObj2);
|
||||||
|
|
||||||
|
console.log(result);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.content {
|
||||||
|
height: 1000vh;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -8,7 +8,8 @@ export const useNavbarStore = defineStore('navbar', {
|
||||||
title: '',
|
title: '',
|
||||||
isTransparent: false,
|
isTransparent: false,
|
||||||
height: 0,
|
height: 0,
|
||||||
hasPlaceholder: true
|
hasPlaceholder: true,
|
||||||
|
scrollTop: 0 //滚动高度
|
||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
updateNavbarConfig(config) {
|
updateNavbarConfig(config) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue