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() {
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 now = new Date().getTime();
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://www.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 SERVICE_API_URL = "https://service-test.xdd618.com/api";
export const SERVICE_API_URL = "https://service.xdd618.com/api";
+6
View File
@@ -555,6 +555,12 @@
"style": {
"navigationBarTitleText": "历史会话"
}
},
{
"path": "views/xiaoZhi",
"style": {
"navigationBarTitleText": ""
}
}
]
},
+1 -1
View File
@@ -485,7 +485,7 @@ export default {
},
onShareAppMessage() {
return {
title: '云南香道滇官方商城',
title: '探寻有趣有味的生活方式',
path: '/pages/home/index',
imageUrl: this.shareAppImg
}
+38 -6
View File
@@ -10,6 +10,19 @@
</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="title">热门搜索</view>
<view class="list acea-row">
@@ -37,16 +50,25 @@ export default {
return {
webUrl: this.$VUE_APP_RESOURCES_URL,
keywords: [],
search: ""
search: "",
historyKey: []
};
},
mounted: function () {
this.getData();
},
onShow() {
this.getHistory();
},
methods: {
submit() {
const search = trim(this.search) || "";
if (!search) return;
this.historyKey.unshift({id: this.$global.generateMixed(10), word: search});
this.setHistory();
this.search = "";
this.toSearch(search);
},
toSearch(s) {
@@ -56,18 +78,22 @@ export default {
getSearchKeyword().then(res => {
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>
<style lang="less">
page {
.good-search {
min-height: 100vh;
background: #fff !important;
}
.good-search {
.header {
padding: 40rpx 32rpx 32rpx;
@@ -81,6 +107,7 @@ page {
border-radius: 36rpx;
background: #fff;
font-size: 24rpx;
input {
width: 100%;
}
@@ -117,7 +144,7 @@ page {
.item {
height: 48rpx;
box-sizing: border-box;
margin-right: 24rpx;
margin: 0 24rpx 20rpx 0;
padding: 0 24rpx;
border-radius: 28rpx;
background: #F1F0EE;
@@ -126,6 +153,11 @@ page {
line-height: 48rpx;
}
}
.limit-box {
max-height: 260rpx;
overflow-y: hidden;
}
}
}
</style>
+2 -2
View File
@@ -52,11 +52,11 @@
</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.unitName }}</text>
<text>规格:{{ storeInfo.storeInfo }}</text>
</view>
</view> -->
</view>
<!-- 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 cookie from "@/utils/store/cookie";
import {getUrlParam} from "@/utils/common.js";
export default {
data() {
@@ -48,6 +49,42 @@ export default {
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() {
let that = this;
const randomID = () => Math.random().toString(36).substring(2);
@@ -108,8 +145,8 @@ export default {
</view>
</u-popup>
<view class="scroll-item section">
<u-swiper :autoplay="false" :current="current" :list="info.swiper" height="100vh" indicator
<view class="scroll-item">
<u-swiper :autoplay="false" :current="current" :list="info.swiper" height="1200rpx" radius="0" indicator
imgMode="scaleToFill"></u-swiper>
<image class="icon-direction icon-left" :src="webUrl+'/20230911105736198247.png'" mode="scaleToFill"
@click="tapLeft"/>
@@ -118,8 +155,10 @@ export default {
</view>
<view class="scroll-item">
<scroll-view scroll-y class="product-list" :style="{backgroundImage:'url(' + info.productImage + ')'}">
<image class="item" :src="item.image" mode="scaleToFill" @click="$global.navToGoods(item.id)"
<image class="bg-img" :src="info.productImage" mode="widthFix"/>
<!-- <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"/>
</scroll-view>
</view>
@@ -143,11 +182,6 @@ export default {
box-sizing: border-box;
}
.section {
width: 100vw;
height: 100vh;
}
.img-top {
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 {
position: absolute;
top: 50%;
@@ -187,15 +232,19 @@ export default {
}
.product-list {
padding: 200rpx 32rpx 0;
background-size: 100vw auto;
position: absolute;
top: 0;
left: 0;
padding: 280rpx 32rpx 0;
.item {
width: 686rpx;
height: 400rpx;
margin-bottom: 46rpx;
border-radius: 20rpx;
}
}
.bg-img {
width: 100vw;
}
}
</style>
+7 -6
View File
@@ -36,7 +36,7 @@ export default {
<text class="type-name" :class="{'choose-name':typeIndex===index}">{{ item.name }}</text>
</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>
</u-grid-item>
</u-grid>
@@ -77,11 +77,11 @@ export default {
}
.type-box {
padding: 32rpx 62rpx 0;
padding: 32rpx 32rpx 0;
.icon-logo {
width: 80rpx;
height: 80rpx;
width: 120rpx;
height: 120rpx;
}
.type-name {
@@ -90,8 +90,8 @@ export default {
}
.choose-icon {
width: 90rpx;
height: 90rpx;
width: 160rpx;
height: 160rpx;
}
.choose-name {
@@ -166,6 +166,7 @@ export default {
.more-t {
width: 100%;
margin-top: 10rpx;
color: #FFFFFF;
font-size: 26rpx;
line-height: 38rpx;
text-align: left;