Merge branch 'dev' into test

This commit is contained in:
lifizer
2024-08-07 11:32:30 +08:00
13 changed files with 2214 additions and 957 deletions
+7
View File
@@ -85,6 +85,13 @@ export function getFestival() {
return request.get('/contentFestival', {}, {login: false})
}
/**
* 尖货专题
* */
export function getContentBest(id) {
return request.get(`/contentBest/${id}`, {}, {login: false})
}
/*
* 非遗文化
* */
+2 -2
View File
@@ -8,8 +8,8 @@ export function getSplashScreen() {
* 首页
* @returns {*}
*/
export function getHomeData() {
return request.get("index", {}, {
export function getHomeData(params) {
return request.get("index", params, {
login: false
});
}
+161
View File
@@ -0,0 +1,161 @@
<template>
<view class="xdd-product-item" @click="viewHandle(item)">
<view class="focus-img">
<image
:src="item[imageKey]"
class="img"
/>
<image
v-if="item.isOldBrand"
:src="webUrl + '/home/old-mark.png'"
class="mark-img"
/>
<image
v-if="item.isLandmarkGoods"
:src="webUrl + '/home/mark-land.png'"
class="mark-img"
/>
<image
v-if="item.isCountyFamous"
:src="webUrl + '/home/qixian-mark.png'"
class="mark-img"
/>
</view>
<view class="info-wrap">
<view class="name more-t">
{{ item.storeName }}
</view>
<view v-if="item.bestContent" class="desc one-t">
{{ item.bestContent }}
</view>
<view v-if="item.couponName" class="coupon">
<view class="tag"></view>
<view class="tag">{{ item.couponName }}</view>
</view>
<view class="price-wrap">
<view class="price">
<text class="price-txt price-red">{{ item.price }}</text>
</view>
<view class="btn">
<image
:src="webUrl + '/home/icon-cart.png'"
class="img"
/>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'XddProductItem',
props: {
item: {
type: Object,
default: () => {
return {}
}
},
imageKey: {
type: String,
default: 'image'
}
},
data() {
return {
webUrl: this.$VUE_APP_RESOURCES_URL
}
},
methods: {
viewHandle(item) {
this.$emit('view', item)
}
}
}
</script>
<style lang="less">
.xdd-product-item {
border-radius: 20rpx;
background-color: #fff;
overflow: hidden;
.focus-img {
position: relative;
.img {
position: relative;
z-index: 2;
display: block;
width: 345rpx;
height: 345rpx;
border-radius: 20rpx;
}
.mark-img {
position: absolute;
top: 0;
right: 0;
z-index: 3;
display: block;
width: 84rpx;
height: 74rpx;
}
}
.info-wrap {
padding: 12rpx;
.name {
font-size: 28rpx;
line-height: 40rpx;
color: #333;
}
.desc {
padding: 10rpx 0 0 0;
color: #FFC543;
font-size: 24rpx;
}
.coupon {
display: flex;
padding: 10rpx 0 0 0;
.tag + .tag {
margin: 0 0 0 -1rpx;
}
.tag {
height: 32rpx;
padding: 0 6rpx;
border-radius: 8rpx;
border: 1rpx solid #C52733;
color: #C52733;
line-height: 32rpx;
font-size: 10px;
}
}
.price-wrap {
display: flex;
justify-content: space-between;
align-items: flex-end;
padding: 10rpx 0 0 0;
.price {
font-size: 24rpx;
line-height: 40rpx;
.price-txt {
font-size: 40rpx;
font-weight: bold;
}
}
.price-red {
margin: 0 10rpx 0 0;
color: #C52733;
}
.price-grey {
color: #C4C4C4;
}
.btn {
.img {
display: block;
width: 48rpx;
height: 48rpx;
}
}
}
}
}
</style>
+183
View File
@@ -0,0 +1,183 @@
<template>
<view
:style="{
'background-image': 'url(' + webUrl + '/home/tabbar-bg.png);'
}"
class="xdd-tabbar-wrap"
>
<view class="center-img" @click="switchTabFn('/pages/cloud/haveFun')">
<image
:src="webUrl + '/home/tabbar-center.png'"
class="img"
/>
</view>
<view class="tabbar-list">
<view
v-for="(tabbarItem, tabbarIndex) in tabbar"
:key="tabbarIndex"
class="tabbar-item"
>
<view
v-for="(item, index) in tabbarItem"
:key="index"
:class="currIndex === item.index ? 'curr' : ''"
class="item"
@click="gotoPage(item.url, item.type, item.index)"
>
<view class="img-wrap">
<!-- 预加载两张图片可以在点击切换的时候不闪屏 -->
<image
:src="item.onIcon"
class="img on"
/>
<image
:src="item.offIcon"
class="img off"
/>
</view>
<view class="name">{{ item.name }}</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'XddTabbar',
props: {
currIndex: {
type: Number,
default: 0
}
},
data() {
return {
webUrl: this.$VUE_APP_RESOURCES_URL,
tabbar: [[
{
name: '首页',
onIcon: this.$VUE_APP_RESOURCES_URL + '/home/tabbar-01-on.png',
offIcon: this.$VUE_APP_RESOURCES_URL + '/home/tabbar-01-off.png',
url: '/pages/home/index',
type: 1,
index: 0
},
{
name: '消息',
onIcon: this.$VUE_APP_RESOURCES_URL + '/home/tabbar-02-on.png',
offIcon: this.$VUE_APP_RESOURCES_URL + '/home/tabbar-02-off.png',
url: '/pkg_common/views/roomLogs',
type: 2,
index: 1
}
],[
{
name: '购物车',
onIcon: this.$VUE_APP_RESOURCES_URL + '/home/tabbar-03-on.png',
offIcon: this.$VUE_APP_RESOURCES_URL + '/home/tabbar-03-off.png',
url: '/pages/cart',
type: 1,
index: 2
},
{
name: '我的',
onIcon: this.$VUE_APP_RESOURCES_URL + '/home/tabbar-04-on.png',
offIcon: this.$VUE_APP_RESOURCES_URL + '/home/tabbar-04-off.png',
url: '/pages/user/User/index',
type: 1,
index: 3
}
]]
}
},
methods: {
/**
* 跳转至目标页面
* type: 1-tabbar页面,2-非tabbar页面
*/
gotoPage(url, type = 1, index) {
if (this.currIndex === index) return
if (type === 1) {
this.switchTabFn(url)
}
if (type === 2) {
uni.navigateTo({ url })
}
},
switchTabFn(url) {
uni.switchTab({ url })
}
}
}
</script>
<style scoped lang="less">
.xdd-tabbar-wrap {
position: fixed;
bottom: 21rpx;
left: 21rpx;
right: 21rpx;
z-index: 99;
height: 164rpx;
background-size: 708rpx 164rpx;
background-repeat: no-repeat;
.center-img {
position: absolute;
top: -16rpx;
left: 50%;
z-index: 5;
transform: translateX(-50%);
.img {
width: 136rpx;
height: 136rpx;
}
}
.tabbar-list {
position: relative;
z-index: 2;
display: flex;
justify-content: space-between;
padding: 70rpx 0 0 0;
.tabbar-item {
display: flex;
align-items: center;
width: calc(50% - 78rpx);
.img-wrap {
.img {
display: block;
width: 44rpx;
height: 44rpx;
margin: 0 auto;
&.on {
display: none;
}
&.off {
display: block;
}
}
}
.name {
padding: 10rpx 0 0 0;
text-align: center;
font-size: 24rpx;
color: #9a9a9a;
}
.item {
width: 140rpx;
&.curr {
.name {
color: #C52733;
}
.on {
display: block;
}
.off {
display: none;
}
}
}
}
}
}
</style>
+2 -2
View File
@@ -814,10 +814,10 @@
"text": "首页"
},
{
"pagePath": "pages/home/landMark",
"pagePath": "pages/cloud/haveFun",
"iconPath": "static/tabbar/icon-land.png",
"selectedIconPath": "static/tabbar/icon-land-hot.png",
"text": "地标好物"
"text": "寻趣味"
},
{
"pagePath": "pages/cart",
+9 -3
View File
@@ -3,7 +3,7 @@
:style="{
'padding-top': (statusBarHeight + 54) + 'px'
}"
class="pages-cart"
class="pages-cart tabbar-page"
>
<u-navbar
:left-icon="selectCount > 0 ? 'trash' : ''"
@@ -213,9 +213,11 @@
v-else
:show-avatar="false"
/>
<xdd-tabbar :curr-index="2" />
</view>
</template>
<script>
import XddTabbar from '@/components/xdd-tabbar'
import {
changeCartNum,
getCartGroup,
@@ -227,7 +229,8 @@ import CheckboxIcon from '@/components/CheckboxIcon.vue'
import { pageListenMixins } from '@/mixins/pageListenMixins'
export default {
components: {
CheckboxIcon
CheckboxIcon,
XddTabbar
},
mixins: [pageListenMixins],
data() {
@@ -633,7 +636,7 @@ view {
.footer-fixed {
position: fixed;
left: 0;
bottom: 0;
bottom: 180rpx;
width: 100vw;
height: 100rpx;
box-shadow: 0 6rpx 12rpx rgba(0, 0, 0, 0.16);
@@ -770,4 +773,7 @@ view {
}
}
}
.tabbar-page {
padding: 0 0 180rpx 0;
}
</style>
+8 -2
View File
@@ -1,5 +1,5 @@
<template>
<view class="have-fun">
<view class="have-fun tabbar-page">
<view class="top-box">
<view class="search-box flex jc-between ai-center">
<input
@@ -73,6 +73,7 @@
:show-avatar="false"
/>
</view>
<xdd-tabbar :curr-index="4" />
</view>
</template>
<script>
@@ -80,9 +81,11 @@ import { getHotelList, getHotelTypeList } from "@/api/inn.js"
import { getCurAddress, getLocation } from "@/utils/common"
import FunHotelItem from './components/HotelItem'
import { pageListenMixins } from '@/mixins/pageListenMixins'
import XddTabbar from '@/components/xdd-tabbar'
export default {
components: {
FunHotelItem
FunHotelItem,
XddTabbar
},
mixins: [pageListenMixins],
data() {
@@ -291,4 +294,7 @@ export default {
}
}
}
.tabbar-page {
padding: 0 0 180rpx 0;
}
</style>
+600 -934
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+9 -1
View File
@@ -1,5 +1,5 @@
<template>
<view class="user user-page">
<view class="user user-page tabbar-page">
<view
v-if="$store.getters.token || userInfo.uid"
class="acea-row row-column"
@@ -239,10 +239,12 @@
</view>
</view>
</uni-popup>
<xdd-tabbar :curr-index="3" />
</view>
</template>
<script>
import XddTabbar from '@/components/xdd-tabbar'
import {mapGetters, mapMutations} from "vuex"
import {
getSpreadImg,
@@ -256,6 +258,9 @@ import cookie from "@/utils/store/cookie"
import { pageListenMixins } from '@/mixins/pageListenMixins'
export default {
name: 'UserPage',
components: {
XddTabbar
},
mixins: [pageListenMixins],
data() {
return {
@@ -735,4 +740,7 @@ export default {
height: 52rpx;
}
}
.tabbar-page {
padding: 0 0 180rpx 0;
}
</style>
+43 -12
View File
@@ -16,7 +16,7 @@
mode="widthFix"
/>
<view
v-for="(content,cIndex) in contents"
v-for="(content, cIndex) in contents"
:key="cIndex"
class="section"
>
@@ -35,7 +35,7 @@
:class="cIndex === 0 ? 'span12' : 'span8'"
:src="item.image"
mode="scaleToFill"
@click="goGoods(item.id)"
@click="goGoods(item.id || item.linkId)"
/>
</view>
</view>
@@ -44,8 +44,11 @@
</view>
</template>
<script>
// 节日专题
import { getFestival } from '@/api/product'
/**
* 节日专题&尖货推荐初始模板
* options.theme:best-尖货,''-节日
*/
import { getFestival, getContentBest } from '@/api/product'
import { pageListenMixins } from '@/mixins/pageListenMixins'
export default {
name: 'FestivalPage',
@@ -54,16 +57,44 @@ export default {
return {
isLoad: false,
topImage: '',
contents: [],
pageKeyId: Object.freeze('appContentFestival')
contents: {},
pageKeyId: ''
}
},
onLoad() {
getFestival().then(({data}) => {
this.isLoad = true
this.topImage = data.topImage
this.contents = data.contents
})
onLoad(options) {
const theme = options.theme || ''
const id = options.id
// 尖货
if (theme === 'best') {
this.pageKeyId = `appContentBest_id_${id}`
getContentBest(id).then(({data}) => {
this.isLoad = true
const contents = []
if (data.templateProperties) {
const temp = data.templateProperties
// 第一页图片
this.topImage = temp.page1Image
// 第二页数据
contents.push({
backgroundImage: temp.page2BackgroundImage,
products: temp.page2Links
})
// 第三页数据
contents.push({
backgroundImage: temp.page3BackgroundImage,
products: temp.page3Links
})
}
this.contents = contents
})
} else {
this.pageKeyId = 'appContentFestival'
getFestival().then(({data}) => {
this.isLoad = true
this.topImage = data.topImage
this.contents = data.contents
})
}
},
methods: {
goGoods(id) {
+58
View File
@@ -6,6 +6,19 @@ module.exports = {
type: 'wgs84'
})
},
getLocationPromise() {
return new Promise((resolve, reject) => {
uni.getLocation({
type: 'wgs84',
success: (res) => {
resolve(res)
},
fail: () => {
resolve({})
}
})
})
},
getCurAddress(latitude, longitude) {
return uni.request({
@@ -14,6 +27,51 @@ module.exports = {
});
},
getLocationSetting(cb) {
uni.getSetting({
success: res => {
if (!res.authSetting['scope.userLocation']) {
uni.showModal({
title: '提示',
content: '当前定位未开启,请点击确定手动开启定位',
success: response => {
if (response.confirm) {
cb && cb ()
} else {
uni.showToast({
title: '您拒绝了授权,无法获取定位服务',
duration: 2000,
icon: 'none'
})
}
}
})
}
}
})
},
openLocationSettting() {
return new Promise((resolve, reject) => {
uni.openSetting({
success: res => {
if (res.authSetting['scope.userLocation']) {
resolve()
} else {
uni.showToast({
title: '您拒绝了授权,无法获取定位服务',
duration: 2000,
icon: 'none'
})
}
},
fail: () => {
reject()
}
})
})
},
getUrlParam(url, name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = url.match(reg);
+1 -1
View File
@@ -46,7 +46,7 @@ function baseRequest(options) {
// 如果接口需要登录,携带 token 去请求
options.headers = {
...options.headers,
Authorization: "Bearer " + token
Authorization: token ? ('Bearer ' + token) : ''
}
// 结构请求需要的参数