index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521
  1. <template>
  2. <layoutBack :isGoBack='true'>
  3. <layout title='推荐云手机'>
  4. <div :class="isShowApp?'introduction':'introduction introduction-white'">
  5. <div class="introduction-title" v-if="isShowApp">
  6. 推荐云手机
  7. </div>
  8. <div class="introduction-tips" :style="{color: isShowApp ? '#EDEEF0' : '#0A132B' }">
  9. 请搜索您在云手机内希望使用的应用!
  10. </div>
  11. <div class="introduction-search">
  12. <img src="@/assets/image/introductionCloudPhone/search.png" alt="" />
  13. <input ref="inputField" v-model="searchText" type="search" placeholder="请输入应用名" />
  14. <div style="width: 1px;height: 20px;background: #7E8495;border-radius: 1px;"></div>
  15. <div @click="search">搜索</div>
  16. </div>
  17. <div v-if="applicationList.length && isShow">
  18. <div class="introduction-tips" style="margin-top: 24px;">
  19. 以下推荐应用选您需要使用的应用
  20. </div>
  21. <div>
  22. <div class="application">
  23. <div v-for="(item,index) in applicationList" :key="index" @click="selectApplication(item)">
  24. {{ item }}
  25. </div>
  26. </div>
  27. </div>
  28. </div>
  29. <div style="margin-top: 24px;" v-if="appSeatchList.length && !isShow">
  30. <div class="application-list" v-for="(item,index) in appSeatchList" :key="index">
  31. <div class="application-list-top">
  32. <img class="application-list-img" width="42" height="42" :src="item.img" alt="" />
  33. <div class="application-list-rigth">
  34. <div class="application-list-title">
  35. <div class="application-list-appname"> {{item.appName}}</div>
  36. <span v-if="item.articleId>0" @click="goArticleDetails(item)">点击阅读</span>
  37. </div>
  38. <div class="application-list-tips">{{item.appName}}云手机使用教程</div>
  39. </div>
  40. <div class="application-list-btn" @click="pay(item)">购买云手机
  41. <!-- <img width="12" src="@/assets/image/introductionCloudPhone/btn.png" /> -->
  42. </div>
  43. </div>
  44. <div class="application-list-bottom">推荐机型:{{item.list?item.list.map(o=>o.phoneTypeStr).join('/'):''}}</div>
  45. </div>
  46. </div>
  47. <div class="application-default" v-if="!appSeatchList.length && !isShow">
  48. <div class="empty">
  49. <div class="empty-title">当前搜索结果为空,您可以通过下面两种方式在云手机安装APP(限安卓手机应用上传安装)</div>
  50. <div class="empty-img">
  51. <img :src="require(`@/assets/image/introductionCloudPhone/${isShowApp ? 'empty-tips-default' : 'empty-tips-defaultWhite'}.png`)" alt="">
  52. </div>
  53. <div class="empty-tips">
  54. <div :style="{color: isShowApp ? '#EDEEF0' : '#0A132B' }">
  55. 温馨提示:
  56. </div>
  57. <div>
  58. 根据相关部门要求,违规APP将无法安装。请远离以上风险软件,谨防上当受骗。如果需要应用上报,请联系客服;也可以购买短期云手机,试用您未搜索到的应用。
  59. </div>
  60. </div>
  61. <div class="empty-btn" style="bottom: 24px; left: 16px;width: calc(100% - 32PX)">
  62. <div v-for="item in emptyBtn" :key="item.key" @click="emptyBtnFun(item.type)" :class="{dark: isShowApp && !item.type}">
  63. {{ item.name }}
  64. </div>
  65. </div>
  66. </div>
  67. </div>
  68. </div>
  69. </layout>
  70. </layoutBack>
  71. </template>
  72. <script>
  73. import layoutBack from '@/components/layout';
  74. import layout from './components/layout';
  75. import { fileKeyToUrl } from '@/plugins/file-center.js';
  76. import uni from '@/static/static/js/uni.webview.1.5.2';
  77. export default {
  78. auth: false,
  79. name: 'introductionCloudPhone',
  80. head: {
  81. title: '推荐云手机',
  82. },
  83. data() {
  84. return {
  85. searchText: '',
  86. isShow: true,
  87. applicationList: [], // 推荐应用数组
  88. appSeatchList: [], // 应用数组
  89. emptyBtn: [{
  90. name: '联系客服咨询',
  91. key: 'customerService',
  92. type: 0
  93. },
  94. {
  95. name: '购买云手机试用',
  96. key: 'purchaseCloudPhone',
  97. type: 1
  98. }]
  99. };
  100. },
  101. components: { layout, layoutBack },
  102. created() {
  103. this.getSuggestApp()
  104. let _this = this
  105. document.addEventListener('keydown', function (e) {
  106. // 检查是否是搜索键(通常是“Enter”键)
  107. if (e.keyCode === 13) { // Enter key
  108. // 执行搜索操作
  109. _this.search();
  110. // 调用原生方法隐藏软键盘
  111. _this.$refs.inputField.blur();
  112. }
  113. });
  114. },
  115. watch: {
  116. searchText(value) {
  117. if (!value)
  118. this.isShow = true
  119. }
  120. },
  121. computed: {
  122. isShowApp() {
  123. // 是否是APP
  124. const isApp = this.$userAgent.isSzx || this.$userAgent.isSzxBrowser;
  125. const isAndroid = this.$userAgent.isAndroid;
  126. const isIos = this.$userAgent.isIos;
  127. const isWx = this.$userAgent.isWx;
  128. // 如果是App并且是安卓,就不显示头部, ios显示
  129. // 如果微信小程序环境的,也不显示头部
  130. // 如果是h5 就显示头部
  131. let bool = false;
  132. bool = isApp && (isAndroid || isIos) ? true : false;
  133. return bool;
  134. },
  135. },
  136. methods: {
  137. pay() {
  138. this.isApp = this.$userAgent.isSzx || this.$userAgent.isSzxBrowser
  139. if (this.isApp && this.$userAgent.isAndroid) {
  140. window.native.startPurchase();
  141. } else if (this.isApp && this.$userAgent.isIos) {
  142. window.webkit.messageHandlers.startPurchase.postMessage({});
  143. } else if (this.$userAgent.isMiniProgram) {
  144. this.$wx.miniProgram.navigateTo({
  145. url: '/package/purchase/purchase',
  146. });
  147. } else {
  148. uni.navigateTo({
  149. url: '/package/purchase/purchase',
  150. });
  151. }
  152. },
  153. goArticleDetails(item) {
  154. this.$router.push({ path: '/introductionCloudPhone/articleDetails?token=needToken', query: { id: item.articleId } })
  155. },
  156. getSuggestApp() {
  157. this.$axios.$post('/public/v1/market/getSuggestApp', {
  158. pageNum: 1, pageSize: -1
  159. }).then((res) => {
  160. this.applicationList = res.data
  161. });
  162. },
  163. selectApplication(name) {
  164. this.searchText = name
  165. this.search()
  166. },
  167. search() {
  168. if (!this.searchText) return
  169. this.appSeatchList.slice(0, this.appSeatchList.length)
  170. this.isShow = false
  171. this.$axios.$post('/public/v1/market/clientSearchSuggestApp', { pageSize: 100, pageNum: 1, appName: this.searchText }).then((res) => {
  172. this.appSeatchList = res.data.list
  173. this.appSeatchList.forEach(element => {
  174. element.img = fileKeyToUrl(element.imageId)
  175. });
  176. });
  177. },
  178. emptyBtnFun(type) {
  179. if(type) {
  180. this.pay()
  181. return
  182. }
  183. let url = `/introductionCloudPhone/onlineService?token=${this.$route.query.token}`
  184. if(this.$route.query.isWeixin) {
  185. url+= '&isWeixin=1'
  186. }
  187. this.$router.push(url)
  188. }
  189. },
  190. };
  191. </script>
  192. <style lang="less" scoped>
  193. .introduction {
  194. height: 100%;
  195. box-sizing: border-box;
  196. .introduction-title {
  197. margin-left: 10px;
  198. font-family: PingFangSC, PingFang SC;
  199. font-weight: 500;
  200. font-size: 18px;
  201. color: #cfd1d4;
  202. font-style: normal;
  203. margin-bottom: 24px;
  204. }
  205. .introduction-tips {
  206. font-family: PingFangSC, PingFang SC;
  207. font-weight: bold;
  208. font-size: 14px;
  209. color: #fefefe;
  210. font-style: normal;
  211. }
  212. .introduction-search {
  213. margin-top: 16px;
  214. height: 42px;
  215. width: 100%;
  216. background: #2c2c2d;
  217. border-radius: 8px;
  218. border: 1px solid #545660;
  219. display: flex;
  220. align-items: center;
  221. // padding: 12px 4px 4px 12px;
  222. img {
  223. margin: 12px 4px 12px 12px;
  224. vertical-align: top;
  225. width: 16px;
  226. }
  227. input {
  228. // margin-top: 8px;
  229. // vertical-align: top;
  230. height: 42px;
  231. line-height: 42px;
  232. font-size: 14px;
  233. color: #ffffff;
  234. flex: 1;
  235. width: calc(100% - 16px - 60px);
  236. }
  237. div {
  238. font-family: PingFangSC, PingFang SC;
  239. font-weight: 500;
  240. font-size: 14px;
  241. color: #3b7fff;
  242. line-height: 18px;
  243. text-align: left;
  244. font-style: normal;
  245. line-height: 37px;
  246. width: 60px;
  247. height: 34px;
  248. // background: linear-gradient(90deg, #38aefc 0%, #3b7fff 100%);
  249. float: right;
  250. text-align: center;
  251. border-radius: 1px;
  252. // border-left: 1px solid #7e8495;
  253. // margin: 4px 4px 0 0;
  254. margin: 0 4px 2px;
  255. }
  256. }
  257. .application {
  258. padding: 0 16px;
  259. margin-top: 24px;
  260. display: grid;
  261. grid-gap: 16px;
  262. grid-template-columns: repeat(3, 1fr);
  263. & > div {
  264. font-family: PingFangSC, PingFang SC;
  265. font-weight: 400;
  266. font-size: 14px;
  267. color: #ffffff;
  268. line-height: 20px;
  269. text-align: center;
  270. font-style: normal;
  271. background: #2c2c2d;
  272. border-radius: 14px;
  273. padding: 11px 0;
  274. }
  275. }
  276. .application-list {
  277. width: 100%;
  278. background: #2c2c2d;
  279. border-radius: 12px;
  280. color: #ffffff;
  281. margin-bottom: 15px;
  282. .application-list-top {
  283. padding: 16px;
  284. }
  285. .application-list-img {
  286. width: 42px;
  287. margin-right: 8px;
  288. border-radius: 12px;
  289. }
  290. .application-list-rigth {
  291. display: inline-block;
  292. overflow: hidden;
  293. width: calc(100% - 150px);
  294. }
  295. .application-list-title {
  296. vertical-align: top;
  297. font-weight: 500;
  298. font-size: 14px;
  299. color: #ffffff;
  300. font-style: normal;
  301. margin-right: 4px;
  302. .application-list-appname {
  303. max-width: calc(100% - 50px);
  304. display: inline-block;
  305. white-space: nowrap;
  306. text-overflow: ellipsis;
  307. overflow: hidden;
  308. }
  309. span {
  310. vertical-align: super;
  311. font-family: PingFangSC, PingFang SC;
  312. font-weight: 400;
  313. font-size: 10px;
  314. color: #3b7fff;
  315. line-height: 14px;
  316. text-align: left;
  317. font-style: normal;
  318. }
  319. }
  320. .application-list-tips {
  321. font-family: PingFangSC, PingFang SC;
  322. font-weight: 400;
  323. font-size: 12px;
  324. color: #999999;
  325. line-height: 16px;
  326. text-align: left;
  327. font-style: normal;
  328. margin-right: 4px;
  329. white-space: nowrap;
  330. text-overflow: ellipsis;
  331. overflow: hidden;
  332. }
  333. .application-list-btn {
  334. width: 82px;
  335. height: 32px;
  336. background: linear-gradient(90deg, #38aefc 0%, #3b7fff 100%);
  337. border-radius: 8px;
  338. color: #ffffff;
  339. line-height: 32px;
  340. padding: 0 0 0 8px;
  341. float: right;
  342. font-size: 12px;
  343. img {
  344. vertical-align: middle;
  345. margin-top: -1px;
  346. }
  347. }
  348. .application-list-bottom {
  349. padding: 12px;
  350. font-family: PingFangSC, PingFang SC;
  351. font-weight: 400;
  352. font-size: 14px;
  353. color: #ffffff;
  354. line-height: 20px;
  355. text-align: left;
  356. font-style: normal;
  357. background: #333333;
  358. border-radius: 0px 0px 12px 12px;
  359. }
  360. }
  361. .application-default {
  362. width: 100%;
  363. text-align: center;
  364. font-family: PingFangSC, PingFang SC;
  365. font-weight: 400;
  366. font-size: 12px;
  367. color: #999999;
  368. line-height: 18px;
  369. font-style: normal;
  370. }
  371. }
  372. .introduction-white {
  373. .introduction-title {
  374. color: #0a132b;
  375. }
  376. .introduction-tips {
  377. color: #0a132b;
  378. }
  379. .introduction-search {
  380. background: #ffffff;
  381. // border: 1px solid #ffffff;
  382. input {
  383. color: #0a132b;
  384. }
  385. div {
  386. // color: #ffffff;
  387. }
  388. }
  389. .application {
  390. & > div {
  391. color: #0a132b;
  392. background: #ffffff;
  393. }
  394. }
  395. .application-list {
  396. background: #ffffff;
  397. .application-list-title {
  398. color: #0a132b;
  399. span {
  400. color: #3b7fff;
  401. }
  402. }
  403. .application-list-tips {
  404. color: #666666;
  405. }
  406. .application-list-btn {
  407. background: linear-gradient(90deg, #38aefc 0%, #3b7fff 100%);
  408. color: #ffffff;
  409. overflow: hidden;
  410. }
  411. .application-list-bottom {
  412. color: #0a132b;
  413. background: #edeef0;
  414. }
  415. }
  416. }
  417. .empty{
  418. margin-top: 16px;
  419. .empty-title{
  420. font-family: PingFangSC, PingFang SC;
  421. font-weight: 400;
  422. font-size: 12px;
  423. color: #959799;
  424. line-height: 16px;
  425. text-align: left;
  426. font-style: normal;
  427. }
  428. .empty-img{
  429. height: 348px;
  430. margin-top: 24px;
  431. padding-left: 20px;
  432. &>img{
  433. width: 100%;
  434. height: 100%;
  435. }
  436. }
  437. .empty-tips{
  438. margin-top: 24px;
  439. padding-bottom: 68px;
  440. &>div:first-child{
  441. font-family: PingFangSC, PingFang SC;
  442. font-weight: 500;
  443. font-size: 14px;
  444. line-height: 20px;
  445. text-align: left;
  446. font-style: normal;
  447. }
  448. &>div:last-child{
  449. font-family: PingFangSC, PingFang SC;
  450. font-weight: 400;
  451. font-size: 12px;
  452. color: #959799;
  453. line-height: 16px;
  454. text-align: left;
  455. font-style: normal;
  456. }
  457. }
  458. .empty-btn{
  459. position: fixed;
  460. display: grid;
  461. font-family: PingFangSC, PingFang SC;
  462. font-weight: 400;
  463. font-size: 16px;
  464. color: #3B7FFF;
  465. height: 40px;
  466. line-height: 40px;
  467. text-align: center;
  468. font-style: normal;
  469. display: grid;
  470. grid-gap: 14px;
  471. grid-template-columns: repeat(2, 1fr);
  472. &>div:first-child{
  473. border-radius: 8px;
  474. border: 1px solid #3B7FFF;
  475. color: #3B7FFF;
  476. background: #f2f4f7;
  477. &.dark{
  478. background: #1C1C1E;
  479. }
  480. }
  481. &>div:last-child{
  482. color: #FFFFFF;
  483. background: #3B7FFF;
  484. border-radius: 8px;
  485. }
  486. }
  487. }
  488. </style>