index.vue 12 KB

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