index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522
  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.$axios.$post('/public/v1/market/clientSearchSuggestApp', { pageSize: 100, pageNum: 1, appName: this.searchText }).then((res) => {
  171. this.appSeatchList = res.data.list
  172. this.isShow = false
  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. box-sizing: border-box;
  275. }
  276. }
  277. .application-list {
  278. width: 100%;
  279. background: #2c2c2d;
  280. border-radius: 12px;
  281. color: #ffffff;
  282. margin-bottom: 15px;
  283. .application-list-top {
  284. padding: 16px;
  285. }
  286. .application-list-img {
  287. width: 42px;
  288. margin-right: 8px;
  289. border-radius: 12px;
  290. }
  291. .application-list-rigth {
  292. display: inline-block;
  293. overflow: hidden;
  294. width: calc(100% - 150px);
  295. }
  296. .application-list-title {
  297. vertical-align: top;
  298. font-weight: 500;
  299. font-size: 14px;
  300. color: #ffffff;
  301. font-style: normal;
  302. margin-right: 4px;
  303. .application-list-appname {
  304. max-width: calc(100% - 50px);
  305. display: inline-block;
  306. white-space: nowrap;
  307. text-overflow: ellipsis;
  308. overflow: hidden;
  309. }
  310. span {
  311. vertical-align: super;
  312. font-family: PingFangSC, PingFang SC;
  313. font-weight: 400;
  314. font-size: 10px;
  315. color: #3b7fff;
  316. line-height: 14px;
  317. text-align: left;
  318. font-style: normal;
  319. }
  320. }
  321. .application-list-tips {
  322. font-family: PingFangSC, PingFang SC;
  323. font-weight: 400;
  324. font-size: 12px;
  325. color: #999999;
  326. line-height: 16px;
  327. text-align: left;
  328. font-style: normal;
  329. margin-right: 4px;
  330. white-space: nowrap;
  331. text-overflow: ellipsis;
  332. overflow: hidden;
  333. }
  334. .application-list-btn {
  335. width: 82px;
  336. height: 32px;
  337. background: linear-gradient(90deg, #38aefc 0%, #3b7fff 100%);
  338. border-radius: 8px;
  339. color: #ffffff;
  340. line-height: 32px;
  341. padding: 0 0 0 8px;
  342. float: right;
  343. font-size: 12px;
  344. img {
  345. vertical-align: middle;
  346. margin-top: -1px;
  347. }
  348. }
  349. .application-list-bottom {
  350. padding: 12px;
  351. font-family: PingFangSC, PingFang SC;
  352. font-weight: 400;
  353. font-size: 14px;
  354. color: #ffffff;
  355. line-height: 20px;
  356. text-align: left;
  357. font-style: normal;
  358. background: #333333;
  359. border-radius: 0px 0px 12px 12px;
  360. }
  361. }
  362. .application-default {
  363. width: 100%;
  364. text-align: center;
  365. font-family: PingFangSC, PingFang SC;
  366. font-weight: 400;
  367. font-size: 12px;
  368. color: #999999;
  369. line-height: 18px;
  370. font-style: normal;
  371. }
  372. }
  373. .introduction-white {
  374. .introduction-title {
  375. color: #0a132b;
  376. }
  377. .introduction-tips {
  378. color: #0a132b;
  379. }
  380. .introduction-search {
  381. background: #ffffff;
  382. // border: 1px solid #ffffff;
  383. input {
  384. color: #0a132b;
  385. }
  386. div {
  387. // color: #ffffff;
  388. }
  389. }
  390. .application {
  391. & > div {
  392. color: #0a132b;
  393. background: #ffffff;
  394. }
  395. }
  396. .application-list {
  397. background: #ffffff;
  398. .application-list-title {
  399. color: #0a132b;
  400. span {
  401. color: #3b7fff;
  402. }
  403. }
  404. .application-list-tips {
  405. color: #666666;
  406. }
  407. .application-list-btn {
  408. background: linear-gradient(90deg, #38aefc 0%, #3b7fff 100%);
  409. color: #ffffff;
  410. overflow: hidden;
  411. }
  412. .application-list-bottom {
  413. color: #0a132b;
  414. background: #edeef0;
  415. }
  416. }
  417. }
  418. .empty{
  419. margin-top: 16px;
  420. .empty-title{
  421. font-family: PingFangSC, PingFang SC;
  422. font-weight: 400;
  423. font-size: 12px;
  424. color: #959799;
  425. line-height: 16px;
  426. text-align: left;
  427. font-style: normal;
  428. }
  429. .empty-img{
  430. height: 348px;
  431. margin-top: 24px;
  432. padding-left: 20px;
  433. &>img{
  434. width: 100%;
  435. height: 100%;
  436. }
  437. }
  438. .empty-tips{
  439. margin-top: 24px;
  440. padding-bottom: 68px;
  441. &>div:first-child{
  442. font-family: PingFangSC, PingFang SC;
  443. font-weight: 500;
  444. font-size: 14px;
  445. line-height: 20px;
  446. text-align: left;
  447. font-style: normal;
  448. }
  449. &>div:last-child{
  450. font-family: PingFangSC, PingFang SC;
  451. font-weight: 400;
  452. font-size: 12px;
  453. color: #959799;
  454. line-height: 16px;
  455. text-align: left;
  456. font-style: normal;
  457. }
  458. }
  459. .empty-btn{
  460. position: fixed;
  461. display: grid;
  462. font-family: PingFangSC, PingFang SC;
  463. font-weight: 400;
  464. font-size: 16px;
  465. color: #3B7FFF;
  466. height: 40px;
  467. line-height: 40px;
  468. text-align: center;
  469. font-style: normal;
  470. display: grid;
  471. grid-gap: 14px;
  472. grid-template-columns: repeat(2, 1fr);
  473. &>div:first-child{
  474. border-radius: 8px;
  475. border: 1px solid #3B7FFF;
  476. color: #3B7FFF;
  477. background: #f2f4f7;
  478. &.dark{
  479. background: #1C1C1E;
  480. }
  481. }
  482. &>div:last-child{
  483. color: #FFFFFF;
  484. background: #3B7FFF;
  485. border-radius: 8px;
  486. }
  487. }
  488. }
  489. </style>