Merge pull request '商品详情. 新闻详情和厂家详情登录拦截' (#50) from DJ into dev

Reviewed-on: http://git.hchyun.com/feashow/pupil/pulls/50
This commit is contained in:
odjbin
2023-01-11 14:12:49 +00:00
5 changed files with 133 additions and 20 deletions

View File

@@ -95,7 +95,7 @@
//修改我的需求或创意 //修改我的需求或创意
editIdeasAndNeeds(item) { editIdeasAndNeeds(item) {
uni.reLaunch({ uni.reLaunch({
url: '/pages/ideasAndNeeds/ideasAndNeeds?item=' + JSON.stringify(item) url: '/pages/ideasAndNeeds/ideasAndNeeds?item=' + JSON.stringify(item) + '&index=' + this.type
}) })
}, },
//删除我的需求或创意 //删除我的需求或创意

View File

@@ -25,22 +25,41 @@
<u-icon name="kefu-ermai" color="#fff" size="30rpx"></u-icon> <u-icon name="kefu-ermai" color="#fff" size="30rpx"></u-icon>
<text>联系客服</text> <text>联系客服</text>
</view> </view>
<view style="margin:0 20rpx;">
<u-overlay :show="!isLoad">
<login @success="reOnLoad()" @fail="failToLoad()"></login>
</u-overlay>
</view>
</view> </view>
</template> </template>
<script> <script>
import login from 'pages/my/login/login'
export default { export default {
components: {
login
},
data() { data() {
return { return {
id: '', id: '',
detailList: [], detailList: [],
imgUrl: '' imgUrl: '',
isLoad: true
} }
}, },
onLoad(option) { onLoad(option) {
this.id = option.id this.id = option.id
this.getCertifiedCjDetail() this.getCertifiedCjDetail()
this.imgUrl = uni.getStorageSync('img_url') 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: { methods: {
//获取认证厂家详情 //获取认证厂家详情
@@ -55,6 +74,22 @@
this.$toast.warn('没有更多详情了') this.$toast.warn('没有更多详情了')
} }
}).finally(_ => {}) }).finally(_ => {})
},
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('登录失败请重试')
} }
} }
} }

View File

@@ -14,6 +14,11 @@
<view class="xwD_content"> <view class="xwD_content">
<u-parse :content="detailList.content" @preview="preview" @navigate="navigate"></u-parse> <u-parse :content="detailList.content" @preview="preview" @navigate="navigate"></u-parse>
</view> </view>
<view style="margin:0 20rpx;">
<u-overlay :show="!isLoad">
<login @success="reOnLoad()" @fail="failToLoad()"></login>
</u-overlay>
</view>
</view> </view>
</template> </template>
@@ -21,16 +26,30 @@
import { import {
dateFormatXwDetail dateFormatXwDetail
} from '../../utills/date.js' } from '../../utills/date.js'
import login from 'pages/my/login/login'
export default { export default {
components: {
login
},
data() { data() {
return { return {
id: '', id: '',
detailList: [], detailList: [],
isLoad: true
} }
}, },
onLoad(option) { onLoad(option) {
this.id = option.id this.id = option.id
this.getNewsDetail() this.getNewsDetail()
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: { methods: {
//获取行业新闻详情 //获取行业新闻详情
@@ -46,6 +65,22 @@
} }
}).finally(_ => {}) }).finally(_ => {})
}, },
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('登录失败请重试')
}
} }
} }
</script> </script>

View File

@@ -55,6 +55,11 @@
<text>{{detailList.pub_time}}</text> <text>{{detailList.pub_time}}</text>
</view> </view>
<u-parse :content="detailList.desc" @preview="preview" @navigate="navigate"></u-parse> <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>
</view> </view>
</template> </template>
@@ -63,26 +68,40 @@
import { import {
dateFormatDetail dateFormatDetail
} from '../../../utills/date.js' } from '../../../utills/date.js'
import login from 'pages/my/login/login'
export default { export default {
components: {
login
},
data() { data() {
return { return {
id: '', id: '',
imgUrl: '', imgUrl: '',
tagsArray: [], tagsArray: [],
showHeart: false, showHeart: false,
detailList: [] detailList: [],
isLoad: true
} }
}, },
onLoad(option) { onLoad(option) {
this.id = option.id this.id = option.id
this.getProductDetail() this.getProductDetail()
this.imgUrl = uni.getStorageSync('img_url') 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: { methods: {
//获取详情信息 //获取详情信息
getProductDetail() { getProductDetail() {
this.$apiServe.getProductDetail(this.id).then(res => { this.$apiServe.getProductDetail(this.id).then(res => {
// console.log('产品详情页', res.data.data) console.log('产品详情页', res.data)
if (res.data.data.thumb) { if (res.data.data.thumb) {
this.isThumb = true this.isThumb = true
} }
@@ -101,15 +120,35 @@
//收藏按钮 //收藏按钮
starTap() { starTap() {
this.detailList.type = !this.detailList.type this.detailList.type = !this.detailList.type
// this.$apiServe.collect(this.id).then(res => { this.$apiServe.collect(this.id).then(res => {
// console.log('收藏成功', res.data) console.log('收藏成功', res.data)
if (res.data.code == 1) {
// this.detailList.type = 1 this.detailList.type = 1
// }).finally(_ => {}) this.$toast.warn('收藏成功')
} else {
this.$toast.warn('收藏失败')
}
}).finally(_ => {})
}, },
//点赞按钮 //点赞按钮
heartTap() { heartTap() {
this.showHeart = !this.showHeart 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('登录失败请重试')
} }
} }
} }

View File

@@ -105,8 +105,10 @@
</template> </template>
<script> <script>
import { apiService } from '../../service/request' import {
import login from '../my/login/login.vue' apiService
} from '../../service/request'
import login from '../my/login/login.vue'
export default { export default {
components: { components: {
login login
@@ -151,9 +153,9 @@ import login from '../my/login/login.vue'
}, },
onLoad(options) { onLoad(options) {
console.log(options) console.log(options)
if (options.index == 0) { if (options.index == 1) {
this.tabCurrent = 0 this.tabCurrent = 0
} else if (options.index == 1) { } else if (options.index == 2) {
this.tabCurrent = 1 this.tabCurrent = 1
} }
if (!uni.getStorageSync('token') || uni.getStorageSync('token').length === 0) { 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.open('GET', blodurl, true);
http.responseType = 'blob'; http.responseType = 'blob';
http.onload = function(e) { http.onload = function(e) {
if (this.status == 200 || this.status === 0) { if (this.status == 200 || this.status === 0) {
// console.log('blod数据',this.response); // console.log('blod数据',this.response);
// 在将blod数据转为file // 在将blod数据转为file
let files = new window.File([this.response], 'file.name', { type: 'image' }); let files = new window.File([this.response], 'file.name', {
// console.log('blod数据转换file',files); type: 'image'
resolve(files); });
} // console.log('blod数据转换file',files);
resolve(files);
}
}; };
http.send(); http.send();
}); });