index.vue 14 KB

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