增加新模块
This commit is contained in:
+224
@@ -0,0 +1,224 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const api_product = require("../../api/product.js");
|
||||
const _sfc_main = {
|
||||
data() {
|
||||
return {
|
||||
searchList: [
|
||||
{
|
||||
id: 1,
|
||||
name: "酒"
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "鸿星尔克"
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "361"
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "国美"
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "刘丹"
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "榴莲"
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "会心一笑"
|
||||
}
|
||||
],
|
||||
// 搜索历史记录
|
||||
isShowSearch: false,
|
||||
searchVal: null,
|
||||
poductList: [],
|
||||
// 产品列表
|
||||
imgSize: "min"
|
||||
// big:大,min:笑
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
jumpHome() {
|
||||
common_vendor.index.switchTab({
|
||||
url: "/pages/home/home"
|
||||
});
|
||||
},
|
||||
// 删除历史
|
||||
searchHistoryDelete(item) {
|
||||
common_vendor.index.__f__("log", "at pages/search/search.vue:141", "item", item);
|
||||
this.isShowSearch = false;
|
||||
},
|
||||
/**
|
||||
* 查询产品
|
||||
*/
|
||||
async searchClick(item) {
|
||||
this.searchVal = item.name;
|
||||
this.searchClickFun();
|
||||
},
|
||||
/**
|
||||
* 查询产品
|
||||
*/
|
||||
async searchClickFun() {
|
||||
const param = {
|
||||
keyword: this.searchVal
|
||||
};
|
||||
const resp = await api_product.searchList(param);
|
||||
if (resp && resp.bizcode === 100) {
|
||||
this.poductList = resp.data;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 切换图大小
|
||||
*/
|
||||
toggleImg() {
|
||||
this.imgSize = this.imgSize === "big" ? "min" : "big";
|
||||
},
|
||||
jumpInfo(item) {
|
||||
common_vendor.index.navigateTo({
|
||||
url: "/pages/productInfo/productInfo?id=" + item.id
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
if (!Array) {
|
||||
const _easycom_up_image2 = common_vendor.resolveComponent("up-image");
|
||||
const _easycom_up_input2 = common_vendor.resolveComponent("up-input");
|
||||
const _easycom_up_tag2 = common_vendor.resolveComponent("up-tag");
|
||||
(_easycom_up_image2 + _easycom_up_input2 + _easycom_up_tag2)();
|
||||
}
|
||||
const _easycom_up_image = () => "../../uni_modules/uview-plus/components/u-image/u-image.js";
|
||||
const _easycom_up_input = () => "../../uni_modules/uview-plus/components/u-input/u-input.js";
|
||||
const _easycom_up_tag = () => "../../uni_modules/uview-plus/components/u-tag/u-tag.js";
|
||||
if (!Math) {
|
||||
(_easycom_up_image + _easycom_up_input + _easycom_up_tag)();
|
||||
}
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.o($options.jumpHome),
|
||||
b: common_vendor.p({
|
||||
src: "/static/common/left.png",
|
||||
width: "20",
|
||||
height: "20",
|
||||
bgColor: "#f1f6ff00"
|
||||
}),
|
||||
c: common_vendor.o($options.jumpHome),
|
||||
d: common_vendor.p({
|
||||
src: "/static/common/search.png",
|
||||
width: "20",
|
||||
height: "20",
|
||||
bgColor: "#f1f6ff00"
|
||||
}),
|
||||
e: common_vendor.o((...args) => $options.searchClickFun && $options.searchClickFun(...args)),
|
||||
f: common_vendor.o(($event) => $data.searchVal = $event),
|
||||
g: common_vendor.p({
|
||||
placeholder: "搜索关键字(商品、店铺、品牌)",
|
||||
customStyle: {
|
||||
"border-color": "#FF7C41 !important",
|
||||
"padding": "0 0 0 20rpx !important",
|
||||
"border-radius": "20rpx !important",
|
||||
"width": "590rpx"
|
||||
},
|
||||
modelValue: $data.searchVal
|
||||
}),
|
||||
h: !$data.searchVal
|
||||
}, !$data.searchVal ? common_vendor.e({
|
||||
i: common_vendor.o(($event) => {
|
||||
$data.isShowSearch = true;
|
||||
}),
|
||||
j: common_vendor.p({
|
||||
src: "/static/common/delete.png",
|
||||
width: "20",
|
||||
height: "20",
|
||||
bgColor: "#f1f6ff00"
|
||||
}),
|
||||
k: $data.searchList && $data.searchList.length !== 0
|
||||
}, $data.searchList && $data.searchList.length !== 0 ? {
|
||||
l: common_vendor.f($data.searchList, (item, k0, i0) => {
|
||||
return {
|
||||
a: common_vendor.o(($event) => $options.searchHistoryDelete(item), item.id),
|
||||
b: common_vendor.o(($event) => $options.searchClick(item), item.id),
|
||||
c: "c10c040c-4-" + i0,
|
||||
d: common_vendor.p({
|
||||
plain: true,
|
||||
text: item.name,
|
||||
type: "warning",
|
||||
show: true,
|
||||
closable: $data.isShowSearch
|
||||
}),
|
||||
e: item.id
|
||||
};
|
||||
})
|
||||
} : {
|
||||
m: common_vendor.p({
|
||||
src: "/static/common/not_search.png",
|
||||
width: "100",
|
||||
height: "100",
|
||||
bgColor: "#f1f6ff00"
|
||||
})
|
||||
}) : common_vendor.e({
|
||||
n: common_vendor.o($options.toggleImg),
|
||||
o: common_vendor.p({
|
||||
src: $data.imgSize === "big" ? "/static/search/dt.png" : "/static/search/xt.png",
|
||||
width: "20",
|
||||
height: "20",
|
||||
bgColor: "#f1f6ff00"
|
||||
}),
|
||||
p: $data.poductList && $data.poductList.length !== 0
|
||||
}, $data.poductList && $data.poductList.length !== 0 ? common_vendor.e({
|
||||
q: $data.imgSize === "big"
|
||||
}, $data.imgSize === "big" ? {
|
||||
r: common_vendor.f($data.poductList, (item, k0, i0) => {
|
||||
return {
|
||||
a: "c10c040c-7-" + i0,
|
||||
b: common_vendor.p({
|
||||
src: item.url,
|
||||
width: "100%",
|
||||
height: "150px",
|
||||
bgColor: "#f1f6ff00",
|
||||
radius: "10"
|
||||
}),
|
||||
c: common_vendor.t(item.title),
|
||||
d: common_vendor.t(item.adPrice),
|
||||
e: common_vendor.t(item.price),
|
||||
f: item.id,
|
||||
g: common_vendor.o(($event) => $options.jumpInfo(item), item.id)
|
||||
};
|
||||
})
|
||||
} : {}, {
|
||||
s: $data.imgSize === "min"
|
||||
}, $data.imgSize === "min" ? {
|
||||
t: common_vendor.f($data.poductList, (item, k0, i0) => {
|
||||
return {
|
||||
a: "c10c040c-8-" + i0,
|
||||
b: common_vendor.p({
|
||||
src: item.url,
|
||||
width: "100",
|
||||
height: "100",
|
||||
bgColor: "#f1f6ff00",
|
||||
radius: "10"
|
||||
}),
|
||||
c: common_vendor.t(item.title),
|
||||
d: common_vendor.t(item.adPrice),
|
||||
e: common_vendor.t(item.price),
|
||||
f: item.id,
|
||||
g: common_vendor.o(($event) => $options.jumpInfo(item), item.id)
|
||||
};
|
||||
})
|
||||
} : {}) : {
|
||||
v: common_vendor.p({
|
||||
src: "/static/common/not_search.png",
|
||||
width: "100",
|
||||
height: "100",
|
||||
bgColor: "#f1f6ff00"
|
||||
})
|
||||
}));
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-c10c040c"]]);
|
||||
wx.createPage(MiniProgramPage);
|
||||
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/search/search.js.map
|
||||
Reference in New Issue
Block a user