Merge branch 'test'
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "jdt-user",
|
"name": "jdt-user",
|
||||||
"version": "3.0.4",
|
"version": "3.0.5",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "",
|
"description": "",
|
||||||
"templateInfo": {
|
"templateInfo": {
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
"css": "sass"
|
"css": "sass"
|
||||||
},
|
},
|
||||||
"taroConfig": {
|
"taroConfig": {
|
||||||
"version": "3.0.4"
|
"version": "3.0.5"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build:weapp": "taro build --type weapp",
|
"build:weapp": "taro build --type weapp",
|
||||||
|
|||||||
@@ -13,7 +13,11 @@
|
|||||||
auto-play="3000"
|
auto-play="3000"
|
||||||
>
|
>
|
||||||
<nut-swiper-item v-for="(itm, idx) in bannerList" :key="idx">
|
<nut-swiper-item v-for="(itm, idx) in bannerList" :key="idx">
|
||||||
<img :src="itm.url" :alt="itm.ID.toString()" />
|
<img
|
||||||
|
:src="itm.url"
|
||||||
|
:alt="itm.ID.toString()"
|
||||||
|
@click="toPage(itm.jump)"
|
||||||
|
/>
|
||||||
</nut-swiper-item>
|
</nut-swiper-item>
|
||||||
</nut-swiper>
|
</nut-swiper>
|
||||||
</view>
|
</view>
|
||||||
@@ -44,6 +48,8 @@ import Popup from "@/components/Popup.vue";
|
|||||||
import MerList from "@/components/MerList.vue";
|
import MerList from "@/components/MerList.vue";
|
||||||
import { getHomeList } from "@/api/home";
|
import { getHomeList } from "@/api/home";
|
||||||
import { getBanner } from "@/api/user";
|
import { getBanner } from "@/api/user";
|
||||||
|
import { parseQueryString } from "@/utils";
|
||||||
|
import { getMerList } from "@/api/goods";
|
||||||
|
|
||||||
const searchValue = ref("");
|
const searchValue = ref("");
|
||||||
|
|
||||||
@@ -127,6 +133,19 @@ const toDetails = (item: SwiperList) => {
|
|||||||
url: item.url as string,
|
url: item.url as string,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const toPage = async (url: string) => {
|
||||||
|
// url转对象
|
||||||
|
const obj = parseQueryString(url);
|
||||||
|
if (obj.type === "1") {
|
||||||
|
const { data: res } = await getMerList({});
|
||||||
|
const mer = res.data.filter((item) => item.bid === obj.bid)[0];
|
||||||
|
Taro.setStorageSync("mer_info", mer);
|
||||||
|
}
|
||||||
|
Taro.navigateTo({
|
||||||
|
url,
|
||||||
|
});
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|||||||
@@ -28,3 +28,28 @@ export function calculateDistance(
|
|||||||
function toRadians(degrees: number): number {
|
function toRadians(degrees: number): number {
|
||||||
return (degrees * Math.PI) / 180;
|
return (degrees * Math.PI) / 180;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// url转对象
|
||||||
|
interface UrlParams {
|
||||||
|
type?: string;
|
||||||
|
gid?: string;
|
||||||
|
bid?: string;
|
||||||
|
}
|
||||||
|
export function parseQueryString(url: string) {
|
||||||
|
const queryString = url.split("?")[1];
|
||||||
|
|
||||||
|
if (!queryString) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
const keyValuePairs = queryString.split("&");
|
||||||
|
|
||||||
|
const result: UrlParams = {};
|
||||||
|
|
||||||
|
keyValuePairs.forEach((keyValue) => {
|
||||||
|
const [key, value] = keyValue.split("=");
|
||||||
|
result[key] = decodeURIComponent(value);
|
||||||
|
});
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user