Browse Source

测评收藏

home_hotList
ld0104 2 years ago
parent
commit
8b42cdeaa1
  1. 20
      api/store.js
  2. 50
      pages/shop/Evaluations/EvaluationDetail/index.vue
  3. 1
      utils/request.js

20
api/store.js

@ -209,6 +209,26 @@ export function getBrands() {
login: false
});
}
/**
* 添加收藏
*
*/
export function getUserCollection(data) {
console.log(9999999966);
return request.post("/collectEvaluation/add", data, {
login: true
});
}
/**
*
* 删除收藏
*/
export function delUserCollection(data) {
console.log(88886);
return request.post("/collectEvaluation/del", data, {
login: true
});
}
/**
* 品牌详情

50
pages/shop/Evaluations/EvaluationDetail/index.vue

@ -97,11 +97,15 @@
<view :style="addBottom?'height: 162rpx;':'height: 122rpx;'"></view>
<view class="footer acea-row row-between" :style="addBottom?'height: 162rpx;':'height: 122rpx;'">
<view class="acea-row">
<view class="acea-row btn-box row-around">
<button class="item contacButton" open-type="share" hover-class="none">
<image src="../../../../static/images/share-icon.png" mode=""></image>
<view class="">分享</view>
</button>
<button class="item contacButton" hover-class="none" @click="getCollection">
<image :src="`../../../../static/images/${isCollection?'star-light':'star'}.png`" mode=""></image>
<view class="">{{isCollection? '已收藏':'收藏'}}</view>
</button>
<!-- <view class="item" @click="share">
<image src="../../../../static/images/share-icon.png" mode=""></image>
<view class="">分享</view>
@ -109,15 +113,18 @@
</view>
<view class="btn" @click="goGoodsDetail">立即购买</view>
</view>
</view>
</template>
<script>
import { getEvaluationDetail } from '@/api/store'
import { getEvaluationDetail,getUserCollection,delUserCollection} from '@/api/store'
export default {
data() {
return {
isCollection:false,
addBottom: this.addBottom,
id: 0,
info: {},
@ -128,6 +135,7 @@
onLoad() {
this.id = this._route.query.id
this.getInfo(this.id);
this.getEvaluation(this.id)
},
onShareAppMessage() {
return {
@ -136,12 +144,47 @@
}
},
methods: {
//
// del(){
// delUserCollection().then(res=>{
// var param={}
// param.id=this.id
// param.category= ""
// delUserCollection(param).then(res=>{
// console.log(res,'==========11');
// })
// this.isCollection=!this.isCollection
// console.log('++++++++');
// })
// },
//
getEvaluation(id){
// collectEvaluation/add
},
//
getCollection(){
var param={}
param.id=this.id
param.category= ""
getUserCollection(param).then(res=>{
console.log(res,'==========11');
})
this.isCollection=!this.isCollection
console.log('收藏---------');
},
getInfo(id) {
uni.showLoading({
title: ''
})
getEvaluationDetail(id).then(res => {
this.info = res.data;
console.log(this.info,4444444441);
uni.hideLoading();
})
},
@ -387,6 +430,9 @@
box-shadow: 0rpx -4rpx 38rpx 0rpx rgba(0,0,0,0.2);
border-radius: 28rpx 28rpx 0rpx 0rpx;
padding: 12rpx 32rpx 0rpx;
.btn-box{
width: 35%;
}
.contacButton {
height: 80rpx;
padding: 0;

1
utils/request.js

@ -138,6 +138,7 @@ const request = ['post', 'put', 'patch'].reduce((request, method) => {
* @returns {AxiosPromise}
*/
request[method] = (url, data = {}, options = {}) => {
console.log(data,'7777777');
return baseRequest(Object.assign({ url, data, method }, defaultOpt, options))
}
return request

Loading…
Cancel
Save