Feat:香小智对接

This commit is contained in:
lifizer
2023-10-10 23:15:58 +08:00
parent 2d73c2fe46
commit 450da2c79a
10 changed files with 208 additions and 32 deletions
+4
View File
@@ -204,3 +204,7 @@ export function userUnionId() {
export function getShareImage() { export function getShareImage() {
return request.get("/shareImage", {}, {login: false}) return request.get("/shareImage", {}, {login: false})
} }
export function getXiaoZhi() {
return request.get("/appAdvertising", {}, {login: false})
}
+13
View File
@@ -65,6 +65,19 @@ export default {
let timestamp = new Date(date).getTime(); let timestamp = new Date(date).getTime();
let now = new Date().getTime(); let now = new Date().getTime();
return timestamp - now; return timestamp - now;
},
//生成n位数字字母混合字符串
generateMixed(n) {
let chars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
let res = "";
for (let i = 0; i < n; i++) {
let id = Math.floor(Math.random() * 36);
res += chars[id];
}
return res;
} }
} }
+2 -2
View File
@@ -1,5 +1,5 @@
export const VUE_APP_API_URL = "https://shop.xdd618.com/api"; // export const VUE_APP_API_URL = "https://shop.xdd618.com/api";
// export const VUE_APP_API_URL = "https://www.xdd618.com/api"; export const VUE_APP_API_URL = "https://www.xdd618.com/api";
// export const SERVICE_API_URL = "https://service-test.xdd618.com/api"; // export const SERVICE_API_URL = "https://service-test.xdd618.com/api";
export const SERVICE_API_URL = "https://service.xdd618.com/api"; export const SERVICE_API_URL = "https://service.xdd618.com/api";
+6
View File
@@ -555,6 +555,12 @@
"style": { "style": {
"navigationBarTitleText": "历史会话" "navigationBarTitleText": "历史会话"
} }
},
{
"path": "views/xiaoZhi",
"style": {
"navigationBarTitleText": ""
}
} }
] ]
}, },
+1 -1
View File
@@ -485,7 +485,7 @@ export default {
}, },
onShareAppMessage() { onShareAppMessage() {
return { return {
title: '云南香道滇官方商城', title: '探寻有趣有味的生活方式',
path: '/pages/home/index', path: '/pages/home/index',
imageUrl: this.shareAppImg imageUrl: this.shareAppImg
} }
+39 -7
View File
@@ -10,6 +10,19 @@
</view> </view>
</view> </view>
<view class="page-content" v-if="historyKey.length">
<view class="title">历史搜索</view>
<view class="list acea-row limit-box">
<view
class="item"
v-for="item of historyKey"
:key="item.id"
@click="toSearch(item.word)"
>{{ item.word }}
</view>
</view>
</view>
<view class="page-content" v-if="keywords.length"> <view class="page-content" v-if="keywords.length">
<view class="title">热门搜索</view> <view class="title">热门搜索</view>
<view class="list acea-row"> <view class="list acea-row">
@@ -37,16 +50,25 @@ export default {
return { return {
webUrl: this.$VUE_APP_RESOURCES_URL, webUrl: this.$VUE_APP_RESOURCES_URL,
keywords: [], keywords: [],
search: "" search: "",
historyKey: []
}; };
}, },
mounted: function () { mounted: function () {
this.getData(); this.getData();
}, },
onShow() {
this.getHistory();
},
methods: { methods: {
submit() { submit() {
const search = trim(this.search) || ""; const search = trim(this.search) || "";
if (!search) return; if (!search) return;
this.historyKey.unshift({id: this.$global.generateMixed(10), word: search});
this.setHistory();
this.search = "";
this.toSearch(search); this.toSearch(search);
}, },
toSearch(s) { toSearch(s) {
@@ -56,18 +78,22 @@ export default {
getSearchKeyword().then(res => { getSearchKeyword().then(res => {
this.keywords = res.data; this.keywords = res.data;
}); });
},
getHistory() {
let temp = JSON.parse(uni.getStorageSync("historyKey")) || [];
this.historyKey = temp.slice(0, 30);
},
setHistory() {
uni.setStorageSync("historyKey", JSON.stringify(this.historyKey));
} }
} }
}; };
</script> </script>
<style lang="less"> <style lang="less">
page { .good-search {
min-height: 100vh; min-height: 100vh;
background: #fff !important; background: #fff !important;
}
.good-search {
.header { .header {
padding: 40rpx 32rpx 32rpx; padding: 40rpx 32rpx 32rpx;
@@ -81,7 +107,8 @@ page {
border-radius: 36rpx; border-radius: 36rpx;
background: #fff; background: #fff;
font-size: 24rpx; font-size: 24rpx;
input{
input {
width: 100%; width: 100%;
} }
@@ -117,7 +144,7 @@ page {
.item { .item {
height: 48rpx; height: 48rpx;
box-sizing: border-box; box-sizing: border-box;
margin-right: 24rpx; margin: 0 24rpx 20rpx 0;
padding: 0 24rpx; padding: 0 24rpx;
border-radius: 28rpx; border-radius: 28rpx;
background: #F1F0EE; background: #F1F0EE;
@@ -126,6 +153,11 @@ page {
line-height: 48rpx; line-height: 48rpx;
} }
} }
.limit-box {
max-height: 260rpx;
overflow-y: hidden;
}
} }
} }
</style> </style>
+2 -2
View File
@@ -52,11 +52,11 @@
</view> </view>
</view> </view>
<!-- 文玩 --> <!-- 文玩 -->
<view class="wenwan-info flex jc-between ai-center" v-if="isWenwan===1"> <!-- <view class="wenwan-info flex jc-between ai-center" v-if="isWenwan===1">
<text>产地:{{ storeInfo.origin }}</text> <text>产地:{{ storeInfo.origin }}</text>
<text>单位:{{ storeInfo.unitName }}</text> <text>单位:{{ storeInfo.unitName }}</text>
<text>规格:{{ storeInfo.storeInfo }}</text> <text>规格:{{ storeInfo.storeInfo }}</text>
</view> </view> -->
</view> </view>
<!-- v4 特产 --> <!-- v4 特产 -->
+71
View File
@@ -0,0 +1,71 @@
<script>
import {getXiaoZhi} from "@/api/public";
export default ({
name: "xiaoZhi",
data() {
return {
info: null
}
},
onLoad() {
this.init()
},
methods: {
init() {
getXiaoZhi().then(({data}) => {
this.info = data[0] || null
if (this.info) {
uni.setNavigationBarTitle({
title: this.info.name
})
}
})
},
gotoXiaoZhi() {
if (this.info.urlType !== 1) return;
uni.navigateToMiniProgram({
appId: this.info.appId,
path: this.info.url,
extraData: this.info.extraData,
envVersion: this.info.envVersion === '1' ? 'release' : 'trial'
})
}
}
})
</script>
<template>
<view class="pkg-common-zhi">
<template v-if="info">
<rich-text :nodes="info.content"/>
<view class="btn-fixed" @click="gotoXiaoZhi">{{ info.buttonText }}</view>
</template>
</view>
</template>
<style scoped lang="less">
.pkg-common-zhi {
max-width: 100vw;
overflow-x: hidden;
.btn-fixed {
position: fixed;
bottom: 40rpx;
left: 50%;
transform: translate(-50%, 0);
width: 440rpx;
height: 110rpx;
line-height: 110rpx;
border-radius: 50rpx;
background-color: #4481EB;
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16);
color: #FFFFFF;
font-size: 56rpx;
font-weight: bold;
text-align: center;
}
}
</style>
+63 -14
View File
@@ -1,6 +1,7 @@
<script setup> <script>
import {getSeason, getSeasonPoster} from "@/api/product"; import {getSeason, getSeasonPoster} from "@/api/product";
import cookie from "@/utils/store/cookie"; import cookie from "@/utils/store/cookie";
import {getUrlParam} from "@/utils/common.js";
export default { export default {
data() { data() {
@@ -48,6 +49,42 @@ export default {
this.current++; this.current++;
}, },
saveImg() {
let that = this;
uni.getSetting({
success: getRes => {
if (getRes.authSetting["scope.writePhotosAlbum"]) {
that.downloadImage();
} else {
uni.authorize({
scope: "scope.writePhotosAlbum",
success: () => {
that.downloadImage();
},
fail: () => {
console.log("authorize fail")
uni.openSetting({
success: openRes => {
console.log(typeof openRes, openRes)
},
fail: () => {
uni.showToast({
title: "请在设置中打开对应权限",
icon: "none"
})
}
})
}
})
}
},
fail: (err) => {
console.log(err, 2)
}
})
},
downloadImage() { downloadImage() {
let that = this; let that = this;
const randomID = () => Math.random().toString(36).substring(2); const randomID = () => Math.random().toString(36).substring(2);
@@ -108,8 +145,8 @@ export default {
</view> </view>
</u-popup> </u-popup>
<view class="scroll-item section"> <view class="scroll-item">
<u-swiper :autoplay="false" :current="current" :list="info.swiper" height="100vh" indicator <u-swiper :autoplay="false" :current="current" :list="info.swiper" height="1200rpx" radius="0" indicator
imgMode="scaleToFill"></u-swiper> imgMode="scaleToFill"></u-swiper>
<image class="icon-direction icon-left" :src="webUrl+'/20230911105736198247.png'" mode="scaleToFill" <image class="icon-direction icon-left" :src="webUrl+'/20230911105736198247.png'" mode="scaleToFill"
@click="tapLeft"/> @click="tapLeft"/>
@@ -118,8 +155,10 @@ export default {
</view> </view>
<view class="scroll-item"> <view class="scroll-item">
<scroll-view scroll-y class="product-list" :style="{backgroundImage:'url(' + info.productImage + ')'}"> <image class="bg-img" :src="info.productImage" mode="widthFix"/>
<image class="item" :src="item.image" mode="scaleToFill" @click="$global.navToGoods(item.id)" <!-- <scroll-view scroll-y class="product-list" :style="{backgroundImage:'url(' + info.productImage + ')'}">-->
<scroll-view scroll-y class="product-list">
<image class="item" :src="item.image" mode="widthFix" @click="$global.navToGoods(item.id)"
v-for="(item,index) in info.products" :key="index"/> v-for="(item,index) in info.products" :key="index"/>
</scroll-view> </scroll-view>
</view> </view>
@@ -143,11 +182,6 @@ export default {
box-sizing: border-box; box-sizing: border-box;
} }
.section {
width: 100vw;
height: 100vh;
}
.img-top { .img-top {
width: 100vw; width: 100vw;
} }
@@ -171,6 +205,17 @@ export default {
} }
} }
.box-share{
.box-img{
width: 500rpx;
height: 889.5rpx;
}
.main-img{
width: 500rpx;
height: 889.5rpx;
}
}
.icon-direction { .icon-direction {
position: absolute; position: absolute;
top: 50%; top: 50%;
@@ -187,15 +232,19 @@ export default {
} }
.product-list { .product-list {
padding: 200rpx 32rpx 0; position: absolute;
background-size: 100vw auto; top: 0;
left: 0;
padding: 280rpx 32rpx 0;
.item { .item {
width: 686rpx; width: 686rpx;
height: 400rpx;
margin-bottom: 46rpx; margin-bottom: 46rpx;
border-radius: 20rpx;
} }
} }
.bg-img {
width: 100vw;
}
} }
</style> </style>
+7 -6
View File
@@ -36,7 +36,7 @@ export default {
<text class="type-name" :class="{'choose-name':typeIndex===index}">{{ item.name }}</text> <text class="type-name" :class="{'choose-name':typeIndex===index}">{{ item.name }}</text>
</u-grid-item> </u-grid-item>
<u-grid-item> <u-grid-item>
<image class="icon-logo" :src="webUrl+'/20230913155700903114.png'" mode="scaleToFill"/> <image class="icon-logo" :src="webUrl+'/20231010130532811085.png'" mode="scaleToFill"/>
<text class="type-name">全部</text> <text class="type-name">全部</text>
</u-grid-item> </u-grid-item>
</u-grid> </u-grid>
@@ -77,11 +77,11 @@ export default {
} }
.type-box { .type-box {
padding: 32rpx 62rpx 0; padding: 32rpx 32rpx 0;
.icon-logo { .icon-logo {
width: 80rpx; width: 120rpx;
height: 80rpx; height: 120rpx;
} }
.type-name { .type-name {
@@ -90,8 +90,8 @@ export default {
} }
.choose-icon { .choose-icon {
width: 90rpx; width: 160rpx;
height: 90rpx; height: 160rpx;
} }
.choose-name { .choose-name {
@@ -166,6 +166,7 @@ export default {
.more-t { .more-t {
width: 100%; width: 100%;
margin-top: 10rpx; margin-top: 10rpx;
color: #FFFFFF;
font-size: 26rpx; font-size: 26rpx;
line-height: 38rpx; line-height: 38rpx;
text-align: left; text-align: left;