解决冲突
This commit is contained in:
@@ -1,21 +1,24 @@
|
||||
<template>
|
||||
<view>
|
||||
<view :key="index">
|
||||
<view style="position: relative;padding-bottom: 100rpx;">
|
||||
<u-image :src="imgUrl+detailList.cover" width="750rpx" height="530rpx">
|
||||
</u-image>
|
||||
<view class="collect" @click="starTap">
|
||||
<view class="collect" v-if="detailList.is_fav==0||!detailList.is_fav" @click="starTap">
|
||||
<view class="star">
|
||||
<u-image v-if="detailList.is_fav==0||!detailList.is_fav" src="/static/detail/xp_icon_wstar.png"
|
||||
width="28rpx" height="28rpx">
|
||||
</u-image>
|
||||
<u-image v-if="detailList.is_fav==1" src="/static/detail/xp_icon_star.png" width="28rpx"
|
||||
height="28rpx">
|
||||
<u-image src="/static/detail/xp_icon_wstar.png" width="28rpx" height="28rpx">
|
||||
</u-image>
|
||||
</view>
|
||||
<u-image src="/static/detail/xiangqing_icon_shoucang.png" width="119rpx" height="48rpx">
|
||||
</u-image>
|
||||
</view>
|
||||
<view class="collect" v-if="detailList.is_fav==1" @click="cancelStarTap(detailList.fav_id)">
|
||||
<view class="star">
|
||||
<u-image src="/static/detail/xp_icon_star.png" width="28rpx" height="28rpx">
|
||||
</u-image>
|
||||
</view>
|
||||
<u-image src="/static/detail/xiangqing_icon_shoucang.png" width="119rpx" height="48rpx">
|
||||
</u-image>
|
||||
</view>
|
||||
|
||||
<view class="content">
|
||||
<view class="title_box">
|
||||
<text class="title">{{detailList.name}}</text>
|
||||
@@ -31,19 +34,33 @@
|
||||
<view>
|
||||
<text class="tagOne" v-for="item in detailList.tags" :key="item.id">{{item}}</text>
|
||||
</view>
|
||||
<!-- thumb有值,显示数字+赞 -->
|
||||
<view v-if="detailList.thumb" class="heart">
|
||||
<u-image src="/static/detail/xp_icon_ysc.png" width="34rpx" height="32rpx">
|
||||
<!-- 如果用户对该商品没有点赞,显示灰星 -->
|
||||
<u-image v-if="detailList.is_thumb==0" src="/static/detail/xp_icon_heart.png" width="34rpx"
|
||||
height="32rpx" @click="heartTap">
|
||||
</u-image>
|
||||
<text class="thumb">{{detailList.thumb}}赞</text>
|
||||
<!-- 如果用户对该商品已经点赞,显示黄星-->
|
||||
<u-image v-if="detailList.is_thumb==1" src="/static/detail/xp_icon_ysc.png" width="34rpx"
|
||||
height="32rpx" @click="cancelHeartTap(detailList.thumb_id)">
|
||||
</u-image>
|
||||
<text class="thumb">{{detailList.thumb}} 赞</text>
|
||||
</view>
|
||||
<view v-else class="heart" @click="heartTap">
|
||||
<u-image v-if="showHeart==false" src="/static/detail/xp_icon_heart.png" width="34rpx"
|
||||
height="32rpx">
|
||||
</u-image>
|
||||
<u-image v-if="showHeart==true" src="/static/detail/xp_icon_ysc.png" width="34rpx"
|
||||
height="32rpx">
|
||||
</u-image>
|
||||
<text class="thumb">点赞</text>
|
||||
<!-- thumb无值,显示‘点赞’二字 ,用户进行一次点赞之后,显示1赞-->
|
||||
<view v-else class="heart">
|
||||
<view v-if="detailList.is_thumb==0" style="display: flex;">
|
||||
<u-image src="/static/detail/xp_icon_heart.png" width="34rpx" height="32rpx"
|
||||
@click="heartTap">
|
||||
</u-image>
|
||||
<text class="thumb" @click="heartTap">点赞</text>
|
||||
</view>
|
||||
<view v-if="detailList.is_thumb==1" style="display: flex;">
|
||||
<!-- 用户是否点赞字段 showHeart -->
|
||||
<u-image src="/static/detail/xp_icon_ysc.png" width="34rpx" height="32rpx"
|
||||
@click="cancelHeartTap(detailList.thumb_id)">
|
||||
</u-image>
|
||||
<text class="thumb">{{detailList.thumb}} 赞</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -54,16 +71,32 @@
|
||||
<text class="release">发布日期:</text>
|
||||
<text>{{detailList.pub_time}}</text>
|
||||
</view>
|
||||
|
||||
<u-parse :content="detailList.desc" @preview="preview" @navigate="navigate"></u-parse>
|
||||
|
||||
<u-modal :show="showCall" showCancelButton closeOnClickOverlay="false" confirmText="是" cancelText="否"
|
||||
@confirm="confirmCall" @cancel="cancelCall">
|
||||
<view>
|
||||
<view style="text-indent: 25rpx;">{{mobile}}</view>
|
||||
<text>是否拨打客服电话</text>
|
||||
</view>
|
||||
</u-modal>
|
||||
<view style="margin:0 20rpx;">
|
||||
<u-overlay :show="!isLoad">
|
||||
<login @success="reOnLoad()" @fail="failToLoad()"></login>
|
||||
<login :timoutText="timoutText" @success="reOnLoad()" @fail="failToLoad()"></login>
|
||||
</u-overlay>
|
||||
</view>
|
||||
<u-modal :show="showM" :content='content' closeOnClickOverlay="false" showCancelButton="true"
|
||||
confirmText="升级VIP" @confirm="confirm" confirmColor="#0EBB5B">
|
||||
<rich-text :nodes="content"></rich-text>
|
||||
<u-modal :show="showUpdate" :content='content' closeOnClickOverlay="false" showCancelButton="true"
|
||||
confirmText="升级VIP" @confirm="confirm" @cancel="cancel" confirmColor="#0EBB5B">
|
||||
<rich-text :nodes="updateContent"></rich-text>
|
||||
</u-modal>
|
||||
<u-modal :show="showUpdating" closeOnClickOverlay="false" confirmText="确定" @confirm="confirm">
|
||||
<rich-text :nodes="updatingContent"></rich-text>
|
||||
</u-modal>
|
||||
</view>
|
||||
<view class="footer" @click="showContact()">
|
||||
<u-icon name="kefu-ermai" color="#fff" size="30rpx"></u-icon>
|
||||
<text>联系客服</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -81,76 +114,120 @@
|
||||
return {
|
||||
id: '',
|
||||
imgUrl: '',
|
||||
tagsArray: [],
|
||||
showHeart: false,
|
||||
detailList: [],
|
||||
isLoad: true,
|
||||
showM: false,
|
||||
content: '您暂无权限访问,请升级VIP访问'
|
||||
showUpdate: false,
|
||||
showUpdating: false,
|
||||
showCall: false,
|
||||
mobile: '',
|
||||
updateContent: '您暂无权限访问,请升级VIP访问',
|
||||
updatingContent: '升级VIP,正在审核中',
|
||||
timoutText: 1
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
this.imgUrl = uni.getStorageSync('img_url')
|
||||
this.id = option.id
|
||||
this.getProductDetail()
|
||||
this.imgUrl = uni.getStorageSync('img_url')
|
||||
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
|
||||
this.isLoad = false
|
||||
// uni.navigateTo({
|
||||
// url: '../../pages/my/login/login'
|
||||
// })
|
||||
return
|
||||
}
|
||||
this.isLoad = true
|
||||
this.getCsTel()
|
||||
},
|
||||
methods: {
|
||||
//获取客服电话
|
||||
getCsTel() {
|
||||
this.$apiServe.getCsTel().then(res => {
|
||||
this.mobile = res.data.data.cs_tel
|
||||
}).finally(_ => {})
|
||||
},
|
||||
//获取详情信息
|
||||
getProductDetail() {
|
||||
this.$apiServe.getProductDetail(this.id).then(res => {
|
||||
console.log('产品详情页', res.data)
|
||||
if (res.data.data.thumb) {
|
||||
this.isThumb = true
|
||||
console.log('产品详情', res);
|
||||
let detail = res.data.data
|
||||
let dataCode = res.data.code
|
||||
if (dataCode === -1 || res.statusCode == 500) {
|
||||
this.isLoad = false
|
||||
}
|
||||
if (res.data.msg == "没有权限访问" && uni.getStorageSync('loginToken')) {
|
||||
this.showM = true
|
||||
//授权登录拦截
|
||||
if (dataCode == 0 && detail.mytpe == 1) {
|
||||
this.isLoad = false
|
||||
}
|
||||
if (res.data.data) {
|
||||
let detail = res.data.data
|
||||
//跳转到升级VIP页面
|
||||
if (dataCode == 0 && detail.mytpe == 2) {
|
||||
this.showUpdate = true
|
||||
}
|
||||
//升级VIP正在审核中
|
||||
if (dataCode == 0 && detail.mytpe == 3) {
|
||||
this.showUpdating = true
|
||||
}
|
||||
|
||||
if (detail) {
|
||||
detail.pub_time = dateFormatDetail(detail.pub_time)
|
||||
let tag = detail.tags
|
||||
this.tagsArray = tag.split(',')
|
||||
detail.tags = this.tagsArray
|
||||
this.detailList = res.data.data
|
||||
} else {
|
||||
this.$toast.warn('没有更多详情了')
|
||||
if (detail.tags) {
|
||||
detail.tags = detail.tags.split(',')
|
||||
}
|
||||
|
||||
// if (detail.is_thumb == 1 && parseInt(detail.thumb) == 1 && parseInt(detail
|
||||
// .thumbcount) == 1) {
|
||||
// console.log('222');
|
||||
// detail.thumb = parseInt(detail.thumbcount)
|
||||
// } else {
|
||||
detail.thumb = parseInt(detail.thumb) + parseInt(detail.thumbcount)
|
||||
// }
|
||||
|
||||
this.detailList = detail
|
||||
}
|
||||
}).finally(_ => {})
|
||||
},
|
||||
//收藏按钮
|
||||
//点击star收藏
|
||||
starTap() {
|
||||
if (this.detailList.is_fav === 1) {
|
||||
this.$toast.warn('已收藏')
|
||||
} else if (this.detailList.is_fav === 0) {
|
||||
if (!uni.getStorageSync('loginToken')) {
|
||||
this.$toast.warn('请登录后操作')
|
||||
} else {
|
||||
this.$apiServe.collect(this.id).then(res => {
|
||||
// console.log('收藏成功', res.data)
|
||||
if (res.data.code == 1) {
|
||||
this.detailList.is_fav = 1
|
||||
this.$toast.warn('收藏成功')
|
||||
this.getProductDetail()
|
||||
} else {
|
||||
this.$toast.warn('收藏失败')
|
||||
}
|
||||
}).finally(_ => {})
|
||||
}
|
||||
},
|
||||
//点击star取消收藏
|
||||
cancelStarTap(fav_id) {
|
||||
this.$apiServe.deleteHistoryOrCollection(fav_id).then(res => {
|
||||
if (res.data.code == 1) {
|
||||
this.$toast.warn('取消收藏')
|
||||
this.getProductDetail()
|
||||
} else {
|
||||
this.$toast.warn('取消收藏失败')
|
||||
}
|
||||
}).finally(_ => {})
|
||||
},
|
||||
//点赞按钮
|
||||
heartTap() {
|
||||
// this.showHeart = !this.showHeart
|
||||
this.$apiServe.thumb(this.id).then(res => {
|
||||
console.log('点赞成功', res.data)
|
||||
if (!uni.getStorageSync('loginToken')) {
|
||||
this.$toast.warn('请登录后操作')
|
||||
} else {
|
||||
this.$apiServe.thumb(this.id).then(res => {
|
||||
if (res.data.code == 1) {
|
||||
this.getProductDetail()
|
||||
this.$toast.warn('点赞成功')
|
||||
} else {
|
||||
this.$toast.warn('点赞失败')
|
||||
}
|
||||
}).finally(_ => {})
|
||||
}
|
||||
},
|
||||
//取消点赞
|
||||
cancelHeartTap(thumb_id) {
|
||||
this.$apiServe.cancelThumb(thumb_id).then(res => {
|
||||
if (res.data.code == 1) {
|
||||
this.showHeart = 1
|
||||
this.$toast.warn('点赞成功')
|
||||
this.getProductDetail()
|
||||
this.$toast.warn('取消点赞')
|
||||
} else {
|
||||
this.$toast.warn('点赞失败')
|
||||
this.$toast.warn('取消点赞失败')
|
||||
}
|
||||
}).finally(_ => {})
|
||||
},
|
||||
@@ -167,12 +244,40 @@
|
||||
this.getProductDetail()
|
||||
},
|
||||
failToLoad() {
|
||||
this.$toast.warn('登录失败请重试')
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
},
|
||||
confirm() {
|
||||
uni.navigateTo({
|
||||
url: '../../../packageMy/memberCenter/memberCenter?ask=' + 1
|
||||
})
|
||||
},
|
||||
cancel() {
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
},
|
||||
// 联系客服模态框
|
||||
showContact() {
|
||||
this.showCall = true
|
||||
},
|
||||
confirmCall() {
|
||||
this.showCall = false
|
||||
let phone = this.mobile
|
||||
phone = phone.toString()
|
||||
uni.makePhoneCall({
|
||||
phoneNumber: phone,
|
||||
success: function() {
|
||||
console.log('拨打电话成功');
|
||||
},
|
||||
fail() {
|
||||
console.log('打电话失败了');
|
||||
}
|
||||
})
|
||||
},
|
||||
cancelCall() {
|
||||
this.showCall = false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -292,12 +397,38 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 24rpx 20rpx;
|
||||
margin-top: 20rpx;
|
||||
margin: 20rpx 0;
|
||||
background-color: #fff;
|
||||
|
||||
|
||||
.release {
|
||||
padding: 0 10rpx 0 6rpx;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
.footer {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: 100rpx;
|
||||
background: #0EBB5B;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-content: center;
|
||||
text-align: center;
|
||||
|
||||
.u-icon {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
text {
|
||||
font-size: 20rpx;
|
||||
font-family: MicrosoftYaHei-Bold, MicrosoftYaHei;
|
||||
font-weight: bold;
|
||||
color: #FFFFFF;
|
||||
line-height: 26rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
<view style="margin-bottom: 20rpx;">
|
||||
<u-form-item label="姓名" borderBottom>
|
||||
<u-input v-model="needsPublishForm.name" :border="false" placeholder="请输入您的名称"
|
||||
placeholder-style="color:#CCCCCC" />
|
||||
placeholder-style="color:#CCCCCC" :disabled="btnDisabled" disabledColor="#ffffff" />
|
||||
</u-form-item>
|
||||
<u-form-item label="城市">
|
||||
<view class="select-view" @tap="showCityPicker = true">
|
||||
<view class="select-view" @tap="btnDisabled==true?showCityPicker=false:showCityPicker = true">
|
||||
<text v-if="needsPublishForm.area_name">{{needsPublishForm.area_name}}</text>
|
||||
<text v-else style="color:#CCCCCC;">请选择所在城市</text>
|
||||
<u-icon name="arrow-right" color="#969696" size="14"></u-icon>
|
||||
@@ -26,39 +26,46 @@
|
||||
<view v-if="tabCurrent === 1">
|
||||
<u-form-item label="品名" borderBottom>
|
||||
<u-input v-model="needsPublishForm.pname" :border="false" placeholder="请输入您的产品名称"
|
||||
placeholder-style="color:#CCCCCC" />
|
||||
placeholder-style="color:#CCCCCC" :disabled="btnDisabled" disabledColor="#ffffff" />
|
||||
</u-form-item>
|
||||
<u-form-item label="分类" borderBottom>
|
||||
<view class="select-view" @tap="showCategoryPicker = true">
|
||||
<view class="select-view"
|
||||
@tap="btnDisabled==true?showCategoryPicker=false: showCategoryPicker=true">
|
||||
<text v-if="needsPublishForm.class">{{needsPublishForm.class}}</text>
|
||||
<text v-else style="color:#CCCCCC;">请选择分类</text>
|
||||
<u-icon name="arrow-right" color="#969696" size="14"></u-icon>
|
||||
</view>
|
||||
<u-picker :show="showCategoryPicker" :columns="categoryPickerList"
|
||||
@cancel="showCategoryPicker = false" @confirm="getCategoryValue"></u-picker>
|
||||
@cancel="showCategoryPicker = false" @confirm="getCategoryValue">
|
||||
</u-picker>
|
||||
</u-form-item>
|
||||
</view>
|
||||
<u-form-item label="产品" borderBottom>
|
||||
<view class="select-view" @tap="showProductPicker = true">
|
||||
<view class="select-view"
|
||||
@tap="btnDisabled==true?showProductPicker=false: showProductPicker = true">
|
||||
<text v-if="needsPublishForm.product">{{needsPublishForm.product}}</text>
|
||||
<text v-else style="color:#CCCCCC;">请选择产品类型</text>
|
||||
<u-icon name="arrow-right" color="#969696" size="14"></u-icon>
|
||||
</view>
|
||||
<u-picker :show="showProductPicker" :columns="productPickerColumn"
|
||||
@cancel="showProductPicker = false" @confirm="getProductValue"></u-picker>
|
||||
@cancel="showProductPicker = false" @confirm="getProductValue">
|
||||
</u-picker>
|
||||
</u-form-item>
|
||||
<u-form-item label="定位" borderBottom>
|
||||
<view class="select-view" @tap="showPositionPicker = true">
|
||||
<view class="select-view"
|
||||
@tap="btnDisabled==true?showPositionPicker=false:showPositionPicker = true">
|
||||
<text v-if="needsPublishForm.loc">{{needsPublishForm.loc}}</text>
|
||||
<text v-else style="color:#CCCCCC;">请选择产品定位</text>
|
||||
<u-icon name="arrow-right" color="#969696" size="14"></u-icon>
|
||||
</view>
|
||||
<u-picker :show=showPositionPicker :columns="positionPickerColumn"
|
||||
@cancel="showPositionPicker = false" @confirm="getPositionValue"></u-picker>
|
||||
@cancel="showPositionPicker = false" @confirm="getPositionValue">
|
||||
</u-picker>
|
||||
</u-form-item>
|
||||
<view style="padding: 20rpx 15rpx;background-color: #fff;">
|
||||
<u-textarea v-model="needsPublishForm.desc" border="surround" placeholder="请输入具体描述(限120字)"
|
||||
:maxlength="120" placeholder-style="color:#CCCCCC"></u-textarea>
|
||||
:maxlength="120" placeholder-style="color:#CCCCCC" :disabled="btnDisabled"
|
||||
disabledColor="#ffffff"></u-textarea>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -66,7 +73,7 @@
|
||||
<u-form-item label="上传图片" labelPosition="top">
|
||||
<view style="padding-left: 20rpx;margin-top: 20rpx;">
|
||||
<u-upload :fileList="fileList1" :auto-upload="false" @afterRead="afterRead" @delete="deletePic"
|
||||
name="1" multiple :maxCount="10"></u-upload>
|
||||
name="1" multiple :maxCount="10" :disabled="btnDisabled"></u-upload>
|
||||
</view>
|
||||
</u-form-item>
|
||||
</view>
|
||||
@@ -81,21 +88,23 @@
|
||||
:customStyle="{marginRight: '16px'}"
|
||||
label="手机"
|
||||
name="mobile"
|
||||
:disabled="btnDisabled"
|
||||
>
|
||||
</u-radio>
|
||||
<u-radio
|
||||
label="邮箱"
|
||||
name="email"
|
||||
:disabled="btnDisabled"
|
||||
>
|
||||
</u-radio>
|
||||
</u-radio-group>
|
||||
</u-form-item>
|
||||
<u-form-item v-if="needsPublishForm.contactWay === 'mobile'" label="手机" borderBottom>
|
||||
<u--input placeholder="请输入手机号" :border="false" v-model="needsPublishForm.mobile"
|
||||
placeholder-style="color:#CCCCCC"></u--input>
|
||||
placeholder-style="color:#CCCCCC" :disabled="btnDisabled" disabledColor="#ffffff"></u--input>
|
||||
</u-form-item>
|
||||
<u-form-item v-if="needsPublishForm.contactWay === 'email'" label="邮箱" borderBottom>
|
||||
<u--input placeholder="请输入邮箱地址" :border="false" v-model="needsPublishForm.email"
|
||||
<u--input placeholder="请输入邮箱地址" :border="false" v-model="needsPublishForm.email" :disabled="btnDisabled"
|
||||
placeholder-style="color:#CCCCCC"></u--input>
|
||||
</u-form-item>
|
||||
<view style="padding: 6rpx 20rpx 0;text-align: left;background-color: #fff;">
|
||||
@@ -114,12 +123,15 @@
|
||||
</view>
|
||||
</u-form-item> -->
|
||||
<view style="padding: 30rpx;background-color: #fff;">
|
||||
<u-button color="#0EBB5B" text="确定发布" @tap.stop="submitForm"></u-button>
|
||||
<u-button color="#0EBB5B" text="确定发布" @tap.stop="submitForm" :disabled="btnDisabled"></u-button>
|
||||
</view>
|
||||
<view style="padding: 10rpx 20rpx;text-align: center;background-color: #fff;">
|
||||
<text style="font-size: 24rpx;font-family: PingFangSC-Regular, PingFang SC;font-weight: 400;color: #C8C8C8;line-height: 28rpx;">
|
||||
您在确认发布后,会由平台管理方经行审核。审核通过后,予以发布。对于用户在本站发表的信息,由用户个人承担对应责任,本平台不承担任何法律责任。
|
||||
</text>
|
||||
<view style="padding: 12rpx 30rpx 20rpx 30rpx;background-color: #fff;">
|
||||
<text
|
||||
style="font-size: 24rpx;font-family: PingFangSC-Regular, PingFang SC;font-weight: 400;color: #C8C8C8;line-height: 28rpx;"
|
||||
v-if="tabCurrent === 0">{{claim_r}}</text>
|
||||
<text
|
||||
style="font-size: 24rpx;font-family: PingFangSC-Regular, PingFang SC;font-weight: 400;color: #C8C8C8;line-height: 28rpx;"
|
||||
v-if="tabCurrent === 1">{{claim_c}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</u--form>
|
||||
@@ -143,6 +155,9 @@
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
btnDisabled: false,
|
||||
claim_r: '',
|
||||
claim_c: '',
|
||||
tabsList: [{
|
||||
name: '需求发布'
|
||||
}, {
|
||||
@@ -163,18 +178,13 @@
|
||||
productPickerList: [],
|
||||
productPickerColumn: [
|
||||
[]
|
||||
// {name: '烘焙', val: 'hongbei'}
|
||||
// {name: '零食', val: 'ls'}
|
||||
// {name: '饮料', val: 'yl'}
|
||||
],
|
||||
positionPickerList: [],
|
||||
positionPickerColumn: [
|
||||
[]
|
||||
],
|
||||
categoryPickerList: [],
|
||||
fileList1: [
|
||||
// uploads/images/20230117/202301172309397deda1543.jpg
|
||||
],
|
||||
fileList1: [],
|
||||
isLoad: true,
|
||||
cateName: null,
|
||||
tagName: null,
|
||||
@@ -183,17 +193,11 @@
|
||||
}
|
||||
},
|
||||
onTabItemTap() {
|
||||
console.log('----onShow')
|
||||
// if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
|
||||
// console.log(uni.getStorageSync('loginToken'))
|
||||
// this.isLoad = false
|
||||
// // uni.navigateTo({
|
||||
// // url: '../../pages/my/login/login'
|
||||
// // })
|
||||
// return
|
||||
// }
|
||||
this.imgUrl = uni.getStorageSync('img_url')
|
||||
console.log(this.imgUrl)
|
||||
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
|
||||
this.isLoad = false
|
||||
return
|
||||
}
|
||||
this.isLoad = true
|
||||
this.token = uni.getStorageSync('loginToken')
|
||||
this.tabCurrent = 0
|
||||
@@ -201,23 +205,18 @@
|
||||
this.needsPublishForm = {}
|
||||
},
|
||||
onLoad(options) {
|
||||
console.log('---onLoad')
|
||||
console.log(options.item)
|
||||
this.imgUrl = uni.getStorageSync('img_url')
|
||||
//我的发布点击修改回显数据
|
||||
if(options && options.item && uni.getStorageSync(options.item)) {
|
||||
try{
|
||||
if (options && options.item && uni.getStorageSync(options.item)) {
|
||||
try {
|
||||
let publishFormList = uni.getStorageSync(options.item)
|
||||
console.log(publishFormList.images)
|
||||
this.fileList1 = publishFormList.images.map(item => {
|
||||
console.log(this.imgUrl)
|
||||
return {
|
||||
url: item
|
||||
}
|
||||
})
|
||||
console.log(this.fileList1)
|
||||
this.needsPublishForm = publishFormList
|
||||
} catch(error) {
|
||||
} catch (error) {
|
||||
this.$toast.warn(error)
|
||||
}
|
||||
}
|
||||
@@ -226,6 +225,9 @@
|
||||
} else if (options.index == 1) {
|
||||
this.tabCurrent = 1
|
||||
}
|
||||
if (options.view == 11) {
|
||||
this.btnDisabled = true
|
||||
}
|
||||
// this.getProductPickerList()
|
||||
},
|
||||
onShow() {
|
||||
@@ -235,20 +237,24 @@
|
||||
tabChange(data) {
|
||||
this.tabCurrent = data.index
|
||||
this.needsPublishForm = {}
|
||||
this.fileList1 = []
|
||||
this.btnDisabled = this.btnDisabled == true ? false : false;
|
||||
},
|
||||
getFormData() {
|
||||
this.$apiServe.getIdeasAndNeedsFormdata().then(res => {
|
||||
console.log(res.data.data)
|
||||
const formData = res.data.data
|
||||
this.productPickerColumn[0] = formData.product
|
||||
this.positionPickerColumn[0] = formData.loc
|
||||
this.categoryPickerList[0] = formData.class
|
||||
this.claim_r = formData.claim_r
|
||||
this.claim_c = formData.claim_c
|
||||
// this.productPickerList = res.data.data.map((item, index) => {
|
||||
// temp.push(item.name)
|
||||
// return item
|
||||
// })
|
||||
// this.productPickerColumn[0] = [...temp]
|
||||
}).finally(_ => {})
|
||||
}).finally(_ => {
|
||||
})
|
||||
},
|
||||
// getProductPickerList() {
|
||||
// const data = {}
|
||||
@@ -279,7 +285,6 @@
|
||||
// }
|
||||
// },
|
||||
getCityValue(data) {
|
||||
console.log(data)
|
||||
this.showCityPicker = false
|
||||
this.needsPublishForm.area_name = data[0].join('-')
|
||||
this.needsPublishForm.area_code = data[1]
|
||||
@@ -288,7 +293,6 @@
|
||||
this.showProductPicker = false
|
||||
this.showCategoryPicker = false
|
||||
this.needsPublishForm.product = data.value[0]
|
||||
// console.log(data)
|
||||
// const obj = this.productPickerList.find(item => {
|
||||
// return item.name === data.value[0]
|
||||
// })
|
||||
@@ -342,9 +346,6 @@
|
||||
async afterRead(event) {
|
||||
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
|
||||
let lists = [].concat(event.file)
|
||||
console.log(this.fileList1)
|
||||
console.log(lists)
|
||||
console.log(this[`fileList${event.name}`])
|
||||
let fileListLen = this[`fileList${event.name}`].length
|
||||
lists.map((item) => {
|
||||
this[`fileList${event.name}`].push({
|
||||
@@ -354,7 +355,6 @@
|
||||
})
|
||||
})
|
||||
for (let i = 0; i < lists.length; i++) {
|
||||
console.log(lists[i])
|
||||
const result = await this.uploadFilePromise(lists[i].url)
|
||||
let item = this[`fileList${event.name}`][fileListLen]
|
||||
this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
|
||||
@@ -367,16 +367,6 @@
|
||||
},
|
||||
uploadFilePromise(url) {
|
||||
return new Promise((resolve, reject) => {
|
||||
// const data = {
|
||||
// file: new File
|
||||
// }
|
||||
// let a = apiService.postImage(data).then(res => {
|
||||
// console.log(res)
|
||||
// })
|
||||
console.log('--345')
|
||||
console.log(url)
|
||||
console.log(this.token)
|
||||
console.log(apiService.uploadImgUrl)
|
||||
let a = uni.uploadFile({
|
||||
url: apiService.uploadImgUrl,
|
||||
filePath: url,
|
||||
@@ -387,8 +377,6 @@
|
||||
},
|
||||
success: (res) => {
|
||||
setTimeout(() => {
|
||||
console.log('---355')
|
||||
console.log(JSON.parse(res.data).data.url)
|
||||
resolve(JSON.parse(res.data).data.url)
|
||||
}, 1000)
|
||||
}
|
||||
@@ -396,7 +384,6 @@
|
||||
})
|
||||
},
|
||||
submitForm() {
|
||||
console.log(this.fileList1)
|
||||
if (this.needsPublishForm.contactWay === 'mobile' && !/^1[3456789]\d{9}$/.test(this.needsPublishForm.mobile)) {
|
||||
this.$toast.warn('请输入正确的手机号')
|
||||
return false
|
||||
@@ -406,12 +393,12 @@
|
||||
}
|
||||
this.needsPublishForm.type = Number(this.tabCurrent + 1)
|
||||
this.needsPublishForm.pub_time = this.needsPublishForm.pub_time ? this.needsPublishForm.pub_time :
|
||||
Math.round(new Date().getTime() / 1000)
|
||||
Math.round(new Date().getTime() / 1000)
|
||||
const temp = []
|
||||
if (this.fileList1.length > 0) {
|
||||
this.fileList1.map(item => {
|
||||
const url = item.url
|
||||
temp.push(url.replace(this.imgUrl+'/', ''))
|
||||
temp.push(url.replace(this.imgUrl + '/', ''))
|
||||
})
|
||||
}
|
||||
this.needsPublishForm.images = temp.join(';')
|
||||
@@ -434,10 +421,10 @@
|
||||
apiService.submitIdeasAndNeeds(data).then(res => {
|
||||
this.$toast.success('提交成功')
|
||||
console.log('esf=', res);
|
||||
if(this.needsPublishForm.id) {
|
||||
uni.navigateTo({
|
||||
url: '../../packageMy/myRelease/myRelease?index=' + (this.tabCurrent + 1)
|
||||
})
|
||||
if (this.needsPublishForm.id) {
|
||||
uni.navigateTo({
|
||||
url: '../../packageMy/myRelease/myRelease?index=' + (this.tabCurrent + 1)
|
||||
})
|
||||
}
|
||||
this.tabCurrent = 0
|
||||
this.fileList1 = []
|
||||
@@ -447,41 +434,21 @@
|
||||
this.$toast.warn(error)
|
||||
})
|
||||
},
|
||||
reOnLoad() {
|
||||
console.log('----------------true')
|
||||
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
|
||||
this.$toast.warn('登录失败请重试')
|
||||
this.isLoad = false
|
||||
// uni.navigateTo({
|
||||
// url: '../../pages/my/login/login'
|
||||
// })
|
||||
return
|
||||
}
|
||||
this.token = uni.getStorageSync('loginToken')
|
||||
this.isLoad = true
|
||||
this.getFormData()
|
||||
},
|
||||
failToLoad() {
|
||||
console.log('----------------false')
|
||||
this.$toast.warn('登录失败请重试')
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
// uni.navigateBack({
|
||||
// success: () => {
|
||||
// let page = getCurrentPages().pop();
|
||||
// if (page) {
|
||||
// page.onLoad(page.options);//执行上个页面的方法
|
||||
// };
|
||||
// }
|
||||
// })
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
/deep/.u-textarea--disabled {
|
||||
background-color: #ffffff !important;
|
||||
}
|
||||
|
||||
.content {
|
||||
background-color: #F8F8F8;
|
||||
|
||||
|
||||
@@ -24,7 +24,9 @@
|
||||
</view>
|
||||
<!-- 分类模块下的轮播图 -->
|
||||
<view>
|
||||
<u-swiper :list="swiperList" keyName="img" indicatorMode="line" radius="0" circular></u-swiper>
|
||||
<u-swiper :list="swiperList" keyName="img" indicatorMode="line" radius="0" circular
|
||||
@change="e => currentNum = e.current"
|
||||
@click="handleSwiperList(currentNum==''?0:currentNum,swiperList)"></u-swiper>
|
||||
</view>
|
||||
|
||||
<!-- 选项卡: 上架时间和点赞量 -->
|
||||
@@ -34,9 +36,9 @@
|
||||
</u-tabs>
|
||||
</view>
|
||||
<!-- 产品 -->
|
||||
<productsByTime v-if="tabCurrent==0" ref="productsByTime" @getTimeLength="getTimeLength">
|
||||
<productsByTime v-if="tabCurrent==0 && initStart" ref="productsByTime" @getTimeLength="getTimeLength">
|
||||
</productsByTime>
|
||||
<productsByThumb v-if="tabCurrent==1" ref="productsByThumb" @getThumbLength="getThumbLength">
|
||||
<productsByThumb v-if="tabCurrent==1 && initStart" ref="productsByThumb" @getThumbLength="getThumbLength">
|
||||
</productsByThumb>
|
||||
<view style="font-size: 24rpx;color: #A3A3A3;text-align: center;padding: 26rpx 0;"
|
||||
v-show="reachBottomLength===0">
|
||||
@@ -61,8 +63,10 @@
|
||||
},
|
||||
],
|
||||
imgUrl: '',
|
||||
initStart: false,
|
||||
swiperList: [],
|
||||
reachBottomLength: '',
|
||||
currentNum: ''
|
||||
}
|
||||
},
|
||||
onReachBottom() {
|
||||
@@ -75,33 +79,41 @@
|
||||
this.$refs.productsByThumb.getProductsByThumb()
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
// this.login()
|
||||
this.getCategories()
|
||||
this.getBanner()
|
||||
created() {
|
||||
this.getImgUrl()
|
||||
this.imgUrl = uni.getStorageSync('img_url')
|
||||
},
|
||||
methods: {
|
||||
// login() {
|
||||
// var that = this
|
||||
// uni.login({
|
||||
// "provider": "weixin",
|
||||
// "onlyAuthorize": true, // 微信登录仅请求授权认证
|
||||
// success: function(event) {
|
||||
// const {
|
||||
// code
|
||||
// } = event
|
||||
// that.$apiServe.login({
|
||||
// code: code
|
||||
// }).then(res => {
|
||||
// var data = res.data.data
|
||||
// // console.log('登录code换取的信息', data);
|
||||
// uni.setStorageSync('token', data.token);
|
||||
// })
|
||||
// },
|
||||
// })
|
||||
// },
|
||||
init() {
|
||||
this.imgUrl = uni.getStorageSync('img_url')
|
||||
this.getCategories()
|
||||
this.getBanner()
|
||||
wx.showShareMenu({
|
||||
withShareTicket: true,
|
||||
//设置下方的Menus菜单,才能够让发送给朋友与分享到朋友圈两个按钮可以点击
|
||||
menus: ["shareAppMessage", "shareTimeline"]
|
||||
})
|
||||
},
|
||||
//分享到微信好友
|
||||
onShareAppMessage(res) {
|
||||
return {
|
||||
title: '食瞳',
|
||||
type: 0,
|
||||
path: '/pages/index/index?id=' + distSource,
|
||||
summary: "",
|
||||
imageUrl: "https://pupil.hchyun.com/uploads/product/zhanwei02.png"
|
||||
}
|
||||
},
|
||||
//分享到朋友圈
|
||||
onShareTimeline(res) {
|
||||
return {
|
||||
title: '食瞳',
|
||||
type: 0,
|
||||
query: 'id=' + distSource,
|
||||
summary: "",
|
||||
imageUrl: "https://pupil.hchyun.com/uploads/product/zhanwei02.png"
|
||||
}
|
||||
},
|
||||
|
||||
//获取按上架时间排列的产品列表length
|
||||
getTimeLength(e) {
|
||||
this.reachBottomLength = e
|
||||
@@ -129,12 +141,21 @@
|
||||
getBanner() {
|
||||
this.$apiServe.getBanner().then(res => {
|
||||
let banner = res.data.data
|
||||
for (const item of banner) {
|
||||
item.img = this.imgUrl + item.img
|
||||
if (banner) {
|
||||
for (const item of banner) {
|
||||
item.img = this.imgUrl + item.img
|
||||
}
|
||||
this.swiperList = res.data.data
|
||||
}
|
||||
this.swiperList = res.data.data
|
||||
}).finally(_ => {})
|
||||
},
|
||||
//点击轮播图
|
||||
handleSwiperList(currentNum, swiperList) {
|
||||
swiperList[currentNum].link = swiperList[currentNum].link.replace(/\s*/g, "")
|
||||
uni.navigateTo({
|
||||
url: '/' + swiperList[currentNum].link
|
||||
})
|
||||
},
|
||||
//点击搜索框跳转到搜索页面
|
||||
toSearch() {
|
||||
uni.navigateTo({
|
||||
@@ -150,12 +171,17 @@
|
||||
//获取图片url
|
||||
getImgUrl() {
|
||||
this.$apiServe.getImgUrl().then(res => {
|
||||
res.data.data.img_url = res.data.data.img_url + '/'
|
||||
try {
|
||||
uni.setStorageSync('img_url', res.data.data.img_url);
|
||||
this.initStart = true
|
||||
this.init()
|
||||
} catch (e) {
|
||||
// error
|
||||
}
|
||||
}).finally(_ => {})
|
||||
}).finally(_ => {
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<view class="login-content">
|
||||
<view style="text-align: center;margin-bottom:30rpx;">
|
||||
<text>请登录后查看</text>
|
||||
<text>{{loginText}}</text>
|
||||
</view>
|
||||
<view style="padding-left: 30rpx;padding-right: 30rpx;display: flex;">
|
||||
<u-button type="info" :plain="true" size="nomal" @click="$emit('fail')">取消</u-button>
|
||||
@@ -18,7 +18,20 @@
|
||||
} from '@/service/request.js'
|
||||
export default {
|
||||
data() {
|
||||
return {}
|
||||
return {
|
||||
loginText: '请登录后查看'
|
||||
}
|
||||
},
|
||||
props: {
|
||||
timoutText: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (this.timoutText == 1) {
|
||||
this.loginText = "登录超时,请重新登录"
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getphonenumber(e) {
|
||||
|
||||
@@ -7,9 +7,12 @@
|
||||
<myAvatar ref="myavatar"></myAvatar>
|
||||
<view class="table">
|
||||
<u-cell-group>
|
||||
<u-cell size="large" title="绑定公司" icon="/static/my/wo_icon_bd.png" :isLink="true" value="未绑定公司"
|
||||
<!-- <u-cell v-if="is_bind" size="large" title="绑定公司" icon="/static/my/wo_icon_bd.png" :isLink="true"
|
||||
value="已绑定公司">
|
||||
</u-cell> -->
|
||||
<!-- <u-cell v-else size="large" title="绑定公司" icon="/static/my/wo_icon_bd.png" :isLink="true" value="未绑定公司"
|
||||
@click="bindCompany()">
|
||||
</u-cell>
|
||||
</u-cell> -->
|
||||
<u-cell size="large" title="会员中心" icon="/static/my/wo_icon_hyzx.png" :isLink="true"
|
||||
@click="toMemberCenter()"></u-cell>
|
||||
<u-cell size="large" title="浏览记录" icon="/static/my/wo_icon_lljl.png" :isLink="true"
|
||||
@@ -23,9 +26,9 @@
|
||||
</u-cell>
|
||||
</u-cell-group>
|
||||
<u-modal :show="showM" showCancelButton closeOnClickOverlay="false" confirmText="是" cancelText="否"
|
||||
@confirm="confirm" @cancel="cancel" @close="close">
|
||||
@confirm="confirm" @cancel="cancel">
|
||||
<view>
|
||||
<view>{{phone}}</view>
|
||||
<view>{{mobile}}</view>
|
||||
<text>是否拨打客服电话</text>
|
||||
</view>
|
||||
</u-modal>
|
||||
@@ -46,22 +49,34 @@
|
||||
data() {
|
||||
return {
|
||||
showM: false,
|
||||
phone: '138 1222 222',
|
||||
mobile: '',
|
||||
isLoad: true,
|
||||
is_bind: false
|
||||
}
|
||||
},
|
||||
onTabItemTap() {
|
||||
this.$refs.myavatar.getUser()
|
||||
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
|
||||
this.isLoad = false
|
||||
// uni.navigateTo({
|
||||
// url: '../../pages/my/login/login'
|
||||
// })
|
||||
return
|
||||
}
|
||||
this.isLoad = true
|
||||
},
|
||||
onLoad() {
|
||||
if (uni.getStorageSync('com_mobile')) {
|
||||
this.is_bind = true
|
||||
}
|
||||
this.getCsTel()
|
||||
},
|
||||
methods: {
|
||||
//获取客服电话
|
||||
getCsTel() {
|
||||
this.$apiServe.getCsTel().then(res => {
|
||||
if (res.data.data) {
|
||||
this.mobile = res.data.data.cs_tel
|
||||
}
|
||||
}).finally(_ => {})
|
||||
},
|
||||
//跳转到绑定公司页面
|
||||
bindCompany() {
|
||||
uni.navigateTo({
|
||||
@@ -98,7 +113,8 @@
|
||||
},
|
||||
confirm() {
|
||||
this.showM = false
|
||||
let phone = '1381222222'
|
||||
let phone = this.mobile
|
||||
phone = phone.toString()
|
||||
uni.makePhoneCall({
|
||||
phoneNumber: phone,
|
||||
success: function() {
|
||||
@@ -112,16 +128,10 @@
|
||||
cancel() {
|
||||
this.showM = false
|
||||
},
|
||||
close() {
|
||||
this.showM = false
|
||||
},
|
||||
reOnLoad() {
|
||||
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
|
||||
this.$toast.warn('登录失败请重试')
|
||||
this.isLoad = false
|
||||
// uni.navigateTo({
|
||||
// url: '../../pages/my/login/login'
|
||||
// })
|
||||
return
|
||||
}
|
||||
this.isLoad = true
|
||||
@@ -130,10 +140,9 @@
|
||||
}
|
||||
},
|
||||
failToLoad() {
|
||||
// uni.navigateBack({
|
||||
// url: '/pages/my/my'
|
||||
// })
|
||||
this.$toast.warn('登录失败请重试')
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<news></news>
|
||||
</view>
|
||||
|
||||
<!-- 新品发布 -->
|
||||
<!-- 企业需求 -->
|
||||
<view>
|
||||
<view class="subtitle">
|
||||
<u--image src="/static/report/hy_icon_fux.png" width="24rpx" height="24rpx" :lazy-load="true">
|
||||
@@ -32,7 +32,7 @@
|
||||
</view>
|
||||
|
||||
<!-- 认证厂家 -->
|
||||
<view>
|
||||
<view v-if="token==true">
|
||||
<view class="subtitle">
|
||||
<u--image src="/static/report/hy_icon_cjx.png" width="24rpx" height="24rpx" :lazy-load="true">
|
||||
</u--image>
|
||||
@@ -40,13 +40,24 @@
|
||||
</view>
|
||||
<certifiedCj></certifiedCj>
|
||||
</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 {
|
||||
isLoad: true,
|
||||
token: '',
|
||||
classifyList: [{
|
||||
src: '/static/report/hy_icon_xw.png',
|
||||
title: '行业新闻'
|
||||
@@ -60,7 +71,16 @@
|
||||
title: '认证厂家'
|
||||
},
|
||||
],
|
||||
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
if (uni.getStorageSync('loginToken')) {
|
||||
this.token = true
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
if (uni.getStorageSync('loginToken')) {
|
||||
this.token = true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -76,12 +96,33 @@
|
||||
url: '../../packageReport/newProductRelease/newProductRelease'
|
||||
})
|
||||
} else if (listIndex == 2) {
|
||||
if (uni.getStorageSync('loginToken')) {
|
||||
uni.navigateTo({
|
||||
url: '../../packageReport/certifiedCj/certifiedCj'
|
||||
})
|
||||
} else {
|
||||
this.isLoad = false
|
||||
}
|
||||
}
|
||||
},
|
||||
reOnLoad() {
|
||||
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
|
||||
this.$toast.warn('登录失败请重试')
|
||||
this.isLoad = false
|
||||
return
|
||||
}
|
||||
this.isLoad = true
|
||||
if (this.isLoad) {
|
||||
uni.navigateTo({
|
||||
url: '../../packageReport/certifiedCj/certifiedCj'
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
failToLoad() {
|
||||
uni.reLaunch({
|
||||
url: '/pages/report/report'
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user