Commit 657c2f7c authored by 罗超's avatar 罗超

新增跳转参数封装

parent 494f6f50
const product = {
/**
* 生成產品詳情地址
* @param {*} productInfo 產品信息(必須包含Id和ProductType)
*/
genernalUrl(productInfo) {
let t = productInfo.productType ? productInfo.productType : productInfo.ProductType;
let configId = productInfo.configId ? productInfo.configId : productInfo.ConfigId;
let url = ''
if (t && configId) {
if (t === 4) {
// 接送机,包车
url = "/detailCar/" + configId
} else if (t === 3) {
url = "/detailHotal/" + configId
} else if (t === 2) {
url = "/detailsScenicSpotTicket/" + configId
} else if (t === 1) {
url = "/detail/" + encodeURIComponent(item.id) + "/" + 0 + "/" + configId
}
} else {
throw new Error("參數不合法");
}
return url
},
};
export default product
\ No newline at end of file
......@@ -6,6 +6,7 @@ import VueCoreVideoPlayer from 'vue-core-video-players'
import 'viewerjs/dist/viewer.css'
import user from './user'
import message from './message'
import product from './product'
import VueViewer from 'v-viewer'
// import VueCoreVideoPlayer from 'vue-core-video-player'
Vue.prototype.$EventBus = new Vue()
......@@ -13,6 +14,7 @@ Vue.use(VueCoreVideoPlayer)
Vue.use(VueViewer)
Vue.prototype.$md5 = md5;
Vue.prototype.$message = message
Vue.prototype.$product = product
//域名管理对象
Vue.prototype.domainManager = function() {
let domainUrl = '';
......@@ -195,8 +197,9 @@ Vue.prototype.OpenNewUrl = function(URL) {
//公用跳转
Vue.prototype.CommonJump = function(path, obj) {
let p = typeof(path) == 'string' ? path : this.$product.genernalUrl(path)
this.$router.push({
path: path,
path: p,
query: obj
});
}
......
......@@ -5,7 +5,7 @@
{{ formatEnum(product.ProductType) }}
</div>
</q-img>
<div class="ellipsis-2-lines text-body1 q-ma-md cursor-pointer" style="height: 74px;">{{ product.Title }}</div>
<div class="ellipsis-2-lines text-body1 q-ma-md cursor-pointer" style="height: 74px;" @click="CommonJump(product,{})">{{ product.Title }}</div>
<div class="text-subtitle2 text-weight-bolder text-dark q-mx-md">
<span>CNY {{moneyFormat(product.B2CPrice,2)}}</span>
<span class="f12 q-ml-sm"></span>
......
......@@ -15,7 +15,7 @@
</div>
</q-img>
<div class="q-px-md col">
<div class="ellipsis-2-lines text-body1 q-ma-md cursor-pointer" style="height:50px;">{{ product.Title }}</div>
<div class="ellipsis-2-lines text-body1 q-ma-md cursor-pointer" style="height:50px;" @click="CommonJump(product,{})">{{ product.Title }}</div>
<div class="text-subtitle2 text-weight-bolder text-dark q-mx-md">
<span>CNY {{moneyFormat(product.B2CPrice,2)}}</span>
<span class="f12 q-ml-sm"></span>
......
......@@ -733,29 +733,7 @@ this.dayArray = this.dayArray.filter(item => arr.includes(item.id))
// this.msg.dayNumList = arr;
},
GotoDetails(item) {
if(item.productType === 4) { // 接送机,包车
this.CommonJump(
"/detailCar/"+item.configId,
{}
);
return
}else if(item.productType === 3) { // 住宿
this.CommonJump(
"/detailHotal/"+item.configId,
{}
);
return
}else if(item.productType === 2) { // 景区门票
this.CommonJump(
"/detailsScenicSpotTicket/"+item.configId,
{}
);
return
}
this.CommonJump(
"/detail/" + encodeURIComponent(item.id) + "/" + item.tcid + "/" + item.configId,
{}
);
this.CommonJump(item,{});
},
},
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment