youyue.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653
  1. <template>
  2. <view class="youyue">
  3. <view class="">
  4. <u-parse :content="memberInfo"></u-parse>
  5. </view>
  6. <!-- <view class="nav">
  7. <image src="http://t9.9026.com/imgs/logo@2x.png"></image>
  8. </view>
  9. <view class="title">
  10. IHG优悦会忠诚计划优悦随行悦享世界
  11. </view>
  12. <view class="detail">
  13. <view><text>IHG优悦会是洲际酒店集团的会员忠诚计划。在全球拥有超过1亿会员。</text></view>
  14. <view><text> 即刻加入HG优悦会,一键开启会员专享价及会员专属礼遇。轻松赚取积分,使用灵活的积分兑换及竞拍,畅享独特且多元的犒赏体验。</text></view>
  15. </view>
  16. <view class="boxitem">
  17. <text class="boxitemtitle">优悦会会员权益</text>
  18. </view>
  19. <view class="boxitem" style="border-top: none;">
  20. <text class="boxitemtitle">入会第一天起即可臻享礼遇</text>
  21. </view>
  22. <view class="boxitem" style="border-top: none;">
  23. <text class="boxitemtitle">赚取酒店积分兑换奖励住宿以及更多</text>
  24. <text class="boxitemcontent">积分不仅可以兑换体验,目录商品等,还可以兑换全球6000等多个目的地奖励住宿</text>
  25. <image src="/static/icon/loginicon1.png"></image>
  26. </view>
  27. <view class="boxitem" style="border-top: none;">
  28. <text class="boxitemtitle">会员专享价</text>
  29. <text class="boxitemcontent" style="margin-bottom: 30rpx;">直接预订可享受我们会员专属的优惠房价</text>
  30. <image src="/static/icon/loginicon2.png"></image>
  31. </view>
  32. <view class="boxitem" style="border-top: none;">
  33. <text class="boxitemtitle">会员促销</text>
  34. <text class="boxitemcontent" style="margin-bottom: 30rpx;">尽情享受会员促销,赚取更多奖励积分</text>
  35. <image src="/static/icon/loginicon3.png"></image>
  36. </view>
  37. <view class="item"><text class="itemtitle">畅享网络</text></view>
  38. <view class="itemLast">我们所有酒店均提供免费WIFI,让您始终顺畅连通</view> -->
  39. <view class="btn" @click="goOther">
  40. <text>立即加入会员</text>
  41. </view>
  42. <view class="logintitle">
  43. <view class="line"></view>
  44. <view class="logintype"><text>其他登录</text></view>
  45. <view class="line"></view>
  46. </view>
  47. <view class="typebtn" @click="getmsg">
  48. <view class="item">
  49. <image src="/static/icon/wechart.png" mode="scaleToFill"></image>
  50. <text>微信登录</text>
  51. </view>
  52. </view>
  53. <!-- <u-modal @close="closeMask" closeOnClickOverlay="true" :show="modal.show" :title="modal.title"
  54. :show-confirm-button="false">
  55. <view>
  56. <button class="avatar" open-type="chooseAvatar" @chooseavatar="handleChooseAvatar">
  57. <image class="user-avatar" style="height: 176rpx;width: 176rpx;border-radius: 50%;"
  58. :src="modal.avatar?modal.avatar:'/static/icon/avatar.png'" />
  59. </button>
  60. <input class="avatar" type="nickname" :value="modal.nickname" placeholder="填写昵称"
  61. @change="handleChangeNickname">
  62. <button class="confirm" @click="handleConfirmWechatUserInfo">提交</button>
  63. </view>
  64. </u-modal> -->
  65. <u-popup :show="modal.show" :round="10" mode="bottom" @close="close">
  66. <view class="popup-login">
  67. <view class="popup-login-top">
  68. <image style="width: 56rpx; height: 56rpx; margin-right: 20rpx; "
  69. src="https://t9.9026.com/imgs/loginLogo1.png" mode=""></image>
  70. <text>登录后体验更多功能</text>
  71. </view>
  72. <view class="popup-login-main">
  73. <button class="avatar" open-type="chooseAvatar" @chooseavatar="handleChooseAvatar">
  74. <image class="user-avatar" style="height: 176rpx;width: 176rpx;border-radius: 50%;"
  75. :src="modal.avatar?modal.avatar:'https://t9.9026.com/imgs/loginAvatar.png'" />
  76. </button>
  77. </view>
  78. <view class="popup-login-ipt">
  79. <input class="avatar" type="nickname" :value="modal.nickname" placeholder="输入昵称"
  80. @change="handleChangeNickname">
  81. </view>
  82. <view class="popup-login-btn" @click="handleConfirmWechatUserInfo">
  83. <button class="confirm">完成</button>
  84. </view>
  85. <view class="popup-login-text">
  86. <view>登录即代表已阅读并同意<text style="color: #FF6200;">服务协议、隐私协议</text></view>
  87. </view>
  88. </view>
  89. </u-popup>
  90. </view>
  91. </template>
  92. <script>
  93. export default {
  94. data() {
  95. return {
  96. //页面信息
  97. memberInfo:'',
  98. //跳转h5,小程序,其他页面
  99. jump_type: '',
  100. jump_config: {},
  101. //加入会员广告配置
  102. advise: '',
  103. imgBase64: '',
  104. isLoginOff: false,
  105. modal: {
  106. show: false,
  107. title: '用户信息获取',
  108. nickname: '',
  109. avatar: ''
  110. },
  111. code: '',
  112. encryptedData: '',
  113. iv: '',
  114. data: {}
  115. }
  116. },
  117. onLoad() {
  118. this.isLoginOff = this.$store.getters.userInfo
  119. this.advise = this.$store.getters.allset.add_member
  120. this.memberInfo = this.advise.value.member_info
  121. if(this.advise){
  122. this.jump_type = this.advise.value.member_info_jump_type
  123. if( this.jump_type == 1){
  124. this.jump_config = this.advise.value.member_info_h5_url
  125. }else if(this.jump_type == 2){
  126. this.jump_config.appid = this.advise.value.member_info_appid
  127. this.jump_config.path = this.advise.value.member_info_path
  128. }else if(this.jump_type == 3){
  129. this.jump_config =this.advise.value.member_info_other_path
  130. }
  131. }
  132. },
  133. methods: {
  134. // 跳转其他小程序
  135. goOther() {
  136. this.jumpHAppID(this.jump_type, this.jump_config)
  137. },
  138. jumpHAppID(id, urls) {
  139. if (id == 1) {
  140. const url = urls; // 跳转的外链
  141. const navtitle = 'H5'; // 这个标题是你自己可以设置的
  142. uni.navigateTo({
  143. // 跳转到webview页面
  144. url: `/pages/webview/webview?url=${url}&nav=${navtitle}`,
  145. success: () => {
  146. console.log('成功')
  147. },
  148. fail: (e) => {
  149. console.log(e, "失败")
  150. }
  151. });
  152. } else if (id == 2) {
  153. let _this = this
  154. let obj = urls;
  155. console.log(obj, '----->obj');
  156. wx.navigateToMiniProgram({
  157. appId: `${obj.appid}`, //appid
  158. path: `${obj.path}`, //path
  159. extraData: { //参数
  160. foo: 'bar'
  161. },
  162. // envVersion: 'develop', //开发版develop 开发版 trial 体验版 release 正式版
  163. success(res) {
  164. let page = _this.getPageUrl()
  165. console.log('成功', page)
  166. _this.$api.my.userMemberAdd({
  167. user_id: 0,
  168. page,
  169. }).then(res => {
  170. console.log(res.data);
  171. })
  172. // 打开成功
  173. },
  174. fail(e) {
  175. console.log(e, '失败')
  176. }
  177. })
  178. } else if (id == 3) {
  179. uni.redirectTo({
  180. url: urls,
  181. fail: (err) => {
  182. uni.reLaunch({
  183. url: urls
  184. })
  185. }
  186. })
  187. }
  188. },
  189. //关闭遮罩层
  190. closeMask() {
  191. this.modal.show = false
  192. },
  193. close() {
  194. this.modal.show = false
  195. },
  196. //提交微信名称和头像
  197. handleConfirmWechatUserInfo() {
  198. if (!this.modal.avatar) {
  199. this.$u.toast('请上传头像')
  200. return
  201. }
  202. if (!this.modal.nickname) {
  203. this.$u.toast('请填写昵称')
  204. return
  205. }
  206. this.$loading('数据提交中...')
  207. this.$api.my.update({
  208. avatar: this.modal.avatar,
  209. nickname: this.modal.nickname
  210. }).then(res => {
  211. this.$hideLoading()
  212. this.$store.dispatch('user/info', res.data)
  213. this.modal.show = false
  214. uni.switchTab({
  215. url: '/pages/my/my'
  216. })
  217. })
  218. },
  219. handleGetWechatUserInfo() {
  220. this.modal.show = true
  221. },
  222. // 微信获取头像
  223. handleChooseAvatar({
  224. detail
  225. }) {
  226. let _this = this
  227. uni.getFileSystemManager().readFile({
  228. filePath: detail.avatarUrl, // 选择图片返回的相对路径
  229. encoding: 'base64', // 编码格式
  230. success: res => { // 成功的回调
  231. uni.uploadFile({
  232. url: _this.$setting.BASE_URL + '/v1/user/uploadFile',
  233. // filePath: 'data:image/png;base64,' + res.data,
  234. filePath: detail.avatarUrl,
  235. name: 'file',
  236. success({
  237. data
  238. }) {
  239. const res = JSON.parse(data)
  240. const {
  241. url
  242. } = res.data
  243. _this.modal.avatar = url
  244. console.log('-->data', _this.modal.avatar)
  245. }
  246. })
  247. // this.modal.avatar = detail.avatarUrl
  248. // console.log('data:image/png;base64,' + res.data)
  249. }
  250. })
  251. },
  252. handleChangeNickname(res) {
  253. this.modal.nickname = res.detail.value
  254. },
  255. //获取当前页面路径
  256. getPageUrl() {
  257. const pages = getCurrentPages();
  258. console.log(pages, '--------->pages')
  259. if (pages.length == 1) {
  260. const currentPage = pages[0];
  261. let pageUrl = `/${currentPage.route}`;
  262. return pageUrl
  263. console.log('当前页面url:', pageUrl);
  264. } else {
  265. const currentPage = pages[pages.length - 1];
  266. let pageUrl = `/${currentPage.route}`;
  267. return pageUrl
  268. console.log('当前页面url:', pageUrl);
  269. }
  270. // pageUrl = this.pageUrl + '?id=' + this.detailID;
  271. },
  272. //登录
  273. getCode() {
  274. return new Promise((resolve, reject) => {
  275. uni.getUserInfo({
  276. success: loginRes => {
  277. this.data.encryptData = loginRes.encryptedData,
  278. this.data.iv = loginRes.iv
  279. resolve(this.data)
  280. }
  281. })
  282. })
  283. },
  284. //获取微信登录的code码
  285. getmsg() {
  286. if (this.isLoginOff) {
  287. uni.switchTab({
  288. url: '/pages/my/my'
  289. })
  290. } else {
  291. uni.login({
  292. provider: uni.$u.platform,
  293. success: res => {
  294. this.getCode().then((data) => {
  295. const params = {
  296. code: res.code,
  297. iv: data.iv,
  298. encryptData: data.encryptData
  299. }
  300. console.log(params);
  301. this.$api.my.myLogin(params).then(res => {
  302. if(res.code == 0){
  303. let {
  304. token
  305. } = res.data
  306. this.handleGetWechatUserInfo()
  307. // this.handleConfirmWechatUserInfo()
  308. this.$store.dispatch('user/token', token)
  309. }else{
  310. uni.showToast({
  311. icon:'none',
  312. title:res.msg
  313. })
  314. }
  315. })
  316. })
  317. }
  318. })
  319. }
  320. },
  321. }
  322. }
  323. </script>
  324. <style lang="scss" scoped>
  325. $pageColor:#F9F9F9;
  326. $bgColor:#FFFFFF;
  327. .youyue {
  328. height: 100%;
  329. background: $bgColor;
  330. padding: 0rpx 30rpx 140rpx 30rpx;
  331. position: relative;
  332. }
  333. .userinfo {
  334. position: absolute;
  335. top: 38rpx;
  336. left: 200rpx;
  337. .unlogin {
  338. width: 220rpx;
  339. font-size: 44rpx;
  340. font-family: PingFang-SC-Heavy, PingFang-SC;
  341. font-weight: 500;
  342. color: #FFFFFF;
  343. display: block;
  344. margin-top: 20rpx;
  345. }
  346. .username {
  347. width: 184rpx;
  348. height: 44rpx;
  349. font-size: 44rpx;
  350. font-family: PingFang-SC-Heavy, PingFang-SC;
  351. font-weight: 500;
  352. color: #FFFFFF;
  353. line-height: 44rpx;
  354. display: block;
  355. margin-bottom: 24rpx;
  356. }
  357. .userId {
  358. font-size: 32rpx;
  359. font-family: PingFang-SC-Medium, PingFang-SC;
  360. font-weight: 400;
  361. color: #FFFFFF;
  362. line-height: 32rpx;
  363. }
  364. }
  365. .nav {
  366. position: absolute;
  367. top: 0rpx;
  368. left: 0rpx;
  369. image {
  370. width: 750rpx;
  371. height: 142rpx;
  372. }
  373. }
  374. .title {
  375. width: 400rpx;
  376. height: 120rpx;
  377. font-size: 44rpx;
  378. font-family: PingFang-SC-Bold, PingFang-SC;
  379. font-weight: bold;
  380. color: #333333;
  381. line-height: 60rpx;
  382. margin-bottom: 64rpx;
  383. }
  384. .detail {
  385. width: 690rpx;
  386. height: 220rpx;
  387. margin-bottom: 64rpx;
  388. text {
  389. font-size: 32rpx;
  390. font-family: PingFang-SC-Medium, PingFang-SC;
  391. font-weight: 500;
  392. color: #333333;
  393. }
  394. }
  395. .item {
  396. margin: 40rpx 0;
  397. .itemtitle {
  398. font-size: 32rpx;
  399. font-family: PingFang-SC-Bold, PingFang-SC;
  400. font-weight: bold;
  401. color: #333333;
  402. }
  403. }
  404. .itemLast {
  405. width: 690rpx;
  406. font-size: 24rpx;
  407. font-family: PingFang-SC-Medium, PingFang-SC;
  408. font-weight: 500;
  409. color: #333333;
  410. margin-bottom: 64rpx;
  411. }
  412. .btn {
  413. width: 688rpx;
  414. height: 92rpx;
  415. background: linear-gradient(270deg, #FF6200 0%, #FF9342 100%);
  416. display: flex;
  417. align-items: center;
  418. justify-content: center;
  419. border-radius: 12rpx;
  420. text {
  421. font-size: 30rpx;
  422. font-family: PingFang-SC-Bold, PingFang-SC;
  423. font-weight: bold;
  424. color: #FFFFFF;
  425. }
  426. }
  427. .logintitle {
  428. height: 40rpx;
  429. width: 690rpx;
  430. margin-top: 64rpx;
  431. margin-bottom: 64rpx;
  432. display: flex;
  433. align-items: center;
  434. justify-content: space-between;
  435. .line {
  436. width: 240rpx;
  437. height: 2rpx;
  438. background: #EDEDED;
  439. border-radius: 1rpx;
  440. }
  441. .logintype {
  442. position: relative;
  443. top: -8rpx;
  444. text {
  445. font-size: 28rpx;
  446. font-family: PingFang-SC-Medium, PingFang-SC;
  447. font-weight: 500;
  448. color: #333333;
  449. }
  450. }
  451. }
  452. .typebtn {
  453. display: flex;
  454. align-items: center;
  455. justify-content: space-around;
  456. .item {
  457. width: 140rpx;
  458. height: 156rpx;
  459. display: flex;
  460. flex-direction: column;
  461. align-items: center;
  462. justify-content: center;
  463. image {
  464. width: 104rpx;
  465. height: 104rpx;
  466. margin-bottom: 12rpx;
  467. }
  468. text {
  469. display: block;
  470. font-size: 28rpx;
  471. font-family: PingFang-SC-Medium, PingFang-SC;
  472. font-weight: 500;
  473. color: #666666;
  474. }
  475. }
  476. }
  477. .boxitem {
  478. border-top: #F0F0F0 2rpx solid;
  479. border-bottom: #F0F0F0 2rpx solid;
  480. padding: 40rpx 0;
  481. position: relative;
  482. image {
  483. top: 35%;
  484. right: 0rpx;
  485. width: 96rpx;
  486. height: 96rpx;
  487. position: absolute;
  488. }
  489. .boxitemtitle {
  490. font-size: 32rpx;
  491. font-family: PingFang-SC-Bold, PingFang-SC;
  492. font-weight: bold;
  493. color: #333333;
  494. }
  495. .boxitemcontent {
  496. margin-top: 24rpx;
  497. width: 512rpx;
  498. display: block;
  499. font-size: 28rpx;
  500. font-family: PingFang-SC-Medium, PingFang-SC;
  501. font-weight: 500;
  502. color: #333333;
  503. }
  504. }
  505. //登录弹框
  506. .popup-login {
  507. width: 100%;
  508. height: 706rpx;
  509. background: #FFFFFF;
  510. box-shadow: 0rpx -10rpx 32rpx 0px rgba(0, 0, 0, 0.04);
  511. border-radius: 16rpx 16rpx 0px 0px;
  512. padding: 40rpx 64rpx 92rpx;
  513. .popup-login-top {
  514. display: flex;
  515. align-items: center;
  516. justify-content: flex-start;
  517. font-size: 30rpx;
  518. font-weight: bold;
  519. color: #000000;
  520. }
  521. .popup-login-main {
  522. width: 100%;
  523. display: flex;
  524. align-items: center;
  525. justify-content: center;
  526. margin-top: 62rpx;
  527. .avatar {
  528. width: 176rpx;
  529. height: 176rpx;
  530. border-radius: 50%;
  531. border: 0;
  532. background: transparent;
  533. &::after {
  534. border: none;
  535. }
  536. .user-avatar {
  537. object-fit: cover;
  538. object-position: center;
  539. }
  540. }
  541. }
  542. .popup-login-ipt {
  543. width: 100%;
  544. height: 88rpx;
  545. background: #F6F6F6;
  546. border-radius: 44rpx;
  547. display: flex;
  548. align-items: center;
  549. justify-content: center;
  550. margin-top: 48rpx;
  551. .avatar {
  552. width: 100%;
  553. height: 100%;
  554. text-align: center;
  555. font-size: 28rpx;
  556. font-weight: bold;
  557. color: #999999;
  558. }
  559. }
  560. .popup-login-btn {
  561. width: 100%;
  562. height: 88rpx;
  563. background: #1AAC1B;
  564. border-radius: 38rpx;
  565. display: flex;
  566. align-items: center;
  567. justify-content: center;
  568. margin-top: 32rpx;
  569. .confirm {
  570. border: 0;
  571. background: transparent;
  572. font-size: 28rpx;
  573. font-weight: bold;
  574. color: #FFFFFF;
  575. &::after {
  576. border: none;
  577. }
  578. }
  579. }
  580. .popup-login-text {
  581. display: flex;
  582. align-items: center;
  583. justify-content: center;
  584. margin-top: 32rpx;
  585. font-weight: bold;
  586. color: #999999;
  587. font-size: 22rpx;
  588. }
  589. }
  590. </style>