index.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <template>
  2. <u-popup :show="show" :round="36" mode="bottom" @close="close">
  3. <view class="bind_device">
  4. <div class="top adfacjb">
  5. <div class="pre adffcacjc" @tap="scanBind">
  6. <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/06/03/7d603c9a-6b47-40b3-9a49-46638ed677ee.png"></image>
  7. <text>扫码绑定设备</text>
  8. </div>
  9. <div class="pre adffcacjc" @tap="wifiBind">
  10. <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/06/03/58afeb20-9bea-46e3-b31c-7be2b9b7014d.png"></image>
  11. <text>配网并绑定设备</text>
  12. </div>
  13. </div>
  14. <div class="close">
  15. <u-icon name="close" color="#5C5C5C" size="50" @tap="close"></u-icon>
  16. </div>
  17. </view>
  18. </u-popup>
  19. </template>
  20. <script>
  21. export default {
  22. data(){
  23. return {
  24. show:false
  25. }
  26. },
  27. methods:{
  28. close(){
  29. this.show = false;
  30. },
  31. scanBind(){
  32. this.show = false;
  33. let that = this;
  34. uni.scanCode({
  35. success: (res) => {
  36. let result = JSON.parse(res.result);
  37. if(res.errMsg==='scanCode:ok'){
  38. uni.navigateTo({
  39. url:'/pagesMy/scanResult?scanParams='+JSON.stringify(result)
  40. })
  41. // that.$api.post('/device/bind',{
  42. // ...result,
  43. // "type": "",
  44. // "userId": 0,
  45. // "agentId": ""
  46. // }).then(res=>{
  47. // if(res.data.code!==0) return that.$showToast(res.data.msg)
  48. // uni.navigateTo({
  49. // url:'/pagesMy/scanResult?deviceId='+res.data.data
  50. // })
  51. // })
  52. }
  53. }
  54. })
  55. },
  56. wifiBind(){
  57. this.show = false;
  58. uni.navigateTo({
  59. url:'/pagesMy/deviceAdd'
  60. })
  61. },
  62. }
  63. }
  64. </script>
  65. <style scoped lang="less">
  66. .bind_device{
  67. width: 100%;
  68. padding: 74rpx 74rpx 20rpx;
  69. box-sizing: border-box;
  70. .top{
  71. .pre{
  72. width: calc(50% - 51rpx);
  73. image{
  74. width: 110rpx;
  75. height: 110rpx;
  76. }
  77. text{
  78. font-family: PingFangSC, PingFang SC;
  79. font-weight: 400;
  80. font-size: 28rpx;
  81. color: #111111;
  82. line-height: 32rpx;
  83. text-align: center;
  84. margin-top: 24rpx;
  85. }
  86. }
  87. }
  88. .close{
  89. width: 100%;
  90. margin-top: 113rpx;
  91. display: flex;
  92. align-items: center;
  93. justify-content: center;
  94. }
  95. }
  96. </style>