{"ast":null,"code":"import \"vant/es/loading/style\";\nimport _Loading from \"vant/es/loading\";\nimport \"vant/es/tab/style\";\nimport _Tab from \"vant/es/tab\";\nimport \"vant/es/tabs/style\";\nimport _Tabs from \"vant/es/tabs\";\nimport \"vant/es/list/style\";\nimport _List from \"vant/es/list\";\nimport \"core-js/modules/es.array.push.js\";\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\nimport { _fundRecord } from '@/API/fund.api';\nimport { _getHomeList, _myCoins, _collect, _deleteCollect } from '@/API/home.api';\nimport { mapGetters } from \"vuex\";\nimport { TIME_OUT } from \"@/config\";\nimport { setStorage } from \"@/utils/utis\";\nexport default {\n name: \"search\",\n data() {\n return {\n keywords: '',\n active: 0,\n allFunList: [],\n dataList: [],\n allCurrencyList: [],\n currencyList: [],\n timeout: null,\n collectionList: [],\n isLoading: true\n };\n },\n mounted() {\n this.allFunList = [{\n name: this.$t('理财'),\n icon: require(`../../assets/theme/${this.theme}/image/nav/finance.png`),\n path: '/fm-home'\n }, {\n name: this.$t('充值'),\n icon: require(`../../assets/theme/${this.theme}/image/nav/account.png`),\n // path: '/recharge/rechargePage'\n path: '/recharge/rechargePage'\n }, {\n name: this.$t('合约交易'),\n icon: require(`../../assets/theme/${this.theme}/image/nav/trading.png`),\n path: '/trendDetails/btc'\n }, {\n name: this.$t('闪兑'),\n icon: require(`../../assets/theme/${this.theme}/image/nav/exchange.png`),\n path: '/exchange/exchangePage'\n }];\n this.dataList = this.allFunList;\n if (this.$store.state.user.userInfo.token) {\n this.myCoinsList();\n }\n setTimeout(() => {\n this.fetchQList();\n }, 1000);\n },\n components: {\n [_List.name]: _List,\n [_Tabs.name]: _Tabs,\n [_Tab.name]: _Tab,\n [_Loading.name]: _Loading\n },\n watch: {\n collectionList(val) {\n if (val) {\n this.allCurrencyList.map(item => {\n val.map(item2 => {\n if (item.symbol == item2.symbol) {\n item.isCollection = true;\n }\n });\n });\n this.currencyList.map(item => {\n val.map(item2 => {\n if (item.symbol == item2.symbol) {\n item.isCollection = true;\n }\n });\n });\n }\n }\n },\n computed: {\n ...mapGetters({\n coinArr: 'home/coinArr',\n theme: 'home/theme'\n })\n },\n filters: {},\n beforeDestroy() {\n clearInterval(this.timeout);\n },\n methods: {\n onInput() {\n if (this.active == 1) {\n if (this.keywords) {\n this.dataList = this.dataList.filter(item => {\n return item.name.indexOf(this.keywords) != -1;\n });\n } else {\n this.dataList = this.allFunList;\n }\n }\n },\n cancel() {\n this.$router.go(-1);\n },\n jump(path) {\n this.$router.push(path);\n },\n myCoinsList() {\n _myCoins().then(res => {\n this.collectionList = res;\n });\n },\n onCollect(item) {\n // 收藏,取消收藏\n let _api = _collect;\n if (item.isCollection) {\n _api = _deleteCollect;\n }\n _api(item.symbol).then(() => {\n this.myCoinsList();\n item.collected = !item.collected;\n if (!item.isCollection) {\n this.$toast.success(this.$t('收藏成功'));\n } else {\n this.$toast.success(this.$t('取消收藏'));\n }\n });\n },\n fetchQList() {\n // 获取行情\n _getHomeList(this.coinArr.join(',')).then(res => {\n this.isLoading = false;\n res.map(item => {\n this.$set(item, 'isCollection', false);\n });\n this.allCurrencyList = res;\n this.currencyList = res;\n this.allCurrencyList.map(item => {\n this.collectionList.map(item2 => {\n if (item.symbol == item2.symbol) {\n item.isCollection = true;\n }\n });\n });\n this.currencyList.map(item => {\n this.collectionList.map(item2 => {\n if (item.symbol == item2.symbol) {\n item.isCollection = true;\n }\n });\n });\n if (this.active == 0) {\n if (this.keywords) {\n this.currencyList = this.currencyList.filter(item => {\n return item.name.toUpperCase().indexOf(this.keywords.toUpperCase()) != -1;\n });\n } else {\n this.currencyList = this.allCurrencyList;\n }\n }\n this.timeout = setTimeout(() => {\n this.fetchQList();\n }, 1000);\n });\n if (this.timeout) {\n clearInterval(this.timeout);\n }\n },\n changeValue() {\n console.log(this.dataList);\n this.keywords = '';\n },\n onItemClick(item) {\n setStorage('symbol', item.symbol);\n this.$router.push({\n path: `/perpetualContract/${item.symbol}`\n });\n }\n }\n};","map":{"version":3,"names":["_fundRecord","_getHomeList","_myCoins","_collect","_deleteCollect","mapGetters","TIME_OUT","setStorage","name","data","keywords","active","allFunList","dataList","allCurrencyList","currencyList","timeout","collectionList","isLoading","mounted","$t","icon","require","theme","path","$store","state","user","userInfo","token","myCoinsList","setTimeout","fetchQList","components","_List","_Tabs","_Tab","_Loading","watch","val","map","item","item2","symbol","isCollection","computed","coinArr","filters","beforeDestroy","clearInterval","methods","onInput","filter","indexOf","cancel","$router","go","jump","push","then","res","onCollect","_api","collected","$toast","success","join","$set","toUpperCase","changeValue","console","log","onItemClick"],"sources":["src/page/search/index.vue"],"sourcesContent":["<template>\n <!-- 账变记录 -->\n <div class=\"accountChange\">\n <div class=\"px-32 py-30 flex items-center\">\n <!-- <img src=\"@/assets/image/icon-left_arrow.png\" alt=\"logo\" class=\"w-20 h-33 border-1 mr-32\" @click=\"back\"/> -->\n <div class=\"inputBoxbg h-60 w-full rounded-full flex items-center\">\n <img src=\"@/assets/image/icon-search.png\" alt=\"logo\" class=\"w-32 h-32 mx-16\" />\n <input type=\"text\" v-model=\"keywords\" :placeholder=\"$t('搜索')\"\n class=\"h-full flex-1 border-none search-input bg-none\" @input=\"onInput\" />\n </div>\n <div class=\"cancel\" @click=\"cancel\">\n {{ $t('取消') }}\n </div>\n </div>\n <van-tabs v-model=\"active\" @change=\"changeValue\">\n <van-tab :title=\"$t('热门搜索')\"></van-tab>\n <van-tab :title=\"$t('热门功能')\"></van-tab>\n </van-tabs>\n <div v-if=\"active == 0\" class=\"px-32 mt-20\">\n <div class=\"list-item flex\" v-for=\"(item, index) in currencyList\" :key=\"index\" @click.stop=\"onItemClick(item)\">\n <div class=\"flex-1 item-left flex\">\n <div class=\"\">\n <van-icon class=\"star-icon-check\" v-if=\"index == 0 || index == 1\" name=\"fire\" />\n <span v-else class=\"font-35\">\n {{ index + 1 }}\n </span>\n </div>\n <div class=\"pl-30 symbol-name\">{{ item.symbol.toUpperCase() }}<span>/usdt</span></div>\n </div>\n <div class=\"item-right\">\n <div class=\"symbol-name\">{{ item.close }}</div>\n <div class=\"increase mt-10\" :class=\"[item.change_ratio > 0 ? 'green' : 'red']\">{{ item.change_ratio\n }}%</div>\n </div>\n <van-icon :class=\"[item.isCollection ? 'star-icon-check' : 'star-icon']\" class=\"font-40 ml-20\" name=\"star\"\n @click.stop=\"onCollect(item)\" />\n </div>\n </div>\n <div v-if=\"active == 1\" class=\"px-32 mt-30\">\n <div class=\"function-item list-item flex\" v-for=\"(item, index) in dataList\" @click=\"jump(item.path)\"\n :key=\"index\">\n <div class=\"flex-1 flex item-left\">\n <div>\n <span v-if=\"index == 0 || index == 1\">{{ index + 1 }}</span>\n <span v-else>\n {{ index + 1 }}\n </span>\n\n </div>\n <div class=\"imgBox ml-30\"><img :src=\"item.icon\" alt=\"\"></div>\n <div class=\" ml-30 symbol-name\">{{ item.name }}</div>\n </div>\n <div class=\"item-right\">\n <van-icon name=\"arrow\" />\n </div>\n </div>\n </div>\n <div v-if=\"dataList.length == 0 || currencyList.length == 0\"\n class=\"flex flex-col justify-center items-center pt-185\">\n <img src=\"@/assets/image/assets-center/no-data.png\" alt=\"no-date\" class=\"w-180 h-180\" />\n <p class=\"textColor\">{{ $t('暂无数据') }}</p>\n </div>\n <div class=\"loading-box\" v-if=\"isLoading\">\n <van-loading type=\"spinner\" size=\"24px\" />\n </div>\n </div>\n</template>\n\n<script>\nimport { _fundRecord } from '@/API/fund.api'\nimport { List } from 'vant'\nimport { Tab, Tabs, Loading } from 'vant';\nimport { _getHomeList, _myCoins, _collect, _deleteCollect } from '@/API/home.api'\nimport { mapGetters } from \"vuex\";\nimport { TIME_OUT } from \"@/config\";\nimport { setStorage } from \"@/utils/utis\";\nexport default {\n name: \"search\",\n data() {\n return {\n keywords: '',\n active: 0,\n allFunList: [],\n dataList: [],\n allCurrencyList: [],\n currencyList: [],\n timeout: null,\n collectionList: [],\n isLoading: true\n }\n },\n mounted() {\n this.allFunList = [\n {\n name: this.$t('理财'),\n icon: require(`../../assets/theme/${this.theme}/image/nav/finance.png`),\n path: '/fm-home'\n },\n {\n name: this.$t('充值'),\n icon: require(`../../assets/theme/${this.theme}/image/nav/account.png`),\n // path: '/recharge/rechargePage'\n path: '/recharge/rechargePage'\n },\n {\n name: this.$t('合约交易'),\n icon: require(`../../assets/theme/${this.theme}/image/nav/trading.png`),\n path: '/trendDetails/btc'\n },\n {\n name: this.$t('闪兑'),\n icon: require(`../../assets/theme/${this.theme}/image/nav/exchange.png`),\n path: '/exchange/exchangePage'\n }\n ]\n this.dataList = this.allFunList\n if (this.$store.state.user.userInfo.token) {\n this.myCoinsList()\n }\n setTimeout(() => {\n this.fetchQList();\n }, 1000)\n },\n components: {\n [List.name]: List,\n [Tabs.name]: Tabs,\n [Tab.name]: Tab,\n [Loading.name]: Loading\n },\n watch: {\n collectionList(val) {\n if (val) {\n this.allCurrencyList.map((item) => {\n val.map((item2) => {\n if (item.symbol == item2.symbol) {\n item.isCollection = true\n }\n })\n })\n this.currencyList.map((item) => {\n val.map((item2) => {\n if (item.symbol == item2.symbol) {\n item.isCollection = true\n }\n })\n })\n }\n }\n },\n computed: {\n ...mapGetters({\n coinArr: 'home/coinArr',\n theme: 'home/theme'\n }),\n },\n filters: {\n\n },\n beforeDestroy() {\n clearInterval(this.timeout)\n },\n methods: {\n onInput() {\n if (this.active == 1) {\n if (this.keywords) {\n this.dataList = this.dataList.filter((item) => {\n return item.name.indexOf(this.keywords) != -1\n })\n } else {\n this.dataList = this.allFunList\n }\n }\n },\n cancel() {\n this.$router.go(-1)\n },\n jump(path) {\n this.$router.push(path)\n },\n myCoinsList() {\n _myCoins().then((res) => {\n this.collectionList = res\n\n })\n },\n onCollect(item) { // 收藏,取消收藏\n let _api = _collect\n if (item.isCollection) {\n _api = _deleteCollect\n }\n _api(item.symbol).then(() => {\n this.myCoinsList()\n item.collected = !item.collected\n if (!item.isCollection) {\n this.$toast.success(this.$t('收藏成功'))\n } else {\n this.$toast.success(this.$t('取消收藏'))\n }\n })\n },\n fetchQList() { // 获取行情\n _getHomeList(this.coinArr.join(',')).then((res) => {\n this.isLoading = false\n res.map((item) => {\n this.$set(item, 'isCollection', false)\n })\n this.allCurrencyList = res\n this.currencyList = res\n this.allCurrencyList.map((item) => {\n this.collectionList.map((item2) => {\n if (item.symbol == item2.symbol) {\n item.isCollection = true\n }\n })\n })\n this.currencyList.map((item) => {\n this.collectionList.map((item2) => {\n if (item.symbol == item2.symbol) {\n item.isCollection = true\n }\n })\n })\n if (this.active == 0) {\n if (this.keywords) {\n this.currencyList = this.currencyList.filter((item) => {\n return item.name.toUpperCase().indexOf(this.keywords.toUpperCase()) != -1\n })\n } else {\n this.currencyList = this.allCurrencyList\n }\n }\n this.timeout = setTimeout(() => {\n this.fetchQList()\n }, 1000)\n })\n\n if (this.timeout) {\n clearInterval(this.timeout)\n }\n },\n changeValue() {\n console.log(this.dataList)\n this.keywords = ''\n },\n onItemClick(item) {\n\n setStorage('symbol', item.symbol)\n this.$router.push({\n path: `/perpetualContract/${item.symbol}`\n });\n\n }\n }\n}\n</script>\n<style lang=\"scss\" scoped>\n.cancel {\n width: 150px;\n text-align: center;\n color: #868D9A;\n font-size: 28px;\n}\n\n.inputBoxbg {\n @include themify() {\n background: themed(\"tab_background\");\n }\n\n}\n\n.search-input {\n @include themify() {\n color: themed(\"text_color\");\n }\n}\n\n.list-item {\n align-items: center;\n margin-bottom: 40px;\n\n .item-left {\n font-size: 36px;\n font-weight: bold;\n\n span {\n color: #868D9A;\n font-weight: initial;\n font-size: 28px;\n }\n }\n\n .item-right {\n text-align: right;\n font-size: 30px;\n font-weight: bold;\n\n .increase {\n font-size: 26px;\n font-weight: initial;\n }\n }\n\n .green {\n color: #5EBA89;\n }\n\n .red {\n color: #F6465D;\n }\n\n}\n\n.function-item {\n align-items: center;\n margin-bottom: 60px;\n\n .item-left {\n font-size: 30px;\n font-weight: bold;\n }\n\n .item-right {\n color: #B8BDC5;\n font-size: 30px;\n }\n\n .imgBox {\n img {\n width: 42px;\n height: 42px;\n }\n }\n}\n\n.star-icon {\n color: #c8cad2;\n}\n\n.star-icon-check {\n color: #FCD436;\n}\n\n.symbol-name {\n @include themify() {\n color: themed(\"text_color\");\n }\n}\n\n.accountChange {\n ::v-deep .van-tabs__nav {\n background: transparent;\n }\n\n ::v-deep .van-tab {\n @include themify() {\n color: themed(\"text_color\");\n }\n }\n}\n\n.loading-box {\n position: fixed;\n top: 0;\n left: 0;\n z-index: 10;\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n background: rgba(0, 0, 0, 0.4);\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqEA,SAAAA,WAAA;AAGA,SAAAC,YAAA,EAAAC,QAAA,EAAAC,QAAA,EAAAC,cAAA;AACA,SAAAC,UAAA;AACA,SAAAC,QAAA;AACA,SAAAC,UAAA;AACA;EACAC,IAAA;EACAC,KAAA;IACA;MACAC,QAAA;MACAC,MAAA;MACAC,UAAA;MACAC,QAAA;MACAC,eAAA;MACAC,YAAA;MACAC,OAAA;MACAC,cAAA;MACAC,SAAA;IACA;EACA;EACAC,QAAA;IACA,KAAAP,UAAA,IACA;MACAJ,IAAA,OAAAY,EAAA;MACAC,IAAA,EAAAC,OAAA,4BAAAC,KAAA;MACAC,IAAA;IACA,GACA;MACAhB,IAAA,OAAAY,EAAA;MACAC,IAAA,EAAAC,OAAA,4BAAAC,KAAA;MACA;MACAC,IAAA;IACA,GACA;MACAhB,IAAA,OAAAY,EAAA;MACAC,IAAA,EAAAC,OAAA,4BAA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