ISBN搜索接入孔夫子真实商品搜索API,替换mock数据
This commit is contained in:
parent
49a453f880
commit
63251f75c3
@ -210,11 +210,10 @@
|
||||
<!-- 商品列表 -->
|
||||
<view class="product-grid" v-else>
|
||||
<view class="grid-item" v-for="(item, index) in sortedProductList.slice(0, 12)" :key="index">
|
||||
<image class="grid-image" :src="item.image" mode="aspectFill" @click="previewProductImage(index)"></image>
|
||||
<text class="grid-total-price">¥{{ item.totalPrice }}</text>
|
||||
<text class="grid-price-detail">(书{{ item.bookPrice }}+运{{ item.shippingFee }})</text>
|
||||
<text class="grid-condition">{{ item.condition }}</text>
|
||||
<text class="grid-shop">{{ item.shopName }}</text>
|
||||
<text class="grid-book-name">{{ item.bookName || '未知书名' }}</text>
|
||||
<text class="grid-author">{{ item.author || item.shopName || '' }}</text>
|
||||
<text class="grid-total-price">{{ item.totalPrice }}</text>
|
||||
<text class="grid-condition">{{ item.condition || item.pubDate || '' }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 无数据提示 -->
|
||||
@ -721,7 +720,7 @@
|
||||
|
||||
<script>
|
||||
import { getWarehouseList, getLocationList, searchBookByIsbn } from '@/utils/api.js'
|
||||
import { login as kongfzLogin } from '@/utils/kongfz.js'
|
||||
import { login as kongfzLogin, searchProducts } from '@/utils/kongfz.js'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@ -917,17 +916,13 @@ export default {
|
||||
return
|
||||
}
|
||||
this.isLoading = true
|
||||
let bookDetail = null
|
||||
let marketDone = false
|
||||
this.productList = []
|
||||
|
||||
// 1. 查询图书中心 - 获取图书详情
|
||||
searchBookByIsbn(this.isbn).then(data => {
|
||||
bookDetail = data
|
||||
// 更新表单字段
|
||||
if (data.book_name) this.bookName = data.book_name
|
||||
if (data.author) this.author = data.author
|
||||
if (data.publisher) this.publisher = data.publisher
|
||||
// 定价:fix_price 单位为分,转为元
|
||||
if (data.fix_price && data.fix_price > 0) {
|
||||
this.fixPrice = (data.fix_price / 100).toFixed(2)
|
||||
}
|
||||
@ -938,26 +933,37 @@ export default {
|
||||
console.log('图书中心查询无结果:', err)
|
||||
})
|
||||
|
||||
// 2. 模拟孔网市场数据(后续接入真实API)
|
||||
setTimeout(() => {
|
||||
// 2. 搜索孔夫子 - 获取在售商品信息
|
||||
searchProducts(this.isbn).then(data => {
|
||||
this.isLoading = false
|
||||
marketDone = true
|
||||
// 模拟市场数据
|
||||
this.marketData = {
|
||||
onSale: Math.floor(Math.random() * 50) + 10,
|
||||
old: Math.floor(Math.random() * 30) + 5,
|
||||
new: Math.floor(Math.random() * 20) + 1,
|
||||
sold: Math.floor(Math.random() * 10) + 1
|
||||
if (data && data.total > 0) {
|
||||
// 市场统计
|
||||
this.marketData = {
|
||||
onSale: data.total || 0,
|
||||
old: 0,
|
||||
new: 0,
|
||||
sold: 0
|
||||
}
|
||||
// 在售商品列表(最多12条)
|
||||
const list = (data.list || []).slice(0, 12)
|
||||
this.productList = list.map(item => ({
|
||||
image: '',
|
||||
totalPrice: item.prodNum + '本在售',
|
||||
bookPrice: '',
|
||||
shippingFee: '',
|
||||
condition: item.binding || '',
|
||||
shopName: item.press || '',
|
||||
bookName: item.bookName || '',
|
||||
author: item.author || '',
|
||||
pubDate: item.pubDate || '',
|
||||
bookId: item.bookId || ''
|
||||
}))
|
||||
} else {
|
||||
this.marketData = { onSale: 0, old: 0, new: 0, sold: 0 }
|
||||
}
|
||||
// 模拟在售商品
|
||||
this.productList = [
|
||||
{ image: '', totalPrice: '28.00', bookPrice: '25.00', shippingFee: '3.00', condition: '九品', shopName: '孔网书店' },
|
||||
{ image: '', totalPrice: '35.00', bookPrice: '32.00', shippingFee: '3.00', condition: '九五品', shopName: '旧书坊' },
|
||||
{ image: '', totalPrice: '22.00', bookPrice: '20.00', shippingFee: '2.00', condition: '八五品', shopName: '书香阁' },
|
||||
{ image: '', totalPrice: '30.00', bookPrice: '28.00', shippingFee: '2.00', condition: '九品', shopName: '古旧书店' }
|
||||
]
|
||||
if (!this.isLoading) { /* already hidden */ }
|
||||
}, 1500)
|
||||
}).catch(() => {
|
||||
this.isLoading = false
|
||||
})
|
||||
},
|
||||
|
||||
// 品相选择
|
||||
@ -1836,7 +1842,7 @@ export default {
|
||||
/* ========== 商品网格 ========== */
|
||||
.product-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 10rpx;
|
||||
margin-top: 14rpx;
|
||||
}
|
||||
@ -1855,17 +1861,37 @@ export default {
|
||||
}
|
||||
|
||||
.grid-total-price {
|
||||
font-size: 28rpx;
|
||||
font-size: 22rpx;
|
||||
color: #f56c6c;
|
||||
font-weight: 600;
|
||||
display: block;
|
||||
margin-top: 6rpx;
|
||||
margin-top: 4rpx;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.grid-price-detail {
|
||||
.grid-book-name {
|
||||
font-size: 24rpx;
|
||||
color: #303133;
|
||||
font-weight: 500;
|
||||
display: block;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.grid-author {
|
||||
font-size: 20rpx;
|
||||
color: #909399;
|
||||
display: block;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
margin-top: 2rpx;
|
||||
}
|
||||
|
||||
.grid-condition {
|
||||
@ -1873,6 +1899,7 @@ export default {
|
||||
color: #606266;
|
||||
display: block;
|
||||
margin-top: 4rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.grid-shop {
|
||||
|
||||
1
temp_kongfz_chunk_index1.txt
Normal file
1
temp_kongfz_chunk_index1.txt
Normal file
@ -0,0 +1 @@
|
||||
import{t as E,am as P,r as m,x as a,G as u,A as i,O as v,ad as p,I as V,g as S,v as s,F as N,ao as T,ap as M,a3 as B}from"./chunk-vendor.BEvyqpzI.js";import{u as D,A as O,q as w,f as q,a as F,b as G}from"./product-BETIuZ_J.js";import{d as L}from"./chunk-elementPlus.BwuzvisO.js";import{i as U}from"./chunk-preload-helper.C2F1rpzq.js";/* empty css */import"./chunk-object.BU-HPFRj.js";import"./chunk-SearchTypeEnum.DVsuZ0pI.js";const J=_=>(T("data-v-3694c412"),_=_(),M(),_),W={key:0,class:"more-view-container"},z={class:"result-title"},H={class:"result-list"},K=["onClick"],Q={key:0,class:"item-num"},X=J(()=>i("p",{class:"result-title-sket"},null,-1)),Y={class:"result-list"},Z=E({name:"MoreView",__name:"index",setup(_){const{query:g}=P(),j=m(!1),I=m(""),A=m([]),[b]=O(g,{});b().then(e=>{if(e.status===1){const c=e.data.labels.reduce((t,l,r)=>{const o=Math.floor(r/12);return t[o]||(t[o]=[]),t[o].push(l),t},[]).reduce((t,l,r)=>{const o=Math.floor(r/3);return t[o]||(t[o]=[]),t[o].push(l),t},[]);A.value=c,I.value=e.data.tplName,document.title=e.data.tplName,j.value=!0}}).catch(e=>{$(e)});const f=m(!0),h=D();function $(e){var n,d,c,t,l,r,o;if(e.type==="data")switch(((n=e.data)==null?void 0:n.errType)||""){case"102":h.setRequestRejectInfo({requestRejectAction:(c=(d=e.data)==null?void 0:d.data)==null?void 0:c.requestRejectAction,requestRejectCause:(l=(t=e.data)==null?void 0:t.data)==null?void 0:l.requestRejectCause,requestVerifyUrl:((o=(r=e.data)==null?void 0:r.data)==null?void 0:o.requestVerifyWebUrl)||""}),f.value=!1;break;default:h.setRequestRejectInfo({requestRejectAction:"DATA_ERROR",requestRejectCause:e.message}),f.value=!1;break}else if(e.type==="status"){switch(e.typeDetail){case"netError":h.setRequestRejectInfo({requestRejectAction:"NET_ERROR",requestRejectCause:"网络好像迷路了,请注意检查您的网络连接~"});break;case"serverError":h.setRequestRejectInfo({requestRejectAction:"SERVER_ERROR",requestRejectCause:"服务器开小差了,我们正在抓紧恢复中~"});break}f.value=!1}else e.type!=="cancel"&&L({message:e.message,grouping:!0,type:"error",offset:130})}const R=S(),k=(R==null?void 0:R.appContext.config.globalProperties.$sites)||{},y=e=>G(e.name,g.actionPath||"",e.name),x=e=>{const n=B(e.params);switch(n.searchType){case"keyword":window.open("".concat(k.s_search,"product/").concat(w(q(n)),"&actionPath=").concat(y(e)),"_self");break;case"category":window.open("".concat(k.s_search,"product/category/").concat(w(q(n)),"&actionPath=").concat(y(e)),"_self");break;case"latest":window.open("".concat(k.s_search,"product/latest/").concat(w(q(n)),"&actionPath=").concat(y(e)),"_self");break}};return(e,n)=>f.value?(s(),a("div",W,[j.value?(s(),a(u,{key:0},[i("h6",z,v(I.value),1),i("div",H,[(s(!0),a(u,null,p(A.value,(d,c)=>(s(),a("div",{class:"result-list__row clearfix",key:c},[(s(!0),a(u,null,p(d,(t,l)=>(s(),a("ul",{class:"result-list__column",key:l},[(s(!0),a(u,null,p(t,(r,o)=>(s(),a("li",{class:"result-list__item",key:o},[i("a",{href:"javascript:;",class:"item-name",onClick:C=>x(r)},v(r.showName),9,K),r.showValue!=0?(s(),a("span",Q,"("+v(r.showValue)+")",1)):N("",!0)]))),128))]))),128))]))),128))])],64)):(s(),a(u,{key:1},[X,i("div",Y,[(s(),a(u,null,p(3,d=>i("div",{class:"result-list__row clearfix",key:d},[(s(),a(u,null,p(3,c=>i("ul",{class:"result-list__column",key:c},[(s(),a(u,null,p(9,t=>i("li",{class:"result-list-sket__item",key:t})),64))])),64))])),64))])],64))])):(s(),V(F,{key:1}))}}),ce=U(Z,[["__scopeId","data-v-3694c412"]]);export{ce as default};
|
||||
1
temp_kongfz_chunk_index2.txt
Normal file
1
temp_kongfz_chunk_index2.txt
Normal file
@ -0,0 +1 @@
|
||||
import{i as c}from"./chunk-preload-helper.C2F1rpzq.js";import{E as n}from"./chunk-elementPlus.BwuzvisO.js";import{t as r,x as i,L as p,J as _,v as d,a2 as l,ao as m,ap as f,A as t}from"./chunk-vendor.BEvyqpzI.js";const h="https://static.kongfz.com/search-v3/assets/images/not-found-_sPryl7V.png",e=o=>(m("data-v-7389e0ba"),o=o(),f(),o),u={class:"not-found-view"},w=e(()=>t("img",{class:"placeholder-img",src:h,alt:""},null,-1)),x=e(()=>t("p",{class:"error-title"},"抱歉,您要找的页面不存在",-1)),b=r({name:"NotFoundView",__name:"index",setup(o){const s=()=>{window.location.href="https://www.kongfz.com/"};return(g,k)=>{const a=n;return d(),i("div",u,[w,x,p(a,{class:"el-button--primary back-btn",onClick:s},{default:_(()=>[l("返回首页")]),_:1})])}}}),I=c(b,[["__scopeId","data-v-7389e0ba"]]);export{I as default};
|
||||
11
temp_kongfz_main_js.txt
Normal file
11
temp_kongfz_main_js.txt
Normal file
File diff suppressed because one or more lines are too long
42
temp_kongfz_preload.txt
Normal file
42
temp_kongfz_preload.txt
Normal file
File diff suppressed because one or more lines are too long
156
temp_kongfz_search.html
Normal file
156
temp_kongfz_search.html
Normal file
@ -0,0 +1,156 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-Hans">
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="Cache-Control" content="no-siteapp" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||
<meta name="renderer" content="webkit" />
|
||||
<meta name="viewport" content="width=1240" />
|
||||
<meta name="format-detection" content="telephone=no" />
|
||||
<meta name="format-detection" content="email=no" />
|
||||
<meta content="" name="keywords" />
|
||||
<meta content="" name="description" />
|
||||
<script type="text/javascript">
|
||||
//跳转到vue2版页面
|
||||
function toVue2Page() {
|
||||
var _domain = 'https://search.kongfz.com';
|
||||
var url = _domain + '/ie/product';
|
||||
if (location.pathname.indexOf('category') !== -1) {
|
||||
url += '/category';
|
||||
} else if(location.pathname.indexOf('latest') !== -1) {
|
||||
url += '/latest';
|
||||
} else if(location.pathname.indexOf('more') !== -1) {
|
||||
url += '/more';
|
||||
}
|
||||
location.href = url + location.search || '';
|
||||
}
|
||||
//浏览器检查
|
||||
function _browserCheck() {
|
||||
var _ua = navigator.userAgent.toLowerCase(),
|
||||
isXP = _ua && _ua.indexOf('windows nt 5') != -1,
|
||||
isIE7 = _ua && _ua.indexOf('msie 7.0') != -1,
|
||||
isIE8 = _ua && _ua.indexOf('msie 8.0') != -1,
|
||||
isIE9 = _ua && _ua.indexOf('msie 9.0') != -1,
|
||||
isIE10 = _ua && _ua.indexOf('msie 10.0') != -1,
|
||||
isIE11 = _ua && _ua.indexOf('trident/') != -1 && _ua.indexOf('rv:11.') != -1,
|
||||
isUBrowser = _ua && _ua.indexOf('ubrowser') != -1, //UBrowser uc
|
||||
isTheWorld = _ua && _ua.indexOf('theworld') != -1; //世界之窗
|
||||
var isChrome = _ua && _ua.match(/chrome\/(\d+)\./),
|
||||
isLowChrome = false;//low Chrome
|
||||
if (isChrome && isChrome.length > 1 && Number(isChrome[1]) < 69) {
|
||||
isLowChrome = true
|
||||
}
|
||||
var isSafari = _ua && _ua.match(/version\/(\d+)\./),
|
||||
isLowSafari = false; //low safari
|
||||
if (isSafari && isSafari.length > 1 && Number(isSafari[1]) < 11) {
|
||||
isLowSafari = true
|
||||
}
|
||||
if (isIE9 || isIE10 || isIE11 || isLowChrome || isLowSafari || isUBrowser || isTheWorld) {
|
||||
toVue2Page()
|
||||
}
|
||||
}
|
||||
_browserCheck();
|
||||
|
||||
function supportJs() {
|
||||
var _ua = navigator.userAgent.toLowerCase(),
|
||||
isXP = _ua && _ua.indexOf('windows nt 5') != -1,
|
||||
isIE7 = _ua && _ua.indexOf('msie 7.0') != -1,
|
||||
isIE8 = _ua && _ua.indexOf('msie 8.0') != -1,
|
||||
isIE9 = _ua && _ua.indexOf('msie 9.0') != -1,
|
||||
isIE10 = _ua && _ua.indexOf('msie 10.0') != -1,
|
||||
isIE11 = _ua && _ua.indexOf('trident/') != -1 && _ua.indexOf('rv:11.') != -1,
|
||||
isUBrowser = _ua && _ua.indexOf('ubrowser') != -1, //UBrowser uc
|
||||
isTheWorld = _ua && _ua.indexOf('theworld') != -1; //世界之窗
|
||||
var isChrome = _ua && _ua.match(/chrome\/(\d+)\./),
|
||||
isLowChrome = false;//low Chrome
|
||||
if (isChrome && isChrome.length > 1 && Number(isChrome[1]) < 69) {
|
||||
isLowChrome = true
|
||||
}
|
||||
var isSafari = _ua && _ua.match(/version\/(\d+)\./),
|
||||
isLowSafari = false; //low safari
|
||||
if (isSafari && isSafari.length > 1 && Number(isSafari[1]) < 11) {
|
||||
isLowSafari = true
|
||||
}
|
||||
if (isIE7 || isIE8) {
|
||||
return 'jquery'
|
||||
} else if (isIE9 || isIE10 || isIE11 || isLowChrome || isLowSafari || isUBrowser || isTheWorld) {
|
||||
return 'vue2'
|
||||
} else {
|
||||
return 'vue3'
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
window.KFZ_PAGE_INIT_TIME = new Date().getTime();
|
||||
</script>
|
||||
<script type="module" crossorigin src="https://static.kongfz.com/search-v3/assets/product-BETIuZ_J.js"></script>
|
||||
<link rel="modulepreload" crossorigin href="https://static.kongfz.com/search-v3/assets/chunk-vendor.BEvyqpzI.js">
|
||||
<link rel="modulepreload" crossorigin href="https://static.kongfz.com/search-v3/assets/chunk-elementPlus.BwuzvisO.js">
|
||||
<link rel="modulepreload" crossorigin href="https://static.kongfz.com/search-v3/assets/chunk-preload-helper.C2F1rpzq.js">
|
||||
<link rel="modulepreload" crossorigin href="https://static.kongfz.com/search-v3/assets/chunk-object.BU-HPFRj.js">
|
||||
<link rel="modulepreload" crossorigin href="https://static.kongfz.com/search-v3/assets/chunk-SearchTypeEnum.DVsuZ0pI.js">
|
||||
<link rel="stylesheet" crossorigin href="https://static.kongfz.com/search-v3/assets/preload-helper-pD0ob2W0.css">
|
||||
<link rel="stylesheet" crossorigin href="https://static.kongfz.com/search-v3/assets/SearchTypeEnum-iU9jAdZr.css">
|
||||
<link rel="stylesheet" crossorigin href="https://static.kongfz.com/search-v3/assets/product-BbGyCC7j.css">
|
||||
<link rel="stylesheet" crossorigin href="https://static.kongfz.com/search-v3/assets/el-select-jitKNRXQ.css">
|
||||
<script type="module">import.meta.url;import("_").catch(()=>1);(async function*(){})().next();if(location.protocol!="file:"){window.__vite_is_modern_browser=true}</script>
|
||||
<script type="module">!function(){if(window.__vite_is_modern_browser)return;console.warn("vite: loading legacy chunks, syntax error above and the same error below should be ignored");var e=document.getElementById("vite-legacy-polyfill"),n=document.createElement("script");n.src=e.src,n.onload=function(){System.import(document.getElementById('vite-legacy-entry').getAttribute('data-src'))},document.body.appendChild(n)}();</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="text/javascript">
|
||||
(function (win) {
|
||||
var _selfUrl = encodeURIComponent(location.href),
|
||||
_refUrl = encodeURIComponent(document.referrer),
|
||||
winWidth = window.screen.width,
|
||||
winHeight = window.screen.height;
|
||||
var commonData = {
|
||||
resolution: winWidth + 'x' + winHeight,
|
||||
selfUrl: _selfUrl,
|
||||
refUrl: _refUrl,
|
||||
utmSource: ''
|
||||
};
|
||||
var track = function () {
|
||||
this.v = '1.0.2';
|
||||
};
|
||||
track.prototype.send = function (ev, data) {
|
||||
var dataStr = '';
|
||||
if (data && typeof data == 'object') {
|
||||
dataStr = encodeURIComponent(JSON.stringify(data));
|
||||
}
|
||||
var __imgurl = '//tj.kongfz.com/web/collect/1.gif';
|
||||
if (window.location.href.indexOf('neibu') > -1) {
|
||||
__imgurl = '//neibutj.kongfz.com/web/collect/1.gif';
|
||||
}
|
||||
//utm_source
|
||||
var locSearch = window.location.search;
|
||||
var locHost = window.location.host;
|
||||
if (locHost == 'item.kongfz.com' && locSearch.indexOf('utm_source') > -1) {
|
||||
commonData.utmSource = locSearch.substring(locSearch.indexOf('utm_source')).split('=')[1];
|
||||
}
|
||||
__imgurl += '?event=' + ev + '&resolution=' + commonData.resolution + '&selfUrl=' + commonData.selfUrl + '&refUrl=' + commonData.refUrl + '&eventAttr=' + dataStr + "&utmSource=" + commonData.utmSource + "&n_" + Math.random();
|
||||
|
||||
// 由于服务器采集端 (.gif) 可能不支持 POST 请求导致 sendBeacon 报 405 错误,
|
||||
// 这里统一使用创建独立 Image 对象的方式发送 GET 请求。
|
||||
// 这种方式既能保证请求是 GET 类型,又能通过独立实例避免请求被后续调用取消。
|
||||
var _img = new Image();
|
||||
_img.onload = _img.onerror = function() {
|
||||
_img = null; // 释放内存
|
||||
};
|
||||
_img.src = __imgurl;
|
||||
};
|
||||
win.trackPro = new track();
|
||||
})(window);
|
||||
</script>
|
||||
<!-- <script src="https://res2.kongfz.com/mobile/js/track.js?2019070314"></script> -->
|
||||
<script nomodule>!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",(function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()}),!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script>
|
||||
<script nomodule crossorigin id="vite-legacy-polyfill" src="https://static.kongfz.com/search-v3/assets/polyfills-legacy-BcS4InRA.js"></script>
|
||||
<script nomodule crossorigin id="vite-legacy-entry" data-src="https://static.kongfz.com/search-v3/assets/product-legacy-CaSSjz0m.js">System.import(document.getElementById('vite-legacy-entry').getAttribute('data-src'))</script>
|
||||
</body>
|
||||
<link rel="stylesheet" href="https://res2.kongfz.com/common/popover/popover.css?v=202603051423">
|
||||
<script src="https://res2.kongfz.com/common/popover/popover.js?v=202603051423"></script>
|
||||
|
||||
</html>
|
||||
98
temp_kongfz_search_vue2.html
Normal file
98
temp_kongfz_search_vue2.html
Normal file
@ -0,0 +1,98 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-Hans">
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="Cache-Control" content="no-siteapp" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||
<meta name="renderer" content="webkit" />
|
||||
<meta name="viewport" content="width=1240" />
|
||||
<meta name="format-detection" content="telephone=no" />
|
||||
<meta name="format-detection" content="email=no" />
|
||||
<meta http-equiv="Pragma" content="no-cache">
|
||||
<meta http-equiv="Cache-Control" content="no-cache">
|
||||
<meta http-equiv="Expires" content="0">
|
||||
<meta content="" name="keywords" />
|
||||
<meta content="" name="description" />
|
||||
<script src="https://res2.kongfz.com/mobile/js/track.js?2019070314"></script>
|
||||
<script type="module" crossorigin src="https://static.kongfz.com/search-v2/assets/product.b6c17ed0.js"></script>
|
||||
<link rel="modulepreload" crossorigin href="https://static.kongfz.com/search-v2/assets/chunk-button.eb8c6a0f.js">
|
||||
<link rel="modulepreload" crossorigin href="https://static.kongfz.com/search-v2/assets/chunk-vendor.eca28747.js">
|
||||
<link rel="modulepreload" crossorigin href="https://static.kongfz.com/search-v2/assets/chunk-ElementUI.a8f8e446.js">
|
||||
<link rel="modulepreload" crossorigin href="https://static.kongfz.com/search-v2/assets/chunk-iconfont.dd101a92.js">
|
||||
<link rel="stylesheet" href="https://static.kongfz.com/search-v2/assets/button-5a1c117f.css">
|
||||
<link rel="stylesheet" href="https://static.kongfz.com/search-v2/assets/iconfont-c477feab.css">
|
||||
<link rel="stylesheet" href="https://static.kongfz.com/search-v2/assets/index-0ee4c2c2.css">
|
||||
<script type="module">try{import.meta.url;import("_").catch(()=>1);}catch(e){}window.__vite_is_modern_browser=true;</script>
|
||||
<script type="module">!function(){if(window.__vite_is_modern_browser)return;console.warn("vite: loading legacy build because dynamic import or import.meta.url is unsupported, syntax error above should be ignored");var e=document.getElementById("vite-legacy-polyfill"),n=document.createElement("script");n.src=e.src,n.onload=function(){System.import(document.getElementById('vite-legacy-entry').getAttribute('data-src'))},document.body.appendChild(n)}();</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="__ieCheck"></div>
|
||||
<div id="__ieCheck_mask"></div>
|
||||
<div id="app"></div>
|
||||
<script type="text/javascript">
|
||||
function _getUrlKeyVal(name) {
|
||||
var regex = new RegExp("[?&]" + encodeURIComponent(name) + "\\=([^&#]+)");
|
||||
var value = (location.search.match(regex) || ["", ""])[1];
|
||||
return decodeURIComponent(value)
|
||||
}
|
||||
function _closeLayer() {
|
||||
document.getElementById('__ieCheck_mask').style.display = 'none'
|
||||
document.getElementById('__ieCheck').style.display = 'none'
|
||||
location.href = 'https://www.kongfz.com/'
|
||||
}
|
||||
function _layerUpdate(){
|
||||
var templeteHtml =
|
||||
'<div style="position:fixed;left:50%;top:50%;width:680px;height:400px;margin-left:-340px;margin-top:-200px;border-radius: 4px;background:#fff;overflow:hidden;z-index:100000001;">' +
|
||||
'<div style="width:100%;height:70px;text-align:center;line-height:70px;font-size:22px;background:#EDF6FF;">浏览器升级提示</div>' +
|
||||
'<div style="width:592px;height:216px;border-bottom:1px solid #E5E5E5;margin:0 auto;overflow:hidden;">' +
|
||||
'<div style="float:left;width:400px;height:180px;margin-top:30px;font-size:16px;color: #262626;line-height: 22px;">' +
|
||||
'<p style="margin: 10px 0;">您的浏览器版本过低</p>' +
|
||||
'<p style="margin: 10px 0;">为避免购物时可能存在的安全风险,建议您升级浏览器。</p>' +
|
||||
'<p style="margin: 10px 0;">如您开启了浏览器兼容模式,建议切换到极速模式,可以享受到更流畅的操作体验。</p>' +
|
||||
'<p style="margin:20px 0 20px 0;"><a <a href="javascript:;" onClick="_closeLayer()" style="font-size:14px;color:#105FB3">返回首页</a></p>' +
|
||||
'</div>' +
|
||||
'<div style="float:right;width:120px;font-size:0;margin-top:41px;text-align:center;">' +
|
||||
'<img src="https://res.kongfz.com/img/ie-check/kfzapp.png" width="120" height="120" style="width:120px;height:120px;" alt="">' +
|
||||
'<span style="font-size:12px;color:#999999;line-height:34px;">下载孔夫子旧书网App</span>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'<div style="width:592px;margin:0 auto;">' +
|
||||
'<div style="font-size:12px;color:#999999;margin-top:10px;">或者您还可以下载:</div>' +
|
||||
'<div style="width:100%;margin-top:6px;line-height: 0px;text-align:center;">' +
|
||||
'<div style="float:left;width:50px;text-decoration:none;line-height:0px;text-align:center;margin-right: 27px;"><a target="_blank" href="https://www.google.cn/chrome/" ><div><img width="40" height="40" style="width:40px;height:40px;" src="https://res.kongfz.com/img/ie-check/google.png" alt=""></div><span style="font-size:12px;color:#999999;line-height:20px;">Chrome</span></a></div>' +
|
||||
'<div style="float:left;width:50px;text-decoration:none;line-height:0px;text-align:center;margin-right: 27px;"><a target="_blank" href="https://ie.sogou.com/"><div><img width="40" height="40" style="width:40px;height:40px;" src="https://res.kongfz.com/img/ie-check/sougou.png" alt=""></div><span style="font-size:12px;color:#999999;line-height:20px;">搜狗</span></a></div>' +
|
||||
'<div style="float:left;width:50px;text-decoration:none;line-height:0px;text-align:center;margin-right: 27px;"><a target="_blank" href="https://browser.qq.com/?adtag=SEM1"><div><img width="40" height="40" style="width:40px;height:40px;" src="https://res.kongfz.com/img/ie-check/qq.png" alt=""></div><span style="font-size:12px;color:#999999;line-height:20px;">QQ</span></a></div>' +
|
||||
'<div style="float:left;width:50px;text-decoration:none;line-height:0px;text-align:center;margin-right: 27px;"><a target="_blank" href="https://browser.360.cn/se/"><div><img width="40" height="40" style="width:40px;height:40px;" src="https://res.kongfz.com/img/ie-check/360.png" alt=""></div><span style="font-size:12px;color:#999999;line-height:20px;">360</span></a></div>' +
|
||||
'<div style="float:left;width:50px;text-decoration:none;line-height:0px;text-align:center;margin-right: 27px;"><a target="_blank" href="https://www.liebao.cn/"><div><img width="40" height="40" style="width:40px;height:40px;" src="https://res.kongfz.com/img/ie-check/liebao.png" alt=""></div><span style="font-size:12px;color:#999999;line-height:20px;">猎豹</span></a></div>' +
|
||||
'<div style="float:left;width:50px;text-decoration:none;line-height:0px;text-align:center;margin-right: 27px;"><a target="_blank" href="http://www.firefox.com.cn/"><div><img width="40" height="40" style="width:40px;height:40px;" src="https://res.kongfz.com/img/ie-check/firefox.png" alt=""></div><span style="font-size:12px;color:#999999;line-height:20px;">Firefox</span></a></div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>'
|
||||
var mask =
|
||||
'<div style="position: fixed;top: 0px;left: 0px;z-index: 100000000;width: 100%;height: 100%;background-color: #000;filter: alpha(opacity=50); opacity: .5;"></div>'
|
||||
document.getElementById('__ieCheck_mask').innerHTML = mask
|
||||
document.getElementById('__ieCheck').innerHTML = templeteHtml
|
||||
}
|
||||
//浏览器检查
|
||||
function _browserCheck(){
|
||||
var _ua = navigator.userAgent.toLowerCase(),
|
||||
isXP = _ua && _ua.indexOf('windows nt 5') != -1,
|
||||
isIE7 = _ua && _ua.indexOf('msie 7.0') != -1,
|
||||
isIE8 = _ua && _ua.indexOf('msie 8.0') != -1,
|
||||
isIE9 = _ua && _ua.indexOf('msie 9.0') != -1,
|
||||
isIE10 = _ua && _ua.indexOf('msie 10.0') != -1,
|
||||
isIE11 = _ua && _ua.indexOf('trident/') != -1 && _ua.indexOf('rv:11.') != -1;
|
||||
if (isIE7 || isIE8 || isIE9) {
|
||||
_layerUpdate()
|
||||
}
|
||||
}
|
||||
_browserCheck();
|
||||
</script>
|
||||
|
||||
<script nomodule>!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",(function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()}),!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script>
|
||||
<script nomodule crossorigin id="vite-legacy-polyfill" src="https://static.kongfz.com/search-v2/assets/polyfills-legacy.ba0a0481.js"></script>
|
||||
<script nomodule crossorigin id="vite-legacy-entry" data-src="https://static.kongfz.com/search-v2/assets/product-legacy.e91e506f.js">System.import(document.getElementById('vite-legacy-entry').getAttribute('data-src'))</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
25
temp_kongfz_vendor.txt
Normal file
25
temp_kongfz_vendor.txt
Normal file
File diff suppressed because one or more lines are too long
@ -144,3 +144,40 @@ export default {
|
||||
login,
|
||||
fetchItems
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索孔夫子商品(公开搜索API,无需登录)
|
||||
* @param {string} keyword ISBN或书名
|
||||
* @param {number} page 页码
|
||||
* @returns {Promise<{total: number, list: Array}>}
|
||||
*/
|
||||
export function searchProducts(keyword, page = 1) {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.request({
|
||||
url: `https://search.kongfz.com/pc-gw/search-web/client/pc/product/keyword/isbnList?dataType=0&keyword=${encodeURIComponent(keyword)}&page=${page}`,
|
||||
method: 'GET',
|
||||
header: {
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36',
|
||||
'Referer': `https://search.kongfz.com/product/?keyword=${encodeURIComponent(keyword)}`,
|
||||
'sec-ch-ua': '"Chromium";v="148", "Google Chrome";v="148", "Not/A)Brand";v="99"',
|
||||
'sec-ch-ua-mobile': '?0',
|
||||
'sec-ch-ua-platform': '"Windows"'
|
||||
},
|
||||
success: (res) => {
|
||||
console.log('孔夫子搜索响应:', res.statusCode, res.data)
|
||||
if (res.statusCode === 200 && res.data && res.data.status === 1 && res.data.data) {
|
||||
resolve(res.data.data)
|
||||
} else if (res.statusCode === 200 && res.data && res.data.data) {
|
||||
resolve(res.data.data)
|
||||
} else {
|
||||
resolve({ total: 0, list: [] })
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('孔夫子搜索失败:', err)
|
||||
resolve({ total: 0, list: [] })
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user