feat: 积分商城-补充
This commit is contained in:
@@ -84,6 +84,7 @@ layout("/layouts/platform_h5.html"){
|
||||
<script nonce="${cspNonce!}">
|
||||
new Vue({
|
||||
el: "#app",
|
||||
store,
|
||||
data() {
|
||||
return {
|
||||
keyword: "",
|
||||
@@ -145,12 +146,36 @@ layout("/layouts/platform_h5.html"){
|
||||
this.userPoints = resp.data || 0
|
||||
}
|
||||
},
|
||||
openSupplier(item) {
|
||||
async openSupplier(item) {
|
||||
if (!item.supplierUrl) {
|
||||
this.$toast("暂无跳转地址")
|
||||
return
|
||||
}
|
||||
window.location.href = item.supplierUrl
|
||||
const userId = this.$store && this.$store.state.user ? this.$store.state.user.id : ""
|
||||
if (!userId) {
|
||||
this.$toast("获取用户信息失败,请重新登录后再试")
|
||||
return
|
||||
}
|
||||
window.location.href = this.withSupplierQuery(item.supplierUrl, {
|
||||
userId: userId
|
||||
})
|
||||
},
|
||||
withSupplierQuery(url, params) {
|
||||
const query = Object.keys(params)
|
||||
.filter((key) => params[key] !== undefined && params[key] !== null && params[key] !== "")
|
||||
.map((key) => encodeURIComponent(key) + "=" + encodeURIComponent(params[key]))
|
||||
.join("&")
|
||||
if (!query) {
|
||||
return url
|
||||
}
|
||||
const hashIndex = url.indexOf("#")
|
||||
if (hashIndex > -1) {
|
||||
const base = url.slice(0, hashIndex)
|
||||
const hash = url.slice(hashIndex)
|
||||
const joiner = hash.indexOf("?") > -1 ? "&" : "?"
|
||||
return base + hash + joiner + query
|
||||
}
|
||||
return url + (url.indexOf("?") > -1 ? "&" : "?") + query
|
||||
},
|
||||
onImgError(e) {
|
||||
e.target.src = this.defaultLogo
|
||||
|
||||
Reference in New Issue
Block a user