<template>
  <view class="content">
    <!-- 搜索 -->
    <search ref="search" :voice="true" @handleSearch="handleSearch" @mic="onShowSearchType(1)" @camera="onShowSearchType(2)"></search>

    <view class="box menu">
      <!-- 头部1级菜单栏 -->
      <view class="tab_list">
        <scroll-view class="scroll-menu" scroll-x="true" style="white-space: nowrap;">
          <view class="tabbar" v-for="(ite,ind) in menuTop" :key="ind" @click="handleToggle(ind)">
            <view :class="[index ==ind?'active':'']">{{ite.name}}</view>
          </view>
        </scroll-view>
      </view>
      <!-- 左侧2菜单栏 -->
      <view class="left">
        <view class="name" v-for="(ite,ind) in menu2" :key="ind" :class="[leftInd==ind?'active':'']"
          @click="handleToggleLeft(ind)">
          {{ite.name}}
        </view>
      </view>

      <!-- 右侧商品 -->
      <view class="right">
        <!-- <view class="right_list">
          <view class="list mt-20">
            <view class="item" v-for="(it,id) in menu3" :key="id" @click="handleDetail(it)">
              <text>{{it.name}}</text>
            </view>
          </view>
        </view> -->
        <food-item :foodList="menu3" @scroll="onScrollBottom" @select="handleDetail"></food-item>
        <view v-if="!menu3.length" class="nolist">
        	<icon class="iconfont icon-wancan"></icon>
        	<text>还没有数据哦！</text>
        </view>
      </view>
    </view>
    <!-- 底部购物车 -->
    <view class="groupbtn">
      <view class="che" @click="isShop =! isShop">
        <text v-if="ActiveList.length">{{ActiveList.length}}</text>
        <!-- <image src="../../static/pan.png"></image> -->
        <icon class="t-icon t-icon-canpan"></icon>
      </view>
      <view class="subbtn" @click="handlesubbtn"> 确定</view>
    </view>
    <!-- 购物车列表 -->
    <view class="wrapper activeList" v-if="isShop">
      <view class="bg" @click='isShop=false'>
        <view class="box" @click.stop>
          <view class="title">共{{ActiveList.length}}条记录</view>
          <view class="list" v-if="ActiveList.length">
            <view class="item" v-for="(ite,ind) in ActiveList" :key="ind">
              <view class="">
                <text class="name">{{ite.name}}</text>
                <text>（{{ite.weight}}{{ite.unit}}）</text>
              </view>
              <icon class="iconfont icon-ashbin" @click="handledelactive(ite)"></icon>
            </view>
          </view>
          <view v-else class="nolist list">
            <icon class="iconfont icon-wancan"></icon>
            <text>还没有记录哦</text>
          </view>
        </view>
      </view>
    </view>
    <!-- 语音拍照 -->
    <!-- <view class="voice-photo-wrap">
      <view class="voice" @click="onShowSearchType(1)">
        <div class="voice-icon"></div>
      </view>
      <view class="photo" @click="onShowSearchType(2)">
        <div class="photo-icon"></div>
      </view>
    </view> -->
    <!-- 称重区 -->
    <view class="wrapper" v-if="IsWeight">
      <view class="bg" @click='IsWeight=false'>
        <view class="box" @click.stop>
          <view class="title">
            <view class="weight" @click="handleWeight()">
              <icon class="iconfont icon-lianjie"></icon>
              食物秤称重
            </view>
            <view class="cancel">
              <icon class="iconfont icon-error" @click="Cancelword()"></icon>
            </view>

          </view>
          <view class="name">{{activeType.name}}</view>
          <view class="val">
            <text>{{activeType.weight?activeType.weight:'0'}}</text>g
          </view>
          <view class="mybrankmask">
            <view class="MymaskAll">
              <view class="MymaskList">
                <view class="maskListItem" @click="NumberCk(1)">1</view>
                <view class="maskListItem" @click="NumberCk(2)">2</view>
                <view class="maskListItem" @click="NumberCk(3)">3</view>
              </view>
              <view class="MymaskList">
                <view class="maskListItem" @click="NumberCk(4)">4</view>
                <view class="maskListItem" @click="NumberCk(5)">5</view>
                <view class="maskListItem" @click="NumberCk(6)">6</view>
              </view>
              <view class="MymaskList">
                <view class="maskListItem" @click="NumberCk(7)">7</view>
                <view class="maskListItem" @click="NumberCk(8)">8</view>
                <view class="maskListItem" @click="NumberCk(9)">9</view>
              </view>
              <view class="MymaskList">
                <view class="maskListItem" @click="NumberCk('.')">.</view>
                <view class="maskListItem" @click="NumberCk(0)">0</view>
                <view class="maskListItem" @click="Cancelword()">
                  <image src="../../static/Clear.png"></image>
                </view>
              </view>
            </view>
            <view class="MymaskList MymaskList2">
              <view class="maskListItem text" @click="Tuige()">
                <image src="../../static/close.png" class="close"></image>
              </view>
              <view class="maskListItem text" @click="Clear()">清空</view>
              <view class="maskListItem width48" @click="Next()">保存</view>
            </view>
          </view>
        </view>
      </view>
    </view>
    <!--蓝牙连接区  -->
    <view class="wrapper" v-show="isBle">
      <view class="bg" @click='isBle=false'>
        <view class="box" @click.stop>
          <view class="title">
            <view class="weight" style="width: 242rpx;" @click="handleMannulWeight()">
              <icon class="iconfont icon-lianjie"></icon>
              手动称重
            </view>
            <view class="name">{{activeType.name}}</view>
            <icon class="iconfont icon-error" @click='isBle=false'></icon>
          </view>
          <blue-tooth @handleBle="handleBle" :weightType="'2'" :weightKcal="weightKcal"></blue-tooth>
        </view>
      </view>
    </view>
    <view class="auto-search-dialog" v-if="showAutoSearchDlg">
      <view class="auto-search-inner">
        <text>{{autoSearchContent != '' ? `识别到你描述的食材为“${autoSearchContent}”,是否查找食材“${autoSearchContent}”` : "长安麦克风图标开始说话，松开后结束"}}</text>
        <view class="mic-icon" :style="{'border-color':mic_touch ? '#18bc37' : '#777777'}"
          @touchstart="onVoiceTouchStart" @touchend="onVoiceTouchEnd"
          v-if=" autoSearchType == 1 && autoSearchContent == ''">
          <uni-icons type="mic-filled" size="80" :color="mic_touch ? '#18bc37' : '#777777'"></uni-icons>
        </view>
        <view class="btn-wrap" v-else>
          <view class="retry" @click="retrySearch">重试</view>
          <view class="confirm" @click="handleVoiceSearch(autoSearchContent)">确定</view>
        </view>
        <uni-icons class="close" type="close" color="#ffffff" size="45" @click="showAutoSearchDlg=false"></uni-icons>
      </view>
    </view>
  </view>
</template>

<script>
  import {
    mapState
  } from "vuex";
  let myTime
  // const plugin = requirePlugin("sdkPlugin").AiLink;
  import search from "../../components/search.vue"
  import blueTooth from "../../components/bluetooth_new.vue"
  import FoodItem from "../../components/food_item.vue"
  const plugin = requirePlugin("WechatSI")
  export default {
    components: {
      search,
      blueTooth,
      FoodItem
    },
    data() {
      return {
        typename: "",
        typeind: 0,
        index: 0,
        leftInd: 0,
        menu: [],
        menu2: [],
        menu3: [],
        myvalue: [],
        searchResults: [],
        ActiveList: [],
        activeType: {},
        IsWeight: false,
        isShop: false,
        isBle: false,
        weightKcal: "",
        kcal: "",
        weight: "",
        stopblue: true,
        page: 1,
        loading: false,
        autoSearchType: 1, //搜索类型，1：语音识别 2：图像识别
        voiceManager: null,
        autoSearchContent: '',
        isConnection: 0, //是否连接成功
        showAutoSearchDlg: false,
        mic_touch: false
      };
    },
    computed: {
      ...mapState(["user", 'isConnected', "isBluetoothTyle", 'foodList']),
      menuTop() {
        this.menu2 = this.foodList.length ? this.foodList[0].list : []
        return [...this.foodList, {
          id: 4,
          list: [],
          name: '搜索'
        }]
      },
    },
    onLoad(options) {
      let that = this
      that.typename = options.name
      that.typeind = options.ind
      that.handleHomeInfo()
    },
    mounted() {
      let that = this
      that.voiceManager = plugin.getRecordRecognitionManager()
      that.voiceManager.onStop = function(res) {
        that.autoSearchContent = res.result.replace('。', '')
      }
      that.voiceManager.onError = function(res) {
        console.error("error msg", res.retcode)
      }
      that.voiceManager.stop()
    },
    methods: {
      handleHomeInfo() {
        let that = this
        that.loading = true
        that.$model.getCookFoodList({
          food_level2_id: that.menu2[that.leftInd].id,
          page: that.page,
          search_data: that.name
        }).then(res => {
          if (res.code != 0) return
          that.lastPage = res.data.page_total
          that.loading = false
          that.menu3 = that.menu3.concat(res.data.content_list)
        })
      },
      // 头部切换
      handleToggle(ind) {
        let that = this
        that.index = ind
        that.leftInd = 0
        that.menu2 = that.menuTop[ind].list
        that.menu3 = []
        that.page = 1
        if (that.menu2.length) {
          that.handleHomeInfo()
        }
      },
      // 左侧切换
      handleToggleLeft(ind) {
        let that = this
        that.leftInd = ind
        that.menu3 = []
        that.page = 1
        that.handleHomeInfo()
      },
      onScrollBottom() {
        let that = this
        if (!this.lastPage || this.page >= this.lastPage) {
          uni.showToast({
            title: '没有更多数据！',
            icon: 'none'
          })
          return
        }
        this.page++
        if (that.menu2.length) {
          that.handleHomeInfo()
        }
      },
      // 搜索
      handleSearch(name) {
        let that = this
        let list = []
        that.$model.getFoodSearch({
          food_name: name
        }).then(res => {
          if (res.code != 0) {
            uni.showToast({
              title: res.msg,
              icon: 'error'
            })
            return
          }
          that.index = 3
          that.menu2 = []
          that.menu3 = res.data
        })
      },
      handleVoiceSearch() {
        let that = this
        if (that.autoSearchContent != '') {
          that.$refs.search.searchByName(that.autoSearchContent)
          that.showAutoSearchDlg = false
          that.autoSearchContent = ''
        }
      },
      // 商品选择
      handleDetail(ite) {
        var that = this;
        that.myvalue = []
        that.activeType = ite
        that.activeType.weight = 100
        // that.IsWeight = true
        that.weightKcal = that.activeType.kcal
        that.isShop = false
        that.isBle = true
        console.log("选中的商品", ite)
      },
      // 购物车提交
      handlesubbtn() {
        let that = this

        if (that.ActiveList.length <= 0) return

        that.$model.getAddIntakeFood({
          aud_id: that.user.aud_id,
          meals_type: that.typename,
          food_list: that.ActiveList
        }).then(res => {
          if (res.code != 0) return
          uni.navigateBack({
            delta: 1
          })
        })
      },
      //删除购物车食材
      handledelactive(ite) {
        let that = this
        that.ActiveList.splice(that.ActiveList.indexOf(ite), 1);
      },
      // 键盘点击
      NumberCk(val) {
        let that = this
        that.myvalue = that.myvalue[0] == '.' ? [0, '.'].concat(val) : that.myvalue.concat(val)
        if (that.myvalue.toString().indexOf('.') != -1) {
          let ind = that.myvalue.indexOf(".")
          that.myvalue = that.myvalue.slice(0, ind + 2)
        }
        if (that.myvalue.toString().indexOf('.') == -1 && that.myvalue.length > 3) {
          that.myvalue = ["9", "9", "9"]
        }
        that.activeType.weight = that.myvalue.join("")
      },
      // 键盘退格
      Tuige() {
        let that = this
        var txt = that.myvalue
        if (txt.length >= 1) {
          if (txt[txt.length - 2] != '.') {
            that.myvalue = txt.slice(0, txt.length - 1)
          } else {
            that.myvalue = txt.slice(0, txt.length - 2)
          }
        }
        that.activeType.weight = that.myvalue.join("")
        // console.log("退格1", txt, that.myvalue.join(""))
      },
      // 键盘取消
      Cancelword() {
        this.IsWeight = false
        this.myvalue = []
        this.activeType = {}
        // console.log("取消")
      },
      // 键盘清空
      Clear() {
        this.myvalue = []
        this.activeType.weight = null
        // console.log("清空")
      },
      // 键盘保存
      Next() {
        let that = this
        let ite = that.activeType
        that.IsWeight = false
        if (that.ActiveList.indexOf(ite) == -1) {
          that.ActiveList.push(ite);
        } else {
          let index = that.ActiveList.indexOf(ite)
          that.ActiveList[index].weight = that.activeType.weight;
          that.ActiveList[index].unit = that.activeType.unit;
        }
        console.log("保存", that.ActiveList)
      },
      // 称重
      handleWeight() {
        let that = this
        that.weightKcal = that.activeType.kcal
        that.isBle = true
        that.IsWeight = false
      },
      // 手动称重
      handleMannulWeight() {
        let that = this
        that.isBle = false
        that.IsWeight = true
      },
      //称重返回
      handleBle(weight, unit, kcal) {
        let that = this
        that.isBle = false
        that.activeType.weight = weight
        that.activeType.unit = unit
        that.activeType.kcal = kcal
        that.Next()
        console.log("返回", that.activeType, weight, unit, kcal)
      },
      onShowSearchType(type) {
        let that = this
        this.autoSearchType = type

        if (type == 1) {
          that.showAutoSearchDlg = true
        } else if (type == 2) {
          that.selectPhoto()
        }
      },
      retrySearch() {
        let that = this
        that.autoSearchContent = ''
        if(that.autoSearchType == 2) {
          that.showAutoSearchDlg = false
          that.selectPhoto()
        }
      },
      selectPhoto() {
        let that = this
        uni.chooseMedia({
          count: 1,
          mediaType: ['image'],
          sourceType: ['album', 'camera'],
          sizeType: ['compressed'],
          camera: 'back',
          success(res) {
            const tempFilePath = res.tempFiles[0].tempFilePath
            uni.getFileSystemManager().readFile({
              filePath: tempFilePath,
              encoding: 'base64',
              success: (res) => {
                const base64 = 'data:image/jpeg;base64,' + res.data

                uni.showLoading({
                  title: '图片识别中...',
                  mask: true
                })
                
                that.$model.getPhotoSearch({
                  img_str: base64,
                }).then(res => {
                  uni.hideLoading()
                  if (res.code != 0) return
                  that.autoSearchContent = res.data.name
                  that.showAutoSearchDlg = true
                })
              },
              fail: (err) => {
                console.error('读取文件失败:', err)
              }
            })
          },
          fail(err) {
            console.error('拍照失败:', err)
          }
        })
      },
      onVoiceTouchStart() {
        let that = this
        that.mic_touch = true
        that.voiceManager.start({
          duration: 60000,
          lang: "zh_CN"
        })
      },
      onVoiceTouchEnd() {
        let that = this
        that.mic_touch = false
        that.voiceManager.stop()
      }
    }
  }
</script>

<style lang="scss" scoped>
  .tab_list {
    display: flex;
    margin: 45px -10px 0;
    justify-content: space-between;

    .scroll-menu {
      width: 100%;

      .tabbar {
        padding: 10px;
        display: inline-block;

        view {
          display: inline-block;
        }
      }
    }

    .active {
      color: #fff;
      padding: 5px 8px;
      border-radius: 5px;
      background-color: #ff4c4f;
    }
  }

  .left {
    top: 90px !important;
  }

  .right {
    top: 90px !important;
    
    .list {
      display: block !important;
      column-count: 3; /* 分成两列 */
      column-gap: 10px; /* 列间距 */
    }
    .item {
      break-inside: avoid;
      /* 防止元素被分割到不同列 */
      border: 1px solid #f7f7f7;
      display: flex;
      align-items: center;
      box-sizing: border-box;
      justify-content: space-around;
      // height: 30px;
      border-radius: 5px;
      margin: 0 2% 10px;
      box-shadow: 0 0 10rpx #e1e1e1;

      text {
        margin-bottom: 0 !important;
        padding: 10rpx;
      }
    }

    .icon-xuanzhong {
      color: $maincolor;
    }

    .active0 {
      border: 1px solid $maincolor;
    }
  }

  .weightPages {
    display: flex;
    flex-wrap: wrap;
    flex-direction: column;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 20px;
    top: 60px;
    justify-content: space-around;

    .weight {
      background: #fff;
      color: #666;
      font-size: 16px;
      flex-wrap: wrap;
      text-align: center;

      view {
        width: 60%;
        height: 50px;
        display: flex;
        margin-left: 25%;
        align-items: flex-end;
        margin-bottom: 15px;

        text {
          width: 80px;
          display: inline-block;
          border-bottom: 1px solid #dfdfdf;
          margin: 0 10px;
          font-size: 18px;
          font-weight: bold;
          color: #f0ae43;
        }
      }
    }

    .tips {
      font-size: 12px;
      text-align: center;
    }

    .btn {
      color: #fff;
      width: 80%;
      margin-left: 10%;
    }

    .table {
      width: 100%;
      font-size: 16px;
      font-weight: bold;
      text-align: center;
      margin: 15px 0;
    }

    .image {
      width: 160px;
      height: 160px;
      margin: auto;

      image {
        width: 100%;
        height: 100%;
      }
    }

    .tips {
      margin-bottom: 15px;
      margin-left: 15px;
      display: flex;
      color: #999;
    }
  }

  .groupbtn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 55px;
    z-index: 15;
    background-color: #fff;
    overflow: hidden;
    box-shadow: 0px 1px 5px 2px #dfe2e1fc;

    .subbtn {
      color: #fff;
      width: 40%;
      text-align: center;
      border-radius: 10px;
      height: 31px;
      line-height: 31px;
      background-color: $maincolor;
    }

    .che {
      width: 50px;
      height: 40px;
      position: relative;

      text {
        position: absolute;
        height: 15px;
        background: red;
        width: 15px;
        border-radius: 50%;
        display: inline-block;
        color: #fff;
        line-height: 15px;
        text-align: center;
        font-size: 12px;
        right: 0;
        top: 5px;
      }

      image,
      .t-icon {
        width: 50px;
        height: 50px;
        margin-top: -3px;
        border-radius: 50%;
      }
    }
  }

  .menu {
    .left {
      bottom: 55px;
      height: calc(100vh - 150px);
    }

    .right {
      bottom: 55px;
      height: calc(100vh - 150px);

    }

  }

  .activeList {
    z-index: 12;
    bottom: 50px;

    .title {
      font-weight: bold;
      margin: 5px 0;
    }

    .list {
      padding-bottom: 55px;

      .name {
        margin-right: 5px;
      }


    }
  }

  .voice-photo-wrap {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: fixed;
    bottom: 200rpx;
    right: 0;
    width: 70rpx;
    height: 160rpx;

    .voice {
      border-radius: 35rpx;
      background-color: #70a1ff;

      .voice-icon {
        width: 70rpx;
        height: 70rpx;
        background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAMAAABHPGVmAAAAY1BMVEUAAAD+/v7+/v7////////+/v7////////+/v7////+/v7////+/v7////+/v7+/v7////+/v7////+/v7+/v7////+/v7+/v7////+/v7+/v7////+/v7+/v7+/v7///////8gTHxJAAAAIHRSTlMAkL8QIPcwoLAI32DXUO9IKMd4p5iIaOcYt1hAOM9wgPxxuZIAAAMsSURBVGje7djpcqQgEADg9kDF0fF2PMd+/6dcYRajwTERsTab8vsTClPVabqJCFwuP0TVpIaXGWlTwUms0iQomCmFEzzvuHB/ag/j+CgJHNCqEWn0tevWAfmbTAQa3ZBLykqUJ0EuBW0iZPxmPhe+1k9bLvGdp2EtZ62azZIY9OBL48rzLi8S1VeQBGSU51KCBtRn9bBghf1gj3SkEvI/dyPJEI7L2LaDNwJercMoa60B3ijYljy+Xh2OnM2nnZaSEHiL5dnAUU+pJFJRnqBAWnVze6MacJSxHcTUFiQIRw6FpZbN9pqCCJm0fxjNQdCez9t4ShBizectckaQxw0Wygef/r+66wryI4JYqfsSsMYaf+aRdFAyxmnWYr37ktLdJxTJ7fM7QFLvTARlOSzkKLOOBZEzafQEMb2Rz2rCBqV0VMnGWfZm9NljUzGIs6e7nCvI7wtC/FEfwUKUsFlyOMjWm5ES5DQHwRhmYtQfRP4OqjUH6W+jEJZoyGYDbUG8s7ur+LqFCzbo9gcBHIV7TvURjmAfIj4Um+3vEyK+T0r+e/v4YhlaqXmlRm7FsvqwjylehRbZukIZpr8/57XbQXTutB96ulGSbBoZKtcQ9jQqYVWJoiSxGO1RTatkvb92oP70KN3dwSJ98yOpbC1K/XG+MHmn73WbuooGbDjQ9a+KQHQZT1xlvTw+bMlaLtRls8QBxmNDG3bLxWWDuB1MWphpg9lhrEPFO5aYfPx7L5CrQ5FNVCNXzA61NijIZ+tcivvTOi+GzCTLQ+XzdYpVYZPZTWZ7R8kjEvegoiIKbvObTKsguEAGa34P+gRFHo78WPRb4c+yMCqRcCBuEtRYwd9VEZw0z5LEM0obhI7nEVigzPbxi6V4vvohhgPiBzLem6ra3iuGA4fYJnL5SpjKQK634SCaIUfckC7mo5wgl1lw3CB69+6lTVdRGndhapKpk0ELOyO4QlRLlzbBVWYLOjliJ873owPadYPXi3ULvKKD07T8oEXhVPbKm+MKcgW5gvyKIHZqfOby16Q0PcSgqLrjt/kVqIlwh1A1E4LfRpTrFHnmN7kRXC7/xB8ZerD103/W/wAAAABJRU5ErkJggg==);
        background-size: cover;
      }
    }

    .photo {
      border-radius: 35rpx;
      background-color: #ffbe76;

      .photo-icon {
        width: 70rpx;
        height: 70rpx;
        background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAMAAABHPGVmAAAAXVBMVEUAAAD////////////+/v7////////+/v7+/v7////////////////+/v7+/v7+/v7////+/v7+/v7+/v7+/v7////+/v7+/v7+/v7+/v7+/v7+/v7////+/v7///9dayJ/AAAAHnRSTlMAoDBf71BA3/eACCWI18+/eDjHso8Q56dYl2hHGG/EjhawAAABlUlEQVRo3u2W23KDIBBAEUERvF8ac+P/P7MVWiYDmk7o8tDMnrddlxydNe4SBEEQBEGQpFTZIfV2nbvwEi8R+hCxbDfhwizaUegnFECS/pmkApJ0zyQTgMS1RJQBbMt/fBXcXaqOdQx6wz/uHoCSl1mKgNo12INbexEgf5FQfcDOQakPoJGSca+4BZbMe8VnYAnfK+bAErVXfPuT5Mx99quv3GN+QZKTSHKUvKvkNtBbWsl6YuazP63JJNdSOxqeRjIHcxdekmmPE7yk1wE1tGT46UW1rlWrDWIAlnT2Z+0FmQsTdrCSwTrc6cJaKJzEdaQnjrvtCqikMyuWJA7JzOQHlZTBOzsZLahEBMvEbJoEKvkIFt0zvKTZsu1jZjQZUMnp+w12KLvEg0q4/+ebTOICKlmYvXNpQ5mZkC2gElI9jBHJR/e1B5XIUltYOzJtKRdgCVFMezAKP7SupecYUoxf1Tw6WpVmkZAX9zBNnm4lkqrPpi7r6TtskChByX+QsFjEC5J4UAIvURkAiiAIgiAIggDxCa/TqV5BIswVAAAAAElFTkSuQmCC);
        background-size: cover;
      }
    }
  }

  .auto-search-dialog {
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    
    .auto-search-inner {
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      align-items: center;
      position: relative;
      width: 70%;
      height: 350rpx;
      padding: 80rpx 0;
      background-color: #fff;
      border-radius: 20rpx;
      box-shadow: 0 0 20rpx #ccc;
      .close {
        position: absolute;
        left: 0;
        right: 0;
        bottom: -140rpx;
        width: 90rpx;
        margin: 0 auto;
      }
    }

    text {
      font-size: 32rpx;
      width: 80%;
    }

    .mic-icon {
      display: flex;
      justify-content: center;
      align-items: center;
      width: 150rpx;
      height: 150rpx;
      border-radius: 50%;
      border: 8rpx solid #777777;
    }

    .btn-wrap {
      display: flex;
      justify-content: space-around;
      width: 90%;

      .retry,
      .confirm {
        width: 190rpx;
        height: 60rpx;
        line-height: 60rpx;
        text-align: center;
        font-size: 28rpx;
        border: 2rpx solid #777;
        border-radius: 15rpx;
      }
    }
  }

  .icon-error {
    font-size: 45px;
    margin-top: -30px;
    background: #fff;
    border-radius: 50%;
    width: 45px;
    height: 45px;
  }
</style>