| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- <template>
- <view>
- <!--活动页面-->
- <view v-if="current == 0">
- <activity-view :rankList="rankList" :activityId="activityId"></activity-view>
- </view>
- <!--花积分-->
- <view v-if="current == 1">
- <points-view :activityId="activityId"></points-view>
- </view>
- <!--个人中心-->
- <view v-if="current == 2">
- <mine-view ref="mine" :activityId="activityId"></mine-view>
- </view>
- <view style="height: 100upx;"></view>
- <view class="footer-fixed">
- <bottom-bar-home ref="bar" @onTap="change"></bottom-bar-home>
- </view>
- </view>
- </template>
- <script>
- import {getUrlParams} from '@/common/utils/utils.js';
- import searchBar from "@/components/basic/search-bar.vue";
- import bottomBarHome from "@/components/basic/bottom-bar-home.vue";
- import activityView from "@/components/homeViews/activity-view.vue";
- import pointsView from "@/components/homeViews/points-view.vue";
- import mineView from "@/components/homeViews/mine-view.vue";
- export default {
- components: {
- searchBar,
- bottomBarHome,
- activityView,
- mineView,
- pointsView
- },
- data() {
- return {
- rankList:[],
- activityId: '',
- current: 0,
- }
- },
- onLoad(options) {
- this.activityId = options.activityId;
- this.authorization(options.current);
- this.addVisit(options.activityId);
- },
- onShow() {
- if (this.current == 0) {
- this.getRankList()
- }
-
- if (this.current == 2) {
- this.$refs.mine.getUserInfo();
- }
- },
- methods: {
- getRankList() {
- let params={
- activityId:this.activityId,
- type:0,//选手排名
- current:1,
- size:20
- }
- this.$u.api.activity.rankList(params).then(res => {
- this.rankList = res.records;
- })
- },
- async authorization(current) {
- let agenterId=uni.getStorageSync("agenterId")
- let params = getUrlParams(window.location.search);
- if (!this.$u.test.isEmpty(params.code)) {
- let res = await this.$u.api.wxInfo.getUserInfo({userCode: params.code});
- uni.setStorageSync("openid", res.openid);
- let datas = {
- nickName: res.nickname,
- avatar: res.headimgurl,
- gender: res.sex,
- openid: res.openid,
- unionid: res.unionid,
- province:res.province,
- city:res.city
- }
- if (!this.$u.test.isEmpty(agenterId)) {
- datas.agenterId=agenterId
- }
- let result = await this.$u.api.user.login(datas);
- if (result) {
- uni.setStorageSync("userId", result.id);
- if (!this.$u.test.isEmpty(current)) {
- this.$refs.bar.change(current);
- }
- }
- }
- },
- addVisit(id) {
- let params={
- id,
- userId:uni.getStorageSync("userId")
- }
- this.$u.api.activity.visit(params).then(res => {
- console.log(res);
- })
- },
- change(index) {
- this.current = index;
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .first {
- height: 300upx;
- width: 30%;
- border-radius: 30upx;
- box-shadow: -1upx -1upx 60upx #d8d8d8;
- }
- .second {
- height: 260upx;
- width: 27%;
- border-radius: 30upx;
- box-shadow: -1upx -1upx 60upx #d8d8d8;
- }
- .third {
- height: 260upx;
- width: 27%;
- border-radius: 30upx;
- box-shadow: -1upx -1upx 60upx #d8d8d8;
- }
- .hot-btn {
- color: #FFFFFF;
- line-height: 56upx;
- width: 70%;
- border-radius: 30upx;
- background-color: #583ce6;
- font-weight: bold;
- }
- </style>
|