修改商品列表切换无数据,修改商品列表请求数据重复的问题

This commit is contained in:
Gao xiaosong
2021-11-07 23:00:14 +08:00
parent c965a72359
commit 0a13a11ec6
4 changed files with 215 additions and 190 deletions

View File

@ -2,10 +2,15 @@
// launchtype项可配置值为local或remote, local代表前端连本地云函数remote代表前端连云端云函数 // launchtype项可配置值为local或remote, local代表前端连本地云函数remote代表前端连云端云函数
"version": "0.0", "version": "0.0",
"configurations": [{ "configurations": [{
"type": "uniCloud", "default" :
"default": { {
"launchtype": "remote" "launchtype" : "remote"
} },
} "h5" :
{
"launchtype" : "remote"
},
"type" : "uniCloud"
}
] ]
} }

View File

@ -1,181 +1,191 @@
{ {
"name" : "yshopmall", "name": "yshopmall",
"appid" : "__UNI__C7A519E", "appid": "__UNI__C7A519E",
"description" : "", "description": "",
"versionName" : "1.0.1", "versionName": "1.0.1",
"versionCode" : 1, "versionCode": 1,
"transformPx" : false, "transformPx": false,
/* 5+App */ /* 5+App */
"app-plus" : { "app-plus": {
"usingComponents" : true, "usingComponents": true,
"nvueCompiler" : "uni-app", "nvueCompiler": "uni-app",
"compilerVersion" : 3, "compilerVersion": 3,
"splashscreen" : { "splashscreen": {
"alwaysShowBeforeRender" : true, "alwaysShowBeforeRender": true,
"waiting" : false, "waiting": false,
"autoclose" : true, "autoclose": true,
"delay" : 0 "delay": 0
},
/* */
"modules": {
"OAuth": {},
"Payment": {},
"Share": {},
"Geolocation": {}
},
/* */
"distribute": {
/* android */
"android": {
"permissions": [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.READ_CONTACTS\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.WRITE_CONTACTS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.CALL_PHONE\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>",
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
]
},
/* ios */
"ios": {},
/* SDK */
"sdkConfigs": {
"oauth": {
"weixin": {
"appid": "wx7c84ede33062d1e4",
"appsecret": "c47ef66d3311194da44e60387d5c1abd",
"UniversalLinks": "https://yixiang.co/app/"
}
}, },
/* */ "payment": {
"modules" : { "weixin": {
"OAuth" : {}, "appid": "wx7c84ede33062d1e4",
"Payment" : {}, "UniversalLinks": "https://yixiang.co/app/"
"Share" : {}, }
"Geolocation" : {}
}, },
/* */ "share": {
"distribute" : { "weixin": {
/* android */ "appid": "wx7c84ede33062d1e4",
"android" : { "UniversalLinks": "https://yixiang.co/app/"
"permissions" : [ }
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>", },
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>", "ad": {},
"<uses-permission android:name=\"android.permission.READ_CONTACTS\"/>", "geolocation": {}
"<uses-permission android:name=\"android.permission.VIBRATE\"/>", },
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>", "splashscreen": {
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>", "ios": {
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>", "iphone": {
"<uses-permission android:name=\"android.permission.WRITE_CONTACTS\"/>", "portrait-896h@3x": "splash/1242+2688.png",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>", "portrait-896h@2x": "splash/828+1792.png",
"<uses-permission android:name=\"android.permission.CAMERA\"/>", "iphonex": "splash/1125+2436.png",
"<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>", "retina55": "splash/1142+2208.png",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>", "retina47": "splash/750+1334.png",
"<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>", "retina40": "splash/640+1136.png",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>", "retina35": "splash/640+960.png"
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>", }
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>", },
"<uses-permission android:name=\"android.permission.CALL_PHONE\"/>", "android": {
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>", "hdpi": "splash/480+762.png",
"<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>", "xhdpi": "splash/720+1242.png",
"<uses-feature android:name=\"android.hardware.camera\"/>", "xxhdpi": "splash/1080+1882.png"
"<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>", },
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>" "iosStyle": "common"
] },
}, "icons": {
/* ios */ "android": {
"ios" : {}, "hdpi": "icons/72x72.png",
/* SDK */ "xhdpi": "icons/96x96.png",
"sdkConfigs" : { "xxhdpi": "icons/144x144.png",
"oauth" : { "xxxhdpi": "icons/192x192.png"
"weixin" : { },
"appid" : "wx7c84ede33062d1e4", "ios": {
"appsecret" : "c47ef66d3311194da44e60387d5c1abd", "appstore": "icons/1024x1024.png",
"UniversalLinks" : "https://yixiang.co/app/" "ipad": {
} "app": "icons/76x76.png",
}, "app@2x": "icons/152x152.png",
"payment" : { "notification": "icons/20x20.png",
"weixin" : { "notification@2x": "icons/40x40.png",
"appid" : "wx7c84ede33062d1e4", "proapp@2x": "icons/167x167.png",
"UniversalLinks" : "https://yixiang.co/app/" "settings": "icons/29x29.png",
} "settings@2x": "icons/58x58.png",
}, "spotlight": "icons/40x40.png",
"share" : { "spotlight@2x": "icons/80x80.png"
"weixin" : { },
"appid" : "wx7c84ede33062d1e4", "iphone": {
"UniversalLinks" : "https://yixiang.co/app/" "app@2x": "icons/120x120.png",
} "app@3x": "icons/180x180.png",
}, "notification@2x": "icons/40x40.png",
"ad" : {}, "notification@3x": "icons/60x60.png",
"geolocation" : {} "settings@2x": "icons/58x58.png",
}, "settings@3x": "icons/87x87.png",
"splashscreen" : { "spotlight@2x": "icons/80x80.png",
"ios" : { "spotlight@3x": "icons/120x120.png"
"iphone" : { }
"portrait-896h@3x" : "splash/1242+2688.png",
"portrait-896h@2x" : "splash/828+1792.png",
"iphonex" : "splash/1125+2436.png",
"retina55" : "splash/1142+2208.png",
"retina47" : "splash/750+1334.png",
"retina40" : "splash/640+1136.png",
"retina35" : "splash/640+960.png"
}
},
"android" : {
"hdpi" : "splash/480+762.png",
"xhdpi" : "splash/720+1242.png",
"xxhdpi" : "splash/1080+1882.png"
},
"iosStyle" : "common"
},
"icons" : {
"android" : {
"hdpi" : "icons/72x72.png",
"xhdpi" : "icons/96x96.png",
"xxhdpi" : "icons/144x144.png",
"xxxhdpi" : "icons/192x192.png"
},
"ios" : {
"appstore" : "icons/1024x1024.png",
"ipad" : {
"app" : "icons/76x76.png",
"app@2x" : "icons/152x152.png",
"notification" : "icons/20x20.png",
"notification@2x" : "icons/40x40.png",
"proapp@2x" : "icons/167x167.png",
"settings" : "icons/29x29.png",
"settings@2x" : "icons/58x58.png",
"spotlight" : "icons/40x40.png",
"spotlight@2x" : "icons/80x80.png"
},
"iphone" : {
"app@2x" : "icons/120x120.png",
"app@3x" : "icons/180x180.png",
"notification@2x" : "icons/40x40.png",
"notification@3x" : "icons/60x60.png",
"settings@2x" : "icons/58x58.png",
"settings@3x" : "icons/87x87.png",
"spotlight@2x" : "icons/80x80.png",
"spotlight@3x" : "icons/120x120.png"
}
}
}
} }
}, }
"quickapp" : {},
"mp-weixin" : {
"appid" : "wx604d2ea4702620d2",
"setting" : {
"urlCheck" : false
},
"usingComponents" : true,
"permission" : {
"scope.userLocation" : {
"desc" : "你的位置信息将用于小程序位置接口的效果展示"
}
},
"plugins" : {
// #ifdef MP-WEIXIN
"live-player-plugin" : {
"version" : "1.2.8",
"provider" : "wx2b03c6e691cd7370"
}
}
},
// #endif
"mp-alipay" : {
"usingComponents" : true
},
"mp-baidu" : {
"usingComponents" : true
},
"mp-toutiao" : {
"usingComponents" : true
},
"h5" : {
"title" : "yshop",
"devServer" : {
"disableHostCheck" : true
},
"router" : {
"mode" : "history"
},
"sdkConfigs" : {
"maps" : {
"qqmap" : {
"key" : ""
}
}
},
"domain" : "h5.yixiang.co"
} }
},
"quickapp": {},
"mp-weixin": {
"appid": "wx604d2ea4702620d2",
"setting": {
"urlCheck": false
},
"usingComponents": true,
"permission": {
"scope.userLocation": {
"desc": "你的位置信息将用于小程序位置接口的效果展示"
}
},
"plugins": {
// #ifdef MP-WEIXIN
"live-player-plugin": {
"version": "1.2.8",
"provider": "wx2b03c6e691cd7370"
}
}
},
// #endif
"mp-alipay": {
"usingComponents": true
},
"mp-baidu": {
"usingComponents": true
},
"mp-toutiao": {
"usingComponents": true
},
"h5": {
"title": "yshop",
"devServer": {
"disableHostCheck": true,
"proxy": {
"/api": {
"target": "https://wxapi.yixiang.co",
"changeOrigin": true,
"secure": true,
"pathRewrite": {
"^/api": "/api"
}
}
}
},
"router": {
"mode": "history"
},
"sdkConfigs": {
"maps": {
"qqmap": {
"key": ""
}
}
},
"domain": "h5.yixiang.co"
}
} }

View File

@ -86,7 +86,6 @@ export default {
const s = '', const s = '',
id = 0, id = 0,
title = '' title = ''
return { return {
hostProduct: [], hostProduct: [],
productList: [], productList: [],
@ -127,8 +126,7 @@ export default {
}) })
} }
}, },
$yroute(to) { $yroute(to) {},
},
}, },
mounted: function() { mounted: function() {
const { s = '', id = 0, title = '', isIntegral = false } = this.$yroute.query const { s = '', id = 0, title = '', isIntegral = false } = this.$yroute.query
@ -143,8 +141,7 @@ export default {
this.recommendLoading = true this.recommendLoading = true
!this.loading && this.getProductList() !this.loading && this.getProductList()
}, },
onHide() { onHide() {},
},
methods: { methods: {
changeRecommendLoading(recommendLoading) { changeRecommendLoading(recommendLoading) {
this.recommendLoading = recommendLoading this.recommendLoading = recommendLoading
@ -173,6 +170,10 @@ export default {
}) })
}, },
getProductList() { getProductList() {
if (this.loading) {
return
}
this.loading = true
var that = this var that = this
this.setWhere() this.setWhere()
const { s = '', id = 0, title = '' } = this.$yroute.query const { s = '', id = 0, title = '' } = this.$yroute.query
@ -211,26 +212,30 @@ export default {
}, },
//点击事件处理 //点击事件处理
set_where: function(index) { set_where: function(index) {
const { s = '', id = 0, title = '', isIntegral = false } = this.$yroute.query
let that = this let that = this
switch (index) { switch (index) {
case 0: case 0:
return that.$yrouter.push({ this.where.keyword = ''
path: '/pages/shop/GoodsClass/index', break
})
case 1: case 1:
if (that.price === 0) that.price = 1 if (that.price === 0) that.price = 1
else if (that.price === 1) that.price = 2 else if (that.price === 1) that.price = 2
else if (that.price === 2) that.price = 0 else if (that.price === 2) that.price = 0
that.stock = 0 that.stock = 0
this.where.keyword = s
break break
case 2: case 2:
if (that.stock === 0) that.stock = 1 if (that.stock === 0) that.stock = 1
else if (that.stock === 1) that.stock = 2 else if (that.stock === 1) that.stock = 2
else if (that.stock === 2) that.stock = 0 else if (that.stock === 2) that.stock = 0
that.price = 0 that.price = 0
this.where.keyword = s
break break
case 3: case 3:
that.nows = !that.nows that.nows = !that.nows
this.where.keyword = s
break break
default: default:
break break

View File

@ -60,9 +60,14 @@ function baseRequest(options) {
// 合并传参过来的 headers // 合并传参过来的 headers
// 如果接口需要登录,携带 token 去请求 // 如果接口需要登录,携带 token 去请求
console.log(options)
options.headers = { options.headers = {
...options.headers, ...options.headers,
// hahah: 'Bearer2 ',
}
if(options.method=='post'){
options.headers.hahah='Bearer2 '
} }
if (options.login === true) { if (options.login === true) {