Commit c8e53b5b authored by Facius's avatar Facius

首页接口变更

parent e11175e2
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
<view class="topTitle"><text>{{ dataItem.title }}</text></view> <view class="topTitle"><text>{{ dataItem.title }}</text></view>
<view class="ph-pr-content"> <view class="ph-pr-content">
<view v-for="(item,ikey) in dataItem.data" <view v-for="(item,ikey) in dataItem.data"
:class="param[dataItem.type] === item._id ? 'select-item-view' : 'item-view'" :class="param[dataItem.type] === item.id ? 'select-item-view' : 'item-view'"
@click="itemClick(dataItem.type, item)" :key="item._id"> @click="itemClick(dataItem.type, item, ikey)" :key="item.id">
<text class="itemTitle">{{item.name}}</text> <text class="itemTitle">{{item.name}}</text>
</view> </view>
</view> </view>
...@@ -59,8 +59,7 @@ ...@@ -59,8 +59,7 @@
}, },
onLoad(e) { onLoad(e) {
getApp().trackPage('选择产品页') getApp().trackPage('选择产品页')
this.getclassifyList() this.getRelationDictionaryV2()
}, },
onShareAppMessage(res) { onShareAppMessage(res) {
let shareObj = { let shareObj = {
...@@ -72,69 +71,46 @@ ...@@ -72,69 +71,46 @@
} }
return shareObj return shareObj
}, },
methods: { methods: {
getRelationDictionaryV2: function() {
getclassifyList: function() { this.$u.cloudApi.getRelationDictionaryV2().then(res => {
console.log('V2:')
let that = this
this.$u.cloudApi.getClassifyDictionary().then(res => {
console.log('获取产品数据:')
console.log(res) console.log(res)
if (res.result && res.result.data) { if (res && res.result) {
that.classifyList = res.result.data this.classifyList = res.result
that.param.classifyId = that.classifyList[0]._id this.param.classifyId = res.result[0].id
that.$u.cloudApi.getRelationDictionary({ this.systemList = res.result[0].child
"classify_id": that.param.classifyId,
"field": "system_id"
}).then(res1 => {
that.systemList = res1.result
})
} }
}) })
}, },
//选择 点击 //选择 点击
itemClick: function(type, item) { itemClick: function(type, item, ikey) {
switch (type) { switch (type) {
case 'classifyId': case 'classifyId':
this.param = { this.param = {
classifyId: item._id, classifyId: item.id,
systemId: '', systemId: '',
brandId: '' brandId: ''
} }
this.selectedAll = false this.selectedAll = false
this.systemList = [] this.systemList = this.classifyList[ikey].child
this.brandList = [] this.brandList = []
this.$u.cloudApi.getRelationDictionary({
"classify_id": this.param.classifyId,
"field": "system_id"
}).then(res => {
this.systemList = res.result
})
break break
case 'systemId': case 'systemId':
this.param = { this.param = {
classifyId: this.param.classifyId, classifyId: this.param.classifyId,
systemId: item._id, systemId: item.id,
brandId: '' brandId: ''
} }
this.selectedAll = false this.selectedAll = false
this.brandList = [] this.brandList = this.systemList[ikey].child
this.$u.cloudApi.getRelationDictionary({
"classify_id": this.param.classifyId,
"system_id": this.param.systemId,
"field": "brand_id"
}).then(res => {
console.log('获取品牌数据:', res)
this.brandList = res.result
})
break break
case 'brandId': case 'brandId':
this.param.brandId = item._id this.param.brandId = item.id
this.selectedAll = true this.selectedAll = true
this.brandName = item.name this.brandName = item.name
break break
......
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