|
|
@@ -305,9 +305,20 @@
|
|
|
collectComponent: function () {
|
|
|
if (this.user.logged) {
|
|
|
if (!this.isCollect) {
|
|
|
- this.$store.dispatch('product/saveEntity', {componentid: this.component.id, kind: 2})
|
|
|
- this.collectResult = '收藏成功'
|
|
|
- this.timeoutCount++
|
|
|
+ this.$http.post('/trade/collection/save', {componentid: this.component.id, kind: 2})
|
|
|
+ .then(res => {
|
|
|
+ if (res.data.code === 1) {
|
|
|
+ this.collectResult = '收藏成功'
|
|
|
+ this.$store.dispatch('product/saveStores')
|
|
|
+ } else {
|
|
|
+ this.collectResult = res.data.data || '收藏失败'
|
|
|
+ }
|
|
|
+ this.timeoutCount++
|
|
|
+ }, err => {
|
|
|
+ this.collectResult = err.response.data || '收藏失败'
|
|
|
+ this.timeoutCount++
|
|
|
+ console.log(err)
|
|
|
+ })
|
|
|
} else {
|
|
|
this.$http.post('/trade/collection/delete/cmpId', [this.component.id]).then(response => {
|
|
|
this.collectResult = '取消成功'
|