商品详情. 新闻详情和厂家详情登录拦截
This commit is contained in:
@@ -55,6 +55,11 @@
|
||||
<text>{{detailList.pub_time}}</text>
|
||||
</view>
|
||||
<u-parse :content="detailList.desc" @preview="preview" @navigate="navigate"></u-parse>
|
||||
<view style="margin:0 20rpx;">
|
||||
<u-overlay :show="!isLoad">
|
||||
<login @success="reOnLoad()" @fail="failToLoad()"></login>
|
||||
</u-overlay>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -63,26 +68,40 @@
|
||||
import {
|
||||
dateFormatDetail
|
||||
} from '../../../utills/date.js'
|
||||
import login from 'pages/my/login/login'
|
||||
export default {
|
||||
components: {
|
||||
login
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
id: '',
|
||||
imgUrl: '',
|
||||
tagsArray: [],
|
||||
showHeart: false,
|
||||
detailList: []
|
||||
detailList: [],
|
||||
isLoad: true
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
this.id = option.id
|
||||
this.getProductDetail()
|
||||
this.imgUrl = uni.getStorageSync('img_url')
|
||||
if (!uni.getStorageSync('token') || uni.getStorageSync('token').length === 0) {
|
||||
console.log(uni.getStorageSync('token'))
|
||||
this.isLoad = false
|
||||
// uni.navigateTo({
|
||||
// url: '../../pages/my/login/login'
|
||||
// })
|
||||
return
|
||||
}
|
||||
this.isLoad = true
|
||||
},
|
||||
methods: {
|
||||
//获取详情信息
|
||||
getProductDetail() {
|
||||
this.$apiServe.getProductDetail(this.id).then(res => {
|
||||
// console.log('产品详情页', res.data.data)
|
||||
console.log('产品详情页', res.data)
|
||||
if (res.data.data.thumb) {
|
||||
this.isThumb = true
|
||||
}
|
||||
@@ -101,15 +120,35 @@
|
||||
//收藏按钮
|
||||
starTap() {
|
||||
this.detailList.type = !this.detailList.type
|
||||
// this.$apiServe.collect(this.id).then(res => {
|
||||
// console.log('收藏成功', res.data)
|
||||
|
||||
// this.detailList.type = 1
|
||||
// }).finally(_ => {})
|
||||
this.$apiServe.collect(this.id).then(res => {
|
||||
console.log('收藏成功', res.data)
|
||||
if (res.data.code == 1) {
|
||||
this.detailList.type = 1
|
||||
this.$toast.warn('收藏成功')
|
||||
} else {
|
||||
this.$toast.warn('收藏失败')
|
||||
}
|
||||
}).finally(_ => {})
|
||||
},
|
||||
//点赞按钮
|
||||
heartTap() {
|
||||
this.showHeart = !this.showHeart
|
||||
},
|
||||
reOnLoad() {
|
||||
console.log('----------------true')
|
||||
if (!uni.getStorageSync('token') || uni.getStorageSync('token').length === 0) {
|
||||
this.$toast.warn('登录失败请重试')
|
||||
this.isLoad = false
|
||||
// uni.navigateTo({
|
||||
// url: '../../pages/my/login/login'
|
||||
// })
|
||||
return
|
||||
}
|
||||
this.isLoad = true
|
||||
},
|
||||
failToLoad() {
|
||||
console.log('----------------false')
|
||||
this.$toast.warn('登录失败请重试')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,8 +105,10 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { apiService } from '../../service/request'
|
||||
import login from '../my/login/login.vue'
|
||||
import {
|
||||
apiService
|
||||
} from '../../service/request'
|
||||
import login from '../my/login/login.vue'
|
||||
export default {
|
||||
components: {
|
||||
login
|
||||
@@ -151,9 +153,9 @@ import login from '../my/login/login.vue'
|
||||
},
|
||||
onLoad(options) {
|
||||
console.log(options)
|
||||
if (options.index == 0) {
|
||||
if (options.index == 1) {
|
||||
this.tabCurrent = 0
|
||||
} else if (options.index == 1) {
|
||||
} else if (options.index == 2) {
|
||||
this.tabCurrent = 1
|
||||
}
|
||||
if (!uni.getStorageSync('token') || uni.getStorageSync('token').length === 0) {
|
||||
@@ -267,13 +269,15 @@ import login from '../my/login/login.vue'
|
||||
http.open('GET', blodurl, true);
|
||||
http.responseType = 'blob';
|
||||
http.onload = function(e) {
|
||||
if (this.status == 200 || this.status === 0) {
|
||||
// console.log('blod数据',this.response);
|
||||
// 在将blod数据转为file
|
||||
let files = new window.File([this.response], 'file.name', { type: 'image' });
|
||||
// console.log('blod数据转换file',files);
|
||||
resolve(files);
|
||||
}
|
||||
if (this.status == 200 || this.status === 0) {
|
||||
// console.log('blod数据',this.response);
|
||||
// 在将blod数据转为file
|
||||
let files = new window.File([this.response], 'file.name', {
|
||||
type: 'image'
|
||||
});
|
||||
// console.log('blod数据转换file',files);
|
||||
resolve(files);
|
||||
}
|
||||
};
|
||||
http.send();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user