Feat:接口对接

This commit is contained in:
lifizer
2023-11-20 15:54:00 +08:00
parent 4652b6706a
commit a3ac5a2506
24 changed files with 2305 additions and 152 deletions
+48 -3
View File
@@ -31,6 +31,9 @@
<text class="bold">{{ item.price }}</text>
</view>
</view>
<image class="img-nodata" :src="webUrl+'/20231023131208675588.png'" mode="scaleToFill"
v-if="dataList.length===0"/>
</view>
</view>
</template>
@@ -38,6 +41,11 @@
<script>
import {countyFamous} from "@/api/product";
import {getProducts} from "@/api/store";
import {famousShareImage} from "@/api/share";
import {mapGetters} from "vuex";
import cookie from "@/utils/store/cookie";
import {userBindParent} from "@/api/user";
import {getUrlParam} from "@/utils/common.js";
export default {
name: "famousList",
@@ -49,10 +57,38 @@ export default {
bannerList: [],
dataList: [],
navList: [],
navIndex: 0
navIndex: 0,
partnerId: null
}
},
onLoad() {
computed: mapGetters(["userInfo", "isLogin"]),
onShareAppMessage() {
return new Promise(async (resolve, reject) => {
const {status, data} = await famousShareImage();
if (status === 200) {
resolve({
title: '探寻有趣有味的生活方式',
path: '/pkg_product/views/famousList?partnerId=' + this.userInfo.uid,
imageUrl: data
})
}
})
},
onLoad(options) {
if (options.partnerId) {
this.partnerId = options.partnerId || null;
} else {
let obj = uni.getEnterOptionsSync();
if (options.scene != null || obj.query.scene != null) {
let query = options ? decodeURIComponent(options.scene) : decodeURIComponent(obj.query.scene);
this.partnerId = getUrlParam(query, "partnerId") || null;
}
}
if (this.partnerId) {
cookie.set("spread", this.partnerId);
userBindParent({spread: parseInt(this.partnerId)});
}
countyFamous().then(({data}) => {
this.bannerList = data.banner;
this.navList = data.countyFamousAreaList;
@@ -91,7 +127,7 @@ export default {
},
goGoods(id) {
uni.navigateTo({
url: "/pages/shop/GoodsCon/index?id=" + id
url: `/pages/shop/GoodsCon/index?id=${id}&from=famous`
})
},
goStory() {
@@ -207,6 +243,15 @@ export default {
.item:nth-child(2n) {
margin-right: 0;
}
.img-nodata {
position: relative;
top: 40rpx;
left: 50%;
transform: translate(-50%, 0);
width: 352rpx;
height: 338rpx;
}
}
}
</style>