index.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682
  1. <template>
  2. <view class="home">
  3. <MyNav title="洲际酒店集团中国西区" bgColor="" :backIcon="false"></MyNav>
  4. <!-- swiper -->
  5. <view class="home-swiper">
  6. <uni-swiper-dot :info="infoList" :current="current1" :mode="mode" :dots-styles="dotsStyles">
  7. <swiper class="swiper-box" @change="change1" circular>
  8. <swiper-item v-for="(item ,index) in infoList" :key="index">
  9. <view class="swiper-item" v-if="item.resource_type == 1"
  10. @click="$utils.jump({
  11. jump_type: item.jump_type,
  12. jump_config: item.jump_config
  13. })">
  14. <image style="width: 100%;height:592rpx;" :src="item.img" mode="aspectFill"></image>
  15. </view>
  16. <view class="swiper-item" v-if="item.resource_type == 2">
  17. <video id="swiperVideo" ref="swiperVideo" style="width: 100%; height: 592rpx;"
  18. :src="item.video_url" controls :enable-progress-gesture="false">
  19. </video>
  20. </view>
  21. </swiper-item>
  22. </swiper>
  23. </uni-swiper-dot>
  24. </view>
  25. <!-- 金刚图 -->
  26. <view class="home-nav">
  27. <view class="home-nav-item" v-for="(item,index) in navList" :key="index"
  28. @click="$utils.jump({
  29. jump_type: item.jump_type,
  30. jump_config: item.jump_config
  31. })">
  32. <image style="width: 101.96rpx;height: 103.96rpx;" :src="item.img" mode=""></image>
  33. <text style="color: #333;font-size: 24rpx;margin-top: 18rpx; ">{{item.title}}</text>
  34. </view>
  35. </view>
  36. <!-- 活动专区 -->
  37. <view class="home-special-area">
  38. <view class="home-special-area-left">
  39. <text>非凡西区</text>
  40. <view class="text-shadow"></view>
  41. <image style="width:16rpx;height: 16rpx;margin-left: 14rpx;" src="/static/icon/symbol.png" mode="">
  42. </image>
  43. </view>
  44. <view @click="goSpecialList" class="home-special-area-right">
  45. <text>全部</text>
  46. <image style="width: 12rpx; height: 20rpx;margin-left: 8rpx;" src="/static/icon/right01.png" mode="">
  47. </image>
  48. </view>
  49. </view>
  50. <!-- 活动图片 -->
  51. <view class="home-special-img">
  52. <template v-for="(item,index) in specialList" >
  53. <view class="ListItem" v-if="item.show_status" :key="index" @click="$utils.jump({
  54. jump_type: 3,
  55. jump_config: '/pages/index/active-detail/index',
  56. id: item.id,
  57. })">
  58. <image style="width: 312rpx;height: 200rpx; border-radius: 12rpx; "
  59. :src="item.banners?item.cover_img:'http://t9.9026.com/imgs/Kudosbg.png'" mode=""></image>
  60. <view class="kudosicon" @click.stop="kudosActive(item.id,index)">
  61. <image style="width:24rpx;height: 24rpx;" src="/static/icon/Kudos.png" v-if="item.is_like==0">
  62. </image>
  63. <image style="width:24rpx;height: 24rpx;" src="/static/icon/Kudos(1).png" v-if="item.is_like==1">
  64. </image>
  65. </view>
  66. <text style="color: #333;font-weight: bold;font-size: 28rpx;">{{item.title}}</text>
  67. </view>
  68. </template>
  69. </view>
  70. <!-- 广告图 -->
  71. <view class="home-banner" v-if="!isShowAdver">
  72. <view class="home-banner-img" v-if="in_page==1 && type == 1 ">
  73. <image style="width: 100%; height: 576rpx; border-radius: 12rpx;" :src="advData.img" mode=""
  74. @click="$utils.jump({
  75. jump_type: item.jump_type,
  76. jump_config: item.jump_config
  77. })"></image>
  78. <image @click="cleanCoverImg" class="img-clean" style="width: 20rpx; height: 20rpx; "
  79. src="/static/icon/clean.png" mode="">
  80. </image>
  81. </view>
  82. <view class="home-banner-img" v-if="in_page==1 && type == 2">
  83. <image class="banner-img" v-if="!isOpenVideo" @click="openVideoPlay"
  84. style="width: 100%; height: 576rpx; border-radius: 12rpx;" :src="videoCoverImg" mode=""></image>
  85. <image @click="cleanCoverImg" class="img-clean" style="width: 20rpx; height: 20rpx; "
  86. src="/static/icon/clean.png" mode="">
  87. </image>
  88. <video class="baner-video" id="myVideo" ref="myVideo"
  89. style="width: 100%; height: 576rpx;border-radius: 12rpx; " :src="videoSrc" controls
  90. :enable-progress-gesture="false">
  91. </video>
  92. </view>
  93. </view>
  94. <movable-area class="movableArea">
  95. <movable-view class="movableView" direction="all" x="630rpx" y="700rpx">
  96. <view class="img-IHg" @click="$utils.jumpJoinVip()">
  97. <image style="width: 64rpx; height: 58rpx; " src="/static/icon/vip.png" mode=""></image>
  98. </view>
  99. </movable-view>
  100. </movable-area>
  101. <!-- 广告的附图 -->
  102. <view class="home-attach"
  103. @click="$utils.jump({
  104. jump_type: advInsetImg.jump_type,
  105. jump_config: advInsetImg.jump_config
  106. })"
  107. >
  108. <image style="width: 690rpx;height: 156rpx;border-radius: 79rpx;" :src="advInsetImg.img" mode=""></image>
  109. </view>
  110. <!-- 酒店推荐 -->
  111. <view class="home-hotel home-special-area">
  112. <view class="home-special-area-left">
  113. <text>西区优品</text>
  114. <view class="text-shadow"></view>
  115. <image style="width:16rpx;height: 16rpx;margin-left: 14rpx;" src="/static/icon/symbol.png" mode="">
  116. </image>
  117. </view>
  118. </view>
  119. <!-- 酒店推荐图片 -->
  120. <view class="home-hotel-img">
  121. <view class="home-hotel-img-content">
  122. <!-- <view @click="produceDetail(item.id)" class="home-hotel-img-content-item" v-for="(item,index) in goodsList" :key="index"
  123. :style="{marginTop:item.marginTop || 0 }">
  124. <image class="home-hotel-img-content-item-img"
  125. :class="item.short?'home-hotel-img-content-item-img': 'homel-hotel-img-content-item-img-long' "
  126. :src="item.cover_img" mode=""></image>
  127. <view class="text">
  128. <text class="text-top">{{item.name}}</text>
  129. </view> -->
  130. <view class="home-hotel-img-content-item" v-for="(item,index) in goodsList" :key="index"
  131. :style="{marginTop:item.marginTop || 0 }">
  132. <image class="home-hotel-img-content-item-img"
  133. :class="item.short?'home-hotel-img-content-item-img': 'home-hotel-img-content-item-img-long' "
  134. :src="item.cover_img" mode=""></image>
  135. <view class="text">
  136. <text class="text-top">{{item.name}}</text>
  137. </view>
  138. </view>
  139. </view>
  140. <view class="home-hotel-img-more" @click="$utils.jump({
  141. jump_type: 4,
  142. jump_config: '/pages/goods/goods'
  143. })">
  144. <text>查看更多商品</text>
  145. </view>
  146. </view>
  147. <!-- 酒店品牌 -->
  148. <view class="home-brand home-special-area">
  149. <view class="home-special-area-left">
  150. <text>洲际酒店集团品牌</text>
  151. <view class="text-shadow"></view>
  152. <image style="width:16rpx;height: 16rpx;margin-left: 14rpx;" src="/static/icon/symbol.png" mode="">
  153. </image>
  154. </view>
  155. </view>
  156. <!-- 酒店品牌图片 -->
  157. <view class="home-brand-img">
  158. <uni-swiper-dot :info="info" mode="default" :current="current2" :dots-styles="dotsStylesBand">
  159. <swiper class="swiper-box" circular @change="change2">
  160. <swiper-item v-for="(items ,index) in info" :key="index">
  161. <view v-for="(item ,j) in items" :key="j" class="swiper-item"
  162. @click="$utils.jump({
  163. jump_type: item.jump_type,
  164. jump_config: item.jump_config
  165. })"
  166. >
  167. <image style="width:144rpx;height:142rpx;" :src="item.img" mode="aspectFill"></image>
  168. </view>
  169. </swiper-item>
  170. </swiper>
  171. </uni-swiper-dot>
  172. </view>
  173. <!-- 触底 -->
  174. <view class="home-bottom">
  175. <uni-load-more :status="status" color="#CCCCCC" :content-text="contentText" />
  176. </view>
  177. <!-- 弹窗广告 -->
  178. <uni-popup ref="popup" type="center">
  179. <view class="popup-banner">
  180. <image @click="$utils.jump({
  181. jump_type: popupData.jump_type,
  182. jump_config: popupData.jump_config
  183. })" style="width: 656rpx;height: 916rpx;border-radius: 12rpx;" :src="popupData.img">
  184. </image>
  185. <view class="popup-banner-clean" @click='closePopupBanner'>
  186. <image style="width: 20rpx; height: 20rpx; " src="/static/icon/clean.png" mode="">
  187. </view>
  188. </view>
  189. </uni-popup>
  190. <view style="height:168rpx; background-color: #f9f9f9; "></view>
  191. <tab-bar></tab-bar>
  192. </view>
  193. </template>
  194. <script>
  195. import TabBar from '../../components/TabBar/tabbar.vue'
  196. import SwiperBox from '../../components/SwiperBox/index.vue'
  197. import MyNav from "@/components/my-nav/my-nav.vue"
  198. export default {
  199. components: {
  200. TabBar,
  201. SwiperBox,
  202. MyNav
  203. },
  204. data() {
  205. return {
  206. //用户个人信息,判断是否登录
  207. admin: '',
  208. //获取token
  209. data: {},
  210. //录播图是展示视频1:图片2:视频
  211. resource_type: '',
  212. //广告弹框跳转
  213. jup_type: '',
  214. jump_config: '',
  215. //广告弹框图
  216. popupData:{},
  217. //弹窗的类型 1只弹一次首次 2就是每次都弹啊
  218. times_type:'',
  219. //弹窗的显示0不显示 1显示
  220. popupImgStatus:'',
  221. //视频封面图
  222. isOpenVideo: false,
  223. videoCoverImg: '',
  224. videoSrc: '',
  225. in_page: '',
  226. type: '',
  227. //隐藏广告图
  228. isShowAdver: false,
  229. //广告图
  230. advertis: '',
  231. advData: {},
  232. //广告附图展示图片
  233. advertisInsetImg: '',
  234. advInsetImg:{},
  235. //广告图展示图片:
  236. advertisImg: '',
  237. //广告图展示视频
  238. goodsList: [
  239. {
  240. cover_img:'https://t9.9026.com/imgs/11.png',
  241. name:'2023新春福兔系列礼盒 倾心甄选 待你拥有'
  242. },
  243. {
  244. cover_img:'https://t9.9026.com/imgs/22.png',
  245. name:'2023新春福兔系列礼盒 倾心甄选 待你拥有'
  246. },
  247. {
  248. cover_img:'https://t9.9026.com/imgs/33.png',
  249. name:'2023新春福兔系列礼盒 倾心甄选 待你拥有'
  250. },
  251. {
  252. cover_img:'https://t9.9026.com/imgs/44.png',
  253. name:'2023新春福兔系列礼盒 倾心甄选 待你拥有'
  254. },
  255. ],
  256. status: 'noMore',
  257. contentText: {
  258. contentdown: '查看更多',
  259. contentrefresh: '加载中',
  260. contentnomore: '—— 已经到底啦 ——'
  261. },
  262. infoList: [],
  263. //轮播图
  264. info: [],
  265. dotsStyles: {
  266. bottom: 24,
  267. backgroundColor: 'rgba(255, 255, 255, .3)',
  268. border: '1px rgba(255, 255, 255, .3) solid',
  269. color: '#fff',
  270. selectedBackgroundColor: 'rgba(255, 255, 255, 1)',
  271. selectedBorder: '1px rgba(255, 255, 255, 1) solid'
  272. },
  273. dotsStylesBand: {
  274. bottom: -24,
  275. backgroundColor: 'rgba(198, 198, 198, 1)',
  276. border: '1px rgba(0, 0, 0, .3) solid',
  277. color: '#fff',
  278. selectedBackgroundColor: 'rgba(151, 151, 151, 1)',
  279. selectedBorder: '1px rgba(0, 0, 0, .9) solid'
  280. },
  281. //指示点显示位置
  282. current1: 0,
  283. current2: 0,
  284. //指示点模式
  285. mode: 'dot',
  286. // 金刚图
  287. navList: [],
  288. //活动专区
  289. specialList: []
  290. }
  291. },
  292. onTabItemTap(e){
  293. console.log(e)
  294. },
  295. // 下拉刷新
  296. onPullDownRefresh() {
  297. setTimeout(() => {
  298. uni.stopPullDownRefresh();
  299. this.$store.dispatch('user/allset', null)
  300. this.getAllSet()
  301. this.getList()
  302. }, 1000);
  303. },
  304. onReady: function(res) {
  305. this.videoContext = uni.createVideoContext('myVideo')
  306. },
  307. onShow() {
  308. //获取token
  309. this.getmsg()
  310. this.admin = this.$store.getters.userInfo
  311. },
  312. onLoad() {
  313. this.getGoodsList()
  314. this.getAllSet()
  315. },
  316. methods: {
  317. // **************** Data ***************//
  318. //获取配置数据
  319. getAllSet() {
  320. this.$api.document.allSet().then(res => {
  321. this.$store.dispatch('user/allset', res.data)
  322. this.infoList = this.$store.getters.allset.banners
  323. this.navList = this.$store.getters.allset.nav_icon
  324. this.info = this.$store.getters.allset.partner
  325. //广告图
  326. this.advertis = this.$store.getters.allset.advertises.filter(item => {
  327. return item.in_page == 1
  328. })
  329. this.advData = this.advertis[0];
  330. if (this.advertis[0].type == 1) {
  331. this.in_page = 1
  332. this.type = 1
  333. this.advertisImg = this.advertis[0].img
  334. } else if (this.advertis[0].type == 2) {
  335. this.in_page = 1
  336. this.type = 2
  337. this.videoCoverImg = this.advertis[0].video_cover
  338. this.videoSrc = this.advertis[0].video
  339. }
  340. //胶囊图
  341. this.advertisInset = this.$store.getters.allset.advertises.filter(item => {
  342. return item.in_page == 2
  343. })
  344. this.advInsetImg = this.advertisInset[0]
  345. this.advertisInsetImg = this.advertisInset[0].img
  346. //广告弹框图
  347. this.popupData = this.$store.getters.allset.popup_ads[0]
  348. //弹窗是否展示
  349. this.popupImgStatus = this.popupData?.status
  350. this.times_type = this.popupData?.times_type
  351. //广告弹框跳转h5和小程序和内部
  352. this.jump_type = this.popupData?.jump_type,
  353. this.jump_config = this.popupData?.jump_config
  354. this.open()
  355. })
  356. },
  357. // 获取活动列表
  358. getList() {
  359. this.$api.active.getActiveList({
  360. page: 0,
  361. keyword: '',
  362. category_id: ''
  363. }).then(res => {
  364. console.log(res, '活动列表')
  365. if (res.code == 0) {
  366. this.specialList = res.data.data
  367. }
  368. })
  369. },
  370. //产品列表type:1,第三方购买产品
  371. getGoodsList(category_id) {
  372. this.$api.product.getProducts({
  373. type: 1,
  374. page: 0,
  375. }).then(res => {
  376. this.goodsList = res.data.data.slice(0,4)
  377. this.shortLong()
  378. console.log(this.goodsList,'------>产品图');
  379. })
  380. },
  381. //产品详情
  382. produceDetail(id){
  383. uni.navigateTo({
  384. url:`/pages/goods/goods-detail/index?id=${id}&type=1`
  385. })
  386. },
  387. // **************** Dev ***************//
  388. shortLong() {
  389. this.goodsList.forEach((item, index, arr) => {
  390. if (index % 4 === 0) {
  391. item.short = true
  392. }
  393. if (index % 4 === 1) {
  394. item.long = true
  395. }
  396. if (index % 4 === 2) {
  397. item.long = true
  398. item.marginTop = -68 + "rpx"
  399. }
  400. if (index % 4 === 3) {
  401. item.short = true
  402. }
  403. })
  404. },
  405. //隐藏图片
  406. cleanCoverImg() {
  407. this.isShowAdver = !this.isShowAdver
  408. },
  409. //打开弹框
  410. open() {
  411. console.log(this.popupImgStatus,this.times_type);
  412. // 从本地缓存中同步获取指定 key 对应的内容,用于判断是否是第一次打开应用
  413. if(this.popupImgStatus == 1){
  414. if(this.times_type == 1){
  415. //首次进入弹窗
  416. const value = uni.getStorageSync('launchFlag');
  417. if (value) {
  418. console.log('首次弹窗')
  419. } else {
  420. // 没有值,跳到引导页,并存储,下次打开就不会进去引导页
  421. uni.setStorage({
  422. key: 'launchFlag',
  423. data: true
  424. });
  425. this.$refs.popup.open('center')
  426. }
  427. }else{
  428. this.$refs.popup.open('center')//每次都弹
  429. }
  430. }else{
  431. this.$refs.popup.close()//不显示广告弹框
  432. }
  433. },
  434. //关闭弹框
  435. closePopupBanner() {
  436. this.$refs.popup.close()
  437. },
  438. //点击视频封面图片,播放视频
  439. openVideoPlay() {
  440. this.isOpenVideo = !this.isOpenVideo
  441. this.videoContext.play()
  442. },
  443. // **************** 跳转 ***************//
  444. //合同伙伴跳转h5和小程序
  445. goGoodsDetail(id, urls) {
  446. console.log(urls, '----->url');
  447. if (id == 1) {
  448. const url = urls; // 跳转的外链
  449. const navtitle = 'H5'; // 这个标题是你自己可以设置的
  450. uni.navigateTo({
  451. // 跳转到webview页面
  452. url: `/pages/webview/webview?url=${url}&nav=${navtitle}`,
  453. success: () => {
  454. console.log('成功')
  455. },
  456. fail: (e) => {
  457. console.log(e, "失败")
  458. }
  459. });
  460. } else if (id == 2) {
  461. let obj = JSON.parse(urls);
  462. wx.navigateToMiniProgram({
  463. appId: `${obj.appid}`, //appid
  464. path: `${obj.path}`, //path
  465. extraData: { //参数
  466. foo: 'bar'
  467. },
  468. // envVersion: 'develop', //开发版develop 开发版 trial 体验版 release 正式版
  469. success(res) {
  470. console.log('成功')
  471. // 打开成功
  472. },
  473. fail(e) {
  474. console.log(e, '失败')
  475. }
  476. })
  477. }
  478. },
  479. // 活动详情页
  480. activeDetail(id) {
  481. uni.navigateTo({
  482. url: '/pages/index/active-detail/index?id=' + id
  483. })
  484. },
  485. // 点赞活动
  486. kudosActive(id, index) {
  487. let beforeLike = this.specialList[index].is_like
  488. this.$api.active.kudos({
  489. activity_id: id
  490. }).then(res => {
  491. console.log(res, '点赞')
  492. if (res.code == 0) {
  493. if (beforeLike == 1) {
  494. this.specialList[index].is_like = 0
  495. uni.showToast({
  496. icon: 'none',
  497. title: '取消点赞'
  498. })
  499. } else {
  500. this.specialList[index].is_like = 1
  501. uni.showToast({
  502. icon: 'none',
  503. title: '点赞成功'
  504. })
  505. }
  506. }
  507. })
  508. },
  509. //跳转方法
  510. jumpHAppID(id, urls) {
  511. if (id == 1) {
  512. const url = urls; // 跳转的外链
  513. const navtitle = 'H5'; // 这个标题是你自己可以设置的
  514. uni.navigateTo({
  515. // 跳转到webview页面
  516. url: `/pages/webview/webview?url=${url}&nav=${navtitle}`,
  517. success: () => {
  518. console.log('成功')
  519. },
  520. fail: (e) => {
  521. console.log(e, "失败")
  522. }
  523. });
  524. } else if (id == 2) {
  525. let obj = JSON.parse(urls);
  526. wx.navigateToMiniProgram({
  527. appId: `${obj.appid}`, //appid
  528. path: `${obj.path}`, //path
  529. extraData: { //参数
  530. foo: 'bar'
  531. },
  532. // envVersion: 'develop', //开发版develop 开发版 trial 体验版 release 正式版
  533. success(res) {
  534. console.log('成功')
  535. // 打开成功
  536. },
  537. fail(e) {
  538. console.log(e, '失败')
  539. }
  540. })
  541. } else if (id == 3) {
  542. uni.redirectTo({
  543. url: urls,
  544. fail:(err)=>{
  545. uni.reLaunch({
  546. url: urls
  547. })
  548. }
  549. })
  550. }
  551. },
  552. // 跳转其他小程序
  553. goJoin() {
  554. wx.navigateToMiniProgram({
  555. appId: 'wx255b58f0992b3c53', //appid
  556. path: 'newUIMain/enrollment/enrollment', //path
  557. extraData: { //参数
  558. foo: 'bar'
  559. },
  560. // envVersion: 'develop', //开发版develop 开发版 trial 体验版 release 正式版
  561. success(res) {
  562. console.log('成功')
  563. // 打开成功
  564. },
  565. fail(e) {
  566. console.log(e, '失败')
  567. }
  568. })
  569. },
  570. // 跳转到h5页面
  571. goH5() {
  572. let inset = this.advertisInset[0].jump_type
  573. let inserPath = this.advertisInset[0].jump_config
  574. //跳转h5
  575. if (inset == 1) {
  576. const url = inserPath; // 跳转的外链
  577. const navtitle = 'H5'; // 这个标题是你自己可以设置的
  578. uni.navigateTo({
  579. // 跳转到webview页面
  580. url: `/pages/webview/webview?url=${url}&nav=${navtitle}`,
  581. success: () => {
  582. console.log('成功')
  583. },
  584. fail: (e) => {
  585. console.log(e, "失败")
  586. }
  587. });
  588. } else if (inset == 2) {
  589. let obj = JSON.parse(inserPath);
  590. wx.navigateToMiniProgram({
  591. appId: `${obj.appid}`, //appid
  592. path: `${obj.path}`, //path
  593. extraData: { //参数
  594. foo: 'bar'
  595. },
  596. // envVersion: 'develop', //开发版develop 开发版 trial 体验版 release 正式版
  597. success(res) {
  598. console.log('成功')
  599. // 打开成功
  600. },
  601. fail(e) {
  602. console.log(e, '失败')
  603. }
  604. })
  605. }
  606. },
  607. //产品列表
  608. goProduceList() {
  609. uni.navigateTo({
  610. url: '/pages/goods/goods'
  611. })
  612. },
  613. //活动列表
  614. goSpecialList() {
  615. uni.navigateTo({
  616. url: '/pages/index/active-list/index'
  617. })
  618. },
  619. // 切换轮播图指示点
  620. change1(e) {
  621. this.current1 = e.detail.current;
  622. },
  623. change2(e) {
  624. this.current2 = e.detail.current;
  625. },
  626. getCode() {
  627. return new Promise((resolve, reject) => {
  628. uni.getUserInfo({
  629. success: loginRes => {
  630. console.log(loginRes);
  631. this.data.encryptData = loginRes.encryptedData,
  632. this.data.iv = loginRes.iv
  633. resolve(this.data)
  634. }
  635. })
  636. })
  637. },
  638. //获取微信登录的code码
  639. getmsg() {
  640. uni.login({
  641. provider: uni.$u.platform,
  642. success: res => {
  643. console.log(res, '------->res');
  644. this.getCode().then((data) => {
  645. console.log(this.data, '------>data');
  646. const params = {
  647. code: res.code,
  648. iv: data.iv,
  649. encryptData: data.encryptData
  650. }
  651. console.log(params);
  652. this.$api.my.myLogin(params).then(res => {
  653. let {
  654. token
  655. } = res.data
  656. this.$store.dispatch('user/token', token)
  657. // 获取活动列表
  658. this.getList()
  659. })
  660. })
  661. }
  662. })
  663. }
  664. },
  665. }
  666. </script>
  667. <style lang="scss" src="./index.scss" scoped></style>