冲突解决
This commit is contained in:
@@ -1,19 +1,17 @@
|
||||
<template>
|
||||
<view>
|
||||
<view :key="index">
|
||||
<u-swiper :list="detailList.images" indicatorMode="line " width="750rpx" height="530rpx" radius="0"
|
||||
circular>
|
||||
</u-swiper>
|
||||
<view class="collect">
|
||||
<u-image :src="imgUrl+detailList.cover" width="750rpx" height="530rpx">
|
||||
</u-image>
|
||||
<view class="collect" @click="starTap">
|
||||
<view class="star">
|
||||
<u-image v-if="showStar==false" src="/static/detail/xp_icon_wstar.png" width="28rpx" height="28rpx"
|
||||
@click="starTap">
|
||||
<u-image v-if="detailList.type==0" src="/static/detail/xp_icon_wstar.png" width="28rpx"
|
||||
height="28rpx">
|
||||
</u-image>
|
||||
<u-image v-if="showStar==true" src="/static/detail/xp_icon_star.png" width="28rpx" height="28rpx"
|
||||
@click="starTap">
|
||||
<u-image v-if="detailList.type==1" 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>
|
||||
@@ -31,23 +29,22 @@
|
||||
</view>
|
||||
<view class="tag_view">
|
||||
<view>
|
||||
<text class="tagOne">{{detailList.tags}}</text>
|
||||
<!-- <text class="tagTwo">{{item.tagTwo}}</text> v-for="item in detailList.tags" :key="item.id" -->
|
||||
<text class="tagOne" v-for="item in detailList.tags" :key="item.id">{{item}}</text>
|
||||
</view>
|
||||
<view v-if="isThumb==false" class="heart">
|
||||
<u-image v-if="showHeart==false" src="/static/detail/xp_icon_heart.png" width="34rpx"
|
||||
height="32rpx" @click="heartTap">
|
||||
</u-image>
|
||||
<u-image v-if="showHeart==true" src="/static/detail/xp_icon_ysc.png" width="34rpx"
|
||||
height="32rpx" @click="heartTap">
|
||||
</u-image>
|
||||
<text class="thumb">点赞</text>
|
||||
</view>
|
||||
<view v-if="isThumb==true" class="heart">
|
||||
<u-image src="/static/detail/xp_icon_ysc.png" width="34rpx" height="32rpx" @click="heartTap">
|
||||
<view v-if="detailList.thumb" class="heart">
|
||||
<u-image src="/static/detail/xp_icon_ysc.png" width="34rpx" height="32rpx">
|
||||
</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>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -64,50 +61,48 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
dateFormatDetail
|
||||
} from '../../../utills/date.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
id: '',
|
||||
showStar: false,
|
||||
imgUrl: '',
|
||||
tagsArray: [],
|
||||
showHeart: false,
|
||||
isThumb: false,
|
||||
detailList: [
|
||||
// {
|
||||
// title: '锅巴',
|
||||
// tag: '零食铺子',
|
||||
// desc: '糯米蟹黄锅巴散装,非油炸绿色健康食品',
|
||||
// classify: '薯片膨化',
|
||||
// tagOne: '无添加剂1',
|
||||
// tagTwo: '无添加剂',
|
||||
// time: '2022年12月04日',
|
||||
// content: '<h1>一级标题</h1><br/><h2>二级标题</h2>'
|
||||
// },
|
||||
],
|
||||
swiperList: [
|
||||
'/static/detail/zhanwei_xppx.png',
|
||||
'/static/detail/zhanwei_xppx.png'
|
||||
]
|
||||
detailList: []
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
console.log('产品id', option.id);
|
||||
this.id = option.id
|
||||
this.getProductDetail()
|
||||
this.imgUrl = uni.getStorageSync('img_url')
|
||||
},
|
||||
methods: {
|
||||
//获取详情信息
|
||||
getProductDetail() {
|
||||
this.$apiServe.getProductDetail(this.id).then(res => {
|
||||
// console.log('详情页', res.data.data.thumb)
|
||||
console.log('详情页', res.data.data)
|
||||
if (res.data.data.thumb) {
|
||||
this.isThumb = true
|
||||
}
|
||||
let detail = res.data.data
|
||||
detail.pub_time = dateFormatDetail(detail.pub_time)
|
||||
let tag = detail.tags
|
||||
this.tagsArray = tag.split(',')
|
||||
detail.tags = this.tagsArray
|
||||
this.detailList = res.data.data
|
||||
}).finally(_ => {})
|
||||
},
|
||||
//收藏按钮
|
||||
starTap() {
|
||||
this.showStar = !this.showStar
|
||||
this.detailList.type = !this.detailList.type
|
||||
// this.$apiServe.collect(this.id).then(res => {
|
||||
// console.log('收藏成功', res.data)
|
||||
|
||||
// this.detailList.type = 1
|
||||
// }).finally(_ => {})
|
||||
},
|
||||
//点赞按钮
|
||||
heartTap() {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<view class="classify">
|
||||
<u-grid :border="false" col="5">
|
||||
<u-grid-item v-for="(listItem,listIndex) in classifyList" :key="listIndex" @click="toClassify(listItem.id)">
|
||||
<u--image :src="listItem.icon" width="86rpx" height="86rpx" :lazy-load="true">
|
||||
<u--image :src="imgUrl+listItem.icon" width="86rpx" height="86rpx" :lazy-load="true">
|
||||
</u--image>
|
||||
<!-- <u-icon size="86rpx" :name="listItem.icon"></u-icon> -->
|
||||
<text class="grid-text">{{listItem.name}}</text>
|
||||
@@ -23,7 +23,7 @@
|
||||
</view>
|
||||
<!-- 分类模块下的轮播图 -->
|
||||
<view>
|
||||
<u-swiper :list="swiperList" indicatorMode="line" radius="0" circular></u-swiper>
|
||||
<u-swiper :list="swiperList" keyName="img" indicatorMode="line" radius="0" circular></u-swiper>
|
||||
</view>
|
||||
|
||||
|
||||
@@ -33,12 +33,15 @@
|
||||
</view> -->
|
||||
<!-- 选项卡: 上架时间和点赞量 -->
|
||||
<view>
|
||||
<u-tabs :list="tabList" lineColor="#15CA65" :is-scroll="false"
|
||||
activeStyle="color:#15CA65;font-weight: bold;">
|
||||
<u-tabs :list="tabList" lineColor="#15CA65" scrollable="false"
|
||||
activeStyle="color:#15CA65;font-weight: bold;" :current="tabCurrent" @change="tabChange">
|
||||
</u-tabs>
|
||||
</view>
|
||||
<!-- 产品 -->
|
||||
<products ref="getProducts"></products>
|
||||
<products ref="getProductsByTime"></products>
|
||||
<view style="font-size: 24rpx;color: #A3A3A3;text-align: center;padding: 26rpx 0;"
|
||||
v-show="reachBottomLength===0">
|
||||
没有更多数据了</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -46,51 +49,12 @@
|
||||
import {
|
||||
serverHost
|
||||
} from '@/service/request.js'
|
||||
import loginVue from '../my/login/login.vue'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
classifyList: [
|
||||
// {
|
||||
// src: '/static/classify/sy_icon_hp.png',
|
||||
// title: '烘培宝典'
|
||||
// },
|
||||
// {
|
||||
// src: '/static/classify/sy_icon_ls.png',
|
||||
// title: '零食铺子'
|
||||
// },
|
||||
// {
|
||||
// src: '/static/classify/sy_icon_yp.png',
|
||||
// title: '饮品大全'
|
||||
// },
|
||||
// {
|
||||
// src: '/static/classify/sy_icon_tw.png',
|
||||
// title: '调味菜单'
|
||||
// },
|
||||
// {
|
||||
// src: '/static/classify/sy_icon_rs.png',
|
||||
// title: '肉食荟萃'
|
||||
// },
|
||||
// {
|
||||
// src: '/static/classify/sy_icon_np.png',
|
||||
// title: '乳品手册'
|
||||
// },
|
||||
// {
|
||||
// src: '/static/classify/sy_icon_gs.png',
|
||||
// title: '果蔬地图'
|
||||
// },
|
||||
// {
|
||||
// src: '/static/classify/sy_icon_sj.png',
|
||||
// title: '食界新贵'
|
||||
// },
|
||||
// {
|
||||
// src: '/static/classify/sy_icon_hz.png',
|
||||
// title: '欢喜盒子'
|
||||
// },
|
||||
// {
|
||||
// src: '/static/classify/sy_icon_cy.png',
|
||||
// title: '创意工具'
|
||||
// },
|
||||
],
|
||||
classifyList: [],
|
||||
tabCurrent: 0,
|
||||
tabList: [{
|
||||
name: '上架时间'
|
||||
},
|
||||
@@ -98,63 +62,61 @@
|
||||
name: '点赞量'
|
||||
},
|
||||
],
|
||||
|
||||
// swiperList: [
|
||||
// 'https://cdn.uviewui.com/uview/swiper/swiper3.png',
|
||||
// 'https://cdn.uviewui.com/uview/swiper/swiper3.png'
|
||||
// ],
|
||||
imgUrl: '',
|
||||
swiperList: [],
|
||||
reachBottomLength: '',
|
||||
productList: [],
|
||||
pageNum: 1,
|
||||
sortType: ''
|
||||
}
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
// this.$refs.getProducts.query.pageNum = 1
|
||||
// this.$refs.getProducts.productList = []
|
||||
|
||||
this.$refs.getProducts.getProducts()
|
||||
//关闭下拉刷新
|
||||
uni.stopPullDownRefresh()
|
||||
onReachBottom() {
|
||||
this.pageNum += 1
|
||||
if (this.reachBottomLength !== 0) {
|
||||
this.getNewProducts()
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.getCategories()
|
||||
this.getBanner()
|
||||
this.getImgUrl()
|
||||
// this.$refs.getProducts.getProducts()
|
||||
this.getToken()
|
||||
this.imgUrl = uni.getStorageSync('img_url')
|
||||
},
|
||||
|
||||
methods: {
|
||||
//获取一级分类
|
||||
getCategories() {
|
||||
this.$apiServe.getCategories().then(res => {
|
||||
// console.log(res.data.data)
|
||||
this.classifyList = res.data.data
|
||||
}).finally(_ => {})
|
||||
//点击上架时间和点赞量切换页面
|
||||
tabChange(data) {
|
||||
this.tabCurrent = data.index
|
||||
uni.$emit("getCurrent", data.index);
|
||||
if (data.index == 0) {
|
||||
this.sortType = 1
|
||||
} else if (data.index == 1) {
|
||||
this.$refs.getProductsByTime.getProducts()
|
||||
this.sortType = 2
|
||||
}
|
||||
},
|
||||
//获取首页轮播图
|
||||
getBanner() {
|
||||
this.$apiServe.getBanner().then(res => {
|
||||
// console.log(res.data.data);
|
||||
let banner = res.data.data
|
||||
for (const item of banner) {
|
||||
this.swiperList = item.img
|
||||
// console.log(item);
|
||||
//下拉刷新获取新数据
|
||||
getNewProducts() {
|
||||
this.$apiServe.getProducts({
|
||||
sortType: this.sortType,
|
||||
pageSize: 4,
|
||||
pageNum: this.pageNum
|
||||
}).then(res => {
|
||||
let tags = res.data.data
|
||||
for (const item of tags) {
|
||||
let tag = item.tags
|
||||
this.tagsArray = tag.split(',')
|
||||
item.tags = this.tagsArray[0]
|
||||
}
|
||||
// this.swiperList = res.data.data
|
||||
}).finally(_ => {})
|
||||
},
|
||||
//点击一级分类
|
||||
// click(listIndex) {
|
||||
// this.$refs.uToast.success(`点击了第${listIndex}个`)
|
||||
// },
|
||||
//点击搜索框跳转到搜索页面
|
||||
toSearch() {
|
||||
uni.navigateTo({
|
||||
url: '../../packageSearch/search/search'
|
||||
if (tags.length === 0) {
|
||||
this.reachBottomLength = tags.length
|
||||
}
|
||||
this.$refs.getProductsByTime.productList.push(...res.data.data)
|
||||
})
|
||||
},
|
||||
getphonenumber(e) {
|
||||
const {
|
||||
code
|
||||
} = e.detail;
|
||||
console.log("手机code : ", code);
|
||||
//获取token
|
||||
getToken() {
|
||||
var that = this
|
||||
uni.login({
|
||||
"provider": "weixin",
|
||||
"onlyAuthorize": true, // 微信登录仅请求授权认证
|
||||
@@ -162,13 +124,13 @@
|
||||
const {
|
||||
code
|
||||
} = event
|
||||
|
||||
console.log("登录code", code);
|
||||
//客户端成功获取授权临时票据(code),向业务服务器发起登录请求。
|
||||
|
||||
|
||||
// 调用登录接口 拿到token 传手机code,更新手机号码
|
||||
|
||||
that.$apiServe.login({
|
||||
code: code
|
||||
}).then(res => {
|
||||
var data = res.data.data
|
||||
// console.log('登录code换取的信息', data);
|
||||
uni.setStorageSync('token', data.token);
|
||||
})
|
||||
},
|
||||
fail: function(err) {
|
||||
// 登录授权失败
|
||||
@@ -176,6 +138,40 @@
|
||||
}
|
||||
})
|
||||
},
|
||||
//获取手机code
|
||||
getphonenumber(e) {
|
||||
let that = this
|
||||
// const {
|
||||
// code
|
||||
// } = e.detail;
|
||||
// console.log("手机code : ", code);
|
||||
},
|
||||
//获取子组件的getProducts方法返回数据的length,用于当length为0时取消发送请求
|
||||
// getChild(e) {
|
||||
// this.reachBottomLength = e
|
||||
// },
|
||||
//获取一级分类
|
||||
getCategories() {
|
||||
this.$apiServe.getCategories().then(res => {
|
||||
this.classifyList = res.data.data
|
||||
}).finally(_ => {})
|
||||
},
|
||||
//获取首页轮播图
|
||||
getBanner() {
|
||||
this.$apiServe.getBanner().then(res => {
|
||||
let banner = res.data.data
|
||||
for (const item of banner) {
|
||||
item.img = this.imgUrl + item.img
|
||||
}
|
||||
this.swiperList = res.data.data
|
||||
}).finally(_ => {})
|
||||
},
|
||||
//点击搜索框跳转到搜索页面
|
||||
toSearch() {
|
||||
uni.navigateTo({
|
||||
url: '../../packageSearch/search/search'
|
||||
})
|
||||
},
|
||||
//点击一级分类跳转到分类页
|
||||
toClassify(id) {
|
||||
uni.navigateTo({
|
||||
@@ -184,7 +180,6 @@
|
||||
},
|
||||
getImgUrl() {
|
||||
this.$apiServe.getImgUrl().then(res => {
|
||||
console.log(res)
|
||||
try {
|
||||
uni.setStorageSync('img_url', res.data.data.img_url);
|
||||
} catch (e) {
|
||||
|
||||
@@ -1,56 +1,56 @@
|
||||
<template>
|
||||
<view>
|
||||
<u-button type="primary" open-type="getPhoneNumber" size="medium" @getphonenumber="getphonenumber">
|
||||
获取电话号码</u-button>
|
||||
</view>
|
||||
<view>
|
||||
<u-button type="primary" open-type="getPhoneNumber" size="medium" @getphonenumber="getphonenumber">
|
||||
获取电话号码</u-button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {loginSys} from '@/service/request.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getphonenumber(e) {
|
||||
const {
|
||||
phoneCode
|
||||
} = e.detail;
|
||||
console.log("手机code : ", phoneCode);
|
||||
uni.login({
|
||||
"provider": "weixin",
|
||||
"onlyAuthorize": true, // 微信登录仅请求授权认证
|
||||
success: function(event) {
|
||||
const {
|
||||
code
|
||||
} = event
|
||||
|
||||
console.log("登录code", code);
|
||||
//客户端成功获取授权临时票据(code),向业务服务器发起登录请求。
|
||||
|
||||
|
||||
// 调用登录接口 拿到token 传手机code,更新手机号码
|
||||
loginSys(code).then(res=>{
|
||||
console.log(res);
|
||||
|
||||
|
||||
|
||||
//登录完成后使用手机code换取手机号,调用/user/getMobileByMnp接口
|
||||
//接口详细链接 https://docs.apipost.cn/preview/468be606f65cae75/3f2f988ddf82dd8e
|
||||
})
|
||||
},
|
||||
fail: function(err) {
|
||||
// 登录授权失败
|
||||
// err.code是错误码
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
import {
|
||||
loginSys
|
||||
} from '@/service/request.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getphonenumber(e) {
|
||||
const {
|
||||
phoneCode
|
||||
} = e.detail;
|
||||
console.log("手机code : ", phoneCode);
|
||||
uni.login({
|
||||
"provider": "weixin",
|
||||
"onlyAuthorize": true, // 微信登录仅请求授权认证
|
||||
success: function(event) {
|
||||
const {
|
||||
code
|
||||
} = event
|
||||
|
||||
console.log("登录code", code);
|
||||
//客户端成功获取授权临时票据(code),向业务服务器发起登录请求。
|
||||
|
||||
|
||||
// 调用登录接口 拿到token 传手机code,更新手机号码
|
||||
loginSys(code).then(res => {
|
||||
console.log(res);
|
||||
|
||||
//登录完成后使用手机code换取手机号,调用/user/getMobileByMnp接口
|
||||
//接口详细链接 https://docs.apipost.cn/preview/468be606f65cae75/3f2f988ddf82dd8e
|
||||
})
|
||||
},
|
||||
fail: function(err) {
|
||||
// 登录授权失败
|
||||
// err.code是错误码
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -24,27 +24,29 @@
|
||||
</u-cell-group>
|
||||
<u-modal :show="showM" showCancelButton closeOnClickOverlay confirmText="是" cancelText="否"
|
||||
@confirm="confirm" @cancel="cancel" @close="close">
|
||||
<rich-text :nodes="content"></rich-text>
|
||||
<view>
|
||||
<text>{{phone}}</text>
|
||||
<text>是否拨打客服电话</text>
|
||||
</view>
|
||||
</u-modal>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import loginVue from './login/login.vue'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
showM: false,
|
||||
content: `138 1222 222<br>
|
||||
是否拨打客服电话`,
|
||||
|
||||
phone: '138 1222 222',
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
//跳转到绑定公司页面
|
||||
bindCompany() {
|
||||
uni.navigateTo({
|
||||
url: '../../packageMy/bindCompony/bindCompony'
|
||||
url: '../../packageMy/bindCompany/bindCompany'
|
||||
})
|
||||
},
|
||||
//跳转到会员中心页面
|
||||
@@ -56,14 +58,13 @@
|
||||
//跳转到浏览记录页面
|
||||
toBrowseHistory() {
|
||||
uni.navigateTo({
|
||||
url: '../../packageMy/browseHistory/browseHistory?id=' + 1
|
||||
url: '../../packageMy/browseHistory/browseHistory'
|
||||
})
|
||||
},
|
||||
|
||||
//跳转到我的收藏页面
|
||||
toMyCollect() {
|
||||
uni.navigateTo({
|
||||
url: '../../packageMy/browseHistory/browseHistory?id=' + 2
|
||||
url: '../../packageMy/myCollection/myCollection'
|
||||
})
|
||||
},
|
||||
//跳转到我的发布页面
|
||||
@@ -72,7 +73,6 @@
|
||||
url: '../../packageMy/myRelease/myRelease'
|
||||
})
|
||||
},
|
||||
|
||||
// 联系客服模态框
|
||||
showModal() {
|
||||
this.showM = true
|
||||
@@ -139,36 +139,10 @@
|
||||
color: #CCCCCC !important;
|
||||
}
|
||||
|
||||
.u-modal {
|
||||
width: 472rpx !important;
|
||||
|
||||
}
|
||||
|
||||
.u-modal__button-group__wrapper--cancel {
|
||||
|
||||
background: #D8D8D8;
|
||||
|
||||
.u-modal__button-group__wrapper__text {
|
||||
color: #fff !important;
|
||||
}
|
||||
}
|
||||
|
||||
.u-modal__content {
|
||||
padding: 43rpx 104rpx !important;
|
||||
text-indent: 25rpx;
|
||||
}
|
||||
|
||||
.u-modal__content__text {
|
||||
font-size: 32rpx !important;
|
||||
font-weight: 400;
|
||||
color: #252421 !important;
|
||||
}
|
||||
|
||||
.u-modal__button-group__wrapper--confirm {
|
||||
background: #0EBB5B;
|
||||
|
||||
.u-modal__button-group__wrapper__text {
|
||||
color: #fff !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
<view class="classify">
|
||||
<u-grid :border="false" col="3">
|
||||
<u-grid-item v-for="(listItem,listIndex) in classifyList" :key="listIndex" @click="click(listIndex)">
|
||||
<!-- 懒加载 :lazy-load="true" -->
|
||||
<u--image :src="listItem.src" width="86rpx" height="86rpx" :lazy-load="true">
|
||||
</u--image>
|
||||
<text class="grid-text">{{listItem.title}}</text>
|
||||
@@ -121,7 +120,9 @@
|
||||
color: #5ACCF0;
|
||||
}
|
||||
|
||||
|
||||
.u-image__error {
|
||||
position: static !important;
|
||||
}
|
||||
|
||||
|
||||
.xpfb_text {
|
||||
|
||||
Reference in New Issue
Block a user