index.vue 20 KB

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