index.vue 20 KB

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