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) {
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>
<text>联系客服</text>
</view>
<view style="margin:0 20rpx;">
<u-overlay :show="!isLoad">
<login @success="reOnLoad()" @fail="failToLoad()"></login>
</u-overlay>
</view>
</view>
</template>
<script>
import login from 'pages/my/login/login'
export default {
components: {
login
},
data() {
return {
id: '',
detailList: [],
imgUrl: ''
imgUrl: '',
isLoad: true
}
},
onLoad(option) {
this.id = option.id
this.getCertifiedCjDetail()
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: {
//获取认证厂家详情
@@ -55,6 +74,22 @@
this.$toast.warn('没有更多详情了')
}
}).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">
<u-parse :content="detailList.content" @preview="preview" @navigate="navigate"></u-parse>
</view>
<view style="margin:0 20rpx;">
<u-overlay :show="!isLoad">
<login @success="reOnLoad()" @fail="failToLoad()"></login>
</u-overlay>
</view>
</view>
</template>
@@ -21,16 +26,30 @@
import {
dateFormatXwDetail
} from '../../utills/date.js'
import login from 'pages/my/login/login'
export default {
components: {
login
},
data() {
return {
id: '',
detailList: [],
isLoad: true
}
},
onLoad(option) {
this.id = option.id
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: {
//获取行业新闻详情
@@ -46,6 +65,22 @@
}
}).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>

View File

@@ -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('登录失败请重试')
}
}
}

View File

@@ -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();
});