index.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. try{
  37. let result = JSON.parse(res.result);
  38. if(res.errMsg==='scanCode:ok'){
  39. uni.navigateTo({
  40. url:'/pagesMy/scanResult?scanParams='+JSON.stringify(result)
  41. })
  42. }
  43. }catch(e){
  44. that.$showModal('扫码失败,请检查设备二维码。')
  45. }
  46. }
  47. })
  48. },
  49. wifiBind(){
  50. this.show = false;
  51. uni.navigateTo({
  52. url:'/pagesMy/deviceAdd'
  53. })
  54. },
  55. }
  56. }
  57. </script>
  58. <style scoped lang="less">
  59. .bind_device{
  60. width: 100%;
  61. padding: 74rpx 74rpx 20rpx;
  62. box-sizing: border-box;
  63. .top{
  64. .pre{
  65. width: calc(50% - 51rpx);
  66. image{
  67. width: 110rpx;
  68. height: 110rpx;
  69. }
  70. text{
  71. font-family: PingFangSC, PingFang SC;
  72. font-weight: 400;
  73. font-size: 28rpx;
  74. color: #111111;
  75. line-height: 32rpx;
  76. text-align: center;
  77. margin-top: 24rpx;
  78. }
  79. }
  80. }
  81. .close{
  82. width: 100%;
  83. margin-top: 113rpx;
  84. display: flex;
  85. align-items: center;
  86. justify-content: center;
  87. }
  88. }
  89. </style>