提交代码

This commit is contained in:
duan
2024-06-07 15:55:12 +08:00
parent 4ab5b59d7f
commit c8633827cc
4 changed files with 22 additions and 17 deletions

View File

@@ -21,8 +21,7 @@ const baseUrlwws = 'ws://cashier.sxczgkj.cn/cashierService'
// const baseUrl = 'http://192.168.2.42:9888/cashierService'// 测试-w // const baseUrl = 'http://192.168.2.42:9888/cashierService'// 测试-w
// const baseUrlwws ='wss://192.168.2.42:9999/netty' // 测试-w // const baseUrlwws ='wss://192.168.2.42:9999/netty' // 测试-w
const baseUrl = 'https://wxcashiertest.sxczgkj.cn/cashierService'// 测试 const baseUrl = 'https://wxcashiertest.sxczgkj.cn/cashierService'// 测试
const baseUrlwws ='wss://wxcashiertest.sxczgkj.cn/cashierService' // 测试 const baseUrlwws ='wss://wxcashiertest.sxczgkj.cn/netty' // 测试
// #endif // #endif
// import VConsole from "./vConsole.js" // import VConsole from "./vConsole.js"

View File

@@ -133,7 +133,7 @@
onLoad(e) { onLoad(e) {
console.log(e) console.log(e,'调试1')
try { try {
this.types = e.types this.types = e.types
} catch (e) { } catch (e) {
@@ -348,7 +348,6 @@
url: '/pages/order_food/order_food' url: '/pages/order_food/order_food'
}); });
} else { } else {
// uni.cache.set('shopUser', res.data.shopUser);
uni.pro.switchTab('index/index') uni.pro.switchTab('index/index')
} }
} }

View File

@@ -230,6 +230,9 @@
}, },
onUnload() { onUnload() {
uni.switchTab({
url: '/pages/order/order'
})
uni.$off('getMessage') uni.$off('getMessage')
this.ispws = false this.ispws = false
}, },
@@ -241,6 +244,8 @@
// 获取用户信息,判断是否设置支付密码 // 获取用户信息,判断是否设置支付密码
this.getuserinfo() this.getuserinfo()
}, },
onShow() { onShow() {
// this.$store.dispatch("set_shopid"); //获取shapid // this.$store.dispatch("set_shopid"); //获取shapid
this.getAount() this.getAount()
@@ -300,20 +305,20 @@
} }
}, },
handlemessage() { handlemessage() {
console.log(this.socketTicket,'detail页面') console.log(this.socketTicket, 'detail页面')
this.socketTicket ? this.socketTicket.Close() : null //调用前先判断是否有socket正在进行 先关闭后链接 this.socketTicket ? this.socketTicket.Close() : null //调用前先判断是否有socket正在进行 先关闭后链接
// this.socketTicket = new webSocketUtils( // this.socketTicket = new webSocketUtils(
// `${uni.conf.baseUrlwws}/websocket/table/${uni.cache.get('tableCode')}/${uni.cache.get('shopUser')}/${uni.cache.get('userInfo').id}`, // `${uni.conf.baseUrlwws}/websocket/table/${uni.cache.get('tableCode')}/${uni.cache.get('shopUser')}/${uni.cache.get('userInfo').id}`,
// 5000) // 5000)
this.socketTicket = new webSocketUtils( this.socketTicket = new webSocketUtils(
`${uni.conf.baseUrlwws}`, `${uni.conf.baseUrlwws}`,
5000, { 5000, {
tableId: uni.cache.get('tableCode'), tableId: uni.cache.get('tableCode'),
shopId: uni.cache.get('shopUser'), shopId: uni.cache.get('shopUser'),
userId: uni.cache.get('userInfo').id, userId: uni.cache.get('userInfo').id,
"type": "connect", "type": "connect",
}) })
}, },
// 数据处理 // 数据处理

View File

@@ -60,7 +60,7 @@
</view> </view>
<view class="shop-item" v-for="(item1,index1) in item.products" :key="item1.id"> <view class="shop-item" v-for="(item1,index1) in item.products" :key="item1.id">
<view class="cover" style="width:180rpx; height: 180rpx;"> <view class="cover" style="width:180rpx; height: 180rpx;">
<c-image :src="`${item1.coverImg}?x-oss-process=image/resize,m_lfit,w_180,h_180`" <c-image :src="`${item1.coverImg}?x-oss-process=image/resize,m_lfit,w_90,h_90`"
width="180" height="180"></c-image> width="180" height="180"></c-image>
</view> </view>
<view class="info " style="display: flex;flex-direction: column;justify-content: center;"> <view class="info " style="display: flex;flex-direction: column;justify-content: center;">
@@ -312,6 +312,7 @@
// } // }
// }); // });
// setTimeout() // setTimeout()
this.handlemessage()
setTimeout(() => { setTimeout(() => {
console.log('调试1') console.log('调试1')
if (uni.cache.get('token') && uni.cache.get('tableCode')) { if (uni.cache.get('token') && uni.cache.get('tableCode')) {
@@ -330,6 +331,7 @@
console.log(time, '时间戳') console.log(time, '时间戳')
uni.cache.set('shopUser', res.data) uni.cache.set('shopUser', res.data)
this.handlemessage() this.handlemessage()
this.productqueryProduct() //list 数据
} else { } else {
setTimeout(() => { setTimeout(() => {
uni.pro.switchTab('index/index') uni.pro.switchTab('index/index')
@@ -429,7 +431,7 @@
} }
}, },
handlemessage() { handlemessage() {
// this.socketTicket ? this.socketTicket.Close() : null //调用前先判断是否有socket正在进行 先关闭后链接 this.socketTicket ? this.socketTicket.Close() : null //调用前先判断是否有socket正在进行 先关闭后链接
// this.socketTicket = new webSocketUtils( // this.socketTicket = new webSocketUtils(
// `${uni.conf.baseUrlwws}/websocket/table?tableId=${uni.cache.get('tableCode')}&shopId=${uni.cache.get('shopUser')}&userId=${uni.cache.get('userInfo').id}`, // `${uni.conf.baseUrlwws}/websocket/table?tableId=${uni.cache.get('tableCode')}&shopId=${uni.cache.get('shopUser')}&userId=${uni.cache.get('userInfo').id}`,
// 5000) // 5000)