openyed.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <view>
  3. <ujp-navbar :title="title" :is-back="false" ></ujp-navbar>
  4. <div class="openMain">
  5. <div class="open1" v-if="asynCallBackBl" >
  6. <img src="@/assets/img/9-4/身份认证通过.svg">
  7. </div>
  8. <div class="open1" v-else >
  9. <img src="@/assets/img/9-4/未身份认证.svg">
  10. </div>
  11. <div class="open2" v-if="!asynCallBackIng">
  12. 加载中,请稍后...
  13. </div>
  14. <div class="open2" v-else-if="asynCallBackIng&&asynCallBackBl">
  15. 身份已核实,请开门进入
  16. </div>
  17. <div class="open2" v-show="asynCallBackIng&&!asynCallBackBl">
  18. 您的身份暂无开门权限
  19. </div>
  20. <div class="open3" v-show="asynCallBackIng&&!asynCallBackBl">
  21. <span>此房间仅限{{projectName}}车主和小鹏管家用户使用</span>
  22. </div>
  23. <div class="open4" v-show="asynCallBackIng&&asynCallBackBl">
  24. <button @click="asynCallBack()">
  25. <img src="@/assets/img/9-4/riLine-lock-unlock-line.svg">
  26. 重新解锁
  27. </button>
  28. </div>
  29. <div class="open4" v-show="asynCallBackIng&&!asynCallBackBl">
  30. <button @click="thispush()">
  31. 前往注册
  32. </button>
  33. </div>
  34. </div>
  35. </view>
  36. </template>
  37. <script>
  38. import * as loginApi from '@/apis/login.js'
  39. import * as API from '@/apis/xpgj.js'
  40. export default {
  41. data() {
  42. return {
  43. title: '扫码开门',
  44. asynCallBackIng:false,
  45. asynCallBackBl:false,
  46. imei:'861658065434626',
  47. isLoading: false,
  48. openId:"",
  49. }
  50. },
  51. onLoad(op){
  52. if (op.imei) {
  53. this.imei=op.imei;
  54. }
  55. this.getUserInfo()
  56. },
  57. methods: {
  58. thispush(){
  59. uni.navigateTo({
  60. url: '/pages/login/login?imei='+this.imei
  61. })
  62. },
  63. getUserInfo() {
  64. this.openId= this.carhelp.getOpenId()
  65. uni.showLoading({
  66. title: "加载中",
  67. mask: true,
  68. })
  69. loginApi.findByOpenId({
  70. openId: this.carhelp.getOpenId(),
  71. noerror: true,
  72. }).then((res) => {
  73. uni.hideLoading();
  74. console.log(res)
  75. if(res.result&&res.data.regUser.userType==2){
  76. this.asynCallBack()
  77. }else{
  78. this.asynCallBack(true)
  79. }
  80. }).catch(error => {
  81. uni.showToast({
  82. title: error,
  83. icon: "none"
  84. })
  85. })
  86. },
  87. asynCallBack(bl) {
  88. this.asynCallBackIng=true;
  89. if (!bl) {
  90. this.asynCallBackBl=true;
  91. API.remoteControl({
  92. openId:this.openId,
  93. source:"xpgj",
  94. imei:this.imei,
  95. state:'1',
  96. channel:'1'
  97. }).then(response => {
  98. uni.showToast({
  99. title:"开门成功"
  100. })
  101. }).catch(error => {
  102. uni.showToast({
  103. title:error
  104. })
  105. })
  106. API.playVoice({
  107. source:"xpgj",
  108. openId:this.openId,
  109. imei:this.imei,
  110. volume:'7',
  111. message:'欢迎光临'
  112. }).then(response => {
  113. }).catch(error => {
  114. uni.showToast({
  115. title:error
  116. })
  117. })
  118. }
  119. },
  120. }
  121. }
  122. </script>
  123. <style scoped>
  124. .openMain{
  125. margin-top: 160px;
  126. text-align: center;
  127. }
  128. .open1>img {
  129. width: 80px;
  130. height: 80px;
  131. }
  132. .open2{
  133. color: rgba(51, 51, 51, 1);
  134. font-size: 24px;
  135. margin-top: 16px;
  136. }
  137. .open3{
  138. color: rgba(102, 102, 102, 1);
  139. font-size: 14px;
  140. margin-top: 4px;
  141. }
  142. .open4{
  143. margin-top: 26px;
  144. }
  145. .open4>button{
  146. font-size: 20px;
  147. height: 48px;
  148. width: 255px;
  149. line-height: 20px;
  150. border-radius: 50px;
  151. background-color: rgba(255, 255, 255, 1);
  152. text-align: center;
  153. border: 1px solid rgba(187, 196, 192, 1);
  154. display: flex;
  155. margin: 0 auto;
  156. align-items: center;
  157. justify-content: center;
  158. }
  159. </style>