index.vue 20 KB

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