2025.2.11 工作代码提交
This commit is contained in:
parent
28843fa3d3
commit
b56aae7b27
|
@ -207,6 +207,16 @@ export const news = {
|
|||
method: 'POST'
|
||||
})
|
||||
},
|
||||
|
||||
// 群聊发消息
|
||||
getMessageList(param) {
|
||||
return util.request({
|
||||
url: `/user/chat/getMessageList`,
|
||||
query: param.query,
|
||||
data: param.data,
|
||||
method: 'GET'
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
export default news
|
|
@ -422,6 +422,19 @@ const shop = {
|
|||
url: `/shopify/reviews/findReviewByProductId`,
|
||||
query: param.query,
|
||||
method: 'GET',
|
||||
load: true,
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 分页查询商品评论列表
|
||||
* @param {Object} param
|
||||
*/
|
||||
recentOrder(param) {
|
||||
return util.request({
|
||||
url: `/shopify/appOrder/recentOrder`,
|
||||
query: param.query,
|
||||
method: 'GET',
|
||||
})
|
||||
},
|
||||
}
|
||||
|
|
|
@ -7,8 +7,9 @@ const config = {
|
|||
// #endif
|
||||
// #ifndef H5
|
||||
host: 'http://91f.xyz:8080',
|
||||
// host: 'http://22vn9z.natappfree.cc',
|
||||
// host: 'https://63fdb472.r24.cpolar.top',
|
||||
// host: 'http://6t42vi.natappfree.cc',
|
||||
// host: 'http://nrpnpc.natappfree.cc',
|
||||
// host: 'http://6aa4a4c3.r24.cpolar.top',
|
||||
// #endif
|
||||
// 支付方式配置
|
||||
payType: {
|
||||
|
|
|
@ -209,13 +209,14 @@
|
|||
|
||||
// 移除加好友监听
|
||||
function removelistener() {
|
||||
uni.$chat.off(TencentCloudChat.EVENT.FRIEND_LIST_UPDATED);
|
||||
uni.$chat.off(TencentCloudChat.EVENT.FRIEND_LIST_UPDATED, () => {});
|
||||
}
|
||||
|
||||
// 获取朋友列表
|
||||
function getFriendList() {
|
||||
// 验证sdk是否准备完毕
|
||||
let isReady = uni.$chat.isReady();
|
||||
console.log('getFriendList', isReady)
|
||||
|
||||
if (!isReady) {
|
||||
setTimeout(function() {
|
||||
|
@ -223,6 +224,7 @@
|
|||
}, 500);
|
||||
return
|
||||
}
|
||||
console.log('getFriendList')
|
||||
|
||||
//
|
||||
api.news.getFriendList().then(rs => {
|
||||
|
|
|
@ -81,10 +81,19 @@
|
|||
|
||||
// 获取朋友列表
|
||||
function getList() {
|
||||
uni.$chat.getConversationList().then(rs => {
|
||||
// console.log('getConversation', rs)
|
||||
list.length = 0
|
||||
list.push(...rs.data.conversationList)
|
||||
api.news.getMessageList({
|
||||
query: {
|
||||
userId: userinfo.value.id,
|
||||
}
|
||||
}).then(rs => {
|
||||
if (rs.code == 200) {
|
||||
//
|
||||
return
|
||||
}
|
||||
util.alert({
|
||||
content: rs.msg,
|
||||
showCancel: false,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -202,7 +211,8 @@
|
|||
</view>
|
||||
</view>
|
||||
</uni-swipe-action-item> -->
|
||||
<uni-swipe-action-item :right-options="rightOption" v-for="(item, index) in list" :key="index" @click="handleMenu($event,item)">
|
||||
<uni-swipe-action-item :right-options="rightOption" v-for="(item, index) in list" :key="index"
|
||||
@click="handleMenu($event,item)">
|
||||
<view class="item rows ptb20 plr30" @click="handleChat(item)">
|
||||
<view class="image wh90 pr">
|
||||
<template v-if="item.type == 'GROUP'">
|
||||
|
@ -224,7 +234,8 @@
|
|||
<text>{{item.userProfile.nick}}</text>
|
||||
</template>
|
||||
</view>
|
||||
<view class="datetime c999 f22">{{ util.formatTime('MM-dd HH:mm',item.lastMessage.lastTime) }}</view>
|
||||
<view class="datetime c999 f22">
|
||||
{{ util.formatTime('MM-dd HH:mm',item.lastMessage.lastTime) }}</view>
|
||||
</view>
|
||||
<view class="desc thd mt10 c666 f24">{{item.lastMessage.messageForShow}}</view>
|
||||
</view>
|
||||
|
|
|
@ -1,180 +1,171 @@
|
|||
<template>
|
||||
<view class="tab">
|
||||
<scroll-view class="scroll" scroll-x scroll-with-animation :show-scrollbar="false" :scroll-left="scrollLeft">
|
||||
<view class="list" :class="scroll ? '' : 'flex-row-left'" id="tab">
|
||||
<view class="item fmid ptb10 plr20" :class="{'active': index === currentIndex}" :id="'tab-item-' + index"
|
||||
v-for="(item, index) in list" :key="index" @click="clickTab(item, index)">
|
||||
{{ item[titalName] }}
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view class="tab">
|
||||
<scroll-view class="scroll" scroll-x scroll-with-animation :show-scrollbar="false" :scroll-left="scrollLeft">
|
||||
<view class="list" :class="scroll ? '' : 'flex-row-left'" id="tab">
|
||||
<view class="item fmid ptb10 plr20" :class="{'active': index === currentIndex}" :id="'tab-item-' + index"
|
||||
v-for="(item, index) in list" :key="index" @click="handleTabClick(item, index)">
|
||||
{{ item[titalName] }}
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
list: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return []
|
||||
}
|
||||
},
|
||||
titalName: {
|
||||
type: String,
|
||||
default: 'name'
|
||||
},
|
||||
// 是否滚动,默认是,否则是不滚动,按个数等分宽度
|
||||
scroll: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
scrollLeft: 0,
|
||||
componentWidth: 0, // tabs组件宽度,单位为px
|
||||
parentLeft: 0, // 父元素(tabs组件)到屏幕左边的距离
|
||||
scrollBarLeft: 0, // 移动bar需要通过translateX()移动的距离
|
||||
tabItemRectInfo: [],
|
||||
currentIndex: 0,
|
||||
barFirstTimeMove: true
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
list(n, o) {
|
||||
// list变动时,重制内部索引,否则可能导致超出数组边界的情况
|
||||
if (n.length !== o.length) this.currentIndex = 0;
|
||||
this.$nextTick(() => {
|
||||
this.init();
|
||||
});
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.init()
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.$nextTick(() => {
|
||||
uni.createSelectorQuery().in(this).select(`#tab`).fields({
|
||||
size: true,
|
||||
rect: true
|
||||
}, data => {
|
||||
this.parentLeft = data.left;
|
||||
// tabs组件的宽度
|
||||
this.componentWidth = data.width;
|
||||
}).exec();
|
||||
this.getTabItemRect()
|
||||
})
|
||||
},
|
||||
getTabItemRect() {
|
||||
let query = uni.createSelectorQuery().in(this);
|
||||
for (let i = 0; i < this.list.length; i++) {
|
||||
// 只要size和rect两个参数
|
||||
query.select(`#tab-item-${i}`).fields({
|
||||
size: true,
|
||||
rect: true
|
||||
});
|
||||
}
|
||||
query.exec((data) => {
|
||||
this.tabItemRectInfo = data
|
||||
this.scrollByIndex()
|
||||
})
|
||||
},
|
||||
scrollByIndex() {
|
||||
let tabInfo = this.tabItemRectInfo[this.currentIndex]
|
||||
if (!tabInfo) return
|
||||
// 活动tab的宽度
|
||||
let tabWidth = tabInfo.width
|
||||
let offsetLeft = tabInfo.left - this.parentLeft
|
||||
// 将活动的tabs-item移动到屏幕正中间,实际上是对scroll-view的移动
|
||||
let scrollLeft = offsetLeft - (this.componentWidth - tabWidth) / 2
|
||||
this.scrollLeft = scrollLeft < 0 ? 0 : scrollLeft;
|
||||
// 计算当前活跃item到组件左边的距离
|
||||
let left = tabInfo.left + tabInfo.width / 2 - this.parentLeft
|
||||
this.scrollBarLeft = left - this.barWidth / 2;
|
||||
if (this.barFirstTimeMove == true) {
|
||||
setTimeout(() => {
|
||||
this.barFirstTimeMove = false;
|
||||
}, 100)
|
||||
}
|
||||
},
|
||||
|
||||
clickTab(item, index) {
|
||||
// 点击当前活动tab,不触发事件
|
||||
if (index === this.currentIndex) return
|
||||
this.currentIndex = index
|
||||
this.$emit('tabItemClick', item, index)
|
||||
this.scrollByIndex()
|
||||
}
|
||||
}
|
||||
}
|
||||
export default {
|
||||
props: {
|
||||
list: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
titalName: {
|
||||
type: String,
|
||||
default: 'name'
|
||||
},
|
||||
// 是否滚动,默认是,否则是不滚动,按个数等分宽度
|
||||
scroll: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
// 支持双向绑定的 prop
|
||||
modelValue: {
|
||||
type: [Number,String],
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
currentIndex: {
|
||||
get() {
|
||||
return this.modelValue;
|
||||
},
|
||||
set(newValue) {
|
||||
this.$emit('update:modelValue', newValue);
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
scrollLeft: 0,
|
||||
componentWidth: 0, // tabs组件宽度,单位为px
|
||||
parentLeft: 0, // 父元素(tabs组件)到屏幕左边的距离
|
||||
scrollBarLeft: 0, // 移动bar需要通过translateX()移动的距离
|
||||
tabItemRectInfo: [],
|
||||
barFirstTimeMove: true
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
list: {
|
||||
deep: true,
|
||||
handler(newList, oldList) {
|
||||
if (newList.length !== oldList.length) {
|
||||
this.currentIndex = 0;
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.initialize();
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.initialize();
|
||||
},
|
||||
methods: {
|
||||
initialize() {
|
||||
this.getComponentRect();
|
||||
this.getTabItemRect();
|
||||
},
|
||||
getComponentRect() {
|
||||
uni.createSelectorQuery().in(this).select('#tab').fields({
|
||||
size: true,
|
||||
rect: true
|
||||
}, (data) => {
|
||||
if (data) {
|
||||
this.parentLeft = data.left;
|
||||
this.componentWidth = data.width;
|
||||
}
|
||||
}).exec();
|
||||
},
|
||||
getTabItemRect() {
|
||||
const query = uni.createSelectorQuery().in(this);
|
||||
this.list.forEach((_, index) => {
|
||||
query.select(`#tab-item-${index}`).fields({
|
||||
size: true,
|
||||
rect: true
|
||||
});
|
||||
});
|
||||
query.exec((data) => {
|
||||
if (data) {
|
||||
this.tabItemRectInfo = data;
|
||||
this.scrollToActiveTab();
|
||||
}
|
||||
});
|
||||
},
|
||||
scrollToActiveTab() {
|
||||
const tabInfo = this.tabItemRectInfo[this.currentIndex];
|
||||
if (!tabInfo) return;
|
||||
const tabWidth = tabInfo.width;
|
||||
const offsetLeft = tabInfo.left - this.parentLeft;
|
||||
let scrollLeft = offsetLeft - (this.componentWidth - tabWidth) / 2;
|
||||
this.scrollLeft = Math.max(0, scrollLeft);
|
||||
const left = tabInfo.left + tabWidth / 2 - this.parentLeft;
|
||||
this.scrollBarLeft = left - this.barWidth / 2;
|
||||
if (this.barFirstTimeMove) {
|
||||
setTimeout(() => {
|
||||
this.barFirstTimeMove = false;
|
||||
}, 100);
|
||||
}
|
||||
},
|
||||
handleTabClick(item, index) {
|
||||
if (index === this.currentIndex) return;
|
||||
this.currentIndex = index;
|
||||
this.$emit('tabItemClick', item, index);
|
||||
this.scrollToActiveTab();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.tab {
|
||||
position: sticky;
|
||||
top: 88rpx;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
z-index: 9;
|
||||
}
|
||||
.tab {
|
||||
position: sticky;
|
||||
top: 88rpx;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
z-index: 9;
|
||||
}
|
||||
|
||||
scroll-view {
|
||||
box-sizing: border-box;
|
||||
height: 100%;
|
||||
}
|
||||
.scroll {
|
||||
box-sizing: border-box;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
white-space: nowrap;
|
||||
width: 100%;
|
||||
|
||||
::v-deep ::-webkit-scrollbar {
|
||||
display: none
|
||||
}
|
||||
.list {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* #ifndef APP-NVUE */
|
||||
::-webkit-scrollbar,
|
||||
::-webkit-scrollbar,
|
||||
::-webkit-scrollbar {
|
||||
display: none;
|
||||
width: 0 !important;
|
||||
height: 0 !important;
|
||||
-webkit-appearance: none;
|
||||
background: transparent;
|
||||
}
|
||||
.item {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
color: #8C8C8C;
|
||||
|
||||
/* #endif */
|
||||
/* #ifdef H5 */
|
||||
// 通过样式穿透,隐藏H5下,scroll-view下的滚动条
|
||||
scroll-view ::v-deep ::-webkit-scrollbar {
|
||||
display: none;
|
||||
width: 0 !important;
|
||||
height: 0 !important;
|
||||
-webkit-appearance: none;
|
||||
background: transparent;
|
||||
}
|
||||
&.active {
|
||||
color: #333;
|
||||
font-weight: bold;
|
||||
transform: scale(1.1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
|
||||
.scroll {
|
||||
position: relative;
|
||||
white-space: nowrap;
|
||||
width: 100%;
|
||||
|
||||
.list {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.item {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
color: #8C8C8C;
|
||||
|
||||
//
|
||||
&.active {
|
||||
color: #333;
|
||||
font-weight: bold;
|
||||
transform: scale(1.1);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 隐藏滚动条
|
||||
::-webkit-scrollbar {
|
||||
display: none;
|
||||
width: 0 !important;
|
||||
height: 0 !important;
|
||||
-webkit-appearance: none;
|
||||
background: transparent;
|
||||
}
|
||||
</style>
|
|
@ -505,7 +505,8 @@
|
|||
"path": "pages/shop/commodity/evaluate",
|
||||
"style": {
|
||||
"navigationBarTitleText": "商品评价",
|
||||
"navigationBarBackgroundColor": "#fff"
|
||||
"navigationBarBackgroundColor": "#fff",
|
||||
"enablePullDownRefresh": true
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -277,6 +277,7 @@
|
|||
// 获取首页分页视频
|
||||
api.video.homeVideo({
|
||||
query: {
|
||||
userId: userinfo.value.id || 0,
|
||||
pageNum: recList.pageNum,
|
||||
pageSize: recList.pageSize,
|
||||
}
|
||||
|
|
|
@ -192,7 +192,7 @@
|
|||
|
||||
<view class="rows mtb30 ptb20 plr30 cfff f34 b000 br10">
|
||||
<text>商家明细</text>
|
||||
<uni-icons type="right" color="" />
|
||||
<uni-icons type="right" c1olor="" />
|
||||
</view>
|
||||
|
||||
<view class="rows mtb30 ptb20 plr30 cfff f34 b000 br10" @click="$refs.get.open()">
|
||||
|
|
|
@ -112,23 +112,23 @@
|
|||
</view>
|
||||
|
||||
<view class="main ptb20 f24">
|
||||
<view class="item ver">
|
||||
<view class="item ver" @click="link('/pages/shop/order/index?tabIndex=1')">
|
||||
<image src="/static/mine-daifukuan.png" mode="aspectFit" class="wh50" />
|
||||
<text class="txt mt10 wsn">待付款</text>
|
||||
</view>
|
||||
<view class="item ver">
|
||||
<view class="item ver" @click="link('/pages/shop/order/index?tabIndex=2')">
|
||||
<image src="/static/mine-daifahuo.png" mode="aspectFit" class="wh50" />
|
||||
<text class="txt mt10 wsn">待发货</text>
|
||||
</view>
|
||||
<view class="item ver">
|
||||
<view class="item ver" @click="link('/pages/shop/order/index?tabIndex=3')">
|
||||
<image src="/static/mine-daishouhuo.png" mode="aspectFit" class="wh50" />
|
||||
<text class="txt mt10 wsn">待收货</text>
|
||||
</view>
|
||||
<view class="item ver">
|
||||
<view class="item ver" @click="link('/pages/shop/order/index?tabIndex=6')">
|
||||
<image src="/static/mine-daipingjia.png" mode="aspectFit" class="wh50" />
|
||||
<text class="txt mt10 wsn">评价</text>
|
||||
</view>
|
||||
<view class="item ver">
|
||||
<view class="item ver" @click="link('/pages/shop/order/index?tabIndex=6')">
|
||||
<image src="/static/mine-tuikuan_shouhou.png" mode="aspectFit" class="wh50" />
|
||||
<text class="txt mt10 wsn">退款/售后</text>
|
||||
</view>
|
||||
|
@ -171,7 +171,7 @@
|
|||
</view>
|
||||
</template>
|
||||
<template v-else-if="userinfo.isShop == 1">
|
||||
<view class="item ver" @click="link('/pages/shop/settle')" >
|
||||
<view class="item ver" @click="link('/pages/shop/settle')">
|
||||
<image src="/static/mine-ruzhushangjia.png" mode="aspectFit" class="wh50" />
|
||||
<text class="txt mt10 wsn">店铺管理</text>
|
||||
</view>
|
||||
|
|
|
@ -43,11 +43,11 @@
|
|||
name: '即时消息',
|
||||
load: false,
|
||||
},
|
||||
{
|
||||
key: 'video',
|
||||
name: '视讯消息',
|
||||
load: false,
|
||||
},
|
||||
// {
|
||||
// key: 'video',
|
||||
// name: '视讯消息',
|
||||
// load: false,
|
||||
// },
|
||||
// {
|
||||
// key: 'video',
|
||||
// name: '商城消息',
|
||||
|
|
|
@ -18,21 +18,37 @@
|
|||
const more_share_data = ref([])
|
||||
// 分享弹窗
|
||||
const more_share = {
|
||||
more: [{
|
||||
icon: '/static/news.png',
|
||||
title: '信息'
|
||||
},
|
||||
more: [
|
||||
// {
|
||||
// icon: '/static/news.png',
|
||||
// title: '信息'
|
||||
// },
|
||||
{
|
||||
icon: '/static/home.png',
|
||||
title: '回到首页'
|
||||
title: '回到首页',
|
||||
event: () => {
|
||||
uni.switchTab({
|
||||
url: '/pages/shop/shop'
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
icon: '/static/individual.png',
|
||||
title: '个人中心'
|
||||
title: '个人中心',
|
||||
event: () => {
|
||||
uni.switchTab({
|
||||
url: '/pages/mine/mine'
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
icon: '/static/order.png',
|
||||
title: '我的订单'
|
||||
title: '我的订单',
|
||||
event: () => {
|
||||
uni.redirectTo({
|
||||
url: '/pages/shop/order/index'
|
||||
})
|
||||
}
|
||||
}
|
||||
],
|
||||
share: [{
|
||||
|
@ -52,6 +68,14 @@
|
|||
share_more.value.open()
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表项事件
|
||||
* @param {Object} item
|
||||
*/
|
||||
function handleItem(item) {
|
||||
if (item.event) item.event()
|
||||
}
|
||||
|
||||
// 返回
|
||||
function goBack(url) {
|
||||
// 获取当前页面栈
|
||||
|
@ -83,11 +107,13 @@
|
|||
<view class="side">
|
||||
<image @click="goBack('/pages/shop/shop')" class="back wh55" src="/static/back.png" />
|
||||
</view>
|
||||
|
||||
<view class="main f1 tac">
|
||||
<text>销量: {{detail.sales}}</text>
|
||||
</view>
|
||||
|
||||
<view class="side df fdr jcr">
|
||||
<image @click="open('share')" class="share wh55" src="/static/share1.png" />
|
||||
<!-- <image @click="open('share')" class="share wh55" src="/static/share1.png" /> -->
|
||||
<image @click="open('more')" class="more wh55 ml20" src="/static/more.png" />
|
||||
</view>
|
||||
</view>
|
||||
|
@ -97,8 +123,7 @@
|
|||
<uni-popup ref="share_more" type="bottom">
|
||||
<view class="menuAlt popBot">
|
||||
<view class="main df ptb40">
|
||||
<view class="item ver" v-for="(item, index) in more_share_data" :key="index"
|
||||
@click="handle_share(item)">
|
||||
<view class="item ver" v-for="(item, index) in more_share_data" :key="index" @click="handleItem(item)">
|
||||
<image class="wh100" :src="item.icon" />
|
||||
<view class="title mt10">
|
||||
<text class="txt c666 f8">{{ item.title }}</text>
|
||||
|
|
|
@ -9,85 +9,107 @@
|
|||
import {
|
||||
onLoad,
|
||||
onReady,
|
||||
onPageScroll,
|
||||
onPullDownRefresh,
|
||||
onReachBottom
|
||||
} from '@dcloudio/uni-app'
|
||||
import {
|
||||
useStore
|
||||
} from 'vuex'
|
||||
//
|
||||
import util from '@/common/js/util.js'
|
||||
// 接口地址
|
||||
import api from '@/api/index.js'
|
||||
const {
|
||||
proxy
|
||||
} = getCurrentInstance()
|
||||
const {
|
||||
userinfo
|
||||
} = useStore().state
|
||||
//
|
||||
const typeList = ref([{
|
||||
text: '全部',
|
||||
icon: null,
|
||||
value: 1
|
||||
param: {},
|
||||
}, {
|
||||
text: '最新',
|
||||
icon: '/static/picture.png',
|
||||
value: 2
|
||||
param: {
|
||||
isNew: 1,
|
||||
},
|
||||
}, {
|
||||
text: '图/视频',
|
||||
icon: '/static/time.png',
|
||||
value: 3
|
||||
text: '有图',
|
||||
param: {
|
||||
isImage: 1,
|
||||
},
|
||||
}])
|
||||
// 当前选中
|
||||
const typeIndex = ref(0)
|
||||
// id
|
||||
const id = ref('')
|
||||
// 评论列表
|
||||
const comment = reactive({
|
||||
pageNum: 1,
|
||||
pageSize: 5,
|
||||
list: [],
|
||||
})
|
||||
|
||||
//
|
||||
const list = reactive([{
|
||||
id: 0,
|
||||
userId: 1,
|
||||
ks: 123,
|
||||
isLike: 1,
|
||||
userName: '明月天涯',
|
||||
portrait: 'https://mp-bcaa355d-ec14-4cb2-a10e-482127e7cb48.cdn.bspapp.com/VKCEYUGU-bcaa355d-ec14-4cb2-a10e-482127e7cb48/00412594-656b-4379-a49e-0b381d5f6652.jpg',
|
||||
time: '2023年10月30日 14:20',
|
||||
content: '明月天涯明月天涯明月天涯明月天涯明月天涯明月天涯明月天涯',
|
||||
imageList: [
|
||||
'https://mp-bcaa355d-ec14-4cb2-a10e-482127e7cb48.cdn.bspapp.com/VKCEYUGU-bcaa355d-ec14-4cb2-a10e-482127e7cb48/00412594-656b-4379-a49e-0b381d5f6652.jpg',
|
||||
'https://mp-bcaa355d-ec14-4cb2-a10e-482127e7cb48.cdn.bspapp.com/VKCEYUGU-bcaa355d-ec14-4cb2-a10e-482127e7cb48/00412594-656b-4379-a49e-0b381d5f6652.jpg',
|
||||
'https://mp-bcaa355d-ec14-4cb2-a10e-482127e7cb48.cdn.bspapp.com/VKCEYUGU-bcaa355d-ec14-4cb2-a10e-482127e7cb48/00412594-656b-4379-a49e-0b381d5f6652.jpg',
|
||||
'https://mp-bcaa355d-ec14-4cb2-a10e-482127e7cb48.cdn.bspapp.com/VKCEYUGU-bcaa355d-ec14-4cb2-a10e-482127e7cb48/00412594-656b-4379-a49e-0b381d5f6652.jpg',
|
||||
'https://mp-bcaa355d-ec14-4cb2-a10e-482127e7cb48.cdn.bspapp.com/VKCEYUGU-bcaa355d-ec14-4cb2-a10e-482127e7cb48/00412594-656b-4379-a49e-0b381d5f6652.jpg',
|
||||
'https://mp-bcaa355d-ec14-4cb2-a10e-482127e7cb48.cdn.bspapp.com/VKCEYUGU-bcaa355d-ec14-4cb2-a10e-482127e7cb48/00412594-656b-4379-a49e-0b381d5f6652.jpg',
|
||||
'https://mp-bcaa355d-ec14-4cb2-a10e-482127e7cb48.cdn.bspapp.com/VKCEYUGU-bcaa355d-ec14-4cb2-a10e-482127e7cb48/00412594-656b-4379-a49e-0b381d5f6652.jpg',
|
||||
'https://mp-bcaa355d-ec14-4cb2-a10e-482127e7cb48.cdn.bspapp.com/VKCEYUGU-bcaa355d-ec14-4cb2-a10e-482127e7cb48/00412594-656b-4379-a49e-0b381d5f6652.jpg',
|
||||
'https://mp-bcaa355d-ec14-4cb2-a10e-482127e7cb48.cdn.bspapp.com/VKCEYUGU-bcaa355d-ec14-4cb2-a10e-482127e7cb48/00412594-656b-4379-a49e-0b381d5f6652.jpg'
|
||||
],
|
||||
child: [{
|
||||
nickname: '用户a',
|
||||
content: '这款产品怎么样?',
|
||||
}, {
|
||||
nickname: '用户b',
|
||||
content: '这款产品怎么样?',
|
||||
}, ],
|
||||
}, {
|
||||
id: 0,
|
||||
userId: 1,
|
||||
isLike: 0,
|
||||
ks: 123,
|
||||
userName: '明月天涯',
|
||||
portrait: 'https://mp-bcaa355d-ec14-4cb2-a10e-482127e7cb48.cdn.bspapp.com/VKCEYUGU-bcaa355d-ec14-4cb2-a10e-482127e7cb48/00412594-656b-4379-a49e-0b381d5f6652.jpg',
|
||||
time: '2023年10月30日 14:20',
|
||||
content: '明月天涯明月天涯明月天涯明月天涯明月天涯明月天涯明月天涯',
|
||||
imageList: [
|
||||
'https://mp-bcaa355d-ec14-4cb2-a10e-482127e7cb48.cdn.bspapp.com/VKCEYUGU-bcaa355d-ec14-4cb2-a10e-482127e7cb48/00412594-656b-4379-a49e-0b381d5f6652.jpg',
|
||||
'https://mp-bcaa355d-ec14-4cb2-a10e-482127e7cb48.cdn.bspapp.com/VKCEYUGU-bcaa355d-ec14-4cb2-a10e-482127e7cb48/00412594-656b-4379-a49e-0b381d5f6652.jpg',
|
||||
'https://mp-bcaa355d-ec14-4cb2-a10e-482127e7cb48.cdn.bspapp.com/VKCEYUGU-bcaa355d-ec14-4cb2-a10e-482127e7cb48/00412594-656b-4379-a49e-0b381d5f6652.jpg',
|
||||
'https://mp-bcaa355d-ec14-4cb2-a10e-482127e7cb48.cdn.bspapp.com/VKCEYUGU-bcaa355d-ec14-4cb2-a10e-482127e7cb48/00412594-656b-4379-a49e-0b381d5f6652.jpg',
|
||||
'https://mp-bcaa355d-ec14-4cb2-a10e-482127e7cb48.cdn.bspapp.com/VKCEYUGU-bcaa355d-ec14-4cb2-a10e-482127e7cb48/00412594-656b-4379-a49e-0b381d5f6652.jpg',
|
||||
'https://mp-bcaa355d-ec14-4cb2-a10e-482127e7cb48.cdn.bspapp.com/VKCEYUGU-bcaa355d-ec14-4cb2-a10e-482127e7cb48/00412594-656b-4379-a49e-0b381d5f6652.jpg',
|
||||
'https://mp-bcaa355d-ec14-4cb2-a10e-482127e7cb48.cdn.bspapp.com/VKCEYUGU-bcaa355d-ec14-4cb2-a10e-482127e7cb48/00412594-656b-4379-a49e-0b381d5f6652.jpg',
|
||||
'https://mp-bcaa355d-ec14-4cb2-a10e-482127e7cb48.cdn.bspapp.com/VKCEYUGU-bcaa355d-ec14-4cb2-a10e-482127e7cb48/00412594-656b-4379-a49e-0b381d5f6652.jpg',
|
||||
'https://mp-bcaa355d-ec14-4cb2-a10e-482127e7cb48.cdn.bspapp.com/VKCEYUGU-bcaa355d-ec14-4cb2-a10e-482127e7cb48/00412594-656b-4379-a49e-0b381d5f6652.jpg'
|
||||
],
|
||||
child: [],
|
||||
}])
|
||||
onLoad((option) => {
|
||||
if (option.id) id.value = option.id
|
||||
|
||||
// 获取商品评论
|
||||
getProComment()
|
||||
})
|
||||
|
||||
onPullDownRefresh(() => {
|
||||
refreshList()
|
||||
})
|
||||
|
||||
onReachBottom(() => {
|
||||
getMoreList()
|
||||
})
|
||||
|
||||
// 重载
|
||||
function refreshList() {
|
||||
comment.pageNum = 1
|
||||
getProComment()
|
||||
}
|
||||
|
||||
// 获取更多
|
||||
function getMoreList() {
|
||||
if (comment.total <= comment.list.length) return
|
||||
comment.pageNum++
|
||||
getProComment()
|
||||
}
|
||||
|
||||
// 获取商品评论
|
||||
function getProComment() {
|
||||
api.shop.getProComment({
|
||||
query: {
|
||||
// 产品id
|
||||
productId: id.value,
|
||||
pageNum: comment.pageNum,
|
||||
pageSize: comment.pageSize,
|
||||
...typeList.value[typeIndex.value].param,
|
||||
}
|
||||
}).then(rs => {
|
||||
if (rs.code == 200) {
|
||||
// 页码
|
||||
if (comment.pageNum == 1) comment.list.length = 0
|
||||
// 列表
|
||||
comment.list.push(...rs.rows.map(item => {
|
||||
if(item.imageUrls) item.imageUrls = item.imageUrls.split(',')
|
||||
return item
|
||||
}))
|
||||
// 总数
|
||||
comment.total = rs.total
|
||||
return
|
||||
}
|
||||
util.alert({
|
||||
content: rs.msg,
|
||||
showCancel: false,
|
||||
})
|
||||
}).finally(() => {
|
||||
uni.stopPullDownRefresh()
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前评论状态
|
||||
|
@ -96,6 +118,8 @@
|
|||
function handleTypeIndex(index) {
|
||||
if (typeIndex.value === index) return
|
||||
typeIndex.value = index
|
||||
// 重载列表
|
||||
refreshList()
|
||||
}
|
||||
|
||||
// 打开弹窗
|
||||
|
@ -123,36 +147,36 @@
|
|||
</view>
|
||||
|
||||
<view class="listBox f28">
|
||||
<view class="nomore" v-if="!list[0]">暂无评论~</view>
|
||||
<view class="nomore mtb30" v-if="!comment.list[0]">暂无评论~</view>
|
||||
|
||||
<view class="list df fdc" v-for="(item, index) in list" :key="index">
|
||||
<view class="list df fdc mlr30" v-for="(item, index) in comment.list" :key="index">
|
||||
<!-- 评论的用户 -->
|
||||
<view class="userinfo rows mtb20 mlr20">
|
||||
<image class="wh80 cir" :src="item.portrait" mode="aspectFill" />
|
||||
<view class="name f1 mlr20 c333 f34">{{ item.userName }}</view>
|
||||
<uni-icons type="more-filled" color="#999" />
|
||||
<view class="userinfo rows mtb20 ">
|
||||
<image class="wh80 cir" :src="item.avatar" mode="aspectFill" />
|
||||
<view class="name f1 mlr20 c333 f34">{{ item.nickname }}</view>
|
||||
<!-- <uni-icons type="more-filled" color="#999" /> -->
|
||||
</view>
|
||||
|
||||
<view class="content ml40 plr20 bfff br20">
|
||||
<view class="content ml30 plr20 bfff br20">
|
||||
<!-- 款式日期 -->
|
||||
<view class="rows mtb20 c999">
|
||||
<view class="">款式:{{ item.ks }}</view>
|
||||
<view class="">{{ item.time }}</view>
|
||||
<view class="">款式:{{ item.sku }}</view>
|
||||
<view class="">{{ item.commentTime }}</view>
|
||||
</view>
|
||||
|
||||
<!-- 评论内容 -->
|
||||
<view class="content mtb20 f30">{{item.content}}</view>
|
||||
|
||||
<!-- 图片 -->
|
||||
<view class="images mtb20" v-if="item.imageList[0]">
|
||||
<view class="item pr" @click="preview(item.imageList,index)"
|
||||
v-for="(image, index) in item.imageList" :key="index">
|
||||
<view class="images mtb20" v-if="item.imageUrls">
|
||||
<view class="item pr" @click="preview(item.imageUrls,secIndex)"
|
||||
v-for="(image, secIndex) in item.imageUrls" :key="secIndex">
|
||||
<image class="img pa br10" :src="image" mode="aspectFill" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 菜单 -->
|
||||
<view class="fn df jcr aic mtb20 c999">
|
||||
<view class="fn df jcr aic mtb20 c999" v-if="0">
|
||||
<!-- 点赞 -->
|
||||
<view class="ec-item df aic mr20">
|
||||
<uni-icons type="hand-up-filled" color="#FF0000" v-if="item.isLike == 1" />
|
||||
|
@ -177,7 +201,7 @@
|
|||
</view>
|
||||
</view>
|
||||
|
||||
<view class="nomore mtb30">暂无更多评论~</view>
|
||||
<view class="nomore mtb30" v-if="comment.list[0]">暂无更多评论~</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<script setup>
|
||||
// 商品详情
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
|
@ -40,6 +41,8 @@
|
|||
list: [],
|
||||
total: 0,
|
||||
})
|
||||
// 最近购买订单列表
|
||||
const recentOrderList = ref([])
|
||||
// 详情
|
||||
const banner = computed(() => {
|
||||
let result = []
|
||||
|
@ -57,10 +60,12 @@
|
|||
getDetail()
|
||||
// 添加商品浏览记录
|
||||
addBrowsing()
|
||||
// 开启监听
|
||||
addListener()
|
||||
// 获取商品评论
|
||||
getProComment()
|
||||
// 获取最近购买
|
||||
getRecentOrder()
|
||||
// 开启监听
|
||||
addListener()
|
||||
})
|
||||
|
||||
onReady(() => {
|
||||
|
@ -91,12 +96,39 @@
|
|||
uni.$off('commodityDetail')
|
||||
}
|
||||
|
||||
// 获取最近购买
|
||||
function getRecentOrder() {
|
||||
api.shop.recentOrder({
|
||||
query: {
|
||||
// 产品id
|
||||
productId: id.value,
|
||||
}
|
||||
}).then(rs => {
|
||||
if (rs.code == 200) {
|
||||
// 结果
|
||||
const result = rs.data
|
||||
let list = []
|
||||
//
|
||||
for (let i = 0; i < result.length / 2; i++) {
|
||||
if (!result[i * 2 + 1]) break
|
||||
list.push([result[i * 2], result[i * 2 + 1]])
|
||||
}
|
||||
recentOrderList.value = list
|
||||
return
|
||||
}
|
||||
util.alert({
|
||||
content: rs.msg,
|
||||
showCancel: false,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// 获取商品评论
|
||||
function getProComment() {
|
||||
api.shop.getProComment({
|
||||
query: {
|
||||
// 产品id
|
||||
productionId: id.value,
|
||||
productId: id.value,
|
||||
pageNum: 1,
|
||||
pageSize: 2,
|
||||
}
|
||||
|
@ -301,7 +333,7 @@
|
|||
<!-- 商品名称 -->
|
||||
<view class="name mtb20 f34 c333 t2hd">{{detail.name}}</view>
|
||||
|
||||
<view class="history mtb20 rows">
|
||||
<view class="history mtb20 rows" v-if="0">
|
||||
<view class="c666 f28">商品修改历史</view>
|
||||
<uni-icons type="right" />
|
||||
</view>
|
||||
|
@ -327,21 +359,19 @@
|
|||
</view>
|
||||
|
||||
<!-- 最近购买 -->
|
||||
<view class="recently mtb20">
|
||||
<view class="recently mtb20" v-if="recentOrderList[0]">
|
||||
<swiper class="swiper" :autoplay="true" vertical="true">
|
||||
<swiper-item v-for="(item, index) in 2" :key="index">
|
||||
<swiper-item v-for="(item, index) in recentOrderList" :key="index">
|
||||
<view class="list plr10 bfff">
|
||||
<view class="item bsb rows plr10" v-for="(item, index) in 2" :key="index">
|
||||
<view class="item bsb rows plr10" v-for="(secItem, secIndex) in item" :key="secIndex">
|
||||
<view class="avatar">
|
||||
<image class="avatar wh70 cir"
|
||||
src="https://img30.360buyimg.com/popWareDetail/jfs/t1/124291/22/31317/138753/6449f30dF90683c84/4fee5d1a337f7b90.jpg.avif"
|
||||
mode="aspectFill" />
|
||||
<image class="avatar wh70 cir" :src="secItem.avatar" mode="aspectFill" />
|
||||
</view>
|
||||
|
||||
<view class="name f1 mlr10 f28">用户xxx</view>
|
||||
<view class="name f1 mlr10 f28">{{secItem.nickname}}</view>
|
||||
<view class="info mlr10 f26 tar">
|
||||
<view class="fn">刚刚下单</view>
|
||||
<view class="time c999">2014.12.08 18:00</view>
|
||||
<!-- <view class="fn">刚刚下单</view> -->
|
||||
<view class="time c999">{{secItem.time}}</view>
|
||||
</view>
|
||||
<view class="btn sm warm plr15">立即购买</view>
|
||||
</view>
|
||||
|
@ -352,21 +382,20 @@
|
|||
|
||||
<!-- 商品评价 -->
|
||||
<view class="evaluate mtb20 plr25 bfff">
|
||||
<view class="header rows ptb25" @click="link(util.setUrl('/pages/shop/commodity/evaluate',{id: 1}))">
|
||||
<text class="modelTitle">商品评价(3)</text>
|
||||
<view class="header rows ptb25"
|
||||
@click="link(util.setUrl('/pages/shop/commodity/evaluate',{id: detail.id}))">
|
||||
<text class="modelTitle">商品评价({{comment.total}})</text>
|
||||
<uni-icons type="right" />
|
||||
</view>
|
||||
|
||||
<!-- 部分评论 -->
|
||||
<view class="list">
|
||||
<view class="item ptb20" v-for="(item, index) in comment" :key="index">
|
||||
<view class="item ptb20" v-for="(item, index) in comment.list" :key="index">
|
||||
<view class="userinfo df c666 f28">
|
||||
<image class="avatar wh45 cir"
|
||||
src="https://img30.360buyimg.com/popWareDetail/jfs/t1/124291/22/31317/138753/6449f30dF90683c84/4fee5d1a337f7b90.jpg.avif"
|
||||
mode="aspectFill" />
|
||||
<view class="name thd f32 f1 ml20">用户xxx</view>
|
||||
<image class="avatar wh45 cir" :src="item.avatar" mode="aspectFill" />
|
||||
<view class="name thd f32 f1 ml20">{{item.nickname}}</view>
|
||||
</view>
|
||||
<view class="content t2hd mt10 c333 f28">这个商品不错</view>
|
||||
<view class="content t2hd mt10 c333 f28">{{item.content}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
|
@ -3,14 +3,15 @@
|
|||
import {
|
||||
ref,
|
||||
reactive,
|
||||
getCurrentInstance
|
||||
getCurrentInstance,
|
||||
watch,
|
||||
} from 'vue'
|
||||
import {
|
||||
onLoad,
|
||||
onUnload,
|
||||
onReachBottom,
|
||||
onPullDownRefresh,
|
||||
onPageScroll
|
||||
onPageScroll,
|
||||
} from '@dcloudio/uni-app';
|
||||
// 工具库
|
||||
import util from '@/common/js/util';
|
||||
|
@ -60,6 +61,8 @@
|
|||
name: '已取消'
|
||||
}
|
||||
])
|
||||
// 当前tab下标
|
||||
const tabIndex = ref(0)
|
||||
// 列表
|
||||
const list = reactive({
|
||||
status: '',
|
||||
|
@ -74,8 +77,8 @@
|
|||
// 当前操作的订单
|
||||
const orderDetail = reactive({})
|
||||
|
||||
onLoad((options) => {
|
||||
// this.params.currentTab = options.currentTab / 1
|
||||
onLoad((option) => {
|
||||
if (option.tabIndex) tabIndex.value = Number(option.tabIndex)
|
||||
// 获取订单列表
|
||||
getList()
|
||||
// 开启监听
|
||||
|
@ -265,7 +268,7 @@
|
|||
|
||||
<!-- tab选项卡 -->
|
||||
<view class="f1 pr">
|
||||
<JyShopNavigation :list="tabs" @tabItemClick="itemClick" />
|
||||
<JyShopNavigation v-model="tabIndex" :list="tabs" @tabItemClick="itemClick" />
|
||||
</view>
|
||||
|
||||
<!-- 订单列表 -->
|
||||
|
|
|
@ -117,7 +117,7 @@
|
|||
</swiper>
|
||||
|
||||
<!-- 公告 -->
|
||||
<swiper class="notice mtb30 mlr30 c333 f28 br20" vertical="true">
|
||||
<swiper class="notice mtb30 mlr30 c333 f28 br20" vertical="true" v-if="0">
|
||||
<swiper-item class="item bsb rows plr20" v-for="(item, index) in 2" :key="index">
|
||||
<image class="wh30" src="/static/notice.png" mode="aspectFit" />
|
||||
<view class="f1 mlr20">九亿商城上线啦~</view>
|
||||
|
@ -127,8 +127,8 @@
|
|||
|
||||
<!-- 功能区 -->
|
||||
<view class="fn rows mtb30 mlr30">
|
||||
<uni-icons type="scan" size="48rpx" color="#FF7F37" />
|
||||
<view class="searchBox rows f1 ml20 ptb10 plr20 bar">
|
||||
<!-- <uni-icons type="scan" class="mr20" size="48rpx" color="#FF7F37" /> -->
|
||||
<view class="searchBox rows f1 ptb10 plr20 bar">
|
||||
<input type="text" v-model="keyword" class="f1" placeholder="请输入关键字" @blur="handleSearch" />
|
||||
<uni-icons type="search" size="30rpx" color="#999" />
|
||||
</view>
|
||||
|
|
|
@ -4,8 +4,8 @@ import {
|
|||
import uni from '@dcloudio/vite-plugin-uni';
|
||||
|
||||
let target = 'http://91f.xyz:8080'
|
||||
// let target = 'http://22vn9z.natappfree.cc'
|
||||
// let target = 'https://63fdb472.r24.cpolar.top'
|
||||
// let target = 'http://nrpnpc.natappfree.cc'
|
||||
// let target = 'http://6aa4a4c3.r24.cpolar.top'
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [uni()],
|
||||
|
|
Loading…
Reference in New Issue